Start on the update

This commit is contained in:
modmuss50 2016-11-19 12:50:08 +00:00
parent c8d8ce0241
commit a0e6a2dc34
No known key found for this signature in database
GPG key ID: 773D17BE8BF49C82
112 changed files with 522 additions and 503 deletions

View file

@ -107,7 +107,7 @@ public class TileDieselGenerator extends TilePowerAcceptor implements IWrenchabl
@Override
public void onDataPacket(NetworkManager net, SPacketUpdateTileEntity packet) {
worldObj.markBlockRangeForRenderUpdate(getPos().getX(), getPos().getY(), getPos().getZ(), getPos().getX(),
world.markBlockRangeForRenderUpdate(getPos().getX(), getPos().getY(), getPos().getZ(), getPos().getX(),
getPos().getY(), getPos().getZ());
readFromNBT(packet.getNbtCompound());
}
@ -115,7 +115,7 @@ public class TileDieselGenerator extends TilePowerAcceptor implements IWrenchabl
@Override
public void updateEntity() {
super.updateEntity();
if (!worldObj.isRemote) {
if (!world.isRemote) {
FluidUtils.drainContainers(this, inventory, 0, 1);
FluidUtils.fillContainers(this, inventory, 0, 1, tank.getFluidType());
if (tank.getFluidType() != null && getStackInSlot(2) == null) {

View file

@ -26,8 +26,8 @@ public class TileDragonEggSiphoner extends TilePowerAcceptor implements IWrencha
public void updateEntity() {
super.updateEntity();
if (!worldObj.isRemote) {
if (worldObj.getBlockState(new BlockPos(getPos().getX(), getPos().getY() + 1, getPos().getZ()))
if (!world.isRemote) {
if (world.getBlockState(new BlockPos(getPos().getX(), getPos().getY() + 1, getPos().getZ()))
.getBlock() == Blocks.DRAGON_EGG) {
addEnergy(euTick);
}

View file

@ -120,7 +120,7 @@ public class TileGasTurbine extends TilePowerAcceptor implements IWrenchable, IF
@Override
public void onDataPacket(NetworkManager net, SPacketUpdateTileEntity packet) {
worldObj.markBlockRangeForRenderUpdate(getPos().getX(), getPos().getY(), getPos().getZ(), getPos().getX(),
world.markBlockRangeForRenderUpdate(getPos().getX(), getPos().getY(), getPos().getZ(), getPos().getX(),
getPos().getY(), getPos().getZ());
readFromNBT(packet.getNbtCompound());
}
@ -128,7 +128,7 @@ public class TileGasTurbine extends TilePowerAcceptor implements IWrenchable, IF
@Override
public void updateEntity() {
super.updateEntity();
if (!worldObj.isRemote) {
if (!world.isRemote) {
FluidUtils.drainContainers(this, inventory, 0, 1);
tank.compareAndUpdate();
}

View file

@ -38,7 +38,7 @@ public class TileGenerator extends TilePowerAcceptor implements IWrenchable, IIn
@Override
public void updateEntity() {
super.updateEntity();
if (worldObj.isRemote) {
if (world.isRemote) {
return;
}
if (getEnergy() < getMaxPower()) {
@ -57,7 +57,7 @@ public class TileGenerator extends TilePowerAcceptor implements IWrenchable, IIn
if (burnTime > 0) {
updateState();
burnItem = getStackInSlot(fuelSlot);
if (getStackInSlot(fuelSlot).stackSize == 1) {
if (getStackInSlot(fuelSlot).getCount() == 1) {
if(getStackInSlot(fuelSlot).getItem() == Items.LAVA_BUCKET || getStackInSlot(fuelSlot).getItem() == ForgeModContainer.getInstance().universalBucket){
setInventorySlotContents(fuelSlot, new ItemStack(Items.BUCKET));
} else {
@ -74,11 +74,11 @@ public class TileGenerator extends TilePowerAcceptor implements IWrenchable, IIn
}
public void updateState() {
IBlockState BlockStateContainer = worldObj.getBlockState(pos);
IBlockState BlockStateContainer = world.getBlockState(pos);
if (BlockStateContainer.getBlock() instanceof BlockMachineBase) {
BlockMachineBase blockMachineBase = (BlockMachineBase) BlockStateContainer.getBlock();
if (BlockStateContainer.getValue(BlockMachineBase.ACTIVE) != burnTime > 0)
blockMachineBase.setActive(burnTime > 0, worldObj, pos);
blockMachineBase.setActive(burnTime > 0, world, pos);
}
}

View file

@ -23,20 +23,20 @@ public class TileHeatGenerator extends TilePowerAcceptor implements IWrenchable
public void updateEntity() {
super.updateEntity();
if (!worldObj.isRemote) {
if (worldObj.getBlockState(new BlockPos(getPos().getX() + 1, getPos().getY(), getPos().getZ()))
if (!world.isRemote) {
if (world.getBlockState(new BlockPos(getPos().getX() + 1, getPos().getY(), getPos().getZ()))
.getBlock() == Blocks.LAVA) {
addEnergy(euTick);
} else if (worldObj.getBlockState(new BlockPos(getPos().getX(), getPos().getY(), getPos().getZ() + 1))
} else if (world.getBlockState(new BlockPos(getPos().getX(), getPos().getY(), getPos().getZ() + 1))
.getBlock() == Blocks.LAVA) {
addEnergy(euTick);
} else if (worldObj.getBlockState(new BlockPos(getPos().getX(), getPos().getY(), getPos().getZ() - 1))
} else if (world.getBlockState(new BlockPos(getPos().getX(), getPos().getY(), getPos().getZ() - 1))
.getBlock() == Blocks.LAVA) {
addEnergy(euTick);
} else if (worldObj.getBlockState(new BlockPos(getPos().getX() - 1, getPos().getY(), getPos().getZ()))
} else if (world.getBlockState(new BlockPos(getPos().getX() - 1, getPos().getY(), getPos().getZ()))
.getBlock() == Blocks.LAVA) {
addEnergy(euTick);
} else if (worldObj.getBlockState(new BlockPos(getPos().getX(), getPos().getY() - 1, getPos().getZ()))
} else if (world.getBlockState(new BlockPos(getPos().getX(), getPos().getY() - 1, getPos().getZ()))
.getBlock() == Blocks.LAVA) {
addEnergy(euTick);
}

View file

@ -28,24 +28,24 @@ public class TileLightningRod extends TilePowerAcceptor {
if (onStatusHoldTicks == 0 || getEnergy() <= 0) {
if (getBlockType() instanceof BlockMachineBase)
((BlockMachineBase) getBlockType()).setActive(false, worldObj, pos);
((BlockMachineBase) getBlockType()).setActive(false, world, pos);
onStatusHoldTicks = -1;
}
float weatherStrength = worldObj.getThunderStrength(1.0F);
float weatherStrength = world.getThunderStrength(1.0F);
if (weatherStrength > 0.2F) {
//lightStrikeChance = (MAX - (CHANCE * WEATHER_STRENGTH)
float lightStrikeChance = ((100F - ConfigTechReborn.LightningRodChance) * 20F);
float totalChance = lightStrikeChance * getLightningStrikeMultiplier() * ((1.1F - weatherStrength));
if (worldObj.rand.nextInt((int) Math.floor(totalChance)) == 0) {
EntityLightningBolt lightningBolt = new EntityLightningBolt(worldObj,
if (world.rand.nextInt((int) Math.floor(totalChance)) == 0) {
EntityLightningBolt lightningBolt = new EntityLightningBolt(world,
pos.getX() + 0.5F,
worldObj.provider.getAverageGroundLevel(),
world.provider.getAverageGroundLevel(),
pos.getZ() + 0.5F, false);
worldObj.addWeatherEffect(lightningBolt);
worldObj.spawnEntityInWorld(lightningBolt);
world.addWeatherEffect(lightningBolt);
world.spawnEntity(lightningBolt);
addEnergy(32768 * (0.3F + weatherStrength));
((BlockMachineBase) getBlockType()).setActive(true, worldObj, pos);
((BlockMachineBase) getBlockType()).setActive(true, world, pos);
onStatusHoldTicks = 400;
}
}
@ -53,8 +53,8 @@ public class TileLightningRod extends TilePowerAcceptor {
}
public float getLightningStrikeMultiplier() {
float actualHeight = worldObj.provider.getActualHeight();
float groundLevel = worldObj.provider.getAverageGroundLevel();
float actualHeight = world.provider.getActualHeight();
float groundLevel = world.provider.getAverageGroundLevel();
for (int i = pos.getY() + 1; i < actualHeight; i++) {
if (!isValidIronFence(i)) {
if (groundLevel >= i)
@ -68,7 +68,7 @@ public class TileLightningRod extends TilePowerAcceptor {
}
public boolean isValidIronFence(int y) {
Item itemBlock = Item.getItemFromBlock(worldObj.getBlockState(new BlockPos(pos.getX(), y, pos.getZ())).getBlock());
Item itemBlock = Item.getItemFromBlock(world.getBlockState(new BlockPos(pos.getX(), y, pos.getZ())).getBlock());
for (ItemStack fence : OreDictionary.getOres("fenceIron")) {
if (fence.getItem() == itemBlock)
return true;

View file

@ -126,7 +126,7 @@ public class TileSemifluidGenerator extends TilePowerAcceptor implements IWrench
@Override
public void onDataPacket(NetworkManager net, SPacketUpdateTileEntity packet) {
worldObj.markBlockRangeForRenderUpdate(getPos().getX(), getPos().getY(), getPos().getZ(), getPos().getX(),
world.markBlockRangeForRenderUpdate(getPos().getX(), getPos().getY(), getPos().getZ(), getPos().getX(),
getPos().getY(), getPos().getZ());
readFromNBT(packet.getNbtCompound());
}
@ -134,7 +134,7 @@ public class TileSemifluidGenerator extends TilePowerAcceptor implements IWrench
@Override
public void updateEntity() {
super.updateEntity();
if (!worldObj.isRemote)
if (!world.isRemote)
FluidUtils.drainContainers(this, inventory, 0, 1);
if (tank.getFluidAmount() > 0 && getMaxPower() - getEnergy() >= euTick && tank.getFluidType() != null && fluids.containsKey(tank.getFluidType().getName())) {

View file

@ -25,8 +25,8 @@ public class TileSolarPanel extends TilePowerAcceptor implements ITickable {
@Override
public void updateEntity() {
super.updateEntity();
if (!worldObj.isRemote) {
if (worldObj.getTotalWorldTime() % 60 == 0) {
if (!world.isRemote) {
if (world.getTotalWorldTime() % 60 == 0) {
shouldMakePower = isSunOut();
}
@ -37,8 +37,8 @@ public class TileSolarPanel extends TilePowerAcceptor implements ITickable {
powerToAdd = 0;
}
worldObj.setBlockState(getPos(),
worldObj.getBlockState(this.getPos()).withProperty(BlockSolarPanel.ACTIVE, isSunOut()));
world.setBlockState(getPos(),
world.getBlockState(this.getPos()).withProperty(BlockSolarPanel.ACTIVE, isSunOut()));
}
}
@ -54,8 +54,8 @@ public class TileSolarPanel extends TilePowerAcceptor implements ITickable {
}
public boolean isSunOut() {
return worldObj.canBlockSeeSky(pos.up()) && !worldObj.isRaining() && !worldObj.isThundering()
&& worldObj.isDaytime();
return world.canBlockSeeSky(pos.up()) && !world.isRaining() && !world.isThundering()
&& world.isDaytime();
}
@Override

View file

@ -111,7 +111,7 @@ public class TileThermalGenerator extends TilePowerAcceptor implements IWrenchab
@Override
public void onDataPacket(NetworkManager net, SPacketUpdateTileEntity packet) {
worldObj.markBlockRangeForRenderUpdate(getPos().getX(), getPos().getY(), getPos().getZ(), getPos().getX(),
world.markBlockRangeForRenderUpdate(getPos().getX(), getPos().getY(), getPos().getZ(), getPos().getX(),
getPos().getY(), getPos().getZ());
readFromNBT(packet.getNbtCompound());
}
@ -120,27 +120,27 @@ public class TileThermalGenerator extends TilePowerAcceptor implements IWrenchab
// TODO optimise this code
public void updateEntity() {
super.updateEntity();
if (!worldObj.isRemote) {
if (!world.isRemote) {
FluidUtils.drainContainers(this, inventory, 0, 1);
for (EnumFacing direction : EnumFacing.values()) {
if (worldObj.getBlockState(new BlockPos(getPos().getX() + direction.getFrontOffsetX(),
if (world.getBlockState(new BlockPos(getPos().getX() + direction.getFrontOffsetX(),
getPos().getY() + direction.getFrontOffsetY(), getPos().getZ() + direction.getFrontOffsetZ()))
.getBlock() == Blocks.LAVA) {
addEnergy(1);
}
}
if (worldObj.getTotalWorldTime() % 40 == 0) {
BlockMachineBase bmb = (BlockMachineBase) worldObj.getBlockState(pos).getBlock();
if (world.getTotalWorldTime() % 40 == 0) {
BlockMachineBase bmb = (BlockMachineBase) world.getBlockState(pos).getBlock();
boolean didFindLava = false;
for (EnumFacing direction : EnumFacing.values()) {
if (worldObj.getBlockState(new BlockPos(getPos().getX() + direction.getFrontOffsetX(),
if (world.getBlockState(new BlockPos(getPos().getX() + direction.getFrontOffsetX(),
getPos().getY() + direction.getFrontOffsetY(),
getPos().getZ() + direction.getFrontOffsetZ())).getBlock() == Blocks.LAVA) {
didFindLava = true;
}
}
bmb.setActive(didFindLava, worldObj, pos);
bmb.setActive(didFindLava, world, pos);
}
}
if (tank.getFluidAmount() > 0 && getMaxPower() - getEnergy() >= euTick) {

View file

@ -19,7 +19,7 @@ public class TileWaterMill extends TilePowerAcceptor {
@Override
public void updateEntity() {
super.updateEntity();
if (worldObj.getTotalWorldTime() % 20 == 0) {
if (world.getTotalWorldTime() % 20 == 0) {
checkForWater();
}
if (waterblocks > 0) {
@ -30,7 +30,7 @@ public class TileWaterMill extends TilePowerAcceptor {
public void checkForWater() {
waterblocks = 0;
for (EnumFacing facing : EnumFacing.HORIZONTALS) {
if (worldObj.getBlockState(getPos().offset(facing)).getBlock() == Blocks.WATER) {
if (world.getBlockState(getPos().offset(facing)).getBlock() == Blocks.WATER) {
waterblocks++;
}
}

View file

@ -20,7 +20,7 @@ public class TileWindMill extends TilePowerAcceptor {
super.updateEntity();
if (pos.getY() > 64) {
int actualPower = basePower;
if (worldObj.isThundering()) {
if (world.isThundering()) {
actualPower *= 1.25;
}
addEnergy(actualPower); // Value taken from