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) {