Run formatter
This commit is contained in:
parent
61c44a831b
commit
08258fd6ef
606 changed files with 13464 additions and 22975 deletions
|
@ -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;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue