mirror of
https://github.com/GTNewHorizons/Botania.git
synced 2026-11-23 21:49:50 +00:00
Initial attempt at animated corporea crystal cube
This commit is contained in:
1 parent
d1d8eb801c
commit
988e80a3f2
14 files changed
+155
-48
No files matched your search
@@ -242,7 +242,7 @@ public class ClientProxy extends CommonProxy {
|
||||
ClientRegistry.bindTileEntitySpecialRenderer(TilePrism.class, new RenderTilePrism());
|
||||
ClientRegistry.bindTileEntitySpecialRenderer(TileCorporeaIndex.class, new RenderTileCorporeaIndex());
|
||||
ClientRegistry.bindTileEntitySpecialRenderer(TilePump.class, new AnimationTESR<>());
|
||||
ClientRegistry.bindTileEntitySpecialRenderer(TileCorporeaCrystalCube.class, new RenderTileCorporeaCrystalCube());
|
||||
ClientRegistry.bindTileEntitySpecialRenderer(TileCorporeaCrystalCube.class, new AnimationTESR<>());
|
||||
ClientRegistry.bindTileEntitySpecialRenderer(TileIncensePlate.class, new RenderTileIncensePlate());
|
||||
ClientRegistry.bindTileEntitySpecialRenderer(TileHourglass.class, new RenderTileHourglass());
|
||||
ClientRegistry.bindTileEntitySpecialRenderer(TileSparkChanger.class, new RenderTileSparkChanger());
|
||||
|
||||
@@ -12,6 +12,8 @@ package vazkii.botania.common.block.corporea;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.block.properties.IProperty;
|
||||
import net.minecraft.block.state.BlockState;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.client.particle.EntityDiggingFX;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
@@ -21,7 +23,12 @@ import net.minecraft.util.BlockPos;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.util.EnumParticleTypes;
|
||||
import net.minecraft.util.MathHelper;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.property.ExtendedBlockState;
|
||||
import net.minecraftforge.common.property.IExtendedBlockState;
|
||||
import net.minecraftforge.common.property.IUnlistedProperty;
|
||||
import net.minecraftforge.common.property.Properties;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
import vazkii.botania.api.lexicon.ILexiconable;
|
||||
@@ -42,6 +49,27 @@ public class BlockCorporeaCrystalCube extends BlockCorporeaBase implements ILexi
|
||||
setStepSound(soundTypeMetal);
|
||||
float f = (1F - 10F / 16F) / 2F;
|
||||
setBlockBounds(f, 0F, f, 1F - f, 1F, 1F - f);
|
||||
setDefaultState(((IExtendedBlockState) blockState.getBaseState()).withProperty(Properties.AnimationProperty, null).withProperty(Properties.StaticProperty, true));
|
||||
}
|
||||
|
||||
@Override
|
||||
public BlockState createBlockState() {
|
||||
return new ExtendedBlockState(this, new IProperty[] { Properties.StaticProperty }, new IUnlistedProperty[] { Properties.AnimationProperty } );
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMetaFromState(IBlockState state) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IBlockState getStateFromMeta(int meta) {
|
||||
return getDefaultState();
|
||||
}
|
||||
|
||||
@Override
|
||||
public IBlockState getActualState(IBlockState state, IBlockAccess world, BlockPos pos) {
|
||||
return state.withProperty(Properties.StaticProperty, true);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -74,11 +102,6 @@ public class BlockCorporeaCrystalCube extends BlockCorporeaBase implements ILexi
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getRenderType() {
|
||||
return 2;
|
||||
}
|
||||
|
||||
@Override
|
||||
public TileCorporeaBase createNewTileEntity(World world, int meta) {
|
||||
return new TileCorporeaCrystalCube();
|
||||
@@ -99,40 +122,4 @@ public class BlockCorporeaCrystalCube extends BlockCorporeaBase implements ILexi
|
||||
return ((TileCorporeaCrystalCube) world.getTileEntity(pos)).compValue;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean addLandingEffects(net.minecraft.world.WorldServer worldObj, BlockPos blockPosition, IBlockState iblockstate, EntityLivingBase entity, int numberOfParticles )
|
||||
{
|
||||
float f = (float) MathHelper.ceiling_float_int(entity.fallDistance - 3.0F);
|
||||
double d0 = (double)Math.min(0.2F + f / 15.0F, 10.0F);
|
||||
if (d0 > 2.5D) {
|
||||
d0 = 2.5D;
|
||||
}
|
||||
int i = (int)(150.0D * d0);
|
||||
worldObj.spawnParticle(EnumParticleTypes.BLOCK_DUST, entity.posX, entity.posY, entity.posZ, i, 0.0D, 0.0D, 0.0D, 0.15000000596046448D, Block.getStateId(ModBlocks.storage.getDefaultState().withProperty(BotaniaStateProps.STORAGE_VARIANT, StorageVariant.ELEMENTIUM)));
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public boolean addDestroyEffects(World world, BlockPos pos, net.minecraft.client.particle.EffectRenderer effectRenderer)
|
||||
{
|
||||
if (world.getBlockState(pos).getBlock() == this) {
|
||||
int i = 4;
|
||||
EntityDiggingFX.Factory factory = new EntityDiggingFX.Factory();
|
||||
for (int j = 0; j < i; ++j) {
|
||||
for (int k = 0; k < i; ++k) {
|
||||
for (int l = 0; l < i; ++l) {
|
||||
double d0 = (double)pos.getX() + ((double)j + 0.5D) / (double)i;
|
||||
double d1 = (double)pos.getY() + ((double)k + 0.5D) / (double)i;
|
||||
double d2 = (double)pos.getZ() + ((double)l + 0.5D) / (double)i;
|
||||
effectRenderer.addEffect(factory.getEntityFX(-1, world, d0, d1, d2, d0 - (double)pos.getX() - 0.5D, d1 - (double)pos.getY() - 0.5D, d2 - (double)pos.getZ() - 0.5D, Block.getStateId(ModBlocks.storage.getDefaultState().withProperty(BotaniaStateProps.STORAGE_VARIANT, StorageVariant.ELEMENTIUM))));
|
||||
}
|
||||
}
|
||||
}
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
+23
-1
@@ -12,16 +12,24 @@ package vazkii.botania.common.block.tile.corporea;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.google.common.collect.ImmutableMap;
|
||||
import net.minecraft.entity.item.EntityItem;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
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.TimeValues;
|
||||
import net.minecraftforge.common.model.animation.IAnimationStateMachine;
|
||||
import net.minecraftforge.fml.common.FMLCommonHandler;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import vazkii.botania.api.corporea.CorporeaHelper;
|
||||
import vazkii.botania.api.corporea.ICorporeaRequestor;
|
||||
import vazkii.botania.api.corporea.ICorporeaSpark;
|
||||
import vazkii.botania.api.internal.VanillaPacketDispatcher;
|
||||
import vazkii.botania.common.lib.LibBlockNames;
|
||||
|
||||
public class TileCorporeaCrystalCube extends TileCorporeaBase implements ICorporeaRequestor {
|
||||
public class TileCorporeaCrystalCube extends TileCorporeaBase implements ICorporeaRequestor, IAnimationProvider {
|
||||
|
||||
private static final String TAG_REQUEST_TARGET = "requestTarget";
|
||||
private static final String TAG_ITEM_COUNT = "itemCount";
|
||||
@@ -33,6 +41,16 @@ public class TileCorporeaCrystalCube extends TileCorporeaBase implements ICorpor
|
||||
int ticks = 0;
|
||||
public int compValue = 0;
|
||||
|
||||
private final IAnimationStateMachine asm;
|
||||
|
||||
public TileCorporeaCrystalCube() {
|
||||
if (FMLCommonHandler.instance().getSide() == Side.CLIENT) {
|
||||
asm = Animation.INSTANCE.load(new ResourceLocation("botania", "asms/block/crystalcube_cube.json"), ImmutableMap.of());
|
||||
} else {
|
||||
asm = null;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateEntity() {
|
||||
++ticks;
|
||||
@@ -156,4 +174,8 @@ public class TileCorporeaCrystalCube extends TileCorporeaBase implements ICorpor
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public IAnimationStateMachine asm() {
|
||||
return asm;
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user