下面列出了net.minecraft.util.ResourceLocation#equals ( ) 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。
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;
}
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;
}
@Override
public IModel loadModel(ResourceLocation modelLocation) throws Exception
{
if (modelLocation.equals(FAKE_LOCATION_FILTERED))
{
return new ModelInserterFiltered();
}
else
{
return new ModelInserterNormal();
}
}
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;
}
@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;
}
@Override
public boolean accepts(ResourceLocation modelLocation)
{
return modelLocation.equals(FAKE_LOCATION_NORMAL) || modelLocation.equals(FAKE_LOCATION_FILTERED);
}
@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();
}
@Override
public boolean accepts(ResourceLocation modelLocation)
{
return modelLocation.equals(FAKE_LOCATION_NORMAL) || modelLocation.equals(FAKE_LOCATION_CREATIVE);
}
@Override
public boolean accepts(ResourceLocation modelLocation)
{
return modelLocation.equals(FAKE_LOCATION);
}