Additional work on the Alchemy Table, as well as the Elytra upgrade.

This commit is contained in:
WayofTime 2016-05-01 22:32:15 -04:00
parent d10d6e6275
commit d3379ff69b
14 changed files with 1429 additions and 1120 deletions

View file

@ -1,31 +1,32 @@
package WayofTime.bloodmagic.block;
import java.util.ArrayList;
import java.util.List;
import net.minecraft.block.BlockContainer;
import net.minecraft.block.material.Material;
import net.minecraft.block.properties.IProperty;
import net.minecraft.block.properties.PropertyBool;
import net.minecraft.block.properties.PropertyEnum;
import net.minecraft.block.state.BlockStateContainer;
import net.minecraft.block.state.IBlockState;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.BlockRenderLayer;
import net.minecraft.util.EnumBlockRenderType;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;
import org.apache.commons.lang3.tuple.ImmutablePair;
import org.apache.commons.lang3.tuple.Pair;
import WayofTime.bloodmagic.BloodMagic;
import WayofTime.bloodmagic.api.Constants;
import WayofTime.bloodmagic.client.IVariantProvider;
import WayofTime.bloodmagic.tile.TileDemonCrucible;
import WayofTime.bloodmagic.tile.TileAlchemyTable;
public class BlockAlchemyTable extends BlockContainer implements IVariantProvider
public class BlockAlchemyTable extends BlockContainer
{
public static final PropertyBool INVISIBLE = PropertyBool.create("invisible");
public static final PropertyEnum<EnumFacing> DIRECTION = PropertyEnum.<EnumFacing>create("direction", EnumFacing.class);
public BlockAlchemyTable()
{
super(Material.ROCK);
// this.setDefaultState(this.blockState.getBaseState().withProperty(DIRECTION, EnumFacing.DOWN).withProperty(INVISIBLE, false));
setUnlocalizedName(Constants.Mod.MODID + ".alchemyTable");
setCreativeTab(BloodMagic.tabBloodMagic);
@ -72,10 +73,43 @@ public class BlockAlchemyTable extends BlockContainer implements IVariantProvide
return layer == BlockRenderLayer.CUTOUT_MIPPED || layer == BlockRenderLayer.TRANSLUCENT;
}
@Override
public IBlockState getStateFromMeta(int meta)
{
return this.getDefaultState();
}
/**
* Convert the BlockState into the correct metadata value
*/
@Override
public int getMetaFromState(IBlockState state)
{
return 0;
}
@Override
public IBlockState getActualState(IBlockState state, IBlockAccess world, BlockPos pos)
{
TileEntity tile = world.getTileEntity(pos);
if (tile instanceof TileAlchemyTable)
{
return state.withProperty(INVISIBLE, ((TileAlchemyTable) tile).isInvisible()).withProperty(DIRECTION, ((TileAlchemyTable) tile).getDirection());
}
return state.withProperty(INVISIBLE, false);
}
@Override
protected BlockStateContainer createBlockState()
{
return new BlockStateContainer(this, new IProperty[] { DIRECTION, INVISIBLE });
}
@Override
public TileEntity createNewTileEntity(World world, int meta)
{
return new TileDemonCrucible();
return new TileAlchemyTable();
}
// @Override
@ -103,18 +137,18 @@ public class BlockAlchemyTable extends BlockContainer implements IVariantProvide
@Override
public void breakBlock(World world, BlockPos blockPos, IBlockState blockState)
{
TileDemonCrucible tile = (TileDemonCrucible) world.getTileEntity(blockPos);
TileAlchemyTable tile = (TileAlchemyTable) world.getTileEntity(blockPos);
if (tile != null)
tile.dropItems();
super.breakBlock(world, blockPos, blockState);
}
@Override
public List<Pair<Integer, String>> getVariants()
{
List<Pair<Integer, String>> ret = new ArrayList<Pair<Integer, String>>();
ret.add(new ImmutablePair<Integer, String>(0, "normal"));
return ret;
}
//
// @Override
// public List<Pair<Integer, String>> getVariants()
// {
// List<Pair<Integer, String>> ret = new ArrayList<Pair<Integer, String>>();
// ret.add(new ImmutablePair<Integer, String>(0, "normal"));
// return ret;
// }
}