Block fixes
This commit is contained in:
parent
252a4559f0
commit
10c6829482
31 changed files with 638 additions and 561 deletions
|
@ -1,10 +1,10 @@
|
|||
package WayofTime.bloodmagic.block;
|
||||
|
||||
import WayofTime.bloodmagic.BloodMagic;
|
||||
import WayofTime.bloodmagic.api.Constants;
|
||||
import WayofTime.bloodmagic.tile.TileBloodTank;
|
||||
import WayofTime.bloodmagic.util.Utils;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.block.BlockContainer;
|
||||
import net.minecraft.block.SoundType;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
|
@ -12,16 +12,19 @@ import net.minecraft.entity.player.EntityPlayer;
|
|||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.BlockPos;
|
||||
import net.minecraft.util.EnumBlockRenderType;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.util.MovingObjectPosition;
|
||||
import net.minecraft.util.EnumHand;
|
||||
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.FluidContainerRegistry;
|
||||
import net.minecraftforge.fluids.FluidStack;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import WayofTime.bloodmagic.BloodMagic;
|
||||
import WayofTime.bloodmagic.api.Constants;
|
||||
import WayofTime.bloodmagic.tile.TileBloodTank;
|
||||
import WayofTime.bloodmagic.util.Utils;
|
||||
|
||||
public class BlockBloodTank extends BlockContainer
|
||||
{
|
||||
|
@ -33,7 +36,7 @@ public class BlockBloodTank extends BlockContainer
|
|||
setRegistryName(Constants.BloodMagicBlock.BLOOD_TANK.getRegName());
|
||||
setHardness(2.0F);
|
||||
setResistance(5.0F);
|
||||
setStepSound(soundTypeGlass);
|
||||
setStepSound(SoundType.GLASS);
|
||||
setHarvestLevel("pickaxe", 1);
|
||||
setCreativeTab(BloodMagic.tabBloodMagic);
|
||||
}
|
||||
|
@ -45,32 +48,32 @@ public class BlockBloodTank extends BlockContainer
|
|||
}
|
||||
|
||||
@Override
|
||||
public int getRenderType()
|
||||
public EnumBlockRenderType getRenderType(IBlockState state)
|
||||
{
|
||||
return 3;
|
||||
return EnumBlockRenderType.MODEL;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onBlockActivated(World world, BlockPos blockPos, IBlockState blockState, EntityPlayer player, EnumFacing side, float hitX, float hitY, float hitZ)
|
||||
public boolean onBlockActivated(World world, BlockPos blockPos, IBlockState state, EntityPlayer player, EnumHand hand, ItemStack heldItem, EnumFacing side, float hitX, float hitY, float hitZ)
|
||||
{
|
||||
TileBloodTank fluidHandler = (TileBloodTank) world.getTileEntity(blockPos);
|
||||
if (Utils.fillHandlerWithContainer(world, fluidHandler, player))
|
||||
{
|
||||
world.markBlockForUpdate(blockPos);
|
||||
world.notifyBlockUpdate(blockPos, state, state, 3);
|
||||
return true;
|
||||
}
|
||||
if (Utils.fillContainerFromHandler(world, fluidHandler, player, fluidHandler.tank.getFluid()))
|
||||
{
|
||||
world.markBlockForUpdate(blockPos);
|
||||
world.notifyBlockUpdate(blockPos, state, state, 3);
|
||||
return true;
|
||||
}
|
||||
if (FluidContainerRegistry.isContainer(player.getCurrentEquippedItem()))
|
||||
if (FluidContainerRegistry.isContainer(heldItem))
|
||||
{
|
||||
world.markBlockForUpdate(blockPos);
|
||||
world.notifyBlockUpdate(blockPos, state, state, 3);
|
||||
return true;
|
||||
}
|
||||
|
||||
return super.onBlockActivated(world, blockPos, blockState, player, side, hitX, hitY, hitZ);
|
||||
return super.onBlockActivated(world, blockPos, state, player, hand, heldItem, side, hitX, hitY, hitZ);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -112,7 +115,7 @@ public class BlockBloodTank extends BlockContainer
|
|||
}
|
||||
|
||||
@Override
|
||||
public int getLightValue(IBlockAccess world, BlockPos pos)
|
||||
public int getLightValue(IBlockState state, IBlockAccess world, BlockPos pos)
|
||||
{
|
||||
TileEntity tile = world.getTileEntity(pos);
|
||||
|
||||
|
@ -129,7 +132,7 @@ public class BlockBloodTank extends BlockContainer
|
|||
}
|
||||
|
||||
@Override
|
||||
public ItemStack getPickBlock(MovingObjectPosition target, World world, BlockPos pos, EntityPlayer player)
|
||||
public ItemStack getPickBlock(IBlockState state, RayTraceResult target, World world, BlockPos pos, EntityPlayer player)
|
||||
{
|
||||
return getDrops(world, pos, world.getBlockState(pos), 0).get(0);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue