Java Code Examples for net.minecraft.util.ResourceLocation#equals()

The following examples show how to use net.minecraft.util.ResourceLocation#equals() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: AbstractBiomeFilter.java    From EnderZoo with Creative Commons Zero v1.0 Universal 6 votes vote down vote up
protected boolean isExcluded(Biome candidate) {
  for (BiomeDictionary.Type exType : typeExcludes) {
    if (BiomeDictionary.hasType(candidate, exType)) {
      if (Config.spawnConfigPrintDetailedOutput) {
        System.out.print("Excluded " + candidate.getBiomeName() + ", ");
      }
      return true;

    }
  }
  for (ResourceLocation exName : nameExcludes) {
    if (exName != null && exName.equals(candidate.getRegistryName())) {
      System.out.print("Excluded " + candidate.getRegistryName() + ", ");
      return false;
    }
  }
  return false;
}
 
Example 2
Source File: SignalsConfig.java    From Signals with GNU General Public License v3.0 5 votes vote down vote up
public static boolean isBlacklisted(EntityMinecart cart, String[] config){
    if(config.length == 0) return false;
    EntityEntry entry = EntityRegistry.getEntry(cart.getClass());
    ResourceLocation cartID = ForgeRegistries.ENTITIES.getKey(entry);
    for(String blacklist : config) {
        if(cartID.equals(new ResourceLocation(blacklist))) {
            return true;
        }
    }
    return false;
}
 
Example 3
Source File: BakedModelInserter.java    From enderutilities with GNU Lesser General Public License v3.0 5 votes vote down vote up
@Override
public IModel loadModel(ResourceLocation modelLocation) throws Exception
{
    if (modelLocation.equals(FAKE_LOCATION_FILTERED))
    {
        return new ModelInserterFiltered();
    }
    else
    {
        return new ModelInserterNormal();
    }
}
 
Example 4
Source File: BlockUtils.java    From enderutilities with GNU Lesser General Public License v3.0 5 votes vote down vote up
public static Set<IBlockState> getMatchingBlockStatesForString(String blockStateString)
{
    Set<IBlockState> validStates = new HashSet<>();
    ResourceLocation air = new ResourceLocation("minecraft:air");
    int index = blockStateString.indexOf('[');
    String name = index > 0 ? blockStateString.substring(0, index) : blockStateString;
    ResourceLocation key = new ResourceLocation(name);
    Block block = ForgeRegistries.BLOCKS.getValue(key);

    if (block != null && (block != Blocks.AIR || key.equals(air)))
    {
        // First get all valid states for this block
        Collection<IBlockState> statesTmp = block.getBlockState().getValidStates();
        // Then get the list of properties and their values in the given name (if any)
        List<Pair<String, String>> props = getBlockStatePropertiesFromString(blockStateString);

        // ... and then filter the list of all valid states by the provided properties and their values
        if (props.isEmpty() == false)
        {
            for (Pair<String, String> pair : props)
            {
                statesTmp = getFilteredStates(statesTmp, pair.getLeft(), pair.getRight());
            }
        }

        validStates.addAll(statesTmp);
    }
    else
    {
        EnderUtilities.logger.warn("BlockUtils.getMatchingBlockStatesForString(): Invalid block state string '{}'", blockStateString);
    }

    return validStates;
}
 
Example 5
Source File: ResourceDataWalker.java    From OpenModsLib with MIT License 5 votes vote down vote up
@Override
public NBTTagCompound process(IDataFixer fixer, NBTTagCompound compound, int version) {
	final ResourceLocation id = new ResourceLocation(compound.getString(idTag));
	final ResourceLocation expected = entry.getRegistryName();
	if (id.equals(expected)) return processImpl(fixer, compound, version);

	return compound;
}
 
Example 6
Source File: BakedModelInserter.java    From enderutilities with GNU Lesser General Public License v3.0 4 votes vote down vote up
@Override
public boolean accepts(ResourceLocation modelLocation)
{
    return modelLocation.equals(FAKE_LOCATION_NORMAL) || modelLocation.equals(FAKE_LOCATION_FILTERED);
}
 
Example 7
Source File: ModelCamouflageBlock.java    From enderutilities with GNU Lesser General Public License v3.0 4 votes vote down vote up
@Override
public IModel loadModel(ResourceLocation modelLocation) throws Exception
{
    if (modelLocation.equals(LOC_ELEVATOR_NORMAL))
    {
        return new ModelElevator(EnderUtilitiesBlocks.ELEVATOR.getDefaultState(), "_full");
    }
    else if (modelLocation.equals(LOC_ELEVATOR_SLAB_TOP))
    {
        return new ModelElevator(EnderUtilitiesBlocks.ELEVATOR_SLAB.getDefaultState(), "_slab_top");
    }
    else if (modelLocation.equals(LOC_ELEVATOR_SLAB_BOTTOM))
    {
        return new ModelElevator(EnderUtilitiesBlocks.ELEVATOR_SLAB.getDefaultState(), "_slab_bottom");
    }
    else if (modelLocation.equals(LOC_ELEVATOR_LAYER_TOP))
    {
        return new ModelElevator(EnderUtilitiesBlocks.ELEVATOR_LAYER.getDefaultState(), "_layer_top");
    }
    else if (modelLocation.equals(LOC_ELEVATOR_LAYER_BOTTOM))
    {
        return new ModelElevator(EnderUtilitiesBlocks.ELEVATOR_LAYER.getDefaultState(), "_layer_bottom");
    }
    else if (modelLocation.equals(LOC_PORTAL_FRAME))
    {
        return new ModelCamouflageBlockBase(new ResourceLocation("minecraft:block/cube_all"), null);
    }
    else if (modelLocation.equals(LOC_DRAW_BRIDGE_N) || modelLocation.equals(LOC_DRAW_BRIDGE_A))
    {
        ResourceLocation baseModelLocation = new ResourceLocation(Reference.MOD_ID, "block/orientable_directional_individual");
        return new ModelCamouflageBlockBase(baseModelLocation, null);
    }
    else if (modelLocation.equals(LOC_BARREL_NORMAL))
    {
        // The Barrel handles both normal and overlay models with the same custom model
        return new ModelCamouflageBlockBase(ModelLoaderBarrel.LOCATION_NORMAL, ModelLoaderBarrel.LOCATION_NORMAL);
    }
    else if (modelLocation.equals(LOC_BARREL_CREATIVE))
    {
        // The Barrel handles both normal and overlay models with the same custom model
        return new ModelCamouflageBlockBase(ModelLoaderBarrel.LOCATION_CREATIVE, ModelLoaderBarrel.LOCATION_CREATIVE);
    }

    return ModelLoaderRegistry.getMissingModel();
}
 
Example 8
Source File: BakedModelBarrel.java    From enderutilities with GNU Lesser General Public License v3.0 4 votes vote down vote up
@Override
public boolean accepts(ResourceLocation modelLocation)
{
    return modelLocation.equals(FAKE_LOCATION_NORMAL) || modelLocation.equals(FAKE_LOCATION_CREATIVE);
}
 
Example 9
Source File: ModelNullifierBaked.java    From enderutilities with GNU Lesser General Public License v3.0 4 votes vote down vote up
@Override
public boolean accepts(ResourceLocation modelLocation)
{
    return modelLocation.equals(FAKE_LOCATION);
}