Permalink
Browse files

Refactorization

  • Loading branch information...
Ri5ux committed Nov 5, 2017
1 parent d7cd2e9 commit c049721be5306d4eb2ddf1c0da907605401a9476
@@ -69,6 +69,7 @@
import org.avp.tile.TileEntityAmpule;
import org.avp.tile.TileEntityAssembler;
import org.avp.tile.TileEntityBlastdoor;
import org.avp.tile.TileEntityCCFLTube;
import org.avp.tile.TileEntityCryostasisTube;
import org.avp.tile.TileEntityGunLocker;
import org.avp.tile.TileEntityHiveResin;
@@ -144,6 +145,7 @@ public void registerTileEntities()
GameRegistry.registerTileEntity(TileEntitySevastopolBlastDoor.class, "tileEntitySevastopolBlastdoor");
GameRegistry.registerTileEntity(TileEntityCryostasisTube.class, "tileEntityCryostasisTube");
GameRegistry.registerTileEntity(TileEntityLightPanel.class, "tileEntityLightPanel");
GameRegistry.registerTileEntity(TileEntityCCFLTube.class, "tileEntityCCFLTube");
GameRegistry.registerTileEntity(TileEntitySatelliteModem.class, "tileEntitySatelliteModem");
GameRegistry.registerTileEntity(TileEntitySatelliteDish.class, "tileEntitySatelliteDish");
GameRegistry.registerTileEntity(TileEntityTransformer.class, "tileEntityTransformer");
@@ -32,7 +32,7 @@ public void onBlockPlacedBy(World world, BlockPos pos, IBlockState state, Entity
if (tile != null && tile instanceof TileEntityAmpule && placer != null)
{
TileEntityAmpule ampule = (TileEntityAmpule) tile;
ampule.setDirection(Entities.getDirectionFacing(placer));
ampule.setRotationYAxis(Entities.getEntityFacingRotY(placer));
}
}
@@ -163,7 +163,7 @@ public void onBlockPlacedBy(World world, BlockPos pos, IBlockState state, Entity
{
TileEntityBlastdoor blastdoor = (TileEntityBlastdoor) tile;
blastdoor.setDirection(Entities.getDirectionFacing(placer));
blastdoor.setRotationYAxis(Entities.getEntityFacingRotY(placer));
if (!blastdoor.setup(true))
{
@@ -78,7 +78,7 @@ public void onBlockPlacedBy(World world, BlockPos pos, IBlockState state, Entity
if (tile != null)
{
tile.setDirection(Entities.getDirectionFacing(placer));
tile.setRotationYAxis(Entities.getEntityFacingRotY(placer));
world.markBlockRangeForRenderUpdate(pos, pos);
}
}
@@ -3,7 +3,7 @@
import org.avp.tile.TileEntityLocker;
import com.arisux.mdx.lib.world.entity.Entities;
import com.arisux.mdx.lib.world.tile.IRotatable;
import com.arisux.mdx.lib.world.tile.IRotatableYAxis;
import net.minecraft.block.Block;
import net.minecraft.block.material.Material;
@@ -100,10 +100,10 @@ public void onBlockPlacedBy(World world, BlockPos pos, IBlockState state, Entity
{
TileEntity tile = world.getTileEntity(pos);
if (tile != null && tile instanceof IRotatable && placer != null)
if (tile != null && tile instanceof IRotatableYAxis && placer != null)
{
IRotatable rotatable = (IRotatable) tile;
rotatable.setDirection(Entities.getDirectionFacing(placer));
IRotatableYAxis rotatable = (IRotatableYAxis) tile;
rotatable.setRotationYAxis(Entities.getEntityFacingRotY(placer));
}
}
@@ -4,7 +4,7 @@
import org.avp.tile.TileEntityMedpod;
import com.arisux.mdx.lib.world.entity.Entities;
import com.arisux.mdx.lib.world.tile.IRotatable;
import com.arisux.mdx.lib.world.tile.IRotatableYAxis;
import net.minecraft.block.Block;
import net.minecraft.block.material.Material;
@@ -66,10 +66,10 @@ public void onBlockPlacedBy(World world, BlockPos pos, IBlockState state, Entity
{
TileEntity tile = world.getTileEntity(pos);
if (tile != null && tile instanceof IRotatable && placer != null)
if (tile != null && tile instanceof IRotatableYAxis && placer != null)
{
IRotatable rotatable = (IRotatable) tile;
rotatable.setDirection(Entities.getDirectionFacing(placer));
IRotatableYAxis rotatable = (IRotatableYAxis) tile;
rotatable.setRotationYAxis(Entities.getEntityFacingRotY(placer));
}
}
@@ -58,9 +58,9 @@ public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, En
}
}
if (generator.getDirection() != null)
if (generator.getRotationYAxis() != null)
{
int index = EnumFacings.indexOf(generator.getDirection());
int index = EnumFacings.indexOf(generator.getRotationYAxis());
if (index + 1 >= EnumFacings.size())
{
@@ -69,12 +69,12 @@ public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, En
if (EnumFacings.get(index + 1) != null)
{
generator.setDirection(EnumFacings.get(index + 1));
generator.setRotationYAxis(EnumFacings.get(index + 1));
}
if (!world.isRemote)
{
AliensVsPredator.network().sendToAll(new PacketRotateRotatable(generator.getDirection().ordinal(), generator.getPos().getX(), generator.getPos().getY(), generator.getPos().getZ()));
AliensVsPredator.network().sendToAll(new PacketRotateRotatable(generator.getRotationYAxis().ordinal(), generator.getPos().getX(), generator.getPos().getY(), generator.getPos().getZ()));
}
}
@@ -73,7 +73,7 @@ public void onBlockPlacedBy(World world, BlockPos pos, IBlockState state, Entity
if (tile != null && tile instanceof TileEntitySkull && placer != null)
{
TileEntitySkull skull = (TileEntitySkull) tile;
skull.setDirection(Entities.getDirectionFacing(placer));
skull.setRotationYAxis(Entities.getEntityFacingRotY(placer));
}
}
@@ -7,7 +7,7 @@
import org.avp.tile.TileEntitySupplyCrate;
import com.arisux.mdx.lib.world.entity.Entities;
import com.arisux.mdx.lib.world.tile.IRotatable;
import com.arisux.mdx.lib.world.tile.IRotatableYAxis;
import net.minecraft.block.BlockFalling;
import net.minecraft.block.material.Material;
@@ -121,10 +121,10 @@ public void onBlockPlacedBy(World world, BlockPos pos, IBlockState state, Entity
{
TileEntity tile = world.getTileEntity(pos);
if (tile != null && tile instanceof IRotatable && placer != null)
if (tile != null && tile instanceof IRotatableYAxis && placer != null)
{
IRotatable rotatable = (IRotatable) tile;
rotatable.setDirection(Entities.getDirectionFacing(placer));
IRotatableYAxis rotatable = (IRotatableYAxis) tile;
rotatable.setRotationYAxis(Entities.getEntityFacingRotY(placer));
}
}
@@ -77,9 +77,9 @@ public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, En
}
}
if (transformer.getDirection() != null)
if (transformer.getRotationYAxis() != null)
{
int index = EnumFacings.indexOf(transformer.getDirection());
int index = EnumFacings.indexOf(transformer.getRotationYAxis());
if (index + 1 >= EnumFacings.size())
{
@@ -88,12 +88,12 @@ public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, En
if (EnumFacings.get(index + 1) != null)
{
transformer.setDirection(EnumFacings.get(index + 1));
transformer.setRotationYAxis(EnumFacings.get(index + 1));
}
if (!world.isRemote)
{
AliensVsPredator.network().sendToAll(new PacketRotateRotatable(transformer.getDirection().ordinal(), transformer.getPos().getX(), transformer.getPos().getY(), transformer.getPos().getZ()));
AliensVsPredator.network().sendToAll(new PacketRotateRotatable(transformer.getRotationYAxis().ordinal(), transformer.getPos().getX(), transformer.getPos().getY(), transformer.getPos().getZ()));
}
}
@@ -55,7 +55,7 @@ public void renderWorldLastEvent(RenderWorldLastEvent event)
if (t instanceof TileEntityBlastdoor)
{
TileEntityBlastdoor bd = (TileEntityBlastdoor) t;
List<BlockPos> blocks = new ArrayList<BlockPos>(Arrays.asList(bd.setFor(Entities.getDirectionFacing(p))));
List<BlockPos> blocks = new ArrayList<BlockPos>(Arrays.asList(bd.setFor(Entities.getEntityFacingRotY(p))));
blocks.add(new BlockPos(0, 0, 0));
Vec3d hitVec = Game.minecraft().objectMouseOver.hitVec;
@@ -26,22 +26,22 @@ public void renderTileEntityAt(TileEntityTransformer tile, double x, double y, d
OpenGL.scale(1F, -1F, 1F);
OpenGL.translate(0.5F, -1.5F, 0.5F);
if (transformer.getDirection() == EnumFacing.EAST)
if (transformer.getRotationYAxis() == EnumFacing.EAST)
{
OpenGL.rotate(90F, 0F, 1F, 0F);
}
if (transformer.getDirection() == EnumFacing.WEST)
if (transformer.getRotationYAxis() == EnumFacing.WEST)
{
OpenGL.rotate(-90F, 0F, 1F, 0F);
}
if (transformer.getDirection() == EnumFacing.NORTH)
if (transformer.getRotationYAxis() == EnumFacing.NORTH)
{
OpenGL.rotate(180F, 0F, 1F, 0F);
}
if (transformer.getDirection() == EnumFacing.SOUTH)
if (transformer.getRotationYAxis() == EnumFacing.SOUTH)
{
OpenGL.rotate(0F, 0F, 1F, 0F);
}
@@ -1,7 +1,7 @@
package org.avp.packets.client;
import com.arisux.mdx.lib.game.Game;
import com.arisux.mdx.lib.world.tile.IRotatable;
import com.arisux.mdx.lib.world.tile.IRotatableYAxis;
import io.netty.buffer.ByteBuf;
import net.minecraft.tileentity.TileEntity;
@@ -65,10 +65,10 @@ public void run()
{
TileEntity tile = world.getTileEntity(new BlockPos(packet.x, packet.y, packet.z));
if (tile != null && tile instanceof IRotatable)
if (tile != null && tile instanceof IRotatableYAxis)
{
IRotatable rotatable = (IRotatable) tile;
rotatable.setDirection(EnumFacing.getFront(packet.direction));
IRotatableYAxis rotatable = (IRotatableYAxis) tile;
rotatable.setRotationYAxis(EnumFacing.getFront(packet.direction));
}
}
}
@@ -1,14 +1,14 @@
package org.avp.tile;
import com.arisux.mdx.lib.world.tile.IRotatable;
import com.arisux.mdx.lib.world.tile.IRotatableYAxis;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.network.NetworkManager;
import net.minecraft.network.play.server.SPacketUpdateTileEntity;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.EnumFacing;
public class TileEntityAmpule extends TileEntity implements IRotatable
public class TileEntityAmpule extends TileEntity implements IRotatableYAxis
{
private EnumFacing direction;
@@ -55,13 +55,13 @@ public void readFromNBT(NBTTagCompound nbt)
}
@Override
public EnumFacing getDirection()
public EnumFacing getRotationYAxis()
{
return direction;
}
@Override
public void setDirection(EnumFacing direction)
public void setRotationYAxis(EnumFacing direction)
{
this.direction = direction;
}
@@ -3,7 +3,7 @@
import org.avp.api.power.IVoltageReceiver;
import org.avp.item.ItemEntitySummoner;
import com.arisux.mdx.lib.world.tile.IRotatable;
import com.arisux.mdx.lib.world.tile.IRotatableYAxis;
import net.minecraft.block.Block;
import net.minecraft.entity.Entity;
@@ -16,7 +16,7 @@
import net.minecraft.util.ITickable;
public class TileEntityCryostasisTube extends TileEntityElectrical implements IVoltageReceiver, IRotatable, ITickable
public class TileEntityCryostasisTube extends TileEntityElectrical implements IVoltageReceiver, IRotatableYAxis, ITickable
{
private EnumFacing direction;
public Entity stasisEntity;
@@ -196,13 +196,13 @@ public int getTicksExisted()
}
@Override
public EnumFacing getDirection()
public EnumFacing getRotationYAxis()
{
return this.direction;
}
@Override
public void setDirection(EnumFacing facing)
public void setRotationYAxis(EnumFacing facing)
{
this.direction = facing;
}
@@ -2,7 +2,6 @@
import org.avp.api.power.IVoltageReceiver;
import net.minecraft.block.state.IBlockState;
import net.minecraft.util.EnumFacing;
import net.minecraft.world.EnumSkyBlock;
@@ -6,7 +6,7 @@
import org.avp.item.ItemFirearm;
import org.avp.packets.client.PacketOpenable;
import com.arisux.mdx.lib.world.tile.IRotatable;
import com.arisux.mdx.lib.world.tile.IRotatableYAxis;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.inventory.Container;
@@ -23,7 +23,7 @@
import net.minecraftforge.fml.common.network.internal.FMLNetworkHandler;
public class TileEntityLocker extends TileEntity implements IOpenable, IRotatable
public class TileEntityLocker extends TileEntity implements IOpenable, IRotatableYAxis
{
public IInventory inventory;
private EnumFacing direction;
@@ -145,13 +145,13 @@ public void openGui(EntityPlayer player)
}
@Override
public EnumFacing getDirection()
public EnumFacing getRotationYAxis()
{
return direction;
}
@Override
public void setDirection(EnumFacing direction)
public void setRotationYAxis(EnumFacing direction)
{
this.direction = direction;
}
@@ -7,7 +7,7 @@
import org.avp.packets.client.PacketOpenable;
import com.arisux.mdx.lib.world.entity.Entities;
import com.arisux.mdx.lib.world.tile.IRotatable;
import com.arisux.mdx.lib.world.tile.IRotatableYAxis;
import net.minecraft.entity.Entity;
import net.minecraft.nbt.NBTTagCompound;
@@ -16,7 +16,7 @@
import net.minecraft.util.EnumFacing;
public class TileEntityMedpod extends TileEntityElectrical implements IOpenable, IVoltageReceiver, IRotatable
public class TileEntityMedpod extends TileEntityElectrical implements IOpenable, IVoltageReceiver, IRotatableYAxis
{
private EnumFacing direction;
private boolean isOpen;
@@ -104,16 +104,16 @@ public void update()
{
float rotation = 0F;
if (this.getDirection() == EnumFacing.NORTH)
if (this.getRotationYAxis() == EnumFacing.NORTH)
rotation = 0F;
if (this.getDirection() == EnumFacing.SOUTH)
if (this.getRotationYAxis() == EnumFacing.SOUTH)
rotation = 180F;
if (this.getDirection() == EnumFacing.EAST)
if (this.getRotationYAxis() == EnumFacing.EAST)
rotation = 90F;
if (this.getDirection() == EnumFacing.WEST)
if (this.getRotationYAxis() == EnumFacing.WEST)
rotation = -90F;
this.getEntity().setLocationAndAngles(this.getPos().getX() + getEntity().width / 2, this.getPos().getY(), this.getPos().getZ() + getEntity().width / 2, rotation, 0F);
@@ -131,13 +131,13 @@ public void update()
}
@Override
public EnumFacing getDirection()
public EnumFacing getRotationYAxis()
{
return direction;
}
@Override
public void setDirection(EnumFacing direction)
public void setRotationYAxis(EnumFacing direction)
{
this.direction = direction;
}
Oops, something went wrong.

0 comments on commit c049721

Please sign in to comment.