Huge commit for the Pull-Request.
Added a lot of things: - Blood Tank - Teleposition Sigil - Transposition Sigil - Cobblestone/Netherrack/Obisidian generation Ritual - Tree Cutter Ritual - Pump Ritual - Altar Builder Ritual - Block Placing Ritual - Portal Ritual - Teleportation System and API Components - Cross pattern Area Descriptor - Two reagents and their textures for the sigils’ crafting Fixed: - Teleposer not teleporting entities correctly And probably other things I forgot!
This commit is contained in:
parent
d947f23696
commit
7e8aec8652
53 changed files with 3031 additions and 372 deletions
130
src/main/java/WayofTime/bloodmagic/block/BlockBloodTank.java
Normal file
130
src/main/java/WayofTime/bloodmagic/block/BlockBloodTank.java
Normal file
|
@ -0,0 +1,130 @@
|
|||
package WayofTime.bloodmagic.block;
|
||||
|
||||
import WayofTime.bloodmagic.BloodMagic;
|
||||
import WayofTime.bloodmagic.api.Constants;
|
||||
import WayofTime.bloodmagic.tile.TileBloodTank;
|
||||
import WayofTime.bloodmagic.util.Utils;
|
||||
import net.minecraft.block.BlockContainer;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.BlockPos;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.util.MovingObjectPosition;
|
||||
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;
|
||||
|
||||
public class BlockBloodTank extends BlockContainer
|
||||
{
|
||||
public BlockBloodTank()
|
||||
{
|
||||
super(Material.iron);
|
||||
|
||||
setUnlocalizedName(Constants.Mod.MODID + ".bloodTank");
|
||||
setRegistryName(Constants.BloodMagicBlock.BLOOD_TANK.getRegName());
|
||||
setHardness(2.0F);
|
||||
setResistance(5.0F);
|
||||
setStepSound(soundTypeGlass);
|
||||
setHarvestLevel("pickaxe", 1);
|
||||
setCreativeTab(BloodMagic.tabBloodMagic);
|
||||
}
|
||||
|
||||
@Override
|
||||
public TileEntity createNewTileEntity(World worldIn, int meta)
|
||||
{
|
||||
return new TileBloodTank();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onBlockActivated(World world, BlockPos blockPos, IBlockState blockState, EntityPlayer player, EnumFacing side, float hitX, float hitY, float hitZ)
|
||||
{
|
||||
TileBloodTank fluidHandler = (TileBloodTank) world.getTileEntity(blockPos);
|
||||
if (Utils.fillHandlerWithContainer(world, fluidHandler, player))
|
||||
{
|
||||
world.markBlockForUpdate(blockPos);
|
||||
return true;
|
||||
}
|
||||
if (Utils.fillContainerFromHandler(world, fluidHandler, player, fluidHandler.tank.getFluid()))
|
||||
{
|
||||
world.markBlockForUpdate(blockPos);
|
||||
return true;
|
||||
}
|
||||
if (FluidContainerRegistry.isContainer(player.getCurrentEquippedItem()))
|
||||
{
|
||||
world.markBlockForUpdate(blockPos);
|
||||
return true;
|
||||
}
|
||||
|
||||
return super.onBlockActivated(world, blockPos, blockState, player, side, hitX, hitY, hitZ);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBlockHarvested(World worldIn, BlockPos pos, IBlockState state, EntityPlayer player)
|
||||
{
|
||||
this.dropBlockAsItem(worldIn, pos, state, 0);
|
||||
super.onBlockHarvested(worldIn, pos, state, player);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<ItemStack> getDrops(IBlockAccess world, BlockPos blockPos, IBlockState blockState, int fortune)
|
||||
{
|
||||
ArrayList<ItemStack> list = new ArrayList<ItemStack>();
|
||||
|
||||
if (world.getTileEntity(blockPos) instanceof TileBloodTank)
|
||||
{
|
||||
TileBloodTank bloodTank = (TileBloodTank) world.getTileEntity(blockPos);
|
||||
ItemStack drop = new ItemStack(this);
|
||||
NBTTagCompound tag = new NBTTagCompound();
|
||||
bloodTank.writeToNBT(tag);
|
||||
drop.setTagCompound(tag);
|
||||
list.add(drop);
|
||||
}
|
||||
|
||||
return list;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBlockPlacedBy(World world, BlockPos blockPos, IBlockState blockState, EntityLivingBase placer, ItemStack stack)
|
||||
{
|
||||
if (world.getTileEntity(blockPos) != null && world.getTileEntity(blockPos) instanceof TileBloodTank)
|
||||
{
|
||||
NBTTagCompound tag = stack.getTagCompound();
|
||||
if (tag != null)
|
||||
{
|
||||
world.getTileEntity(blockPos).readFromNBT(tag);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getLightValue(IBlockAccess world, BlockPos pos)
|
||||
{
|
||||
TileEntity tile = world.getTileEntity(pos);
|
||||
|
||||
if (tile instanceof TileBloodTank)
|
||||
{
|
||||
TileBloodTank tank = (TileBloodTank) tile;
|
||||
FluidStack fluid = tank.tank.getFluid();
|
||||
if (fluid != null)
|
||||
{
|
||||
return fluid.getFluid().getLuminosity(fluid);
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack getPickBlock(MovingObjectPosition 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