use of net.minecraft.util.EnumFacing in project ImmersiveEngineering by BluSunrize.
the class TileEntityConnectorLV method getConnectionOffset.
@Override
public Vec3d getConnectionOffset(Connection con) {
EnumFacing side = facing.getOpposite();
double conRadius = con.cableType.getRenderDiameter() / 2;
return new Vec3d(.5 - conRadius * side.getFrontOffsetX(), .5 - conRadius * side.getFrontOffsetY(), .5 - conRadius * side.getFrontOffsetZ());
}
use of net.minecraft.util.EnumFacing in project ImmersiveEngineering by BluSunrize.
the class TileEntityConnectorMV method getConnectionOffset.
@Override
public Vec3d getConnectionOffset(Connection con) {
EnumFacing side = facing.getOpposite();
double conRadius = con.cableType.getRenderDiameter() / 2;
return new Vec3d(.5 + side.getFrontOffsetX() * (.0625 - conRadius), .5 + side.getFrontOffsetY() * (.0625 - conRadius), .5 + side.getFrontOffsetZ() * (.0625 - conRadius));
}
use of net.minecraft.util.EnumFacing in project ImmersiveEngineering by BluSunrize.
the class TileEntityCrusher method getAdvancedSelectionBounds.
@Override
public List<AxisAlignedBB> getAdvancedSelectionBounds() {
if (pos % 15 == 7)
return null;
EnumFacing fl = facing;
EnumFacing fw = facing.rotateY();
if (mirrored)
fw = fw.getOpposite();
if (pos == 4) {
List<AxisAlignedBB> list = Lists.newArrayList(new AxisAlignedBB(0, 0, 0, 1, .5f, 1).offset(getPos().getX(), getPos().getY(), getPos().getZ()));
float minX = fl == EnumFacing.WEST ? .625f : fl == EnumFacing.EAST ? .125f : .125f;
float maxX = fl == EnumFacing.EAST ? .375f : fl == EnumFacing.WEST ? .875f : .25f;
float minZ = fl == EnumFacing.NORTH ? .625f : fl == EnumFacing.SOUTH ? .125f : .125f;
float maxZ = fl == EnumFacing.SOUTH ? .375f : fl == EnumFacing.NORTH ? .875f : .25f;
list.add(new AxisAlignedBB(minX, .5f, minZ, maxX, 1, maxZ).offset(getPos().getX(), getPos().getY(), getPos().getZ()));
minX = fl == EnumFacing.WEST ? .625f : fl == EnumFacing.EAST ? .125f : .75f;
maxX = fl == EnumFacing.EAST ? .375f : fl == EnumFacing.WEST ? .875f : .875f;
minZ = fl == EnumFacing.NORTH ? .625f : fl == EnumFacing.SOUTH ? .125f : .75f;
maxZ = fl == EnumFacing.SOUTH ? .375f : fl == EnumFacing.NORTH ? .875f : .875f;
list.add(new AxisAlignedBB(minX, .5f, minZ, maxX, 1, maxZ).offset(getPos().getX(), getPos().getY(), getPos().getZ()));
return list;
}
if ((pos > 20 && pos < 24) || (pos > 35 && pos < 39)) {
List<AxisAlignedBB> list = new ArrayList<AxisAlignedBB>(3);
float minY = .5f;
float minX = (pos % 5 == 1 && fw == EnumFacing.EAST) || (pos % 5 == 3 && fw == EnumFacing.WEST) ? .4375f : 0;
float maxX = (pos % 5 == 1 && fw == EnumFacing.WEST) || (pos % 5 == 3 && fw == EnumFacing.EAST) ? .5625f : 1;
float minZ = (pos % 5 == 1 && fw == EnumFacing.SOUTH) || (pos % 5 == 3 && fw == EnumFacing.NORTH) ? .4375f : 0;
float maxZ = (pos % 5 == 1 && fw == EnumFacing.NORTH) || (pos % 5 == 3 && fw == EnumFacing.SOUTH) ? .5625f : 1;
if (pos > 20 && pos < 24)
list.add(new AxisAlignedBB(minX, .5f, minZ, maxX, .75f, maxZ).offset(getPos().getX(), getPos().getY(), getPos().getZ()));
else
minY = 0;
minX = (pos % 5 == 1 && fw == EnumFacing.EAST) || (pos % 5 == 3 && fw == EnumFacing.WEST) ? .1875f : (pos % 5 == 1 && fw == EnumFacing.WEST) || (pos % 5 == 3 && fw == EnumFacing.EAST) ? .5625f : 0;
maxX = (pos % 5 == 1 && fw == EnumFacing.WEST) || (pos % 5 == 3 && fw == EnumFacing.EAST) ? .8125f : (pos % 5 == 1 && fw == EnumFacing.EAST) || (pos % 5 == 3 && fw == EnumFacing.WEST) ? .4375f : 1;
minZ = (pos % 5 == 1 && fw == EnumFacing.SOUTH) || (pos % 5 == 3 && fw == EnumFacing.NORTH) ? .1875f : (pos % 5 == 1 && fw == EnumFacing.NORTH) || (pos % 5 == 3 && fw == EnumFacing.SOUTH) ? .5625f : 0;
maxZ = (pos % 5 == 1 && fw == EnumFacing.NORTH) || (pos % 5 == 3 && fw == EnumFacing.SOUTH) ? .8125f : (pos % 5 == 1 && fw == EnumFacing.SOUTH) || (pos % 5 == 3 && fw == EnumFacing.NORTH) ? .4375f : 1;
list.add(new AxisAlignedBB(minX, minY, minZ, maxX, 1, maxZ).offset(getPos().getX(), getPos().getY(), getPos().getZ()));
return list;
}
if ((pos > 15 && pos < 19) || (pos > 30 && pos < 34) || (pos > 25 && pos < 29) || (pos > 40 && pos < 44)) {
if (pos % 15 > 9)
fl = fl.getOpposite();
List<AxisAlignedBB> list = new ArrayList<AxisAlignedBB>(3);
float minY = .5f;
float minX = (pos % 5 == 1 && fw == EnumFacing.EAST) || (pos % 5 == 3 && fw == EnumFacing.WEST) ? .4375f : fl == EnumFacing.EAST ? .4375f : 0;
float maxX = (pos % 5 == 1 && fw == EnumFacing.WEST) || (pos % 5 == 3 && fw == EnumFacing.EAST) ? .5625f : fl == EnumFacing.WEST ? .5625f : 1;
float minZ = (pos % 5 == 1 && fw == EnumFacing.SOUTH) || (pos % 5 == 3 && fw == EnumFacing.NORTH) ? .4375f : fl == EnumFacing.SOUTH ? .4375f : 0;
float maxZ = (pos % 5 == 1 && fw == EnumFacing.NORTH) || (pos % 5 == 3 && fw == EnumFacing.SOUTH) ? .5625f : fl == EnumFacing.NORTH ? .5625f : 1;
if ((pos > 15 && pos < 19) || (pos > 25 && pos < 29))
list.add(new AxisAlignedBB(minX, .5f, minZ, maxX, .75f, maxZ).offset(getPos().getX(), getPos().getY(), getPos().getZ()));
else
minY = 0;
if (pos / 15 > 9)
fl = fl.getOpposite();
minX = (pos % 5 == 1 && fw == EnumFacing.EAST) || (pos % 5 == 3 && fw == EnumFacing.WEST) ? .1875f : fl == EnumFacing.EAST ? .1875f : fl == EnumFacing.WEST ? .5625f : 0;
maxX = (pos % 5 == 1 && fw == EnumFacing.WEST) || (pos % 5 == 3 && fw == EnumFacing.EAST) ? .8125f : fl == EnumFacing.WEST ? .8125f : fl == EnumFacing.EAST ? .4375f : 1;
minZ = (pos % 5 == 1 && fw == EnumFacing.SOUTH) || (pos % 5 == 3 && fw == EnumFacing.NORTH) ? .1875f : fl == EnumFacing.SOUTH ? .1875f : fl == EnumFacing.NORTH ? .5625f : 0;
maxZ = (pos % 5 == 1 && fw == EnumFacing.NORTH) || (pos % 5 == 3 && fw == EnumFacing.SOUTH) ? .8125f : fl == EnumFacing.NORTH ? .8125f : fl == EnumFacing.SOUTH ? .4375f : 1;
list.add(new AxisAlignedBB(minX, minY, minZ, maxX, 1, maxZ).offset(getPos().getX(), getPos().getY(), getPos().getZ()));
if (pos != 17 && pos != 32 && pos != 27 && pos != 42) {
minX = (pos % 5 == 1 && fw == EnumFacing.EAST) || (pos % 5 == 3 && fw == EnumFacing.WEST) ? .1875f : fl == EnumFacing.EAST ? .4375f : fl == EnumFacing.WEST ? 0 : .5625f;
maxX = (pos % 5 == 1 && fw == EnumFacing.WEST) || (pos % 5 == 3 && fw == EnumFacing.EAST) ? .8125f : fl == EnumFacing.WEST ? .5625f : fl == EnumFacing.EAST ? 1 : .4375f;
minZ = (pos % 5 == 1 && fw == EnumFacing.SOUTH) || (pos % 5 == 3 && fw == EnumFacing.NORTH) ? .1875f : fl == EnumFacing.SOUTH ? .4375f : fl == EnumFacing.NORTH ? 0 : .5625f;
maxZ = (pos % 5 == 1 && fw == EnumFacing.NORTH) || (pos % 5 == 3 && fw == EnumFacing.SOUTH) ? .8125f : fl == EnumFacing.NORTH ? .5625f : fl == EnumFacing.SOUTH ? 1 : .4375f;
list.add(new AxisAlignedBB(minX, minY, minZ, maxX, 1, maxZ).offset(getPos().getX(), getPos().getY(), getPos().getZ()));
if (pos % 15 % 10 == 1)
fw = fw.getOpposite();
if ((pos > 15 && pos < 19) || (pos > 25 && pos < 29)) {
minX = fl == EnumFacing.WEST ? .5f : fl == EnumFacing.EAST ? .25f : fw == EnumFacing.EAST ? .5f : .25f;
maxX = fl == EnumFacing.EAST ? .5f : fl == EnumFacing.WEST ? .75f : fw == EnumFacing.EAST ? .75f : .5f;
minZ = fl == EnumFacing.NORTH ? .5f : fl == EnumFacing.SOUTH ? .25f : fw == EnumFacing.SOUTH ? .5f : .25f;
maxZ = fl == EnumFacing.SOUTH ? .5f : fl == EnumFacing.NORTH ? .75f : fw == EnumFacing.SOUTH ? .75f : .5f;
list.add(new AxisAlignedBB(minX, 0, minZ, maxX, .5f, maxZ).offset(getPos().getX(), getPos().getY(), getPos().getZ()));
}
}
return list;
}
if (pos == 1 || pos == 3 || pos == 11 || pos == 13) {
List<AxisAlignedBB> list = Lists.newArrayList(new AxisAlignedBB(0, 0, 0, 1, .5f, 1).offset(getPos().getX(), getPos().getY(), getPos().getZ()));
if (pos % 15 > 9)
fl = fl.getOpposite();
if (pos % 15 % 10 == 1)
fw = fw.getOpposite();
float minX = fl == EnumFacing.WEST ? .5f : fl == EnumFacing.EAST ? .25f : fw == EnumFacing.EAST ? .5f : .25f;
float maxX = fl == EnumFacing.EAST ? .5f : fl == EnumFacing.WEST ? .75f : fw == EnumFacing.EAST ? .75f : .5f;
float minZ = fl == EnumFacing.NORTH ? .5f : fl == EnumFacing.SOUTH ? .25f : fw == EnumFacing.SOUTH ? .5f : .25f;
float maxZ = fl == EnumFacing.SOUTH ? .5f : fl == EnumFacing.NORTH ? .75f : fw == EnumFacing.SOUTH ? .75f : .5f;
list.add(new AxisAlignedBB(minX, .5f, minZ, maxX, 1, maxZ).offset(getPos().getX(), getPos().getY(), getPos().getZ()));
return list;
}
return null;
}
use of net.minecraft.util.EnumFacing in project ImmersiveEngineering by BluSunrize.
the class TileEntityCrusher method getBlockBounds.
@Override
public float[] getBlockBounds() {
if (pos == 1 || pos == 3 || pos == 4 || pos == 6 || pos == 8 || pos == 11 || pos == 12 || pos == 13 || pos == 14 || pos == 24)
return new float[] { 0, 0, 0, 1, .5f, 1 };
if (pos == 22)
return new float[] { 0, 0, 0, 1, .75f, 1 };
if (pos == 37)
return new float[] { 0, 0, 0, 0, 0, 0 };
EnumFacing fl = facing;
EnumFacing fw = facing.rotateY();
if (mirrored)
fw = fw.getOpposite();
if (pos > 15 && pos % 5 > 0 && pos % 5 < 4) {
float minX = 0;
float maxX = 1;
float minZ = 0;
float maxZ = 1;
if (pos % 5 == 1) {
minX = fw == EnumFacing.EAST ? .1875f : 0;
maxX = fw == EnumFacing.WEST ? .8125f : 1;
minZ = fw == EnumFacing.SOUTH ? .1875f : 0;
maxZ = fw == EnumFacing.NORTH ? .8125f : 1;
} else if (pos % 5 == 3) {
minX = fw == EnumFacing.WEST ? .1875f : 0;
maxX = fw == EnumFacing.EAST ? .8125f : 1;
minZ = fw == EnumFacing.NORTH ? .1875f : 0;
maxZ = fw == EnumFacing.SOUTH ? .8125f : 1;
}
if ((pos % 15) / 5 == 0) {
if (fl == EnumFacing.EAST)
minX = .1875f;
if (fl == EnumFacing.WEST)
maxX = .8125f;
if (fl == EnumFacing.SOUTH)
minZ = .1875f;
if (fl == EnumFacing.NORTH)
maxZ = .8125f;
}
return new float[] { minX, 0, minZ, maxX, 1, maxZ };
}
if (pos == 19)
return new float[] { facing == EnumFacing.WEST ? .5f : 0, 0, facing == EnumFacing.NORTH ? .5f : 0, facing == EnumFacing.EAST ? .5f : 1, 1, facing == EnumFacing.SOUTH ? .5f : 1 };
return new float[] { 0, 0, 0, 1, 1, 1 };
}
use of net.minecraft.util.EnumFacing in project ImmersiveEngineering by BluSunrize.
the class TileEntityDieselGenerator method update.
@Override
public void update() {
super.update();
if (isDummy())
return;
if (active || animation_fanFadeIn > 0 || animation_fanFadeOut > 0) {
float base = 18f;
float step = active ? base : 0;
if (animation_fanFadeIn > 0) {
step -= (animation_fanFadeIn / 80f) * base;
animation_fanFadeIn--;
}
if (animation_fanFadeOut > 0) {
step += (animation_fanFadeOut / 80f) * base;
animation_fanFadeOut--;
}
animation_fanRotationStep = step;
animation_fanRotation += step;
animation_fanRotation %= 360;
}
if (worldObj.isRemote) {
ImmersiveEngineering.proxy.handleTileSound(IESounds.dieselGenerator, this, active, .5f, 1);
if (active && worldObj.getTotalWorldTime() % 4 == 0) {
BlockPos exhaust = this.getBlockPosForPos(38);
EnumFacing fl = facing;
EnumFacing fw = facing.rotateY();
if (mirrored)
fw = fw.getOpposite();
worldObj.spawnParticle(EnumParticleTypes.SMOKE_LARGE, exhaust.getX() + .5 + (fl.getFrontOffsetX() * .3125f) + (-fw.getFrontOffsetX() * .3125f), exhaust.getY() + 1.25, exhaust.getZ() + .5 + (fl.getFrontOffsetZ() * .3125f) + (-fw.getFrontOffsetZ() * .3125f), 0, 0, 0);
}
} else {
boolean prevActive = active;
if (!isRSDisabled() && tanks[0].getFluid() != null && tanks[0].getFluid().getFluid() != null) {
int burnTime = DieselHandler.getBurnTime(tanks[0].getFluid().getFluid());
if (burnTime > 0) {
int fluidConsumed = 1000 / burnTime;
int output = IEConfig.Machines.dieselGen_output;
int connected = 0;
TileEntity[] receivers = new TileEntity[3];
for (int i = 0; i < 3; i++) {
receivers[i] = getEnergyOutput(i == 1 ? -1 : i == 2 ? 1 : 0);
if (receivers[i] != null) {
if (EnergyHelper.insertFlux(receivers[i], EnumFacing.DOWN, 4096, true) > 0)
connected++;
}
}
if (connected > 0 && tanks[0].getFluidAmount() >= fluidConsumed) {
if (!active) {
active = true;
animation_fanFadeIn = 80;
}
tanks[0].drain(fluidConsumed, true);
int splitOutput = output / connected;
int leftover = output % connected;
for (int i = 0; i < 3; i++) if (receivers[i] != null)
EnergyHelper.insertFlux(receivers[i], EnumFacing.DOWN, splitOutput + (leftover-- > 0 ? 1 : 0), false);
} else if (active) {
active = false;
animation_fanFadeOut = 80;
}
}
} else if (active) {
active = false;
animation_fanFadeOut = 80;
}
if (prevActive != active) {
this.markDirty();
this.markContainingBlockForUpdate(null);
}
}
}
Aggregations