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