Run formatter
This commit is contained in:
parent
61c44a831b
commit
08258fd6ef
606 changed files with 13464 additions and 22975 deletions
|
@ -1,9 +1,9 @@
|
|||
package WayofTime.bloodmagic.block;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
|
||||
import WayofTime.bloodmagic.BloodMagic;
|
||||
import WayofTime.bloodmagic.core.RegistrarBloodMagicItems;
|
||||
import WayofTime.bloodmagic.tile.TileAlchemyArray;
|
||||
import WayofTime.bloodmagic.util.Utils;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
|
@ -22,18 +22,15 @@ import net.minecraft.world.IBlockAccess;
|
|||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
import WayofTime.bloodmagic.core.RegistrarBloodMagicItems;
|
||||
import WayofTime.bloodmagic.tile.TileAlchemyArray;
|
||||
import WayofTime.bloodmagic.util.Utils;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
|
||||
public class BlockAlchemyArray extends Block
|
||||
{
|
||||
public class BlockAlchemyArray extends Block {
|
||||
protected static final AxisAlignedBB ARRAY_AABB = new AxisAlignedBB(0, 0, 0, 1, 0.1, 1);
|
||||
|
||||
public BlockAlchemyArray()
|
||||
{
|
||||
public BlockAlchemyArray() {
|
||||
super(Material.CLOTH);
|
||||
|
||||
setUnlocalizedName(BloodMagic.MODID + ".alchemyArray");
|
||||
|
@ -46,61 +43,51 @@ public class BlockAlchemyArray extends Block
|
|||
}
|
||||
|
||||
@Override
|
||||
public void onEntityCollidedWithBlock(World world, BlockPos pos, IBlockState state, Entity entity)
|
||||
{
|
||||
public void onEntityCollidedWithBlock(World world, BlockPos pos, IBlockState state, Entity entity) {
|
||||
TileEntity tile = world.getTileEntity(pos);
|
||||
if (tile instanceof TileAlchemyArray)
|
||||
{
|
||||
if (tile instanceof TileAlchemyArray) {
|
||||
((TileAlchemyArray) tile).onEntityCollidedWithBlock(state, entity);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public AxisAlignedBB getBoundingBox(IBlockState state, IBlockAccess source, BlockPos pos)
|
||||
{
|
||||
public AxisAlignedBB getBoundingBox(IBlockState state, IBlockAccess source, BlockPos pos) {
|
||||
return ARRAY_AABB;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public BlockRenderLayer getBlockLayer()
|
||||
{
|
||||
public BlockRenderLayer getBlockLayer() {
|
||||
return BlockRenderLayer.CUTOUT;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isNormalCube(IBlockState state, IBlockAccess world, BlockPos pos)
|
||||
{
|
||||
public boolean isNormalCube(IBlockState state, IBlockAccess world, BlockPos pos) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isFullCube(IBlockState state)
|
||||
{
|
||||
public boolean isFullCube(IBlockState state) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean causesSuffocation(IBlockState state)
|
||||
{
|
||||
public boolean causesSuffocation(IBlockState state) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isOpaqueCube(IBlockState state)
|
||||
{
|
||||
public boolean isOpaqueCube(IBlockState state) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public EnumBlockRenderType getRenderType(IBlockState state)
|
||||
{
|
||||
public EnumBlockRenderType getRenderType(IBlockState state) {
|
||||
return EnumBlockRenderType.INVISIBLE;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumHand hand, 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,17 +96,13 @@ public class BlockAlchemyArray extends Block
|
|||
|
||||
ItemStack playerItem = player.getHeldItem(hand);
|
||||
|
||||
if (!playerItem.isEmpty())
|
||||
{
|
||||
if (array.getStackInSlot(0).isEmpty())
|
||||
{
|
||||
if (!playerItem.isEmpty()) {
|
||||
if (array.getStackInSlot(0).isEmpty()) {
|
||||
Utils.insertItemToTile(array, player, 0);
|
||||
} else if (!array.getStackInSlot(0).isEmpty())
|
||||
{
|
||||
} else if (!array.getStackInSlot(0).isEmpty()) {
|
||||
Utils.insertItemToTile(array, player, 1);
|
||||
array.attemptCraft();
|
||||
} else
|
||||
{
|
||||
} else {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
@ -129,20 +112,17 @@ public class BlockAlchemyArray extends Block
|
|||
}
|
||||
|
||||
@Override
|
||||
public ItemStack getPickBlock(IBlockState state, RayTraceResult target, World world, BlockPos pos, EntityPlayer player)
|
||||
{
|
||||
public ItemStack getPickBlock(IBlockState state, RayTraceResult target, World world, BlockPos pos, EntityPlayer player) {
|
||||
return new ItemStack(RegistrarBloodMagicItems.ARCANE_ASHES);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int quantityDropped(Random random)
|
||||
{
|
||||
public int quantityDropped(Random random) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void breakBlock(World world, BlockPos blockPos, IBlockState blockState)
|
||||
{
|
||||
public void breakBlock(World world, BlockPos blockPos, IBlockState blockState) {
|
||||
TileAlchemyArray alchemyArray = (TileAlchemyArray) world.getTileEntity(blockPos);
|
||||
if (alchemyArray != null)
|
||||
alchemyArray.dropItems();
|
||||
|
|
|
@ -1,6 +1,9 @@
|
|||
package WayofTime.bloodmagic.block;
|
||||
|
||||
import WayofTime.bloodmagic.BloodMagic;
|
||||
import WayofTime.bloodmagic.api.Constants;
|
||||
import WayofTime.bloodmagic.item.block.ItemBlockAlchemyTable;
|
||||
import WayofTime.bloodmagic.tile.TileAlchemyTable;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.block.properties.PropertyBool;
|
||||
|
@ -17,19 +20,14 @@ import net.minecraft.util.EnumHand;
|
|||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraft.world.World;
|
||||
import WayofTime.bloodmagic.BloodMagic;
|
||||
import WayofTime.bloodmagic.api.Constants;
|
||||
import WayofTime.bloodmagic.tile.TileAlchemyTable;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
public class BlockAlchemyTable extends Block implements IBMBlock
|
||||
{
|
||||
public class BlockAlchemyTable extends Block implements IBMBlock {
|
||||
public static final PropertyBool INVISIBLE = PropertyBool.create("invisible");
|
||||
public static final PropertyEnum<EnumFacing> DIRECTION = PropertyEnum.<EnumFacing>create("direction", EnumFacing.class);
|
||||
|
||||
public BlockAlchemyTable()
|
||||
{
|
||||
public BlockAlchemyTable() {
|
||||
super(Material.ROCK);
|
||||
// this.setDefaultState(this.blockState.getBaseState().withProperty(DIRECTION, EnumFacing.DOWN).withProperty(INVISIBLE, false));
|
||||
|
||||
|
@ -43,44 +41,37 @@ public class BlockAlchemyTable extends Block implements IBMBlock
|
|||
}
|
||||
|
||||
@Override
|
||||
public boolean isOpaqueCube(IBlockState state)
|
||||
{
|
||||
public boolean isOpaqueCube(IBlockState state) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isNormalCube(IBlockState state, IBlockAccess world, BlockPos pos)
|
||||
{
|
||||
public boolean isNormalCube(IBlockState state, IBlockAccess world, BlockPos pos) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isFullCube(IBlockState state)
|
||||
{
|
||||
public boolean isFullCube(IBlockState state) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean causesSuffocation(IBlockState state)
|
||||
{
|
||||
public boolean causesSuffocation(IBlockState state) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public EnumBlockRenderType getRenderType(IBlockState state)
|
||||
{
|
||||
public EnumBlockRenderType getRenderType(IBlockState state) {
|
||||
return EnumBlockRenderType.MODEL;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canRenderInLayer(IBlockState state, BlockRenderLayer layer)
|
||||
{
|
||||
public boolean canRenderInLayer(IBlockState state, BlockRenderLayer layer) {
|
||||
return layer == BlockRenderLayer.CUTOUT_MIPPED || layer == BlockRenderLayer.TRANSLUCENT;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IBlockState getStateFromMeta(int meta)
|
||||
{
|
||||
public IBlockState getStateFromMeta(int meta) {
|
||||
return this.getDefaultState();
|
||||
}
|
||||
|
||||
|
@ -88,17 +79,14 @@ public class BlockAlchemyTable extends Block implements IBMBlock
|
|||
* Convert the BlockState into the correct metadata value
|
||||
*/
|
||||
@Override
|
||||
public int getMetaFromState(IBlockState state)
|
||||
{
|
||||
public int getMetaFromState(IBlockState state) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IBlockState getActualState(IBlockState state, IBlockAccess world, BlockPos pos)
|
||||
{
|
||||
public IBlockState getActualState(IBlockState state, IBlockAccess world, BlockPos pos) {
|
||||
TileEntity tile = world.getTileEntity(pos);
|
||||
if (tile instanceof TileAlchemyTable)
|
||||
{
|
||||
if (tile instanceof TileAlchemyTable) {
|
||||
return state.withProperty(INVISIBLE, ((TileAlchemyTable) tile).isInvisible()).withProperty(DIRECTION, ((TileAlchemyTable) tile).getDirection());
|
||||
}
|
||||
|
||||
|
@ -106,24 +94,19 @@ public class BlockAlchemyTable extends Block implements IBMBlock
|
|||
}
|
||||
|
||||
@Override
|
||||
protected BlockStateContainer createBlockState()
|
||||
{
|
||||
protected BlockStateContainer createBlockState() {
|
||||
return new BlockStateContainer(this, DIRECTION, INVISIBLE);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumHand hand, 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);
|
||||
if (tile instanceof TileAlchemyTable)
|
||||
{
|
||||
if (((TileAlchemyTable) tile).isSlave())
|
||||
{
|
||||
if (tile instanceof TileAlchemyTable) {
|
||||
if (((TileAlchemyTable) tile).isSlave()) {
|
||||
position = ((TileAlchemyTable) tile).getConnectedPos();
|
||||
tile = world.getTileEntity(position);
|
||||
if (!(tile instanceof TileAlchemyTable))
|
||||
{
|
||||
if (!(tile instanceof TileAlchemyTable)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
@ -135,11 +118,9 @@ public class BlockAlchemyTable extends Block implements IBMBlock
|
|||
}
|
||||
|
||||
@Override
|
||||
public void breakBlock(World world, BlockPos pos, IBlockState blockState)
|
||||
{
|
||||
public void breakBlock(World world, BlockPos pos, IBlockState blockState) {
|
||||
TileAlchemyTable tile = (TileAlchemyTable) world.getTileEntity(pos);
|
||||
if (tile != null && !tile.isSlave())
|
||||
{
|
||||
if (tile != null && !tile.isSlave()) {
|
||||
tile.dropItems();
|
||||
}
|
||||
|
||||
|
@ -158,15 +139,12 @@ public class BlockAlchemyTable extends Block implements IBMBlock
|
|||
}
|
||||
|
||||
@Override
|
||||
public void neighborChanged(IBlockState state, World world, BlockPos pos, Block blockIn, BlockPos fromPos)
|
||||
{
|
||||
public void neighborChanged(IBlockState state, World world, BlockPos pos, Block blockIn, BlockPos fromPos) {
|
||||
TileAlchemyTable tile = (TileAlchemyTable) world.getTileEntity(pos);
|
||||
if (tile != null)
|
||||
{
|
||||
if (tile != null) {
|
||||
BlockPos connectedPos = tile.getConnectedPos();
|
||||
TileEntity connectedTile = world.getTileEntity(connectedPos);
|
||||
if (!(connectedTile instanceof TileAlchemyTable && ((TileAlchemyTable) connectedTile).getConnectedPos().equals(pos)))
|
||||
{
|
||||
if (!(connectedTile instanceof TileAlchemyTable && ((TileAlchemyTable) connectedTile).getConnectedPos().equals(pos))) {
|
||||
this.breakBlock(world, pos, state);
|
||||
world.setBlockToAir(pos);
|
||||
}
|
||||
|
|
|
@ -1,13 +1,21 @@
|
|||
package WayofTime.bloodmagic.block;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import WayofTime.bloodmagic.BloodMagic;
|
||||
import WayofTime.bloodmagic.altar.BloodAltar;
|
||||
import WayofTime.bloodmagic.api.altar.EnumAltarComponent;
|
||||
import WayofTime.bloodmagic.api.altar.IAltarManipulator;
|
||||
import WayofTime.bloodmagic.api.altar.IBloodAltar;
|
||||
import WayofTime.bloodmagic.api.iface.IAltarReader;
|
||||
import WayofTime.bloodmagic.api.iface.IBindable;
|
||||
import WayofTime.bloodmagic.api.iface.IDocumentedBlock;
|
||||
import WayofTime.bloodmagic.api.orb.BloodOrb;
|
||||
import WayofTime.bloodmagic.api.orb.IBloodOrb;
|
||||
import WayofTime.bloodmagic.api.saving.SoulNetwork;
|
||||
import WayofTime.bloodmagic.api.util.helper.NetworkHelper;
|
||||
import WayofTime.bloodmagic.client.IVariantProvider;
|
||||
import WayofTime.bloodmagic.tile.TileAltar;
|
||||
import WayofTime.bloodmagic.util.Utils;
|
||||
import com.google.common.base.Strings;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
|
@ -23,29 +31,15 @@ import net.minecraft.util.text.ITextComponent;
|
|||
import net.minecraft.util.text.TextComponentTranslation;
|
||||
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.altar.IAltarManipulator;
|
||||
import WayofTime.bloodmagic.api.iface.IAltarReader;
|
||||
import WayofTime.bloodmagic.api.iface.IBindable;
|
||||
import WayofTime.bloodmagic.api.saving.SoulNetwork;
|
||||
import WayofTime.bloodmagic.api.orb.IBloodOrb;
|
||||
import WayofTime.bloodmagic.api.util.helper.NetworkHelper;
|
||||
import WayofTime.bloodmagic.client.IVariantProvider;
|
||||
import WayofTime.bloodmagic.tile.TileAltar;
|
||||
import WayofTime.bloodmagic.util.Utils;
|
||||
|
||||
import com.google.common.base.Strings;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class BlockAltar extends Block implements IVariantProvider, IDocumentedBlock, IBMBlock
|
||||
{
|
||||
public BlockAltar()
|
||||
{
|
||||
public class BlockAltar extends Block implements IVariantProvider, IDocumentedBlock, IBMBlock {
|
||||
public BlockAltar() {
|
||||
super(Material.ROCK);
|
||||
|
||||
setUnlocalizedName(BloodMagic.MODID + ".altar");
|
||||
|
@ -56,32 +50,26 @@ public class BlockAltar extends Block implements IVariantProvider, IDocumentedBl
|
|||
}
|
||||
|
||||
@Override
|
||||
public boolean hasComparatorInputOverride(IBlockState state)
|
||||
{
|
||||
public boolean hasComparatorInputOverride(IBlockState state) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getComparatorInputOverride(IBlockState state, World world, BlockPos pos)
|
||||
{
|
||||
public int getComparatorInputOverride(IBlockState state, World world, BlockPos pos) {
|
||||
if (world.isRemote)
|
||||
return 0;
|
||||
|
||||
TileEntity tile = world.getTileEntity(pos);
|
||||
|
||||
if (tile != null && tile instanceof TileAltar)
|
||||
{
|
||||
if (tile != null && tile instanceof TileAltar) {
|
||||
TileAltar altar = (TileAltar) tile;
|
||||
ItemStack orbStack = altar.getStackInSlot(0);
|
||||
|
||||
if (world.getBlockState(pos.down()).getBlock() instanceof BlockDecorative)
|
||||
{
|
||||
if (orbStack.getItem() instanceof IBloodOrb && orbStack.getItem() instanceof IBindable)
|
||||
{
|
||||
if (world.getBlockState(pos.down()).getBlock() instanceof BlockDecorative) {
|
||||
if (orbStack.getItem() instanceof IBloodOrb && orbStack.getItem() instanceof IBindable) {
|
||||
BloodOrb orb = ((IBloodOrb) orbStack.getItem()).getOrb(orbStack);
|
||||
IBindable bindable = (IBindable) orbStack.getItem();
|
||||
if (orb != null && !Strings.isNullOrEmpty(bindable.getOwnerUUID(orbStack)))
|
||||
{
|
||||
if (orb != null && !Strings.isNullOrEmpty(bindable.getOwnerUUID(orbStack))) {
|
||||
SoulNetwork soulNetwork = NetworkHelper.getSoulNetwork(bindable.getOwnerUUID(orbStack));
|
||||
|
||||
int maxEssence = orb.getCapacity();
|
||||
|
@ -90,8 +78,7 @@ public class BlockAltar extends Block implements IVariantProvider, IDocumentedBl
|
|||
return Math.min(15, level) % 16;
|
||||
}
|
||||
}
|
||||
} else
|
||||
{
|
||||
} else {
|
||||
int maxEssence = altar.getCapacity();
|
||||
int currentEssence = altar.getCurrentBlood();
|
||||
int level = currentEssence * 15 / maxEssence;
|
||||
|
@ -103,38 +90,32 @@ public class BlockAltar extends Block implements IVariantProvider, IDocumentedBl
|
|||
}
|
||||
|
||||
@Override
|
||||
public boolean isNormalCube(IBlockState state, IBlockAccess world, BlockPos pos)
|
||||
{
|
||||
public boolean isNormalCube(IBlockState state, IBlockAccess world, BlockPos pos) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isOpaqueCube(IBlockState state)
|
||||
{
|
||||
public boolean isOpaqueCube(IBlockState state) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isFullCube(IBlockState state)
|
||||
{
|
||||
public boolean isFullCube(IBlockState state) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean causesSuffocation(IBlockState state)
|
||||
{
|
||||
public boolean causesSuffocation(IBlockState state) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public EnumBlockRenderType getRenderType(IBlockState state)
|
||||
{
|
||||
public EnumBlockRenderType getRenderType(IBlockState state) {
|
||||
return EnumBlockRenderType.MODEL;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumHand hand, 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);
|
||||
|
||||
if (altar == null || player.isSneaking())
|
||||
|
@ -142,8 +123,7 @@ public class BlockAltar extends Block implements IVariantProvider, IDocumentedBl
|
|||
|
||||
ItemStack playerItem = player.inventory.getCurrentItem();
|
||||
|
||||
if (playerItem.getItem() instanceof IAltarReader || playerItem.getItem() instanceof IAltarManipulator)
|
||||
{
|
||||
if (playerItem.getItem() instanceof IAltarReader || playerItem.getItem() instanceof IAltarManipulator) {
|
||||
playerItem.getItem().onItemRightClick(world, player, hand);
|
||||
return true;
|
||||
}
|
||||
|
@ -158,11 +138,9 @@ public class BlockAltar extends Block implements IVariantProvider, IDocumentedBl
|
|||
}
|
||||
|
||||
@Override
|
||||
public void breakBlock(World world, BlockPos blockPos, IBlockState blockState)
|
||||
{
|
||||
public void breakBlock(World world, BlockPos blockPos, IBlockState blockState) {
|
||||
TileEntity tile = world.getTileEntity(blockPos);
|
||||
if (tile instanceof TileAltar)
|
||||
{
|
||||
if (tile instanceof TileAltar) {
|
||||
TileAltar tileAltar = (TileAltar) world.getTileEntity(blockPos);
|
||||
if (tileAltar != null)
|
||||
tileAltar.dropItems();
|
||||
|
@ -185,8 +163,7 @@ public class BlockAltar extends Block implements IVariantProvider, IDocumentedBl
|
|||
// IVariantProvider
|
||||
|
||||
@Override
|
||||
public List<Pair<Integer, String>> getVariants()
|
||||
{
|
||||
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;
|
||||
|
@ -195,8 +172,7 @@ public class BlockAltar extends Block implements IVariantProvider, IDocumentedBl
|
|||
// IDocumentedBlock
|
||||
|
||||
@Override
|
||||
public List<ITextComponent> getDocumentation(EntityPlayer player, World world, BlockPos pos, IBlockState state)
|
||||
{
|
||||
public List<ITextComponent> getDocumentation(EntityPlayer player, World world, BlockPos pos, IBlockState state) {
|
||||
List<ITextComponent> docs = new ArrayList<ITextComponent>();
|
||||
IBloodAltar altar = ((IBloodAltar) world.getTileEntity(pos));
|
||||
Pair<BlockPos, EnumAltarComponent> missingBlock = BloodAltar.getAltarMissingBlock(world, pos, altar.getTier().toInt());
|
||||
|
|
|
@ -1,8 +1,7 @@
|
|||
package WayofTime.bloodmagic.block;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
import WayofTime.bloodmagic.BloodMagic;
|
||||
import WayofTime.bloodmagic.core.RegistrarBloodMagicItems;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
|
@ -17,16 +16,14 @@ import net.minecraft.world.IBlockAccess;
|
|||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
import WayofTime.bloodmagic.core.RegistrarBloodMagicItems;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
import java.util.Random;
|
||||
|
||||
public class BlockBloodLight extends Block
|
||||
{
|
||||
public class BlockBloodLight extends Block {
|
||||
protected static final AxisAlignedBB AABB = new AxisAlignedBB(0.4, 0.4, 0.4, 0.6, 0.6, 0.6);
|
||||
|
||||
public BlockBloodLight()
|
||||
{
|
||||
public BlockBloodLight() {
|
||||
super(Material.CLOTH);
|
||||
|
||||
setUnlocalizedName(BloodMagic.MODID + ".bloodLight");
|
||||
|
@ -34,66 +31,55 @@ public class BlockBloodLight extends Block
|
|||
|
||||
@Nullable
|
||||
@Override
|
||||
public AxisAlignedBB getCollisionBoundingBox(IBlockState blockState, IBlockAccess worldIn, BlockPos pos)
|
||||
{
|
||||
public AxisAlignedBB getCollisionBoundingBox(IBlockState blockState, IBlockAccess worldIn, BlockPos pos) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isCollidable()
|
||||
{
|
||||
public boolean isCollidable() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isReplaceable(IBlockAccess world, BlockPos pos)
|
||||
{
|
||||
public boolean isReplaceable(IBlockAccess world, BlockPos pos) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public BlockRenderLayer getBlockLayer()
|
||||
{
|
||||
public BlockRenderLayer getBlockLayer() {
|
||||
return BlockRenderLayer.CUTOUT;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isNormalCube(IBlockState state, IBlockAccess world, BlockPos pos)
|
||||
{
|
||||
public boolean isNormalCube(IBlockState state, IBlockAccess world, BlockPos pos) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isOpaqueCube(IBlockState state)
|
||||
{
|
||||
public boolean isOpaqueCube(IBlockState state) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isFullCube(IBlockState state)
|
||||
{
|
||||
public boolean isFullCube(IBlockState state) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean causesSuffocation(IBlockState state)
|
||||
{
|
||||
public boolean causesSuffocation(IBlockState state) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getLightValue(IBlockState state)
|
||||
{
|
||||
public int getLightValue(IBlockState state) {
|
||||
return 15;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public boolean addDestroyEffects(World world, BlockPos pos, ParticleManager particleManager)
|
||||
{
|
||||
if (world.getBlockState(pos).getBlock() == this)
|
||||
{
|
||||
public boolean addDestroyEffects(World world, BlockPos pos, ParticleManager particleManager) {
|
||||
if (world.getBlockState(pos).getBlock() == this) {
|
||||
Random random = new Random();
|
||||
particleManager.spawnEffectParticle(EnumParticleTypes.REDSTONE.getParticleID(), pos.getX() + 0.5D + random.nextGaussian() / 8, pos.getY() + 0.5D, pos.getZ() + 0.5D + random.nextGaussian() / 8, 0, 0, 0);
|
||||
}
|
||||
|
@ -102,15 +88,12 @@ public class BlockBloodLight extends Block
|
|||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void randomDisplayTick(IBlockState state, World world, BlockPos pos, Random rand)
|
||||
{
|
||||
public void randomDisplayTick(IBlockState state, World world, BlockPos pos, Random rand) {
|
||||
EntityPlayerSP playerSP = Minecraft.getMinecraft().player;
|
||||
|
||||
if (rand.nextInt(3) != 0)
|
||||
{
|
||||
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().isEmpty() && playerSP.getActiveItemStack().getItem() == RegistrarBloodMagicItems.SIGIL_BLOOD_LIGHT)
|
||||
{
|
||||
if (!playerSP.getActiveItemStack().isEmpty() && playerSP.getActiveItemStack().getItem() == RegistrarBloodMagicItems.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);
|
||||
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);
|
||||
|
@ -119,14 +102,12 @@ public class BlockBloodLight extends Block
|
|||
}
|
||||
|
||||
@Override
|
||||
public AxisAlignedBB getBoundingBox(IBlockState state, IBlockAccess source, BlockPos pos)
|
||||
{
|
||||
public AxisAlignedBB getBoundingBox(IBlockState state, IBlockAccess source, BlockPos pos) {
|
||||
return AABB;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int quantityDropped(Random par1Random)
|
||||
{
|
||||
public int quantityDropped(Random par1Random) {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,28 +1,19 @@
|
|||
package WayofTime.bloodmagic.block;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.block.SoundType;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.client.util.ITooltipFlag;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
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.block.base.BlockEnum;
|
||||
import WayofTime.bloodmagic.block.enums.EnumBloodRune;
|
||||
import WayofTime.bloodmagic.client.IVariantProvider;
|
||||
import WayofTime.bloodmagic.util.helper.TextHelper;
|
||||
import net.minecraft.block.SoundType;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.client.util.ITooltipFlag;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public class BlockBloodRune extends BlockEnum<EnumBloodRune>
|
||||
{
|
||||
public BlockBloodRune()
|
||||
{
|
||||
import java.util.List;
|
||||
|
||||
public class BlockBloodRune extends BlockEnum<EnumBloodRune> {
|
||||
public BlockBloodRune() {
|
||||
super(Material.ROCK, EnumBloodRune.class);
|
||||
|
||||
setUnlocalizedName(BloodMagic.MODID + ".rune.");
|
||||
|
@ -33,14 +24,12 @@ public class BlockBloodRune extends BlockEnum<EnumBloodRune>
|
|||
setHarvestLevel("pickaxe", 2);
|
||||
}
|
||||
|
||||
public int getRuneEffect(int meta)
|
||||
{
|
||||
public int getRuneEffect(int meta) {
|
||||
return meta;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addInformation(ItemStack stack, World world, List<String> tooltip, ITooltipFlag tooltipFlag)
|
||||
{
|
||||
public void addInformation(ItemStack stack, World world, List<String> tooltip, ITooltipFlag tooltipFlag) {
|
||||
tooltip.add(TextHelper.localizeEffect("tooltip.bloodmagic.decoration.safe"));
|
||||
super.addInformation(stack, world, tooltip, tooltipFlag);
|
||||
}
|
||||
|
|
|
@ -24,24 +24,19 @@ import net.minecraft.util.math.BlockPos;
|
|||
import net.minecraft.util.math.RayTraceResult;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.fluids.FluidActionResult;
|
||||
import net.minecraftforge.fluids.FluidStack;
|
||||
import net.minecraftforge.fluids.FluidUtil;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
import org.apache.commons.lang3.tuple.ImmutablePair;
|
||||
import org.apache.commons.lang3.tuple.Pair;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class BlockBloodTank extends BlockInteger implements IVariantProvider, IBMBlock
|
||||
{
|
||||
public class BlockBloodTank extends BlockInteger implements IVariantProvider, IBMBlock {
|
||||
public static final AxisAlignedBB BOX = new AxisAlignedBB(0.25, 0, 0.25, 0.75, 0.8, 0.75);
|
||||
|
||||
public BlockBloodTank()
|
||||
{
|
||||
public BlockBloodTank() {
|
||||
super(Material.IRON, TileBloodTank.CAPACITIES.length - 1, "tier");
|
||||
|
||||
setUnlocalizedName(BloodMagic.MODID + ".bloodTank");
|
||||
|
@ -55,39 +50,33 @@ public class BlockBloodTank extends BlockInteger implements IVariantProvider, IB
|
|||
|
||||
@Nullable
|
||||
@Override
|
||||
public AxisAlignedBB getCollisionBoundingBox(IBlockState blockState, IBlockAccess worldIn, BlockPos pos)
|
||||
{
|
||||
public AxisAlignedBB getCollisionBoundingBox(IBlockState blockState, IBlockAccess worldIn, BlockPos pos) {
|
||||
return BOX;
|
||||
}
|
||||
|
||||
@Override
|
||||
public AxisAlignedBB getSelectedBoundingBox(IBlockState state, World worldIn, BlockPos pos)
|
||||
{
|
||||
public AxisAlignedBB getSelectedBoundingBox(IBlockState state, World worldIn, BlockPos pos) {
|
||||
return BOX;
|
||||
}
|
||||
|
||||
@Override
|
||||
public EnumBlockRenderType getRenderType(IBlockState state)
|
||||
{
|
||||
public EnumBlockRenderType getRenderType(IBlockState state) {
|
||||
return EnumBlockRenderType.MODEL;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public BlockRenderLayer getBlockLayer()
|
||||
{
|
||||
public BlockRenderLayer getBlockLayer() {
|
||||
return BlockRenderLayer.CUTOUT_MIPPED;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isFullCube(IBlockState state)
|
||||
{
|
||||
public boolean isFullCube(IBlockState state) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isOpaqueCube(IBlockState state)
|
||||
{
|
||||
public boolean isOpaqueCube(IBlockState state) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -103,11 +92,9 @@ public class BlockBloodTank extends BlockInteger implements IVariantProvider, IB
|
|||
}
|
||||
|
||||
@Override
|
||||
public boolean onBlockActivated(World world, BlockPos blockPos, IBlockState state, EntityPlayer player, EnumHand hand, 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) {
|
||||
boolean success = FluidUtil.interactWithFluidHandler(player, hand, world, blockPos, side);
|
||||
if (success)
|
||||
{
|
||||
if (success) {
|
||||
world.checkLight(blockPos);
|
||||
world.updateComparatorOutputLevel(blockPos, this);
|
||||
world.markAndNotifyBlock(blockPos, world.getChunkFromBlockCoords(blockPos), state, state, 3);
|
||||
|
@ -118,21 +105,18 @@ public class BlockBloodTank extends BlockInteger implements IVariantProvider, IB
|
|||
}
|
||||
|
||||
@Override
|
||||
public void onBlockHarvested(World worldIn, BlockPos pos, IBlockState state, EntityPlayer player)
|
||||
{
|
||||
public void onBlockHarvested(World worldIn, BlockPos pos, IBlockState state, EntityPlayer player) {
|
||||
if (!player.capabilities.isCreativeMode)
|
||||
this.dropBlockAsItem(worldIn, pos, state, 0);
|
||||
super.onBlockHarvested(worldIn, pos, state, player);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<ItemStack> getDrops(IBlockAccess world, BlockPos pos, IBlockState blockState, int fortune)
|
||||
{
|
||||
public List<ItemStack> getDrops(IBlockAccess world, BlockPos pos, IBlockState blockState, int fortune) {
|
||||
List<ItemStack> list = Lists.newArrayList();
|
||||
|
||||
TileEntity tile = world.getTileEntity(pos);
|
||||
if (tile instanceof TileBloodTank)
|
||||
{
|
||||
if (tile instanceof TileBloodTank) {
|
||||
TileBloodTank bloodTank = (TileBloodTank) tile;
|
||||
ItemStack drop = new ItemStack(this, 1, bloodTank.getBlockMetadata());
|
||||
NBTTagCompound tag = new NBTTagCompound();
|
||||
|
@ -148,15 +132,12 @@ public class BlockBloodTank extends BlockInteger implements IVariantProvider, IB
|
|||
}
|
||||
|
||||
@Override
|
||||
public void onBlockPlacedBy(World world, BlockPos pos, IBlockState blockState, EntityLivingBase placer, ItemStack stack)
|
||||
{
|
||||
public void onBlockPlacedBy(World world, BlockPos pos, IBlockState blockState, EntityLivingBase placer, ItemStack stack) {
|
||||
TileEntity tile = world.getTileEntity(pos);
|
||||
if (tile instanceof TileBloodTank)
|
||||
{
|
||||
if (tile instanceof TileBloodTank) {
|
||||
TileBloodTank bloodTank = (TileBloodTank) tile;
|
||||
NBTTagCompound tag = stack.getTagCompound();
|
||||
if (tag != null)
|
||||
{
|
||||
if (tag != null) {
|
||||
FluidStack fluidStack = FluidStack.loadFluidStackFromNBT(tag);
|
||||
bloodTank.getTank().setFluid(fluidStack);
|
||||
}
|
||||
|
@ -168,11 +149,9 @@ public class BlockBloodTank extends BlockInteger implements IVariantProvider, IB
|
|||
}
|
||||
|
||||
@Override
|
||||
public int getLightValue(IBlockState state, IBlockAccess world, BlockPos pos)
|
||||
{
|
||||
public int getLightValue(IBlockState state, IBlockAccess world, BlockPos pos) {
|
||||
TileEntity tile = world.getTileEntity(pos);
|
||||
if (tile instanceof TileBloodTank)
|
||||
{
|
||||
if (tile instanceof TileBloodTank) {
|
||||
FluidStack fluidStack = ((TileBloodTank) tile).getTank().getFluid();
|
||||
return fluidStack == null || fluidStack.amount <= 0 ? 0 : fluidStack.getFluid().getLuminosity(fluidStack);
|
||||
}
|
||||
|
@ -181,20 +160,17 @@ public class BlockBloodTank extends BlockInteger implements IVariantProvider, IB
|
|||
}
|
||||
|
||||
@Override
|
||||
public ItemStack getPickBlock(IBlockState state, RayTraceResult target, World world, BlockPos pos, EntityPlayer player)
|
||||
{
|
||||
public ItemStack getPickBlock(IBlockState state, RayTraceResult target, World world, BlockPos pos, EntityPlayer player) {
|
||||
return new ItemStack(this, 1, getMetaFromState(state));
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasComparatorInputOverride(IBlockState state)
|
||||
{
|
||||
public boolean hasComparatorInputOverride(IBlockState state) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getComparatorInputOverride(IBlockState state, World world, BlockPos pos)
|
||||
{
|
||||
public int getComparatorInputOverride(IBlockState state, World world, BlockPos pos) {
|
||||
TileEntity tile = world.getTileEntity(pos);
|
||||
if (tile instanceof TileBloodTank)
|
||||
return ((TileBloodTank) tile).getComparatorOutput();
|
||||
|
@ -202,14 +178,12 @@ public class BlockBloodTank extends BlockInteger implements IVariantProvider, IB
|
|||
}
|
||||
|
||||
@Override
|
||||
public TileEntity createTileEntity(World worldIn, IBlockState blockState)
|
||||
{
|
||||
public TileEntity createTileEntity(World worldIn, IBlockState blockState) {
|
||||
return new TileBloodTank(getMetaFromState(blockState));
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasTileEntity(IBlockState state)
|
||||
{
|
||||
public boolean hasTileEntity(IBlockState state) {
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -221,8 +195,7 @@ public class BlockBloodTank extends BlockInteger implements IVariantProvider, IB
|
|||
// IVariantProvider
|
||||
|
||||
@Override
|
||||
public List<Pair<Integer, String>> getVariants()
|
||||
{
|
||||
public List<Pair<Integer, String>> getVariants() {
|
||||
List<Pair<Integer, String>> ret = Lists.newArrayList();
|
||||
for (int i = 0; i < TileBloodTank.CAPACITIES.length; i++)
|
||||
ret.add(Pair.of(i, "inventory"));
|
||||
|
|
|
@ -1,16 +1,13 @@
|
|||
package WayofTime.bloodmagic.block;
|
||||
|
||||
import net.minecraft.block.SoundType;
|
||||
import net.minecraft.block.material.Material;
|
||||
|
||||
import WayofTime.bloodmagic.BloodMagic;
|
||||
import WayofTime.bloodmagic.block.base.BlockEnum;
|
||||
import WayofTime.bloodmagic.block.enums.EnumDecorative;
|
||||
import net.minecraft.block.SoundType;
|
||||
import net.minecraft.block.material.Material;
|
||||
|
||||
public class BlockDecorative extends BlockEnum<EnumDecorative>
|
||||
{
|
||||
public BlockDecorative()
|
||||
{
|
||||
public class BlockDecorative extends BlockEnum<EnumDecorative> {
|
||||
public BlockDecorative() {
|
||||
super(Material.ROCK, EnumDecorative.class);
|
||||
|
||||
setUnlocalizedName(BloodMagic.MODID + ".");
|
||||
|
|
|
@ -1,22 +1,14 @@
|
|||
package WayofTime.bloodmagic.block;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.google.common.collect.Lists;
|
||||
import net.minecraft.block.SoundType;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.util.IStringSerializable;
|
||||
|
||||
import org.apache.commons.lang3.tuple.Pair;
|
||||
|
||||
import WayofTime.bloodmagic.BloodMagic;
|
||||
import WayofTime.bloodmagic.block.base.BlockEnum;
|
||||
import WayofTime.bloodmagic.client.IVariantProvider;
|
||||
import net.minecraft.block.SoundType;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.util.IStringSerializable;
|
||||
|
||||
public class BlockDemonBase<E extends Enum<E> & IStringSerializable> extends BlockEnum<E> implements IVariantProvider
|
||||
{
|
||||
public BlockDemonBase(String baseName, Class<E> enumClass)
|
||||
{
|
||||
public class BlockDemonBase<E extends Enum<E> & IStringSerializable> extends BlockEnum<E> implements IVariantProvider {
|
||||
public BlockDemonBase(String baseName, Class<E> enumClass) {
|
||||
super(Material.ROCK, enumClass);
|
||||
|
||||
setUnlocalizedName(BloodMagic.MODID + "." + baseName + ".");
|
||||
|
|
|
@ -1,8 +1,11 @@
|
|||
package WayofTime.bloodmagic.block;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import WayofTime.bloodmagic.BloodMagic;
|
||||
import WayofTime.bloodmagic.api.soul.IDemonWillGem;
|
||||
import WayofTime.bloodmagic.api.soul.IDiscreteDemonWill;
|
||||
import WayofTime.bloodmagic.client.IVariantProvider;
|
||||
import WayofTime.bloodmagic.tile.TileDemonCrucible;
|
||||
import WayofTime.bloodmagic.util.Utils;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
|
@ -16,23 +19,15 @@ import net.minecraft.util.EnumHand;
|
|||
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.soul.IDemonWillGem;
|
||||
import WayofTime.bloodmagic.api.soul.IDiscreteDemonWill;
|
||||
import WayofTime.bloodmagic.client.IVariantProvider;
|
||||
import WayofTime.bloodmagic.tile.TileDemonCrucible;
|
||||
import WayofTime.bloodmagic.util.Utils;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class BlockDemonCrucible extends Block implements IVariantProvider, IBMBlock
|
||||
{
|
||||
public BlockDemonCrucible()
|
||||
{
|
||||
public class BlockDemonCrucible extends Block implements IVariantProvider, IBMBlock {
|
||||
public BlockDemonCrucible() {
|
||||
super(Material.ROCK);
|
||||
|
||||
setUnlocalizedName(BloodMagic.MODID + ".demonCrucible");
|
||||
|
@ -45,42 +40,35 @@ public class BlockDemonCrucible extends Block implements IVariantProvider, IBMBl
|
|||
}
|
||||
|
||||
@Override
|
||||
public boolean isNormalCube(IBlockState state, IBlockAccess world, BlockPos pos)
|
||||
{
|
||||
public boolean isNormalCube(IBlockState state, IBlockAccess world, BlockPos pos) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isOpaqueCube(IBlockState state)
|
||||
{
|
||||
public boolean isOpaqueCube(IBlockState state) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean causesSuffocation(IBlockState state)
|
||||
{
|
||||
public boolean causesSuffocation(IBlockState state) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public EnumBlockRenderType getRenderType(IBlockState state)
|
||||
{
|
||||
public EnumBlockRenderType getRenderType(IBlockState state) {
|
||||
return EnumBlockRenderType.MODEL;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumHand hand, 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.isEmpty())
|
||||
{
|
||||
if (!(heldItem.getItem() instanceof IDiscreteDemonWill) && !(heldItem.getItem() instanceof IDemonWillGem))
|
||||
{
|
||||
if (!heldItem.isEmpty()) {
|
||||
if (!(heldItem.getItem() instanceof IDiscreteDemonWill) && !(heldItem.getItem() instanceof IDemonWillGem)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
@ -92,8 +80,7 @@ public class BlockDemonCrucible extends Block implements IVariantProvider, IBMBl
|
|||
}
|
||||
|
||||
@Override
|
||||
public void breakBlock(World world, BlockPos blockPos, IBlockState blockState)
|
||||
{
|
||||
public void breakBlock(World world, BlockPos blockPos, IBlockState blockState) {
|
||||
TileDemonCrucible tile = (TileDemonCrucible) world.getTileEntity(blockPos);
|
||||
if (tile != null)
|
||||
tile.dropItems();
|
||||
|
@ -113,8 +100,7 @@ public class BlockDemonCrucible extends Block implements IVariantProvider, IBMBl
|
|||
}
|
||||
|
||||
@Override
|
||||
public List<Pair<Integer, String>> getVariants()
|
||||
{
|
||||
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;
|
||||
|
|
|
@ -1,8 +1,11 @@
|
|||
package WayofTime.bloodmagic.block;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
import WayofTime.bloodmagic.BloodMagic;
|
||||
import WayofTime.bloodmagic.api.soul.EnumDemonWillType;
|
||||
import WayofTime.bloodmagic.api.soul.PlayerDemonWillHandler;
|
||||
import WayofTime.bloodmagic.item.ItemDemonCrystal;
|
||||
import WayofTime.bloodmagic.item.block.ItemBlockDemonCrystal;
|
||||
import WayofTime.bloodmagic.tile.TileDemonCrystal;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.block.properties.PropertyEnum;
|
||||
|
@ -11,7 +14,6 @@ import net.minecraft.block.state.BlockStateContainer;
|
|||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.creativetab.CreativeTabs;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemBlock;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
|
@ -22,24 +24,16 @@ import net.minecraft.util.NonNullList;
|
|||
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;
|
||||
import WayofTime.bloodmagic.BloodMagic;
|
||||
import WayofTime.bloodmagic.api.soul.EnumDemonWillType;
|
||||
import WayofTime.bloodmagic.api.soul.PlayerDemonWillHandler;
|
||||
import WayofTime.bloodmagic.item.ItemDemonCrystal;
|
||||
import WayofTime.bloodmagic.tile.TileDemonCrystal;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
import java.util.Random;
|
||||
|
||||
public class BlockDemonCrystal extends Block implements IBMBlock
|
||||
{
|
||||
public class BlockDemonCrystal extends Block implements IBMBlock {
|
||||
public static final PropertyInteger AGE = PropertyInteger.create("age", 0, 6);
|
||||
public static final PropertyEnum<EnumDemonWillType> TYPE = PropertyEnum.<EnumDemonWillType>create("type", EnumDemonWillType.class);
|
||||
public static final PropertyEnum<EnumFacing> ATTACHED = PropertyEnum.<EnumFacing>create("attached", EnumFacing.class);
|
||||
|
||||
public BlockDemonCrystal()
|
||||
{
|
||||
public BlockDemonCrystal() {
|
||||
super(Material.ROCK);
|
||||
this.setDefaultState(this.blockState.getBaseState().withProperty(TYPE, EnumDemonWillType.DEFAULT).withProperty(ATTACHED, EnumFacing.UP));
|
||||
|
||||
|
@ -51,8 +45,7 @@ public class BlockDemonCrystal extends Block implements IBMBlock
|
|||
}
|
||||
|
||||
@Override
|
||||
public boolean canPlaceBlockOnSide(World world, BlockPos pos, EnumFacing side)
|
||||
{
|
||||
public boolean canPlaceBlockOnSide(World world, BlockPos pos, EnumFacing side) {
|
||||
BlockPos offsetPos = pos.offset(side.getOpposite());
|
||||
IBlockState offsetState = world.getBlockState(offsetPos);
|
||||
Block offsetBlock = offsetState.getBlock();
|
||||
|
@ -61,25 +54,21 @@ public class BlockDemonCrystal extends Block implements IBMBlock
|
|||
}
|
||||
|
||||
@Override
|
||||
public void neighborChanged(IBlockState state, World world, BlockPos pos, Block blockIn, BlockPos fromPos)
|
||||
{
|
||||
public void neighborChanged(IBlockState state, World world, BlockPos pos, Block blockIn, BlockPos fromPos) {
|
||||
TileDemonCrystal tile = (TileDemonCrystal) world.getTileEntity(pos);
|
||||
EnumFacing placement = tile.getPlacement();
|
||||
BlockPos offsetPos = pos.offset(placement.getOpposite());
|
||||
IBlockState offsetState = world.getBlockState(offsetPos);
|
||||
Block offsetBlock = offsetState.getBlock();
|
||||
|
||||
if (!offsetBlock.isSideSolid(offsetState, world, offsetPos, placement))
|
||||
{
|
||||
if (!offsetBlock.isSideSolid(offsetState, world, offsetPos, placement)) {
|
||||
world.setBlockToAir(pos);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public IBlockState getActualState(IBlockState state, IBlockAccess world, BlockPos pos)
|
||||
{
|
||||
if (world.getTileEntity(pos) == null)
|
||||
{
|
||||
public IBlockState getActualState(IBlockState state, IBlockAccess world, BlockPos pos) {
|
||||
if (world.getTileEntity(pos) == null) {
|
||||
return state;
|
||||
}
|
||||
TileDemonCrystal tile = (TileDemonCrystal) world.getTileEntity(pos);
|
||||
|
@ -87,39 +76,33 @@ public class BlockDemonCrystal extends Block implements IBMBlock
|
|||
}
|
||||
|
||||
@Override
|
||||
public void getSubBlocks(CreativeTabs creativeTabs, NonNullList<ItemStack> list)
|
||||
{
|
||||
public void getSubBlocks(CreativeTabs creativeTabs, NonNullList<ItemStack> list) {
|
||||
for (int i = 0; i < EnumDemonWillType.values().length; i++)
|
||||
list.add(new ItemStack(this, 1, i));
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isNormalCube(IBlockState state, IBlockAccess world, BlockPos pos)
|
||||
{
|
||||
public boolean isNormalCube(IBlockState state, IBlockAccess world, BlockPos pos) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isOpaqueCube(IBlockState state)
|
||||
{
|
||||
public boolean isOpaqueCube(IBlockState state) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isFullCube(IBlockState state)
|
||||
{
|
||||
public boolean isFullCube(IBlockState state) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean causesSuffocation(IBlockState state)
|
||||
{
|
||||
public boolean causesSuffocation(IBlockState state) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public EnumBlockRenderType getRenderType(IBlockState state)
|
||||
{
|
||||
public EnumBlockRenderType getRenderType(IBlockState state) {
|
||||
return EnumBlockRenderType.MODEL;
|
||||
}
|
||||
|
||||
|
@ -132,8 +115,7 @@ public class BlockDemonCrystal extends Block implements IBMBlock
|
|||
* Convert the given metadata into a BlockState for this Block
|
||||
*/
|
||||
@Override
|
||||
public IBlockState getStateFromMeta(int meta)
|
||||
{
|
||||
public IBlockState getStateFromMeta(int meta) {
|
||||
return this.getDefaultState().withProperty(TYPE, EnumDemonWillType.values()[meta]);
|
||||
}
|
||||
|
||||
|
@ -141,20 +123,17 @@ public class BlockDemonCrystal extends Block implements IBMBlock
|
|||
* Convert the BlockState into the correct metadata value
|
||||
*/
|
||||
@Override
|
||||
public int getMetaFromState(IBlockState state)
|
||||
{
|
||||
public int getMetaFromState(IBlockState state) {
|
||||
return state.getValue(TYPE).ordinal();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected BlockStateContainer createBlockState()
|
||||
{
|
||||
protected BlockStateContainer createBlockState() {
|
||||
return new BlockStateContainer(this, TYPE, AGE, ATTACHED);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void breakBlock(World world, BlockPos pos, IBlockState state)
|
||||
{
|
||||
public void breakBlock(World world, BlockPos pos, IBlockState state) {
|
||||
TileEntity tile = world.getTileEntity(pos);
|
||||
if (tile instanceof TileDemonCrystal) {
|
||||
EnumDemonWillType type = state.getValue(TYPE);
|
||||
|
@ -167,50 +146,20 @@ public class BlockDemonCrystal extends Block implements IBMBlock
|
|||
super.breakBlock(world, pos, state);
|
||||
}
|
||||
|
||||
public static ItemStack getItemStackDropped(EnumDemonWillType type, int crystalNumber)
|
||||
{
|
||||
ItemStack stack = null;
|
||||
switch (type)
|
||||
{
|
||||
case CORROSIVE:
|
||||
stack = ItemDemonCrystal.getStack(ItemDemonCrystal.CRYSTAL_CORROSIVE);
|
||||
break;
|
||||
case DEFAULT:
|
||||
stack = ItemDemonCrystal.getStack(ItemDemonCrystal.CRYSTAL_DEFAULT);
|
||||
break;
|
||||
case DESTRUCTIVE:
|
||||
stack = ItemDemonCrystal.getStack(ItemDemonCrystal.CRYSTAL_DESTRUCTIVE);
|
||||
break;
|
||||
case STEADFAST:
|
||||
stack = ItemDemonCrystal.getStack(ItemDemonCrystal.CRYSTAL_STEADFAST);
|
||||
break;
|
||||
case VENGEFUL:
|
||||
stack = ItemDemonCrystal.getStack(ItemDemonCrystal.CRYSTAL_VENGEFUL);
|
||||
break;
|
||||
}
|
||||
|
||||
stack.setCount(crystalNumber);
|
||||
return stack;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int quantityDropped(Random random)
|
||||
{
|
||||
public int quantityDropped(Random random) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumHand hand, EnumFacing side, float hitX, float hitY, float hitZ)
|
||||
{
|
||||
if (world.isRemote)
|
||||
{
|
||||
public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumHand hand, EnumFacing side, float hitX, float hitY, float hitZ) {
|
||||
if (world.isRemote) {
|
||||
return true;
|
||||
}
|
||||
|
||||
TileDemonCrystal crystal = (TileDemonCrystal) world.getTileEntity(pos);
|
||||
|
||||
if (PlayerDemonWillHandler.getTotalDemonWill(EnumDemonWillType.DEFAULT, player) > 1024)
|
||||
{
|
||||
if (PlayerDemonWillHandler.getTotalDemonWill(EnumDemonWillType.DEFAULT, player) > 1024) {
|
||||
crystal.dropSingleCrystal();
|
||||
|
||||
world.notifyBlockUpdate(pos, state, state, 3);
|
||||
|
@ -235,6 +184,30 @@ public class BlockDemonCrystal extends Block implements IBMBlock
|
|||
return new ItemBlockDemonCrystal(this);
|
||||
}
|
||||
|
||||
public static ItemStack getItemStackDropped(EnumDemonWillType type, int crystalNumber) {
|
||||
ItemStack stack = null;
|
||||
switch (type) {
|
||||
case CORROSIVE:
|
||||
stack = ItemDemonCrystal.getStack(ItemDemonCrystal.CRYSTAL_CORROSIVE);
|
||||
break;
|
||||
case DEFAULT:
|
||||
stack = ItemDemonCrystal.getStack(ItemDemonCrystal.CRYSTAL_DEFAULT);
|
||||
break;
|
||||
case DESTRUCTIVE:
|
||||
stack = ItemDemonCrystal.getStack(ItemDemonCrystal.CRYSTAL_DESTRUCTIVE);
|
||||
break;
|
||||
case STEADFAST:
|
||||
stack = ItemDemonCrystal.getStack(ItemDemonCrystal.CRYSTAL_STEADFAST);
|
||||
break;
|
||||
case VENGEFUL:
|
||||
stack = ItemDemonCrystal.getStack(ItemDemonCrystal.CRYSTAL_VENGEFUL);
|
||||
break;
|
||||
}
|
||||
|
||||
stack.setCount(crystalNumber);
|
||||
return stack;
|
||||
}
|
||||
|
||||
// @Override
|
||||
// public java.util.List<ItemStack> getDrops(net.minecraft.world.IBlockAccess world, BlockPos pos, IBlockState state, int fortune)
|
||||
// {
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
package WayofTime.bloodmagic.block;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import WayofTime.bloodmagic.BloodMagic;
|
||||
import WayofTime.bloodmagic.client.IVariantProvider;
|
||||
import WayofTime.bloodmagic.tile.TileDemonCrystallizer;
|
||||
import net.minecraft.block.BlockContainer;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
|
@ -13,18 +13,14 @@ 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.client.IVariantProvider;
|
||||
import WayofTime.bloodmagic.tile.TileDemonCrystallizer;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class BlockDemonCrystallizer extends BlockContainer implements IVariantProvider, IBMBlock
|
||||
{
|
||||
public BlockDemonCrystallizer()
|
||||
{
|
||||
public class BlockDemonCrystallizer extends BlockContainer implements IVariantProvider, IBMBlock {
|
||||
public BlockDemonCrystallizer() {
|
||||
super(Material.ROCK);
|
||||
|
||||
setUnlocalizedName(BloodMagic.MODID + ".demonCrystallizer");
|
||||
|
@ -37,50 +33,42 @@ public class BlockDemonCrystallizer extends BlockContainer implements IVariantPr
|
|||
}
|
||||
|
||||
@Override
|
||||
public boolean isSideSolid(IBlockState state, IBlockAccess world, BlockPos pos, EnumFacing side)
|
||||
{
|
||||
public boolean isSideSolid(IBlockState state, IBlockAccess world, BlockPos pos, EnumFacing side) {
|
||||
return side == EnumFacing.UP;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isOpaqueCube(IBlockState state)
|
||||
{
|
||||
public boolean isOpaqueCube(IBlockState state) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isNormalCube(IBlockState state, IBlockAccess world, BlockPos pos)
|
||||
{
|
||||
public boolean isNormalCube(IBlockState state, IBlockAccess world, BlockPos pos) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isFullCube(IBlockState state)
|
||||
{
|
||||
public boolean isFullCube(IBlockState state) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean causesSuffocation(IBlockState state)
|
||||
{
|
||||
public boolean causesSuffocation(IBlockState state) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public EnumBlockRenderType getRenderType(IBlockState state)
|
||||
{
|
||||
public EnumBlockRenderType getRenderType(IBlockState state) {
|
||||
return EnumBlockRenderType.MODEL;
|
||||
}
|
||||
|
||||
@Override
|
||||
public TileEntity createNewTileEntity(World world, int meta)
|
||||
{
|
||||
public TileEntity createNewTileEntity(World world, int meta) {
|
||||
return new TileDemonCrystallizer();
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Pair<Integer, String>> getVariants()
|
||||
{
|
||||
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;
|
||||
|
|
|
@ -1,23 +1,13 @@
|
|||
package WayofTime.bloodmagic.block;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.block.SoundType;
|
||||
import net.minecraft.block.material.Material;
|
||||
|
||||
import org.apache.commons.lang3.tuple.ImmutablePair;
|
||||
import org.apache.commons.lang3.tuple.Pair;
|
||||
|
||||
import WayofTime.bloodmagic.BloodMagic;
|
||||
import WayofTime.bloodmagic.block.base.BlockEnum;
|
||||
import WayofTime.bloodmagic.block.enums.EnumSubWillType;
|
||||
import WayofTime.bloodmagic.client.IVariantProvider;
|
||||
import net.minecraft.block.SoundType;
|
||||
import net.minecraft.block.material.Material;
|
||||
|
||||
public class BlockDemonLight extends BlockEnum<EnumSubWillType>
|
||||
{
|
||||
public BlockDemonLight()
|
||||
{
|
||||
public class BlockDemonLight extends BlockEnum<EnumSubWillType> {
|
||||
public BlockDemonLight() {
|
||||
super(Material.ROCK, EnumSubWillType.class);
|
||||
|
||||
setUnlocalizedName(BloodMagic.MODID + ".demonlight.");
|
||||
|
|
|
@ -1,22 +1,18 @@
|
|||
package WayofTime.bloodmagic.block;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import WayofTime.bloodmagic.BloodMagic;
|
||||
import WayofTime.bloodmagic.block.base.BlockEnumPillar;
|
||||
import com.google.common.collect.Lists;
|
||||
import net.minecraft.block.SoundType;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.util.IStringSerializable;
|
||||
|
||||
import org.apache.commons.lang3.tuple.Pair;
|
||||
|
||||
import WayofTime.bloodmagic.BloodMagic;
|
||||
import WayofTime.bloodmagic.block.base.BlockEnumPillar;
|
||||
import java.util.List;
|
||||
|
||||
public class BlockDemonPillarBase<E extends Enum<E> & IStringSerializable> extends BlockEnumPillar<E>
|
||||
{
|
||||
public BlockDemonPillarBase(String baseName, Material materialIn, Class<E> enumClass)
|
||||
{
|
||||
public class BlockDemonPillarBase<E extends Enum<E> & IStringSerializable> extends BlockEnumPillar<E> {
|
||||
public BlockDemonPillarBase(String baseName, Material materialIn, Class<E> enumClass) {
|
||||
super(materialIn, enumClass);
|
||||
|
||||
setUnlocalizedName(BloodMagic.MODID + "." + baseName + ".");
|
||||
|
@ -28,12 +24,11 @@ public class BlockDemonPillarBase<E extends Enum<E> & IStringSerializable> exten
|
|||
}
|
||||
|
||||
@Override
|
||||
public List<Pair<Integer, String>> getVariants()
|
||||
{
|
||||
public List<Pair<Integer, String>> getVariants() {
|
||||
List<Pair<Integer, String>> ret = Lists.newArrayList();
|
||||
|
||||
//This is done to make the ItemBlocks have the proper model
|
||||
EnumFacing.Axis[] axis = new EnumFacing.Axis[] { EnumFacing.Axis.Y, EnumFacing.Axis.X, EnumFacing.Axis.Z };
|
||||
EnumFacing.Axis[] axis = new EnumFacing.Axis[]{EnumFacing.Axis.Y, EnumFacing.Axis.X, EnumFacing.Axis.Z};
|
||||
|
||||
for (int i = 0; i < 3; i++)
|
||||
for (int j = 0; j < this.getTypes().length; j++)
|
||||
|
|
|
@ -1,22 +1,18 @@
|
|||
package WayofTime.bloodmagic.block;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import WayofTime.bloodmagic.BloodMagic;
|
||||
import WayofTime.bloodmagic.block.base.BlockEnumPillarCap;
|
||||
import com.google.common.collect.Lists;
|
||||
import net.minecraft.block.SoundType;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.util.IStringSerializable;
|
||||
|
||||
import org.apache.commons.lang3.tuple.Pair;
|
||||
|
||||
import WayofTime.bloodmagic.BloodMagic;
|
||||
import WayofTime.bloodmagic.block.base.BlockEnumPillarCap;
|
||||
import java.util.List;
|
||||
|
||||
public class BlockDemonPillarCapBase<E extends Enum<E> & IStringSerializable> extends BlockEnumPillarCap<E>
|
||||
{
|
||||
public BlockDemonPillarCapBase(String baseName, Material materialIn, Class<E> enumClass)
|
||||
{
|
||||
public class BlockDemonPillarCapBase<E extends Enum<E> & IStringSerializable> extends BlockEnumPillarCap<E> {
|
||||
public BlockDemonPillarCapBase(String baseName, Material materialIn, Class<E> enumClass) {
|
||||
super(materialIn, enumClass);
|
||||
|
||||
setUnlocalizedName(BloodMagic.MODID + "." + baseName + ".");
|
||||
|
@ -28,8 +24,7 @@ public class BlockDemonPillarCapBase<E extends Enum<E> & IStringSerializable> ex
|
|||
}
|
||||
|
||||
@Override
|
||||
public List<Pair<Integer, String>> getVariants()
|
||||
{
|
||||
public List<Pair<Integer, String>> getVariants() {
|
||||
List<Pair<Integer, String>> ret = Lists.newArrayList();
|
||||
|
||||
//This is done to make the ItemBlocks have the proper model
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
package WayofTime.bloodmagic.block;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import WayofTime.bloodmagic.BloodMagic;
|
||||
import WayofTime.bloodmagic.client.IVariantProvider;
|
||||
import WayofTime.bloodmagic.tile.TileDemonPylon;
|
||||
import net.minecraft.block.BlockContainer;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
|
@ -11,18 +11,14 @@ import net.minecraft.util.EnumBlockRenderType;
|
|||
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.client.IVariantProvider;
|
||||
import WayofTime.bloodmagic.tile.TileDemonPylon;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class BlockDemonPylon extends BlockContainer implements IVariantProvider
|
||||
{
|
||||
public BlockDemonPylon()
|
||||
{
|
||||
public class BlockDemonPylon extends BlockContainer implements IVariantProvider {
|
||||
public BlockDemonPylon() {
|
||||
super(Material.ROCK);
|
||||
|
||||
setUnlocalizedName(BloodMagic.MODID + ".demonPylon");
|
||||
|
@ -35,44 +31,37 @@ public class BlockDemonPylon extends BlockContainer implements IVariantProvider
|
|||
}
|
||||
|
||||
@Override
|
||||
public boolean isNormalCube(IBlockState state, IBlockAccess world, BlockPos pos)
|
||||
{
|
||||
public boolean isNormalCube(IBlockState state, IBlockAccess world, BlockPos pos) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isOpaqueCube(IBlockState state)
|
||||
{
|
||||
public boolean isOpaqueCube(IBlockState state) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isFullCube(IBlockState state)
|
||||
{
|
||||
public boolean isFullCube(IBlockState state) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean causesSuffocation(IBlockState state)
|
||||
{
|
||||
public boolean causesSuffocation(IBlockState state) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public EnumBlockRenderType getRenderType(IBlockState state)
|
||||
{
|
||||
public EnumBlockRenderType getRenderType(IBlockState state) {
|
||||
return EnumBlockRenderType.MODEL;
|
||||
}
|
||||
|
||||
@Override
|
||||
public TileEntity createNewTileEntity(World world, int meta)
|
||||
{
|
||||
public TileEntity createNewTileEntity(World world, int meta) {
|
||||
return new TileDemonPylon();
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Pair<Integer, String>> getVariants()
|
||||
{
|
||||
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;
|
||||
|
|
|
@ -1,24 +1,17 @@
|
|||
package WayofTime.bloodmagic.block;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import WayofTime.bloodmagic.BloodMagic;
|
||||
import WayofTime.bloodmagic.block.base.BlockEnumStairs;
|
||||
import com.google.common.collect.Lists;
|
||||
import net.minecraft.block.SoundType;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.util.IStringSerializable;
|
||||
|
||||
import org.apache.commons.lang3.tuple.ImmutablePair;
|
||||
import org.apache.commons.lang3.tuple.Pair;
|
||||
|
||||
import WayofTime.bloodmagic.BloodMagic;
|
||||
import WayofTime.bloodmagic.block.base.BlockEnumStairs;
|
||||
import WayofTime.bloodmagic.client.IVariantProvider;
|
||||
import java.util.List;
|
||||
|
||||
public class BlockDemonStairsBase<E extends Enum<E> & IStringSerializable> extends BlockEnumStairs<E>
|
||||
{
|
||||
public BlockDemonStairsBase(String baseName, Material materialIn, Class<E> enumClass)
|
||||
{
|
||||
public class BlockDemonStairsBase<E extends Enum<E> & IStringSerializable> extends BlockEnumStairs<E> {
|
||||
public BlockDemonStairsBase(String baseName, Material materialIn, Class<E> enumClass) {
|
||||
super(materialIn, enumClass);
|
||||
|
||||
setUnlocalizedName(BloodMagic.MODID + "." + baseName + ".");
|
||||
|
@ -30,8 +23,7 @@ public class BlockDemonStairsBase<E extends Enum<E> & IStringSerializable> exten
|
|||
}
|
||||
|
||||
@Override
|
||||
public List<Pair<Integer, String>> getVariants()
|
||||
{
|
||||
public List<Pair<Integer, String>> getVariants() {
|
||||
List<Pair<Integer, String>> ret = Lists.newArrayList();
|
||||
|
||||
for (int i = 0; i < this.getTypes().length; i++)
|
||||
|
|
|
@ -1,23 +1,17 @@
|
|||
package WayofTime.bloodmagic.block;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import WayofTime.bloodmagic.BloodMagic;
|
||||
import WayofTime.bloodmagic.block.base.BlockEnumWall;
|
||||
import com.google.common.collect.Lists;
|
||||
import net.minecraft.block.SoundType;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.util.IStringSerializable;
|
||||
|
||||
import org.apache.commons.lang3.tuple.Pair;
|
||||
|
||||
import WayofTime.bloodmagic.BloodMagic;
|
||||
import WayofTime.bloodmagic.block.base.BlockEnumWall;
|
||||
import WayofTime.bloodmagic.client.IVariantProvider;
|
||||
import java.util.List;
|
||||
|
||||
public class BlockDemonWallBase<E extends Enum<E> & IStringSerializable> extends BlockEnumWall<E>
|
||||
{
|
||||
public BlockDemonWallBase(String baseName, Material materialIn, Class<E> enumClass)
|
||||
{
|
||||
public class BlockDemonWallBase<E extends Enum<E> & IStringSerializable> extends BlockEnumWall<E> {
|
||||
public BlockDemonWallBase(String baseName, Material materialIn, Class<E> enumClass) {
|
||||
super(materialIn, enumClass);
|
||||
|
||||
setUnlocalizedName(BloodMagic.MODID + "." + baseName + ".");
|
||||
|
@ -29,8 +23,7 @@ public class BlockDemonWallBase<E extends Enum<E> & IStringSerializable> extends
|
|||
}
|
||||
|
||||
@Override
|
||||
public List<Pair<Integer, String>> getVariants()
|
||||
{
|
||||
public List<Pair<Integer, String>> getVariants() {
|
||||
List<Pair<Integer, String>> ret = Lists.newArrayList();
|
||||
|
||||
for (int i = 0; i < this.getTypes().length; i++)
|
||||
|
|
|
@ -1,10 +1,13 @@
|
|||
package WayofTime.bloodmagic.block;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Random;
|
||||
|
||||
import WayofTime.bloodmagic.BloodMagic;
|
||||
import WayofTime.bloodmagic.api.ritual.IMasterRitualStone;
|
||||
import WayofTime.bloodmagic.api.teleport.PortalLocation;
|
||||
import WayofTime.bloodmagic.api.teleport.TeleportQueue;
|
||||
import WayofTime.bloodmagic.block.base.BlockInteger;
|
||||
import WayofTime.bloodmagic.ritual.portal.LocationsHandler;
|
||||
import WayofTime.bloodmagic.ritual.portal.Teleports;
|
||||
import WayofTime.bloodmagic.tile.TileDimensionalPortal;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.entity.Entity;
|
||||
|
@ -17,23 +20,17 @@ import net.minecraft.world.IBlockAccess;
|
|||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
import WayofTime.bloodmagic.api.ritual.IMasterRitualStone;
|
||||
import WayofTime.bloodmagic.api.teleport.PortalLocation;
|
||||
import WayofTime.bloodmagic.api.teleport.TeleportQueue;
|
||||
import WayofTime.bloodmagic.ritual.portal.LocationsHandler;
|
||||
import WayofTime.bloodmagic.ritual.portal.Teleports;
|
||||
import WayofTime.bloodmagic.tile.TileDimensionalPortal;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Random;
|
||||
|
||||
public class BlockDimensionalPortal extends BlockInteger
|
||||
{
|
||||
public class BlockDimensionalPortal extends BlockInteger {
|
||||
protected static final AxisAlignedBB AABB_0 = new AxisAlignedBB(0.0D, 0.0D, 0.375D, 1.0D, 1.0D, 0.625D);
|
||||
protected static final AxisAlignedBB AABB_1 = new AxisAlignedBB(0.375D, 0.0D, 0.0D, 0.625D, 1.0D, 1.0D);
|
||||
protected static final AxisAlignedBB AABB_DEFAULT = new AxisAlignedBB(0.375D, 0.0D, 0.375D, 0.625D, 1.0D, 0.625D);
|
||||
|
||||
public BlockDimensionalPortal()
|
||||
{
|
||||
public BlockDimensionalPortal() {
|
||||
super(Material.PORTAL, 2);
|
||||
setUnlocalizedName(BloodMagic.MODID + ".dimensionalPortal");
|
||||
setBlockUnbreakable();
|
||||
|
@ -42,79 +39,61 @@ public class BlockDimensionalPortal extends BlockInteger
|
|||
}
|
||||
|
||||
@Override
|
||||
public boolean isNormalCube(IBlockState state, IBlockAccess world, BlockPos pos)
|
||||
{
|
||||
public boolean isNormalCube(IBlockState state, IBlockAccess world, BlockPos pos) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isOpaqueCube(IBlockState state)
|
||||
{
|
||||
public boolean isOpaqueCube(IBlockState state) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean causesSuffocation(IBlockState state)
|
||||
{
|
||||
public boolean causesSuffocation(IBlockState state) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public AxisAlignedBB getCollisionBoundingBox(IBlockState state, IBlockAccess world, BlockPos pos)
|
||||
{
|
||||
public AxisAlignedBB getCollisionBoundingBox(IBlockState state, IBlockAccess world, BlockPos pos) {
|
||||
return null;
|
||||
}
|
||||
|
||||
public boolean isOpaqueCube()
|
||||
{
|
||||
public boolean isOpaqueCube() {
|
||||
return false;
|
||||
}
|
||||
|
||||
public boolean isFullCube()
|
||||
{
|
||||
public boolean isFullCube() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getLightValue(IBlockState state, IBlockAccess world, BlockPos pos)
|
||||
{
|
||||
public int getLightValue(IBlockState state, IBlockAccess world, BlockPos pos) {
|
||||
return 12;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onEntityCollidedWithBlock(World world, BlockPos pos, IBlockState blockState, Entity entity)
|
||||
{
|
||||
if (!world.isRemote && world.getTileEntity(pos) instanceof TileDimensionalPortal)
|
||||
{
|
||||
public void onEntityCollidedWithBlock(World world, BlockPos pos, IBlockState blockState, Entity entity) {
|
||||
if (!world.isRemote && world.getTileEntity(pos) instanceof TileDimensionalPortal) {
|
||||
TileDimensionalPortal tile = (TileDimensionalPortal) world.getTileEntity(pos);
|
||||
|
||||
if (LocationsHandler.getLocationsHandler() != null)
|
||||
{
|
||||
if (LocationsHandler.getLocationsHandler() != null) {
|
||||
ArrayList<PortalLocation> linkedLocations = LocationsHandler.getLocationsHandler().getLinkedLocations(tile.portalID);
|
||||
|
||||
if (linkedLocations != null && !linkedLocations.isEmpty() && linkedLocations.size() > 1)
|
||||
{
|
||||
if (world.getTileEntity(tile.getMasterStonePos()) != null && world.getTileEntity(tile.getMasterStonePos()) instanceof IMasterRitualStone)
|
||||
{
|
||||
if (linkedLocations != null && !linkedLocations.isEmpty() && linkedLocations.size() > 1) {
|
||||
if (world.getTileEntity(tile.getMasterStonePos()) != null && world.getTileEntity(tile.getMasterStonePos()) instanceof IMasterRitualStone) {
|
||||
IMasterRitualStone masterRitualStone = (IMasterRitualStone) world.getTileEntity(tile.getMasterStonePos());
|
||||
if (linkedLocations.get(0).equals(new PortalLocation(masterRitualStone.getBlockPos().up(), world.provider.getDimension())))
|
||||
{
|
||||
if (linkedLocations.get(0).equals(new PortalLocation(masterRitualStone.getBlockPos().up(), world.provider.getDimension()))) {
|
||||
PortalLocation portal = linkedLocations.get(1);
|
||||
if (portal.getDimension() == world.provider.getDimension())
|
||||
{
|
||||
if (portal.getDimension() == world.provider.getDimension()) {
|
||||
TeleportQueue.getInstance().addITeleport(new Teleports.TeleportSameDim(portal.getX(), portal.getY(), portal.getZ(), entity, masterRitualStone.getOwner(), false));
|
||||
} else
|
||||
{
|
||||
} else {
|
||||
TeleportQueue.getInstance().addITeleport(new Teleports.TeleportToDim(portal.getX(), portal.getY(), portal.getZ(), entity, masterRitualStone.getOwner(), world, portal.getDimension(), false));
|
||||
}
|
||||
} else if (linkedLocations.get(1).equals(new PortalLocation(masterRitualStone.getBlockPos().up(), world.provider.getDimension())))
|
||||
{
|
||||
} else if (linkedLocations.get(1).equals(new PortalLocation(masterRitualStone.getBlockPos().up(), world.provider.getDimension()))) {
|
||||
PortalLocation portal = linkedLocations.get(0);
|
||||
if (portal.getDimension() == world.provider.getDimension())
|
||||
{
|
||||
if (portal.getDimension() == world.provider.getDimension()) {
|
||||
TeleportQueue.getInstance().addITeleport(new Teleports.TeleportSameDim(portal.getX(), portal.getY(), portal.getZ(), entity, masterRitualStone.getOwner(), false));
|
||||
} else
|
||||
{
|
||||
} else {
|
||||
TeleportQueue.getInstance().addITeleport(new Teleports.TeleportToDim(portal.getX(), portal.getY(), portal.getZ(), entity, masterRitualStone.getOwner(), world, portal.getDimension(), false));
|
||||
}
|
||||
}
|
||||
|
@ -125,23 +104,18 @@ public class BlockDimensionalPortal extends BlockInteger
|
|||
}
|
||||
|
||||
@Override
|
||||
public int quantityDropped(Random par1Random)
|
||||
{
|
||||
public int quantityDropped(Random par1Random) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public AxisAlignedBB getBoundingBox(IBlockState state, IBlockAccess world, BlockPos pos)
|
||||
{
|
||||
public AxisAlignedBB getBoundingBox(IBlockState state, IBlockAccess world, BlockPos pos) {
|
||||
int meta = state.getBlock().getMetaFromState(state);
|
||||
if (meta == 0)
|
||||
{
|
||||
if (meta == 0) {
|
||||
return AABB_0;
|
||||
} else if (meta == 1)
|
||||
{
|
||||
} else if (meta == 1) {
|
||||
return AABB_1;
|
||||
} else
|
||||
{
|
||||
} else {
|
||||
return AABB_DEFAULT;
|
||||
}
|
||||
}
|
||||
|
@ -155,15 +129,13 @@ public class BlockDimensionalPortal extends BlockInteger
|
|||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public BlockRenderLayer getBlockLayer()
|
||||
{
|
||||
public BlockRenderLayer getBlockLayer() {
|
||||
return BlockRenderLayer.TRANSLUCENT;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void randomDisplayTick(IBlockState state, World world, BlockPos pos, Random rand)
|
||||
{
|
||||
public void randomDisplayTick(IBlockState state, World world, BlockPos pos, Random rand) {
|
||||
this.spawnParticles(world, pos.getX(), pos.getY(), pos.getZ());
|
||||
}
|
||||
|
||||
|
@ -178,41 +150,32 @@ public class BlockDimensionalPortal extends BlockInteger
|
|||
return new TileDimensionalPortal();
|
||||
}
|
||||
|
||||
private void spawnParticles(World world, int x, int y, int z)
|
||||
{
|
||||
private void spawnParticles(World world, int x, int y, int z) {
|
||||
Random random = world.rand;
|
||||
double d0 = 0.0625D;
|
||||
for (int i = 0; i < 6; ++i)
|
||||
{
|
||||
for (int i = 0; i < 6; ++i) {
|
||||
double particleX = (double) ((float) x + random.nextFloat());
|
||||
double particleY = (double) ((float) y + random.nextFloat());
|
||||
double particleZ = (double) ((float) z + random.nextFloat());
|
||||
if (i == 0 && !world.getBlockState(new BlockPos(x, y + 1, z)).isOpaqueCube())
|
||||
{
|
||||
if (i == 0 && !world.getBlockState(new BlockPos(x, y + 1, z)).isOpaqueCube()) {
|
||||
particleY = (double) (y + 1) + d0;
|
||||
}
|
||||
if (i == 1 && !world.getBlockState(new BlockPos(x, y - 1, z)).isOpaqueCube())
|
||||
{
|
||||
if (i == 1 && !world.getBlockState(new BlockPos(x, y - 1, z)).isOpaqueCube()) {
|
||||
particleY = (double) y - d0;
|
||||
}
|
||||
if (i == 2 && !world.getBlockState(new BlockPos(x, y, z + 1)).isOpaqueCube())
|
||||
{
|
||||
if (i == 2 && !world.getBlockState(new BlockPos(x, y, z + 1)).isOpaqueCube()) {
|
||||
particleZ = (double) (z + 1) + d0;
|
||||
}
|
||||
if (i == 3 && !world.getBlockState(new BlockPos(x, y, z - 1)).isOpaqueCube())
|
||||
{
|
||||
if (i == 3 && !world.getBlockState(new BlockPos(x, y, z - 1)).isOpaqueCube()) {
|
||||
particleZ = (double) z - d0;
|
||||
}
|
||||
if (i == 4 && !world.getBlockState(new BlockPos(x + 1, y, z)).isOpaqueCube())
|
||||
{
|
||||
if (i == 4 && !world.getBlockState(new BlockPos(x + 1, y, z)).isOpaqueCube()) {
|
||||
particleX = (double) (x + 1) + d0;
|
||||
}
|
||||
if (i == 5 && !world.getBlockState(new BlockPos(x - 1, y, z)).isOpaqueCube())
|
||||
{
|
||||
if (i == 5 && !world.getBlockState(new BlockPos(x - 1, y, z)).isOpaqueCube()) {
|
||||
particleX = (double) x - d0;
|
||||
}
|
||||
if (particleX < (double) x || particleX > (double) (x + 1) || particleY < 0.0D || particleY > (double) (y + 1) || particleZ < (double) z || particleZ > (double) (z + 1))
|
||||
{
|
||||
if (particleX < (double) x || particleX > (double) (x + 1) || particleY < 0.0D || particleY > (double) (y + 1) || particleZ < (double) z || particleZ > (double) (z + 1)) {
|
||||
world.spawnParticle(EnumParticleTypes.REDSTONE, particleX, particleY, particleZ, 0.0D, 0.0D, 0.0D);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
package WayofTime.bloodmagic.block;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import WayofTime.bloodmagic.BloodMagic;
|
||||
import WayofTime.bloodmagic.client.IVariantProvider;
|
||||
import WayofTime.bloodmagic.tile.TileIncenseAltar;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
|
@ -13,22 +13,17 @@ import net.minecraft.util.math.AxisAlignedBB;
|
|||
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.client.IVariantProvider;
|
||||
import WayofTime.bloodmagic.tile.TileIncenseAltar;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class BlockIncenseAltar extends Block implements IVariantProvider, IBMBlock
|
||||
{
|
||||
public class BlockIncenseAltar extends Block implements IVariantProvider, IBMBlock {
|
||||
protected static final AxisAlignedBB AABB = new AxisAlignedBB(0.3F, 0F, 0.3F, 0.72F, 1F, 0.72F);
|
||||
|
||||
public BlockIncenseAltar()
|
||||
{
|
||||
public BlockIncenseAltar() {
|
||||
super(Material.ROCK);
|
||||
|
||||
setUnlocalizedName(BloodMagic.MODID + ".incenseAltar");
|
||||
|
@ -39,44 +34,37 @@ public class BlockIncenseAltar extends Block implements IVariantProvider, IBMBlo
|
|||
}
|
||||
|
||||
@Override
|
||||
public AxisAlignedBB getBoundingBox(IBlockState state, IBlockAccess source, BlockPos pos)
|
||||
{
|
||||
public AxisAlignedBB getBoundingBox(IBlockState state, IBlockAccess source, BlockPos pos) {
|
||||
return AABB;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isOpaqueCube(IBlockState state)
|
||||
{
|
||||
public boolean isOpaqueCube(IBlockState state) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isNormalCube(IBlockState state, IBlockAccess world, BlockPos pos)
|
||||
{
|
||||
public boolean isNormalCube(IBlockState state, IBlockAccess world, BlockPos pos) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isFullCube(IBlockState state)
|
||||
{
|
||||
public boolean isFullCube(IBlockState state) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean causesSuffocation(IBlockState state)
|
||||
{
|
||||
public boolean causesSuffocation(IBlockState state) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public EnumBlockRenderType getRenderType(IBlockState state)
|
||||
{
|
||||
public EnumBlockRenderType getRenderType(IBlockState state) {
|
||||
return EnumBlockRenderType.MODEL;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void breakBlock(World world, BlockPos blockPos, IBlockState blockState)
|
||||
{
|
||||
public void breakBlock(World world, BlockPos blockPos, IBlockState blockState) {
|
||||
TileIncenseAltar TileIncenseAltar = (TileIncenseAltar) world.getTileEntity(blockPos);
|
||||
if (TileIncenseAltar != null)
|
||||
TileIncenseAltar.dropItems();
|
||||
|
@ -96,8 +84,7 @@ public class BlockIncenseAltar extends Block implements IVariantProvider, IBMBlo
|
|||
}
|
||||
|
||||
@Override
|
||||
public List<Pair<Integer, String>> getVariants()
|
||||
{
|
||||
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;
|
||||
|
|
|
@ -1,5 +1,8 @@
|
|||
package WayofTime.bloodmagic.block;
|
||||
|
||||
import WayofTime.bloodmagic.BloodMagic;
|
||||
import WayofTime.bloodmagic.api.Constants;
|
||||
import WayofTime.bloodmagic.tile.routing.TileInputRoutingNode;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
|
@ -7,16 +10,11 @@ import net.minecraft.util.EnumFacing;
|
|||
import net.minecraft.util.EnumHand;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.World;
|
||||
import WayofTime.bloodmagic.BloodMagic;
|
||||
import WayofTime.bloodmagic.api.Constants;
|
||||
import WayofTime.bloodmagic.tile.routing.TileInputRoutingNode;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
public class BlockInputRoutingNode extends BlockRoutingNode
|
||||
{
|
||||
public BlockInputRoutingNode()
|
||||
{
|
||||
public class BlockInputRoutingNode extends BlockRoutingNode {
|
||||
public BlockInputRoutingNode() {
|
||||
super();
|
||||
|
||||
setUnlocalizedName(BloodMagic.MODID + ".inputRouting");
|
||||
|
@ -24,11 +22,9 @@ public class BlockInputRoutingNode extends BlockRoutingNode
|
|||
|
||||
@Override
|
||||
//TODO: Combine BlockInputRoutingNode and BlockInputRoutingNode so they have the same superclass
|
||||
public void breakBlock(World world, BlockPos pos, IBlockState state)
|
||||
{
|
||||
public void breakBlock(World world, BlockPos pos, IBlockState state) {
|
||||
TileEntity tile = world.getTileEntity(pos);
|
||||
if (tile instanceof TileInputRoutingNode)
|
||||
{
|
||||
if (tile instanceof TileInputRoutingNode) {
|
||||
((TileInputRoutingNode) tile).removeAllConnections();
|
||||
((TileInputRoutingNode) tile).dropItems();
|
||||
}
|
||||
|
@ -36,10 +32,8 @@ public class BlockInputRoutingNode extends BlockRoutingNode
|
|||
}
|
||||
|
||||
@Override
|
||||
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)
|
||||
{
|
||||
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) {
|
||||
player.openGui(BloodMagic.instance, Constants.Gui.ROUTING_NODE_GUI, world, pos.getX(), pos.getY(), pos.getZ());
|
||||
}
|
||||
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
package WayofTime.bloodmagic.block;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import WayofTime.bloodmagic.BloodMagic;
|
||||
import WayofTime.bloodmagic.block.base.BlockEnum;
|
||||
import WayofTime.bloodmagic.block.enums.EnumSubWillType;
|
||||
import WayofTime.bloodmagic.tile.TileInversionPillar;
|
||||
import net.minecraft.block.SoundType;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.block.state.BlockStateContainer;
|
||||
|
@ -14,19 +14,13 @@ import net.minecraft.util.math.BlockPos;
|
|||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.property.Properties;
|
||||
|
||||
import org.apache.commons.lang3.tuple.ImmutablePair;
|
||||
import org.apache.commons.lang3.tuple.Pair;
|
||||
|
||||
import WayofTime.bloodmagic.BloodMagic;
|
||||
import WayofTime.bloodmagic.block.enums.EnumSubWillType;
|
||||
import WayofTime.bloodmagic.client.IVariantProvider;
|
||||
import WayofTime.bloodmagic.tile.TileInversionPillar;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class BlockInversionPillar extends BlockEnum<EnumSubWillType>
|
||||
{
|
||||
public BlockInversionPillar()
|
||||
{
|
||||
public class BlockInversionPillar extends BlockEnum<EnumSubWillType> {
|
||||
public BlockInversionPillar() {
|
||||
super(Material.ROCK, EnumSubWillType.class);
|
||||
|
||||
setUnlocalizedName(BloodMagic.MODID + ".inversionpillar.");
|
||||
|
@ -38,11 +32,9 @@ public class BlockInversionPillar extends BlockEnum<EnumSubWillType>
|
|||
}
|
||||
|
||||
@Override
|
||||
public void breakBlock(World world, BlockPos blockPos, IBlockState blockState)
|
||||
{
|
||||
public void breakBlock(World world, BlockPos blockPos, IBlockState blockState) {
|
||||
TileEntity tile = world.getTileEntity(blockPos);
|
||||
if (tile instanceof TileInversionPillar)
|
||||
{
|
||||
if (tile instanceof TileInversionPillar) {
|
||||
TileInversionPillar tilePillar = (TileInversionPillar) world.getTileEntity(blockPos);
|
||||
tilePillar.removePillarFromMap();
|
||||
}
|
||||
|
@ -51,44 +43,37 @@ public class BlockInversionPillar extends BlockEnum<EnumSubWillType>
|
|||
}
|
||||
|
||||
@Override
|
||||
public IBlockState getActualState(IBlockState state, IBlockAccess world, BlockPos pos)
|
||||
{
|
||||
public IBlockState getActualState(IBlockState state, IBlockAccess world, BlockPos pos) {
|
||||
return super.getActualState(state, world, pos).withProperty(Properties.StaticProperty, true);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isOpaqueCube(IBlockState state)
|
||||
{
|
||||
public boolean isOpaqueCube(IBlockState state) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isNormalCube(IBlockState state, IBlockAccess world, BlockPos pos)
|
||||
{
|
||||
public boolean isNormalCube(IBlockState state, IBlockAccess world, BlockPos pos) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isFullCube(IBlockState state)
|
||||
{
|
||||
public boolean isFullCube(IBlockState state) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean causesSuffocation(IBlockState state)
|
||||
{
|
||||
public boolean causesSuffocation(IBlockState state) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public EnumBlockRenderType getRenderType(IBlockState state)
|
||||
{
|
||||
public EnumBlockRenderType getRenderType(IBlockState state) {
|
||||
return EnumBlockRenderType.MODEL;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Pair<Integer, String>> getVariants()
|
||||
{
|
||||
public List<Pair<Integer, String>> getVariants() {
|
||||
List<Pair<Integer, String>> ret = new ArrayList<Pair<Integer, String>>();
|
||||
for (int i = 0; i < this.getTypes().length; i++)
|
||||
ret.add(Pair.of(i, "static=false,type=" + this.getTypes()[i]));
|
||||
|
@ -105,8 +90,7 @@ public class BlockInversionPillar extends BlockEnum<EnumSubWillType>
|
|||
return new TileInversionPillar(state.getValue(getProperty()).getType());
|
||||
}
|
||||
|
||||
protected BlockStateContainer createStateContainer()
|
||||
{
|
||||
protected BlockStateContainer createStateContainer() {
|
||||
return new BlockStateContainer.Builder(this).add(getProperty(), Properties.StaticProperty).add(Properties.AnimationProperty).build();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,27 +1,23 @@
|
|||
package WayofTime.bloodmagic.block;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import WayofTime.bloodmagic.BloodMagic;
|
||||
import WayofTime.bloodmagic.block.base.BlockEnum;
|
||||
import WayofTime.bloodmagic.block.enums.EnumInversionCap;
|
||||
import WayofTime.bloodmagic.client.IVariantProvider;
|
||||
import net.minecraft.block.SoundType;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.util.EnumBlockRenderType;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
|
||||
import org.apache.commons.lang3.tuple.ImmutablePair;
|
||||
import org.apache.commons.lang3.tuple.Pair;
|
||||
|
||||
import WayofTime.bloodmagic.BloodMagic;
|
||||
import WayofTime.bloodmagic.block.base.BlockEnum;
|
||||
import WayofTime.bloodmagic.block.enums.EnumInversionCap;
|
||||
import WayofTime.bloodmagic.client.IVariantProvider;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class BlockInversionPillarEnd extends BlockEnum<EnumInversionCap> implements IVariantProvider
|
||||
{
|
||||
public BlockInversionPillarEnd()
|
||||
{
|
||||
public class BlockInversionPillarEnd extends BlockEnum<EnumInversionCap> implements IVariantProvider {
|
||||
public BlockInversionPillarEnd() {
|
||||
super(Material.ROCK, EnumInversionCap.class);
|
||||
|
||||
setUnlocalizedName(BloodMagic.MODID + ".inversionpillarend.");
|
||||
|
@ -33,38 +29,32 @@ public class BlockInversionPillarEnd extends BlockEnum<EnumInversionCap> impleme
|
|||
}
|
||||
|
||||
@Override
|
||||
public boolean isOpaqueCube(IBlockState state)
|
||||
{
|
||||
public boolean isOpaqueCube(IBlockState state) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isNormalCube(IBlockState state, IBlockAccess world, BlockPos pos)
|
||||
{
|
||||
public boolean isNormalCube(IBlockState state, IBlockAccess world, BlockPos pos) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isFullCube(IBlockState state)
|
||||
{
|
||||
public boolean isFullCube(IBlockState state) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean causesSuffocation(IBlockState state)
|
||||
{
|
||||
public boolean causesSuffocation(IBlockState state) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public EnumBlockRenderType getRenderType(IBlockState state)
|
||||
{
|
||||
public EnumBlockRenderType getRenderType(IBlockState state) {
|
||||
return EnumBlockRenderType.MODEL;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Pair<Integer, String>> getVariants()
|
||||
{
|
||||
public List<Pair<Integer, String>> getVariants() {
|
||||
List<Pair<Integer, String>> ret = new ArrayList<Pair<Integer, String>>();
|
||||
for (int i = 0; i < this.getTypes().length; i++)
|
||||
ret.add(new ImmutablePair<Integer, String>(i, "type=" + this.getTypes()[i]));
|
||||
|
|
|
@ -1,30 +1,26 @@
|
|||
package WayofTime.bloodmagic.block;
|
||||
|
||||
import WayofTime.bloodmagic.BloodMagic;
|
||||
import WayofTime.bloodmagic.tile.routing.TileItemRoutingNode;
|
||||
import WayofTime.bloodmagic.tile.routing.TileRoutingNode;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.World;
|
||||
import WayofTime.bloodmagic.tile.routing.TileItemRoutingNode;
|
||||
import WayofTime.bloodmagic.tile.routing.TileRoutingNode;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
public class BlockItemRoutingNode extends BlockRoutingNode
|
||||
{
|
||||
public BlockItemRoutingNode()
|
||||
{
|
||||
public class BlockItemRoutingNode extends BlockRoutingNode {
|
||||
public BlockItemRoutingNode() {
|
||||
super();
|
||||
|
||||
setUnlocalizedName(BloodMagic.MODID + ".itemRouting");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void breakBlock(World world, BlockPos pos, IBlockState state)
|
||||
{
|
||||
public void breakBlock(World world, BlockPos pos, IBlockState state) {
|
||||
TileEntity tile = world.getTileEntity(pos);
|
||||
if (tile instanceof TileRoutingNode)
|
||||
{
|
||||
if (tile instanceof TileRoutingNode) {
|
||||
((TileRoutingNode) tile).removeAllConnections();
|
||||
}
|
||||
super.breakBlock(world, pos, state);
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
package WayofTime.bloodmagic.block;
|
||||
|
||||
import java.awt.Color;
|
||||
|
||||
import WayofTime.bloodmagic.BloodMagic;
|
||||
import WayofTime.bloodmagic.api.Constants;
|
||||
import WayofTime.bloodmagic.util.helper.TextHelper;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.util.BlockRenderLayer;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
|
@ -12,15 +12,13 @@ import net.minecraft.world.World;
|
|||
import net.minecraftforge.fluids.BlockFluidClassic;
|
||||
import net.minecraftforge.fluids.Fluid;
|
||||
import net.minecraftforge.fluids.FluidStack;
|
||||
import WayofTime.bloodmagic.api.Constants;
|
||||
import WayofTime.bloodmagic.util.helper.TextHelper;
|
||||
|
||||
public class BlockLifeEssence extends BlockFluidClassic
|
||||
{
|
||||
import java.awt.Color;
|
||||
|
||||
public class BlockLifeEssence extends BlockFluidClassic {
|
||||
private static final Fluid LIFE_ESSENCE = new FluidLifeEssence();
|
||||
|
||||
public BlockLifeEssence()
|
||||
{
|
||||
public BlockLifeEssence() {
|
||||
super(LIFE_ESSENCE, Material.WATER);
|
||||
|
||||
setUnlocalizedName(BloodMagic.MODID + ".fluid.lifeEssence");
|
||||
|
@ -28,32 +26,27 @@ public class BlockLifeEssence extends BlockFluidClassic
|
|||
}
|
||||
|
||||
@Override
|
||||
public boolean canDisplace(IBlockAccess world, BlockPos blockPos)
|
||||
{
|
||||
public boolean canDisplace(IBlockAccess world, BlockPos blockPos) {
|
||||
return !world.getBlockState(blockPos).getBlock().getMaterial(world.getBlockState(blockPos)).isLiquid() && super.canDisplace(world, blockPos);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean displaceIfPossible(World world, BlockPos blockPos)
|
||||
{
|
||||
public boolean displaceIfPossible(World world, BlockPos blockPos) {
|
||||
return !world.getBlockState(blockPos).getBlock().getMaterial(world.getBlockState(blockPos)).isLiquid() && super.displaceIfPossible(world, blockPos);
|
||||
}
|
||||
|
||||
@Override
|
||||
public BlockRenderLayer getBlockLayer() {
|
||||
return BlockRenderLayer.SOLID;
|
||||
}
|
||||
|
||||
public static Fluid getLifeEssence() {
|
||||
return LIFE_ESSENCE;
|
||||
}
|
||||
|
||||
@Override
|
||||
public BlockRenderLayer getBlockLayer()
|
||||
{
|
||||
return BlockRenderLayer.SOLID;
|
||||
}
|
||||
public static class FluidLifeEssence extends Fluid {
|
||||
|
||||
public static class FluidLifeEssence extends Fluid
|
||||
{
|
||||
|
||||
public FluidLifeEssence()
|
||||
{
|
||||
public FluidLifeEssence() {
|
||||
super("lifeEssence", new ResourceLocation(Constants.Mod.DOMAIN + "blocks/lifeEssenceStill"), new ResourceLocation(Constants.Mod.DOMAIN + "blocks/lifeEssenceFlowing"));
|
||||
|
||||
setDensity(2000);
|
||||
|
@ -61,14 +54,12 @@ public class BlockLifeEssence extends BlockFluidClassic
|
|||
}
|
||||
|
||||
@Override
|
||||
public int getColor()
|
||||
{
|
||||
public int getColor() {
|
||||
return Color.RED.getRGB();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getLocalizedName(FluidStack fluidStack)
|
||||
{
|
||||
public String getLocalizedName(FluidStack fluidStack) {
|
||||
return TextHelper.localize("tile.bloodmagic.fluid.lifeEssence.name");
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,17 +1,15 @@
|
|||
package WayofTime.bloodmagic.block;
|
||||
|
||||
import WayofTime.bloodmagic.BloodMagic;
|
||||
import WayofTime.bloodmagic.tile.routing.TileMasterRoutingNode;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.world.World;
|
||||
import WayofTime.bloodmagic.BloodMagic;
|
||||
import WayofTime.bloodmagic.tile.routing.TileMasterRoutingNode;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
public class BlockMasterRoutingNode extends BlockRoutingNode
|
||||
{
|
||||
public BlockMasterRoutingNode()
|
||||
{
|
||||
public class BlockMasterRoutingNode extends BlockRoutingNode {
|
||||
public BlockMasterRoutingNode() {
|
||||
super();
|
||||
|
||||
setUnlocalizedName(BloodMagic.MODID + ".masterRouting");
|
||||
|
|
|
@ -1,8 +1,13 @@
|
|||
package WayofTime.bloodmagic.block;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import WayofTime.bloodmagic.BloodMagic;
|
||||
import WayofTime.bloodmagic.api.altar.EnumAltarComponent;
|
||||
import WayofTime.bloodmagic.api.altar.IAltarComponent;
|
||||
import WayofTime.bloodmagic.block.base.BlockEnum;
|
||||
import WayofTime.bloodmagic.block.enums.EnumMimic;
|
||||
import WayofTime.bloodmagic.core.RegistrarBloodMagicBlocks;
|
||||
import WayofTime.bloodmagic.tile.TileMimic;
|
||||
import WayofTime.bloodmagic.util.Utils;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.SoundType;
|
||||
import net.minecraft.block.material.Material;
|
||||
|
@ -23,20 +28,12 @@ import net.minecraft.world.World;
|
|||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
|
||||
import WayofTime.bloodmagic.BloodMagic;
|
||||
import WayofTime.bloodmagic.api.altar.EnumAltarComponent;
|
||||
import WayofTime.bloodmagic.api.altar.IAltarComponent;
|
||||
import WayofTime.bloodmagic.block.enums.EnumMimic;
|
||||
import WayofTime.bloodmagic.core.RegistrarBloodMagicBlocks;
|
||||
import WayofTime.bloodmagic.tile.TileMimic;
|
||||
import WayofTime.bloodmagic.util.Utils;
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
public class BlockMimic extends BlockEnum<EnumMimic> implements IAltarComponent
|
||||
{
|
||||
public class BlockMimic extends BlockEnum<EnumMimic> implements IAltarComponent {
|
||||
public static final int sentientMimicMeta = 4;
|
||||
|
||||
public BlockMimic()
|
||||
{
|
||||
public BlockMimic() {
|
||||
super(Material.ROCK, EnumMimic.class);
|
||||
|
||||
setUnlocalizedName(BloodMagic.MODID + ".mimic.");
|
||||
|
@ -50,53 +47,43 @@ public class BlockMimic extends BlockEnum<EnumMimic> implements IAltarComponent
|
|||
|
||||
@Nullable
|
||||
@Override
|
||||
public AxisAlignedBB getCollisionBoundingBox(IBlockState state, IBlockAccess world, BlockPos pos)
|
||||
{
|
||||
switch (this.getMetaFromState(state))
|
||||
{
|
||||
case 1:
|
||||
case 2:
|
||||
case 3:
|
||||
case 4:
|
||||
TileMimic tileMimic = (TileMimic) world.getTileEntity(pos);
|
||||
if (tileMimic != null && !tileMimic.getStackInSlot(0).isEmpty())
|
||||
{
|
||||
Block mimicBlock = Block.getBlockFromItem(tileMimic.getStackInSlot(0).getItem());
|
||||
if (mimicBlock == Blocks.AIR)
|
||||
{
|
||||
public AxisAlignedBB getCollisionBoundingBox(IBlockState state, IBlockAccess world, BlockPos pos) {
|
||||
switch (this.getMetaFromState(state)) {
|
||||
case 1:
|
||||
case 2:
|
||||
case 3:
|
||||
case 4:
|
||||
TileMimic tileMimic = (TileMimic) world.getTileEntity(pos);
|
||||
if (tileMimic != null && !tileMimic.getStackInSlot(0).isEmpty()) {
|
||||
Block mimicBlock = Block.getBlockFromItem(tileMimic.getStackInSlot(0).getItem());
|
||||
if (mimicBlock == Blocks.AIR) {
|
||||
return FULL_BLOCK_AABB;
|
||||
}
|
||||
IBlockState mimicState = mimicBlock.getStateFromMeta(tileMimic.metaOfReplacedBlock);
|
||||
if (mimicBlock != this) {
|
||||
return mimicState.getCollisionBoundingBox(world, pos);
|
||||
}
|
||||
} else {
|
||||
return FULL_BLOCK_AABB;
|
||||
}
|
||||
IBlockState mimicState = mimicBlock.getStateFromMeta(tileMimic.metaOfReplacedBlock);
|
||||
if (mimicBlock != this)
|
||||
{
|
||||
return mimicState.getCollisionBoundingBox(world, pos);
|
||||
}
|
||||
} else
|
||||
{
|
||||
return FULL_BLOCK_AABB;
|
||||
}
|
||||
case 0:
|
||||
default:
|
||||
return NULL_AABB;
|
||||
case 0:
|
||||
default:
|
||||
return NULL_AABB;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public AxisAlignedBB getSelectedBoundingBox(IBlockState state, World world, BlockPos pos)
|
||||
{
|
||||
public AxisAlignedBB getSelectedBoundingBox(IBlockState state, World world, BlockPos pos) {
|
||||
TileMimic tileMimic = (TileMimic) world.getTileEntity(pos);
|
||||
if (tileMimic != null && !tileMimic.getStackInSlot(0).isEmpty())
|
||||
{
|
||||
if (tileMimic != null && !tileMimic.getStackInSlot(0).isEmpty()) {
|
||||
Block mimicBlock = Block.getBlockFromItem(tileMimic.getStackInSlot(0).getItem());
|
||||
if (mimicBlock == Blocks.AIR)
|
||||
{
|
||||
if (mimicBlock == Blocks.AIR) {
|
||||
return FULL_BLOCK_AABB;
|
||||
}
|
||||
IBlockState mimicState = mimicBlock.getStateFromMeta(tileMimic.getStackInSlot(0).getItemDamage());
|
||||
if (mimicBlock != this)
|
||||
{
|
||||
if (mimicBlock != this) {
|
||||
return mimicState.getSelectedBoundingBox(world, pos);
|
||||
}
|
||||
}
|
||||
|
@ -105,35 +92,29 @@ public class BlockMimic extends BlockEnum<EnumMimic> implements IAltarComponent
|
|||
}
|
||||
|
||||
@Override
|
||||
public int getLightOpacity(IBlockState state)
|
||||
{
|
||||
switch (this.getMetaFromState(state))
|
||||
{
|
||||
case 2:
|
||||
case 4:
|
||||
return 0;
|
||||
default:
|
||||
return this.lightOpacity;
|
||||
public int getLightOpacity(IBlockState state) {
|
||||
switch (this.getMetaFromState(state)) {
|
||||
case 2:
|
||||
case 4:
|
||||
return 0;
|
||||
default:
|
||||
return this.lightOpacity;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getLightValue(IBlockState state)
|
||||
{
|
||||
switch (this.getMetaFromState(state))
|
||||
{
|
||||
case 3:
|
||||
return 15;
|
||||
default:
|
||||
return this.lightValue;
|
||||
public int getLightValue(IBlockState state) {
|
||||
switch (this.getMetaFromState(state)) {
|
||||
case 3:
|
||||
return 15;
|
||||
default:
|
||||
return this.lightValue;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMetaFromState(IBlockState state)
|
||||
{
|
||||
if (state.getBlock() == this)
|
||||
{
|
||||
public int getMetaFromState(IBlockState state) {
|
||||
if (state.getBlock() == this) {
|
||||
return super.getMetaFromState(state);
|
||||
}
|
||||
|
||||
|
@ -148,21 +129,16 @@ public class BlockMimic extends BlockEnum<EnumMimic> implements IAltarComponent
|
|||
}
|
||||
|
||||
@Override
|
||||
public IBlockState getActualState(IBlockState state, IBlockAccess world, BlockPos pos)
|
||||
{
|
||||
public IBlockState getActualState(IBlockState state, IBlockAccess world, BlockPos pos) {
|
||||
TileEntity tile = world.getTileEntity(pos);
|
||||
if (tile instanceof TileMimic)
|
||||
{
|
||||
if (tile instanceof TileMimic) {
|
||||
TileMimic mimic = (TileMimic) tile;
|
||||
ItemStack stack = mimic.getStackInSlot(0);
|
||||
if (stack.getItem() instanceof ItemBlock)
|
||||
{
|
||||
if (stack.getItem() instanceof ItemBlock) {
|
||||
Block block = ((ItemBlock) stack.getItem()).getBlock();
|
||||
IBlockState mimicState = block.getStateFromMeta(stack.getItemDamage());
|
||||
if (block != this)
|
||||
{
|
||||
if (block.getRenderType(mimicState) == EnumBlockRenderType.ENTITYBLOCK_ANIMATED)
|
||||
{
|
||||
if (block != this) {
|
||||
if (block.getRenderType(mimicState) == EnumBlockRenderType.ENTITYBLOCK_ANIMATED) {
|
||||
return RegistrarBloodMagicBlocks.BLOOD_LIGHT.getDefaultState(); //Small and invisible-ish, basically this is returned in order to not render over the animated block (TESR)
|
||||
}
|
||||
|
||||
|
@ -174,41 +150,34 @@ public class BlockMimic extends BlockEnum<EnumMimic> implements IAltarComponent
|
|||
}
|
||||
|
||||
@Override
|
||||
public boolean isFullCube(IBlockState state)
|
||||
{
|
||||
public boolean isFullCube(IBlockState state) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isNormalCube(IBlockState state, IBlockAccess world, BlockPos pos)
|
||||
{
|
||||
public boolean isNormalCube(IBlockState state, IBlockAccess world, BlockPos pos) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean causesSuffocation(IBlockState state)
|
||||
{
|
||||
public boolean causesSuffocation(IBlockState state) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isOpaqueCube(IBlockState state)
|
||||
{
|
||||
public boolean isOpaqueCube(IBlockState state) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canRenderInLayer(IBlockState state, BlockRenderLayer layer)
|
||||
{
|
||||
public boolean canRenderInLayer(IBlockState state, BlockRenderLayer layer) {
|
||||
return layer == BlockRenderLayer.CUTOUT_MIPPED || layer == BlockRenderLayer.CUTOUT;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void breakBlock(World world, BlockPos blockPos, IBlockState blockState)
|
||||
{
|
||||
public void breakBlock(World world, BlockPos blockPos, IBlockState blockState) {
|
||||
TileEntity tile = world.getTileEntity(blockPos);
|
||||
if (tile instanceof TileMimic)
|
||||
{
|
||||
if (tile instanceof TileMimic) {
|
||||
TileMimic TileMimic = (TileMimic) world.getTileEntity(blockPos);
|
||||
if (TileMimic != null)
|
||||
TileMimic.dropItems();
|
||||
|
@ -231,21 +200,16 @@ public class BlockMimic extends BlockEnum<EnumMimic> implements IAltarComponent
|
|||
|
||||
@Nullable
|
||||
@Override
|
||||
public EnumAltarComponent getType(World world, IBlockState state, BlockPos pos)
|
||||
{
|
||||
public EnumAltarComponent getType(World world, IBlockState state, BlockPos pos) {
|
||||
TileEntity tile = world.getTileEntity(pos);
|
||||
if (tile instanceof TileMimic)
|
||||
{
|
||||
if (tile instanceof TileMimic) {
|
||||
TileMimic mimic = (TileMimic) tile;
|
||||
ItemStack stack = mimic.getStackInSlot(0);
|
||||
if (stack.getItem() instanceof ItemBlock)
|
||||
{
|
||||
if (stack.getItem() instanceof ItemBlock) {
|
||||
Block block = ((ItemBlock) stack.getItem()).getBlock();
|
||||
if (block instanceof IAltarComponent)
|
||||
{
|
||||
if (block instanceof IAltarComponent) {
|
||||
return ((IAltarComponent) block).getType(world, block.getStateFromMeta(mimic.metaOfReplacedBlock), pos);
|
||||
} else
|
||||
{
|
||||
} else {
|
||||
for (EnumAltarComponent altarComponent : EnumAltarComponent.values())
|
||||
if (block == Utils.getBlockForComponent(altarComponent))
|
||||
return altarComponent;
|
||||
|
|
|
@ -1,5 +1,8 @@
|
|||
package WayofTime.bloodmagic.block;
|
||||
|
||||
import WayofTime.bloodmagic.BloodMagic;
|
||||
import WayofTime.bloodmagic.api.Constants;
|
||||
import WayofTime.bloodmagic.tile.routing.TileOutputRoutingNode;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
|
@ -7,16 +10,11 @@ import net.minecraft.util.EnumFacing;
|
|||
import net.minecraft.util.EnumHand;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.World;
|
||||
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()
|
||||
{
|
||||
public class BlockOutputRoutingNode extends BlockRoutingNode {
|
||||
public BlockOutputRoutingNode() {
|
||||
super();
|
||||
|
||||
setUnlocalizedName(BloodMagic.MODID + ".outputRouting");
|
||||
|
@ -24,11 +22,9 @@ public class BlockOutputRoutingNode extends BlockRoutingNode
|
|||
|
||||
@Override
|
||||
//TODO: Combine BlockOutputRoutingNode and BlockInputRoutingNode so they have the same superclass
|
||||
public void breakBlock(World world, BlockPos pos, IBlockState state)
|
||||
{
|
||||
public void breakBlock(World world, BlockPos pos, IBlockState state) {
|
||||
TileEntity tile = world.getTileEntity(pos);
|
||||
if (tile instanceof TileOutputRoutingNode)
|
||||
{
|
||||
if (tile instanceof TileOutputRoutingNode) {
|
||||
((TileOutputRoutingNode) tile).removeAllConnections();
|
||||
((TileOutputRoutingNode) tile).dropItems();
|
||||
}
|
||||
|
@ -36,10 +32,8 @@ public class BlockOutputRoutingNode extends BlockRoutingNode
|
|||
}
|
||||
|
||||
@Override
|
||||
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)
|
||||
{
|
||||
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) {
|
||||
player.openGui(BloodMagic.instance, Constants.Gui.ROUTING_NODE_GUI, world, pos.getX(), pos.getY(), pos.getZ());
|
||||
}
|
||||
|
||||
|
|
|
@ -1,32 +1,23 @@
|
|||
package WayofTime.bloodmagic.block;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.block.SoundType;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.client.util.ITooltipFlag;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
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.incense.IIncensePath;
|
||||
import WayofTime.bloodmagic.block.base.BlockEnum;
|
||||
import WayofTime.bloodmagic.block.enums.EnumPath;
|
||||
import WayofTime.bloodmagic.client.IVariantProvider;
|
||||
import WayofTime.bloodmagic.util.helper.TextHelper;
|
||||
import net.minecraft.block.SoundType;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.client.util.ITooltipFlag;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public class BlockPath extends BlockEnum<EnumPath> implements IIncensePath
|
||||
{
|
||||
import java.util.List;
|
||||
|
||||
public BlockPath()
|
||||
{
|
||||
public class BlockPath extends BlockEnum<EnumPath> implements IIncensePath {
|
||||
|
||||
public BlockPath() {
|
||||
super(Material.ROCK, EnumPath.class);
|
||||
|
||||
setUnlocalizedName(BloodMagic.MODID + ".path.");
|
||||
|
@ -46,31 +37,28 @@ public class BlockPath extends BlockEnum<EnumPath> implements IIncensePath
|
|||
}
|
||||
|
||||
@Override
|
||||
public void addInformation(ItemStack stack, World world, List<String> tooltip, ITooltipFlag tooltipFlag)
|
||||
{
|
||||
public void addInformation(ItemStack stack, World world, List<String> tooltip, ITooltipFlag tooltipFlag) {
|
||||
tooltip.add(TextHelper.localizeEffect("tooltip.bloodmagic.decoration.safe"));
|
||||
super.addInformation(stack, world, tooltip, tooltipFlag);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getLevelOfPath(World world, BlockPos pos, IBlockState state)
|
||||
{
|
||||
switch (this.getMetaFromState(state))
|
||||
{
|
||||
case 0:
|
||||
case 1:
|
||||
return 2;
|
||||
case 2:
|
||||
case 3:
|
||||
return 4;
|
||||
case 4:
|
||||
case 5:
|
||||
return 6;
|
||||
case 6:
|
||||
case 7:
|
||||
return 8;
|
||||
default:
|
||||
return 0;
|
||||
public int getLevelOfPath(World world, BlockPos pos, IBlockState state) {
|
||||
switch (this.getMetaFromState(state)) {
|
||||
case 0:
|
||||
case 1:
|
||||
return 2;
|
||||
case 2:
|
||||
case 3:
|
||||
return 4;
|
||||
case 4:
|
||||
case 5:
|
||||
return 6;
|
||||
case 6:
|
||||
case 7:
|
||||
return 8;
|
||||
default:
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,9 +1,8 @@
|
|||
package WayofTime.bloodmagic.block;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
|
||||
import WayofTime.bloodmagic.BloodMagic;
|
||||
import WayofTime.bloodmagic.client.IVariantProvider;
|
||||
import WayofTime.bloodmagic.tile.TilePhantomBlock;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
|
@ -16,20 +15,16 @@ import net.minecraft.world.IBlockAccess;
|
|||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
|
||||
import org.apache.commons.lang3.tuple.ImmutablePair;
|
||||
import org.apache.commons.lang3.tuple.Pair;
|
||||
|
||||
import WayofTime.bloodmagic.BloodMagic;
|
||||
import WayofTime.bloodmagic.client.IVariantProvider;
|
||||
import WayofTime.bloodmagic.tile.TilePhantomBlock;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
|
||||
public class BlockPhantom extends Block implements IVariantProvider
|
||||
{
|
||||
public BlockPhantom()
|
||||
{
|
||||
public class BlockPhantom extends Block implements IVariantProvider {
|
||||
public BlockPhantom() {
|
||||
super(Material.CLOTH);
|
||||
|
||||
setUnlocalizedName(BloodMagic.MODID + ".phantom");
|
||||
|
@ -37,52 +32,44 @@ public class BlockPhantom extends Block implements IVariantProvider
|
|||
}
|
||||
|
||||
@Override
|
||||
public boolean isNormalCube(IBlockState state, IBlockAccess world, BlockPos pos)
|
||||
{
|
||||
public boolean isNormalCube(IBlockState state, IBlockAccess world, BlockPos pos) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isOpaqueCube(IBlockState state)
|
||||
{
|
||||
public boolean isOpaqueCube(IBlockState state) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isFullCube(IBlockState state)
|
||||
{
|
||||
public boolean isFullCube(IBlockState state) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean causesSuffocation(IBlockState state)
|
||||
{
|
||||
public boolean causesSuffocation(IBlockState state) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public EnumBlockRenderType getRenderType(IBlockState state)
|
||||
{
|
||||
public EnumBlockRenderType getRenderType(IBlockState state) {
|
||||
return EnumBlockRenderType.MODEL;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public BlockRenderLayer getBlockLayer()
|
||||
{
|
||||
public BlockRenderLayer getBlockLayer() {
|
||||
return BlockRenderLayer.TRANSLUCENT;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public boolean shouldSideBeRendered(IBlockState state, IBlockAccess world, BlockPos pos, EnumFacing side)
|
||||
{
|
||||
public boolean shouldSideBeRendered(IBlockState state, IBlockAccess world, BlockPos pos, EnumFacing side) {
|
||||
return world.getBlockState(pos.offset(side)) != state || state.getBlock() != this && super.shouldSideBeRendered(state, world, pos, side);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int quantityDropped(Random par1Random)
|
||||
{
|
||||
public int quantityDropped(Random par1Random) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -98,8 +85,7 @@ public class BlockPhantom extends Block implements IVariantProvider
|
|||
}
|
||||
|
||||
@Override
|
||||
public List<Pair<Integer, String>> getVariants()
|
||||
{
|
||||
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;
|
||||
|
|
|
@ -1,10 +1,20 @@
|
|||
package WayofTime.bloodmagic.block;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import WayofTime.bloodmagic.BloodMagic;
|
||||
import WayofTime.bloodmagic.api.BlockStack;
|
||||
import WayofTime.bloodmagic.api.iface.IBindable;
|
||||
import com.google.common.base.Strings;
|
||||
import WayofTime.bloodmagic.api.registry.ImperfectRitualRegistry;
|
||||
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.BlockEnum;
|
||||
import WayofTime.bloodmagic.block.enums.EnumRitualController;
|
||||
import WayofTime.bloodmagic.core.RegistrarBloodMagicItems;
|
||||
import WayofTime.bloodmagic.tile.TileImperfectRitualStone;
|
||||
import WayofTime.bloodmagic.tile.TileMasterRitualStone;
|
||||
import amerifrance.guideapi.api.IGuideLinked;
|
||||
import com.google.common.base.Strings;
|
||||
import net.minecraft.block.SoundType;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
|
@ -19,23 +29,10 @@ import net.minecraft.util.text.TextComponentTranslation;
|
|||
import net.minecraft.world.Explosion;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import WayofTime.bloodmagic.BloodMagic;
|
||||
import WayofTime.bloodmagic.api.BlockStack;
|
||||
import WayofTime.bloodmagic.api.registry.ImperfectRitualRegistry;
|
||||
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.enums.EnumRitualController;
|
||||
import WayofTime.bloodmagic.core.RegistrarBloodMagicItems;
|
||||
import WayofTime.bloodmagic.tile.TileImperfectRitualStone;
|
||||
import WayofTime.bloodmagic.tile.TileMasterRitualStone;
|
||||
import amerifrance.guideapi.api.IGuideLinked;
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
public class BlockRitualController extends BlockEnum<EnumRitualController> implements IGuideLinked
|
||||
{
|
||||
public BlockRitualController()
|
||||
{
|
||||
public class BlockRitualController extends BlockEnum<EnumRitualController> implements IGuideLinked {
|
||||
public BlockRitualController() {
|
||||
super(Material.ROCK, EnumRitualController.class);
|
||||
|
||||
setUnlocalizedName(BloodMagic.MODID + ".stone.ritual.");
|
||||
|
@ -47,15 +44,12 @@ public class BlockRitualController extends BlockEnum<EnumRitualController> imple
|
|||
}
|
||||
|
||||
@Override
|
||||
public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumHand hand, 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);
|
||||
TileEntity tile = world.getTileEntity(pos);
|
||||
|
||||
if (state.getValue(getProperty()) != EnumRitualController.IMPERFECT && tile instanceof TileMasterRitualStone)
|
||||
{
|
||||
if (heldItem.getItem() == RegistrarBloodMagicItems.ACTIVATION_CRYSTAL)
|
||||
{
|
||||
if (state.getValue(getProperty()) != EnumRitualController.IMPERFECT && tile instanceof TileMasterRitualStone) {
|
||||
if (heldItem.getItem() == RegistrarBloodMagicItems.ACTIVATION_CRYSTAL) {
|
||||
IBindable bindable = (IBindable) heldItem.getItem();
|
||||
if (Strings.isNullOrEmpty(bindable.getOwnerName(heldItem)))
|
||||
return false;
|
||||
|
@ -63,21 +57,17 @@ public class BlockRitualController extends BlockEnum<EnumRitualController> imple
|
|||
String key = RitualHelper.getValidRitual(world, pos);
|
||||
EnumFacing direction = RitualHelper.getDirectionOfRitual(world, pos, key);
|
||||
// TODO: Give a message stating that this ritual is not a valid ritual.
|
||||
if (!key.isEmpty() && direction != null && RitualHelper.checkValidRitual(world, pos, key, direction))
|
||||
{
|
||||
if (((TileMasterRitualStone) tile).activateRitual(heldItem, player, RitualRegistry.getRitualForId(key)))
|
||||
{
|
||||
if (!key.isEmpty() && direction != null && RitualHelper.checkValidRitual(world, pos, key, direction)) {
|
||||
if (((TileMasterRitualStone) tile).activateRitual(heldItem, player, RitualRegistry.getRitualForId(key))) {
|
||||
((TileMasterRitualStone) tile).setDirection(direction);
|
||||
if (state.getValue(getProperty()) == EnumRitualController.INVERTED)
|
||||
((TileMasterRitualStone) tile).setInverted(true);
|
||||
}
|
||||
} else
|
||||
{
|
||||
} else {
|
||||
player.sendStatusMessage(new TextComponentTranslation("chat.bloodmagic.ritual.notValid"), true);
|
||||
}
|
||||
}
|
||||
} else if (state.getValue(getProperty()) == EnumRitualController.IMPERFECT && tile instanceof TileImperfectRitualStone)
|
||||
{
|
||||
} else if (state.getValue(getProperty()) == EnumRitualController.IMPERFECT && tile instanceof TileImperfectRitualStone) {
|
||||
|
||||
IBlockState determinerState = world.getBlockState(pos.up());
|
||||
BlockStack determiner = new BlockStack(determinerState.getBlock(), determinerState.getBlock().getMetaFromState(determinerState));
|
||||
|
@ -89,8 +79,7 @@ public class BlockRitualController extends BlockEnum<EnumRitualController> imple
|
|||
}
|
||||
|
||||
@Override
|
||||
public void onBlockHarvested(World world, BlockPos pos, IBlockState state, EntityPlayer player)
|
||||
{
|
||||
public void onBlockHarvested(World world, BlockPos pos, IBlockState state, EntityPlayer player) {
|
||||
TileEntity tile = world.getTileEntity(pos);
|
||||
|
||||
if (getMetaFromState(state) == 0 && tile instanceof TileMasterRitualStone)
|
||||
|
@ -98,8 +87,7 @@ public class BlockRitualController extends BlockEnum<EnumRitualController> imple
|
|||
}
|
||||
|
||||
@Override
|
||||
public void onBlockDestroyedByExplosion(World world, BlockPos pos, Explosion explosion)
|
||||
{
|
||||
public void onBlockDestroyedByExplosion(World world, BlockPos pos, Explosion explosion) {
|
||||
TileEntity tile = world.getTileEntity(pos);
|
||||
|
||||
if (tile instanceof TileMasterRitualStone)
|
||||
|
@ -107,14 +95,12 @@ public class BlockRitualController extends BlockEnum<EnumRitualController> imple
|
|||
}
|
||||
|
||||
@Override
|
||||
public boolean hasTileEntity(IBlockState state)
|
||||
{
|
||||
public boolean hasTileEntity(IBlockState state) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public TileEntity createTileEntity(World world, IBlockState state)
|
||||
{
|
||||
public TileEntity createTileEntity(World world, IBlockState state) {
|
||||
return state.getValue(getProperty()) != EnumRitualController.IMPERFECT ? new TileMasterRitualStone() : new TileImperfectRitualStone();
|
||||
}
|
||||
|
||||
|
@ -122,18 +108,15 @@ public class BlockRitualController extends BlockEnum<EnumRitualController> imple
|
|||
|
||||
@Override
|
||||
@Nullable
|
||||
public ResourceLocation getLinkedEntry(World world, BlockPos pos, EntityPlayer player, ItemStack stack)
|
||||
{
|
||||
public ResourceLocation getLinkedEntry(World world, BlockPos pos, EntityPlayer player, ItemStack stack) {
|
||||
IBlockState state = world.getBlockState(pos);
|
||||
if (state.getValue(getProperty()).equals(EnumRitualController.MASTER))
|
||||
{
|
||||
if (state.getValue(getProperty()).equals(EnumRitualController.MASTER)) {
|
||||
TileMasterRitualStone mrs = (TileMasterRitualStone) world.getTileEntity(pos);
|
||||
if (mrs == null || mrs.getCurrentRitual() == null)
|
||||
return null;
|
||||
else
|
||||
return new ResourceLocation("bloodmagic", "ritual_" + mrs.getCurrentRitual().getName());
|
||||
} else if (state.getValue(getProperty()).equals(EnumRitualController.IMPERFECT))
|
||||
{
|
||||
} else if (state.getValue(getProperty()).equals(EnumRitualController.IMPERFECT)) {
|
||||
ImperfectRitual imperfectRitual = ImperfectRitualRegistry.getRitualForBlock(BlockStack.getStackFromPos(world, pos.up()));
|
||||
if (imperfectRitual != null)
|
||||
return new ResourceLocation("bloodmagic", "ritual_" + imperfectRitual.getName());
|
||||
|
|
|
@ -1,7 +1,11 @@
|
|||
package WayofTime.bloodmagic.block;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import WayofTime.bloodmagic.BloodMagic;
|
||||
import WayofTime.bloodmagic.api.ritual.EnumRuneType;
|
||||
import WayofTime.bloodmagic.api.ritual.IRitualStone;
|
||||
import WayofTime.bloodmagic.block.base.BlockEnum;
|
||||
import WayofTime.bloodmagic.core.RegistrarBloodMagicBlocks;
|
||||
import WayofTime.bloodmagic.util.helper.TextHelper;
|
||||
import net.minecraft.block.SoundType;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
|
@ -10,21 +14,13 @@ import net.minecraft.entity.player.EntityPlayer;
|
|||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
|
||||
import WayofTime.bloodmagic.BloodMagic;
|
||||
import WayofTime.bloodmagic.api.ritual.EnumRuneType;
|
||||
import WayofTime.bloodmagic.api.ritual.IRitualStone;
|
||||
import WayofTime.bloodmagic.block.base.BlockEnum;
|
||||
import WayofTime.bloodmagic.core.RegistrarBloodMagicBlocks;
|
||||
import WayofTime.bloodmagic.util.helper.TextHelper;
|
||||
import java.util.List;
|
||||
|
||||
public class BlockRitualStone extends BlockEnum<EnumRuneType> implements IRitualStone
|
||||
{
|
||||
public BlockRitualStone()
|
||||
{
|
||||
public class BlockRitualStone extends BlockEnum<EnumRuneType> implements IRitualStone {
|
||||
public BlockRitualStone() {
|
||||
super(Material.IRON, EnumRuneType.class);
|
||||
|
||||
setUnlocalizedName(BloodMagic.MODID + ".ritualStone.");
|
||||
|
@ -37,33 +33,28 @@ public class BlockRitualStone extends BlockEnum<EnumRuneType> implements IRitual
|
|||
|
||||
@SideOnly(Side.CLIENT)
|
||||
@Override
|
||||
public void addInformation(ItemStack stack, World world, List<String> tooltip, ITooltipFlag tooltipFlag)
|
||||
{
|
||||
public void addInformation(ItemStack stack, World world, List<String> tooltip, ITooltipFlag tooltipFlag) {
|
||||
tooltip.add(TextHelper.localizeEffect("tooltip.bloodmagic.decoration.safe"));
|
||||
super.addInformation(stack, world, tooltip, tooltipFlag);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int damageDropped(IBlockState state)
|
||||
{
|
||||
public int damageDropped(IBlockState state) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canSilkHarvest(World world, BlockPos pos, IBlockState state, EntityPlayer player)
|
||||
{
|
||||
public boolean canSilkHarvest(World world, BlockPos pos, IBlockState state, EntityPlayer player) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isRuneType(World world, BlockPos pos, EnumRuneType runeType)
|
||||
{
|
||||
public boolean isRuneType(World world, BlockPos pos, EnumRuneType runeType) {
|
||||
return runeType == this.getTypes()[getMetaFromState(world.getBlockState(pos))];
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setRuneType(World world, BlockPos pos, EnumRuneType runeType)
|
||||
{
|
||||
public void setRuneType(World world, BlockPos pos, EnumRuneType runeType) {
|
||||
int meta = runeType.ordinal();
|
||||
IBlockState newState = RegistrarBloodMagicBlocks.RITUAL_STONE.getStateFromMeta(meta);
|
||||
world.setBlockState(pos, newState);
|
||||
|
|
|
@ -1,5 +1,8 @@
|
|||
package WayofTime.bloodmagic.block;
|
||||
|
||||
import WayofTime.bloodmagic.BloodMagic;
|
||||
import WayofTime.bloodmagic.tile.routing.TileMasterRoutingNode;
|
||||
import WayofTime.bloodmagic.tile.routing.TileRoutingNode;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.block.properties.PropertyBool;
|
||||
|
@ -14,23 +17,17 @@ import net.minecraft.util.math.AxisAlignedBB;
|
|||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraft.world.World;
|
||||
import WayofTime.bloodmagic.BloodMagic;
|
||||
import WayofTime.bloodmagic.tile.routing.TileMasterRoutingNode;
|
||||
import WayofTime.bloodmagic.tile.routing.TileRoutingNode;
|
||||
|
||||
public class BlockRoutingNode extends Block implements IBMBlock
|
||||
{
|
||||
protected static final AxisAlignedBB AABB = new AxisAlignedBB(0.378F, 0.378F, 0.378F, 0.625F, 0.625F, 0.625F);
|
||||
|
||||
public class BlockRoutingNode extends Block implements IBMBlock {
|
||||
public static final PropertyBool UP = PropertyBool.create("up");
|
||||
public static final PropertyBool DOWN = PropertyBool.create("down");
|
||||
public static final PropertyBool NORTH = PropertyBool.create("north");
|
||||
public static final PropertyBool EAST = PropertyBool.create("east");
|
||||
public static final PropertyBool SOUTH = PropertyBool.create("south");
|
||||
public static final PropertyBool WEST = PropertyBool.create("west");
|
||||
protected static final AxisAlignedBB AABB = new AxisAlignedBB(0.378F, 0.378F, 0.378F, 0.625F, 0.625F, 0.625F);
|
||||
|
||||
public BlockRoutingNode()
|
||||
{
|
||||
public BlockRoutingNode() {
|
||||
super(Material.ROCK);
|
||||
|
||||
setCreativeTab(BloodMagic.TAB_BM);
|
||||
|
@ -42,56 +39,47 @@ public class BlockRoutingNode extends Block implements IBMBlock
|
|||
}
|
||||
|
||||
@Override
|
||||
public boolean canConnectRedstone(IBlockState state, IBlockAccess world, BlockPos pos, EnumFacing side)
|
||||
{
|
||||
public boolean canConnectRedstone(IBlockState state, IBlockAccess world, BlockPos pos, EnumFacing side) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public AxisAlignedBB getBoundingBox(IBlockState state, IBlockAccess source, BlockPos pos)
|
||||
{
|
||||
public AxisAlignedBB getBoundingBox(IBlockState state, IBlockAccess source, BlockPos pos) {
|
||||
return AABB;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isOpaqueCube(IBlockState state)
|
||||
{
|
||||
public boolean isOpaqueCube(IBlockState state) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isNormalCube(IBlockState state, IBlockAccess world, BlockPos pos)
|
||||
{
|
||||
public boolean isNormalCube(IBlockState state, IBlockAccess world, BlockPos pos) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isFullCube(IBlockState state)
|
||||
{
|
||||
public boolean isFullCube(IBlockState state) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean causesSuffocation(IBlockState state)
|
||||
{
|
||||
public boolean causesSuffocation(IBlockState state) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public EnumBlockRenderType getRenderType(IBlockState state)
|
||||
{
|
||||
public EnumBlockRenderType getRenderType(IBlockState state) {
|
||||
return EnumBlockRenderType.MODEL;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canRenderInLayer(IBlockState state, BlockRenderLayer layer)
|
||||
{
|
||||
public boolean canRenderInLayer(IBlockState state, BlockRenderLayer layer) {
|
||||
return layer == BlockRenderLayer.CUTOUT_MIPPED || layer == BlockRenderLayer.TRANSLUCENT;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IBlockState getStateFromMeta(int meta)
|
||||
{
|
||||
public IBlockState getStateFromMeta(int meta) {
|
||||
return this.getDefaultState();
|
||||
}
|
||||
|
||||
|
@ -99,41 +87,33 @@ public class BlockRoutingNode extends Block implements IBMBlock
|
|||
* Convert the BlockState into the correct metadata value
|
||||
*/
|
||||
@Override
|
||||
public int getMetaFromState(IBlockState state)
|
||||
{
|
||||
public int getMetaFromState(IBlockState state) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IBlockState getActualState(IBlockState state, IBlockAccess worldIn, BlockPos pos)
|
||||
{
|
||||
public IBlockState getActualState(IBlockState state, IBlockAccess worldIn, BlockPos pos) {
|
||||
return state.withProperty(UP, this.shouldConnect(state, worldIn, pos.up(), EnumFacing.DOWN)).withProperty(DOWN, this.shouldConnect(state, worldIn, pos.down(), EnumFacing.UP)).withProperty(NORTH, this.shouldConnect(state, worldIn, pos.north(), EnumFacing.SOUTH)).withProperty(EAST, this.shouldConnect(state, worldIn, pos.east(), EnumFacing.WEST)).withProperty(SOUTH, this.shouldConnect(state, worldIn, pos.south(), EnumFacing.NORTH)).withProperty(WEST, this.shouldConnect(state, worldIn, pos.west(), EnumFacing.EAST));
|
||||
}
|
||||
|
||||
@Override
|
||||
protected BlockStateContainer createBlockState()
|
||||
{
|
||||
protected BlockStateContainer createBlockState() {
|
||||
return new BlockStateContainer(this, UP, DOWN, NORTH, EAST, WEST, SOUTH);
|
||||
}
|
||||
|
||||
public boolean shouldConnect(IBlockState state, IBlockAccess world, BlockPos pos, EnumFacing attachedSide)
|
||||
{
|
||||
public boolean shouldConnect(IBlockState state, IBlockAccess world, BlockPos pos, EnumFacing attachedSide) {
|
||||
IBlockState blockState = world.getBlockState(pos);
|
||||
Block block = blockState.getBlock();
|
||||
return block.getMaterial(blockState).isOpaque() && blockState.isFullCube();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void breakBlock(World world, BlockPos pos, IBlockState blockState)
|
||||
{
|
||||
if (!world.isRemote)
|
||||
{
|
||||
public void breakBlock(World world, BlockPos pos, IBlockState blockState) {
|
||||
if (!world.isRemote) {
|
||||
TileEntity tile = world.getTileEntity(pos);
|
||||
if (tile instanceof TileRoutingNode)
|
||||
{
|
||||
if (tile instanceof TileRoutingNode) {
|
||||
((TileRoutingNode) tile).removeAllConnections();
|
||||
} else if (tile instanceof TileMasterRoutingNode)
|
||||
{
|
||||
} else if (tile instanceof TileMasterRoutingNode) {
|
||||
((TileMasterRoutingNode) tile).removeAllConnections();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,8 +1,9 @@
|
|||
package WayofTime.bloodmagic.block;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import WayofTime.bloodmagic.BloodMagic;
|
||||
import WayofTime.bloodmagic.api.Constants;
|
||||
import WayofTime.bloodmagic.client.IVariantProvider;
|
||||
import WayofTime.bloodmagic.tile.TileSoulForge;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.SoundType;
|
||||
import net.minecraft.block.material.Material;
|
||||
|
@ -17,23 +18,17 @@ import net.minecraft.util.math.AxisAlignedBB;
|
|||
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.TileSoulForge;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class BlockSoulForge extends Block implements IVariantProvider, IBMBlock
|
||||
{
|
||||
public class BlockSoulForge extends Block implements IVariantProvider, IBMBlock {
|
||||
protected static final AxisAlignedBB AABB = new AxisAlignedBB(0.06F, 0.0F, 0.06F, 0.94F, 0.75F, 0.94F);
|
||||
|
||||
public BlockSoulForge()
|
||||
{
|
||||
public BlockSoulForge() {
|
||||
super(Material.IRON);
|
||||
|
||||
setUnlocalizedName(BloodMagic.MODID + ".soulForge");
|
||||
|
@ -45,44 +40,37 @@ public class BlockSoulForge extends Block implements IVariantProvider, IBMBlock
|
|||
}
|
||||
|
||||
@Override
|
||||
public boolean isOpaqueCube(IBlockState state)
|
||||
{
|
||||
public boolean isOpaqueCube(IBlockState state) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public AxisAlignedBB getBoundingBox(IBlockState state, IBlockAccess source, BlockPos pos)
|
||||
{
|
||||
public AxisAlignedBB getBoundingBox(IBlockState state, IBlockAccess source, BlockPos pos) {
|
||||
return AABB;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isNormalCube(IBlockState state, IBlockAccess world, BlockPos pos)
|
||||
{
|
||||
public boolean isNormalCube(IBlockState state, IBlockAccess world, BlockPos pos) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isFullCube(IBlockState state)
|
||||
{
|
||||
public boolean isFullCube(IBlockState state) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean causesSuffocation(IBlockState state)
|
||||
{
|
||||
public boolean causesSuffocation(IBlockState state) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public EnumBlockRenderType getRenderType(IBlockState state)
|
||||
{
|
||||
public EnumBlockRenderType getRenderType(IBlockState state) {
|
||||
return EnumBlockRenderType.MODEL;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumHand hand, 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());
|
||||
|
||||
|
@ -90,8 +78,7 @@ public class BlockSoulForge extends Block implements IVariantProvider, IBMBlock
|
|||
}
|
||||
|
||||
@Override
|
||||
public void breakBlock(World world, BlockPos blockPos, IBlockState blockState)
|
||||
{
|
||||
public void breakBlock(World world, BlockPos blockPos, IBlockState blockState) {
|
||||
TileSoulForge tileSoulForge = (TileSoulForge) world.getTileEntity(blockPos);
|
||||
if (tileSoulForge != null)
|
||||
tileSoulForge.dropItems();
|
||||
|
@ -111,8 +98,7 @@ public class BlockSoulForge extends Block implements IVariantProvider, IBMBlock
|
|||
}
|
||||
|
||||
@Override
|
||||
public List<Pair<Integer, String>> getVariants()
|
||||
{
|
||||
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;
|
||||
|
|
|
@ -1,11 +1,9 @@
|
|||
package WayofTime.bloodmagic.block;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
|
||||
import WayofTime.bloodmagic.BloodMagic;
|
||||
import WayofTime.bloodmagic.ConfigHandler;
|
||||
import WayofTime.bloodmagic.client.IVariantProvider;
|
||||
import WayofTime.bloodmagic.tile.TileSpectralBlock;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
|
@ -18,98 +16,83 @@ 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;
|
||||
import org.apache.commons.lang3.tuple.ImmutablePair;
|
||||
import org.apache.commons.lang3.tuple.Pair;
|
||||
|
||||
import WayofTime.bloodmagic.client.IVariantProvider;
|
||||
import WayofTime.bloodmagic.tile.TileSpectralBlock;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
|
||||
public class BlockSpectral extends Block implements IVariantProvider
|
||||
{
|
||||
public class BlockSpectral extends Block implements IVariantProvider {
|
||||
protected static final AxisAlignedBB AABB = new AxisAlignedBB(0, 0, 0, 0, 0, 0);
|
||||
|
||||
public BlockSpectral()
|
||||
{
|
||||
public BlockSpectral() {
|
||||
super(Material.CLOTH);
|
||||
|
||||
setUnlocalizedName(BloodMagic.MODID + ".spectral");
|
||||
}
|
||||
|
||||
@Override
|
||||
public AxisAlignedBB getBoundingBox(IBlockState state, IBlockAccess source, BlockPos pos)
|
||||
{
|
||||
public AxisAlignedBB getBoundingBox(IBlockState state, IBlockAccess source, BlockPos pos) {
|
||||
return AABB;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isNormalCube(IBlockState state, IBlockAccess world, BlockPos pos)
|
||||
{
|
||||
public boolean isNormalCube(IBlockState state, IBlockAccess world, BlockPos pos) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isOpaqueCube(IBlockState state)
|
||||
{
|
||||
public boolean isOpaqueCube(IBlockState state) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isFullCube(IBlockState state)
|
||||
{
|
||||
public boolean isFullCube(IBlockState state) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean causesSuffocation(IBlockState state)
|
||||
{
|
||||
public boolean causesSuffocation(IBlockState state) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
@Override
|
||||
public BlockRenderLayer getBlockLayer()
|
||||
{
|
||||
public BlockRenderLayer getBlockLayer() {
|
||||
return BlockRenderLayer.TRANSLUCENT;
|
||||
}
|
||||
|
||||
@Override
|
||||
public EnumBlockRenderType getRenderType(IBlockState state)
|
||||
{
|
||||
public EnumBlockRenderType getRenderType(IBlockState state) {
|
||||
return ConfigHandler.invisibleSpectralBlocks ? EnumBlockRenderType.INVISIBLE : EnumBlockRenderType.MODEL;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public boolean shouldSideBeRendered(IBlockState state, IBlockAccess world, BlockPos pos, EnumFacing side)
|
||||
{
|
||||
public boolean shouldSideBeRendered(IBlockState state, IBlockAccess world, BlockPos pos, EnumFacing side) {
|
||||
return world.getBlockState(pos.offset(side)) != state || state.getBlock() != this && super.shouldSideBeRendered(state, world, pos, side);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addCollisionBoxToList(IBlockState state, World worldIn, BlockPos pos, AxisAlignedBB mask, List<AxisAlignedBB> list, Entity collidingEntity, boolean bool)
|
||||
{
|
||||
public void addCollisionBoxToList(IBlockState state, World worldIn, BlockPos pos, AxisAlignedBB mask, List<AxisAlignedBB> list, Entity collidingEntity, boolean bool) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public int quantityDropped(Random par1Random)
|
||||
{
|
||||
public int quantityDropped(Random par1Random) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isReplaceable(IBlockAccess worldIn, BlockPos pos)
|
||||
{
|
||||
public boolean isReplaceable(IBlockAccess worldIn, BlockPos pos) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isAir(IBlockState state, IBlockAccess world, BlockPos blockPos)
|
||||
{
|
||||
public boolean isAir(IBlockState state, IBlockAccess world, BlockPos blockPos) {
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -125,8 +108,7 @@ public class BlockSpectral extends Block implements IVariantProvider
|
|||
}
|
||||
|
||||
@Override
|
||||
public List<Pair<Integer, String>> getVariants()
|
||||
{
|
||||
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;
|
||||
|
|
|
@ -1,8 +1,10 @@
|
|||
package WayofTime.bloodmagic.block;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import WayofTime.bloodmagic.BloodMagic;
|
||||
import WayofTime.bloodmagic.api.Constants;
|
||||
import WayofTime.bloodmagic.client.IVariantProvider;
|
||||
import WayofTime.bloodmagic.item.ItemTelepositionFocus;
|
||||
import WayofTime.bloodmagic.tile.TileTeleposer;
|
||||
import net.minecraft.block.BlockContainer;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
|
@ -15,20 +17,14 @@ import net.minecraft.util.EnumFacing;
|
|||
import net.minecraft.util.EnumHand;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
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.item.ItemTelepositionFocus;
|
||||
import WayofTime.bloodmagic.tile.TileTeleposer;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class BlockTeleposer extends BlockContainer implements IVariantProvider, IBMBlock
|
||||
{
|
||||
public BlockTeleposer()
|
||||
{
|
||||
public class BlockTeleposer extends BlockContainer implements IVariantProvider, IBMBlock {
|
||||
public BlockTeleposer() {
|
||||
super(Material.ROCK);
|
||||
|
||||
setCreativeTab(BloodMagic.TAB_BM);
|
||||
|
@ -38,14 +34,12 @@ public class BlockTeleposer extends BlockContainer implements IVariantProvider,
|
|||
}
|
||||
|
||||
@Override
|
||||
public EnumBlockRenderType getRenderType(IBlockState state)
|
||||
{
|
||||
public EnumBlockRenderType getRenderType(IBlockState state) {
|
||||
return EnumBlockRenderType.MODEL;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumHand hand, 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 = player.getHeldItem(hand);
|
||||
|
||||
if (playerItem.getItem() instanceof ItemTelepositionFocus)
|
||||
|
@ -57,8 +51,7 @@ public class BlockTeleposer extends BlockContainer implements IVariantProvider,
|
|||
}
|
||||
|
||||
@Override
|
||||
public void breakBlock(World world, BlockPos blockPos, IBlockState blockState)
|
||||
{
|
||||
public void breakBlock(World world, BlockPos blockPos, IBlockState blockState) {
|
||||
TileTeleposer tileTeleposer = (TileTeleposer) world.getTileEntity(blockPos);
|
||||
if (tileTeleposer != null)
|
||||
tileTeleposer.dropItems();
|
||||
|
@ -67,14 +60,12 @@ public class BlockTeleposer extends BlockContainer implements IVariantProvider,
|
|||
}
|
||||
|
||||
@Override
|
||||
public TileEntity createNewTileEntity(World worldIn, int meta)
|
||||
{
|
||||
public TileEntity createNewTileEntity(World worldIn, int meta) {
|
||||
return new TileTeleposer();
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Pair<Integer, String>> getVariants()
|
||||
{
|
||||
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;
|
||||
|
|
|
@ -18,14 +18,12 @@ import org.apache.commons.lang3.tuple.Pair;
|
|||
|
||||
import java.util.List;
|
||||
|
||||
public class BlockEnum<E extends Enum<E> & IStringSerializable> extends Block implements IBMBlock, IVariantProvider
|
||||
{
|
||||
public class BlockEnum<E extends Enum<E> & IStringSerializable> extends Block implements IBMBlock, IVariantProvider {
|
||||
private final E[] types;
|
||||
private final PropertyEnum<E> property;
|
||||
private final BlockStateContainer realStateContainer;
|
||||
|
||||
public BlockEnum(Material material, Class<E> enumClass, String propName)
|
||||
{
|
||||
public BlockEnum(Material material, Class<E> enumClass, String propName) {
|
||||
super(material);
|
||||
|
||||
this.types = enumClass.getEnumConstants();
|
||||
|
@ -34,50 +32,42 @@ public class BlockEnum<E extends Enum<E> & IStringSerializable> extends Block im
|
|||
setDefaultState(getBlockState().getBaseState());
|
||||
}
|
||||
|
||||
public BlockEnum(Material material, Class<E> enumClass)
|
||||
{
|
||||
public BlockEnum(Material material, Class<E> enumClass) {
|
||||
this(material, enumClass, "type");
|
||||
}
|
||||
|
||||
@Override
|
||||
protected final BlockStateContainer createBlockState()
|
||||
{
|
||||
protected final BlockStateContainer createBlockState() {
|
||||
return new BlockStateContainer.Builder(this).build(); // Blank to avoid crashes
|
||||
}
|
||||
|
||||
@Override
|
||||
public final BlockStateContainer getBlockState()
|
||||
{
|
||||
public final BlockStateContainer getBlockState() {
|
||||
return realStateContainer;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IBlockState getStateFromMeta(int meta)
|
||||
{
|
||||
public IBlockState getStateFromMeta(int meta) {
|
||||
return getDefaultState().withProperty(property, types[meta]);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMetaFromState(IBlockState state)
|
||||
{
|
||||
public int getMetaFromState(IBlockState state) {
|
||||
return state.getValue(property).ordinal();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int damageDropped(IBlockState state)
|
||||
{
|
||||
public int damageDropped(IBlockState state) {
|
||||
return getMetaFromState(state);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void getSubBlocks(CreativeTabs tab, NonNullList<ItemStack> subBlocks)
|
||||
{
|
||||
public void getSubBlocks(CreativeTabs tab, NonNullList<ItemStack> subBlocks) {
|
||||
for (E type : types)
|
||||
subBlocks.add(new ItemStack(this, 1, type.ordinal()));
|
||||
}
|
||||
|
||||
protected BlockStateContainer createStateContainer()
|
||||
{
|
||||
protected BlockStateContainer createStateContainer() {
|
||||
return new BlockStateContainer.Builder(this).add(property).build();
|
||||
}
|
||||
|
||||
|
|
|
@ -15,84 +15,71 @@ import net.minecraft.util.Rotation;
|
|||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.math.RayTraceResult;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import org.apache.commons.lang3.ArrayUtils;
|
||||
|
||||
public class BlockEnumPillar<E extends Enum<E> & IStringSerializable> extends BlockEnum<E>
|
||||
{
|
||||
public BlockEnumPillar(Material material, Class<E> enumClass, String propName)
|
||||
{
|
||||
public class BlockEnumPillar<E extends Enum<E> & IStringSerializable> extends BlockEnum<E> {
|
||||
public BlockEnumPillar(Material material, Class<E> enumClass, String propName) {
|
||||
super(material, enumClass, propName);
|
||||
}
|
||||
|
||||
public BlockEnumPillar(Material material, Class<E> enumClass)
|
||||
{
|
||||
public BlockEnumPillar(Material material, Class<E> enumClass) {
|
||||
this(material, enumClass, "type");
|
||||
}
|
||||
|
||||
@Override
|
||||
protected BlockStateContainer createStateContainer()
|
||||
{
|
||||
protected BlockStateContainer createStateContainer() {
|
||||
return new BlockStateContainer.Builder(this).add(getProperty(), BlockRotatedPillar.AXIS).build();
|
||||
}
|
||||
|
||||
@Override
|
||||
public IBlockState getStateFromMeta(int meta)
|
||||
{
|
||||
public IBlockState getStateFromMeta(int meta) {
|
||||
IBlockState state = getBlockState().getBaseState().withProperty(this.getProperty(), getTypes()[meta % 5]);
|
||||
|
||||
switch (meta / 5)
|
||||
{
|
||||
case 0:
|
||||
state = state.withProperty(BlockRotatedPillar.AXIS, EnumFacing.Axis.Y);
|
||||
break;
|
||||
case 1:
|
||||
state = state.withProperty(BlockRotatedPillar.AXIS, EnumFacing.Axis.X);
|
||||
break;
|
||||
case 2:
|
||||
state = state.withProperty(BlockRotatedPillar.AXIS, EnumFacing.Axis.Z);
|
||||
break;
|
||||
default:
|
||||
state.withProperty(BlockRotatedPillar.AXIS, EnumFacing.Axis.Y);
|
||||
break;
|
||||
switch (meta / 5) {
|
||||
case 0:
|
||||
state = state.withProperty(BlockRotatedPillar.AXIS, EnumFacing.Axis.Y);
|
||||
break;
|
||||
case 1:
|
||||
state = state.withProperty(BlockRotatedPillar.AXIS, EnumFacing.Axis.X);
|
||||
break;
|
||||
case 2:
|
||||
state = state.withProperty(BlockRotatedPillar.AXIS, EnumFacing.Axis.Z);
|
||||
break;
|
||||
default:
|
||||
state.withProperty(BlockRotatedPillar.AXIS, EnumFacing.Axis.Y);
|
||||
break;
|
||||
}
|
||||
|
||||
return state;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack getPickBlock(IBlockState state, RayTraceResult target, World world, BlockPos pos, EntityPlayer player)
|
||||
{
|
||||
public ItemStack getPickBlock(IBlockState state, RayTraceResult target, World world, BlockPos pos, EntityPlayer player) {
|
||||
return new ItemStack(this, 1, damageDropped(state));
|
||||
}
|
||||
|
||||
@SuppressWarnings("incomplete-switch")
|
||||
@Override
|
||||
public int getMetaFromState(IBlockState state)
|
||||
{
|
||||
public int getMetaFromState(IBlockState state) {
|
||||
int i = ArrayUtils.indexOf(getTypes(), state.getValue(getProperty()));
|
||||
|
||||
switch (state.getValue(BlockRotatedPillar.AXIS))
|
||||
{
|
||||
case X:
|
||||
i = i + 5;
|
||||
break;
|
||||
case Z:
|
||||
i = i + 10;
|
||||
break;
|
||||
switch (state.getValue(BlockRotatedPillar.AXIS)) {
|
||||
case X:
|
||||
i = i + 5;
|
||||
break;
|
||||
case Z:
|
||||
i = i + 10;
|
||||
break;
|
||||
}
|
||||
|
||||
return i;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean rotateBlock(World world, BlockPos pos, EnumFacing axis)
|
||||
{
|
||||
public boolean rotateBlock(World world, BlockPos pos, EnumFacing axis) {
|
||||
IBlockState state = world.getBlockState(pos);
|
||||
for (IProperty<?> prop : state.getProperties().keySet())
|
||||
{
|
||||
if (prop == BlockRotatedPillar.AXIS)
|
||||
{
|
||||
for (IProperty<?> prop : state.getProperties().keySet()) {
|
||||
if (prop == BlockRotatedPillar.AXIS) {
|
||||
world.setBlockState(pos, state.cycleProperty(prop));
|
||||
return true;
|
||||
}
|
||||
|
@ -101,44 +88,37 @@ public class BlockEnumPillar<E extends Enum<E> & IStringSerializable> extends Bl
|
|||
}
|
||||
|
||||
@Override
|
||||
public IBlockState withRotation(IBlockState state, Rotation rot)
|
||||
{
|
||||
switch (rot)
|
||||
{
|
||||
case COUNTERCLOCKWISE_90:
|
||||
case CLOCKWISE_90:
|
||||
switch (state.getValue(BlockRotatedPillar.AXIS))
|
||||
{
|
||||
case X:
|
||||
return state.withProperty(BlockRotatedPillar.AXIS, EnumFacing.Axis.Z);
|
||||
case Z:
|
||||
return state.withProperty(BlockRotatedPillar.AXIS, EnumFacing.Axis.X);
|
||||
public IBlockState withRotation(IBlockState state, Rotation rot) {
|
||||
switch (rot) {
|
||||
case COUNTERCLOCKWISE_90:
|
||||
case CLOCKWISE_90:
|
||||
switch (state.getValue(BlockRotatedPillar.AXIS)) {
|
||||
case X:
|
||||
return state.withProperty(BlockRotatedPillar.AXIS, EnumFacing.Axis.Z);
|
||||
case Z:
|
||||
return state.withProperty(BlockRotatedPillar.AXIS, EnumFacing.Axis.X);
|
||||
default:
|
||||
return state;
|
||||
}
|
||||
|
||||
default:
|
||||
return state;
|
||||
}
|
||||
|
||||
default:
|
||||
return state;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected ItemStack getSilkTouchDrop(IBlockState state)
|
||||
{
|
||||
protected ItemStack getSilkTouchDrop(IBlockState state) {
|
||||
return new ItemStack(this, 1, damageDropped(state));
|
||||
}
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public IBlockState getStateForPlacement(World world, BlockPos pos, EnumFacing facing, float hitX, float hitY, float hitZ, int meta, EntityLivingBase placer, EnumHand hand)
|
||||
{
|
||||
public IBlockState getStateForPlacement(World world, BlockPos pos, EnumFacing facing, float hitX, float hitY, float hitZ, int meta, EntityLivingBase placer, EnumHand hand) {
|
||||
return super.getStateForPlacement(world, pos, facing, hitX, hitY, hitZ, meta, placer, hand).withProperty(BlockRotatedPillar.AXIS, facing.getAxis());
|
||||
}
|
||||
|
||||
@Override
|
||||
public int damageDropped(IBlockState state)
|
||||
{
|
||||
public int damageDropped(IBlockState state) {
|
||||
return super.getMetaFromState(state);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -11,76 +11,63 @@ import net.minecraft.util.*;
|
|||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.math.RayTraceResult;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import org.apache.commons.lang3.ArrayUtils;
|
||||
|
||||
public class BlockEnumPillarCap<E extends Enum<E> & IStringSerializable> extends BlockEnum<E>
|
||||
{
|
||||
public class BlockEnumPillarCap<E extends Enum<E> & IStringSerializable> extends BlockEnum<E> {
|
||||
public static final PropertyDirection FACING = PropertyDirection.create("facing");
|
||||
|
||||
public BlockEnumPillarCap(Material material, Class<E> enumClass, String propName)
|
||||
{
|
||||
public BlockEnumPillarCap(Material material, Class<E> enumClass, String propName) {
|
||||
super(material, enumClass, propName);
|
||||
}
|
||||
|
||||
public BlockEnumPillarCap(Material material, Class<E> enumClass)
|
||||
{
|
||||
public BlockEnumPillarCap(Material material, Class<E> enumClass) {
|
||||
this(material, enumClass, "type");
|
||||
}
|
||||
|
||||
@Override
|
||||
protected BlockStateContainer createStateContainer()
|
||||
{
|
||||
protected BlockStateContainer createStateContainer() {
|
||||
return new BlockStateContainer.Builder(this).add(getProperty(), FACING).build();
|
||||
}
|
||||
|
||||
@Override
|
||||
public IBlockState getStateFromMeta(int meta)
|
||||
{
|
||||
public IBlockState getStateFromMeta(int meta) {
|
||||
IBlockState state = getBlockState().getBaseState().withProperty(this.getProperty(), getTypes()[meta % 2]);
|
||||
return state.withProperty(FACING, EnumFacing.getFront(meta / 2));
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMetaFromState(IBlockState state)
|
||||
{
|
||||
public int getMetaFromState(IBlockState state) {
|
||||
int i = ArrayUtils.indexOf(getTypes(), state.getValue(getProperty()));
|
||||
return i + 2 * state.getValue(FACING).getIndex();
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack getPickBlock(IBlockState state, RayTraceResult target, World world, BlockPos pos, EntityPlayer player)
|
||||
{
|
||||
public ItemStack getPickBlock(IBlockState state, RayTraceResult target, World world, BlockPos pos, EntityPlayer player) {
|
||||
return new ItemStack(this, 1, damageDropped(state));
|
||||
}
|
||||
|
||||
@Override
|
||||
public IBlockState withRotation(IBlockState state, Rotation rot)
|
||||
{
|
||||
public IBlockState withRotation(IBlockState state, Rotation rot) {
|
||||
return state.withProperty(FACING, rot.rotate(state.getValue(FACING)));
|
||||
}
|
||||
|
||||
@Override
|
||||
public IBlockState withMirror(IBlockState state, Mirror mirrorIn)
|
||||
{
|
||||
public IBlockState withMirror(IBlockState state, Mirror mirrorIn) {
|
||||
return state.withRotation(mirrorIn.toRotation(state.getValue(FACING)));
|
||||
}
|
||||
|
||||
@Override
|
||||
protected ItemStack getSilkTouchDrop(IBlockState state)
|
||||
{
|
||||
protected ItemStack getSilkTouchDrop(IBlockState state) {
|
||||
return new ItemStack(this, 1, damageDropped(state));
|
||||
}
|
||||
|
||||
@Override
|
||||
public IBlockState getStateForPlacement(World world, BlockPos pos, EnumFacing facing, float hitX, float hitY, float hitZ, int meta, EntityLivingBase placer, EnumHand hand)
|
||||
{
|
||||
public IBlockState getStateForPlacement(World world, BlockPos pos, EnumFacing facing, float hitX, float hitY, float hitZ, int meta, EntityLivingBase placer, EnumHand hand) {
|
||||
return super.getStateForPlacement(world, pos, facing, hitX, hitY, hitZ, meta, placer, hand).withProperty(FACING, facing);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int damageDropped(IBlockState state)
|
||||
{
|
||||
public int damageDropped(IBlockState state) {
|
||||
return super.getMetaFromState(state);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,9 +1,6 @@
|
|||
package WayofTime.bloodmagic.block.base;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import com.google.common.collect.Lists;
|
||||
import net.minecraft.block.BlockHorizontal;
|
||||
import net.minecraft.block.BlockStairs;
|
||||
import net.minecraft.block.BlockStairs.EnumHalf;
|
||||
|
@ -23,16 +20,13 @@ import net.minecraft.util.math.RayTraceResult;
|
|||
import net.minecraft.util.math.Vec3d;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import net.minecraftforge.common.ForgeModContainer;
|
||||
import org.apache.commons.lang3.ArrayUtils;
|
||||
|
||||
import WayofTime.bloodmagic.BloodMagic;
|
||||
import javax.annotation.Nullable;
|
||||
import java.util.List;
|
||||
|
||||
import com.google.common.collect.Lists;
|
||||
|
||||
public class BlockEnumStairs<E extends Enum<E> & IStringSerializable> extends BlockEnum<E>
|
||||
{
|
||||
public class BlockEnumStairs<E extends Enum<E> & IStringSerializable> extends BlockEnum<E> {
|
||||
public static final PropertyDirection FACING = BlockHorizontal.FACING;
|
||||
|
||||
protected static final AxisAlignedBB AABB_SLAB_TOP = new AxisAlignedBB(0.0D, 0.5D, 0.0D, 1.0D, 1.0D, 1.0D);
|
||||
|
@ -54,149 +48,61 @@ public class BlockEnumStairs<E extends Enum<E> & IStringSerializable> extends Bl
|
|||
protected static final AxisAlignedBB AABB_OCT_BOT_SW = new AxisAlignedBB(0.0D, 0.0D, 0.5D, 0.5D, 0.5D, 1.0D);
|
||||
protected static final AxisAlignedBB AABB_OCT_BOT_SE = new AxisAlignedBB(0.5D, 0.0D, 0.5D, 1.0D, 0.5D, 1.0D);
|
||||
|
||||
public BlockEnumStairs(Material material, Class<E> enumClass, String propName)
|
||||
{
|
||||
public BlockEnumStairs(Material material, Class<E> enumClass, String propName) {
|
||||
super(material, enumClass, propName);
|
||||
}
|
||||
|
||||
public BlockEnumStairs(Material material, Class<E> enumClass)
|
||||
{
|
||||
public BlockEnumStairs(Material material, Class<E> enumClass) {
|
||||
this(material, enumClass, "type");
|
||||
}
|
||||
|
||||
@Override
|
||||
protected BlockStateContainer createStateContainer()
|
||||
{
|
||||
protected BlockStateContainer createStateContainer() {
|
||||
return new BlockStateContainer.Builder(this).add(getProperty(), FACING, BlockStairs.HALF, BlockStairs.SHAPE).build();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addCollisionBoxToList(IBlockState state, World worldIn, BlockPos pos, AxisAlignedBB entityBox, List<AxisAlignedBB> collidingBoxes, @Nullable Entity entityIn, boolean bool)
|
||||
{
|
||||
public void addCollisionBoxToList(IBlockState state, World worldIn, BlockPos pos, AxisAlignedBB entityBox, List<AxisAlignedBB> collidingBoxes, @Nullable Entity entityIn, boolean bool) {
|
||||
state = this.getActualState(state, worldIn, pos);
|
||||
|
||||
for (AxisAlignedBB axisalignedbb : getCollisionBoxList(state))
|
||||
{
|
||||
for (AxisAlignedBB axisalignedbb : getCollisionBoxList(state)) {
|
||||
addCollisionBoxToList(pos, entityBox, collidingBoxes, axisalignedbb);
|
||||
}
|
||||
}
|
||||
|
||||
private static List<AxisAlignedBB> getCollisionBoxList(IBlockState state)
|
||||
{
|
||||
List<AxisAlignedBB> list = Lists.newArrayList();
|
||||
boolean flag = state.getValue(BlockStairs.HALF) == BlockStairs.EnumHalf.TOP;
|
||||
list.add(flag ? AABB_SLAB_TOP : AABB_SLAB_BOTTOM);
|
||||
BlockStairs.EnumShape stairShape = state.getValue(BlockStairs.SHAPE);
|
||||
|
||||
if (stairShape == BlockStairs.EnumShape.STRAIGHT || stairShape == BlockStairs.EnumShape.INNER_LEFT || stairShape == BlockStairs.EnumShape.INNER_RIGHT)
|
||||
{
|
||||
list.add(getCollQuarterBlock(state));
|
||||
}
|
||||
|
||||
if (stairShape != BlockStairs.EnumShape.STRAIGHT)
|
||||
{
|
||||
list.add(getCollEighthBlock(state));
|
||||
}
|
||||
|
||||
return list;
|
||||
}
|
||||
|
||||
private static AxisAlignedBB getCollQuarterBlock(IBlockState state)
|
||||
{
|
||||
boolean flag = state.getValue(BlockStairs.HALF) == BlockStairs.EnumHalf.TOP;
|
||||
|
||||
switch (state.getValue(FACING))
|
||||
{
|
||||
case NORTH:
|
||||
default:
|
||||
return flag ? AABB_QTR_BOT_NORTH : AABB_QTR_TOP_NORTH;
|
||||
case SOUTH:
|
||||
return flag ? AABB_QTR_BOT_SOUTH : AABB_QTR_TOP_SOUTH;
|
||||
case WEST:
|
||||
return flag ? AABB_QTR_BOT_WEST : AABB_QTR_TOP_WEST;
|
||||
case EAST:
|
||||
return flag ? AABB_QTR_BOT_EAST : AABB_QTR_TOP_EAST;
|
||||
}
|
||||
}
|
||||
|
||||
private static AxisAlignedBB getCollEighthBlock(IBlockState state)
|
||||
{
|
||||
EnumFacing facing = state.getValue(FACING);
|
||||
EnumFacing newFacing;
|
||||
|
||||
switch (state.getValue(BlockStairs.SHAPE))
|
||||
{
|
||||
case OUTER_LEFT:
|
||||
default:
|
||||
newFacing = facing;
|
||||
break;
|
||||
case OUTER_RIGHT:
|
||||
newFacing = facing.rotateY();
|
||||
break;
|
||||
case INNER_RIGHT:
|
||||
newFacing = facing.getOpposite();
|
||||
break;
|
||||
case INNER_LEFT:
|
||||
newFacing = facing.rotateYCCW();
|
||||
}
|
||||
|
||||
boolean isTop = state.getValue(BlockStairs.HALF) == BlockStairs.EnumHalf.TOP;
|
||||
|
||||
switch (newFacing)
|
||||
{
|
||||
case NORTH:
|
||||
default:
|
||||
return isTop ? AABB_OCT_BOT_NW : AABB_OCT_TOP_NW;
|
||||
case SOUTH:
|
||||
return isTop ? AABB_OCT_BOT_SE : AABB_OCT_TOP_SE;
|
||||
case WEST:
|
||||
return isTop ? AABB_OCT_BOT_SW : AABB_OCT_TOP_SW;
|
||||
case EAST:
|
||||
return isTop ? AABB_OCT_BOT_NE : AABB_OCT_TOP_NE;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isOpaqueCube(IBlockState state)
|
||||
{
|
||||
public boolean isOpaqueCube(IBlockState state) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isFullCube(IBlockState state)
|
||||
{
|
||||
public boolean isFullCube(IBlockState state) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IBlockState getStateForPlacement(World world, BlockPos pos, EnumFacing facing, float hitX, float hitY, float hitZ, int meta, EntityLivingBase placer, EnumHand hand)
|
||||
{
|
||||
public IBlockState getStateForPlacement(World world, BlockPos pos, EnumFacing facing, float hitX, float hitY, float hitZ, int meta, EntityLivingBase placer, EnumHand hand) {
|
||||
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);
|
||||
}
|
||||
|
||||
@Override
|
||||
public RayTraceResult collisionRayTrace(IBlockState blockState, World worldIn, BlockPos pos, Vec3d start, Vec3d end)
|
||||
{
|
||||
public RayTraceResult collisionRayTrace(IBlockState blockState, World worldIn, BlockPos pos, Vec3d start, Vec3d end) {
|
||||
List<RayTraceResult> list = Lists.newArrayList();
|
||||
|
||||
for (AxisAlignedBB axisalignedbb : getCollisionBoxList(this.getActualState(blockState, worldIn, pos)))
|
||||
{
|
||||
for (AxisAlignedBB axisalignedbb : getCollisionBoxList(this.getActualState(blockState, worldIn, pos))) {
|
||||
list.add(this.rayTrace(pos, start, end, axisalignedbb));
|
||||
}
|
||||
|
||||
RayTraceResult rayTrace = null;
|
||||
double d1 = 0.0D;
|
||||
|
||||
for (RayTraceResult raytraceresult : list)
|
||||
{
|
||||
if (raytraceresult != null)
|
||||
{
|
||||
for (RayTraceResult raytraceresult : list) {
|
||||
if (raytraceresult != null) {
|
||||
double d0 = raytraceresult.hitVec.squareDistanceTo(end);
|
||||
|
||||
if (d0 > d1)
|
||||
{
|
||||
if (d0 > d1) {
|
||||
rayTrace = raytraceresult;
|
||||
d1 = d0;
|
||||
}
|
||||
|
@ -208,8 +114,7 @@ public class BlockEnumStairs<E extends Enum<E> & IStringSerializable> extends Bl
|
|||
|
||||
// Meta looks like: {1|11|1} = {HALF|FACING|TYPE}
|
||||
@Override
|
||||
public IBlockState getStateFromMeta(int meta)
|
||||
{
|
||||
public IBlockState getStateFromMeta(int meta) {
|
||||
IBlockState state = getBlockState().getBaseState().withProperty(BlockStairs.HALF, (meta & 8) > 0 ? BlockStairs.EnumHalf.TOP : BlockStairs.EnumHalf.BOTTOM);
|
||||
state = state.withProperty(FACING, EnumFacing.getFront(5 - (meta & 6) / 2)).withProperty(this.getProperty(), getTypes()[meta % 2]);
|
||||
return state;
|
||||
|
@ -217,12 +122,10 @@ public class BlockEnumStairs<E extends Enum<E> & IStringSerializable> extends Bl
|
|||
|
||||
// Meta looks like: {1|11|1} = {HALF|FACING|TYPE}
|
||||
@Override
|
||||
public int getMetaFromState(IBlockState state)
|
||||
{
|
||||
public int getMetaFromState(IBlockState state) {
|
||||
int i = 0;
|
||||
|
||||
if (state.getValue(BlockStairs.HALF) == BlockStairs.EnumHalf.TOP)
|
||||
{
|
||||
if (state.getValue(BlockStairs.HALF) == BlockStairs.EnumHalf.TOP) {
|
||||
i |= 4;
|
||||
}
|
||||
|
||||
|
@ -231,141 +134,78 @@ public class BlockEnumStairs<E extends Enum<E> & IStringSerializable> extends Bl
|
|||
}
|
||||
|
||||
@Override
|
||||
public IBlockState getActualState(IBlockState state, IBlockAccess worldIn, BlockPos pos)
|
||||
{
|
||||
public IBlockState getActualState(IBlockState state, IBlockAccess worldIn, BlockPos pos) {
|
||||
return state.withProperty(BlockStairs.SHAPE, getStairsShape(state, worldIn, pos));
|
||||
}
|
||||
|
||||
private static BlockStairs.EnumShape getStairsShape(IBlockState state, IBlockAccess world, BlockPos pos)
|
||||
{
|
||||
EnumFacing facing = state.getValue(FACING);
|
||||
IBlockState offsetState = world.getBlockState(pos.offset(facing));
|
||||
|
||||
if (isBlockStairs(offsetState) && state.getValue(BlockStairs.HALF) == offsetState.getValue(BlockStairs.HALF))
|
||||
{
|
||||
EnumFacing offsetFacing = offsetState.getValue(FACING);
|
||||
|
||||
if (offsetFacing.getAxis() != state.getValue(FACING).getAxis() && isDifferentStairs(state, world, pos, offsetFacing.getOpposite()))
|
||||
{
|
||||
if (offsetFacing == facing.rotateYCCW())
|
||||
{
|
||||
return BlockStairs.EnumShape.OUTER_LEFT;
|
||||
}
|
||||
|
||||
return BlockStairs.EnumShape.OUTER_RIGHT;
|
||||
}
|
||||
}
|
||||
|
||||
IBlockState oppositeOffsetState = world.getBlockState(pos.offset(facing.getOpposite()));
|
||||
|
||||
if (isBlockStairs(oppositeOffsetState) && state.getValue(BlockStairs.HALF) == oppositeOffsetState.getValue(BlockStairs.HALF))
|
||||
{
|
||||
EnumFacing oppositeOffsetFacing = oppositeOffsetState.getValue(FACING);
|
||||
|
||||
if (oppositeOffsetFacing.getAxis() != (state.getValue(FACING)).getAxis() && isDifferentStairs(state, world, pos, oppositeOffsetFacing))
|
||||
{
|
||||
if (oppositeOffsetFacing == facing.rotateYCCW())
|
||||
{
|
||||
return BlockStairs.EnumShape.INNER_LEFT;
|
||||
}
|
||||
|
||||
return BlockStairs.EnumShape.INNER_RIGHT;
|
||||
}
|
||||
}
|
||||
|
||||
return BlockStairs.EnumShape.STRAIGHT;
|
||||
}
|
||||
|
||||
private static boolean isDifferentStairs(IBlockState state, IBlockAccess world, BlockPos pos, EnumFacing facing)
|
||||
{
|
||||
IBlockState offsetState = world.getBlockState(pos.offset(facing));
|
||||
return !isBlockStairs(offsetState) || offsetState.getValue(FACING) != state.getValue(FACING) || offsetState.getValue(BlockStairs.HALF) != state.getValue(BlockStairs.HALF);
|
||||
}
|
||||
|
||||
public static boolean isBlockStairs(IBlockState state)
|
||||
{
|
||||
return state.getBlock() instanceof BlockStairs || state.getBlock() instanceof BlockEnumStairs;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IBlockState withRotation(IBlockState state, Rotation rot)
|
||||
{
|
||||
public IBlockState withRotation(IBlockState state, Rotation rot) {
|
||||
return state.withProperty(FACING, rot.rotate(state.getValue(FACING)));
|
||||
}
|
||||
|
||||
@SuppressWarnings("incomplete-switch")
|
||||
@Override
|
||||
public IBlockState withMirror(IBlockState state, Mirror mirrorIn)
|
||||
{
|
||||
public IBlockState withMirror(IBlockState state, Mirror mirrorIn) {
|
||||
EnumFacing facing = state.getValue(FACING);
|
||||
BlockStairs.EnumShape stairShape = state.getValue(BlockStairs.SHAPE);
|
||||
|
||||
switch (mirrorIn)
|
||||
{
|
||||
case LEFT_RIGHT:
|
||||
switch (mirrorIn) {
|
||||
case LEFT_RIGHT:
|
||||
|
||||
if (facing.getAxis() == EnumFacing.Axis.Z)
|
||||
{
|
||||
switch (stairShape)
|
||||
{
|
||||
case OUTER_LEFT:
|
||||
return state.withRotation(Rotation.CLOCKWISE_180).withProperty(BlockStairs.SHAPE, BlockStairs.EnumShape.OUTER_RIGHT);
|
||||
case OUTER_RIGHT:
|
||||
return state.withRotation(Rotation.CLOCKWISE_180).withProperty(BlockStairs.SHAPE, BlockStairs.EnumShape.OUTER_LEFT);
|
||||
case INNER_RIGHT:
|
||||
return state.withRotation(Rotation.CLOCKWISE_180).withProperty(BlockStairs.SHAPE, BlockStairs.EnumShape.INNER_LEFT);
|
||||
case INNER_LEFT:
|
||||
return state.withRotation(Rotation.CLOCKWISE_180).withProperty(BlockStairs.SHAPE, BlockStairs.EnumShape.INNER_RIGHT);
|
||||
default:
|
||||
return state.withRotation(Rotation.CLOCKWISE_180);
|
||||
if (facing.getAxis() == EnumFacing.Axis.Z) {
|
||||
switch (stairShape) {
|
||||
case OUTER_LEFT:
|
||||
return state.withRotation(Rotation.CLOCKWISE_180).withProperty(BlockStairs.SHAPE, BlockStairs.EnumShape.OUTER_RIGHT);
|
||||
case OUTER_RIGHT:
|
||||
return state.withRotation(Rotation.CLOCKWISE_180).withProperty(BlockStairs.SHAPE, BlockStairs.EnumShape.OUTER_LEFT);
|
||||
case INNER_RIGHT:
|
||||
return state.withRotation(Rotation.CLOCKWISE_180).withProperty(BlockStairs.SHAPE, BlockStairs.EnumShape.INNER_LEFT);
|
||||
case INNER_LEFT:
|
||||
return state.withRotation(Rotation.CLOCKWISE_180).withProperty(BlockStairs.SHAPE, BlockStairs.EnumShape.INNER_RIGHT);
|
||||
default:
|
||||
return state.withRotation(Rotation.CLOCKWISE_180);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
break;
|
||||
case FRONT_BACK:
|
||||
break;
|
||||
case FRONT_BACK:
|
||||
|
||||
if (facing.getAxis() == EnumFacing.Axis.X)
|
||||
{
|
||||
switch (stairShape)
|
||||
{
|
||||
case OUTER_LEFT:
|
||||
return state.withRotation(Rotation.CLOCKWISE_180).withProperty(BlockStairs.SHAPE, BlockStairs.EnumShape.OUTER_RIGHT);
|
||||
case OUTER_RIGHT:
|
||||
return state.withRotation(Rotation.CLOCKWISE_180).withProperty(BlockStairs.SHAPE, BlockStairs.EnumShape.OUTER_LEFT);
|
||||
case INNER_RIGHT:
|
||||
return state.withRotation(Rotation.CLOCKWISE_180).withProperty(BlockStairs.SHAPE, BlockStairs.EnumShape.INNER_RIGHT);
|
||||
case INNER_LEFT:
|
||||
return state.withRotation(Rotation.CLOCKWISE_180).withProperty(BlockStairs.SHAPE, BlockStairs.EnumShape.INNER_LEFT);
|
||||
case STRAIGHT:
|
||||
return state.withRotation(Rotation.CLOCKWISE_180);
|
||||
if (facing.getAxis() == EnumFacing.Axis.X) {
|
||||
switch (stairShape) {
|
||||
case OUTER_LEFT:
|
||||
return state.withRotation(Rotation.CLOCKWISE_180).withProperty(BlockStairs.SHAPE, BlockStairs.EnumShape.OUTER_RIGHT);
|
||||
case OUTER_RIGHT:
|
||||
return state.withRotation(Rotation.CLOCKWISE_180).withProperty(BlockStairs.SHAPE, BlockStairs.EnumShape.OUTER_LEFT);
|
||||
case INNER_RIGHT:
|
||||
return state.withRotation(Rotation.CLOCKWISE_180).withProperty(BlockStairs.SHAPE, BlockStairs.EnumShape.INNER_RIGHT);
|
||||
case INNER_LEFT:
|
||||
return state.withRotation(Rotation.CLOCKWISE_180).withProperty(BlockStairs.SHAPE, BlockStairs.EnumShape.INNER_LEFT);
|
||||
case STRAIGHT:
|
||||
return state.withRotation(Rotation.CLOCKWISE_180);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return super.withMirror(state, mirrorIn);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected ItemStack getSilkTouchDrop(IBlockState state)
|
||||
{
|
||||
protected ItemStack getSilkTouchDrop(IBlockState state) {
|
||||
return new ItemStack(this, 1, damageDropped(state));
|
||||
}
|
||||
|
||||
@Override
|
||||
public int damageDropped(IBlockState state)
|
||||
{
|
||||
public int damageDropped(IBlockState state) {
|
||||
return super.getMetaFromState(state);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack getPickBlock(IBlockState state, RayTraceResult target, World world, BlockPos pos, EntityPlayer player)
|
||||
{
|
||||
public ItemStack getPickBlock(IBlockState state, RayTraceResult target, World world, BlockPos pos, EntityPlayer player) {
|
||||
return new ItemStack(this, 1, damageDropped(state));
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean doesSideBlockRendering(IBlockState state, IBlockAccess world, BlockPos pos, EnumFacing face)
|
||||
{
|
||||
public boolean doesSideBlockRendering(IBlockState state, IBlockAccess world, BlockPos pos, EnumFacing face) {
|
||||
if (ForgeModContainer.disableStairSlabCulling)
|
||||
return super.doesSideBlockRendering(state, world, pos, face);
|
||||
|
||||
|
@ -391,4 +231,113 @@ public class BlockEnumStairs<E extends Enum<E> & IStringSerializable> extends Bl
|
|||
return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
private static List<AxisAlignedBB> getCollisionBoxList(IBlockState state) {
|
||||
List<AxisAlignedBB> list = Lists.newArrayList();
|
||||
boolean flag = state.getValue(BlockStairs.HALF) == BlockStairs.EnumHalf.TOP;
|
||||
list.add(flag ? AABB_SLAB_TOP : AABB_SLAB_BOTTOM);
|
||||
BlockStairs.EnumShape stairShape = state.getValue(BlockStairs.SHAPE);
|
||||
|
||||
if (stairShape == BlockStairs.EnumShape.STRAIGHT || stairShape == BlockStairs.EnumShape.INNER_LEFT || stairShape == BlockStairs.EnumShape.INNER_RIGHT) {
|
||||
list.add(getCollQuarterBlock(state));
|
||||
}
|
||||
|
||||
if (stairShape != BlockStairs.EnumShape.STRAIGHT) {
|
||||
list.add(getCollEighthBlock(state));
|
||||
}
|
||||
|
||||
return list;
|
||||
}
|
||||
|
||||
private static AxisAlignedBB getCollQuarterBlock(IBlockState state) {
|
||||
boolean flag = state.getValue(BlockStairs.HALF) == BlockStairs.EnumHalf.TOP;
|
||||
|
||||
switch (state.getValue(FACING)) {
|
||||
case NORTH:
|
||||
default:
|
||||
return flag ? AABB_QTR_BOT_NORTH : AABB_QTR_TOP_NORTH;
|
||||
case SOUTH:
|
||||
return flag ? AABB_QTR_BOT_SOUTH : AABB_QTR_TOP_SOUTH;
|
||||
case WEST:
|
||||
return flag ? AABB_QTR_BOT_WEST : AABB_QTR_TOP_WEST;
|
||||
case EAST:
|
||||
return flag ? AABB_QTR_BOT_EAST : AABB_QTR_TOP_EAST;
|
||||
}
|
||||
}
|
||||
|
||||
private static AxisAlignedBB getCollEighthBlock(IBlockState state) {
|
||||
EnumFacing facing = state.getValue(FACING);
|
||||
EnumFacing newFacing;
|
||||
|
||||
switch (state.getValue(BlockStairs.SHAPE)) {
|
||||
case OUTER_LEFT:
|
||||
default:
|
||||
newFacing = facing;
|
||||
break;
|
||||
case OUTER_RIGHT:
|
||||
newFacing = facing.rotateY();
|
||||
break;
|
||||
case INNER_RIGHT:
|
||||
newFacing = facing.getOpposite();
|
||||
break;
|
||||
case INNER_LEFT:
|
||||
newFacing = facing.rotateYCCW();
|
||||
}
|
||||
|
||||
boolean isTop = state.getValue(BlockStairs.HALF) == BlockStairs.EnumHalf.TOP;
|
||||
|
||||
switch (newFacing) {
|
||||
case NORTH:
|
||||
default:
|
||||
return isTop ? AABB_OCT_BOT_NW : AABB_OCT_TOP_NW;
|
||||
case SOUTH:
|
||||
return isTop ? AABB_OCT_BOT_SE : AABB_OCT_TOP_SE;
|
||||
case WEST:
|
||||
return isTop ? AABB_OCT_BOT_SW : AABB_OCT_TOP_SW;
|
||||
case EAST:
|
||||
return isTop ? AABB_OCT_BOT_NE : AABB_OCT_TOP_NE;
|
||||
}
|
||||
}
|
||||
|
||||
private static BlockStairs.EnumShape getStairsShape(IBlockState state, IBlockAccess world, BlockPos pos) {
|
||||
EnumFacing facing = state.getValue(FACING);
|
||||
IBlockState offsetState = world.getBlockState(pos.offset(facing));
|
||||
|
||||
if (isBlockStairs(offsetState) && state.getValue(BlockStairs.HALF) == offsetState.getValue(BlockStairs.HALF)) {
|
||||
EnumFacing offsetFacing = offsetState.getValue(FACING);
|
||||
|
||||
if (offsetFacing.getAxis() != state.getValue(FACING).getAxis() && isDifferentStairs(state, world, pos, offsetFacing.getOpposite())) {
|
||||
if (offsetFacing == facing.rotateYCCW()) {
|
||||
return BlockStairs.EnumShape.OUTER_LEFT;
|
||||
}
|
||||
|
||||
return BlockStairs.EnumShape.OUTER_RIGHT;
|
||||
}
|
||||
}
|
||||
|
||||
IBlockState oppositeOffsetState = world.getBlockState(pos.offset(facing.getOpposite()));
|
||||
|
||||
if (isBlockStairs(oppositeOffsetState) && state.getValue(BlockStairs.HALF) == oppositeOffsetState.getValue(BlockStairs.HALF)) {
|
||||
EnumFacing oppositeOffsetFacing = oppositeOffsetState.getValue(FACING);
|
||||
|
||||
if (oppositeOffsetFacing.getAxis() != (state.getValue(FACING)).getAxis() && isDifferentStairs(state, world, pos, oppositeOffsetFacing)) {
|
||||
if (oppositeOffsetFacing == facing.rotateYCCW()) {
|
||||
return BlockStairs.EnumShape.INNER_LEFT;
|
||||
}
|
||||
|
||||
return BlockStairs.EnumShape.INNER_RIGHT;
|
||||
}
|
||||
}
|
||||
|
||||
return BlockStairs.EnumShape.STRAIGHT;
|
||||
}
|
||||
|
||||
private static boolean isDifferentStairs(IBlockState state, IBlockAccess world, BlockPos pos, EnumFacing facing) {
|
||||
IBlockState offsetState = world.getBlockState(pos.offset(facing));
|
||||
return !isBlockStairs(offsetState) || offsetState.getValue(FACING) != state.getValue(FACING) || offsetState.getValue(BlockStairs.HALF) != state.getValue(BlockStairs.HALF);
|
||||
}
|
||||
|
||||
public static boolean isBlockStairs(IBlockState state) {
|
||||
return state.getBlock() instanceof BlockStairs || state.getBlock() instanceof BlockEnumStairs;
|
||||
}
|
||||
}
|
|
@ -16,94 +16,57 @@ import net.minecraft.world.IBlockAccess;
|
|||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
|
||||
public class BlockEnumWall<E extends Enum<E> & IStringSerializable> extends BlockEnum<E>
|
||||
{
|
||||
public class BlockEnumWall<E extends Enum<E> & IStringSerializable> extends BlockEnum<E> {
|
||||
public static final PropertyBool UP = PropertyBool.create("up");
|
||||
public static final PropertyBool NORTH = PropertyBool.create("north");
|
||||
public static final PropertyBool EAST = PropertyBool.create("east");
|
||||
public static final PropertyBool SOUTH = PropertyBool.create("south");
|
||||
public static final PropertyBool WEST = PropertyBool.create("west");
|
||||
protected static final AxisAlignedBB[] AABB_BY_INDEX = new AxisAlignedBB[] { new AxisAlignedBB(0.25D, 0.0D, 0.25D, 0.75D, 1.0D, 0.75D), new AxisAlignedBB(0.25D, 0.0D, 0.25D, 0.75D, 1.0D, 1.0D), new AxisAlignedBB(0.0D, 0.0D, 0.25D, 0.75D, 1.0D, 0.75D), new AxisAlignedBB(0.0D, 0.0D, 0.25D, 0.75D, 1.0D, 1.0D), new AxisAlignedBB(0.25D, 0.0D, 0.0D, 0.75D, 1.0D, 0.75D), new AxisAlignedBB(0.3125D, 0.0D, 0.0D, 0.6875D, 0.875D, 1.0D), new AxisAlignedBB(0.0D, 0.0D, 0.0D, 0.75D, 1.0D, 0.75D), new AxisAlignedBB(0.0D, 0.0D, 0.0D, 0.75D, 1.0D, 1.0D),
|
||||
new AxisAlignedBB(0.25D, 0.0D, 0.25D, 1.0D, 1.0D, 0.75D), new AxisAlignedBB(0.25D, 0.0D, 0.25D, 1.0D, 1.0D, 1.0D), new AxisAlignedBB(0.0D, 0.0D, 0.3125D, 1.0D, 0.875D, 0.6875D), new AxisAlignedBB(0.0D, 0.0D, 0.25D, 1.0D, 1.0D, 1.0D), new AxisAlignedBB(0.25D, 0.0D, 0.0D, 1.0D, 1.0D, 0.75D), new AxisAlignedBB(0.25D, 0.0D, 0.0D, 1.0D, 1.0D, 1.0D), new AxisAlignedBB(0.0D, 0.0D, 0.0D, 1.0D, 1.0D, 0.75D), new AxisAlignedBB(0.0D, 0.0D, 0.0D, 1.0D, 1.0D, 1.0D) };
|
||||
protected static final AxisAlignedBB[] CLIP_AABB_BY_INDEX = new AxisAlignedBB[] { AABB_BY_INDEX[0].setMaxY(1.5D), AABB_BY_INDEX[1].setMaxY(1.5D), AABB_BY_INDEX[2].setMaxY(1.5D), AABB_BY_INDEX[3].setMaxY(1.5D), AABB_BY_INDEX[4].setMaxY(1.5D), AABB_BY_INDEX[5].setMaxY(1.5D), AABB_BY_INDEX[6].setMaxY(1.5D), AABB_BY_INDEX[7].setMaxY(1.5D), AABB_BY_INDEX[8].setMaxY(1.5D), AABB_BY_INDEX[9].setMaxY(1.5D), AABB_BY_INDEX[10].setMaxY(1.5D), AABB_BY_INDEX[11].setMaxY(1.5D), AABB_BY_INDEX[12].setMaxY(1.5D), AABB_BY_INDEX[13].setMaxY(1.5D), AABB_BY_INDEX[14].setMaxY(1.5D),
|
||||
AABB_BY_INDEX[15].setMaxY(1.5D) };
|
||||
protected static final AxisAlignedBB[] AABB_BY_INDEX = new AxisAlignedBB[]{new AxisAlignedBB(0.25D, 0.0D, 0.25D, 0.75D, 1.0D, 0.75D), new AxisAlignedBB(0.25D, 0.0D, 0.25D, 0.75D, 1.0D, 1.0D), new AxisAlignedBB(0.0D, 0.0D, 0.25D, 0.75D, 1.0D, 0.75D), new AxisAlignedBB(0.0D, 0.0D, 0.25D, 0.75D, 1.0D, 1.0D), new AxisAlignedBB(0.25D, 0.0D, 0.0D, 0.75D, 1.0D, 0.75D), new AxisAlignedBB(0.3125D, 0.0D, 0.0D, 0.6875D, 0.875D, 1.0D), new AxisAlignedBB(0.0D, 0.0D, 0.0D, 0.75D, 1.0D, 0.75D), new AxisAlignedBB(0.0D, 0.0D, 0.0D, 0.75D, 1.0D, 1.0D),
|
||||
new AxisAlignedBB(0.25D, 0.0D, 0.25D, 1.0D, 1.0D, 0.75D), new AxisAlignedBB(0.25D, 0.0D, 0.25D, 1.0D, 1.0D, 1.0D), new AxisAlignedBB(0.0D, 0.0D, 0.3125D, 1.0D, 0.875D, 0.6875D), new AxisAlignedBB(0.0D, 0.0D, 0.25D, 1.0D, 1.0D, 1.0D), new AxisAlignedBB(0.25D, 0.0D, 0.0D, 1.0D, 1.0D, 0.75D), new AxisAlignedBB(0.25D, 0.0D, 0.0D, 1.0D, 1.0D, 1.0D), new AxisAlignedBB(0.0D, 0.0D, 0.0D, 1.0D, 1.0D, 0.75D), new AxisAlignedBB(0.0D, 0.0D, 0.0D, 1.0D, 1.0D, 1.0D)};
|
||||
protected static final AxisAlignedBB[] CLIP_AABB_BY_INDEX = new AxisAlignedBB[]{AABB_BY_INDEX[0].setMaxY(1.5D), AABB_BY_INDEX[1].setMaxY(1.5D), AABB_BY_INDEX[2].setMaxY(1.5D), AABB_BY_INDEX[3].setMaxY(1.5D), AABB_BY_INDEX[4].setMaxY(1.5D), AABB_BY_INDEX[5].setMaxY(1.5D), AABB_BY_INDEX[6].setMaxY(1.5D), AABB_BY_INDEX[7].setMaxY(1.5D), AABB_BY_INDEX[8].setMaxY(1.5D), AABB_BY_INDEX[9].setMaxY(1.5D), AABB_BY_INDEX[10].setMaxY(1.5D), AABB_BY_INDEX[11].setMaxY(1.5D), AABB_BY_INDEX[12].setMaxY(1.5D), AABB_BY_INDEX[13].setMaxY(1.5D), AABB_BY_INDEX[14].setMaxY(1.5D),
|
||||
AABB_BY_INDEX[15].setMaxY(1.5D)};
|
||||
|
||||
// Most of this is copied from BlockWall - if there is an issue when porting, look there first.
|
||||
public BlockEnumWall(Material material, Class<E> enumClass, String propName)
|
||||
{
|
||||
public BlockEnumWall(Material material, Class<E> enumClass, String propName) {
|
||||
super(material, enumClass, propName);
|
||||
}
|
||||
|
||||
public BlockEnumWall(Material material, Class<E> enumClass)
|
||||
{
|
||||
public BlockEnumWall(Material material, Class<E> enumClass) {
|
||||
this(material, enumClass, "type");
|
||||
}
|
||||
|
||||
@Override
|
||||
protected BlockStateContainer createStateContainer()
|
||||
{
|
||||
protected BlockStateContainer createStateContainer() {
|
||||
return new BlockStateContainer.Builder(this).add(getProperty(), UP, NORTH, EAST, SOUTH, WEST).build();
|
||||
}
|
||||
|
||||
@Override
|
||||
public AxisAlignedBB getBoundingBox(IBlockState state, IBlockAccess source, BlockPos pos)
|
||||
{
|
||||
public AxisAlignedBB getBoundingBox(IBlockState state, IBlockAccess source, BlockPos pos) {
|
||||
state = state.getActualState(source, pos);
|
||||
return AABB_BY_INDEX[getAABBIndex(state)];
|
||||
}
|
||||
|
||||
@Override
|
||||
public AxisAlignedBB getCollisionBoundingBox(IBlockState blockState, IBlockAccess worldIn, BlockPos pos)
|
||||
{
|
||||
public AxisAlignedBB getCollisionBoundingBox(IBlockState blockState, IBlockAccess worldIn, BlockPos pos) {
|
||||
blockState = blockState.getActualState(worldIn, pos);
|
||||
return CLIP_AABB_BY_INDEX[getAABBIndex(blockState)];
|
||||
}
|
||||
|
||||
private static int getAABBIndex(IBlockState state)
|
||||
{
|
||||
int i = 0;
|
||||
|
||||
if (state.getValue(NORTH))
|
||||
{
|
||||
i |= 1 << EnumFacing.NORTH.getHorizontalIndex();
|
||||
}
|
||||
|
||||
if (state.getValue(EAST))
|
||||
{
|
||||
i |= 1 << EnumFacing.EAST.getHorizontalIndex();
|
||||
}
|
||||
|
||||
if (state.getValue(SOUTH))
|
||||
{
|
||||
i |= 1 << EnumFacing.SOUTH.getHorizontalIndex();
|
||||
}
|
||||
|
||||
if (state.getValue(WEST))
|
||||
{
|
||||
i |= 1 << EnumFacing.WEST.getHorizontalIndex();
|
||||
}
|
||||
|
||||
return i;
|
||||
}
|
||||
|
||||
public boolean isFullCube(IBlockState state)
|
||||
{
|
||||
public boolean isFullCube(IBlockState state) {
|
||||
return false;
|
||||
}
|
||||
|
||||
public boolean isPassable(IBlockAccess worldIn, BlockPos pos)
|
||||
{
|
||||
public boolean isPassable(IBlockAccess worldIn, BlockPos pos) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isOpaqueCube(IBlockState state)
|
||||
{
|
||||
public boolean isOpaqueCube(IBlockState state) {
|
||||
return false;
|
||||
}
|
||||
|
||||
private boolean canConnectTo(IBlockAccess worldIn, BlockPos pos)
|
||||
{
|
||||
private boolean canConnectTo(IBlockAccess worldIn, BlockPos pos) {
|
||||
IBlockState worldState = worldIn.getBlockState(pos);
|
||||
Block block = worldState.getBlock();
|
||||
return block != Blocks.BARRIER && (!(block != this && !(block instanceof BlockFenceGate)) || ((worldState.getMaterial().isOpaque() && worldState.isFullCube()) && worldState.getMaterial() != Material.GOURD));
|
||||
|
@ -111,14 +74,12 @@ public class BlockEnumWall<E extends Enum<E> & IStringSerializable> extends Bloc
|
|||
|
||||
@SideOnly(Side.CLIENT)
|
||||
@Override
|
||||
public boolean shouldSideBeRendered(IBlockState blockState, IBlockAccess blockAccess, BlockPos pos, EnumFacing side)
|
||||
{
|
||||
public boolean shouldSideBeRendered(IBlockState blockState, IBlockAccess blockAccess, BlockPos pos, EnumFacing side) {
|
||||
return side != EnumFacing.DOWN || super.shouldSideBeRendered(blockState, blockAccess, pos, side);
|
||||
}
|
||||
|
||||
@Override
|
||||
public IBlockState getActualState(IBlockState state, IBlockAccess worldIn, BlockPos pos)
|
||||
{
|
||||
public IBlockState getActualState(IBlockState state, IBlockAccess worldIn, BlockPos pos) {
|
||||
boolean canNorth = this.canConnectTo(worldIn, pos.north());
|
||||
boolean canEast = this.canConnectTo(worldIn, pos.east());
|
||||
boolean canSouth = this.canConnectTo(worldIn, pos.south());
|
||||
|
@ -128,14 +89,34 @@ public class BlockEnumWall<E extends Enum<E> & IStringSerializable> extends Bloc
|
|||
}
|
||||
|
||||
@Override
|
||||
protected ItemStack getSilkTouchDrop(IBlockState state)
|
||||
{
|
||||
protected ItemStack getSilkTouchDrop(IBlockState state) {
|
||||
return new ItemStack(this, 1, damageDropped(state));
|
||||
}
|
||||
|
||||
@Override
|
||||
public int damageDropped(IBlockState state)
|
||||
{
|
||||
public int damageDropped(IBlockState state) {
|
||||
return super.getMetaFromState(state);
|
||||
}
|
||||
|
||||
private static int getAABBIndex(IBlockState state) {
|
||||
int i = 0;
|
||||
|
||||
if (state.getValue(NORTH)) {
|
||||
i |= 1 << EnumFacing.NORTH.getHorizontalIndex();
|
||||
}
|
||||
|
||||
if (state.getValue(EAST)) {
|
||||
i |= 1 << EnumFacing.EAST.getHorizontalIndex();
|
||||
}
|
||||
|
||||
if (state.getValue(SOUTH)) {
|
||||
i |= 1 << EnumFacing.SOUTH.getHorizontalIndex();
|
||||
}
|
||||
|
||||
if (state.getValue(WEST)) {
|
||||
i |= 1 << EnumFacing.WEST.getHorizontalIndex();
|
||||
}
|
||||
|
||||
return i;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -6,25 +6,20 @@ import net.minecraft.block.properties.PropertyInteger;
|
|||
import net.minecraft.block.state.BlockStateContainer;
|
||||
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;
|
||||
|
||||
/**
|
||||
* Creates a block that has multiple meta-based states.
|
||||
*
|
||||
* <p>
|
||||
* These states will be numbered 0 through {@code maxMeta}.
|
||||
*/
|
||||
public class BlockInteger extends Block
|
||||
{
|
||||
public class BlockInteger extends Block {
|
||||
private final int maxMeta;
|
||||
private final PropertyInteger property;
|
||||
private final BlockStateContainer realStateContainer;
|
||||
|
||||
public BlockInteger(Material material, int maxMeta, String propName)
|
||||
{
|
||||
public BlockInteger(Material material, int maxMeta, String propName) {
|
||||
super(material);
|
||||
|
||||
this.maxMeta = maxMeta;
|
||||
|
@ -33,8 +28,7 @@ public class BlockInteger extends Block
|
|||
setDefaultState(getBlockState().getBaseState());
|
||||
}
|
||||
|
||||
public BlockInteger(Material material, int maxMeta)
|
||||
{
|
||||
public BlockInteger(Material material, int maxMeta) {
|
||||
this(material, maxMeta, "meta");
|
||||
}
|
||||
|
||||
|
|
|
@ -1,13 +1,12 @@
|
|||
package WayofTime.bloodmagic.block.base;
|
||||
|
||||
import WayofTime.bloodmagic.block.property.PropertyString;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.block.state.BlockStateContainer;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
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;
|
||||
|
@ -15,20 +14,18 @@ import org.apache.commons.lang3.ArrayUtils;
|
|||
|
||||
/**
|
||||
* Creates a block that has multiple meta-based states.
|
||||
*
|
||||
* <p>
|
||||
* These states will be named after the given string array. Somewhere along the
|
||||
* way, each value is {@code toLowerCase()}'ed, so the blockstate JSON needs all
|
||||
* values to be lowercase.
|
||||
*/
|
||||
public class BlockString extends Block
|
||||
{
|
||||
public class BlockString extends Block {
|
||||
private final int maxMeta;
|
||||
private final String[] types;
|
||||
private final PropertyString property;
|
||||
private final BlockStateContainer realStateContainer;
|
||||
|
||||
public BlockString(Material material, String[] values, String propName)
|
||||
{
|
||||
public BlockString(Material material, String[] values, String propName) {
|
||||
super(material);
|
||||
|
||||
this.maxMeta = values.length;
|
||||
|
@ -39,51 +36,43 @@ public class BlockString extends Block
|
|||
setDefaultState(getBlockState().getBaseState());
|
||||
}
|
||||
|
||||
public BlockString(Material material, String[] values)
|
||||
{
|
||||
public BlockString(Material material, String[] values) {
|
||||
this(material, values, "type");
|
||||
}
|
||||
|
||||
@Override
|
||||
protected final BlockStateContainer createBlockState()
|
||||
{
|
||||
protected final BlockStateContainer createBlockState() {
|
||||
return new BlockStateContainer.Builder(this).build(); // Blank to avoid crashes
|
||||
}
|
||||
|
||||
@Override
|
||||
public final BlockStateContainer getBlockState()
|
||||
{
|
||||
public final BlockStateContainer getBlockState() {
|
||||
return realStateContainer;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IBlockState getStateFromMeta(int meta)
|
||||
{
|
||||
public IBlockState getStateFromMeta(int meta) {
|
||||
return getDefaultState().withProperty(property, types[meta]);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMetaFromState(IBlockState state)
|
||||
{
|
||||
public int getMetaFromState(IBlockState state) {
|
||||
return ArrayUtils.indexOf(types, state.getValue(property));
|
||||
}
|
||||
|
||||
@Override
|
||||
public int damageDropped(IBlockState state)
|
||||
{
|
||||
public int damageDropped(IBlockState state) {
|
||||
return getMetaFromState(state);
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
@Override
|
||||
public void getSubBlocks(CreativeTabs tab, NonNullList<ItemStack> subBlocks)
|
||||
{
|
||||
public void getSubBlocks(CreativeTabs tab, NonNullList<ItemStack> subBlocks) {
|
||||
for (int i = 0; i < maxMeta; i++)
|
||||
subBlocks.add(new ItemStack(this, 1, i));
|
||||
}
|
||||
|
||||
protected BlockStateContainer createStateContainer()
|
||||
{
|
||||
protected BlockStateContainer createStateContainer() {
|
||||
System.out.println("");
|
||||
BlockStateContainer ctn = new BlockStateContainer.Builder(this).add(property).build();
|
||||
System.out.println("Number of states: " + ctn.getValidStates().size());
|
||||
|
|
|
@ -1,11 +1,10 @@
|
|||
package WayofTime.bloodmagic.block.enums;
|
||||
|
||||
import java.util.Locale;
|
||||
|
||||
import net.minecraft.util.IStringSerializable;
|
||||
|
||||
public enum EnumBloodRune implements IStringSerializable
|
||||
{
|
||||
import java.util.Locale;
|
||||
|
||||
public enum EnumBloodRune implements IStringSerializable {
|
||||
BLANK,
|
||||
SPEED,
|
||||
EFFICIENCY,
|
||||
|
@ -19,14 +18,12 @@ public enum EnumBloodRune implements IStringSerializable
|
|||
CHARGING;
|
||||
|
||||
@Override
|
||||
public String toString()
|
||||
{
|
||||
public String toString() {
|
||||
return name().toLowerCase(Locale.ENGLISH);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getName()
|
||||
{
|
||||
public String getName() {
|
||||
return this.toString();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,26 +1,22 @@
|
|||
package WayofTime.bloodmagic.block.enums;
|
||||
|
||||
import java.util.Locale;
|
||||
|
||||
import net.minecraft.util.IStringSerializable;
|
||||
|
||||
public enum EnumDecorative implements IStringSerializable
|
||||
{
|
||||
import java.util.Locale;
|
||||
|
||||
public enum EnumDecorative implements IStringSerializable {
|
||||
BLOODSTONE_TILE,
|
||||
BLOODSTONE_BRICK,
|
||||
CRYSTAL_TILE,
|
||||
CRYSTAL_BRICK,
|
||||
;
|
||||
CRYSTAL_BRICK,;
|
||||
|
||||
@Override
|
||||
public String toString()
|
||||
{
|
||||
public String toString() {
|
||||
return name().toLowerCase(Locale.ROOT);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getName()
|
||||
{
|
||||
public String getName() {
|
||||
return toString();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,11 +1,10 @@
|
|||
package WayofTime.bloodmagic.block.enums;
|
||||
|
||||
import java.util.Locale;
|
||||
|
||||
import net.minecraft.util.IStringSerializable;
|
||||
|
||||
public enum EnumDemonBlock1 implements IStringSerializable
|
||||
{
|
||||
import java.util.Locale;
|
||||
|
||||
public enum EnumDemonBlock1 implements IStringSerializable {
|
||||
BRICK1_RAW,
|
||||
BRICK1_CORROSIVE,
|
||||
BRICK1_DESTRUCTIVE,
|
||||
|
@ -13,14 +12,12 @@ public enum EnumDemonBlock1 implements IStringSerializable
|
|||
BRICK1_STEADFAST;
|
||||
|
||||
@Override
|
||||
public String toString()
|
||||
{
|
||||
public String toString() {
|
||||
return name().toLowerCase(Locale.ENGLISH);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getName()
|
||||
{
|
||||
public String getName() {
|
||||
return this.toString();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,11 +1,10 @@
|
|||
package WayofTime.bloodmagic.block.enums;
|
||||
|
||||
import java.util.Locale;
|
||||
|
||||
import net.minecraft.util.IStringSerializable;
|
||||
|
||||
public enum EnumDemonBlock2 implements IStringSerializable
|
||||
{
|
||||
import java.util.Locale;
|
||||
|
||||
public enum EnumDemonBlock2 implements IStringSerializable {
|
||||
SMALLBRICK_RAW,
|
||||
SMALLBRICK_CORROSIVE,
|
||||
SMALLBRICK_DESTRUCTIVE,
|
||||
|
@ -23,14 +22,12 @@ public enum EnumDemonBlock2 implements IStringSerializable
|
|||
TILESPECIAL_STEADFAST;
|
||||
|
||||
@Override
|
||||
public String toString()
|
||||
{
|
||||
public String toString() {
|
||||
return name().toLowerCase(Locale.ENGLISH);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getName()
|
||||
{
|
||||
public String getName() {
|
||||
return this.toString();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,11 +1,10 @@
|
|||
package WayofTime.bloodmagic.block.enums;
|
||||
|
||||
import java.util.Locale;
|
||||
|
||||
import net.minecraft.util.IStringSerializable;
|
||||
|
||||
public enum EnumDemonBlock3 implements IStringSerializable
|
||||
{
|
||||
import java.util.Locale;
|
||||
|
||||
public enum EnumDemonBlock3 implements IStringSerializable {
|
||||
STONE_RAW,
|
||||
STONE_CORROSIVE,
|
||||
STONE_DESTRUCTIVE,
|
||||
|
@ -23,14 +22,12 @@ public enum EnumDemonBlock3 implements IStringSerializable
|
|||
METAL_STEADFAST;
|
||||
|
||||
@Override
|
||||
public String toString()
|
||||
{
|
||||
public String toString() {
|
||||
return name().toLowerCase(Locale.ENGLISH);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getName()
|
||||
{
|
||||
public String getName() {
|
||||
return this.toString();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,11 +1,10 @@
|
|||
package WayofTime.bloodmagic.block.enums;
|
||||
|
||||
import java.util.Locale;
|
||||
|
||||
import net.minecraft.util.IStringSerializable;
|
||||
|
||||
public enum EnumInversionCap implements IStringSerializable
|
||||
{
|
||||
import java.util.Locale;
|
||||
|
||||
public enum EnumInversionCap implements IStringSerializable {
|
||||
RAW_BOTTOM,
|
||||
RAW_TOP,
|
||||
CORROSIVE_BOTTOM,
|
||||
|
@ -18,14 +17,12 @@ public enum EnumInversionCap implements IStringSerializable
|
|||
STEADFAST_TOP;
|
||||
|
||||
@Override
|
||||
public String toString()
|
||||
{
|
||||
public String toString() {
|
||||
return name().toLowerCase(Locale.ENGLISH);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getName()
|
||||
{
|
||||
public String getName() {
|
||||
return this.toString();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,11 +1,10 @@
|
|||
package WayofTime.bloodmagic.block.enums;
|
||||
|
||||
import java.util.Locale;
|
||||
|
||||
import net.minecraft.util.IStringSerializable;
|
||||
|
||||
public enum EnumMimic implements IStringSerializable
|
||||
{
|
||||
import java.util.Locale;
|
||||
|
||||
public enum EnumMimic implements IStringSerializable {
|
||||
NOHITBOX,
|
||||
SOLIDOPAQUE,
|
||||
SOLIDCLEAR,
|
||||
|
@ -13,14 +12,12 @@ public enum EnumMimic implements IStringSerializable
|
|||
SENTIENT;
|
||||
|
||||
@Override
|
||||
public String toString()
|
||||
{
|
||||
public String toString() {
|
||||
return name().toLowerCase(Locale.ENGLISH);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getName()
|
||||
{
|
||||
public String getName() {
|
||||
return this.toString();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,11 +1,10 @@
|
|||
package WayofTime.bloodmagic.block.enums;
|
||||
|
||||
import java.util.Locale;
|
||||
|
||||
import net.minecraft.util.IStringSerializable;
|
||||
|
||||
public enum EnumPath implements IStringSerializable
|
||||
{
|
||||
import java.util.Locale;
|
||||
|
||||
public enum EnumPath implements IStringSerializable {
|
||||
WOOD,
|
||||
WOODTILE,
|
||||
STONE,
|
||||
|
@ -16,14 +15,12 @@ public enum EnumPath implements IStringSerializable
|
|||
OBSIDIANTILE;
|
||||
|
||||
@Override
|
||||
public String toString()
|
||||
{
|
||||
public String toString() {
|
||||
return name().toLowerCase(Locale.ENGLISH);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getName()
|
||||
{
|
||||
public String getName() {
|
||||
return this.toString();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,25 +1,21 @@
|
|||
package WayofTime.bloodmagic.block.enums;
|
||||
|
||||
import java.util.Locale;
|
||||
|
||||
import net.minecraft.util.IStringSerializable;
|
||||
|
||||
public enum EnumRitualController implements IStringSerializable
|
||||
{
|
||||
import java.util.Locale;
|
||||
|
||||
public enum EnumRitualController implements IStringSerializable {
|
||||
MASTER,
|
||||
IMPERFECT,
|
||||
INVERTED,
|
||||
;
|
||||
INVERTED,;
|
||||
|
||||
@Override
|
||||
public String toString()
|
||||
{
|
||||
public String toString() {
|
||||
return name().toLowerCase(Locale.ENGLISH);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getName()
|
||||
{
|
||||
public String getName() {
|
||||
return this.toString();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,12 +1,11 @@
|
|||
package WayofTime.bloodmagic.block.enums;
|
||||
|
||||
import java.util.Locale;
|
||||
|
||||
import WayofTime.bloodmagic.api.soul.EnumDemonWillType;
|
||||
import net.minecraft.util.IStringSerializable;
|
||||
|
||||
public enum EnumSubWillType implements IStringSerializable
|
||||
{
|
||||
import java.util.Locale;
|
||||
|
||||
public enum EnumSubWillType implements IStringSerializable {
|
||||
RAW,
|
||||
CORROSIVE,
|
||||
DESTRUCTIVE,
|
||||
|
@ -14,14 +13,12 @@ public enum EnumSubWillType implements IStringSerializable
|
|||
STEADFAST;
|
||||
|
||||
@Override
|
||||
public String toString()
|
||||
{
|
||||
public String toString() {
|
||||
return name().toLowerCase(Locale.ENGLISH);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getName()
|
||||
{
|
||||
public String getName() {
|
||||
return this.toString();
|
||||
}
|
||||
|
||||
|
|
|
@ -1,23 +1,20 @@
|
|||
package WayofTime.bloodmagic.block.enums;
|
||||
|
||||
import java.util.Locale;
|
||||
|
||||
import net.minecraft.util.IStringSerializable;
|
||||
|
||||
public enum EnumSubWillType1 implements IStringSerializable
|
||||
{
|
||||
import java.util.Locale;
|
||||
|
||||
public enum EnumSubWillType1 implements IStringSerializable {
|
||||
RAW,
|
||||
CORROSIVE;
|
||||
|
||||
@Override
|
||||
public String toString()
|
||||
{
|
||||
public String toString() {
|
||||
return name().toLowerCase(Locale.ENGLISH);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getName()
|
||||
{
|
||||
public String getName() {
|
||||
return this.toString();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,23 +1,20 @@
|
|||
package WayofTime.bloodmagic.block.enums;
|
||||
|
||||
import java.util.Locale;
|
||||
|
||||
import net.minecraft.util.IStringSerializable;
|
||||
|
||||
public enum EnumSubWillType2 implements IStringSerializable
|
||||
{
|
||||
import java.util.Locale;
|
||||
|
||||
public enum EnumSubWillType2 implements IStringSerializable {
|
||||
DESTRUCTIVE,
|
||||
VENGEFUL;
|
||||
|
||||
@Override
|
||||
public String toString()
|
||||
{
|
||||
public String toString() {
|
||||
return name().toLowerCase(Locale.ENGLISH);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getName()
|
||||
{
|
||||
public String getName() {
|
||||
return this.toString();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,22 +1,19 @@
|
|||
package WayofTime.bloodmagic.block.enums;
|
||||
|
||||
import java.util.Locale;
|
||||
|
||||
import net.minecraft.util.IStringSerializable;
|
||||
|
||||
public enum EnumSubWillType3 implements IStringSerializable
|
||||
{
|
||||
import java.util.Locale;
|
||||
|
||||
public enum EnumSubWillType3 implements IStringSerializable {
|
||||
STEADFAST;
|
||||
|
||||
@Override
|
||||
public String toString()
|
||||
{
|
||||
public String toString() {
|
||||
return name().toLowerCase(Locale.ENGLISH);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getName()
|
||||
{
|
||||
public String getName() {
|
||||
return this.toString();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,11 +1,10 @@
|
|||
package WayofTime.bloodmagic.block.enums;
|
||||
|
||||
import java.util.Locale;
|
||||
|
||||
import net.minecraft.util.IStringSerializable;
|
||||
|
||||
public enum EnumWillWall implements IStringSerializable
|
||||
{
|
||||
import java.util.Locale;
|
||||
|
||||
public enum EnumWillWall implements IStringSerializable {
|
||||
BRICK_RAW,
|
||||
BRICK_CORROSIVE,
|
||||
BRICK_DESTRUCTIVE,
|
||||
|
@ -23,14 +22,12 @@ public enum EnumWillWall implements IStringSerializable
|
|||
LARGE_STEADFAST;
|
||||
|
||||
@Override
|
||||
public String toString()
|
||||
{
|
||||
public String toString() {
|
||||
return name().toLowerCase(Locale.ENGLISH);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getName()
|
||||
{
|
||||
public String getName() {
|
||||
return this.toString();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2,50 +2,40 @@ package WayofTime.bloodmagic.block.property;
|
|||
|
||||
import com.google.common.base.Optional;
|
||||
import com.google.common.collect.ImmutableSet;
|
||||
import com.google.common.collect.Sets;
|
||||
import net.minecraft.block.properties.PropertyHelper;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.Collection;
|
||||
import java.util.HashSet;
|
||||
|
||||
public class PropertyString extends PropertyHelper<String>
|
||||
{
|
||||
public class PropertyString extends PropertyHelper<String> {
|
||||
private final ImmutableSet<String> allowedValues;
|
||||
|
||||
protected PropertyString(String name, String[] values)
|
||||
{
|
||||
protected PropertyString(String name, String[] values) {
|
||||
super(name, String.class);
|
||||
allowedValues = ImmutableSet.copyOf(values);
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public Optional<String> parseValue(String value)
|
||||
{
|
||||
public Optional<String> parseValue(String value) {
|
||||
return allowedValues.contains(value) ? Optional.of(value) : Optional.<String>absent();
|
||||
}
|
||||
|
||||
public static PropertyString create(String name, String[] values)
|
||||
{
|
||||
return new PropertyString(name, values);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Collection<String> getAllowedValues()
|
||||
{
|
||||
public Collection<String> getAllowedValues() {
|
||||
return allowedValues;
|
||||
}
|
||||
|
||||
public String getName0(String value)
|
||||
{
|
||||
public String getName0(String value) {
|
||||
return value;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getName(String value)
|
||||
{
|
||||
public String getName(String value) {
|
||||
return this.getName0(value);
|
||||
}
|
||||
|
||||
public static PropertyString create(String name, String[] values) {
|
||||
return new PropertyString(name, values);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue