Changes after PR review

This commit is contained in:
drcrazy 2018-08-23 13:36:56 +03:00
parent f45da44f2b
commit c86f3dc2f4
3 changed files with 68 additions and 46 deletions

View file

@ -134,7 +134,7 @@ public class RegisterItemJsons {
} }
for (ModPlates plate : ModPlates.values()){ for (ModPlates plate : ModPlates.values()){
registerBlockstateMultiItem(plate.item, plate.name, "items/materials/plates"); plate.registerModel();
} }
name = ItemNuggets.types.clone(); name = ItemNuggets.types.clone();

View file

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

View file

@ -24,8 +24,17 @@
package techreborn.init; package techreborn.init;
import com.google.common.base.CaseFormat;
import net.minecraft.client.renderer.block.model.ModelResourceLocation;
import net.minecraft.item.Item; import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.util.IStringSerializable; 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.lib.ModInfo; import techreborn.lib.ModInfo;
import techreborn.items.ItemPlates; import techreborn.items.ItemPlates;
@ -35,56 +44,69 @@ import techreborn.items.ItemPlates;
* *
*/ */
public enum ModPlates implements IStringSerializable { public enum ModPlates implements IStringSerializable {
ADVANCED_ALLOY_PLATE("plateAdvancedAlloy"), ADVANCED_ALLOY,
ALUMINUM_PLATE("plateAluminum"), ALUMINUM,
BRASS_PLATE("plateBrass"), BRASS,
BRONZE_PLATE("plateBronze"), BRONZE,
CARBON_PLATE("plateCarbon"), CARBON,
COAL_PLATE("plateCoal"), COAL,
COPPER_PLATE("plateCopper"), COPPER,
DIAMOND_PLATE("plateDiamond"), DIAMOND,
ELECTRUM_PLATE("plateElectrum"), ELECTRUM,
EMERALD_PLATE("plateEmerald"), EMERALD,
GOLD_PLATE("plateGold"), GOLD,
INVAR_PLATE("plateInvar"), INVAR,
IRIDIUM_ALLOY_PLATE("plateIridiumAlloy"), IRIDIUM_ALLOY,
IRIDIUM_PLATE("plateIridium"), IRIDIUM,
IRON_PLATE("plateIron"), IRON,
LAPIS_PLATE("plateLapis"), LAPIS,
LAZURITE_PLATE("plateLazurite"), LAZURITE,
LEAD_PLATE("plateLead"), LEAD,
MAGNALIUM_PLATE("plateMagnalium"), MAGNALIUM,
NICKEL_PLATE("plateNickel"), NICKEL,
OBSIDIAN_PLATE("plateObsidian"), OBSIDIAN,
PERIDOT_PLATE("platePeridot"), PERIDOT,
PLATINUM_PLATE("platePlatinum"), PLATINUM,
RED_GARNET_PLATE("plateRedGarnet"), RED_GARNET,
REDSTONE_PLATE("plateRedstone"), REDSTONE,
REFINED_IRON_PLATE("plateRefinedIron"), REFINED_IRON,
RUBY_PLATE("plateRuby"), RUBY,
SAPPHIRE_PLATE("plateSapphire"), SAPPHIRE,
SILICON_PLATE("plateSilicon"), SILICON,
SILVER_PLATE("plateSilver"), SILVER,
STEEL_PLATE("plateSteel"), STEEL,
TIN_PLATE("plateTin"), TIN,
TITANIUM_PLATE("plateTitanium"), TITANIUM,
TUNGSTEN_PLATE("plateTungsten"), TUNGSTEN,
TUNGSTENSTEEL_PLATE("plateTungstensteel"), TUNGSTENSTEEL,
WOOD_PLATE("plateWood"), WOOD,
YELLOW_GARNET_PLATE("plateYellowGarnet"), YELLOW_GARNET,
ZINC_PLATE("plateZinc"); ZINC;
public final String name; public final String name;
public final Item item; public final Item item;
private ModPlates(String name) { private ModPlates() {
this.name = name; name = CaseFormat.UPPER_UNDERSCORE.to(CaseFormat.LOWER_CAMEL, "PLATE_" + this.toString());
this.item = new ItemPlates(); item = new ItemPlates();
// ModItems will take care about setRegistryName item.setRegistryName(new ResourceLocation(ModInfo.MOD_ID, name));
//this.item.setRegistryName(new ResourceLocation(ModInfo.MOD_ID, name)); item.setTranslationKey(ModInfo.MOD_ID + "." + name);
this.item.setTranslationKey(ModInfo.MOD_ID + "." + name); }
public ItemStack getStack() {
return new ItemStack(item);
} }
public void register() {
RebornRegistry.registerItem(item);
}
@SideOnly(Side.CLIENT)
public void registerModel() {
ResourceLocation blockstateJson = new ResourceLocation(ModInfo.MOD_ID, "items/materials/plates");
ModelLoader.setCustomModelResourceLocation(item, 0, new ModelResourceLocation(blockstateJson, "type=" + name));
}
@Override @Override
public String getName() { public String getName() {
return name; return name;