Plates are flattened and enumed

This commit is contained in:
drcrazy 2018-08-23 00:14:02 +03:00
parent be024f0179
commit f45da44f2b
8 changed files with 241 additions and 209 deletions

View file

@ -25,7 +25,6 @@
package techreborn;
import net.minecraft.block.BlockDispenser;
import net.minecraft.item.Item;
import net.minecraft.item.crafting.IRecipe;
import net.minecraft.util.ResourceLocation;
import net.minecraft.world.gen.structure.MapGenStructureIO;
@ -43,7 +42,6 @@ import net.minecraftforge.fml.common.registry.EntityRegistry;
import net.minecraftforge.fml.common.registry.GameRegistry;
import net.minecraftforge.fml.common.registry.VillagerRegistry;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.registries.IForgeRegistry;
import reborncore.RebornCore;
import reborncore.api.recipe.RecipeHandler;
import reborncore.common.multiblock.MultiblockEventHandler;
@ -73,7 +71,6 @@ import techreborn.world.village.VillageComponentRubberPlantaion;
import techreborn.world.village.VillagePlantaionHandler;
import java.io.File;
import java.util.Arrays;
@Mod(modid = ModInfo.MOD_ID, name = ModInfo.MOD_NAME, version = ModInfo.MOD_VERSION, dependencies = ModInfo.MOD_DEPENDENCIES, acceptedMinecraftVersions = "[1.12,1.12.2]", certificateFingerprint = "8727a3141c8ec7f173b87aa78b9b9807867c4e6b", guiFactory = "techreborn.client.TechRebornGuiFactory")
public class Core {
@ -128,12 +125,6 @@ public class Core {
ModRecipes.init();
}
@SubscribeEvent
public void registerItems(RegistryEvent.Register<Item> event) {
IForgeRegistry<Item> itemRegistry = event.getRegistry();
Arrays.stream(ModPlates.values()).forEach(plate -> itemRegistry.register(plate.item));
}
@Mod.EventHandler
public void init(FMLInitializationEvent event) {
// Registers Chest Loot

View file

@ -133,15 +133,8 @@ public class RegisterItemJsons {
registerBlockstate(ModItems.GEMS, i, name[i], "items/materials/");
}
/* name = ItemPlates.types.clone();
for (int i = 0; i < ItemPlates.types.length; ++i) {
registerBlockstate(ModItems.PLATES, i, name[i], "items/materials/");
}*/
ResourceLocation platesBlockstateJson = new ResourceLocation(ModInfo.MOD_ID, "items/materials/plates");
for (ModPlates plate : ModPlates.values()){
ModelLoader.setCustomModelResourceLocation(plate.item, 0, new ModelResourceLocation(platesBlockstateJson, "type=" + plate.getName()));
registerBlockstateMultiItem(plate.item, plate.name, "items/materials/plates");
}
name = ItemNuggets.types.clone();
@ -204,8 +197,9 @@ public class RegisterItemJsons {
}
private static void register(Item item, int meta, String name) {
ResourceLocation loc = new ResourceLocation(ModInfo.MOD_ID, name);
ModelLoader.setCustomModelResourceLocation(item, meta,
new ModelResourceLocation("techreborn:" + name, "inventory"));
new ModelResourceLocation(loc, "inventory"));
}
private static void register(Item item, String name) {
@ -227,7 +221,7 @@ public class RegisterItemJsons {
}
private static void registerBlockstate(Item i, int meta, String variant, String dir) {
ResourceLocation loc = new ResourceLocation("techreborn", dir + i.getRegistryName().getPath());
ResourceLocation loc = new ResourceLocation(ModInfo.MOD_ID, dir + i.getRegistryName().getPath());
ModelLoader.setCustomModelResourceLocation(i, meta, new ModelResourceLocation(loc, "type=" + variant));
}
@ -241,12 +235,12 @@ public class RegisterItemJsons {
}
private static void registerBlockstateMultiItem(Item item, String variantName, String path) {
ResourceLocation loc = new ResourceLocation("techreborn", path);
ResourceLocation loc = new ResourceLocation(ModInfo.MOD_ID, path);
ModelLoader.setCustomModelResourceLocation(item, 0, new ModelResourceLocation(loc, "type=" + variantName));
}
private static void registerBlockstateMultiItem(Item item, int meta, String variantName, String path) {
ResourceLocation loc = new ResourceLocation("techreborn", path);
ResourceLocation loc = new ResourceLocation(ModInfo.MOD_ID, path);
ModelLoader.setCustomModelResourceLocation(item, meta, new ModelResourceLocation(loc, "type=" + variantName));
}
}

View file

@ -41,7 +41,6 @@ import techreborn.items.armor.ItemLithiumBatpack;
import techreborn.items.armor.ItemTRArmour;
import techreborn.items.battery.*;
import techreborn.items.tools.*;
import javax.annotation.Nullable;
public class ModItems {
@ -60,7 +59,7 @@ public class ModItems {
public static Item LAPOTRONIC_ORB;
public static Item MANUAL;
public static Item UU_MATTER;
public static Item PLATES;
public static Item CLOAKING_DEVICE;
public static Item RE_BATTERY;
public static Item TREE_TAP;
@ -165,8 +164,11 @@ public class ModItems {
registerItem(DUSTS, "dust");
SMALL_DUSTS = new ItemDustsSmall();
registerItem(SMALL_DUSTS, "smallDust");
// PLATES = new ItemPlates();
// registerItem(PLATES, "plates");
for (ModPlates plate : ModPlates.values()){
registerItem(plate.item, plate.name);
}
NUGGETS = new ItemNuggets();
registerItem(NUGGETS, "nuggets");
// purifiedCrushedOre = new ItemPurifiedCrushedOre();

View file

@ -26,7 +26,6 @@ package techreborn.init;
import net.minecraft.item.Item;
import net.minecraft.util.IStringSerializable;
import net.minecraft.util.ResourceLocation;
import techreborn.lib.ModInfo;
import techreborn.items.ItemPlates;
@ -38,34 +37,56 @@ import techreborn.items.ItemPlates;
public enum ModPlates implements IStringSerializable {
ADVANCED_ALLOY_PLATE("plateAdvancedAlloy"),
ALUMINUM_PLATE("plateAluminum"),
// BRASS_PLATE("plateBrass"),
// BRONZE_PLATE("plateBronze"),
// CARBON_PLATE("plateCarbon"),
// COAL_PLATE("plateCoal"),
// COPPER_PLATE("plateCopper"),
// DIAMOND_PLATE("plateDiamond"),
//
// IRON_PLATE("plateIron"),
// GOLD_PLATE("plateGold"),
//
// WOOD_PLATE("plateWood"),
// REDSTONE_PLATE("plateRedstone"),
//
// EMERALD_PLATE("plateEmerald"),
//
// OBSIDIAN_PLATE("plateObsidian"),
LAZURITE_PLATE("plateLazurite");
BRASS_PLATE("plateBrass"),
BRONZE_PLATE("plateBronze"),
CARBON_PLATE("plateCarbon"),
COAL_PLATE("plateCoal"),
COPPER_PLATE("plateCopper"),
DIAMOND_PLATE("plateDiamond"),
ELECTRUM_PLATE("plateElectrum"),
EMERALD_PLATE("plateEmerald"),
GOLD_PLATE("plateGold"),
INVAR_PLATE("plateInvar"),
IRIDIUM_ALLOY_PLATE("plateIridiumAlloy"),
IRIDIUM_PLATE("plateIridium"),
IRON_PLATE("plateIron"),
LAPIS_PLATE("plateLapis"),
LAZURITE_PLATE("plateLazurite"),
LEAD_PLATE("plateLead"),
MAGNALIUM_PLATE("plateMagnalium"),
NICKEL_PLATE("plateNickel"),
OBSIDIAN_PLATE("plateObsidian"),
PERIDOT_PLATE("platePeridot"),
PLATINUM_PLATE("platePlatinum"),
RED_GARNET_PLATE("plateRedGarnet"),
REDSTONE_PLATE("plateRedstone"),
REFINED_IRON_PLATE("plateRefinedIron"),
RUBY_PLATE("plateRuby"),
SAPPHIRE_PLATE("plateSapphire"),
SILICON_PLATE("plateSilicon"),
SILVER_PLATE("plateSilver"),
STEEL_PLATE("plateSteel"),
TIN_PLATE("plateTin"),
TITANIUM_PLATE("plateTitanium"),
TUNGSTEN_PLATE("plateTungsten"),
TUNGSTENSTEEL_PLATE("plateTungstensteel"),
WOOD_PLATE("plateWood"),
YELLOW_GARNET_PLATE("plateYellowGarnet"),
ZINC_PLATE("plateZinc");
public final ResourceLocation name;
public final String name;
public final Item item;
private ModPlates(String name) {
this.name = new ResourceLocation(ModInfo.MOD_ID, name);
this.item = new ItemPlates(this.name);
this.name = name;
this.item = new ItemPlates();
// ModItems will take care about setRegistryName
//this.item.setRegistryName(new ResourceLocation(ModInfo.MOD_ID, name));
this.item.setTranslationKey(ModInfo.MOD_ID + "." + name);
}
@Override
public String getName() {
return name.getPath();
return name;
}
}

View file

@ -104,19 +104,11 @@ public class OreDict {
// ItemPlates.registerType(type);
}
for (String type : ItemPlates.types) {
// TODO: fix recipe
// OreUtil.registerOre(CaseFormat.LOWER_UNDERSCORE.to(CaseFormat.LOWER_CAMEL, "plate_" + type), ItemPlates.getPlateByName(type));
}
// for (String type : ItemPlates.types) {
// // TODO: fix recipe
// OreUtil.registerOre(CaseFormat.LOWER_UNDERSCORE.to(CaseFormat.LOWER_CAMEL, "plate_" + type), ItemPlates.getPlateByName(type));
// }
//Late registration of additional plates to keep meta
// ItemPlates.registerType("magnalium");
// OreUtil.registerOre("plateMagnalium", ItemPlates.getPlateByName("magnalium"));
// TODO: Fix recipe
// ItemPlates.registerType("iridium_alloy");
// OreUtil.registerOre("plateIridiumAlloy", ItemPlates.getPlateByName("iridiumAlloy"));
for (String type : ItemDusts.types) {
OreUtil.registerOre(CaseFormat.LOWER_UNDERSCORE.to(CaseFormat.LOWER_CAMEL, "dust_" + type), ItemDusts.getDustByName(type));
}

View file

@ -24,32 +24,12 @@
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 net.minecraft.util.ResourceLocation;
import reborncore.common.util.OreUtil;
import techreborn.events.TRRecipeHandler;
import techreborn.init.ModItems;
import techreborn.lib.ModInfo;
import techreborn.utils.TechRebornCreativeTab;
import java.security.InvalidParameterException;
public class ItemPlates extends ItemTR {
//Vanilla plates or plates not from ingots or gems
public static String[] types = new String[] {
"iron", "gold", "carbon", "wood", "redstone", "diamond", "emerald", "coal", "obsidian", "lazurite"
};
public ItemPlates(ResourceLocation name) {
setRegistryName(name);
setTranslationKey(ModInfo.MOD_ID + "." + name.getPath());
public ItemPlates() {
TRRecipeHandler.hideEntry(this);
//setTranslationKey("techreborn.plate");
//setHasSubtypes(true);
}
// public static ItemStack getPlateByName(String name, int count) {

View file

@ -16,134 +16,189 @@
"layer0": "techreborn:items/plate/aluminum_plate"
}
},
"platelazurite": {
"platebrass": {
"textures": {
"layer0": "techreborn:items/plate/lazurite_plate"
"layer0": "techreborn:items/plate/brass_plate"
}
},
"chrome": {
},
"platebronze": {
"textures": {
"layer0": "techreborn:items/plate/bronze_plate"
}
},
"platecarbon": {
"textures": {
"layer0": "techreborn:items/plate/carbon_plate"
}
},
"platechrome": {
"textures": {
"layer0": "techreborn:items/plate/chrome_plate"
}
},
"electrum": {
"platecoal": {
"textures": {
"layer0": "techreborn:items/plate/coal_plate"
}
},
"platecopper": {
"textures": {
"layer0": "techreborn:items/plate/copper_plate"
}
},
"platediamond": {
"textures": {
"layer0": "techreborn:items/plate/diamond_plate"
}
},
"plateelectrum": {
"textures": {
"layer0": "techreborn:items/plate/electrum_plate"
}
},
"invar": {
"plateemerald": {
"textures": {
"layer0": "techreborn:items/plate/emerald_plate"
}
},
"plategold": {
"textures": {
"layer0": "techreborn:items/plate/gold_plate"
}
},
"plateinvar": {
"textures": {
"layer0": "techreborn:items/plate/invar_plate"
}
},
"iridium": {
"textures": {
"layer0": "techreborn:items/plate/iridium_plate"
}
},
"lead": {
"textures": {
"layer0": "techreborn:items/plate/lead_plate"
}
},
"nickel": {
"textures": {
"layer0": "techreborn:items/plate/nickel_plate"
}
},
"platinum": {
"textures": {
"layer0": "techreborn:items/plate/platinum_plate"
}
},
"silver": {
"textures": {
"layer0": "techreborn:items/plate/silver_plate"
}
},
"steel": {
"textures": {
"layer0": "techreborn:items/plate/steel_plate"
}
},
"tin": {
"textures": {
"layer0": "techreborn:items/plate/tin_plate"
}
},
"titanium": {
"textures": {
"layer0": "techreborn:items/plate/titanium_plate"
}
},
"tungsten": {
"textures": {
"layer0": "techreborn:items/plate/tungsten_plate"
}
},
"hot_tungstensteel": {
"textures": {
"layer0": "techreborn:items/plate/hot_tungstensteel_plate"
}
},
"tungstensteel": {
"textures": {
"layer0": "techreborn:items/plate/tungstensteel_plate"
}
},
"zinc": {
"textures": {
"layer0": "techreborn:items/plate/zinc_plate"
}
},
"refined_iron": {
"textures": {
"layer0": "techreborn:items/plate/refined_iron_plate"
}
},
"mixed_metal": {
"textures": {
"layer0": "techreborn:items/plate/mixed_metal_plate"
}
},
"iridium_alloy": {
"plateiridiumalloy": {
"textures": {
"layer0": "techreborn:items/plate/iridium_alloy_plate"
}
},
"lapis": {
"plateiridium": {
"textures": {
"layer0": "techreborn:items/plate/iridium_plate"
}
},
"plateiron": {
"textures": {
"layer0": "techreborn:items/plate/iron_plate"
}
},
"platelapis": {
"textures": {
"layer0": "techreborn:items/plate/lapis_plate"
}
},
"ruby": {
"platelazurite": {
"textures": {
"layer0": "techreborn:items/plate/ruby_plate"
"layer0": "techreborn:items/plate/lazurite_plate"
}
},
"sapphire": {
"platelead": {
"textures": {
"layer0": "techreborn:items/plate/sapphire_plate"
"layer0": "techreborn:items/plate/lead_plate"
}
},
"peridot": {
"platemagnalium": {
"textures": {
"layer0": "techreborn:items/plate/magnalium_plate"
}
},
"platenickel": {
"textures": {
"layer0": "techreborn:items/plate/nickel_plate"
}
},
"plateobsidian": {
"textures": {
"layer0": "techreborn:items/plate/obsidian_plate"
}
},
"plateperidot": {
"textures": {
"layer0": "techreborn:items/plate/peridot_plate"
}
},
"red_garnet": {
"plateplatinum": {
"textures": {
"layer0": "techreborn:items/plate/platinum_plate"
}
},
"plateredgarnet": {
"textures": {
"layer0": "techreborn:items/plate/red_garnet_plate"
}
},
"yellow_garnet": {
"plateredstone": {
"textures": {
"layer0": "techreborn:items/plate/redstone_plate"
}
},
"platerefinediron": {
"textures": {
"layer0": "techreborn:items/plate/refined_iron_plate"
}
},
"plateruby": {
"textures": {
"layer0": "techreborn:items/plate/ruby_plate"
}
},
"platesapphire": {
"textures": {
"layer0": "techreborn:items/plate/sapphire_plate"
}
},
"platesilicon": {
"textures": {
"layer0": "techreborn:items/plate/silicon_plate"
}
},
"platesilver": {
"textures": {
"layer0": "techreborn:items/plate/silver_plate"
}
},
"platesteel": {
"textures": {
"layer0": "techreborn:items/plate/steel_plate"
}
},
"platetin": {
"textures": {
"layer0": "techreborn:items/plate/tin_plate"
}
},
"platetitanium": {
"textures": {
"layer0": "techreborn:items/plate/titanium_plate"
}
},
"platetungsten": {
"textures": {
"layer0": "techreborn:items/plate/tungsten_plate"
}
},
"platetungstensteel": {
"textures": {
"layer0": "techreborn:items/plate/tungstensteel_plate"
}
},
"platewood": {
"textures": {
"layer0": "techreborn:items/plate/wood_plate"
}
},
"plateyellowgarnet": {
"textures": {
"layer0": "techreborn:items/plate/yellow_garnet_plate"
}
},
"magnalium": {
"platezinc": {
"textures": {
"layer0": "techreborn:items/plate/magnalium_plate"
"layer0": "techreborn:items/plate/zinc_plate"
}
}
}

View file

@ -422,49 +422,46 @@ item.techreborn.nuggets.refined_iron.name=Refined Iron Nugget
item.techreborn.nuggets.diamond.name=Diamond Nugget
#Plates
item.techreborn.plateadvancedalloy.name=Advanced Alloy Plate
item.techreborn.platealuminum.name=Aluminium Plate
item.techreborn.platebrass.name=Brass Plate
item.techreborn.plateAdvancedAlloy.name=Advanced Alloy Plate
item.techreborn.plateAluminum.name=Aluminium Plate
item.techreborn.plateBrass.name=Brass Plate
item.techreborn.plateBronze.name=Bronze Plate
item.techreborn.plateCarbon.name=Carbon Plate
item.techreborn.plateChrome.name=Chrome Plate
item.techreborn.plateCoal.name=Coal Plate
item.techreborn.plateCopper.name=Copper Plate
item.techreborn.plateDiamond.name=Diamond Plate
item.techreborn.plateElectrum.name=Electrum Plate
item.techreborn.plateEmerald.name=Emerald Plate
item.techreborn.plateGold.name=Gold Plate
item.techreborn.plateInvar.name=Invar Plate
item.techreborn.plateIridiumAlloy.name=Iridium Alloy Plate
item.techreborn.plateIridium.name=Iridium Plate
item.techreborn.plateIron.name=Iron Plate
item.techreborn.plateLapis.name=Lapis Lazuli Plate
item.techreborn.plateLazurite.name=Lazurite Plate
item.techreborn.plateLead.name=Lead Plate
item.techreborn.plateMagnalium.name=Magnalium Plate
item.techreborn.plateNickel.name=Nickel Plate
item.techreborn.plateObsidian.name=Obsidian Plate
item.techreborn.platePeridot.name=Peridot Plate
item.techreborn.platePlatinum.name=Platinum Plate
item.techreborn.plateRedGarnet.name=Red Garnet Plate
item.techreborn.plateRedstone.name=Redstone Plate
item.techreborn.plateRefinedIron.name=Refined Iron Plate
item.techreborn.plateRuby.name=Ruby Plate
item.techreborn.plateSapphire.name=Sapphire Plate
item.techreborn.plateSilicon.name=Silicon Plate
item.techreborn.plateSilver.name=Silver Plate
item.techreborn.plateSteel.name=Steel Plate
item.techreborn.plateTin.name=Tin Plate
item.techreborn.plateTitanium.name=Titanium Plate
item.techreborn.plateTungsten.name=Tungsten Plate
item.techreborn.plateTungstensteel.name=Tungstensteel Plate
item.techreborn.plateWood.name=Wooden Plate
item.techreborn.plateYellowGarnet.name=Yellow Garnet Plate
item.techreborn.plateZinc.name=Zinc Plate
item.techreborn.plate.bronze.name=Bronze Plate
item.techreborn.plate.carbon.name=Carbon Plate
item.techreborn.plate.coal.name=Coal Plate
item.techreborn.plate.chrome.name=Chrome Plate
item.techreborn.plate.copper.name=Copper Plate
item.techreborn.plate.diamond.name=Diamond Plate
item.techreborn.plate.electrum.name=Electrum Plate
item.techreborn.plate.emerald.name=Emerald Plate
item.techreborn.plate.gold.name=Gold Plate
item.techreborn.plate.invar.name=Invar Plate
item.techreborn.plate.iridium.name=Iridium Plate
item.techreborn.plate.iron.name=Iron Plate
item.techreborn.plate.lapis.name=Lapis Lazuli Plate
item.techreborn.plate.lead.name=Lead Plate
item.techreborn.plate.nickel.name=Nickel Plate
item.techreborn.plate.obsidian.name=Obsidian Plate
item.techreborn.plate.peridot.name=Peridot Plate
item.techreborn.plate.platinum.name=Platinum Plate
item.techreborn.plate.red_garnet.name=Red Garnet Plate
item.techreborn.plate.redstone.name=Redstone Plate
item.techreborn.plate.ruby.name=Ruby Plate
item.techreborn.plate.sapphire.name=Sapphire Plate
item.techreborn.plate.silicon.name=Silicon Plate
item.techreborn.plate.silver.name=Silver Plate
item.techreborn.plate.steel.name=Steel Plate
item.techreborn.plate.teslatite.name=Teslatite Plate
item.techreborn.plate.tin.name=Tin Plate
item.techreborn.plate.titanium.name=Titanium Plate
item.techreborn.plate.tungsten.name=Tungsten Plate
item.techreborn.plate.hot_tungstensteel.name=Hot Tungstensteel Plate
item.techreborn.plate.tungstensteel.name=Tungstensteel Plate
item.techreborn.plate.yellow_garnet.name=Yellow Garnet Plate
item.techreborn.plate.zinc.name=Zinc Plate
item.techreborn.plate.refined_iron.name=Refined Iron Plate
item.techreborn.plate.wood.name=Wooden Plate
item.techreborn.plate.lazurite.name=Lazurite Plate
item.techreborn.plate.magnalium.name=Magnalium Plate
item.techreborn.plate.iridium_alloy.name=Iridium Alloy Plate
#Parts
item.techreborn.part.diamond_grinding_head.name=Diamond Grinding Head