Quartz, prismarine, various items, fix upper slab uvlock

This commit is contained in:
Vincent Lee committed 2015-12-27 15:39:45 -06:00
1 parent 65837fbf38
commit 5b1ac0368d
100 files changed
+469 -105

No files matched your search

@@ -9,7 +9,7 @@ public enum CustomBrickVariant implements IStringSerializable {
SOUL_BRICK,
FROSTY_BRICK,
ROOF_TILE,
AZULEJO_1, // todo 1.8 must rename these
AZULEJO_1,
AZULEJO_2,
AZULEJO_3,
AZULEJO_4,
@@ -7,7 +7,7 @@ import java.util.Locale;
public enum PrismarineVariant implements IStringSerializable {
PRISMARINE,
PRISMARINE_BRICKS,
DARK_PRIMSARINE;
DARK_PRISMARINE;
@Override
public String getName() {
@@ -25,11 +25,13 @@ import vazkii.botania.api.state.enums.AltarVariant;
import vazkii.botania.api.state.enums.BiomeBrickVariant;
import vazkii.botania.api.state.enums.BiomeStoneVariant;
import vazkii.botania.api.state.enums.CrateVariant;
import vazkii.botania.api.state.enums.CustomBrickVariant;
import vazkii.botania.api.state.enums.DrumVariant;
import vazkii.botania.api.state.enums.EndBrickVariant;
import vazkii.botania.api.state.enums.FutureStoneVariant;
import vazkii.botania.api.state.enums.LivingRockVariant;
import vazkii.botania.api.state.enums.LivingWoodVariant;
import vazkii.botania.api.state.enums.PrismarineVariant;
import vazkii.botania.api.state.enums.PylonVariant;
import vazkii.botania.api.state.enums.StorageVariant;
import vazkii.botania.common.block.ModBlocks;
@@ -111,17 +113,21 @@ public final class ModelHandler {
registerSlabs();
registerWalls();
registerPanes();
registerUnstableBeaconPetal();
registerAltars();
registerQuartzBlocks();
/** Normal Items **/
registerStandardItems();
registerManaResources();
registerDyesPetals();
registerRunes();
registerBows();
registerLens();
registerItemModelAllMeta(signalFlare, EnumDyeColor.values().length);
registerItemModelAllMeta(dye, EnumDyeColor.values().length);
registerItemModelAllMeta(petal, EnumDyeColor.values().length);
registerItemModelMetas(grassSeeds, LibItemNames.GRASS_SEEDS, 9);
registerItemModelMetas(quartz, LibItemNames.QUARTZ, 8);
registerItemModelMetas(cosmetic, LibItemNames.COSMETIC, 32);
registerItemModelMetas(craftPattern, LibItemNames.CRAFT_PATTERN, 9);
/** Special Item Meshers **/
@@ -209,6 +215,13 @@ public final class ModelHandler {
registerItemModel(ModBlocks.thatch);
registerItemModel(ModBlocks.blazeBlock);
registerItemModel(ModBlocks.forestEye);
registerItemModel(ModBlocks.seaLamp);
registerItemModel(ModBlocks.cellBlock);
// Item models which all use the same base model and recolored by render layer
registerItemModelAllMeta(Item.getItemFromBlock(ModBlocks.unstableBlock), EnumDyeColor.values().length);
registerItemModelAllMeta(Item.getItemFromBlock(ModBlocks.petalBlock), EnumDyeColor.values().length);
registerItemModelAllMeta(Item.getItemFromBlock(ModBlocks.manaBeacon), EnumDyeColor.values().length);
// Blocks which share models with their item, and have only one variant to switch over
registerVariantsDefaulted(ModBlocks.altGrass, AltGrassVariant.class, "variant");
@@ -223,6 +236,8 @@ public final class ModelHandler {
registerVariantsDefaulted(ModFluffBlocks.biomeStoneB, BiomeBrickVariant.class, "variant");
registerVariantsDefaulted(ModBlocks.endStoneBrick, EndBrickVariant.class, "variant");
registerVariantsDefaulted(ModBlocks.openCrate, CrateVariant.class, "variant");
registerVariantsDefaulted(ModBlocks.customBrick, CustomBrickVariant.class, "variant");
registerVariantsDefaulted(ModBlocks.prismarine, PrismarineVariant.class, "variant");
}
private static void registerStandardItems() {
@@ -295,22 +310,6 @@ public final class ModelHandler {
}
}
private static void registerDyesPetals() {
Item item = dye;
String name = GameData.getItemRegistry().getNameForObject(item).toString();
Item item2 = petal;
String name2 = GameData.getItemRegistry().getNameForObject(item2).toString();
for (EnumDyeColor color : EnumDyeColor.values()) {
ModelLoader.registerItemVariants(item, new ModelResourceLocation(name, "inventory"));
ModelLoader.setCustomModelResourceLocation(item, color.getMetadata(), new ModelResourceLocation(name, "inventory"));
ModelLoader.registerItemVariants(item2, new ModelResourceLocation(name2, "inventory"));
ModelLoader.setCustomModelResourceLocation(item2, color.getMetadata(), new ModelResourceLocation(name2, "inventory"));
}
}
private static void registerRunes() {
List<String> variantNames = ImmutableList.of("water", "fire", "earth", "air", "spring", "summer", "autumn", "winter", "mana", "lust", "gluttony", "greed", "sloth", "wrath", "envy", "pride");
for (int i = 0; i < variantNames.size(); i++) {
@@ -623,18 +622,6 @@ public final class ModelHandler {
registerItemModel(ModFluffBlocks.managlassPane);
}
private static void registerUnstableBeaconPetal() {
// The blocks that are dynamically colored, not through their states
for (EnumDyeColor color : EnumDyeColor.values()) {
Item unstable = Item.getItemFromBlock(ModBlocks.unstableBlock);
Item beacon = Item.getItemFromBlock(ModBlocks.manaBeacon);
Item petal = Item.getItemFromBlock(ModBlocks.petalBlock);
ModelLoader.setCustomModelResourceLocation(unstable, color.getMetadata(), new ModelResourceLocation("botania:unstableBlock", "inventory"));
ModelLoader.setCustomModelResourceLocation(beacon, color.getMetadata(), new ModelResourceLocation("botania:manaBeacon", "inventory"));
ModelLoader.setCustomModelResourceLocation(petal, color.getMetadata(), new ModelResourceLocation("botania:petalBlock", "inventory"));
}
}
private static void registerAltars() {
Item item = Item.getItemFromBlock(ModBlocks.altar);
String name = GameData.getBlockRegistry().getNameForObject(ModBlocks.altar).toString();
@@ -645,6 +632,19 @@ public final class ModelHandler {
}
}
private static void registerQuartzBlocks() {
for (Block b : ImmutableList.of(ModFluffBlocks.blazeQuartz, ModFluffBlocks.darkQuartz, ModFluffBlocks.elfQuartz, ModFluffBlocks.lavenderQuartz, ModFluffBlocks.manaQuartz, ModFluffBlocks.redQuartz, ModFluffBlocks.sunnyQuartz)) {
Item item = Item.getItemFromBlock(b);
String name = GameData.getBlockRegistry().getNameForObject(b).toString();
ModelLoader.registerItemVariants(item, new ModelResourceLocation(name, "variant=normal"));
ModelLoader.registerItemVariants(item, new ModelResourceLocation(name, "variant=chiseled"));
ModelLoader.registerItemVariants(item, new ModelResourceLocation(name, "variant=pillar_y"));
ModelLoader.setCustomModelResourceLocation(item, 0, new ModelResourceLocation(name, "variant=normal"));
ModelLoader.setCustomModelResourceLocation(item, 1, new ModelResourceLocation(name, "variant=chiseled"));
ModelLoader.setCustomModelResourceLocation(item, 2, new ModelResourceLocation(name, "variant=pillar_y"));
}
}
private static <T extends Enum<T> & IStringSerializable> void registerVariantsDefaulted(Block b, Class<T> enumclazz, String variantHeader) {
Item item = Item.getItemFromBlock(b);
for (T e : enumclazz.getEnumConstants()) {
@@ -655,8 +655,23 @@ public final class ModelHandler {
}
}
/**
* Registers all metas of the given item to models/item/registryname.json
*/
private static void registerItemModelAllMeta(Item item, int range) {
String loc = GameData.getItemRegistry().getNameForObject(item).toString();
for(int i = 0; i < range; i++) {
ModelLoader.registerItemVariants(item, new ModelResourceLocation(loc, "inventory"));
ModelLoader.setCustomModelResourceLocation(item, i, new ModelResourceLocation(loc, "inventory"));
}
}
/**
* Registers each meta of an item to models/item/registryname<meta>.json
* Range is exclusive upper bound
*/
private static void registerItemModelMetas(Item item, String loc, int range) {
for(int i = 0; i < range;i++) {
for(int i = 0; i < range; i++) {
String name = "botania:" + loc + i;
ModelLoader.registerItemVariants(item, new ModelResourceLocation(name, "inventory"));
ModelLoader.setCustomModelResourceLocation(item, i, new ModelResourceLocation(name, "inventory"));
@@ -66,7 +66,7 @@ public class ModelHourglass extends ModelBase {
base1.render(f);
base2.render(f);
Color c = new Color(color);
GlStateManager.color((byte) c.getRed(), (byte) c.getGreen(), (byte) c.getBlue());
GL11.glColor3ub((byte) c.getRed(), (byte) c.getGreen(), (byte) c.getBlue());
GL11.glPushAttrib(GL11.GL_NORMALIZE);
GlStateManager.enableNormalize();
@@ -99,7 +99,7 @@ public class ModelHourglass extends ModelBase {
}
GL11.glPopAttrib();
GlStateManager.color(1F, 1F, 1F);
GL11.glColor3f(1, 1, 1);
glass1.render(f);
glass2.render(f);
}
@@ -57,7 +57,7 @@ public class BlockSpecialQuartz extends BlockMod implements ILexiconable {
@Override
public int getMetaFromState(IBlockState state) {
return ((QuartzVariant) state.getValue(BotaniaStateProps.QUARTZ_VARIANT)).ordinal();
return state.getValue(BotaniaStateProps.QUARTZ_VARIANT).ordinal();
}
@Override
@@ -105,7 +105,7 @@ public class BlockSpecialQuartz extends BlockMod implements ILexiconable {
@Override
public int damageDropped(IBlockState state) {
QuartzVariant variant = ((QuartzVariant) state.getValue(BotaniaStateProps.QUARTZ_VARIANT));
QuartzVariant variant = state.getValue(BotaniaStateProps.QUARTZ_VARIANT);
if (variant == QuartzVariant.PILLAR_X || variant == QuartzVariant.PILLAR_Z) {
state = state.withProperty(BotaniaStateProps.QUARTZ_VARIANT, QuartzVariant.PILLAR_Y);
}
@@ -119,7 +119,7 @@ public class BlockSpecialQuartz extends BlockMod implements ILexiconable {
@Override
public int getRenderType() {
return 39;
return 3;
}
@Override
@@ -7,7 +7,7 @@ import vazkii.botania.common.block.ModFluffBlocks;
public class BlockDarkPrismarineSlab extends BlockPrismarineSlab {
public BlockDarkPrismarineSlab(boolean full) {
super(full, PrismarineVariant.DARK_PRIMSARINE);
super(full, PrismarineVariant.DARK_PRISMARINE);
}
@Override
@@ -6,7 +6,7 @@ import vazkii.botania.api.state.enums.PrismarineVariant;
public class BlockDarkPrismarineStairs extends BlockPrismarineStairs {
public BlockDarkPrismarineStairs() {
super(PrismarineVariant.DARK_PRIMSARINE);
super(PrismarineVariant.DARK_PRISMARINE);
}
}