Finished up the Inversion Pillar animation rendering.

This commit is contained in:
WayofTime 2016-09-14 10:07:53 -04:00
parent dab6e0842b
commit a0b92c0c2f
6 changed files with 37 additions and 24 deletions

View file

@ -3,6 +3,7 @@ Version 2.1.0-60
------------------------------------------------------ ------------------------------------------------------
- Fixed routing node serialization. - Fixed routing node serialization.
- Removed unwanted System.out lines when clicking on the slots in the routing node. - 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 Version 2.1.0-59

View file

@ -56,6 +56,12 @@ public class BlockInversionPillar extends BlockStringContainer implements IVaria
super.breakBlock(world, blockPos, blockState); 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 @Override
public boolean isOpaqueCube(IBlockState state) public boolean isOpaqueCube(IBlockState state)
{ {
@ -91,7 +97,7 @@ public class BlockInversionPillar extends BlockStringContainer implements IVaria
{ {
List<Pair<Integer, String>> ret = new ArrayList<Pair<Integer, String>>(); List<Pair<Integer, String>> ret = new ArrayList<Pair<Integer, String>>();
for (int i = 0; i < names.length; i++) for (int i = 0; i < names.length; i++)
ret.add(new ImmutablePair<Integer, String>(i, "type=" + names[i])); ret.add(new ImmutablePair<Integer, String>(i, "static=false,type=" + names[i]));
return ret; return ret;
} }
@ -104,6 +110,6 @@ public class BlockInversionPillar extends BlockStringContainer implements IVaria
@Override @Override
protected BlockStateContainer createRealBlockState() 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 });
} }
} }

View file

@ -46,9 +46,9 @@ public class TileInversionPillar extends TileTicking
public static double minimumWillForChunkWhenSpreading = 100; public static double minimumWillForChunkWhenSpreading = 100;
private final IAnimationStateMachine asm; 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 cycleLength = new VariableValue(4);
private final VariableValue clickTime = new VariableValue(0);
public EnumDemonWillType type; public EnumDemonWillType type;
public double currentInversion = 0; public double currentInversion = 0;
@ -72,12 +72,19 @@ public class TileInversionPillar extends TileTicking
public TileInversionPillar(EnumDemonWillType type) public TileInversionPillar(EnumDemonWillType type)
{ {
this.type = type; this.type = type;
asm = BloodMagic.proxy.load(new ResourceLocation(Constants.Mod.MODID.toLowerCase(), "asms/block/inversion_pillar.json"), ImmutableMap.<String, ITimeValue>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.<String, ITimeValue>of("offset", animationOffset, "cycle_length", cycleLength));
animationOffsetValue = -1;
} }
@Override @Override
public void onUpdate() public void onUpdate()
{ {
if (animationOffsetValue < 0)
{
animationOffsetValue = worldObj.getTotalWorldTime() * worldObj.rand.nextFloat();
animationOffset.setValue(animationOffsetValue);
}
if (worldObj.isRemote) if (worldObj.isRemote)
{ {
return; return;
@ -281,6 +288,9 @@ public class TileInversionPillar extends TileTicking
currentInversion = tag.getDouble("currentInversion"); currentInversion = tag.getDouble("currentInversion");
currentInfectionRadius = tag.getInteger("currentInfectionRadius"); currentInfectionRadius = tag.getInteger("currentInfectionRadius");
consecutiveFailedChecks = tag.getInteger("consecutiveFailedChecks"); consecutiveFailedChecks = tag.getInteger("consecutiveFailedChecks");
animationOffsetValue = tag.getFloat("animationOffset");
animationOffset.setValue(animationOffsetValue);
} }
@Override @Override
@ -292,6 +302,7 @@ public class TileInversionPillar extends TileTicking
tag.setDouble("currentInversion", currentInversion); tag.setDouble("currentInversion", currentInversion);
tag.setInteger("currentInfectionRadius", currentInfectionRadius); tag.setInteger("currentInfectionRadius", currentInfectionRadius);
tag.setInteger("consecutiveFailedChecks", consecutiveFailedChecks); tag.setInteger("consecutiveFailedChecks", consecutiveFailedChecks);
tag.setFloat("animationOffset", animationOffsetValue);
return tag; return tag;
} }

View file

@ -16,7 +16,7 @@
"variable": "offset_y", "variable": "offset_y",
"type": "uniform", "type": "uniform",
"interpolation": "linear", "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", "variable": "axis_y",
@ -29,16 +29,13 @@
"type": "uniform", "type": "uniform",
"interpolation": "linear", "interpolation": "linear",
"samples": [ "samples": [
0, 120, 240,
0, 120, 240,
0, 120, 240,
0, 120, 240 0, 120, 240
] ]
} }
] ]
}, },
"events": { "events": {
"0.5": "boop"
} }
} }
} }

View file

@ -1,23 +1,13 @@
{ {
"parameters": { "parameters": {
"clip_time": [ "-/", "#offset", "#cycle_length" ], "clip_time": [ "-/", "#offset", "#cycle_length" ]
"round_cycle": [ "compose", [ "-R+", "#offset", "#cycle_length", "#offset" ] , "#click_time" ],
"end_cycle": [ "-", "#round_cycle" ]
}, },
"clips": { "clips": {
"default": "bloodmagic:block/inversion_pillar@default", "moving": [ "apply", "bloodmagic:block/pillar_mid@moving", "#clip_time" ]
"moving": [ "apply", "bloodmagic:block/inversion_pillar@moving", "#clip_time" ],
"stopping": [ "trigger_positive", "#moving", "#end_cycle", "!transition:default" ]
}, },
"states": [ "states": [
"default", "moving"
"moving",
"stopping"
], ],
"transitions": { "transitions": {},
"default": "moving",
"moving": "stopping",
"stopping": "default"
},
"start_state": "moving" "start_state": "moving"
} }

View file

@ -36,6 +36,14 @@
} }
} }
}, },
"static": {
"true": {
"model": "builtin/generated"
},
"false": {
"model": "bloodmagic:pillar_mid"
}
},
"inventory": [{}] "inventory": [{}]
} }
} }