From aadc7150f3e81718d7a9b0793f7ac76cb828d9b0 Mon Sep 17 00:00:00 2001 From: drcrazy Date: Thu, 23 Aug 2018 17:16:17 +0300 Subject: [PATCH] Gems are flattened --- src/main/java/techreborn/blocks/BlockOre.java | 6 +- .../techreborn/client/RegisterItemJsons.java | 9 +- .../techreborn/events/BlockBreakHandler.java | 8 +- src/main/java/techreborn/init/ModGems.java | 83 +++++++++++++++++++ src/main/java/techreborn/init/ModItems.java | 4 +- src/main/java/techreborn/init/ModNuggets.java | 28 ++++++- src/main/java/techreborn/init/ModPlates.java | 4 + src/main/java/techreborn/init/OreDict.java | 19 +++-- .../techreborn/init/SubItemRetriever.java | 8 +- .../recipes/ImplosionCompressorRecipes.java | 14 ++-- .../recipes/IndustrialGrinderRecipes.java | 9 +- .../init/recipes/RecipeMethods.java | 4 +- .../init/recipes/ScrapboxRecipes.java | 9 +- src/main/java/techreborn/items/ItemGems.java | 61 +++----------- .../items/materials/{gem.json => gems.json} | 26 +++--- .../assets/techreborn/lang/en_us.lang | 12 ++- 16 files changed, 188 insertions(+), 116 deletions(-) create mode 100644 src/main/java/techreborn/init/ModGems.java rename src/main/resources/assets/techreborn/blockstates/items/materials/{gem.json => gems.json} (80%) diff --git a/src/main/java/techreborn/blocks/BlockOre.java b/src/main/java/techreborn/blocks/BlockOre.java index e250d5542..e006b5f56 100644 --- a/src/main/java/techreborn/blocks/BlockOre.java +++ b/src/main/java/techreborn/blocks/BlockOre.java @@ -50,8 +50,8 @@ import reborncore.common.util.OreDrop; import reborncore.common.util.StringUtils; import techreborn.events.TRRecipeHandler; import techreborn.init.ModBlocks; +import techreborn.init.ModGems; import techreborn.items.ItemDusts; -import techreborn.items.ItemGems; import techreborn.lib.ModInfo; import techreborn.utils.TechRebornCreativeTab; import techreborn.world.config.IOreNameProvider; @@ -143,10 +143,10 @@ public class BlockOre extends Block implements IOreNameProvider { // Secondary drop, like peridot from sapphire ore added via event handler. if (variant.equalsIgnoreCase("Ruby")) { - OreDrop ruby = new OreDrop(ItemGems.getGemByName("ruby", rubyMinQuatity), rubyMaxQuantity); + OreDrop ruby = new OreDrop(ModGems.RUBY.getStack(rubyMinQuatity), rubyMaxQuantity); drops.add(ruby.getDrops(fortune, random)); } else if (variant.equalsIgnoreCase("Sapphire")) { - OreDrop sapphire = new OreDrop(ItemGems.getGemByName("sapphire", sapphireMinQuantity), sapphireMaxQuantity); + OreDrop sapphire = new OreDrop(ModGems.SAPPHIRE.getStack(sapphireMinQuantity), sapphireMaxQuantity); drops.add(sapphire.getDrops(fortune, random)); } else if (variant.equalsIgnoreCase("Pyrite")) { OreDrop pyriteDust = new OreDrop(ItemDusts.getDustByName("pyrite", pyriteMinQuatity), pyriteMaxQuantity); diff --git a/src/main/java/techreborn/client/RegisterItemJsons.java b/src/main/java/techreborn/client/RegisterItemJsons.java index 6344788cb..ec2b5b95d 100644 --- a/src/main/java/techreborn/client/RegisterItemJsons.java +++ b/src/main/java/techreborn/client/RegisterItemJsons.java @@ -37,6 +37,7 @@ import techreborn.blocks.cable.BlockCable; import techreborn.blocks.cable.EnumCableType; import techreborn.config.ConfigTechReborn; import techreborn.init.ModBlocks; +import techreborn.init.ModGems; import techreborn.init.ModItems; import techreborn.init.ModNuggets; import techreborn.init.ModPlates; @@ -128,12 +129,8 @@ public class RegisterItemJsons { for (int i = 0; i < ItemIngots.types.length; ++i) { registerBlockstate(ModItems.INGOTS, i, name[i], "items/materials/"); } - - name = ItemGems.types.clone(); - for (int i = 0; i < ItemGems.types.length; ++i) { - registerBlockstate(ModItems.GEMS, i, name[i], "items/materials/"); - } - + + ModGems.registerModel(); ModPlates.registerModel(); ModNuggets.registerModel(); diff --git a/src/main/java/techreborn/events/BlockBreakHandler.java b/src/main/java/techreborn/events/BlockBreakHandler.java index dff423535..c37d75c13 100644 --- a/src/main/java/techreborn/events/BlockBreakHandler.java +++ b/src/main/java/techreborn/events/BlockBreakHandler.java @@ -36,9 +36,9 @@ import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; import reborncore.common.registration.RebornRegistry; import reborncore.common.registration.impl.ConfigRegistry; import reborncore.common.util.OreDrop; +import techreborn.init.ModGems; import techreborn.init.ModItems; import techreborn.items.ItemDusts; -import techreborn.items.ItemGems; import techreborn.lib.ModInfo; import techreborn.utils.OreDictUtils; @@ -68,11 +68,11 @@ public class BlockBreakHandler { List drops = event.getDrops(); Random random = new Random(); if (OreDictUtils.isOre(state, "oreRuby")) { - OreDrop redGarnet = new OreDrop(ItemGems.getGemByName("red_garnet"), redGarnetDropChance, 1); + OreDrop redGarnet = new OreDrop(ModGems.RED_GARNET.getStack(), redGarnetDropChance, 1); drops.add(redGarnet.getDrops(event.getFortuneLevel(), random)); } else if (OreDictUtils.isOre(state, "oreSapphire")) { - OreDrop peridot = new OreDrop(ItemGems.getGemByName("peridot"), peridotDropChance, 1); + OreDrop peridot = new OreDrop(ModGems.PERIDOT.getStack(), peridotDropChance, 1); drops.add(peridot.getDrops(event.getFortuneLevel(), random)); } else if (OreDictUtils.isOre(state, "oreSodalite")) { @@ -84,7 +84,7 @@ public class BlockBreakHandler { drops.add(redstone.getDrops(event.getFortuneLevel(), random)); } else if (OreDictUtils.isOre(state, "oreSphalerite")) { - OreDrop yellowGarnet = new OreDrop(ItemGems.getGemByName("yellowGarnet"), yellowGarnetDropChance, 1); + OreDrop yellowGarnet = new OreDrop(ModGems.YELLOW_GARNET.getStack(), yellowGarnetDropChance, 1); drops.add(yellowGarnet.getDrops(event.getFortuneLevel(), random)); } } diff --git a/src/main/java/techreborn/init/ModGems.java b/src/main/java/techreborn/init/ModGems.java new file mode 100644 index 000000000..b0fa5de2c --- /dev/null +++ b/src/main/java/techreborn/init/ModGems.java @@ -0,0 +1,83 @@ +/* + * This file is part of TechReborn, licensed under the MIT License (MIT). + * + * Copyright (c) 2018 TechReborn + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ +package techreborn.init; + +import java.util.Arrays; + +import com.google.common.base.CaseFormat; + +import net.minecraft.client.renderer.block.model.ModelResourceLocation; +import net.minecraft.item.Item; +import net.minecraft.item.ItemStack; +import net.minecraft.util.IStringSerializable; +import net.minecraft.util.ResourceLocation; +import net.minecraftforge.client.model.ModelLoader; +import net.minecraftforge.fml.relauncher.Side; +import net.minecraftforge.fml.relauncher.SideOnly; +import reborncore.RebornRegistry; +import techreborn.items.ItemGems; +import techreborn.lib.ModInfo; + +/** + * @author drcrazy + * + */ +public enum ModGems implements IStringSerializable { + PERIDOT, RED_GARNET, RUBY, SAPPHIRE, YELLOW_GARNET; + + public final String name; + public final Item item; + + private ModGems() { + name = CaseFormat.UPPER_UNDERSCORE.to(CaseFormat.LOWER_CAMEL, "GEM_" + this.toString()); + item = new ItemGems(); + item.setRegistryName(new ResourceLocation(ModInfo.MOD_ID, name)); + item.setTranslationKey(ModInfo.MOD_ID + "." + name); + } + + public ItemStack getStack() { + return new ItemStack(item); + } + + public ItemStack getStack(int amount) { + return new ItemStack(item, amount); + } + + public static void register() { + Arrays.stream(ModGems.values()).forEach(gem -> RebornRegistry.registerItem(gem.item)); + } + + @SideOnly(Side.CLIENT) + public static void registerModel() { + ResourceLocation blockstateJson = new ResourceLocation(ModInfo.MOD_ID, "items/materials/gems"); + Arrays.stream(ModGems.values()).forEach(gem -> ModelLoader.setCustomModelResourceLocation(gem.item, 0, + new ModelResourceLocation(blockstateJson, "type=" + gem.name))); + } + + @Override + public String getName() { + return name; + } + +} diff --git a/src/main/java/techreborn/init/ModItems.java b/src/main/java/techreborn/init/ModItems.java index 06eff403f..e9404e394 100644 --- a/src/main/java/techreborn/init/ModItems.java +++ b/src/main/java/techreborn/init/ModItems.java @@ -45,7 +45,6 @@ import javax.annotation.Nullable; public class ModItems { - public static Item GEMS; public static Item INGOTS; public static Item DUSTS; @@ -156,8 +155,6 @@ public class ModItems { public static DynamicCell CELL; public static void init() { - GEMS = new ItemGems(); - registerItem(GEMS, "gem"); INGOTS = new ItemIngots(); registerItem(INGOTS, "ingot"); DUSTS = new ItemDusts(); @@ -165,6 +162,7 @@ public class ModItems { SMALL_DUSTS = new ItemDustsSmall(); registerItem(SMALL_DUSTS, "smallDust"); + ModGems.register(); ModPlates.register(); ModNuggets.register(); diff --git a/src/main/java/techreborn/init/ModNuggets.java b/src/main/java/techreborn/init/ModNuggets.java index 827b5e1db..30a2c7111 100644 --- a/src/main/java/techreborn/init/ModNuggets.java +++ b/src/main/java/techreborn/init/ModNuggets.java @@ -1,5 +1,25 @@ -/** - * +/* + * This file is part of TechReborn, licensed under the MIT License (MIT). + * + * Copyright (c) 2018 TechReborn + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. */ package techreborn.init; @@ -40,6 +60,10 @@ public enum ModNuggets implements IStringSerializable { public ItemStack getStack() { return new ItemStack(item); } + + public ItemStack getStack(int amount) { + return new ItemStack(item, amount); + } public static void register() { Arrays.stream(ModNuggets.values()).forEach(nugget -> RebornRegistry.registerItem(nugget.item)); diff --git a/src/main/java/techreborn/init/ModPlates.java b/src/main/java/techreborn/init/ModPlates.java index bac50ff5f..9efa2f7b5 100644 --- a/src/main/java/techreborn/init/ModPlates.java +++ b/src/main/java/techreborn/init/ModPlates.java @@ -63,6 +63,10 @@ public enum ModPlates implements IStringSerializable { public ItemStack getStack() { return new ItemStack(item); } + + public ItemStack getStack(int amount) { + return new ItemStack(item, amount); + } public static void register() { Arrays.stream(ModPlates.values()).forEach(plate -> RebornRegistry.registerItem(plate.item)); diff --git a/src/main/java/techreborn/init/OreDict.java b/src/main/java/techreborn/init/OreDict.java index 7c56aa8c4..02b1c9a3a 100644 --- a/src/main/java/techreborn/init/OreDict.java +++ b/src/main/java/techreborn/init/OreDict.java @@ -84,15 +84,16 @@ public class OreDict { OreUtil.registerOre("pulpWood", ItemDusts.getDustByName("saw_dust")); OreUtil.registerOre("dustAsh", ItemDusts.getDustByName("ashes")); - for (String type : ItemGems.types) { - OreUtil.registerOre(CaseFormat.LOWER_UNDERSCORE.to(CaseFormat.LOWER_CAMEL, "gem_" + type), ItemGems.getGemByName(type)); - boolean ignoreIt = false; - for (String ignore : plateGenIgnores) - if (type.startsWith(ignore)) - ignoreIt = true; - // if (!ignoreIt) - // ItemPlates.registerType(type); - } +// TODO: fix recipe +// for (String type : ItemGems.types) { +// OreUtil.registerOre(CaseFormat.LOWER_UNDERSCORE.to(CaseFormat.LOWER_CAMEL, "gem_" + type), ItemGems.getGemByName(type)); +// boolean ignoreIt = false; +// for (String ignore : plateGenIgnores) +// if (type.startsWith(ignore)) +// ignoreIt = true; +// if (!ignoreIt) +// ItemPlates.registerType(type); +// } for (String type : ItemIngots.types) { OreUtil.registerOre(CaseFormat.LOWER_UNDERSCORE.to(CaseFormat.LOWER_CAMEL, "ingot_" + type), ItemIngots.getIngotByName(type)); diff --git a/src/main/java/techreborn/init/SubItemRetriever.java b/src/main/java/techreborn/init/SubItemRetriever.java index 9f421667f..58c4d5037 100644 --- a/src/main/java/techreborn/init/SubItemRetriever.java +++ b/src/main/java/techreborn/init/SubItemRetriever.java @@ -66,12 +66,16 @@ public class SubItemRetriever implements ISubItemRetriever { @Override public ItemStack getGemByName(String name) { - return ItemGems.getGemByName(name); + // TODO: Fix recipe + //return ItemGems.getGemByName(name); + return null; } @Override public ItemStack getGemByName(String name, int count) { - return ItemGems.getGemByName(name, count); + // TODO: Fix recipe + //return ItemGems.getGemByName(name, count); + return null; } @Override diff --git a/src/main/java/techreborn/init/recipes/ImplosionCompressorRecipes.java b/src/main/java/techreborn/init/recipes/ImplosionCompressorRecipes.java index 1f786d83a..2c7b47f61 100644 --- a/src/main/java/techreborn/init/recipes/ImplosionCompressorRecipes.java +++ b/src/main/java/techreborn/init/recipes/ImplosionCompressorRecipes.java @@ -38,15 +38,15 @@ import java.security.InvalidParameterException; */ public class ImplosionCompressorRecipes extends RecipeMethods { public static void init() { - // TODO: fix recipe - // register(getOre("ingotIridiumAlloy"), getMaterial("iridium_alloy", Type.PLATE), 4); register(getOre("dustDiamond", 4), getStack(Items.DIAMOND, 3), 16); register(getOre("dustEmerald", 4), getStack(Items.EMERALD, 3), 12); - register(getOre("dustRuby", 4), getMaterial("ruby", 3, Type.GEM), 12); - register(getOre("dustSapphire", 4), getMaterial("sapphire", 3, Type.GEM), 12); - register(getOre("dustPeridot", 4), getMaterial("peridot", 3, Type.GEM), 12); - register(getOre("dustRedGarnet", 4), getMaterial("red_garnet", 3, Type.GEM), 8); - register(getOre("dustYellowGarnet", 4), getMaterial("yellow_garnet", 3, Type.GEM), 8); + // TODO: fix recipe + // register(getOre("ingotIridiumAlloy"), getMaterial("iridium_alloy", Type.PLATE), 4); +// register(getOre("dustRuby", 4), getMaterial("ruby", 3, Type.GEM), 12); +// register(getOre("dustSapphire", 4), getMaterial("sapphire", 3, Type.GEM), 12); +// register(getOre("dustPeridot", 4), getMaterial("peridot", 3, Type.GEM), 12); +// register(getOre("dustRedGarnet", 4), getMaterial("red_garnet", 3, Type.GEM), 8); +// register(getOre("dustYellowGarnet", 4), getMaterial("yellow_garnet", 3, Type.GEM), 8); if (oresExist("dustApatite", "gemApatite")) { register(getOre("dustApatite", 4), getOre("gemApatite", 3), 12); } diff --git a/src/main/java/techreborn/init/recipes/IndustrialGrinderRecipes.java b/src/main/java/techreborn/init/recipes/IndustrialGrinderRecipes.java index 0569c39ba..d680f5a4f 100644 --- a/src/main/java/techreborn/init/recipes/IndustrialGrinderRecipes.java +++ b/src/main/java/techreborn/init/recipes/IndustrialGrinderRecipes.java @@ -100,9 +100,7 @@ public class IndustrialGrinderRecipes extends RecipeMethods { register(getOre("orePitchblende"), WATER, 100, 64, getOre("uran238", 8), getOre("smallUran235", 2)); } - register(getOre("oreRuby"), WATER, 100, 64, getMaterial("ruby", Type.GEM), getMaterial("ruby", 6, Type.SMALL_DUST), getMaterial("red_garnet", 2, Type.SMALL_DUST)); - - register(getOre("oreSapphire"), WATER, 100, 64, getMaterial("sapphire", Type.GEM), getMaterial("sapphire", 6, Type.SMALL_DUST), getMaterial("peridot", 2, Type.SMALL_DUST)); + register(getOre("oreQuartz"), WATER, 100, 64, getStack(Items.QUARTZ, 2), getMaterial("sulfur", 2, Type.SMALL_DUST)); @@ -118,8 +116,9 @@ public class IndustrialGrinderRecipes extends RecipeMethods { // TODO: Fix recipe // register(getOre("oreSheldonite"), WATER, 100, 64, getMaterial("platinum", 2, Type.DUST), getMaterial("nickel", Type.DUST), getMaterial("iridium", 2, Type.NUGGET)); // register(getOre("oreSheldonite"), MERCURY, 100, 64, getMaterial("platinum", 3, Type.DUST), getMaterial("nickel", Type.DUST), getMaterial("iridium", 2, Type.NUGGET)); - - register(getOre("orePeridot"), WATER, 100, 64, getMaterial("peridot", Type.GEM), getMaterial("peridot", 6, Type.SMALL_DUST), getMaterial("emerald", 2, Type.SMALL_DUST)); +// register(getOre("orePeridot"), WATER, 100, 64, getMaterial("peridot", Type.GEM), getMaterial("peridot", 6, Type.SMALL_DUST), getMaterial("emerald", 2, Type.SMALL_DUST)); +// register(getOre("oreRuby"), WATER, 100, 64, getMaterial("ruby", Type.GEM), getMaterial("ruby", 6, Type.SMALL_DUST), getMaterial("red_garnet", 2, Type.SMALL_DUST)); +// register(getOre("oreSapphire"), WATER, 100, 64, getMaterial("sapphire", Type.GEM), getMaterial("sapphire", 6, Type.SMALL_DUST), getMaterial("peridot", 2, Type.SMALL_DUST)); register(getOre("oreSodalite"), WATER, 100, 64, getMaterial("sodalite", 12, Type.DUST), getMaterial("aluminum", 3, Type.DUST)); diff --git a/src/main/java/techreborn/init/recipes/RecipeMethods.java b/src/main/java/techreborn/init/recipes/RecipeMethods.java index ae7201cbc..8e23d0ca9 100644 --- a/src/main/java/techreborn/init/recipes/RecipeMethods.java +++ b/src/main/java/techreborn/init/recipes/RecipeMethods.java @@ -48,8 +48,8 @@ public abstract class RecipeMethods { return ItemDustsSmall.getSmallDustByName(name, count); } else if (type == Type.INGOT) { return ItemIngots.getIngotByName(name, count); - } else if (type == Type.GEM) { - return ItemGems.getGemByName(name, count); +// } else if (type == Type.GEM) { +// return ItemGems.getGemByName(name, count); // TODO: fix recipe // } else if (type == Type.PLATE) { // return ItemPlates.getPlateByName(name, count); diff --git a/src/main/java/techreborn/init/recipes/ScrapboxRecipes.java b/src/main/java/techreborn/init/recipes/ScrapboxRecipes.java index db5678972..c6c35a906 100644 --- a/src/main/java/techreborn/init/recipes/ScrapboxRecipes.java +++ b/src/main/java/techreborn/init/recipes/ScrapboxRecipes.java @@ -35,7 +35,6 @@ import techreborn.api.recipe.machines.ScrapboxRecipe; import techreborn.init.ModBlocks; import techreborn.items.DynamicCell; import techreborn.items.ItemDusts; -import techreborn.items.ItemGems; import techreborn.utils.StackWIPHandler; /** @@ -196,10 +195,10 @@ public class ScrapboxRecipes extends RecipeMethods { // for (String i : ItemNuggets.types) { // register(ItemNuggets.getNuggetByName(i)); // } - - for (String i : ItemGems.types) { - register(ItemGems.getGemByName(i)); - } +// +// for (String i : ItemGems.types) { +// register(ItemGems.getGemByName(i)); +// } registerDyable(Items.DYE); registerDyable(Blocks.WOOL); diff --git a/src/main/java/techreborn/items/ItemGems.java b/src/main/java/techreborn/items/ItemGems.java index cd1aef57e..52087d15f 100644 --- a/src/main/java/techreborn/items/ItemGems.java +++ b/src/main/java/techreborn/items/ItemGems.java @@ -24,61 +24,26 @@ package techreborn.items; -import com.google.common.base.CaseFormat; -import net.minecraft.creativetab.CreativeTabs; -import net.minecraft.item.ItemStack; -import net.minecraft.util.NonNullList; import techreborn.events.TRRecipeHandler; -import techreborn.init.ModItems; -import techreborn.utils.TechRebornCreativeTab; - -import java.security.InvalidParameterException; public class ItemGems extends ItemTR { - public static final String[] types = new String[] { "ruby", "sapphire", "peridot", "red_garnet", "yellow_garnet" }; - public ItemGems() { - setCreativeTab(TechRebornCreativeTab.instance); - setTranslationKey("techreborn.gem"); - setHasSubtypes(true); TRRecipeHandler.hideEntry(this); } - public static ItemStack getGemByName(String name, int count) { - name = CaseFormat.LOWER_CAMEL.to(CaseFormat.LOWER_UNDERSCORE, name); - for (int i = 0; i < types.length; i++) { - if (types[i].equalsIgnoreCase(name)) { - return new ItemStack(ModItems.GEMS, count, i); - } - } - throw new InvalidParameterException("The gem " + name + " could not be found."); - } - - public static ItemStack getGemByName(String name) { - return getGemByName(name, 1); - } - - @Override - // gets Unlocalized Name depending on meta data - public String getTranslationKey(ItemStack itemStack) { - int meta = itemStack.getItemDamage(); - if (meta < 0 || meta >= types.length) { - meta = 0; - } - - return super.getTranslationKey() + "." + types[meta]; - } - - // Adds Dusts SubItems To Creative Tab - @Override - public void getSubItems(CreativeTabs creativeTabs, NonNullList list) { - if (!isInCreativeTab(creativeTabs)) { - return; - } - for (int meta = 0; meta < types.length; ++meta) { - list.add(new ItemStack(this, 1, meta)); - } - } +// public static ItemStack getGemByName(String name, int count) { +// name = CaseFormat.LOWER_CAMEL.to(CaseFormat.LOWER_UNDERSCORE, name); +// for (int i = 0; i < types.length; i++) { +// if (types[i].equalsIgnoreCase(name)) { +// return new ItemStack(ModItems.GEMS, count, i); +// } +// } +// throw new InvalidParameterException("The gem " + name + " could not be found."); +// } +// +// public static ItemStack getGemByName(String name) { +// return getGemByName(name, 1); +// } } diff --git a/src/main/resources/assets/techreborn/blockstates/items/materials/gem.json b/src/main/resources/assets/techreborn/blockstates/items/materials/gems.json similarity index 80% rename from src/main/resources/assets/techreborn/blockstates/items/materials/gem.json rename to src/main/resources/assets/techreborn/blockstates/items/materials/gems.json index 4321bc40a..787106388 100644 --- a/src/main/resources/assets/techreborn/blockstates/items/materials/gem.json +++ b/src/main/resources/assets/techreborn/blockstates/items/materials/gems.json @@ -6,27 +6,27 @@ }, "variants": { "type": { - "ruby": { + "gemperidot": { + "textures": { + "layer0": "techreborn:items/gem/peridot" + } + }, + "gemredgarnet": { + "textures": { + "layer0": "techreborn:items/gem/red_garnet" + } + }, + "gemruby": { "textures": { "layer0": "techreborn:items/gem/ruby" } }, - "sapphire": { + "gemsapphire": { "textures": { "layer0": "techreborn:items/gem/sapphire" } }, - "peridot": { - "textures": { - "layer0": "techreborn:items/gem/peridot" - } - }, - "red_garnet": { - "textures": { - "layer0": "techreborn:items/gem/red_garnet" - } - }, - "yellow_garnet": { + "gemyellowgarnet": { "textures": { "layer0": "techreborn:items/gem/yellow_garnet" } diff --git a/src/main/resources/assets/techreborn/lang/en_us.lang b/src/main/resources/assets/techreborn/lang/en_us.lang index 9188eecf7..8954f8056 100644 --- a/src/main/resources/assets/techreborn/lang/en_us.lang +++ b/src/main/resources/assets/techreborn/lang/en_us.lang @@ -364,11 +364,11 @@ item.techreborn.dustsmall.diorite.name=Small Pile of Diorite Dust item.techreborn.dustsmall.granite.name=Small Pile of Granite Dust #Gems -item.techreborn.gem.ruby.name=Ruby -item.techreborn.gem.sapphire.name=Sapphire -item.techreborn.gem.peridot.name=Peridot -item.techreborn.gem.red_garnet.name=Red Garnet -item.techreborn.gem.yellow_garnet.name=Yellow Garnet +item.techreborn.gemPeridot.name=Peridot +item.techreborn.gemRedGarnet.name=Red Garnet +item.techreborn.gemRuby.name=Ruby +item.techreborn.gemSapphire.name=Sapphire +item.techreborn.gemYellowGarnet.name=Yellow Garnet #Ingots item.techreborn.ingot.aluminum.name=Aluminium Ingot @@ -418,8 +418,6 @@ item.techreborn.nuggetTungsten.name=Tungsten Nugget item.techreborn.nuggetTungstensteel.name=Tungstensteel Nugget item.techreborn.nuggetZinc.name=Zinc Nugget - - #Plates item.techreborn.plateAdvancedAlloy.name=Advanced Alloy Plate item.techreborn.plateAluminum.name=Aluminium Plate