Changes plates registration

This commit is contained in:
drcrazy 2018-08-23 14:05:22 +03:00
parent c86f3dc2f4
commit 45d6317d12
3 changed files with 20 additions and 55 deletions

View file

@ -133,9 +133,7 @@ public class RegisterItemJsons {
registerBlockstate(ModItems.GEMS, i, name[i], "items/materials/"); registerBlockstate(ModItems.GEMS, i, name[i], "items/materials/");
} }
for (ModPlates plate : ModPlates.values()){ ModPlates.registerModel();
plate.registerModel();
}
name = ItemNuggets.types.clone(); name = ItemNuggets.types.clone();
for (int i = 0; i < ItemNuggets.types.length; ++i) { for (int i = 0; i < ItemNuggets.types.length; ++i) {

View file

@ -165,9 +165,7 @@ public class ModItems {
SMALL_DUSTS = new ItemDustsSmall(); SMALL_DUSTS = new ItemDustsSmall();
registerItem(SMALL_DUSTS, "smallDust"); registerItem(SMALL_DUSTS, "smallDust");
for (ModPlates plate : ModPlates.values()){ ModPlates.register();
plate.register();
}
NUGGETS = new ItemNuggets(); NUGGETS = new ItemNuggets();
registerItem(NUGGETS, "nuggets"); registerItem(NUGGETS, "nuggets");

View file

@ -24,6 +24,8 @@
package techreborn.init; package techreborn.init;
import java.util.Arrays;
import com.google.common.base.CaseFormat; import com.google.common.base.CaseFormat;
import net.minecraft.client.renderer.block.model.ModelResourceLocation; import net.minecraft.client.renderer.block.model.ModelResourceLocation;
@ -38,50 +40,15 @@ import reborncore.RebornRegistry;
import techreborn.lib.ModInfo; import techreborn.lib.ModInfo;
import techreborn.items.ItemPlates; import techreborn.items.ItemPlates;
/** /**
* @author drcrazy * @author drcrazy
* *
*/ */
public enum ModPlates implements IStringSerializable { public enum ModPlates implements IStringSerializable {
ADVANCED_ALLOY, ADVANCED_ALLOY, ALUMINUM, BRASS, BRONZE, CARBON, COAL, COPPER, DIAMOND, ELECTRUM, EMERALD, GOLD, INVAR,
ALUMINUM, IRIDIUM_ALLOY, IRIDIUM, IRON, LAPIS, LAZURITE, LEAD, MAGNALIUM, NICKEL, OBSIDIAN, PERIDOT, PLATINUM, RED_GARNET,
BRASS, REDSTONE, REFINED_IRON, RUBY, SAPPHIRE, SILICON, SILVER, STEEL, TIN, TITANIUM, TUNGSTEN, TUNGSTENSTEEL, WOOD,
BRONZE, YELLOW_GARNET, ZINC;
CARBON,
COAL,
COPPER,
DIAMOND,
ELECTRUM,
EMERALD,
GOLD,
INVAR,
IRIDIUM_ALLOY,
IRIDIUM,
IRON,
LAPIS,
LAZURITE,
LEAD,
MAGNALIUM,
NICKEL,
OBSIDIAN,
PERIDOT,
PLATINUM,
RED_GARNET,
REDSTONE,
REFINED_IRON,
RUBY,
SAPPHIRE,
SILICON,
SILVER,
STEEL,
TIN,
TITANIUM,
TUNGSTEN,
TUNGSTENSTEEL,
WOOD,
YELLOW_GARNET,
ZINC;
public final String name; public final String name;
public final Item item; public final Item item;
@ -97,14 +64,16 @@ public enum ModPlates implements IStringSerializable {
return new ItemStack(item); return new ItemStack(item);
} }
public void register() { public static void register() {
RebornRegistry.registerItem(item); Arrays.stream(ModPlates.values()).forEach(plate -> RebornRegistry.registerItem(plate.item));
} }
@SideOnly(Side.CLIENT) @SideOnly(Side.CLIENT)
public void registerModel() { public static void registerModel() {
ResourceLocation blockstateJson = new ResourceLocation(ModInfo.MOD_ID, "items/materials/plates"); ResourceLocation blockstateJson = new ResourceLocation(ModInfo.MOD_ID, "items/materials/plates");
ModelLoader.setCustomModelResourceLocation(item, 0, new ModelResourceLocation(blockstateJson, "type=" + name)); Arrays.stream(ModPlates.values()).forEach(plate -> ModelLoader.setCustomModelResourceLocation(plate.item, 0,
new ModelResourceLocation(blockstateJson, "type=" + plate.name)));
} }
@Override @Override