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);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,196 @@
|
|||
package WayofTime.bloodmagic.block;
|
||||
|
||||
import WayofTime.bloodmagic.BloodMagic;
|
||||
import WayofTime.bloodmagic.api.Constants;
|
||||
import WayofTime.bloodmagic.api.ritual.IMasterRitualStone;
|
||||
import WayofTime.bloodmagic.api.teleport.PortalLocation;
|
||||
import WayofTime.bloodmagic.api.teleport.TeleportQueue;
|
||||
import WayofTime.bloodmagic.block.base.BlockIntegerContainer;
|
||||
import WayofTime.bloodmagic.ritual.portal.LocationsHandler;
|
||||
import WayofTime.bloodmagic.ritual.portal.Teleports;
|
||||
import WayofTime.bloodmagic.tile.TileDimensionalPortal;
|
||||
import WayofTime.bloodmagic.tile.TileMasterRitualStone;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.client.particle.EntityFX;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.AxisAlignedBB;
|
||||
import net.minecraft.util.BlockPos;
|
||||
import net.minecraft.util.EnumParticleTypes;
|
||||
import net.minecraft.util.EnumWorldBlockLayer;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Random;
|
||||
|
||||
public class BlockDimensionalPortal extends BlockIntegerContainer
|
||||
{
|
||||
|
||||
public BlockDimensionalPortal()
|
||||
{
|
||||
super(Material.portal, 2);
|
||||
setUnlocalizedName(Constants.Mod.MODID + ".dimensionalPortal");
|
||||
setRegistryName(Constants.BloodMagicBlock.DIMENSIONAL_PORTAL.getRegName());
|
||||
setCreativeTab(BloodMagic.tabBloodMagic);
|
||||
setBlockUnbreakable();
|
||||
setResistance(2000);
|
||||
setLightOpacity(0);
|
||||
}
|
||||
|
||||
@Override
|
||||
public TileEntity createNewTileEntity(World worldIn, int meta)
|
||||
{
|
||||
return new TileDimensionalPortal();
|
||||
}
|
||||
|
||||
@Override
|
||||
public AxisAlignedBB getCollisionBoundingBox(World worldIn, BlockPos pos, IBlockState state)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
public boolean isOpaqueCube()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
public boolean isFullCube()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getLightValue(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 && !(entity instanceof EntityFX))
|
||||
{
|
||||
TileDimensionalPortal tile = (TileDimensionalPortal) world.getTileEntity(pos);
|
||||
|
||||
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)
|
||||
{
|
||||
TileMasterRitualStone masterRitualStone = (TileMasterRitualStone) world.getTileEntity(tile.getMasterStonePos());
|
||||
if (linkedLocations.get(0).equals(new PortalLocation(masterRitualStone.getBlockPos().up(), world.provider.getDimensionId())))
|
||||
{
|
||||
PortalLocation portal = linkedLocations.get(1);
|
||||
if (portal.getDimension() == world.provider.getDimensionId())
|
||||
{
|
||||
TeleportQueue.getInstance().addITeleport(new Teleports.TeleportSameDim(portal.getX(), portal.getY(), portal.getZ(), entity, masterRitualStone.getOwner()));
|
||||
} else
|
||||
{
|
||||
TeleportQueue.getInstance().addITeleport(new Teleports.TeleportToDim(portal.getX(), portal.getY(), portal.getZ(), entity, masterRitualStone.getOwner(), world, portal.getDimension()));
|
||||
}
|
||||
} else if (linkedLocations.get(1).equals(new PortalLocation(tile.masterStoneX, tile.masterStoneY + 1, tile.masterStoneZ, world.provider.getDimensionId())))
|
||||
{
|
||||
PortalLocation portal = linkedLocations.get(0);
|
||||
if (portal.getDimension() == world.provider.getDimensionId())
|
||||
{
|
||||
TeleportQueue.getInstance().addITeleport(new Teleports.TeleportSameDim(portal.getX(), portal.getY(), portal.getZ(), entity, masterRitualStone.getOwner()));
|
||||
} else
|
||||
{
|
||||
TeleportQueue.getInstance().addITeleport(new Teleports.TeleportToDim(portal.getX(), portal.getY(), portal.getZ(), entity, masterRitualStone.getOwner(), world, portal.getDimension()));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public int quantityDropped(Random par1Random)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setBlockBoundsBasedOnState(IBlockAccess world, BlockPos blockPos)
|
||||
{
|
||||
int meta = world.getBlockState(blockPos).getBlock().getMetaFromState(world.getBlockState(blockPos));
|
||||
if (meta == 0)
|
||||
{
|
||||
setBlockBounds(0f, 0f, 0.375f, 1f, 1f, 0.625f);
|
||||
} else if (meta == 1)
|
||||
{
|
||||
setBlockBounds(0.375f, 0f, 0f, 0.625f, 1f, 1f);
|
||||
} else
|
||||
{
|
||||
setBlockBounds(0f, 0f, 0f, 1f, 1, 1f);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setBlockBoundsForItemRender()
|
||||
{
|
||||
setBlockBounds(0f, 0f, 0.375f, 1f, 1f, 0.625f);
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public EnumWorldBlockLayer getBlockLayer()
|
||||
{
|
||||
return EnumWorldBlockLayer.TRANSLUCENT;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void randomDisplayTick(World world, BlockPos pos, IBlockState state, Random rand)
|
||||
{
|
||||
this.spawnParticles(world, pos.getX(), pos.getY(), pos.getZ());
|
||||
}
|
||||
|
||||
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)
|
||||
{
|
||||
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)).getBlock().isOpaqueCube())
|
||||
{
|
||||
particleY = (double) (y + 1) + d0;
|
||||
}
|
||||
if (i == 1 && !world.getBlockState(new BlockPos(x, y - 1, z)).getBlock().isOpaqueCube())
|
||||
{
|
||||
particleY = (double) y - d0;
|
||||
}
|
||||
if (i == 2 && !world.getBlockState(new BlockPos(x, y, z + 1)).getBlock().isOpaqueCube())
|
||||
{
|
||||
particleZ = (double) (z + 1) + d0;
|
||||
}
|
||||
if (i == 3 && !world.getBlockState(new BlockPos(x, y, z - 1)).getBlock().isOpaqueCube())
|
||||
{
|
||||
particleZ = (double) z - d0;
|
||||
}
|
||||
if (i == 4 && !world.getBlockState(new BlockPos(x + 1, y, z)).getBlock().isOpaqueCube())
|
||||
{
|
||||
particleX = (double) (x + 1) + d0;
|
||||
}
|
||||
if (i == 5 && !world.getBlockState(new BlockPos(x - 1, y, z)).getBlock().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))
|
||||
{
|
||||
world.spawnParticle(EnumParticleTypes.REDSTONE, particleX, particleY, particleZ, 0.0D, 0.0D, 0.0D);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -89,7 +89,7 @@ public class BlockRitualController extends BlockStringContainer
|
|||
TileEntity tile = world.getTileEntity(pos);
|
||||
IBlockState state = world.getBlockState(pos);
|
||||
|
||||
if (state.getBlock() == this && getMetaFromState(state) == 0 && tile instanceof TileMasterRitualStone)
|
||||
if (getMetaFromState(state) == 0 && tile instanceof TileMasterRitualStone)
|
||||
((TileMasterRitualStone) tile).stopRitual(Ritual.BreakType.EXPLOSION);
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue