diff --git a/changelog.txt b/changelog.txt index 6cbbd806..2da49f60 100644 --- a/changelog.txt +++ b/changelog.txt @@ -3,6 +3,7 @@ Version 2.1.0-60 ------------------------------------------------------ - Fixed routing node serialization. - Removed unwanted System.out lines when clicking on the slots in the routing node. +- Added fancy rendering for the Inversion Pillars. ------------------------------------------------------ Version 2.1.0-59 diff --git a/src/main/java/WayofTime/bloodmagic/block/BlockInversionPillar.java b/src/main/java/WayofTime/bloodmagic/block/BlockInversionPillar.java index acdd532c..9945415f 100644 --- a/src/main/java/WayofTime/bloodmagic/block/BlockInversionPillar.java +++ b/src/main/java/WayofTime/bloodmagic/block/BlockInversionPillar.java @@ -56,6 +56,12 @@ public class BlockInversionPillar extends BlockStringContainer implements IVaria super.breakBlock(world, blockPos, blockState); } + @Override + public IBlockState getActualState(IBlockState state, IBlockAccess world, BlockPos pos) + { + return super.getActualState(state, world, pos).withProperty(Properties.StaticProperty, true); + } + @Override public boolean isOpaqueCube(IBlockState state) { @@ -91,7 +97,7 @@ public class BlockInversionPillar extends BlockStringContainer implements IVaria { List> ret = new ArrayList>(); for (int i = 0; i < names.length; i++) - ret.add(new ImmutablePair(i, "type=" + names[i])); + ret.add(new ImmutablePair(i, "static=false,type=" + names[i])); return ret; } @@ -104,6 +110,6 @@ public class BlockInversionPillar extends BlockStringContainer implements IVaria @Override protected BlockStateContainer createRealBlockState() { - return new ExtendedBlockState(this, new IProperty[] { stringProp }, new IUnlistedProperty[] { unlistedStringProp, Properties.AnimationProperty }); + return new ExtendedBlockState(this, new IProperty[] { stringProp, Properties.StaticProperty }, new IUnlistedProperty[] { unlistedStringProp, Properties.AnimationProperty }); } } diff --git a/src/main/java/WayofTime/bloodmagic/tile/TileInversionPillar.java b/src/main/java/WayofTime/bloodmagic/tile/TileInversionPillar.java index 20709911..370a9fba 100644 --- a/src/main/java/WayofTime/bloodmagic/tile/TileInversionPillar.java +++ b/src/main/java/WayofTime/bloodmagic/tile/TileInversionPillar.java @@ -46,9 +46,9 @@ public class TileInversionPillar extends TileTicking public static double minimumWillForChunkWhenSpreading = 100; private final IAnimationStateMachine asm; - private final VariableValue offset = new VariableValue(0); + private float animationOffsetValue = 0; + private final VariableValue animationOffset = new VariableValue(0); private final VariableValue cycleLength = new VariableValue(4); - private final VariableValue clickTime = new VariableValue(0); public EnumDemonWillType type; public double currentInversion = 0; @@ -72,12 +72,19 @@ public class TileInversionPillar extends TileTicking public TileInversionPillar(EnumDemonWillType type) { this.type = type; - asm = BloodMagic.proxy.load(new ResourceLocation(Constants.Mod.MODID.toLowerCase(), "asms/block/inversion_pillar.json"), ImmutableMap.of("offset", offset, "cycle_length", cycleLength, "click_time", clickTime)); + asm = BloodMagic.proxy.load(new ResourceLocation(Constants.Mod.MODID.toLowerCase(), "asms/block/inversion_pillar.json"), ImmutableMap.of("offset", animationOffset, "cycle_length", cycleLength)); + animationOffsetValue = -1; } @Override public void onUpdate() { + if (animationOffsetValue < 0) + { + animationOffsetValue = worldObj.getTotalWorldTime() * worldObj.rand.nextFloat(); + animationOffset.setValue(animationOffsetValue); + } + if (worldObj.isRemote) { return; @@ -281,6 +288,9 @@ public class TileInversionPillar extends TileTicking currentInversion = tag.getDouble("currentInversion"); currentInfectionRadius = tag.getInteger("currentInfectionRadius"); consecutiveFailedChecks = tag.getInteger("consecutiveFailedChecks"); + + animationOffsetValue = tag.getFloat("animationOffset"); + animationOffset.setValue(animationOffsetValue); } @Override @@ -292,6 +302,7 @@ public class TileInversionPillar extends TileTicking tag.setDouble("currentInversion", currentInversion); tag.setInteger("currentInfectionRadius", currentInfectionRadius); tag.setInteger("consecutiveFailedChecks", consecutiveFailedChecks); + tag.setFloat("animationOffset", animationOffsetValue); return tag; } diff --git a/src/main/resources/assets/bloodmagic/armatures/block/inversion_pillar.json b/src/main/resources/assets/bloodmagic/armatures/block/pillar_mid.json similarity index 86% rename from src/main/resources/assets/bloodmagic/armatures/block/inversion_pillar.json rename to src/main/resources/assets/bloodmagic/armatures/block/pillar_mid.json index 417ed761..16d07d04 100644 --- a/src/main/resources/assets/bloodmagic/armatures/block/inversion_pillar.json +++ b/src/main/resources/assets/bloodmagic/armatures/block/pillar_mid.json @@ -16,7 +16,7 @@ "variable": "offset_y", "type": "uniform", "interpolation": "linear", - "samples": [ 0, 0.08, 0.25, 0.42, 0.5, 0.42, 0.25, 0.08 ] + "samples": [ -0.0625, -0.0442, 0, 0.0442, 0.0625, 0.0442, 0, -0.0442 ] }, { "variable": "axis_y", @@ -29,16 +29,13 @@ "type": "uniform", "interpolation": "linear", "samples": [ - 0, 120, 240, - 0, 120, 240, - 0, 120, 240, 0, 120, 240 ] } ] }, "events": { - "0.5": "boop" + } } } diff --git a/src/main/resources/assets/bloodmagic/asms/block/inversion_pillar.json b/src/main/resources/assets/bloodmagic/asms/block/inversion_pillar.json index ac245bdb..2ebde5e6 100644 --- a/src/main/resources/assets/bloodmagic/asms/block/inversion_pillar.json +++ b/src/main/resources/assets/bloodmagic/asms/block/inversion_pillar.json @@ -1,23 +1,13 @@ { "parameters": { - "clip_time": [ "-/", "#offset", "#cycle_length" ], - "round_cycle": [ "compose", [ "-R+", "#offset", "#cycle_length", "#offset" ] , "#click_time" ], - "end_cycle": [ "-", "#round_cycle" ] + "clip_time": [ "-/", "#offset", "#cycle_length" ] }, "clips": { - "default": "bloodmagic:block/inversion_pillar@default", - "moving": [ "apply", "bloodmagic:block/inversion_pillar@moving", "#clip_time" ], - "stopping": [ "trigger_positive", "#moving", "#end_cycle", "!transition:default" ] + "moving": [ "apply", "bloodmagic:block/pillar_mid@moving", "#clip_time" ] }, "states": [ - "default", - "moving", - "stopping" + "moving" ], - "transitions": { - "default": "moving", - "moving": "stopping", - "stopping": "default" - }, + "transitions": {}, "start_state": "moving" } \ No newline at end of file diff --git a/src/main/resources/assets/bloodmagic/blockstates/BlockInversionPillar.json b/src/main/resources/assets/bloodmagic/blockstates/BlockInversionPillar.json index 89ceccaf..fdf9e93d 100644 --- a/src/main/resources/assets/bloodmagic/blockstates/BlockInversionPillar.json +++ b/src/main/resources/assets/bloodmagic/blockstates/BlockInversionPillar.json @@ -36,6 +36,14 @@ } } }, + "static": { + "true": { + "model": "builtin/generated" + }, + "false": { + "model": "bloodmagic:pillar_mid" + } + }, "inventory": [{}] } }