Initial (unsuccessful) tests of the Inversion Pillar animations.
This commit is contained in:
parent
f40f5abc0d
commit
dab6e0842b
|
@ -5,12 +5,17 @@ import java.util.List;
|
||||||
|
|
||||||
import net.minecraft.block.SoundType;
|
import net.minecraft.block.SoundType;
|
||||||
import net.minecraft.block.material.Material;
|
import net.minecraft.block.material.Material;
|
||||||
|
import net.minecraft.block.properties.IProperty;
|
||||||
|
import net.minecraft.block.state.BlockStateContainer;
|
||||||
import net.minecraft.block.state.IBlockState;
|
import net.minecraft.block.state.IBlockState;
|
||||||
import net.minecraft.tileentity.TileEntity;
|
import net.minecraft.tileentity.TileEntity;
|
||||||
import net.minecraft.util.EnumBlockRenderType;
|
import net.minecraft.util.EnumBlockRenderType;
|
||||||
import net.minecraft.util.math.BlockPos;
|
import net.minecraft.util.math.BlockPos;
|
||||||
import net.minecraft.world.IBlockAccess;
|
import net.minecraft.world.IBlockAccess;
|
||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
|
import net.minecraftforge.common.property.ExtendedBlockState;
|
||||||
|
import net.minecraftforge.common.property.IUnlistedProperty;
|
||||||
|
import net.minecraftforge.common.property.Properties;
|
||||||
|
|
||||||
import org.apache.commons.lang3.tuple.ImmutablePair;
|
import org.apache.commons.lang3.tuple.ImmutablePair;
|
||||||
import org.apache.commons.lang3.tuple.Pair;
|
import org.apache.commons.lang3.tuple.Pair;
|
||||||
|
@ -20,7 +25,6 @@ import WayofTime.bloodmagic.api.Constants;
|
||||||
import WayofTime.bloodmagic.api.soul.EnumDemonWillType;
|
import WayofTime.bloodmagic.api.soul.EnumDemonWillType;
|
||||||
import WayofTime.bloodmagic.block.base.BlockStringContainer;
|
import WayofTime.bloodmagic.block.base.BlockStringContainer;
|
||||||
import WayofTime.bloodmagic.client.IVariantProvider;
|
import WayofTime.bloodmagic.client.IVariantProvider;
|
||||||
import WayofTime.bloodmagic.tile.TileAltar;
|
|
||||||
import WayofTime.bloodmagic.tile.TileInversionPillar;
|
import WayofTime.bloodmagic.tile.TileInversionPillar;
|
||||||
|
|
||||||
public class BlockInversionPillar extends BlockStringContainer implements IVariantProvider
|
public class BlockInversionPillar extends BlockStringContainer implements IVariantProvider
|
||||||
|
@ -96,4 +100,10 @@ public class BlockInversionPillar extends BlockStringContainer implements IVaria
|
||||||
{
|
{
|
||||||
return new TileInversionPillar(EnumDemonWillType.values()[meta % 5]);
|
return new TileInversionPillar(EnumDemonWillType.values()[meta % 5]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected BlockStateContainer createRealBlockState()
|
||||||
|
{
|
||||||
|
return new ExtendedBlockState(this, new IProperty[] { stringProp }, new IUnlistedProperty[] { unlistedStringProp, Properties.AnimationProperty });
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -39,8 +39,8 @@ public class BlockString extends Block
|
||||||
{
|
{
|
||||||
private final int maxMeta;
|
private final int maxMeta;
|
||||||
private final List<String> values;
|
private final List<String> values;
|
||||||
private final PropertyString stringProp;
|
protected final PropertyString stringProp;
|
||||||
private final IUnlistedProperty unlistedStringProp;
|
protected final IUnlistedProperty unlistedStringProp;
|
||||||
private final BlockStateContainer realBlockState;
|
private final BlockStateContainer realBlockState;
|
||||||
|
|
||||||
public BlockString(Material material, String[] values, String propName)
|
public BlockString(Material material, String[] values, String propName)
|
||||||
|
|
|
@ -13,7 +13,12 @@ import net.minecraft.item.ItemStack;
|
||||||
import net.minecraft.potion.PotionUtils;
|
import net.minecraft.potion.PotionUtils;
|
||||||
import net.minecraft.util.ResourceLocation;
|
import net.minecraft.util.ResourceLocation;
|
||||||
import net.minecraftforge.client.model.ModelLoader;
|
import net.minecraftforge.client.model.ModelLoader;
|
||||||
|
import net.minecraftforge.client.model.ModelLoaderRegistry;
|
||||||
|
import net.minecraftforge.client.model.animation.AnimationTESR;
|
||||||
import net.minecraftforge.client.model.obj.OBJLoader;
|
import net.minecraftforge.client.model.obj.OBJLoader;
|
||||||
|
import net.minecraftforge.common.animation.Event;
|
||||||
|
import net.minecraftforge.common.animation.ITimeValue;
|
||||||
|
import net.minecraftforge.common.model.animation.IAnimationStateMachine;
|
||||||
import net.minecraftforge.fml.client.registry.ClientRegistry;
|
import net.minecraftforge.fml.client.registry.ClientRegistry;
|
||||||
import net.minecraftforge.fml.client.registry.RenderingRegistry;
|
import net.minecraftforge.fml.client.registry.RenderingRegistry;
|
||||||
import net.minecraftforge.fml.common.ObfuscationReflectionHelper;
|
import net.minecraftforge.fml.common.ObfuscationReflectionHelper;
|
||||||
|
@ -53,11 +58,14 @@ import WayofTime.bloodmagic.registry.ModItems;
|
||||||
import WayofTime.bloodmagic.tile.TileAlchemyArray;
|
import WayofTime.bloodmagic.tile.TileAlchemyArray;
|
||||||
import WayofTime.bloodmagic.tile.TileAltar;
|
import WayofTime.bloodmagic.tile.TileAltar;
|
||||||
import WayofTime.bloodmagic.tile.TileDemonCrucible;
|
import WayofTime.bloodmagic.tile.TileDemonCrucible;
|
||||||
|
import WayofTime.bloodmagic.tile.TileInversionPillar;
|
||||||
import WayofTime.bloodmagic.tile.TileMimic;
|
import WayofTime.bloodmagic.tile.TileMimic;
|
||||||
import WayofTime.bloodmagic.tile.routing.TileRoutingNode;
|
import WayofTime.bloodmagic.tile.routing.TileRoutingNode;
|
||||||
import WayofTime.bloodmagic.util.helper.InventoryRenderHelper;
|
import WayofTime.bloodmagic.util.helper.InventoryRenderHelper;
|
||||||
import WayofTime.bloodmagic.util.helper.InventoryRenderHelperV2;
|
import WayofTime.bloodmagic.util.helper.InventoryRenderHelperV2;
|
||||||
|
|
||||||
|
import com.google.common.collect.ImmutableMap;
|
||||||
|
|
||||||
public class ClientProxy extends CommonProxy
|
public class ClientProxy extends CommonProxy
|
||||||
{
|
{
|
||||||
public static DemonWillHolder currentAura = new DemonWillHolder();
|
public static DemonWillHolder currentAura = new DemonWillHolder();
|
||||||
|
@ -90,6 +98,15 @@ public class ClientProxy extends CommonProxy
|
||||||
ModBlocks.initRenders();
|
ModBlocks.initRenders();
|
||||||
ModItems.initRenders();
|
ModItems.initRenders();
|
||||||
|
|
||||||
|
ClientRegistry.bindTileEntitySpecialRenderer(TileInversionPillar.class, new AnimationTESR<TileInversionPillar>()
|
||||||
|
{
|
||||||
|
@Override
|
||||||
|
public void handleEvents(TileInversionPillar chest, float time, Iterable<Event> pastEvents)
|
||||||
|
{
|
||||||
|
chest.handleEvents(time, pastEvents);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
ClientRegistry.bindTileEntitySpecialRenderer(TileAlchemyArray.class, new RenderAlchemyArray());
|
ClientRegistry.bindTileEntitySpecialRenderer(TileAlchemyArray.class, new RenderAlchemyArray());
|
||||||
ClientRegistry.bindTileEntitySpecialRenderer(TileAltar.class, new RenderAltar());
|
ClientRegistry.bindTileEntitySpecialRenderer(TileAltar.class, new RenderAltar());
|
||||||
ClientRegistry.bindTileEntitySpecialRenderer(TileRoutingNode.class, new RenderItemRoutingNode());
|
ClientRegistry.bindTileEntitySpecialRenderer(TileRoutingNode.class, new RenderItemRoutingNode());
|
||||||
|
@ -198,4 +215,10 @@ public class ClientProxy extends CommonProxy
|
||||||
BloodMagic.instance.getLogger().error(e.getLocalizedMessage());
|
BloodMagic.instance.getLogger().error(e.getLocalizedMessage());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public IAnimationStateMachine load(ResourceLocation location, ImmutableMap<String, ITimeValue> parameters)
|
||||||
|
{
|
||||||
|
return ModelLoaderRegistry.loadASM(location, parameters);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,9 +2,12 @@ package WayofTime.bloodmagic.proxy;
|
||||||
|
|
||||||
import net.minecraft.block.Block;
|
import net.minecraft.block.Block;
|
||||||
import net.minecraft.item.Item;
|
import net.minecraft.item.Item;
|
||||||
|
import net.minecraft.util.ResourceLocation;
|
||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
import net.minecraftforge.common.MinecraftForge;
|
import net.minecraftforge.common.MinecraftForge;
|
||||||
|
import net.minecraftforge.common.animation.ITimeValue;
|
||||||
import net.minecraftforge.common.capabilities.CapabilityManager;
|
import net.minecraftforge.common.capabilities.CapabilityManager;
|
||||||
|
import net.minecraftforge.common.model.animation.IAnimationStateMachine;
|
||||||
import net.minecraftforge.fml.common.registry.GameRegistry;
|
import net.minecraftforge.fml.common.registry.GameRegistry;
|
||||||
import WayofTime.bloodmagic.api.ritual.CapabilityRuneType;
|
import WayofTime.bloodmagic.api.ritual.CapabilityRuneType;
|
||||||
import WayofTime.bloodmagic.api.ritual.IRitualStone;
|
import WayofTime.bloodmagic.api.ritual.IRitualStone;
|
||||||
|
@ -13,6 +16,8 @@ import WayofTime.bloodmagic.fuel.FuelHandler;
|
||||||
import WayofTime.bloodmagic.util.helper.InventoryRenderHelper;
|
import WayofTime.bloodmagic.util.helper.InventoryRenderHelper;
|
||||||
import WayofTime.bloodmagic.util.helper.InventoryRenderHelperV2;
|
import WayofTime.bloodmagic.util.helper.InventoryRenderHelperV2;
|
||||||
|
|
||||||
|
import com.google.common.collect.ImmutableMap;
|
||||||
|
|
||||||
public class CommonProxy
|
public class CommonProxy
|
||||||
{
|
{
|
||||||
@Deprecated
|
@Deprecated
|
||||||
|
@ -63,4 +68,9 @@ public class CommonProxy
|
||||||
{
|
{
|
||||||
// NO-OP
|
// NO-OP
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public IAnimationStateMachine load(ResourceLocation location, ImmutableMap<String, ITimeValue> parameters)
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,9 +10,17 @@ import net.minecraft.block.state.IBlockState;
|
||||||
import net.minecraft.init.Blocks;
|
import net.minecraft.init.Blocks;
|
||||||
import net.minecraft.nbt.NBTTagCompound;
|
import net.minecraft.nbt.NBTTagCompound;
|
||||||
import net.minecraft.util.EnumFacing;
|
import net.minecraft.util.EnumFacing;
|
||||||
|
import net.minecraft.util.ResourceLocation;
|
||||||
import net.minecraft.util.math.BlockPos;
|
import net.minecraft.util.math.BlockPos;
|
||||||
import net.minecraft.util.math.Vec3d;
|
import net.minecraft.util.math.Vec3d;
|
||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
|
import net.minecraftforge.common.animation.Event;
|
||||||
|
import net.minecraftforge.common.animation.ITimeValue;
|
||||||
|
import net.minecraftforge.common.animation.TimeValues.VariableValue;
|
||||||
|
import net.minecraftforge.common.capabilities.Capability;
|
||||||
|
import net.minecraftforge.common.model.animation.CapabilityAnimation;
|
||||||
|
import net.minecraftforge.common.model.animation.IAnimationStateMachine;
|
||||||
|
import WayofTime.bloodmagic.BloodMagic;
|
||||||
import WayofTime.bloodmagic.api.Constants;
|
import WayofTime.bloodmagic.api.Constants;
|
||||||
import WayofTime.bloodmagic.api.soul.EnumDemonWillType;
|
import WayofTime.bloodmagic.api.soul.EnumDemonWillType;
|
||||||
import WayofTime.bloodmagic.demonAura.WorldDemonWillHandler;
|
import WayofTime.bloodmagic.demonAura.WorldDemonWillHandler;
|
||||||
|
@ -20,6 +28,8 @@ import WayofTime.bloodmagic.inversion.InversionPillarHandler;
|
||||||
import WayofTime.bloodmagic.registry.ModBlocks;
|
import WayofTime.bloodmagic.registry.ModBlocks;
|
||||||
import WayofTime.bloodmagic.tile.base.TileTicking;
|
import WayofTime.bloodmagic.tile.base.TileTicking;
|
||||||
|
|
||||||
|
import com.google.common.collect.ImmutableMap;
|
||||||
|
|
||||||
@Getter
|
@Getter
|
||||||
@Setter
|
@Setter
|
||||||
public class TileInversionPillar extends TileTicking
|
public class TileInversionPillar extends TileTicking
|
||||||
|
@ -35,6 +45,11 @@ public class TileInversionPillar extends TileTicking
|
||||||
public static double inversionCostPerWillSpread = 4;
|
public static double inversionCostPerWillSpread = 4;
|
||||||
public static double minimumWillForChunkWhenSpreading = 100;
|
public static double minimumWillForChunkWhenSpreading = 100;
|
||||||
|
|
||||||
|
private final IAnimationStateMachine asm;
|
||||||
|
private final VariableValue offset = new VariableValue(0);
|
||||||
|
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;
|
||||||
public int consecutiveFailedChecks = 0; //If you fail enough checks, increase the radius.
|
public int consecutiveFailedChecks = 0; //If you fail enough checks, increase the radius.
|
||||||
|
@ -57,6 +72,7 @@ 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));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -372,4 +388,38 @@ public class TileInversionPillar extends TileTicking
|
||||||
|
|
||||||
return 3; //The block was air
|
return 3; //The block was air
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void handleEvents(float time, Iterable<Event> pastEvents)
|
||||||
|
{
|
||||||
|
for (Event event : pastEvents)
|
||||||
|
{
|
||||||
|
System.out.println("Event: " + event.event() + " " + event.offset() + " " + getPos() + " " + time);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean hasFastRenderer()
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean hasCapability(Capability<?> capability, EnumFacing side)
|
||||||
|
{
|
||||||
|
if (capability == CapabilityAnimation.ANIMATION_CAPABILITY)
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return super.hasCapability(capability, side);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public <T> T getCapability(Capability<T> capability, EnumFacing side)
|
||||||
|
{
|
||||||
|
if (capability == CapabilityAnimation.ANIMATION_CAPABILITY)
|
||||||
|
{
|
||||||
|
return CapabilityAnimation.ANIMATION_CAPABILITY.cast(asm);
|
||||||
|
}
|
||||||
|
return super.getCapability(capability, side);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,45 @@
|
||||||
|
{
|
||||||
|
"joints": {
|
||||||
|
"ring": { "0": [ 1.0 ], "1": [ 1.0 ], "2": [ 1.0 ], "3": [ 1.0 ], "4": [ 1.0 ], "5": [ 1.0 ], "6": [ 1.0 ], "7": [ 1.0 ], "8": [ 1.0 ], "9": [ 1.0 ], "10": [ 1.0 ], "11": [ 1.0 ], "12": [ 1.0 ], "13": [ 1.0 ], "14": [ 1.0 ], "15": [ 1.0 ], "16": [ 1.0 ], "17": [ 1.0 ], "18": [ 1.0 ], "19": [ 1.0 ], "20": [ 1.0 ], "21": [ 1.0 ], "22": [ 1.0 ] }
|
||||||
|
},
|
||||||
|
"clips": {
|
||||||
|
"default": {
|
||||||
|
"loop": false,
|
||||||
|
"joint_clips": {},
|
||||||
|
"events": {}
|
||||||
|
},
|
||||||
|
"moving": {
|
||||||
|
"loop": true,
|
||||||
|
"joint_clips": {
|
||||||
|
"ring": [
|
||||||
|
{
|
||||||
|
"variable": "offset_y",
|
||||||
|
"type": "uniform",
|
||||||
|
"interpolation": "linear",
|
||||||
|
"samples": [ 0, 0.08, 0.25, 0.42, 0.5, 0.42, 0.25, 0.08 ]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"variable": "axis_y",
|
||||||
|
"type": "uniform",
|
||||||
|
"interpolation": "nearest",
|
||||||
|
"samples": [ 1 ]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"variable": "angle",
|
||||||
|
"type": "uniform",
|
||||||
|
"interpolation": "linear",
|
||||||
|
"samples": [
|
||||||
|
0, 120, 240,
|
||||||
|
0, 120, 240,
|
||||||
|
0, 120, 240,
|
||||||
|
0, 120, 240
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"events": {
|
||||||
|
"0.5": "boop"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,23 @@
|
||||||
|
{
|
||||||
|
"parameters": {
|
||||||
|
"clip_time": [ "-/", "#offset", "#cycle_length" ],
|
||||||
|
"round_cycle": [ "compose", [ "-R+", "#offset", "#cycle_length", "#offset" ] , "#click_time" ],
|
||||||
|
"end_cycle": [ "-", "#round_cycle" ]
|
||||||
|
},
|
||||||
|
"clips": {
|
||||||
|
"default": "bloodmagic:block/inversion_pillar@default",
|
||||||
|
"moving": [ "apply", "bloodmagic:block/inversion_pillar@moving", "#clip_time" ],
|
||||||
|
"stopping": [ "trigger_positive", "#moving", "#end_cycle", "!transition:default" ]
|
||||||
|
},
|
||||||
|
"states": [
|
||||||
|
"default",
|
||||||
|
"moving",
|
||||||
|
"stopping"
|
||||||
|
],
|
||||||
|
"transitions": {
|
||||||
|
"default": "moving",
|
||||||
|
"moving": "stopping",
|
||||||
|
"stopping": "default"
|
||||||
|
},
|
||||||
|
"start_state": "moving"
|
||||||
|
}
|
Loading…
Reference in a new issue