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 db5076b7f..f404c130a 100644 --- a/src/main/java/vazkii/botania/client/core/handler/ModelHandler.java +++ b/src/main/java/vazkii/botania/client/core/handler/ModelHandler.java @@ -630,7 +630,7 @@ public final class ModelHandler { ForgeHooksClient.registerTESRItemStack(Item.getItemFromBlock(ModBlocks.hourglass), 0, TileHourglass.class); registerItemModel(ModBlocks.pump); // todo await animation api - ForgeHooksClient.registerTESRItemStack(Item.getItemFromBlock(ModBlocks.pump), 0, TilePump.class); + //ForgeHooksClient.registerTESRItemStack(Item.getItemFromBlock(ModBlocks.pump), 0, TilePump.class); registerItemModel(ModBlocks.teruTeruBozu); ForgeHooksClient.registerTESRItemStack(Item.getItemFromBlock(ModBlocks.teruTeruBozu), 0, TileTeruTeruBozu.class); @@ -806,7 +806,6 @@ public final class ModelHandler { ModelLoader.setCustomStateMapper(ModBlocks.brewery, new StateMap.Builder().ignore(BotaniaStateProps.POWERED).build()); ModelLoader.setCustomStateMapper(ModBlocks.gaiaHead, new StateMap.Builder().ignore(BlockSkull.FACING, BlockSkull.NODROP).build()); ModelLoader.setCustomStateMapper(ModBlocks.hourglass, new StateMap.Builder().ignore(BotaniaStateProps.POWERED).build()); - ModelLoader.setCustomStateMapper(ModBlocks.pump, new StateMap.Builder().ignore(BotaniaStateProps.CARDINALS).build()); } private static void registerMushrooms() { diff --git a/src/main/java/vazkii/botania/client/core/proxy/ClientProxy.java b/src/main/java/vazkii/botania/client/core/proxy/ClientProxy.java index 021feaa71..004470d7d 100644 --- a/src/main/java/vazkii/botania/client/core/proxy/ClientProxy.java +++ b/src/main/java/vazkii/botania/client/core/proxy/ClientProxy.java @@ -34,6 +34,7 @@ import net.minecraft.util.EnumFacing; import net.minecraft.util.MovingObjectPosition; import net.minecraft.world.World; import net.minecraft.world.WorldSettings.GameType; +import net.minecraftforge.client.model.animation.AnimationTESR; import net.minecraftforge.common.MinecraftForge; import vazkii.botania.api.item.IExtendedPlayerController; import vazkii.botania.api.lexicon.LexiconEntry; @@ -236,14 +237,13 @@ public class ClientProxy extends CommonProxy { ClientRegistry.bindTileEntitySpecialRenderer(TileFloatingFlower.class, renderTileFloatingFlower); ClientRegistry.bindTileEntitySpecialRenderer(TileFloatingSpecialFlower.class, renderTileFloatingFlower); ClientRegistry.bindTileEntitySpecialRenderer(TileTinyPotato.class, new RenderTileTinyPotato()); - // ClientRegistry.bindTileEntitySpecialRenderer(TileSpawnerClaw.class, new RenderTileSpawnerClaw()); ClientRegistry.bindTileEntitySpecialRenderer(TileStarfield.class, new RenderTileStarfield()); ClientRegistry.bindTileEntitySpecialRenderer(TileBrewery.class, new RenderTileBrewery()); ClientRegistry.bindTileEntitySpecialRenderer(TileTerraPlate.class, new RenderTileTerraPlate()); ClientRegistry.bindTileEntitySpecialRenderer(TileRedString.class, new RenderTileRedString()); ClientRegistry.bindTileEntitySpecialRenderer(TilePrism.class, new RenderTilePrism()); ClientRegistry.bindTileEntitySpecialRenderer(TileCorporeaIndex.class, new RenderTileCorporeaIndex()); - ClientRegistry.bindTileEntitySpecialRenderer(TilePump.class, new RenderTilePump()); + ClientRegistry.bindTileEntitySpecialRenderer(TilePump.class, new AnimationTESR<>()); ClientRegistry.bindTileEntitySpecialRenderer(TileCorporeaCrystalCube.class, new RenderTileCorporeaCrystalCube()); ClientRegistry.bindTileEntitySpecialRenderer(TileIncensePlate.class, new RenderTileIncensePlate()); ClientRegistry.bindTileEntitySpecialRenderer(TileHourglass.class, new RenderTileHourglass()); diff --git a/src/main/java/vazkii/botania/common/block/mana/BlockPump.java b/src/main/java/vazkii/botania/common/block/mana/BlockPump.java index 5579468c7..c51408b62 100644 --- a/src/main/java/vazkii/botania/common/block/mana/BlockPump.java +++ b/src/main/java/vazkii/botania/common/block/mana/BlockPump.java @@ -78,11 +78,6 @@ public class BlockPump extends BlockModContainer implements ILexiconable { } } - @Override - public int getRenderType() { - return 2; - } - @Override public boolean isOpaqueCube() { return false; diff --git a/src/main/java/vazkii/botania/common/block/tile/mana/TilePump.java b/src/main/java/vazkii/botania/common/block/tile/mana/TilePump.java index 93555c126..d8ea04335 100644 --- a/src/main/java/vazkii/botania/common/block/tile/mana/TilePump.java +++ b/src/main/java/vazkii/botania/common/block/tile/mana/TilePump.java @@ -10,14 +10,23 @@ */ package vazkii.botania.common.block.tile.mana; +import com.google.common.collect.ImmutableMap; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.util.EnumParticleTypes; import net.minecraft.util.ITickable; import net.minecraft.util.EnumFacing; +import net.minecraft.util.ResourceLocation; +import net.minecraftforge.client.model.animation.Animation; +import net.minecraftforge.client.model.animation.IAnimationProvider; +import net.minecraftforge.client.model.animation.ITimeValue; +import net.minecraftforge.client.model.animation.TimeValues; +import net.minecraftforge.common.model.animation.IAnimationStateMachine; +import net.minecraftforge.fml.common.FMLCommonHandler; +import net.minecraftforge.fml.relauncher.Side; import vazkii.botania.api.internal.VanillaPacketDispatcher; import vazkii.botania.common.block.tile.TileMod; -public class TilePump extends TileMod { +public class TilePump extends TileMod implements IAnimationProvider { private static final String TAG_ACTIVE = "active"; @@ -31,6 +40,19 @@ public class TilePump extends TileMod { public boolean hasRedstone = false; int lastComparator = 0; + private final TimeValues.VariableValue move; + private final IAnimationStateMachine asm; + + public TilePump() { + if (FMLCommonHandler.instance().getSide() == Side.CLIENT) { + move = new TimeValues.VariableValue(0); + asm = Animation.INSTANCE.load(new ResourceLocation("botania", "asms/block/pump.json"), ImmutableMap.of("move", move)); + } else { + move = null; + asm = null; + } + } + @Override public void updateEntity() { hasRedstone = false; @@ -64,11 +86,15 @@ public class TilePump extends TileMod { moving = 0F; } } + move.setValue(innerRingPos); + if(!hasCartOnTop) comparator = 0; - if(!hasCart && active) + if(!hasCart && active) { + setActive(false); + } if(active && hasRedstone) setActive(false); @@ -88,6 +114,8 @@ public class TilePump extends TileMod { @Override public void readCustomNBT(NBTTagCompound cmp) { active = cmp.getBoolean(TAG_ACTIVE); + if(worldObj != null && worldObj.isRemote) + asm.transition(active ? "moving" : "default"); } public void setActive(boolean active) { @@ -99,4 +127,8 @@ public class TilePump extends TileMod { } } + @Override + public IAnimationStateMachine asm() { + return asm; + } } diff --git a/src/main/resources/assets/botania/armatures/block/pump_head.json b/src/main/resources/assets/botania/armatures/block/pump_head.json new file mode 100644 index 000000000..eccd0533d --- /dev/null +++ b/src/main/resources/assets/botania/armatures/block/pump_head.json @@ -0,0 +1,24 @@ +{ + "joints": { + "head": { "0": [ 1.0 ], "1": [ 1.0 ], "2": [ 1.0 ], "3": [ 1.0 ] } + }, + "clips": { + "default": { + "loop": false, + "joint_clips": {}, + "events": {} + }, + "moving": { + "loop": true, + "joint_clips": { + "head": [{ + "variable": "offset_z", + "type": "uniform", + "interpolation": "linear", + "samples": [ 0.0, 3.2, 4.0, 4.8, 8.0, 4.8, 4.0, 3.2, 0.0 ] + }] + }, + "events": {} + } + } +} \ No newline at end of file diff --git a/src/main/resources/assets/botania/asms/block/pump.json b/src/main/resources/assets/botania/asms/block/pump.json new file mode 100644 index 000000000..1460a8c95 --- /dev/null +++ b/src/main/resources/assets/botania/asms/block/pump.json @@ -0,0 +1,13 @@ +{ + "parameters": {}, + "clips": { + "default": "botania:block/pump_head@default", + "moving": [ "apply", "botania:block/pump_head@moving", "#move"] + }, + "states": [ "default", "moving" ], + "transitions": { + "default": "moving", + "moving": "default" + }, + "start_state": "default" +} \ No newline at end of file diff --git a/src/main/resources/assets/botania/blockstates/pump.json b/src/main/resources/assets/botania/blockstates/pump.json index f458ec0ee..b5742676b 100644 --- a/src/main/resources/assets/botania/blockstates/pump.json +++ b/src/main/resources/assets/botania/blockstates/pump.json @@ -1,12 +1,52 @@ { "forge_marker": 1, "defaults": { - "model": "botania:dummy", + "model": "botania:pump", "textures": { "particle": "botania:blocks/livingrock0" - } + }, + "transform": "forge:default-block" }, "variants": { - "normal": [{}] + "facing": { + "north": { + "submodel": { + "head": { + "model": "botania:pump_head" + } + } + }, + "south": { + "y": 180, + "submodel": { + "head": { + "model": "botania:pump_head" + } + } + }, + "west": { + "y": 270, + "submodel": { + "head": { + "model": "botania:pump_head" + } + } + }, + "east": { + "y": 90, + "submodel": { + "head": { + "model": "botania:pump_head" + } + } + } + }, + "inventory": [{ + "submodel": { + "head": { + "model": "botania:pump_head" + } + } + }] } } \ No newline at end of file diff --git a/src/main/resources/assets/botania/models/block/pump.json b/src/main/resources/assets/botania/models/block/pump.json new file mode 100644 index 000000000..aaf097f1b --- /dev/null +++ b/src/main/resources/assets/botania/models/block/pump.json @@ -0,0 +1,95 @@ +{ + "elements": [ + { + "name": "EndNorth", + "from": [ 4.0, 0.0, 0.0 ], + "to": [ 12.0, 8.0, 1.0 ], + "faces": { + "north": { "texture": "#-1", "uv": [ 0.0, 0.0, 8.0, 8.0 ] }, + "east": { "texture": "#-1", "uv": [ 0.0, 0.0, 1.0, 8.0 ] }, + "south": { "texture": "#-1", "uv": [ 0.0, 0.0, 8.0, 8.0 ] }, + "west": { "texture": "#-1", "uv": [ 0.0, 0.0, 1.0, 8.0 ] }, + "up": { "texture": "#-1", "uv": [ 0.0, 0.0, 8.0, 1.0 ] }, + "down": { "texture": "#-1", "uv": [ 0.0, 0.0, 8.0, 1.0 ] } + } + }, + { + "name": "EndSouth", + "from": [ 4.0, 0.0, 15.0 ], + "to": [ 12.0, 8.0, 16.0 ], + "faces": { + "north": { "texture": "#-1", "uv": [ 0.0, 0.0, 8.0, 8.0 ] }, + "east": { "texture": "#-1", "uv": [ 0.0, 0.0, 1.0, 8.0 ] }, + "south": { "texture": "#-1", "uv": [ 0.0, 0.0, 8.0, 8.0 ] }, + "west": { "texture": "#-1", "uv": [ 0.0, 0.0, 1.0, 8.0 ] }, + "up": { "texture": "#-1", "uv": [ 0.0, 0.0, 8.0, 1.0 ] }, + "down": { "texture": "#-1", "uv": [ 0.0, 0.0, 8.0, 1.0 ] } + } + }, + { + "name": "Axle", + "from": [ 6.0, 2.0, 1.0 ], + "to": [ 10.0, 6.0, 15.0 ], + "faces": { + "north": { "texture": "#-1", "uv": [ 0.0, 0.0, 4.0, 4.0 ] }, + "east": { "texture": "#-1", "uv": [ 0.0, 0.0, 14.0, 4.0 ] }, + "south": { "texture": "#-1", "uv": [ 0.0, 0.0, 4.0, 4.0 ] }, + "west": { "texture": "#-1", "uv": [ 0.0, 0.0, 14.0, 4.0 ] }, + "up": { "texture": "#-1", "uv": [ 0.0, 0.0, 4.0, 14.0 ] }, + "down": { "texture": "#-1", "uv": [ 0.0, 0.0, 4.0, 14.0 ] } + } + }, + { + "name": "PinkTop", + "from": [ 4.0, 7.0, 11.0 ], + "to": [ 12.0, 8.0, 15.0 ], + "faces": { + "north": { "texture": "#-1", "uv": [ 0.0, 0.0, 8.0, 1.0 ] }, + "east": { "texture": "#-1", "uv": [ 0.0, 0.0, 4.0, 1.0 ] }, + "south": { "texture": "#-1", "uv": [ 0.0, 0.0, 8.0, 1.0 ] }, + "west": { "texture": "#-1", "uv": [ 0.0, 0.0, 4.0, 1.0 ] }, + "up": { "texture": "#-1", "uv": [ 0.0, 0.0, 8.0, 4.0 ] }, + "down": { "texture": "#-1", "uv": [ 0.0, 0.0, 8.0, 4.0 ] } + } + }, + { + "name": "PinkBottom", + "from": [ 4.0, 0.0, 11.0 ], + "to": [ 12.0, 1.0, 15.0 ], + "faces": { + "north": { "texture": "#-1", "uv": [ 0.0, 0.0, 8.0, 1.0 ] }, + "east": { "texture": "#-1", "uv": [ 0.0, 0.0, 4.0, 1.0 ] }, + "south": { "texture": "#-1", "uv": [ 0.0, 0.0, 8.0, 1.0 ] }, + "west": { "texture": "#-1", "uv": [ 0.0, 0.0, 4.0, 1.0 ] }, + "up": { "texture": "#-1", "uv": [ 0.0, 0.0, 8.0, 4.0 ] }, + "down": { "texture": "#-1", "uv": [ 0.0, 0.0, 8.0, 4.0 ] } + } + }, + { + "name": "PinkWest", + "from": [ 4.0, 1.0, 11.0 ], + "to": [ 5.0, 7.0, 15.0 ], + "faces": { + "north": { "texture": "#-1", "uv": [ 0.0, 0.0, 1.0, 6.0 ] }, + "east": { "texture": "#-1", "uv": [ 0.0, 0.0, 4.0, 6.0 ] }, + "south": { "texture": "#-1", "uv": [ 0.0, 0.0, 1.0, 6.0 ] }, + "west": { "texture": "#-1", "uv": [ 0.0, 0.0, 4.0, 6.0 ] }, + "up": { "texture": "#-1", "uv": [ 0.0, 0.0, 1.0, 4.0 ] }, + "down": { "texture": "#-1", "uv": [ 0.0, 0.0, 1.0, 4.0 ] } + } + }, + { + "name": "PinkEast", + "from": [ 11.0, 1.0, 11.0 ], + "to": [ 12.0, 7.0, 15.0 ], + "faces": { + "north": { "texture": "#-1", "uv": [ 0.0, 0.0, 1.0, 6.0 ] }, + "east": { "texture": "#-1", "uv": [ 0.0, 0.0, 4.0, 6.0 ] }, + "south": { "texture": "#-1", "uv": [ 0.0, 0.0, 1.0, 6.0 ] }, + "west": { "texture": "#-1", "uv": [ 0.0, 0.0, 4.0, 6.0 ] }, + "up": { "texture": "#-1", "uv": [ 0.0, 0.0, 1.0, 4.0 ] }, + "down": { "texture": "#-1", "uv": [ 0.0, 0.0, 1.0, 4.0 ] } + } + } + ] +} \ No newline at end of file diff --git a/src/main/resources/assets/botania/models/block/pump_head.json b/src/main/resources/assets/botania/models/block/pump_head.json new file mode 100644 index 000000000..8cf6b4e7f --- /dev/null +++ b/src/main/resources/assets/botania/models/block/pump_head.json @@ -0,0 +1,56 @@ +{ + "elements": [ + { + "name": "BlueTop", + "from": [ 5.0, 6.0, 1.0 ], + "to": [ 11.0, 7.0, 7.0 ], + "faces": { + "north": { "texture": "#-1", "uv": [ 0.0, 0.0, 6.0, 1.0 ] }, + "east": { "texture": "#-1", "uv": [ 0.0, 0.0, 6.0, 1.0 ] }, + "south": { "texture": "#-1", "uv": [ 0.0, 0.0, 6.0, 1.0 ] }, + "west": { "texture": "#-1", "uv": [ 0.0, 0.0, 6.0, 1.0 ] }, + "up": { "texture": "#-1", "uv": [ 0.0, 0.0, 6.0, 6.0 ] }, + "down": { "texture": "#-1", "uv": [ 0.0, 0.0, 6.0, 6.0 ] } + } + }, + { + "name": "BlueBottom", + "from": [ 5.0, 1.0, 1.0 ], + "to": [ 11.0, 2.0, 7.0 ], + "faces": { + "north": { "texture": "#-1", "uv": [ 0.0, 0.0, 6.0, 1.0 ] }, + "east": { "texture": "#-1", "uv": [ 0.0, 0.0, 6.0, 1.0 ] }, + "south": { "texture": "#-1", "uv": [ 0.0, 0.0, 6.0, 1.0 ] }, + "west": { "texture": "#-1", "uv": [ 0.0, 0.0, 6.0, 1.0 ] }, + "up": { "texture": "#-1", "uv": [ 0.0, 0.0, 6.0, 6.0 ] }, + "down": { "texture": "#-1", "uv": [ 0.0, 0.0, 6.0, 6.0 ] } + } + }, + { + "name": "BlueWest", + "from": [ 5.0, 2.0, 1.0 ], + "to": [ 6.0, 6.0, 7.0 ], + "faces": { + "north": { "texture": "#-1", "uv": [ 0.0, 0.0, 1.0, 4.0 ] }, + "east": { "texture": "#-1", "uv": [ 0.0, 0.0, 6.0, 4.0 ] }, + "south": { "texture": "#-1", "uv": [ 0.0, 0.0, 1.0, 4.0 ] }, + "west": { "texture": "#-1", "uv": [ 0.0, 0.0, 6.0, 4.0 ] }, + "up": { "texture": "#-1", "uv": [ 0.0, 0.0, 1.0, 6.0 ] }, + "down": { "texture": "#-1", "uv": [ 0.0, 0.0, 1.0, 6.0 ] } + } + }, + { + "name": "BlueEast", + "from": [ 10.0, 2.0, 1.0 ], + "to": [ 11.0, 6.0, 7.0 ], + "faces": { + "north": { "texture": "#-1", "uv": [ 0.0, 0.0, 1.0, 4.0 ] }, + "east": { "texture": "#-1", "uv": [ 0.0, 0.0, 6.0, 4.0 ] }, + "south": { "texture": "#-1", "uv": [ 0.0, 0.0, 1.0, 4.0 ] }, + "west": { "texture": "#-1", "uv": [ 0.0, 0.0, 6.0, 4.0 ] }, + "up": { "texture": "#-1", "uv": [ 0.0, 0.0, 1.0, 6.0 ] }, + "down": { "texture": "#-1", "uv": [ 0.0, 0.0, 1.0, 6.0 ] } + } + } + ] +} \ No newline at end of file