More progress
This commit is contained in:
parent
00d6f8eb46
commit
d80afb18f0
64 changed files with 410 additions and 976 deletions
|
@ -3,6 +3,7 @@ package WayofTime.bloodmagic.block;
|
|||
import java.util.List;
|
||||
import java.util.Random;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockContainer;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
|
@ -27,7 +28,9 @@ import WayofTime.bloodmagic.registry.ModItems;
|
|||
import WayofTime.bloodmagic.tile.TileAlchemyArray;
|
||||
import WayofTime.bloodmagic.util.Utils;
|
||||
|
||||
public class BlockAlchemyArray extends BlockContainer
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
public class BlockAlchemyArray extends Block
|
||||
{
|
||||
protected static final AxisAlignedBB ARRAY_AABB = new AxisAlignedBB(0, 0, 0, 1, 0.1, 1);
|
||||
|
||||
|
@ -81,7 +84,7 @@ public class BlockAlchemyArray extends BlockContainer
|
|||
}
|
||||
|
||||
@Override
|
||||
public boolean isVisuallyOpaque()
|
||||
public boolean causesSuffocation(IBlockState state)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
@ -99,7 +102,7 @@ public class BlockAlchemyArray extends BlockContainer
|
|||
}
|
||||
|
||||
@Override
|
||||
public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumHand hand, ItemStack heldItem, EnumFacing side, float hitX, float hitY, float hitZ)
|
||||
public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumHand hand, EnumFacing side, float hitX, float hitY, float hitZ)
|
||||
{
|
||||
//TODO: Right click should rotate it
|
||||
TileAlchemyArray array = (TileAlchemyArray) world.getTileEntity(pos);
|
||||
|
@ -109,12 +112,12 @@ public class BlockAlchemyArray extends BlockContainer
|
|||
|
||||
ItemStack playerItem = player.getHeldItem(hand);
|
||||
|
||||
if (playerItem != null)
|
||||
if (!playerItem.isEmpty())
|
||||
{
|
||||
if (array.getStackInSlot(0) == null)
|
||||
if (array.getStackInSlot(0).isEmpty())
|
||||
{
|
||||
Utils.insertItemToTile(array, player, 0);
|
||||
} else if (array.getStackInSlot(0) != null)
|
||||
} else if (!array.getStackInSlot(0).isEmpty())
|
||||
{
|
||||
Utils.insertItemToTile(array, player, 1);
|
||||
array.attemptCraft();
|
||||
|
@ -140,12 +143,6 @@ public class BlockAlchemyArray extends BlockContainer
|
|||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public TileEntity createNewTileEntity(World worldIn, int meta)
|
||||
{
|
||||
return new TileAlchemyArray();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void breakBlock(World world, BlockPos blockPos, IBlockState blockState)
|
||||
{
|
||||
|
@ -155,4 +152,15 @@ public class BlockAlchemyArray extends BlockContainer
|
|||
|
||||
super.breakBlock(world, blockPos, blockState);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasTileEntity(IBlockState state) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public TileEntity createTileEntity(World world, IBlockState state) {
|
||||
return new TileAlchemyArray();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -22,7 +22,9 @@ import WayofTime.bloodmagic.BloodMagic;
|
|||
import WayofTime.bloodmagic.api.Constants;
|
||||
import WayofTime.bloodmagic.tile.TileAlchemyTable;
|
||||
|
||||
public class BlockAlchemyTable extends BlockContainer
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
public class BlockAlchemyTable extends Block
|
||||
{
|
||||
public static final PropertyBool INVISIBLE = PropertyBool.create("invisible");
|
||||
public static final PropertyEnum<EnumFacing> DIRECTION = PropertyEnum.<EnumFacing>create("direction", EnumFacing.class);
|
||||
|
@ -60,7 +62,7 @@ public class BlockAlchemyTable extends BlockContainer
|
|||
}
|
||||
|
||||
@Override
|
||||
public boolean isVisuallyOpaque()
|
||||
public boolean causesSuffocation(IBlockState state)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
@ -107,17 +109,11 @@ public class BlockAlchemyTable extends BlockContainer
|
|||
@Override
|
||||
protected BlockStateContainer createBlockState()
|
||||
{
|
||||
return new BlockStateContainer(this, new IProperty[] { DIRECTION, INVISIBLE });
|
||||
return new BlockStateContainer(this, DIRECTION, INVISIBLE);
|
||||
}
|
||||
|
||||
@Override
|
||||
public TileEntity createNewTileEntity(World world, int meta)
|
||||
{
|
||||
return new TileAlchemyTable();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumHand hand, ItemStack heldItem, EnumFacing side, float hitX, float hitY, float hitZ)
|
||||
public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumHand hand, EnumFacing side, float hitX, float hitY, float hitZ)
|
||||
{
|
||||
BlockPos position = pos;
|
||||
TileEntity tile = world.getTileEntity(pos);
|
||||
|
@ -152,7 +148,18 @@ public class BlockAlchemyTable extends BlockContainer
|
|||
}
|
||||
|
||||
@Override
|
||||
public void neighborChanged(IBlockState state, World world, BlockPos pos, Block neighborBlock)
|
||||
public boolean hasTileEntity(IBlockState state) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public TileEntity createTileEntity(World world, IBlockState state) {
|
||||
return new TileAlchemyTable();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void neighborChanged(IBlockState state, World world, BlockPos pos, Block blockIn, BlockPos fromPos)
|
||||
{
|
||||
TileAlchemyTable tile = (TileAlchemyTable) world.getTileEntity(pos);
|
||||
if (tile != null)
|
||||
|
|
|
@ -7,8 +7,7 @@ import WayofTime.bloodmagic.altar.BloodAltar;
|
|||
import WayofTime.bloodmagic.api.altar.EnumAltarComponent;
|
||||
import WayofTime.bloodmagic.api.altar.IBloodAltar;
|
||||
import WayofTime.bloodmagic.api.iface.IDocumentedBlock;
|
||||
import WayofTime.bloodmagic.item.sigil.ItemSigilHolding;
|
||||
import net.minecraft.block.BlockContainer;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
|
@ -40,7 +39,9 @@ import WayofTime.bloodmagic.util.Utils;
|
|||
|
||||
import com.google.common.base.Strings;
|
||||
|
||||
public class BlockAltar extends BlockContainer implements IVariantProvider, IDocumentedBlock
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
public class BlockAltar extends Block implements IVariantProvider, IDocumentedBlock
|
||||
{
|
||||
public BlockAltar()
|
||||
{
|
||||
|
@ -74,7 +75,7 @@ public class BlockAltar extends BlockContainer implements IVariantProvider, IDoc
|
|||
|
||||
if (world.getBlockState(pos.down()).getBlock() instanceof BlockBloodStoneBrick)
|
||||
{
|
||||
if (orbStack != null && orbStack.getItem() instanceof IBloodOrb && orbStack.getItem() instanceof IBindable)
|
||||
if (orbStack.getItem() instanceof IBloodOrb && orbStack.getItem() instanceof IBindable)
|
||||
{
|
||||
IBloodOrb bloodOrb = (IBloodOrb) orbStack.getItem();
|
||||
IBindable bindable = (IBindable) orbStack.getItem();
|
||||
|
@ -119,9 +120,9 @@ public class BlockAltar extends BlockContainer implements IVariantProvider, IDoc
|
|||
}
|
||||
|
||||
@Override
|
||||
public boolean isVisuallyOpaque()
|
||||
public boolean causesSuffocation(IBlockState state)
|
||||
{
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -131,13 +132,7 @@ public class BlockAltar extends BlockContainer implements IVariantProvider, IDoc
|
|||
}
|
||||
|
||||
@Override
|
||||
public TileEntity createNewTileEntity(World world, int meta)
|
||||
{
|
||||
return new TileAltar();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumHand hand, ItemStack heldItem, EnumFacing side, float hitX, float hitY, float hitZ)
|
||||
public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumHand hand, EnumFacing side, float hitX, float hitY, float hitZ)
|
||||
{
|
||||
TileAltar altar = (TileAltar) world.getTileEntity(pos);
|
||||
|
||||
|
@ -146,13 +141,10 @@ public class BlockAltar extends BlockContainer implements IVariantProvider, IDoc
|
|||
|
||||
ItemStack playerItem = player.inventory.getCurrentItem();
|
||||
|
||||
if (playerItem != null)
|
||||
if (playerItem.getItem() instanceof IAltarReader || playerItem.getItem() instanceof IAltarManipulator)
|
||||
{
|
||||
if (playerItem.getItem() instanceof IAltarReader || playerItem.getItem() instanceof IAltarManipulator)
|
||||
{
|
||||
playerItem.getItem().onItemRightClick(playerItem, world, player, hand);
|
||||
return true;
|
||||
}
|
||||
playerItem.getItem().onItemRightClick(world, player, hand);
|
||||
return true;
|
||||
}
|
||||
|
||||
if (Utils.insertItemToTile(altar, player))
|
||||
|
@ -178,6 +170,17 @@ public class BlockAltar extends BlockContainer implements IVariantProvider, IDoc
|
|||
super.breakBlock(world, blockPos, blockState);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasTileEntity(IBlockState state) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public TileEntity createTileEntity(World world, IBlockState state) {
|
||||
return new TileAltar();
|
||||
}
|
||||
|
||||
// IVariantProvider
|
||||
|
||||
@Override
|
||||
|
|
|
@ -70,7 +70,7 @@ public class BlockBloodLight extends Block
|
|||
}
|
||||
|
||||
@Override
|
||||
public boolean isVisuallyOpaque()
|
||||
public boolean causesSuffocation(IBlockState state)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
@ -97,12 +97,12 @@ public class BlockBloodLight extends Block
|
|||
@SideOnly(Side.CLIENT)
|
||||
public void randomDisplayTick(IBlockState state, World world, BlockPos pos, Random rand)
|
||||
{
|
||||
EntityPlayerSP playerSP = Minecraft.getMinecraft().thePlayer;
|
||||
EntityPlayerSP playerSP = Minecraft.getMinecraft().player;
|
||||
|
||||
if (rand.nextInt(3) != 0)
|
||||
{
|
||||
world.spawnParticle(EnumParticleTypes.REDSTONE, pos.getX() + 0.5D + rand.nextGaussian() / 8, pos.getY() + 0.5D, pos.getZ() + 0.5D + rand.nextGaussian() / 8, 0, 0, 0, 0);
|
||||
if (playerSP.getActiveItemStack() != null && playerSP.getActiveItemStack().getItem() == ModItems.SIGIL_BLOOD_LIGHT)
|
||||
if (!playerSP.getActiveItemStack().isEmpty() && playerSP.getActiveItemStack().getItem() == ModItems.SIGIL_BLOOD_LIGHT)
|
||||
{
|
||||
world.spawnParticle(EnumParticleTypes.REDSTONE, pos.getX() + 0.5D + rand.nextGaussian() / 8, pos.getY() + 0.5D, pos.getZ() + 0.5D + rand.nextGaussian() / 8, 0, 0, 0, 0);
|
||||
world.spawnParticle(EnumParticleTypes.REDSTONE, pos.getX() + 0.5D + rand.nextGaussian() / 8, pos.getY() + 0.5D, pos.getZ() + 0.5D + rand.nextGaussian() / 8, 0, 0, 0, 0);
|
||||
|
|
|
@ -52,7 +52,7 @@ public class BlockBloodTank extends BlockInteger implements IVariantProvider
|
|||
|
||||
@Nullable
|
||||
@Override
|
||||
public AxisAlignedBB getCollisionBoundingBox(IBlockState blockState, World worldIn, BlockPos pos)
|
||||
public AxisAlignedBB getCollisionBoundingBox(IBlockState blockState, IBlockAccess worldIn, BlockPos pos)
|
||||
{
|
||||
return BOX;
|
||||
}
|
||||
|
@ -89,10 +89,11 @@ public class BlockBloodTank extends BlockInteger implements IVariantProvider
|
|||
}
|
||||
|
||||
@Override
|
||||
public boolean onBlockActivated(World world, BlockPos blockPos, IBlockState state, EntityPlayer player, EnumHand hand, ItemStack heldItem, EnumFacing side, float hitX, float hitY, float hitZ)
|
||||
public boolean onBlockActivated(World world, BlockPos blockPos, IBlockState state, EntityPlayer player, EnumHand hand, EnumFacing side, float hitX, float hitY, float hitZ)
|
||||
{
|
||||
ItemStack held = player.getHeldItem(hand);
|
||||
TileBloodTank fluidHandler = (TileBloodTank) world.getTileEntity(blockPos);
|
||||
if (FluidUtil.interactWithFluidHandler(heldItem, fluidHandler.getTank(), player))
|
||||
if (FluidUtil.interactWithFluidHandler(held, fluidHandler.getTank(), player).isSuccess())
|
||||
{
|
||||
world.checkLight(blockPos);
|
||||
world.updateComparatorOutputLevel(blockPos, this);
|
||||
|
|
|
@ -3,6 +3,7 @@ package WayofTime.bloodmagic.block;
|
|||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockContainer;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
|
@ -27,7 +28,9 @@ import WayofTime.bloodmagic.client.IVariantProvider;
|
|||
import WayofTime.bloodmagic.tile.TileDemonCrucible;
|
||||
import WayofTime.bloodmagic.util.Utils;
|
||||
|
||||
public class BlockDemonCrucible extends BlockContainer implements IVariantProvider
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
public class BlockDemonCrucible extends Block implements IVariantProvider
|
||||
{
|
||||
public BlockDemonCrucible()
|
||||
{
|
||||
|
@ -55,7 +58,7 @@ public class BlockDemonCrucible extends BlockContainer implements IVariantProvid
|
|||
}
|
||||
|
||||
@Override
|
||||
public boolean isVisuallyOpaque()
|
||||
public boolean causesSuffocation(IBlockState state)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
@ -67,25 +70,17 @@ public class BlockDemonCrucible extends BlockContainer implements IVariantProvid
|
|||
}
|
||||
|
||||
@Override
|
||||
public TileEntity createNewTileEntity(World world, int meta)
|
||||
{
|
||||
return new TileDemonCrucible();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumHand hand, ItemStack heldItem, EnumFacing side, float hitX, float hitY, float hitZ)
|
||||
public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumHand hand, EnumFacing side, float hitX, float hitY, float hitZ)
|
||||
{
|
||||
ItemStack heldItem = player.getHeldItem(hand);
|
||||
TileDemonCrucible crucible = (TileDemonCrucible) world.getTileEntity(pos);
|
||||
|
||||
if (crucible == null || player.isSneaking())
|
||||
return false;
|
||||
|
||||
if (heldItem != null)
|
||||
if (!(heldItem.getItem() instanceof IDiscreteDemonWill) && !(heldItem.getItem() instanceof IDemonWillGem))
|
||||
{
|
||||
if (!(heldItem.getItem() instanceof IDiscreteDemonWill) && !(heldItem.getItem() instanceof IDemonWillGem))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
Utils.insertItemToTile(crucible, player);
|
||||
|
@ -104,6 +99,17 @@ public class BlockDemonCrucible extends BlockContainer implements IVariantProvid
|
|||
super.breakBlock(world, blockPos, blockState);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasTileEntity(IBlockState state) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public TileEntity createTileEntity(World world, IBlockState state) {
|
||||
return new TileDemonCrucible();
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Pair<Integer, String>> getVariants()
|
||||
{
|
||||
|
|
|
@ -19,6 +19,7 @@ import net.minecraft.tileentity.TileEntity;
|
|||
import net.minecraft.util.EnumBlockRenderType;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.util.EnumHand;
|
||||
import net.minecraft.util.NonNullList;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraft.world.World;
|
||||
|
@ -31,7 +32,9 @@ import WayofTime.bloodmagic.api.soul.PlayerDemonWillHandler;
|
|||
import WayofTime.bloodmagic.item.ItemDemonCrystal;
|
||||
import WayofTime.bloodmagic.tile.TileDemonCrystal;
|
||||
|
||||
public class BlockDemonCrystal extends BlockContainer
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
public class BlockDemonCrystal extends Block
|
||||
{
|
||||
public static final PropertyInteger AGE = PropertyInteger.create("age", 0, 6);
|
||||
public static final PropertyEnum<EnumDemonWillType> TYPE = PropertyEnum.<EnumDemonWillType>create("type", EnumDemonWillType.class);
|
||||
|
@ -60,7 +63,7 @@ public class BlockDemonCrystal extends BlockContainer
|
|||
}
|
||||
|
||||
@Override
|
||||
public void neighborChanged(IBlockState state, World world, BlockPos pos, Block neighborBlock)
|
||||
public void neighborChanged(IBlockState state, World world, BlockPos pos, Block blockIn, BlockPos fromPos)
|
||||
{
|
||||
TileDemonCrystal tile = (TileDemonCrystal) world.getTileEntity(pos);
|
||||
EnumFacing placement = tile.getPlacement();
|
||||
|
@ -87,7 +90,7 @@ public class BlockDemonCrystal extends BlockContainer
|
|||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void getSubBlocks(Item item, CreativeTabs creativeTabs, List<ItemStack> list)
|
||||
public void getSubBlocks(Item item, CreativeTabs creativeTabs, NonNullList<ItemStack> list)
|
||||
{
|
||||
for (int i = 0; i < EnumDemonWillType.values().length; i++)
|
||||
list.add(new ItemStack(this, 1, i));
|
||||
|
@ -112,7 +115,7 @@ public class BlockDemonCrystal extends BlockContainer
|
|||
}
|
||||
|
||||
@Override
|
||||
public boolean isVisuallyOpaque()
|
||||
public boolean causesSuffocation(IBlockState state)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
@ -143,19 +146,13 @@ public class BlockDemonCrystal extends BlockContainer
|
|||
@Override
|
||||
public int getMetaFromState(IBlockState state)
|
||||
{
|
||||
return ((EnumDemonWillType) state.getValue(TYPE)).ordinal();
|
||||
return state.getValue(TYPE).ordinal();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected BlockStateContainer createBlockState()
|
||||
{
|
||||
return new BlockStateContainer(this, new IProperty[] { TYPE, AGE, ATTACHED });
|
||||
}
|
||||
|
||||
@Override
|
||||
public TileEntity createNewTileEntity(World world, int meta)
|
||||
{
|
||||
return new TileDemonCrystal();
|
||||
return new BlockStateContainer(this, TYPE, AGE, ATTACHED);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -191,7 +188,7 @@ public class BlockDemonCrystal extends BlockContainer
|
|||
break;
|
||||
}
|
||||
|
||||
stack.stackSize = crystalNumber;
|
||||
stack.setCount(crystalNumber);
|
||||
return stack;
|
||||
}
|
||||
|
||||
|
@ -202,7 +199,7 @@ public class BlockDemonCrystal extends BlockContainer
|
|||
}
|
||||
|
||||
@Override
|
||||
public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumHand hand, ItemStack heldItem, EnumFacing side, float hitX, float hitY, float hitZ)
|
||||
public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumHand hand, EnumFacing side, float hitX, float hitY, float hitZ)
|
||||
{
|
||||
if (world.isRemote)
|
||||
{
|
||||
|
@ -221,7 +218,18 @@ public class BlockDemonCrystal extends BlockContainer
|
|||
return true;
|
||||
}
|
||||
|
||||
// @Override
|
||||
@Override
|
||||
public boolean hasTileEntity(IBlockState state) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public TileEntity createTileEntity(World world, IBlockState state) {
|
||||
return new TileDemonCrystal();
|
||||
}
|
||||
|
||||
// @Override
|
||||
// public java.util.List<ItemStack> getDrops(net.minecraft.world.IBlockAccess world, BlockPos pos, IBlockState state, int fortune)
|
||||
// {
|
||||
// java.util.List<ItemStack> ret = super.getDrops(world, pos, state, fortune);
|
||||
|
|
|
@ -61,7 +61,7 @@ public class BlockDemonCrystallizer extends BlockContainer implements IVariantPr
|
|||
}
|
||||
|
||||
@Override
|
||||
public boolean isVisuallyOpaque()
|
||||
public boolean causesSuffocation(IBlockState state)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -54,7 +54,7 @@ public class BlockDemonPylon extends BlockContainer implements IVariantProvider
|
|||
}
|
||||
|
||||
@Override
|
||||
public boolean isVisuallyOpaque()
|
||||
public boolean causesSuffocation(IBlockState state)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -19,7 +19,6 @@ import WayofTime.bloodmagic.api.Constants;
|
|||
import WayofTime.bloodmagic.api.ritual.IMasterRitualStone;
|
||||
import WayofTime.bloodmagic.api.teleport.PortalLocation;
|
||||
import WayofTime.bloodmagic.api.teleport.TeleportQueue;
|
||||
import WayofTime.bloodmagic.block.base.BlockIntegerContainer;
|
||||
import WayofTime.bloodmagic.ritual.portal.LocationsHandler;
|
||||
import WayofTime.bloodmagic.ritual.portal.Teleports;
|
||||
import WayofTime.bloodmagic.tile.TileDimensionalPortal;
|
||||
|
|
|
@ -3,6 +3,7 @@ package WayofTime.bloodmagic.block;
|
|||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockContainer;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
|
@ -21,7 +22,9 @@ import WayofTime.bloodmagic.api.Constants;
|
|||
import WayofTime.bloodmagic.client.IVariantProvider;
|
||||
import WayofTime.bloodmagic.tile.TileIncenseAltar;
|
||||
|
||||
public class BlockIncenseAltar extends BlockContainer implements IVariantProvider
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
public class BlockIncenseAltar extends Block implements IVariantProvider
|
||||
{
|
||||
protected static final AxisAlignedBB AABB = new AxisAlignedBB(0.3F, 0F, 0.3F, 0.72F, 1F, 0.72F);
|
||||
|
||||
|
@ -61,7 +64,7 @@ public class BlockIncenseAltar extends BlockContainer implements IVariantProvide
|
|||
}
|
||||
|
||||
@Override
|
||||
public boolean isVisuallyOpaque()
|
||||
public boolean causesSuffocation(IBlockState state)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
@ -72,12 +75,6 @@ public class BlockIncenseAltar extends BlockContainer implements IVariantProvide
|
|||
return EnumBlockRenderType.MODEL;
|
||||
}
|
||||
|
||||
@Override
|
||||
public TileEntity createNewTileEntity(World world, int meta)
|
||||
{
|
||||
return new TileIncenseAltar();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void breakBlock(World world, BlockPos blockPos, IBlockState blockState)
|
||||
{
|
||||
|
@ -88,6 +85,17 @@ public class BlockIncenseAltar extends BlockContainer implements IVariantProvide
|
|||
super.breakBlock(world, blockPos, blockState);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasTileEntity(IBlockState state) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public TileEntity createTileEntity(World world, IBlockState state) {
|
||||
return new TileIncenseAltar();
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Pair<Integer, String>> getVariants()
|
||||
{
|
||||
|
|
|
@ -41,7 +41,7 @@ public class BlockInputRoutingNode extends BlockRoutingNode
|
|||
}
|
||||
|
||||
@Override
|
||||
public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumHand hand, ItemStack heldItem, EnumFacing side, float hitX, float hitY, float hitZ)
|
||||
public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumHand hand, EnumFacing side, float hitX, float hitY, float hitZ)
|
||||
{
|
||||
if (world.getTileEntity(pos) instanceof TileInputRoutingNode)
|
||||
{
|
||||
|
|
|
@ -3,6 +3,7 @@ package WayofTime.bloodmagic.block;
|
|||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import WayofTime.bloodmagic.block.base.BlockEnum;
|
||||
import net.minecraft.block.SoundType;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.block.state.BlockStateContainer;
|
||||
|
@ -19,13 +20,11 @@ import org.apache.commons.lang3.tuple.Pair;
|
|||
|
||||
import WayofTime.bloodmagic.BloodMagic;
|
||||
import WayofTime.bloodmagic.api.Constants;
|
||||
import WayofTime.bloodmagic.api.soul.EnumDemonWillType;
|
||||
import WayofTime.bloodmagic.block.base.BlockEnumContainer;
|
||||
import WayofTime.bloodmagic.block.enums.EnumSubWillType;
|
||||
import WayofTime.bloodmagic.client.IVariantProvider;
|
||||
import WayofTime.bloodmagic.tile.TileInversionPillar;
|
||||
|
||||
public class BlockInversionPillar extends BlockEnumContainer<EnumSubWillType> implements IVariantProvider
|
||||
public class BlockInversionPillar extends BlockEnum<EnumSubWillType> implements IVariantProvider
|
||||
{
|
||||
public BlockInversionPillar()
|
||||
{
|
||||
|
@ -77,7 +76,7 @@ public class BlockInversionPillar extends BlockEnumContainer<EnumSubWillType> im
|
|||
}
|
||||
|
||||
@Override
|
||||
public boolean isVisuallyOpaque()
|
||||
public boolean causesSuffocation(IBlockState state)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -52,7 +52,7 @@ public class BlockInversionPillarEnd extends BlockEnum<EnumInversionCap> impleme
|
|||
}
|
||||
|
||||
@Override
|
||||
public boolean isVisuallyOpaque()
|
||||
public boolean causesSuffocation(IBlockState state)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -31,14 +31,6 @@ public class BlockLifeEssence extends BlockFluidClassic
|
|||
BloodMagicAPI.setLifeEssence(getLifeEssence());
|
||||
}
|
||||
|
||||
// TODO - Remove after Forge fixes
|
||||
// Fix for BlockFluidBase not overriding this
|
||||
@Override
|
||||
public IBlockState getStateFromMeta(int meta)
|
||||
{
|
||||
return getBlockState().getBaseState().withProperty(LEVEL, meta);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canDisplace(IBlockAccess world, BlockPos blockPos)
|
||||
{
|
||||
|
|
|
@ -5,11 +5,13 @@ import java.util.List;
|
|||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import WayofTime.bloodmagic.block.base.BlockEnum;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.SoundType;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.item.ItemBlock;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
|
@ -31,14 +33,13 @@ import WayofTime.bloodmagic.BloodMagic;
|
|||
import WayofTime.bloodmagic.api.Constants;
|
||||
import WayofTime.bloodmagic.api.altar.EnumAltarComponent;
|
||||
import WayofTime.bloodmagic.api.altar.IAltarComponent;
|
||||
import WayofTime.bloodmagic.block.base.BlockEnumContainer;
|
||||
import WayofTime.bloodmagic.block.enums.EnumMimic;
|
||||
import WayofTime.bloodmagic.client.IVariantProvider;
|
||||
import WayofTime.bloodmagic.registry.ModBlocks;
|
||||
import WayofTime.bloodmagic.tile.TileMimic;
|
||||
import WayofTime.bloodmagic.util.Utils;
|
||||
|
||||
public class BlockMimic extends BlockEnumContainer<EnumMimic> implements IVariantProvider, IAltarComponent
|
||||
public class BlockMimic extends BlockEnum<EnumMimic> implements IVariantProvider, IAltarComponent
|
||||
{
|
||||
public static final int sentientMimicMeta = 4;
|
||||
|
||||
|
@ -56,7 +57,8 @@ public class BlockMimic extends BlockEnumContainer<EnumMimic> implements IVarian
|
|||
}
|
||||
|
||||
@Nullable
|
||||
public AxisAlignedBB getCollisionBoundingBox(IBlockState state, World world, BlockPos pos)
|
||||
@Override
|
||||
public AxisAlignedBB getCollisionBoundingBox(IBlockState state, IBlockAccess world, BlockPos pos)
|
||||
{
|
||||
switch (this.getMetaFromState(state))
|
||||
{
|
||||
|
@ -65,10 +67,10 @@ public class BlockMimic extends BlockEnumContainer<EnumMimic> implements IVarian
|
|||
case 3:
|
||||
case 4:
|
||||
TileMimic tileMimic = (TileMimic) world.getTileEntity(pos);
|
||||
if (tileMimic != null && tileMimic.getStackInSlot(0) != null)
|
||||
if (tileMimic != null && !tileMimic.getStackInSlot(0).isEmpty())
|
||||
{
|
||||
Block mimicBlock = Block.getBlockFromItem(tileMimic.getStackInSlot(0).getItem());
|
||||
if (mimicBlock == null)
|
||||
if (mimicBlock == Blocks.AIR)
|
||||
{
|
||||
return FULL_BLOCK_AABB;
|
||||
}
|
||||
|
@ -93,10 +95,10 @@ public class BlockMimic extends BlockEnumContainer<EnumMimic> implements IVarian
|
|||
public AxisAlignedBB getSelectedBoundingBox(IBlockState state, World world, BlockPos pos)
|
||||
{
|
||||
TileMimic tileMimic = (TileMimic) world.getTileEntity(pos);
|
||||
if (tileMimic != null && tileMimic.getStackInSlot(0) != null)
|
||||
if (tileMimic != null && !tileMimic.getStackInSlot(0).isEmpty())
|
||||
{
|
||||
Block mimicBlock = Block.getBlockFromItem(tileMimic.getStackInSlot(0).getItem());
|
||||
if (mimicBlock == null)
|
||||
if (mimicBlock == Blocks.AIR)
|
||||
{
|
||||
return FULL_BLOCK_AABB;
|
||||
}
|
||||
|
@ -147,14 +149,10 @@ public class BlockMimic extends BlockEnumContainer<EnumMimic> implements IVarian
|
|||
}
|
||||
|
||||
@Override
|
||||
public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumHand hand, ItemStack heldItem, EnumFacing side, float hitX, float hitY, float hitZ)
|
||||
{
|
||||
public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumHand hand, EnumFacing side, float hitX, float hitY, float hitZ) {
|
||||
TileMimic mimic = (TileMimic) world.getTileEntity(pos);
|
||||
|
||||
if (mimic == null)
|
||||
return false;
|
||||
|
||||
return mimic.onBlockActivated(world, pos, state, player, hand, heldItem, side);
|
||||
return mimic != null && mimic.onBlockActivated(world, pos, state, player, hand, player.getHeldItem(hand), side);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -165,7 +163,7 @@ public class BlockMimic extends BlockEnumContainer<EnumMimic> implements IVarian
|
|||
{
|
||||
TileMimic mimic = (TileMimic) tile;
|
||||
ItemStack stack = mimic.getStackInSlot(0);
|
||||
if (stack != null && stack.getItem() instanceof ItemBlock)
|
||||
if (stack.getItem() instanceof ItemBlock)
|
||||
{
|
||||
Block block = ((ItemBlock) stack.getItem()).getBlock();
|
||||
IBlockState mimicState = block.getStateFromMeta(stack.getItemDamage());
|
||||
|
@ -196,7 +194,7 @@ public class BlockMimic extends BlockEnumContainer<EnumMimic> implements IVarian
|
|||
}
|
||||
|
||||
@Override
|
||||
public boolean isVisuallyOpaque()
|
||||
public boolean causesSuffocation(IBlockState state)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
@ -257,7 +255,7 @@ public class BlockMimic extends BlockEnumContainer<EnumMimic> implements IVarian
|
|||
{
|
||||
TileMimic mimic = (TileMimic) tile;
|
||||
ItemStack stack = mimic.getStackInSlot(0);
|
||||
if (stack != null && stack.getItem() instanceof ItemBlock)
|
||||
if (stack.getItem() instanceof ItemBlock)
|
||||
{
|
||||
Block block = ((ItemBlock) stack.getItem()).getBlock();
|
||||
if (block instanceof IAltarComponent)
|
||||
|
|
|
@ -12,6 +12,8 @@ import WayofTime.bloodmagic.BloodMagic;
|
|||
import WayofTime.bloodmagic.api.Constants;
|
||||
import WayofTime.bloodmagic.tile.routing.TileOutputRoutingNode;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
public class BlockOutputRoutingNode extends BlockRoutingNode
|
||||
{
|
||||
public BlockOutputRoutingNode()
|
||||
|
@ -21,12 +23,6 @@ public class BlockOutputRoutingNode extends BlockRoutingNode
|
|||
setUnlocalizedName(Constants.Mod.MODID + ".outputRouting");
|
||||
}
|
||||
|
||||
@Override
|
||||
public TileEntity createNewTileEntity(World worldIn, int meta)
|
||||
{
|
||||
return new TileOutputRoutingNode();
|
||||
}
|
||||
|
||||
@Override
|
||||
//TODO: Combine BlockOutputRoutingNode and BlockInputRoutingNode so they have the same superclass
|
||||
public void breakBlock(World world, BlockPos pos, IBlockState state)
|
||||
|
@ -41,7 +37,7 @@ public class BlockOutputRoutingNode extends BlockRoutingNode
|
|||
}
|
||||
|
||||
@Override
|
||||
public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumHand hand, ItemStack heldItem, EnumFacing side, float hitX, float hitY, float hitZ)
|
||||
public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumHand hand, EnumFacing side, float hitX, float hitY, float hitZ)
|
||||
{
|
||||
if (world.getTileEntity(pos) instanceof TileOutputRoutingNode)
|
||||
{
|
||||
|
@ -50,4 +46,15 @@ public class BlockOutputRoutingNode extends BlockRoutingNode
|
|||
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasTileEntity(IBlockState state) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public TileEntity createTileEntity(World world, IBlockState state) {
|
||||
return new TileOutputRoutingNode();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -4,6 +4,7 @@ import java.util.ArrayList;
|
|||
import java.util.List;
|
||||
import java.util.Random;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockContainer;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
|
@ -25,7 +26,9 @@ import WayofTime.bloodmagic.api.Constants;
|
|||
import WayofTime.bloodmagic.client.IVariantProvider;
|
||||
import WayofTime.bloodmagic.tile.TilePhantomBlock;
|
||||
|
||||
public class BlockPhantom extends BlockContainer implements IVariantProvider
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
public class BlockPhantom extends Block implements IVariantProvider
|
||||
{
|
||||
public BlockPhantom()
|
||||
{
|
||||
|
@ -54,7 +57,7 @@ public class BlockPhantom extends BlockContainer implements IVariantProvider
|
|||
}
|
||||
|
||||
@Override
|
||||
public boolean isVisuallyOpaque()
|
||||
public boolean causesSuffocation(IBlockState state)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
@ -86,8 +89,13 @@ public class BlockPhantom extends BlockContainer implements IVariantProvider
|
|||
}
|
||||
|
||||
@Override
|
||||
public TileEntity createNewTileEntity(World world, int meta)
|
||||
{
|
||||
public boolean hasTileEntity(IBlockState state) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public TileEntity createTileEntity(World world, IBlockState state) {
|
||||
return new TilePhantomBlock(100);
|
||||
}
|
||||
|
||||
|
|
|
@ -30,7 +30,6 @@ import WayofTime.bloodmagic.api.registry.RitualRegistry;
|
|||
import WayofTime.bloodmagic.api.ritual.Ritual;
|
||||
import WayofTime.bloodmagic.api.ritual.imperfect.ImperfectRitual;
|
||||
import WayofTime.bloodmagic.api.util.helper.RitualHelper;
|
||||
import WayofTime.bloodmagic.block.base.BlockEnumContainer;
|
||||
import WayofTime.bloodmagic.block.enums.EnumRitualController;
|
||||
import WayofTime.bloodmagic.client.IVariantProvider;
|
||||
import WayofTime.bloodmagic.registry.ModItems;
|
||||
|
|
|
@ -18,7 +18,7 @@ import WayofTime.bloodmagic.BloodMagic;
|
|||
import WayofTime.bloodmagic.tile.routing.TileMasterRoutingNode;
|
||||
import WayofTime.bloodmagic.tile.routing.TileRoutingNode;
|
||||
|
||||
public abstract class BlockRoutingNode extends BlockContainer
|
||||
public class BlockRoutingNode extends Block
|
||||
{
|
||||
protected static final AxisAlignedBB AABB = new AxisAlignedBB(0.378F, 0.378F, 0.378F, 0.625F, 0.625F, 0.625F);
|
||||
|
||||
|
@ -72,7 +72,7 @@ public abstract class BlockRoutingNode extends BlockContainer
|
|||
}
|
||||
|
||||
@Override
|
||||
public boolean isVisuallyOpaque()
|
||||
public boolean causesSuffocation(IBlockState state)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -3,6 +3,7 @@ package WayofTime.bloodmagic.block;
|
|||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockContainer;
|
||||
import net.minecraft.block.SoundType;
|
||||
import net.minecraft.block.material.Material;
|
||||
|
@ -26,7 +27,9 @@ import WayofTime.bloodmagic.api.Constants;
|
|||
import WayofTime.bloodmagic.client.IVariantProvider;
|
||||
import WayofTime.bloodmagic.tile.TileSoulForge;
|
||||
|
||||
public class BlockSoulForge extends BlockContainer implements IVariantProvider
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
public class BlockSoulForge extends Block implements IVariantProvider
|
||||
{
|
||||
protected static final AxisAlignedBB AABB = new AxisAlignedBB(0.06F, 0.0F, 0.06F, 0.94F, 0.75F, 0.94F);
|
||||
|
||||
|
@ -67,7 +70,7 @@ public class BlockSoulForge extends BlockContainer implements IVariantProvider
|
|||
}
|
||||
|
||||
@Override
|
||||
public boolean isVisuallyOpaque()
|
||||
public boolean causesSuffocation(IBlockState state)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
@ -79,7 +82,7 @@ public class BlockSoulForge extends BlockContainer implements IVariantProvider
|
|||
}
|
||||
|
||||
@Override
|
||||
public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumHand hand, ItemStack heldItem, EnumFacing side, float hitX, float hitY, float hitZ)
|
||||
public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumHand hand, EnumFacing side, float hitX, float hitY, float hitZ)
|
||||
{
|
||||
if (world.getTileEntity(pos) instanceof TileSoulForge)
|
||||
player.openGui(BloodMagic.instance, Constants.Gui.SOUL_FORGE_GUI, world, pos.getX(), pos.getY(), pos.getZ());
|
||||
|
@ -98,8 +101,13 @@ public class BlockSoulForge extends BlockContainer implements IVariantProvider
|
|||
}
|
||||
|
||||
@Override
|
||||
public TileEntity createNewTileEntity(World worldIn, int meta)
|
||||
{
|
||||
public boolean hasTileEntity(IBlockState state) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public TileEntity createTileEntity(World world, IBlockState state) {
|
||||
return new TileSoulForge();
|
||||
}
|
||||
|
||||
|
|
|
@ -5,6 +5,7 @@ import java.util.List;
|
|||
import java.util.Random;
|
||||
|
||||
import WayofTime.bloodmagic.ConfigHandler;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockContainer;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
|
@ -27,7 +28,9 @@ import WayofTime.bloodmagic.api.Constants;
|
|||
import WayofTime.bloodmagic.client.IVariantProvider;
|
||||
import WayofTime.bloodmagic.tile.TileSpectralBlock;
|
||||
|
||||
public class BlockSpectral extends BlockContainer implements IVariantProvider
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
public class BlockSpectral extends Block implements IVariantProvider
|
||||
{
|
||||
protected static final AxisAlignedBB AABB = new AxisAlignedBB(0, 0, 0, 0, 0, 0);
|
||||
|
||||
|
@ -63,7 +66,7 @@ public class BlockSpectral extends BlockContainer implements IVariantProvider
|
|||
}
|
||||
|
||||
@Override
|
||||
public boolean isVisuallyOpaque()
|
||||
public boolean causesSuffocation(IBlockState state)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
@ -112,8 +115,13 @@ public class BlockSpectral extends BlockContainer implements IVariantProvider
|
|||
}
|
||||
|
||||
@Override
|
||||
public TileEntity createNewTileEntity(World world, int meta)
|
||||
{
|
||||
public boolean hasTileEntity(IBlockState state) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public TileEntity createTileEntity(World world, IBlockState state) {
|
||||
return new TileSpectralBlock();
|
||||
}
|
||||
|
||||
|
|
|
@ -43,11 +43,11 @@ public class BlockTeleposer extends BlockContainer implements IVariantProvider
|
|||
}
|
||||
|
||||
@Override
|
||||
public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumHand hand, ItemStack heldItem, EnumFacing side, float hitX, float hitY, float hitZ)
|
||||
public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumHand hand, EnumFacing side, float hitX, float hitY, float hitZ)
|
||||
{
|
||||
ItemStack playerItem = heldItem;
|
||||
ItemStack playerItem = player.getHeldItem(hand);
|
||||
|
||||
if (playerItem != null && playerItem.getItem() instanceof ItemTelepositionFocus)
|
||||
if (playerItem.getItem() instanceof ItemTelepositionFocus)
|
||||
((ItemTelepositionFocus) playerItem.getItem()).setBlockPos(playerItem, world, pos);
|
||||
else if (world.getTileEntity(pos) instanceof TileTeleposer)
|
||||
player.openGui(BloodMagic.instance, Constants.Gui.TELEPOSER_GUI, world, pos.getX(), pos.getY(), pos.getZ());
|
||||
|
|
|
@ -10,6 +10,7 @@ import net.minecraft.creativetab.CreativeTabs;
|
|||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.IStringSerializable;
|
||||
import net.minecraft.util.NonNullList;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
|
||||
|
@ -69,7 +70,7 @@ public class BlockEnum<E extends Enum<E> & IStringSerializable> extends Block
|
|||
|
||||
@SideOnly(Side.CLIENT)
|
||||
@Override
|
||||
public void getSubBlocks(Item item, CreativeTabs tab, List<ItemStack> subBlocks)
|
||||
public void getSubBlocks(Item item, CreativeTabs tab, NonNullList<ItemStack> subBlocks)
|
||||
{
|
||||
for (E type : types)
|
||||
subBlocks.add(new ItemStack(item, 1, type.ordinal()));
|
||||
|
|
|
@ -1,42 +0,0 @@
|
|||
package WayofTime.bloodmagic.block.base;
|
||||
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.IStringSerializable;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public abstract class BlockEnumContainer<E extends Enum<E> & IStringSerializable> extends BlockEnum<E>
|
||||
{
|
||||
public BlockEnumContainer(Material material, Class<E> enumClass, String propName)
|
||||
{
|
||||
super(material, enumClass, propName);
|
||||
}
|
||||
|
||||
public BlockEnumContainer(Material material, Class<E> enumClass)
|
||||
{
|
||||
this(material, enumClass, "type");
|
||||
}
|
||||
|
||||
@Override
|
||||
public abstract boolean hasTileEntity(IBlockState state);
|
||||
|
||||
@Override
|
||||
public abstract TileEntity createTileEntity(World world, IBlockState state);
|
||||
|
||||
@Override
|
||||
public void breakBlock(World worldIn, BlockPos pos, IBlockState state)
|
||||
{
|
||||
super.breakBlock(worldIn, pos, state);
|
||||
worldIn.removeTileEntity(pos);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean eventReceived(IBlockState state, World worldIn, BlockPos pos, int eventID, int eventParam)
|
||||
{
|
||||
super.eventReceived(state, worldIn, pos, eventID, eventParam);
|
||||
TileEntity tileentity = worldIn.getTileEntity(pos);
|
||||
return tileentity != null && tileentity.receiveClientEvent(eventID, eventParam);
|
||||
}
|
||||
}
|
|
@ -9,6 +9,7 @@ import net.minecraft.entity.EntityLivingBase;
|
|||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.util.EnumHand;
|
||||
import net.minecraft.util.IStringSerializable;
|
||||
import net.minecraft.util.Rotation;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
|
@ -122,15 +123,17 @@ public class BlockEnumPillar<E extends Enum<E> & IStringSerializable> extends Bl
|
|||
}
|
||||
|
||||
@Override
|
||||
protected ItemStack createStackedBlock(IBlockState state)
|
||||
protected ItemStack getSilkTouchDrop(IBlockState state)
|
||||
{
|
||||
return new ItemStack(this, 1, damageDropped(state));
|
||||
}
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public IBlockState onBlockPlaced(World worldIn, BlockPos pos, EnumFacing facing, float hitX, float hitY, float hitZ, int meta, EntityLivingBase placer)
|
||||
public IBlockState getStateForPlacement(World world, BlockPos pos, EnumFacing facing, float hitX, float hitY, float hitZ, int meta, EntityLivingBase placer, EnumHand hand)
|
||||
{
|
||||
return super.onBlockPlaced(worldIn, pos, facing, hitX, hitY, hitZ, meta, placer).withProperty(BlockRotatedPillar.AXIS, facing.getAxis());
|
||||
return super.getStateForPlacement(world, pos, facing, hitX, hitY, hitZ, meta, placer, hand).withProperty(BlockRotatedPillar.AXIS, facing.getAxis());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -7,10 +7,7 @@ import net.minecraft.block.state.IBlockState;
|
|||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.util.IStringSerializable;
|
||||
import net.minecraft.util.Mirror;
|
||||
import net.minecraft.util.Rotation;
|
||||
import net.minecraft.util.*;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.math.RayTraceResult;
|
||||
import net.minecraft.world.World;
|
||||
|
@ -70,15 +67,15 @@ public class BlockEnumPillarCap<E extends Enum<E> & IStringSerializable> extends
|
|||
}
|
||||
|
||||
@Override
|
||||
protected ItemStack createStackedBlock(IBlockState state)
|
||||
protected ItemStack getSilkTouchDrop(IBlockState state)
|
||||
{
|
||||
return new ItemStack(this, 1, damageDropped(state));
|
||||
}
|
||||
|
||||
@Override
|
||||
public IBlockState onBlockPlaced(World worldIn, BlockPos pos, EnumFacing facing, float hitX, float hitY, float hitZ, int meta, EntityLivingBase placer)
|
||||
public IBlockState getStateForPlacement(World world, BlockPos pos, EnumFacing facing, float hitX, float hitY, float hitZ, int meta, EntityLivingBase placer, EnumHand hand)
|
||||
{
|
||||
return super.onBlockPlaced(worldIn, pos, facing, hitX, hitY, hitZ, meta, placer).withProperty(FACING, facing);
|
||||
return super.getStateForPlacement(world, pos, facing, hitX, hitY, hitZ, meta, placer, hand).withProperty(FACING, facing);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -16,10 +16,7 @@ import net.minecraft.entity.Entity;
|
|||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.util.IStringSerializable;
|
||||
import net.minecraft.util.Mirror;
|
||||
import net.minecraft.util.Rotation;
|
||||
import net.minecraft.util.*;
|
||||
import net.minecraft.util.math.AxisAlignedBB;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.math.RayTraceResult;
|
||||
|
@ -172,9 +169,9 @@ public class BlockEnumStairs<E extends Enum<E> & IStringSerializable> extends Bl
|
|||
}
|
||||
|
||||
@Override
|
||||
public IBlockState onBlockPlaced(World worldIn, BlockPos pos, EnumFacing facing, float hitX, float hitY, float hitZ, int meta, EntityLivingBase placer)
|
||||
public IBlockState getStateForPlacement(World world, BlockPos pos, EnumFacing facing, float hitX, float hitY, float hitZ, int meta, EntityLivingBase placer, EnumHand hand)
|
||||
{
|
||||
IBlockState state = super.onBlockPlaced(worldIn, pos, facing, hitX, hitY, hitZ, meta, placer);
|
||||
IBlockState state = super.getStateForPlacement(world, pos, facing, hitX, hitY, hitZ, meta, placer, hand);
|
||||
state = state.withProperty(FACING, placer.getHorizontalFacing()).withProperty(BlockStairs.SHAPE, BlockStairs.EnumShape.STRAIGHT);
|
||||
return facing != EnumFacing.DOWN && (facing == EnumFacing.UP || (double) hitY <= 0.5D) ? state.withProperty(BlockStairs.HALF, BlockStairs.EnumHalf.BOTTOM) : state.withProperty(BlockStairs.HALF, BlockStairs.EnumHalf.TOP);
|
||||
}
|
||||
|
@ -349,7 +346,7 @@ public class BlockEnumStairs<E extends Enum<E> & IStringSerializable> extends Bl
|
|||
}
|
||||
|
||||
@Override
|
||||
protected ItemStack createStackedBlock(IBlockState state)
|
||||
protected ItemStack getSilkTouchDrop(IBlockState state)
|
||||
{
|
||||
return new ItemStack(this, 1, damageDropped(state));
|
||||
}
|
||||
|
|
|
@ -13,7 +13,6 @@ import net.minecraft.util.IStringSerializable;
|
|||
import net.minecraft.util.math.AxisAlignedBB;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
|
||||
|
@ -54,7 +53,7 @@ public class BlockEnumWall<E extends Enum<E> & IStringSerializable> extends Bloc
|
|||
}
|
||||
|
||||
@Override
|
||||
public AxisAlignedBB getCollisionBoundingBox(IBlockState blockState, World worldIn, BlockPos pos)
|
||||
public AxisAlignedBB getCollisionBoundingBox(IBlockState blockState, IBlockAccess worldIn, BlockPos pos)
|
||||
{
|
||||
blockState = blockState.getActualState(worldIn, pos);
|
||||
return CLIP_AABB_BY_INDEX[getAABBIndex(blockState)];
|
||||
|
@ -129,7 +128,7 @@ public class BlockEnumWall<E extends Enum<E> & IStringSerializable> extends Bloc
|
|||
}
|
||||
|
||||
@Override
|
||||
protected ItemStack createStackedBlock(IBlockState state)
|
||||
protected ItemStack getSilkTouchDrop(IBlockState state)
|
||||
{
|
||||
return new ItemStack(this, 1, damageDropped(state));
|
||||
}
|
||||
|
|
|
@ -9,11 +9,10 @@ import net.minecraft.block.state.IBlockState;
|
|||
import net.minecraft.creativetab.CreativeTabs;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.NonNullList;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Creates a block that has multiple meta-based states.
|
||||
*
|
||||
|
@ -68,7 +67,7 @@ public class BlockInteger extends Block
|
|||
|
||||
@SideOnly(Side.CLIENT)
|
||||
@Override
|
||||
public void getSubBlocks(Item item, CreativeTabs tab, List<ItemStack> subBlocks) {
|
||||
public void getSubBlocks(Item item, CreativeTabs tab, NonNullList<ItemStack> subBlocks) {
|
||||
for (int i = 0; i < maxMeta; i++)
|
||||
subBlocks.add(new ItemStack(item, 1, i));
|
||||
}
|
||||
|
|
|
@ -1,38 +0,0 @@
|
|||
package WayofTime.bloodmagic.block.base;
|
||||
|
||||
import net.minecraft.block.ITileEntityProvider;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public abstract class BlockIntegerContainer extends BlockInteger implements ITileEntityProvider
|
||||
{
|
||||
public BlockIntegerContainer(Material material, int maxMeta, String propName)
|
||||
{
|
||||
super(material, maxMeta, propName);
|
||||
|
||||
this.isBlockContainer = true;
|
||||
}
|
||||
|
||||
public BlockIntegerContainer(Material material, int maxMeta)
|
||||
{
|
||||
this(material, maxMeta, "meta");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void breakBlock(World worldIn, BlockPos pos, IBlockState state)
|
||||
{
|
||||
super.breakBlock(worldIn, pos, state);
|
||||
worldIn.removeTileEntity(pos);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean eventReceived(IBlockState state, World worldIn, BlockPos pos, int eventID, int eventParam)
|
||||
{
|
||||
super.eventReceived(state, worldIn, pos, eventID, eventParam);
|
||||
TileEntity tileentity = worldIn.getTileEntity(pos);
|
||||
return tileentity != null && tileentity.receiveClientEvent(eventID, eventParam);
|
||||
}
|
||||
}
|
|
@ -1,7 +1,5 @@
|
|||
package WayofTime.bloodmagic.block.base;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import lombok.Getter;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.material.Material;
|
||||
|
@ -11,6 +9,7 @@ import net.minecraft.creativetab.CreativeTabs;
|
|||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import WayofTime.bloodmagic.block.property.PropertyString;
|
||||
import net.minecraft.util.NonNullList;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
import org.apache.commons.lang3.ArrayUtils;
|
||||
|
@ -79,7 +78,7 @@ public class BlockString extends Block
|
|||
|
||||
@SideOnly(Side.CLIENT)
|
||||
@Override
|
||||
public void getSubBlocks(Item item, CreativeTabs tab, List<ItemStack> subBlocks)
|
||||
public void getSubBlocks(Item item, CreativeTabs tab, NonNullList<ItemStack> subBlocks)
|
||||
{
|
||||
for (int i = 0; i < maxMeta; i++)
|
||||
subBlocks.add(new ItemStack(item, 1, i));
|
||||
|
|
|
@ -1,38 +0,0 @@
|
|||
package WayofTime.bloodmagic.block.base;
|
||||
|
||||
import net.minecraft.block.ITileEntityProvider;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public abstract class BlockStringContainer extends BlockString implements ITileEntityProvider
|
||||
{
|
||||
public BlockStringContainer(Material material, String[] values, String propName)
|
||||
{
|
||||
super(material, values, propName);
|
||||
|
||||
this.isBlockContainer = true;
|
||||
}
|
||||
|
||||
public BlockStringContainer(Material material, String[] values)
|
||||
{
|
||||
this(material, values, "type");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void breakBlock(World worldIn, BlockPos pos, IBlockState state)
|
||||
{
|
||||
super.breakBlock(worldIn, pos, state);
|
||||
worldIn.removeTileEntity(pos);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean eventReceived(IBlockState state, World worldIn, BlockPos pos, int eventID, int eventParam)
|
||||
{
|
||||
super.eventReceived(state, worldIn, pos, eventID, eventParam);
|
||||
TileEntity tileentity = worldIn.getTileEntity(pos);
|
||||
return tileentity != null && tileentity.receiveClientEvent(eventID, eventParam);
|
||||
}
|
||||
}
|
|
@ -1,39 +0,0 @@
|
|||
package WayofTime.bloodmagic.block.property;
|
||||
|
||||
import net.minecraftforge.common.property.IUnlistedProperty;
|
||||
|
||||
public class UnlistedPropertyInteger implements IUnlistedProperty<Integer>
|
||||
{
|
||||
private int maxMeta;
|
||||
private String propName;
|
||||
|
||||
public UnlistedPropertyInteger(int maxMeta, String propName)
|
||||
{
|
||||
this.maxMeta = maxMeta;
|
||||
this.propName = propName;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getName()
|
||||
{
|
||||
return propName;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isValid(Integer value)
|
||||
{
|
||||
return value <= maxMeta;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Class<Integer> getType()
|
||||
{
|
||||
return Integer.class;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String valueToString(Integer value)
|
||||
{
|
||||
return value.toString();
|
||||
}
|
||||
}
|
|
@ -1,42 +0,0 @@
|
|||
package WayofTime.bloodmagic.block.property;
|
||||
|
||||
import net.minecraftforge.common.property.IUnlistedProperty;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
public class UnlistedPropertyString implements IUnlistedProperty<String>
|
||||
{
|
||||
private List values;
|
||||
private String propName;
|
||||
|
||||
public UnlistedPropertyString(String[] values, String propName)
|
||||
{
|
||||
this.values = Arrays.asList(values);
|
||||
this.propName = propName;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getName()
|
||||
{
|
||||
return propName;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isValid(String value)
|
||||
{
|
||||
return values.contains(value);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Class<String> getType()
|
||||
{
|
||||
return String.class;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String valueToString(String value)
|
||||
{
|
||||
return value;
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue