net.minecraft.util.ResourceLocation.equals()方法的使用及代码示例

x33g5p2x  于2022-01-28 转载在 其他  
字(8.6k)|赞(0)|评价(0)|浏览(65)

本文整理了Java中net.minecraft.util.ResourceLocation.equals方法的一些代码示例,展示了ResourceLocation.equals的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。ResourceLocation.equals方法的具体详情如下:
包路径:net.minecraft.util.ResourceLocation
类名称:ResourceLocation
方法名:equals

ResourceLocation.equals介绍

暂无

代码示例

代码示例来源:origin: SlimeKnights/TinkersConstruct

@Override
public boolean equals(Object o) {
 if(this == o) {
  return true;
 }
 if(o == null || getClass() != o.getClass()) {
  return false;
 }
 TankCacheKey that = (TankCacheKey) o;
 return that.fluid == this.fluid && that.location.equals(this.location);
}

代码示例来源:origin: PenguinSquad/Harvest-Festival

@Override
public boolean equals(Object o) {
  if (this == o) return true;
  if (o == null || !(o instanceof Festival)) return false;
  Festival festival = (Festival) o;
  return resource.equals(festival.resource);
}

代码示例来源:origin: PenguinSquad/Harvest-Festival

@Override
public boolean equals(Object o) {
  if (this == o) return true;
  if (o == null || !(o instanceof Letter)) return false;
  Letter letter = (Letter) o;
  return resource != null ? resource.equals(letter.resource) : letter.resource == null;
}

代码示例来源:origin: gr8pefish/IronBackpacks

@Override
public boolean equals(Object o) {
  if (this == o) return true;
  if (!(o instanceof BackpackUpgrade)) return false;
  BackpackUpgrade that = (BackpackUpgrade) o;
  return identifier.equals(that.identifier);
}

代码示例来源:origin: P3pp3rF1y/AncientWarfare2

@Override
public boolean equals(Object o) {
  if (this == o)
    return true;
  if (o == null || getClass() != o.getClass())
    return false;
  RecipeResourceLocation other = (RecipeResourceLocation) o;
  return recipeType == other.recipeType && resourceLocation.equals(other.resourceLocation);
}

代码示例来源:origin: PenguinSquad/Harvest-Festival

@Override
public boolean equals(Object o) {
  if (this == o) return true;
  if (o == null || getClass() != o.getClass()) return false;
  Note note = (Note) o;
  return resource != null ? resource.equals(note.resource) : note.resource == null;
}

代码示例来源:origin: gr8pefish/IronBackpacks

/**
 * Checks if a type is "NULL", as in if it's identifier is the resource location "ironbackpacks:null"
 *
 * @return - boolean result
 */
public boolean isNull() {
  return getIdentifier().equals(IronBackpacksAPI.NULL);
}

代码示例来源:origin: gegy1000/Terrarium

@Override
  public final boolean equals(Object obj) {
    return obj instanceof RegionComponentType && ((RegionComponentType) obj).getIdentifier().equals(this.identifier);
  }
}

代码示例来源:origin: P3pp3rF1y/AncientWarfare2

private Optional<ResourceLocation> getAvailable(
    Function2<NavigableMap<ResourceLocation, VehicleAmmoEntry>, ResourceLocation, Map.Entry<ResourceLocation, VehicleAmmoEntry>> getNextEntry) {
  if (currentAmmoType == null) {
    return Optional.empty();
  }
  Map.Entry<ResourceLocation, VehicleAmmoEntry> entry = getNextEntry.apply(ammoEntries, currentAmmoType);
  while (entry.getValue().ammoCount <= 0 && !currentAmmoType.equals(entry.getKey())) {
    entry = getNextEntry.apply(ammoEntries, entry.getKey());
  }
  return Optional.of(entry.getKey());
}

代码示例来源:origin: SlimeKnights/TinkersConstruct

@SubscribeEvent
public void onLootTableLoad(LootTableLoadEvent event) {
 // wither skellies drop necrotic bones
 if(event.getName().equals(LootTableList.ENTITIES_WITHER_SKELETON)) {
  LootCondition[] lootConditions = new LootCondition[0];
  LootEntry entry = new LootEntryItem(TinkerCommons.matNecroticBone.getItem(),
                    1,
                    0,
                    new LootFunction[]{new SetMetadata(lootConditions, new RandomValueRange(TinkerCommons.matNecroticBone.getMetadata()))},
                    lootConditions,
                    "necrotic_bone");
  event.getTable().addPool(new LootPool(new LootEntry[]{entry},
                     new LootCondition[]{
                       new KilledByPlayer(false),
                       new RandomChanceWithLooting(0.07f, 0.05f)
                     },
                     new RandomValueRange(1),
                     new RandomValueRange(0),
                     "necrotic_bone"));
 }
}

代码示例来源:origin: SquidDev-CC/plethora

private static SoundEvent getInstrument(String name) {
  ResourceLocation id = new ResourceLocation(name);
  for (SoundEvent sound : instruments) {
    if (sound.getRegistryName().equals(id)) {
      return sound;
    }
  }
  return null;
}

代码示例来源:origin: SleepyTrousers/EnderIO

public static @Nonnull NNList<CapturedMob> getSouls(List<ResourceLocation> list) {
 NNList<CapturedMob> result = new NNList<CapturedMob>();
 for (ResourceLocation mobName : list) {
  CapturedMob soul = create(mobName);
  if (soul != null && !DRAGON.equals(mobName)) {
   result.add(soul);
  }
 }
 return result;
}

代码示例来源:origin: PenguinSquad/Harvest-Festival

