本文整理汇总了Java中net.minecraft.util.ResourceLocation.equals方法的典型用法代码示例。如果您正苦于以下问题:Java ResourceLocation.equals方法的具体用法?Java ResourceLocation.equals怎么用?Java ResourceLocation.equals使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类net.minecraft.util.ResourceLocation
的用法示例。
在下文中一共展示了ResourceLocation.equals方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: onLootTableLoad
import net.minecraft.util.ResourceLocation; //导入方法依赖的package包/类
@SubscribeEvent
public static void onLootTableLoad(LootTableLoadEvent event) {
ResourceLocation tableName = event.getName();
LootPool pool = null;
int bandage = 0, plaster = 0, morphine = 0;
if (tableName.equals(LootTableList.CHESTS_SPAWN_BONUS_CHEST)) {
pool = event.getTable().getPool("main");
bandage = 8;
plaster = 16;
morphine = 4;
} else if (tableName.equals(LootTableList.CHESTS_STRONGHOLD_CORRIDOR) || tableName.equals(LootTableList.CHESTS_STRONGHOLD_CROSSING) || tableName.equals(LootTableList.CHESTS_ABANDONED_MINESHAFT)) {
pool = event.getTable().getPool("main");
bandage = 20;
plaster = 24;
morphine = 8;
}
if (pool != null) {
pool.addEntry(new LootEntryItem(FirstAidItems.BANDAGE, bandage, 0, new SetCount[]{new SetCount(new LootCondition[0], new RandomValueRange(1, 3))}, new LootCondition[0], FirstAid.MODID + "bandage"));
pool.addEntry(new LootEntryItem(FirstAidItems.PLASTER, plaster, 0, new SetCount[]{new SetCount(new LootCondition[0], new RandomValueRange(1, 5))}, new LootCondition[0], FirstAid.MODID + "plaster"));
pool.addEntry(new LootEntryItem(FirstAidItems.MORPHINE, morphine, 0, new SetCount[]{new SetCount(new LootCondition[0], new RandomValueRange(1, 2))}, new LootCondition[0], FirstAid.MODID + "morphine"));
}
}
示例2: loadModel
import net.minecraft.util.ResourceLocation; //导入方法依赖的package包/类
public IModel loadModel(ResourceLocation modelLocation) throws Exception
{
if(modelLocation.equals(MODEL_MISSING) && loader.missingModel != null)
{
return loader.getMissingModel();
}
String modelPath = modelLocation.getResourcePath();
if(modelLocation.getResourcePath().startsWith("models/"))
{
modelPath = modelPath.substring("models/".length());
}
ResourceLocation armatureLocation = new ResourceLocation(modelLocation.getResourceDomain(), "armatures/" + modelPath + ".json");
ModelBlockAnimation animation = ModelBlockAnimation.loadVanillaAnimation(loader.resourceManager, armatureLocation);
ModelBlock model = loader.loadModel(modelLocation);
IModel iModel = loader.new VanillaModelWrapper(modelLocation, model, false, animation);
if(loader.missingModel == null && modelLocation.equals(MODEL_MISSING))
{
loader.missingModel = iModel;
}
return iModel;
}
示例3: getParentLocation
import net.minecraft.util.ResourceLocation; //导入方法依赖的package包/类
private ResourceLocation getParentLocation(ResourceLocation p_177576_1_)
{
for (Entry<ResourceLocation, ModelBlock> entry : this.models.entrySet())
{
ModelBlock modelblock = (ModelBlock)entry.getValue();
if (modelblock != null && p_177576_1_.equals(modelblock.getParentLocation()))
{
return (ResourceLocation)entry.getKey();
}
}
return null;
}
示例4: getParentLocation
import net.minecraft.util.ResourceLocation; //导入方法依赖的package包/类
@Nullable
private ResourceLocation getParentLocation(ResourceLocation p_177576_1_)
{
for (Entry<ResourceLocation, ModelBlock> entry : this.models.entrySet())
{
ModelBlock modelblock = (ModelBlock)entry.getValue();
if (modelblock != null && p_177576_1_.equals(modelblock.getParentLocation()))
{
return (ResourceLocation)entry.getKey();
}
}
return null;
}
示例5: isValid
import net.minecraft.util.ResourceLocation; //导入方法依赖的package包/类
public boolean isValid(Item stack){
for(ResourceLocation location: blacklistItems){
if(location.equals(stack.getRegistryName()))
return false;
}
return (isSword(stack) || isTool(stack));
}
示例6: isSword
import net.minecraft.util.ResourceLocation; //导入方法依赖的package包/类
public boolean isSword(Item stack){
for(ResourceLocation location: swordItems){
if(location.equals(stack.getRegistryName()))
return true;
}
return stack instanceof ItemSword;
}
示例7: isTool
import net.minecraft.util.ResourceLocation; //导入方法依赖的package包/类
public boolean isTool(Item stack){
for(ResourceLocation location: toolItems){
if(location.equals(stack.getRegistryName()))
return true;
}
return stack instanceof ItemTool;
}
示例8: addLoot
import net.minecraft.util.ResourceLocation; //导入方法依赖的package包/类
public static void addLoot(LootTable table, ResourceLocation tableName)
{
if(BBConfig.spawnMarshmallows)
{
if(tableName.equals(LootTableList.CHESTS_SIMPLE_DUNGEON))
{
LootUtil.addItemToTable(table, "main", RegisterItems.marshmallow, 100, 1, 5);
}
else if(tableName.equals(LootTableList.CHESTS_DESERT_PYRAMID))
{
LootUtil.addItemToTable(table, "main", RegisterItems.marshmallow, 200, 1, 10);
}
else if(tableName.equals(LootTableList.CHESTS_JUNGLE_TEMPLE))
{
LootUtil.addItemToTable(table, "main", RegisterItems.marshmallow, 200, 1, 10);
}
else if(tableName.equals(LootTableList.CHESTS_STRONGHOLD_CROSSING))
{
LootUtil.addItemToTable(table, "main", RegisterItems.marshmallow, 150, 1, 12);
}
else if(tableName.equals(LootTableList.CHESTS_STRONGHOLD_CORRIDOR))
{
LootUtil.addItemToTable(table, "main", RegisterItems.marshmallow, 150, 1, 12);
}
else if(tableName.equals(LootTableList.CHESTS_ABANDONED_MINESHAFT))
{
LootUtil.addItemToTable(table, "main", RegisterItems.marshmallow, 150, 1, 12);
}
}
}
示例9: putObject
import net.minecraft.util.ResourceLocation; //导入方法依赖的package包/类
/**
* Register an object on this registry.
*/
@Override
@Deprecated
public void putObject(ResourceLocation name, I thing)
{
if (name == null)
{
throw new NullPointerException("Can't use a null-name for the registry.");
}
if (thing == null)
{
throw new NullPointerException("Can't add null-object to the registry.");
}
ResourceLocation existingName = getNameForObject(thing);
if (existingName == null)
{
FMLLog.bigWarning("Ignoring putObject(%s, %s), not resolvable", name, thing);
}
else if (existingName.equals(name))
{
FMLLog.bigWarning("Ignoring putObject(%s, %s), already added", name, thing);
}
else
{
FMLLog.bigWarning("Ignoring putObject(%s, %s), adding alias to %s instead", name, thing, existingName);
addAlias(name, existingName);
}
}
示例10: tryRecoverTileState
import net.minecraft.util.ResourceLocation; //导入方法依赖的package包/类
@net.minecraftforge.fml.common.Optional.Method(modid = "ic2")
private static Tuple<IBlockState, TileEntity> tryRecoverTileState(IBlockState state, @Nonnull NBTTagCompound matchTag, BlockArray.TileInstantiateContext context) {
if(getTeClassIc2 == null || getITeBlockIc2 == null || getTeBlockState == null
|| getITEgetSupportedFacings == null || facingPropertyField == null) {
return null;
}
ResourceLocation ic2TileBlock = new ResourceLocation("ic2", "te");
if(ic2TileBlock.equals(state.getBlock().getRegistryName())) {
if(matchTag.hasKey("id")) {
ResourceLocation key = new ResourceLocation(matchTag.getString("id"));
if(key.getResourceDomain().equalsIgnoreCase("ic2")) {
String name = key.getResourcePath();
try {
Object o = getITeBlockIc2.invoke(null, name);
Object oClazz = getTeClassIc2.invoke(o);
if(oClazz instanceof Class) {
TileEntity te = (TileEntity) ((Class) oClazz).newInstance();
if(te != null) {
context.apply(te);
te.readFromNBT(matchTag);
IBlockState st = (IBlockState) getTeBlockState.invoke(te);
EnumFacing applicable = Iterables.getFirst((Collection<EnumFacing>) getITEgetSupportedFacings.invoke(o), EnumFacing.NORTH);
st = st.withProperty(facingPropertyField, applicable);
return new Tuple<>(st, te);
}
}
} catch (Throwable tr) {
tr.printStackTrace();
}
}
}
}
return null;
}
示例11: isStringEntityName
import net.minecraft.util.ResourceLocation; //导入方法依赖的package包/类
public static boolean isStringEntityName(Entity entityIn, ResourceLocation entityName)
{
ResourceLocation resourcelocation = func_191306_a(entityIn.getClass());
return resourcelocation != null ? resourcelocation.equals(entityName) : (entityIn instanceof EntityPlayer ? field_191310_e.equals(entityName) : (entityIn instanceof EntityLightningBolt ? field_191307_a.equals(entityName) : false));
}
示例12: loadBlocks
import net.minecraft.util.ResourceLocation; //导入方法依赖的package包/类
private void loadBlocks()
{
BlockStateMapper blockstatemapper = this.blockModelShapes.getBlockStateMapper();
for (Block block : Block.REGISTRY)
{
for (final ResourceLocation resourcelocation : blockstatemapper.getBlockstateLocations(block))
{
try
{
ModelBlockDefinition modelblockdefinition = this.getModelBlockDefinition(resourcelocation);
Map<IBlockState, ModelResourceLocation> map = blockstatemapper.getVariants(block);
if (modelblockdefinition.hasMultipartData())
{
Collection<ModelResourceLocation> collection = Sets.newHashSet(map.values());
modelblockdefinition.getMultipartData().setStateContainer(block.getBlockState());
Collection<ModelResourceLocation> collection1 = (Collection)this.multipartVariantMap.get(modelblockdefinition);
if (collection1 == null)
{
collection1 = Lists.<ModelResourceLocation>newArrayList();
this.multipartVariantMap.put(modelblockdefinition, collection1);
}
collection1.addAll(Lists.newArrayList(Iterables.filter(collection, new Predicate<ModelResourceLocation>()
{
public boolean apply(@Nullable ModelResourceLocation p_apply_1_)
{
return resourcelocation.equals(p_apply_1_);
}
})));
}
for (Entry<IBlockState, ModelResourceLocation> entry : map.entrySet())
{
ModelResourceLocation modelresourcelocation = (ModelResourceLocation)entry.getValue();
if (resourcelocation.equals(modelresourcelocation))
{
try
{
this.variants.put(modelresourcelocation, modelblockdefinition.getVariant(modelresourcelocation.getVariant()));
}
catch (RuntimeException var12)
{
if (!modelblockdefinition.hasMultipartData())
{
LOGGER.warn("Unable to load variant: {} from {}", new Object[] {modelresourcelocation.getVariant(), modelresourcelocation});
}
}
}
}
}
catch (Exception exception)
{
LOGGER.warn("Unable to load definition {}", new Object[] {resourcelocation, exception});
}
}
}
}
示例13: WeightedRandomModel
import net.minecraft.util.ResourceLocation; //导入方法依赖的package包/类
public WeightedRandomModel(ResourceLocation parent, VariantList variants) throws Exception
{
this.variants = variants.getVariantList();
ImmutableList.Builder<Pair<IModel, IModelState>> builder = ImmutableList.builder();
for (Variant v : this.variants)
{
ResourceLocation loc = v.getModelLocation();
locations.add(loc);
/*
* Vanilla eats this, which makes it only show variants that have models.
* But that doesn't help debugging, so throw the exception
*/
IModel model;
if(loc.equals(MODEL_MISSING))
{
// explicit missing location, happens if blockstate has "model"=null
model = ModelLoaderRegistry.getMissingModel();
}
else
{
model = ModelLoaderRegistry.getModel(loc);
}
// FIXME: is this the place? messes up dependency and texture resolution
model = v.process(model);
for(ResourceLocation location : model.getDependencies())
{
ModelLoaderRegistry.getModelOrMissing(location);
}
//FMLLog.getLogger().error("Exception resolving indirect dependencies for model" + loc, e);
textures.addAll(model.getTextures()); // Kick this, just in case.
models.add(model);
builder.add(Pair.of(model, v.getState()));
}
if (models.size() == 0) //If all variants are missing, add one with the missing model and default rotation.
{
// FIXME: log this?
IModel missing = ModelLoaderRegistry.getMissingModel();
models.add(missing);
builder.add(Pair.<IModel, IModelState>of(missing, TRSRTransformation.identity()));
}
defaultState = new MultiModelState(builder.build());
}
示例14: loadBlock
import net.minecraft.util.ResourceLocation; //导入方法依赖的package包/类
protected void loadBlock(BlockStateMapper blockstatemapper, Block block, final ResourceLocation resourcelocation)
{
{
{
{
ModelBlockDefinition modelblockdefinition = this.getModelBlockDefinition(resourcelocation);
Map<IBlockState, ModelResourceLocation> map = blockstatemapper.getVariants(block);
if (modelblockdefinition.hasMultipartData())
{
Collection<ModelResourceLocation> collection = Sets.newHashSet(map.values());
modelblockdefinition.getMultipartData().setStateContainer(block.getBlockState());
registerMultipartVariant(modelblockdefinition, Lists.newArrayList(Iterables.filter(collection, new Predicate<ModelResourceLocation>()
{
public boolean apply(@Nullable ModelResourceLocation p_apply_1_)
{
return resourcelocation.equals(p_apply_1_);
}
})));
}
for (Entry<IBlockState, ModelResourceLocation> entry : map.entrySet())
{
ModelResourceLocation modelresourcelocation = (ModelResourceLocation)entry.getValue();
if (resourcelocation.equals(modelresourcelocation))
{
try
{
this.registerVariant(modelblockdefinition, modelresourcelocation);
}
catch (RuntimeException var12)
{
if (!modelblockdefinition.hasMultipartData())
{
LOGGER.warn("Unable to load variant: " + modelresourcelocation.getVariant() + " from " + modelresourcelocation, var12);
}
}
}
}
}
}
}
}