diff --git a/src/main/java/vazkii/botania/client/core/handler/ModelHandler.java b/src/main/java/vazkii/botania/client/core/handler/ModelHandler.java index e4c3415cb..1b2871def 100644 --- a/src/main/java/vazkii/botania/client/core/handler/ModelHandler.java +++ b/src/main/java/vazkii/botania/client/core/handler/ModelHandler.java @@ -150,25 +150,6 @@ public final class ModelHandler { /** Special Item Meshers **/ // Cannot use lambdas directly yet because FG/SS can't reobfuscate them, need a dummy wrapper // See https://github.com/MinecraftForge/ForgeGradle/issues/314. - - ModelLoader.registerItemVariants(Item.getItemFromBlock(ModBlocks.pool), - new ModelResourceLocation("botania:pool", "variant=default"), - new ModelResourceLocation("botania:pool", "variant=diluted"), - new ModelResourceLocation("botania:pool", "variant=creative"), - new ModelResourceLocation("botania:pool", "variant=fabulous"), - new ModelResourceLocation("botania:pool", "default_full"), - new ModelResourceLocation("botania:pool", "diluted_full"), - new ModelResourceLocation("botania:pool", "creative_full"), - new ModelResourceLocation("botania:pool", "fabulous_full")); - ModelLoader.setCustomMeshDefinition(Item.getItemFromBlock(ModBlocks.pool), MesherWrapper.of(stack -> { - int meta = stack.getMetadata(); - if (meta < 0 || meta > 3) - meta = 0; - PoolVariant v = PoolVariant.values()[meta]; - boolean renderFull = v == PoolVariant.CREATIVE || (stack.hasTagCompound() && stack.getTagCompound().getBoolean("RenderFull")); - return new ModelResourceLocation("botania:pool", renderFull ? v.getName() + "_full" : "variant=" + v.getName()); - })); - ModelLoader.registerItemVariants(elementiumShears, new ModelResourceLocation("botania:elementiumShears", "inventory"), new ModelResourceLocation("botania:dammitReddit", "inventory")); @@ -357,6 +338,7 @@ public final class ModelHandler { registerVariantsDefaulted(ModBlocks.livingwood, LivingWoodVariant.class, "variant"); registerVariantsDefaulted(ModBlocks.openCrate, CrateVariant.class, "pattern=none,variant"); registerVariantsDefaulted(ModBlocks.platform, PlatformVariant.class, "variant"); + registerVariantsDefaulted(ModBlocks.pool, PoolVariant.class, "variant"); registerVariantsDefaulted(ModBlocks.spreader, SpreaderVariant.class, "variant"); // todo 1.8 this is temporary until animation API is done, currnetly item model textures will not match true spreader texture registerVariantsDefaulted(ModBlocks.storage, StorageVariant.class, "variant"); diff --git a/src/main/java/vazkii/botania/common/item/block/ItemBlockPool.java b/src/main/java/vazkii/botania/common/item/block/ItemBlockPool.java index 1dfa544f2..80f5855c8 100644 --- a/src/main/java/vazkii/botania/common/item/block/ItemBlockPool.java +++ b/src/main/java/vazkii/botania/common/item/block/ItemBlockPool.java @@ -12,18 +12,32 @@ package vazkii.botania.common.item.block; import net.minecraft.block.Block; import net.minecraft.client.resources.I18n; +import net.minecraft.entity.EntityLivingBase; import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.item.IItemPropertyGetter; import net.minecraft.item.ItemStack; +import net.minecraft.util.ResourceLocation; +import net.minecraft.world.World; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; +import vazkii.botania.api.state.enums.PoolVariant; +import vazkii.botania.common.lib.LibMisc; import javax.annotation.Nonnull; +import javax.annotation.Nullable; import java.util.List; public class ItemBlockPool extends ItemBlockWithMetaNameAndColor { public ItemBlockPool(Block par2Block) { super(par2Block); + addPropertyOverride(new ResourceLocation(LibMisc.MOD_ID, "full"), new IItemPropertyGetter() { + @Override + public float apply(ItemStack stack, @Nullable World worldIn, @Nullable EntityLivingBase entityIn) { + boolean renderFull = stack.getItemDamage() == PoolVariant.CREATIVE.ordinal() || (stack.hasTagCompound() && stack.getTagCompound().getBoolean("RenderFull")); + return renderFull ? 1F : 0F; + } + }); } @SideOnly(Side.CLIENT) diff --git a/src/main/resources/assets/botania/blockstates/pool.json b/src/main/resources/assets/botania/blockstates/pool.json index 2cf104169..b4108d997 100644 --- a/src/main/resources/assets/botania/blockstates/pool.json +++ b/src/main/resources/assets/botania/blockstates/pool.json @@ -1,31 +1,8 @@ { - "forge_marker": 1, - "defaults": { - "model": "botania:pool_tinted", - "transform": "forge:default-block" - }, "variants": { - "variant": { - "default": { "textures": { "all": "botania:model/pool" } }, - "diluted": { "textures": { "all": "botania:model/dilutedPool" } }, - "creative": { "textures": { "all": "botania:model/infinitePool" } }, - "fabulous": { "textures": { "all": "botania:model/pool" } } - }, - "default_full": [{ - "model": "botania:pool_filled", - "textures": { "all": "botania:model/pool", "liquid": "botania:blocks/manaWater" } - }], - "diluted_full": [{ - "model": "botania:pool_filled", - "textures": { "all": "botania:model/dilutedPool", "liquid": "botania:blocks/manaWater" } - }], - "creative_full": [{ - "model": "botania:pool_filled", - "textures": { "all": "botania:model/infinitePool", "liquid": "botania:blocks/manaWater" } - }], - "fabulous_full": [{ - "model": "botania:pool_filled", - "textures": { "all": "botania:model/pool", "liquid": "botania:blocks/manaWater" } - }] + "variant=default": { "model": "botania:default_pool" }, + "variant=diluted": { "model": "botania:diluted_pool" }, + "variant=creative": { "model": "botania:creative_pool" }, + "variant=fabulous": { "model": "botania:fabulous_pool" } } } \ No newline at end of file diff --git a/src/main/resources/assets/botania/models/block/creative_pool.json b/src/main/resources/assets/botania/models/block/creative_pool.json new file mode 100644 index 000000000..11fa1c65e --- /dev/null +++ b/src/main/resources/assets/botania/models/block/creative_pool.json @@ -0,0 +1,12 @@ +{ + "parent": "botania:block/shapes/pool", + "textures": { + "all": "botania:model/infinitePool" + }, + "overrides": [{ + "predicate": { + "botania:full": 1 + }, + "model": "botania:block/creative_pool_full" + }] +} \ No newline at end of file diff --git a/src/main/resources/assets/botania/models/block/creative_pool_full.json b/src/main/resources/assets/botania/models/block/creative_pool_full.json new file mode 100644 index 000000000..148cd08fc --- /dev/null +++ b/src/main/resources/assets/botania/models/block/creative_pool_full.json @@ -0,0 +1,7 @@ +{ + "parent": "botania:block/shapes/pool_full", + "textures": { + "all": "botania:model/infinitePool", + "liquid": "botania:blocks/manaWater" + } +} \ No newline at end of file diff --git a/src/main/resources/assets/botania/models/block/default_pool.json b/src/main/resources/assets/botania/models/block/default_pool.json new file mode 100644 index 000000000..bbb969142 --- /dev/null +++ b/src/main/resources/assets/botania/models/block/default_pool.json @@ -0,0 +1,12 @@ +{ + "parent": "botania:block/shapes/pool", + "textures": { + "all": "botania:model/pool" + }, + "overrides": [{ + "predicate": { + "botania:full": 1 + }, + "model": "botania:block/default_pool_full" + }] +} \ No newline at end of file diff --git a/src/main/resources/assets/botania/models/block/default_pool_full.json b/src/main/resources/assets/botania/models/block/default_pool_full.json new file mode 100644 index 000000000..615f4d40a --- /dev/null +++ b/src/main/resources/assets/botania/models/block/default_pool_full.json @@ -0,0 +1,7 @@ +{ + "parent": "botania:block/shapes/pool_full", + "textures": { + "all": "botania:model/pool", + "liquid": "botania:blocks/manaWater" + } +} \ No newline at end of file diff --git a/src/main/resources/assets/botania/models/block/diluted_pool.json b/src/main/resources/assets/botania/models/block/diluted_pool.json new file mode 100644 index 000000000..43647054d --- /dev/null +++ b/src/main/resources/assets/botania/models/block/diluted_pool.json @@ -0,0 +1,12 @@ +{ + "parent": "botania:block/shapes/pool", + "textures": { + "all": "botania:model/dilutedPool" + }, + "overrides": [{ + "predicate": { + "botania:full": 1 + }, + "model": "botania:block/diluted_pool_full" + }] +} \ No newline at end of file diff --git a/src/main/resources/assets/botania/models/block/diluted_pool_full.json b/src/main/resources/assets/botania/models/block/diluted_pool_full.json new file mode 100644 index 000000000..c39b6723c --- /dev/null +++ b/src/main/resources/assets/botania/models/block/diluted_pool_full.json @@ -0,0 +1,7 @@ +{ + "parent": "botania:block/shapes/pool_full", + "textures": { + "all": "botania:model/dilutedPool", + "liquid": "botania:blocks/manaWater" + } +} \ No newline at end of file diff --git a/src/main/resources/assets/botania/models/block/fabulous_pool.json b/src/main/resources/assets/botania/models/block/fabulous_pool.json new file mode 100644 index 000000000..8ae898e5b --- /dev/null +++ b/src/main/resources/assets/botania/models/block/fabulous_pool.json @@ -0,0 +1,12 @@ +{ + "parent": "botania:block/shapes/pool", + "textures": { + "all": "botania:model/pool" + }, + "overrides": [{ + "predicate": { + "botania:full": 1 + }, + "model": "botania:block/fabulous_pool_full" + }] +} \ No newline at end of file diff --git a/src/main/resources/assets/botania/models/block/fabulous_pool_full.json b/src/main/resources/assets/botania/models/block/fabulous_pool_full.json new file mode 100644 index 000000000..615f4d40a --- /dev/null +++ b/src/main/resources/assets/botania/models/block/fabulous_pool_full.json @@ -0,0 +1,7 @@ +{ + "parent": "botania:block/shapes/pool_full", + "textures": { + "all": "botania:model/pool", + "liquid": "botania:blocks/manaWater" + } +} \ No newline at end of file diff --git a/src/main/resources/assets/botania/models/block/pool.json b/src/main/resources/assets/botania/models/block/pool.json deleted file mode 100644 index 988db7dce..000000000 --- a/src/main/resources/assets/botania/models/block/pool.json +++ /dev/null @@ -1,68 +0,0 @@ -{ - "textures": { - "particle": "botania:blocks/livingrock0" - }, - "elements": [ - { - "name": "Base", - "from": [ 0.0, 0.0, 0.0 ], - "to": [ 16.0, 1.0, 16.0 ], - "faces": { - "west": { "texture": "#all", "uv": [ 0.0, 4.0, 4.0, 4.25 ] }, - "north": { "texture": "#all", "uv": [ 4.0, 4.0, 8.0, 4.25 ] }, - "east": { "texture": "#all", "uv": [ 8.0, 4.0, 12.0, 4.25 ] }, - "south": { "texture": "#all", "uv": [ 12.0, 4.0, 16.0, 4.25 ] }, - "up": { "texture": "#all", "uv": [ 4.0, 0.0, 8.0, 4.0 ] }, - "down": { "texture": "#all", "uv": [ 8.0, 0.0, 12.0, 4.0 ], "cullface": "down" } - } - }, - { - "name": "SideSouth", - "from": [ 0.0, 1.0, 15.0 ], - "to": [ 16.0, 8.0, 16.0 ], - "faces": { - "west": { "texture": "#all", "uv": [ 0.0, 0.25, 0.25, 2.0 ], "cullface": "west" }, - "north": { "texture": "#all", "uv": [ 0.25, 0.25, 4.0, 2.0 ] }, - "east": { "texture": "#all", "uv": [ 4.0, 0.25, 4.25, 2.0 ], "cullface": "east" }, - "south": { "texture": "#all", "uv": [ 4.25, 0.25, 8.0, 2.0 ], "cullface": "south" }, - "up": { "texture": "#all", "uv": [ 0.25, 0.0, 4.0, 0.25 ] }, - "down": { "texture": "#all", "uv": [ 4.25, 8.0, 16.0, 0.25 ] } - } - }, - { - "name": "SideNorth", - "from": [ 0.0, 1.0, 0.0 ], - "to": [ 16.0, 8.0, 1.0 ], - "faces": { - "west": { "texture": "#all", "uv": [ 0.0, 0.25, 0.25, 2.0 ], "cullface": "west" }, - "north": { "texture": "#all", "uv": [ 0.25, 0.25, 4.0, 2.0 ], "cullface": "north" }, - "east": { "texture": "#all", "uv": [ 4.0, 0.25, 4.25, 2.0 ], "cullface": "east" }, - "south": { "texture": "#all", "uv": [ 4.25, 0.25, 8.0, 2.0 ] }, - "up": { "texture": "#all", "uv": [ 0.25, 0.0, 4.0, 0.25 ] }, - "down": { "texture": "#all", "uv": [ 4.25, 8.0, 16.0, 0.25 ] } - } - }, - { - "name": "SideWest", - "from": [ 0.0, 1.0, 1.0 ], - "to": [ 1.0, 8.0, 15.0 ], - "faces": { - "west": { "texture": "#all", "uv": [ 0.0, 3.5, 3.5, 5.25 ], "cullface": "west" }, - "east": { "texture": "#all", "uv": [ 3.75, 3.5, 7.25, 5.25 ] }, - "up": { "texture": "#all", "uv": [ 3.5, 1.0, 3.75, 3.5 ] }, - "down": { "texture": "#all", "uv": [ 3.75, 1.0, 4.0, 3.5 ] } - } - }, - { - "name": "SideEast", - "from": [ 15.0, 1.0, 1.0 ], - "to": [ 16.0, 8.0, 15.0 ], - "faces": { - "west": { "texture": "#all", "uv": [ 0.0, 3.5, 3.5, 5.25 ] }, - "east": { "texture": "#all", "uv": [ 3.75, 3.5, 7.25, 5.25 ], "cullface": "east" }, - "up": { "texture": "#all", "uv": [ 3.5, 1.0, 3.75, 3.5 ] }, - "down": { "texture": "#all", "uv": [ 3.75, 1.0, 4.0, 3.5 ] } - } - } - ] -} \ No newline at end of file diff --git a/src/main/resources/assets/botania/models/block/pool_tinted.json b/src/main/resources/assets/botania/models/block/shapes/pool.json similarity index 98% rename from src/main/resources/assets/botania/models/block/pool_tinted.json rename to src/main/resources/assets/botania/models/block/shapes/pool.json index b99d089b9..0a8f0619c 100644 --- a/src/main/resources/assets/botania/models/block/pool_tinted.json +++ b/src/main/resources/assets/botania/models/block/shapes/pool.json @@ -1,4 +1,5 @@ { + "parent": "minecraft:block/block", "textures": { "particle": "botania:blocks/livingrock0" }, diff --git a/src/main/resources/assets/botania/models/block/pool_filled.json b/src/main/resources/assets/botania/models/block/shapes/pool_full.json similarity index 73% rename from src/main/resources/assets/botania/models/block/pool_filled.json rename to src/main/resources/assets/botania/models/block/shapes/pool_full.json index 081311e4b..6342e2f6d 100644 --- a/src/main/resources/assets/botania/models/block/pool_filled.json +++ b/src/main/resources/assets/botania/models/block/shapes/pool_full.json @@ -1,6 +1,7 @@ { + "parent": "minecraft:block/block", "textures": { - "particle": "botania:blocks/livingrock0" + "particle": "#all" }, "elements": [ { @@ -8,12 +9,12 @@ "from": [ 0.0, 0.0, 0.0 ], "to": [ 16.0, 1.0, 16.0 ], "faces": { - "west": { "texture": "#all", "uv": [ 0.0, 4.0, 4.0, 4.25 ] }, - "north": { "texture": "#all", "uv": [ 4.0, 4.0, 8.0, 4.25 ] }, - "east": { "texture": "#all", "uv": [ 8.0, 4.0, 12.0, 4.25 ] }, - "south": { "texture": "#all", "uv": [ 12.0, 4.0, 16.0, 4.25 ] }, - "up": { "texture": "#all", "uv": [ 4.0, 0.0, 8.0, 4.0 ] }, - "down": { "texture": "#all", "uv": [ 8.0, 0.0, 12.0, 4.0 ], "cullface": "down" } + "west": { "texture": "#all", "uv": [ 0.0, 4.0, 4.0, 4.25 ], "tintindex": 0 }, + "north": { "texture": "#all", "uv": [ 4.0, 4.0, 8.0, 4.25 ], "tintindex": 0 }, + "east": { "texture": "#all", "uv": [ 8.0, 4.0, 12.0, 4.25 ], "tintindex": 0 }, + "south": { "texture": "#all", "uv": [ 12.0, 4.0, 16.0, 4.25 ], "tintindex": 0 }, + "up": { "texture": "#all", "uv": [ 4.0, 0.0, 8.0, 4.0 ], "tintindex": 0 }, + "down": { "texture": "#all", "uv": [ 8.0, 0.0, 12.0, 4.0 ], "tintindex": 0, "cullface": "down" } } }, { @@ -21,12 +22,12 @@ "from": [ 0.0, 1.0, 15.0 ], "to": [ 16.0, 8.0, 16.0 ], "faces": { - "west": { "texture": "#all", "uv": [ 0.0, 0.25, 0.25, 2.0 ], "cullface": "west" }, - "north": { "texture": "#all", "uv": [ 0.25, 0.25, 4.0, 2.0 ] }, - "east": { "texture": "#all", "uv": [ 4.0, 0.25, 4.25, 2.0 ], "cullface": "east" }, - "south": { "texture": "#all", "uv": [ 4.25, 0.25, 8.0, 2.0 ], "cullface": "south" }, - "up": { "texture": "#all", "uv": [ 0.25, 0.0, 4.0, 0.25 ] }, - "down": { "texture": "#all", "uv": [ 4.25, 8.0, 16.0, 0.25 ] } + "west": { "texture": "#all", "uv": [ 0.0, 0.25, 0.25, 2.0 ], "tintindex": 0, "cullface": "west" }, + "north": { "texture": "#all", "uv": [ 0.25, 0.25, 4.0, 2.0 ], "tintindex": 0 }, + "east": { "texture": "#all", "uv": [ 4.0, 0.25, 4.25, 2.0 ], "tintindex": 0, "cullface": "east" }, + "south": { "texture": "#all", "uv": [ 4.25, 0.25, 8.0, 2.0 ], "tintindex": 0, "cullface": "south" }, + "up": { "texture": "#all", "uv": [ 0.25, 0.0, 4.0, 0.25 ], "tintindex": 0 }, + "down": { "texture": "#all", "uv": [ 4.25, 8.0, 16.0, 0.25 ], "tintindex": 0 } } }, { @@ -34,12 +35,12 @@ "from": [ 0.0, 1.0, 0.0 ], "to": [ 16.0, 8.0, 1.0 ], "faces": { - "west": { "texture": "#all", "uv": [ 0.0, 0.25, 0.25, 2.0 ], "cullface": "west" }, - "north": { "texture": "#all", "uv": [ 0.25, 0.25, 4.0, 2.0 ], "cullface": "north" }, - "east": { "texture": "#all", "uv": [ 4.0, 0.25, 4.25, 2.0 ], "cullface": "east" }, - "south": { "texture": "#all", "uv": [ 4.25, 0.25, 8.0, 2.0 ] }, - "up": { "texture": "#all", "uv": [ 0.25, 0.0, 4.0, 0.25 ] }, - "down": { "texture": "#all", "uv": [ 4.25, 8.0, 16.0, 0.25 ] } + "west": { "texture": "#all", "uv": [ 0.0, 0.25, 0.25, 2.0 ], "tintindex": 0, "cullface": "west" }, + "north": { "texture": "#all", "uv": [ 0.25, 0.25, 4.0, 2.0 ], "tintindex": 0, "cullface": "north" }, + "east": { "texture": "#all", "uv": [ 4.0, 0.25, 4.25, 2.0 ], "tintindex": 0, "cullface": "east" }, + "south": { "texture": "#all", "uv": [ 4.25, 0.25, 8.0, 2.0 ], "tintindex": 0 }, + "up": { "texture": "#all", "uv": [ 0.25, 0.0, 4.0, 0.25 ], "tintindex": 0 }, + "down": { "texture": "#all", "uv": [ 4.25, 8.0, 16.0, 0.25 ], "tintindex": 0 } } }, { @@ -47,10 +48,10 @@ "from": [ 0.0, 1.0, 1.0 ], "to": [ 1.0, 8.0, 15.0 ], "faces": { - "west": { "texture": "#all", "uv": [ 0.0, 3.5, 3.5, 5.25 ], "cullface": "west" }, - "east": { "texture": "#all", "uv": [ 3.75, 3.5, 7.25, 5.25 ] }, - "up": { "texture": "#all", "uv": [ 3.5, 1.0, 3.75, 3.5 ] }, - "down": { "texture": "#all", "uv": [ 3.75, 1.0, 4.0, 3.5 ] } + "west": { "texture": "#all", "uv": [ 0.0, 3.5, 3.5, 5.25 ], "tintindex": 0, "cullface": "west" }, + "east": { "texture": "#all", "uv": [ 3.75, 3.5, 7.25, 5.25 ], "tintindex": 0 }, + "up": { "texture": "#all", "uv": [ 3.5, 1.0, 3.75, 3.5 ], "tintindex": 0 }, + "down": { "texture": "#all", "uv": [ 3.75, 1.0, 4.0, 3.5 ], "tintindex": 0 } } }, { @@ -58,10 +59,10 @@ "from": [ 15.0, 1.0, 1.0 ], "to": [ 16.0, 8.0, 15.0 ], "faces": { - "west": { "texture": "#all", "uv": [ 0.0, 3.5, 3.5, 5.25 ] }, - "east": { "texture": "#all", "uv": [ 3.75, 3.5, 7.25, 5.25 ], "cullface": "east" }, - "up": { "texture": "#all", "uv": [ 3.5, 1.0, 3.75, 3.5 ] }, - "down": { "texture": "#all", "uv": [ 3.75, 1.0, 4.0, 3.5 ] } + "west": { "texture": "#all", "uv": [ 0.0, 3.5, 3.5, 5.25 ], "tintindex": 0 }, + "east": { "texture": "#all", "uv": [ 3.75, 3.5, 7.25, 5.25 ], "tintindex": 0, "cullface": "east" }, + "up": { "texture": "#all", "uv": [ 3.5, 1.0, 3.75, 3.5 ], "tintindex": 0 }, + "down": { "texture": "#all", "uv": [ 3.75, 1.0, 4.0, 3.5 ], "tintindex": 0 } } }, {