@Override
public ItemStack getMeal(String string) {
  ResourceLocation location = string.contains(":") ? new ResourceLocation(string) : new ResourceLocation(MODID, string);
  for (Recipe recipe : Recipe.REGISTRY.values()) {
    if (recipe.getResource().equals(location)) {
      return CookingHelper.makeRecipe(recipe);
    }
  }
  return null;
}

代码示例来源:origin: SleepyTrousers/EnderIO

public @Nonnull ItemStack toStack(@Nonnull Item item, int meta, int amount) {
 ItemStack stack = new ItemStack(item, amount, meta);
 stack.setTagCompound(toNbt(null));
 if (item == itemSoulVial.getItem() && customName == null && PIG.equals(entityId) && Math.random() < 0.01) {
  NullHelper.notnullM(stack.getTagCompound(), "getTagCompound() doesn't produce value that was set with setTagCompound()").setString(CUSTOM_NAME_KEY,
    Lang.EASTER_PIGGY.get());
 }
 return stack;
}

代码示例来源:origin: SleepyTrousers/EnderIO

public @Nonnull ItemStack toGenericStack(@Nonnull Item item, int meta, int amount) {
 NBTTagCompound data = new NBTTagCompound();
 if (isUnspawnable(entityId)) {
  return toStack(item, meta, amount);
 }
 data.setString(ENTITY_ID_KEY, entityId.toString());
 if (item == itemSoulVial.getItem() && customName == null && PIG.equals(entityId) && Math.random() < 0.01) {
  data.setString(CUSTOM_NAME_KEY, Lang.EASTER_PIGGY.get());
 }
 ItemStack stack = new ItemStack(item, amount, meta);
 stack.setTagCompound(data);
 return stack;
}

代码示例来源:origin: Alex-the-666/Ice_and_Fire

@SubscribeEvent
public void onChestGenerated(LootTableLoadEvent event) {
  if (event.getName().equals(LootTableList.CHESTS_SIMPLE_DUNGEON)) {
    final LootPool pool1 = event.getTable().getPool("pool1");
    if (pool1 != null) {
      pool1.addEntry(new LootEntryItem(ModItems.manuscript, 10, 5, new LootFunction[0], new LootCondition[0], "iceandfire:manuscript"));
    }
  }
}

代码示例来源:origin: JurassiCraftTeam/JurassiCraft2

@SubscribeEvent
public void missingMapBlock(RegistryEvent.MissingMappings<Block> event) {
  for (RegistryEvent.MissingMappings.Mapping<Block> missing : event.getMappings()) {
    ResourceLocation identifier = new ResourceLocation(missing.key.getResourcePath());
    if (identifier.equals(new ResourceLocation(JurassiCraft.MODID, "action_figure_block"))) {
      missing.remap(BlockHandler.DISPLAY_BLOCK);
    }
  }
}
@SubscribeEvent

代码示例来源:origin: Vazkii/Quark

@SubscribeEvent
public void onLootTableLoad(LootTableLoadEvent event) {
  LootFunction[] funcs = new LootFunction[] { new SetMetadata(new LootCondition[0], new RandomValueRange(0, enableRainbowRuneChests ? 16 : 15)) };
  if(event.getName().equals(LootTableList.CHESTS_SIMPLE_DUNGEON))
    event.getTable().getPool("main").addEntry(new LootEntryItem(rune, dungeonWeight, itemQuality, funcs, new LootCondition[0], "quark:rune"));
  else if(event.getName().equals(LootTableList.CHESTS_NETHER_BRIDGE))
    event.getTable().getPool("main").addEntry(new LootEntryItem(rune, netherFortressWeight, itemQuality, funcs, new LootCondition[0], "quark:rune"));
  else if(event.getName().equals(LootTableList.CHESTS_JUNGLE_TEMPLE))
    event.getTable().getPool("main").addEntry(new LootEntryItem(rune, jungleTempleWeight, itemQuality, funcs, new LootCondition[0], "quark:rune"));
  else if(event.getName().equals(LootTableList.CHESTS_DESERT_PYRAMID))
    event.getTable().getPool("main").addEntry(new LootEntryItem(rune, desertTempleWeight, itemQuality, funcs, new LootCondition[0], "quark:rune"));
}

代码示例来源:origin: Vazkii/Quark

@SubscribeEvent
public void onLootTableLoad(LootTableLoadEvent event) {
  if(event.getName().equals(LootTableList.CHESTS_STRONGHOLD_LIBRARY))
    event.getTable().getPool("main").addEntry(new LootEntryItem(ancient_tome, libraryWeight, itemQuality, new LootFunction[] { new EnchantTomeFunction() }, new LootCondition[0], "quark:ancient_tome"));
  else if(event.getName().equals(LootTableList.CHESTS_SIMPLE_DUNGEON))
    event.getTable().getPool("main").addEntry(new LootEntryItem(ancient_tome, dungeonWeight, itemQuality, new LootFunction[] { new EnchantTomeFunction() }, new LootCondition[0], "quark:ancient_tome"));
}

代码示例来源:origin: JurassiCraftTeam/JurassiCraft2

@SubscribeEvent
public static void onModelBaked(ModelBakeEvent event) {
  for(ModelResourceLocation mrl : event.getModelRegistry().getKeys()) {
    if(mrl.getVariant().equals("inventory")) {
    ResourceLocation location = new ResourceLocation(mrl.getResourceDomain(), mrl.getResourcePath());
    if(location.equals(ItemHandler.DART_GUN.getRegistryName())) {
      event.getModelRegistry().putObject(mrl, new GuiItemModelWrapper(event.getModelRegistry().getObject(mrl), DART_GUN_GUI));
    }
    }
  }
}
private static IBakedModel getModel(ResourceLocation resourceLocation, TextureMap map) {

相关文章