More formatting changes.
This commit is contained in:
parent
52ff6699b4
commit
452932c04e
10 changed files with 159 additions and 158 deletions
|
@ -96,13 +96,13 @@ public class TileCable extends TileEntity
|
|||
@Override
|
||||
public SPacketUpdateTileEntity getUpdatePacket() {
|
||||
NBTTagCompound nbtTag = new NBTTagCompound();
|
||||
this.writeToNBT(nbtTag);
|
||||
writeToNBT(nbtTag);
|
||||
return new SPacketUpdateTileEntity(getPos(), 1, nbtTag);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDataPacket(NetworkManager net, SPacketUpdateTileEntity packet) {
|
||||
this.readFromNBT(packet.getNbtCompound());
|
||||
readFromNBT(packet.getNbtCompound());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -131,9 +131,9 @@ public class TileCable extends TileEntity
|
|||
return;
|
||||
}
|
||||
|
||||
if (this.cableType == null ){
|
||||
this.cableType = getCableType();
|
||||
this.transferRate = this.cableType.transferRate * RebornCoreConfig.euPerFU;
|
||||
if (cableType == null ){
|
||||
cableType = getCableType();
|
||||
transferRate = cableType.transferRate * RebornCoreConfig.euPerFU;
|
||||
}
|
||||
|
||||
ticksSinceLastChange++;
|
||||
|
@ -206,12 +206,12 @@ public class TileCable extends TileEntity
|
|||
|
||||
@Override
|
||||
public int getEnergyStored() {
|
||||
return this.power;
|
||||
return power;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMaxEnergyStored() {
|
||||
return this.transferRate * 5;
|
||||
return transferRate * 5;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -87,7 +87,7 @@ public class TileFusionControlComputer extends TilePowerAcceptor
|
|||
* @return boolean Return true if coils are present
|
||||
*/
|
||||
public boolean checkCoils() {
|
||||
List<BlockPos> coils = Torus.generate(getPos(), size);
|
||||
List<BlockPos> coils = Torus.generate(pos, size);
|
||||
for(BlockPos coilPos : coils){
|
||||
if (!isCoil(coilPos)) {
|
||||
coilCount = 0;
|
||||
|
@ -104,19 +104,19 @@ public class TileFusionControlComputer extends TilePowerAcceptor
|
|||
* @param pos coordinate for block
|
||||
* @return boolean Returns true if block is fusion coil
|
||||
*/
|
||||
public boolean isCoil(final BlockPos pos) {
|
||||
return this.world.getBlockState(pos).getBlock() == ModBlocks.FUSION_COIL;
|
||||
public boolean isCoil(BlockPos pos) {
|
||||
return world.getBlockState(pos).getBlock() == ModBlocks.FUSION_COIL;
|
||||
}
|
||||
|
||||
/**
|
||||
* Resets crafter progress and recipe
|
||||
*/
|
||||
private void resetCrafter() {
|
||||
this.currentRecipe = null;
|
||||
this.crafingTickTime = 0;
|
||||
this.finalTickTime = 0;
|
||||
this.neededPower = 0;
|
||||
this.hasStartedCrafting = false;
|
||||
currentRecipe = null;
|
||||
crafingTickTime = 0;
|
||||
finalTickTime = 0;
|
||||
neededPower = 0;
|
||||
hasStartedCrafting = false;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -128,16 +128,16 @@ public class TileFusionControlComputer extends TilePowerAcceptor
|
|||
* @param oreDic boolean Should we use ore dictionary
|
||||
* @return boolean Returns true if ItemStack will fit into slot
|
||||
*/
|
||||
public boolean canFitStack(final ItemStack stack, final int slot, final boolean oreDic) {// Checks to see if it can
|
||||
public boolean canFitStack(ItemStack stack, int slot, boolean oreDic) {// Checks to see if it can
|
||||
// fit the stack
|
||||
if (stack.isEmpty()) {
|
||||
return true;
|
||||
}
|
||||
if (this.inventory.getStackInSlot(slot).isEmpty()) {
|
||||
if (inventory.getStackInSlot(slot).isEmpty()) {
|
||||
return true;
|
||||
}
|
||||
if (ItemUtils.isItemEqual(this.inventory.getStackInSlot(slot), stack, true, true, oreDic)) {
|
||||
if (stack.getCount() + this.inventory.getStackInSlot(slot).getCount() <= stack.getMaxStackSize()) {
|
||||
if (ItemUtils.isItemEqual(inventory.getStackInSlot(slot), stack, true, true, oreDic)) {
|
||||
if (stack.getCount() + inventory.getStackInSlot(slot).getCount() <= stack.getMaxStackSize()) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
@ -151,8 +151,8 @@ public class TileFusionControlComputer extends TilePowerAcceptor
|
|||
* @return int Scale of progress
|
||||
*/
|
||||
public int getProgressScaled(int scale) {
|
||||
if (this.crafingTickTime != 0 && this.finalTickTime != 0) {
|
||||
return this.crafingTickTime * scale / this.finalTickTime;
|
||||
if (crafingTickTime != 0 && finalTickTime != 0) {
|
||||
return crafingTickTime * scale / finalTickTime;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
@ -163,11 +163,11 @@ public class TileFusionControlComputer extends TilePowerAcceptor
|
|||
private void updateCurrentRecipe() {
|
||||
for (final FusionReactorRecipe reactorRecipe : FusionReactorRecipeHelper.reactorRecipes) {
|
||||
if (validateReactorRecipe(reactorRecipe)) {
|
||||
this.currentRecipe = reactorRecipe;
|
||||
this.crafingTickTime = 0;
|
||||
this.finalTickTime = this.currentRecipe.getTickTime();
|
||||
this.neededPower = (int) this.currentRecipe.getStartEU();
|
||||
this.hasStartedCrafting = false;
|
||||
currentRecipe = reactorRecipe;
|
||||
crafingTickTime = 0;
|
||||
finalTickTime = currentRecipe.getTickTime();
|
||||
neededPower = (int) currentRecipe.getStartEU();
|
||||
hasStartedCrafting = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -190,7 +190,7 @@ public class TileFusionControlComputer extends TilePowerAcceptor
|
|||
return false;
|
||||
}
|
||||
}
|
||||
if (this.canFitStack(recipe.getOutput(), outputStackSlot, true)) {
|
||||
if (canFitStack(recipe.getOutput(), outputStackSlot, true)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
@ -202,77 +202,77 @@ public class TileFusionControlComputer extends TilePowerAcceptor
|
|||
public void update() {
|
||||
super.update();
|
||||
|
||||
if (this.world.isRemote) {
|
||||
if (world.isRemote) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Force check every second
|
||||
if (this.world.getTotalWorldTime() % 20 == 0) {
|
||||
this.checkCoils();
|
||||
this.inventory.hasChanged = true;
|
||||
if (world.getTotalWorldTime() % 20 == 0) {
|
||||
checkCoils();
|
||||
inventory.hasChanged = true;
|
||||
}
|
||||
|
||||
if (this.coilCount == 0) {
|
||||
this.resetCrafter();
|
||||
if (coilCount == 0) {
|
||||
resetCrafter();
|
||||
return;
|
||||
}
|
||||
|
||||
if (this.currentRecipe == null && this.inventory.hasChanged == true) {
|
||||
if (currentRecipe == null && inventory.hasChanged == true) {
|
||||
updateCurrentRecipe();
|
||||
}
|
||||
|
||||
if (this.currentRecipe != null) {
|
||||
if (!hasStartedCrafting && this.inventory.hasChanged && !validateReactorRecipe(this.currentRecipe)) {
|
||||
if (currentRecipe != null) {
|
||||
if (!hasStartedCrafting && inventory.hasChanged && !validateReactorRecipe(currentRecipe)) {
|
||||
resetCrafter();
|
||||
return;
|
||||
}
|
||||
|
||||
if (!this.hasStartedCrafting) {
|
||||
if (!hasStartedCrafting) {
|
||||
// Ignition!
|
||||
if (this.canUseEnergy(this.currentRecipe.getStartEU())) {
|
||||
this.useEnergy(this.currentRecipe.getStartEU());
|
||||
this.hasStartedCrafting = true;
|
||||
this.decrStackSize(this.topStackSlot, this.currentRecipe.getTopInput().getCount());
|
||||
if (!this.currentRecipe.getBottomInput().isEmpty()) {
|
||||
this.decrStackSize(this.bottomStackSlot, this.currentRecipe.getBottomInput().getCount());
|
||||
if (canUseEnergy(currentRecipe.getStartEU())) {
|
||||
useEnergy(currentRecipe.getStartEU());
|
||||
hasStartedCrafting = true;
|
||||
decrStackSize(topStackSlot, currentRecipe.getTopInput().getCount());
|
||||
if (!currentRecipe.getBottomInput().isEmpty()) {
|
||||
decrStackSize(bottomStackSlot, currentRecipe.getBottomInput().getCount());
|
||||
}
|
||||
}
|
||||
}
|
||||
if (hasStartedCrafting && this.crafingTickTime < this.finalTickTime) {
|
||||
this.crafingTickTime++;
|
||||
if (hasStartedCrafting && crafingTickTime < finalTickTime) {
|
||||
crafingTickTime++;
|
||||
// Power gen
|
||||
if (this.currentRecipe.getEuTick() > 0) {
|
||||
if (currentRecipe.getEuTick() > 0) {
|
||||
// Waste power if it has no where to go
|
||||
this.addEnergy(this.currentRecipe.getEuTick() * getPowerMultiplier());
|
||||
this.powerChange = this.currentRecipe.getEuTick() * getPowerMultiplier();
|
||||
addEnergy(currentRecipe.getEuTick() * getPowerMultiplier());
|
||||
powerChange = currentRecipe.getEuTick() * getPowerMultiplier();
|
||||
} else { // Power user
|
||||
if (this.canUseEnergy(this.currentRecipe.getEuTick() * -1)) {
|
||||
this.setEnergy(this.getEnergy() - this.currentRecipe.getEuTick() * -1);
|
||||
if (canUseEnergy(currentRecipe.getEuTick() * -1)) {
|
||||
setEnergy(getEnergy() - currentRecipe.getEuTick() * -1);
|
||||
}
|
||||
}
|
||||
} else if (this.crafingTickTime >= this.finalTickTime) {
|
||||
if (this.canFitStack(this.currentRecipe.getOutput(), this.outputStackSlot, true)) {
|
||||
if (this.getStackInSlot(this.outputStackSlot).isEmpty()) {
|
||||
this.setInventorySlotContents(this.outputStackSlot, this.currentRecipe.getOutput().copy());
|
||||
} else if (crafingTickTime >= finalTickTime) {
|
||||
if (canFitStack(currentRecipe.getOutput(), outputStackSlot, true)) {
|
||||
if (getStackInSlot(outputStackSlot).isEmpty()) {
|
||||
setInventorySlotContents(outputStackSlot, currentRecipe.getOutput().copy());
|
||||
} else {
|
||||
this.decrStackSize(this.outputStackSlot, -this.currentRecipe.getOutput().getCount());
|
||||
decrStackSize(outputStackSlot, -currentRecipe.getOutput().getCount());
|
||||
}
|
||||
if (this.validateReactorRecipe(this.currentRecipe)) {
|
||||
this.crafingTickTime = 0;
|
||||
this.decrStackSize(this.topStackSlot, this.currentRecipe.getTopInput().getCount());
|
||||
if (!this.currentRecipe.getBottomInput().isEmpty()) {
|
||||
this.decrStackSize(this.bottomStackSlot, this.currentRecipe.getBottomInput().getCount());
|
||||
if (validateReactorRecipe(this.currentRecipe)) {
|
||||
crafingTickTime = 0;
|
||||
decrStackSize(topStackSlot, currentRecipe.getTopInput().getCount());
|
||||
if (!currentRecipe.getBottomInput().isEmpty()) {
|
||||
decrStackSize(bottomStackSlot, currentRecipe.getBottomInput().getCount());
|
||||
}
|
||||
} else {
|
||||
this.resetCrafter();
|
||||
resetCrafter();
|
||||
}
|
||||
}
|
||||
}
|
||||
this.markDirty();
|
||||
markDirty();
|
||||
}
|
||||
|
||||
if (this.inventory.hasChanged) {
|
||||
this.inventory.hasChanged = false;
|
||||
if (inventory.hasChanged) {
|
||||
inventory.hasChanged = false;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -289,18 +289,18 @@ public class TileFusionControlComputer extends TilePowerAcceptor
|
|||
}
|
||||
|
||||
@Override
|
||||
public boolean canAcceptEnergy(final EnumFacing direction) {
|
||||
public boolean canAcceptEnergy(EnumFacing direction) {
|
||||
return !(direction == EnumFacing.DOWN || direction == EnumFacing.UP);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canProvideEnergy(final EnumFacing direction) {
|
||||
public boolean canProvideEnergy(EnumFacing direction) {
|
||||
return direction == EnumFacing.DOWN || direction == EnumFacing.UP;
|
||||
}
|
||||
|
||||
@Override
|
||||
public double getBaseMaxOutput() {
|
||||
if (!this.hasStartedCrafting) {
|
||||
if (!hasStartedCrafting) {
|
||||
return 0;
|
||||
}
|
||||
return Integer.MAX_VALUE / RebornCoreConfig.euPerFU;
|
||||
|
@ -308,7 +308,7 @@ public class TileFusionControlComputer extends TilePowerAcceptor
|
|||
|
||||
@Override
|
||||
public double getBaseMaxInput() {
|
||||
if (this.hasStartedCrafting) {
|
||||
if (hasStartedCrafting) {
|
||||
return 0;
|
||||
}
|
||||
return maxInput;
|
||||
|
@ -360,14 +360,14 @@ public class TileFusionControlComputer extends TilePowerAcceptor
|
|||
|
||||
// IToolDrop
|
||||
@Override
|
||||
public ItemStack getToolDrop(EntityPlayer p0) {
|
||||
public ItemStack getToolDrop(EntityPlayer playerIn) {
|
||||
return new ItemStack(ModBlocks.FUSION_CONTROL_COMPUTER, 1);
|
||||
}
|
||||
|
||||
// IInventoryProvider
|
||||
@Override
|
||||
public Inventory getInventory() {
|
||||
return this.inventory;
|
||||
return inventory;
|
||||
}
|
||||
|
||||
// IContainerProvider
|
||||
|
@ -384,34 +384,34 @@ public class TileFusionControlComputer extends TilePowerAcceptor
|
|||
}
|
||||
|
||||
public int getCoilStatus() {
|
||||
return this.coilCount;
|
||||
return coilCount;
|
||||
}
|
||||
|
||||
public void setCoilStatus(final int coilStatus) {
|
||||
public void setCoilStatus(int coilStatus) {
|
||||
this.coilCount = coilStatus;
|
||||
}
|
||||
|
||||
public int getCrafingTickTime() {
|
||||
return this.crafingTickTime;
|
||||
return crafingTickTime;
|
||||
}
|
||||
|
||||
public void setCrafingTickTime(final int crafingTickTime) {
|
||||
public void setCrafingTickTime(int crafingTickTime) {
|
||||
this.crafingTickTime = crafingTickTime;
|
||||
}
|
||||
|
||||
public int getFinalTickTime() {
|
||||
return this.finalTickTime;
|
||||
return finalTickTime;
|
||||
}
|
||||
|
||||
public void setFinalTickTime(final int finalTickTime) {
|
||||
public void setFinalTickTime(int finalTickTime) {
|
||||
this.finalTickTime = finalTickTime;
|
||||
}
|
||||
|
||||
public int getNeededPower() {
|
||||
return this.neededPower;
|
||||
return neededPower;
|
||||
}
|
||||
|
||||
public void setNeededPower(final int neededPower) {
|
||||
public void setNeededPower(int neededPower) {
|
||||
this.neededPower = neededPower;
|
||||
}
|
||||
|
||||
|
|
|
@ -52,7 +52,7 @@ public class TileGasTurbine extends TileBaseFluidGenerator implements IContainer
|
|||
}
|
||||
|
||||
@Override
|
||||
public ItemStack getToolDrop(final EntityPlayer entityPlayer) {
|
||||
public ItemStack getToolDrop(EntityPlayer entityPlayer) {
|
||||
return new ItemStack(ModBlocks.GAS_TURBINE, 1);
|
||||
}
|
||||
|
||||
|
|
|
@ -61,44 +61,44 @@ public class TileLightningRod extends TilePowerAcceptor implements IToolDrop {
|
|||
public void update() {
|
||||
super.update();
|
||||
|
||||
if (this.onStatusHoldTicks > 0)
|
||||
--this.onStatusHoldTicks;
|
||||
if (onStatusHoldTicks > 0)
|
||||
--onStatusHoldTicks;
|
||||
|
||||
if (this.onStatusHoldTicks == 0 || this.getEnergy() <= 0) {
|
||||
if (this.getBlockType() instanceof BlockMachineBase)
|
||||
((BlockMachineBase) this.getBlockType()).setActive(false, this.world, this.pos);
|
||||
this.onStatusHoldTicks = -1;
|
||||
if (onStatusHoldTicks == 0 || getEnergy() <= 0) {
|
||||
if (getBlockType() instanceof BlockMachineBase)
|
||||
((BlockMachineBase) getBlockType()).setActive(false, world, pos);
|
||||
onStatusHoldTicks = -1;
|
||||
}
|
||||
|
||||
final float weatherStrength = this.world.getThunderStrength(1.0F);
|
||||
final float weatherStrength = world.getThunderStrength(1.0F);
|
||||
if (weatherStrength > 0.2F) {
|
||||
//lightStrikeChance = (MAX - (CHANCE * WEATHER_STRENGTH)
|
||||
final float lightStrikeChance = (100F - chanceOfStrike) * 20F;
|
||||
final float totalChance = lightStrikeChance * this.getLightningStrikeMultiplier() * (1.1F - weatherStrength);
|
||||
if (this.world.rand.nextInt((int) Math.floor(totalChance)) == 0) {
|
||||
final float totalChance = lightStrikeChance * getLightningStrikeMultiplier() * (1.1F - weatherStrength);
|
||||
if (world.rand.nextInt((int) Math.floor(totalChance)) == 0) {
|
||||
if (!isValidIronFence(pos.up().getY())) {
|
||||
this.onStatusHoldTicks = 400;
|
||||
onStatusHoldTicks = 400;
|
||||
return;
|
||||
}
|
||||
final EntityLightningBolt lightningBolt = new EntityLightningBolt(this.world,
|
||||
this.pos.getX() + 0.5F,
|
||||
this.world.provider.getAverageGroundLevel(),
|
||||
this.pos.getZ() + 0.5F, false);
|
||||
this.world.addWeatherEffect(lightningBolt);
|
||||
this.world.spawnEntity(lightningBolt);
|
||||
this.addEnergy(baseEnergyStrike * (0.3F + weatherStrength));
|
||||
((BlockMachineBase) this.getBlockType()).setActive(true, this.world, this.pos);
|
||||
this.onStatusHoldTicks = 400;
|
||||
final EntityLightningBolt lightningBolt = new EntityLightningBolt(world,
|
||||
pos.getX() + 0.5F,
|
||||
world.provider.getAverageGroundLevel(),
|
||||
pos.getZ() + 0.5F, false);
|
||||
world.addWeatherEffect(lightningBolt);
|
||||
world.spawnEntity(lightningBolt);
|
||||
addEnergy(baseEnergyStrike * (0.3F + weatherStrength));
|
||||
((BlockMachineBase) getBlockType()).setActive(true, world, pos);
|
||||
onStatusHoldTicks = 400;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public float getLightningStrikeMultiplier() {
|
||||
final float actualHeight = this.world.provider.getActualHeight();
|
||||
final float groundLevel = this.world.provider.getAverageGroundLevel();
|
||||
for (int i = this.pos.getY() + 1; i < actualHeight; i++) {
|
||||
if (!this.isValidIronFence(i)) {
|
||||
final float actualHeight = world.provider.getActualHeight();
|
||||
final float groundLevel = world.provider.getAverageGroundLevel();
|
||||
for (int i = pos.getY() + 1; i < actualHeight; i++) {
|
||||
if (!isValidIronFence(i)) {
|
||||
if (groundLevel >= i)
|
||||
return 4.3F;
|
||||
final float max = actualHeight - groundLevel;
|
||||
|
@ -109,8 +109,8 @@ public class TileLightningRod extends TilePowerAcceptor implements IToolDrop {
|
|||
return 4F;
|
||||
}
|
||||
|
||||
public boolean isValidIronFence(final int y) {
|
||||
final Item itemBlock = Item.getItemFromBlock(this.world.getBlockState(new BlockPos(this.pos.getX(), y, this.pos.getZ())).getBlock());
|
||||
public boolean isValidIronFence(int y) {
|
||||
final Item itemBlock = Item.getItemFromBlock(this.world.getBlockState(new BlockPos(pos.getX(), y, pos.getZ())).getBlock());
|
||||
for (final ItemStack fence : OreDictionary.getOres("fenceIron")) {
|
||||
if (fence.getItem() == itemBlock)
|
||||
return true;
|
||||
|
@ -144,7 +144,7 @@ public class TileLightningRod extends TilePowerAcceptor implements IToolDrop {
|
|||
}
|
||||
|
||||
@Override
|
||||
public ItemStack getToolDrop(final EntityPlayer p0) {
|
||||
public ItemStack getToolDrop(EntityPlayer playerIn) {
|
||||
return new ItemStack(ModBlocks.LIGHTNING_ROD);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -52,7 +52,7 @@ public class TilePlasmaGenerator extends TileBaseFluidGenerator implements ICont
|
|||
}
|
||||
|
||||
@Override
|
||||
public ItemStack getToolDrop(EntityPlayer p0) {
|
||||
public ItemStack getToolDrop(EntityPlayer playerIn) {
|
||||
return new ItemStack(ModBlocks.PLASMA_GENERATOR, 1);
|
||||
}
|
||||
|
||||
|
|
|
@ -52,7 +52,7 @@ public class TileSemiFluidGenerator extends TileBaseFluidGenerator implements IC
|
|||
}
|
||||
|
||||
@Override
|
||||
public ItemStack getToolDrop(final EntityPlayer arg0) {
|
||||
public ItemStack getToolDrop(EntityPlayer playerIn) {
|
||||
return new ItemStack(ModBlocks.SEMI_FLUID_GENERATOR, 1);
|
||||
}
|
||||
|
||||
|
|
|
@ -61,31 +61,31 @@ public class TileSolarPanel extends TilePowerAcceptor implements IToolDrop {
|
|||
@Override
|
||||
public void update() {
|
||||
super.update();
|
||||
if (this.world.isRemote) {
|
||||
if (world.isRemote) {
|
||||
return;
|
||||
}
|
||||
if (world.getTotalWorldTime() % 20 == 0) {
|
||||
canSeeSky = this.world.canBlockSeeSky(this.pos.up());
|
||||
if(lastSate != this.isSunOut()){
|
||||
this.world.setBlockState(this.getPos(),
|
||||
this.world.getBlockState(this.getPos()).withProperty(BlockSolarPanel.ACTIVE, this.isSunOut()));
|
||||
canSeeSky = world.canBlockSeeSky(pos.up());
|
||||
if(lastSate != isSunOut()){
|
||||
world.setBlockState(pos,
|
||||
world.getBlockState(pos).withProperty(BlockSolarPanel.ACTIVE, isSunOut()));
|
||||
lastSate = isSunOut();
|
||||
}
|
||||
|
||||
}
|
||||
if (isSunOut()) {
|
||||
this.powerToAdd = panel.generationRateD;
|
||||
powerToAdd = panel.generationRateD;
|
||||
} else if (canSeeSky) {
|
||||
this.powerToAdd = panel.generationRateN;
|
||||
powerToAdd = panel.generationRateN;
|
||||
} else {
|
||||
this.powerToAdd = 0;
|
||||
powerToAdd = 0;
|
||||
}
|
||||
|
||||
this.addEnergy(this.powerToAdd);
|
||||
addEnergy(powerToAdd);
|
||||
}
|
||||
|
||||
public boolean isSunOut() {
|
||||
return canSeeSky && !this.world.isRaining() && !this.world.isThundering() && this.world.isDaytime();
|
||||
return canSeeSky && !world.isRaining() && !world.isThundering() && world.isDaytime();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -115,7 +115,7 @@ public class TileSolarPanel extends TilePowerAcceptor implements IToolDrop {
|
|||
|
||||
@Override
|
||||
public EnumPowerTier getTier() {
|
||||
return this.panel.powerTier;
|
||||
return panel.powerTier;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -124,8 +124,8 @@ public class TileSolarPanel extends TilePowerAcceptor implements IToolDrop {
|
|||
}
|
||||
|
||||
@Override
|
||||
public ItemStack getToolDrop(final EntityPlayer p0) {
|
||||
return new ItemStack(ModBlocks.SOLAR_PANEL, 1, this.panel.ordinal());
|
||||
public ItemStack getToolDrop(final EntityPlayer playerIn) {
|
||||
return new ItemStack(ModBlocks.SOLAR_PANEL, 1, panel.ordinal());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -50,7 +50,7 @@ public class TileSolidFuelGenerator extends TilePowerAcceptor implements IToolDr
|
|||
@ConfigRegistry(config = "generators", category = "generator", key = "GeneratorMaxOutput", comment = "Solid Fuel Generator Max Output (Value in EU)")
|
||||
public static int maxOutput = 32;
|
||||
@ConfigRegistry(config = "generators", category = "generator", key = "GeneratorMaxEnergy", comment = "Solid Fuel Generator Max Energy (Value in EU)")
|
||||
public static int maxEnergy = 10000;
|
||||
public static int maxEnergy = 10_000;
|
||||
@ConfigRegistry(config = "generators", category = "generator", key = "GeneratorEnergyOutput", comment = "Solid Fuel Generator Energy Output Amount (Value in EU)")
|
||||
public static int outputAmount = 10;
|
||||
|
||||
|
@ -68,54 +68,55 @@ public class TileSolidFuelGenerator extends TilePowerAcceptor implements IToolDr
|
|||
super();
|
||||
}
|
||||
|
||||
public static int getItemBurnTime(final ItemStack stack) {
|
||||
public static int getItemBurnTime(ItemStack stack) {
|
||||
return TileEntityFurnace.getItemBurnTime(stack) / 4;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void update() {
|
||||
super.update();
|
||||
if (this.world.isRemote) {
|
||||
if (world.isRemote) {
|
||||
return;
|
||||
}
|
||||
if (this.getEnergy() < this.getMaxPower()) {
|
||||
if (this.burnTime > 0) {
|
||||
this.burnTime--;
|
||||
this.addEnergy(TileSolidFuelGenerator.outputAmount);
|
||||
this.isBurning = true;
|
||||
if (getEnergy() < getMaxPower()) {
|
||||
if (burnTime > 0) {
|
||||
burnTime--;
|
||||
addEnergy(TileSolidFuelGenerator.outputAmount);
|
||||
isBurning = true;
|
||||
}
|
||||
} else {
|
||||
this.isBurning = false;
|
||||
isBurning = false;
|
||||
}
|
||||
|
||||
if (this.burnTime == 0) {
|
||||
this.updateState();
|
||||
this.burnTime = this.totalBurnTime = TileSolidFuelGenerator.getItemBurnTime(this.getStackInSlot(this.fuelSlot));
|
||||
if (this.burnTime > 0) {
|
||||
this.updateState();
|
||||
this.burnItem = this.getStackInSlot(this.fuelSlot);
|
||||
if (this.getStackInSlot(this.fuelSlot).getCount() == 1) {
|
||||
if (this.getStackInSlot(this.fuelSlot).getItem() == Items.LAVA_BUCKET || this.getStackInSlot(this.fuelSlot).getItem() == ForgeModContainer.getInstance().universalBucket) {
|
||||
this.setInventorySlotContents(this.fuelSlot, new ItemStack(Items.BUCKET));
|
||||
if (burnTime == 0) {
|
||||
updateState();
|
||||
burnTime = totalBurnTime = TileSolidFuelGenerator.getItemBurnTime(getStackInSlot(fuelSlot));
|
||||
if (burnTime > 0) {
|
||||
updateState();
|
||||
burnItem = getStackInSlot(fuelSlot);
|
||||
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 {
|
||||
this.setInventorySlotContents(this.fuelSlot, ItemStack.EMPTY);
|
||||
setInventorySlotContents(fuelSlot, ItemStack.EMPTY);
|
||||
}
|
||||
|
||||
} else {
|
||||
this.decrStackSize(this.fuelSlot, 1);
|
||||
decrStackSize(fuelSlot, 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
this.lastTickBurning = this.isBurning;
|
||||
lastTickBurning = isBurning;
|
||||
}
|
||||
|
||||
public void updateState() {
|
||||
final IBlockState BlockStateContainer = this.world.getBlockState(this.pos);
|
||||
final IBlockState BlockStateContainer = world.getBlockState(pos);
|
||||
if (BlockStateContainer.getBlock() instanceof BlockMachineBase) {
|
||||
final BlockMachineBase blockMachineBase = (BlockMachineBase) BlockStateContainer.getBlock();
|
||||
if (BlockStateContainer.getValue(BlockMachineBase.ACTIVE) != this.burnTime > 0)
|
||||
blockMachineBase.setActive(this.burnTime > 0, this.world, this.pos);
|
||||
if (BlockStateContainer.getValue(BlockMachineBase.ACTIVE) != burnTime > 0) {
|
||||
blockMachineBase.setActive(burnTime > 0, world, pos);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -125,12 +126,12 @@ public class TileSolidFuelGenerator extends TilePowerAcceptor implements IToolDr
|
|||
}
|
||||
|
||||
@Override
|
||||
public boolean canAcceptEnergy(final EnumFacing direction) {
|
||||
public boolean canAcceptEnergy(EnumFacing direction) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canProvideEnergy(final EnumFacing direction) {
|
||||
public boolean canProvideEnergy(EnumFacing direction) {
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -145,17 +146,17 @@ public class TileSolidFuelGenerator extends TilePowerAcceptor implements IToolDr
|
|||
}
|
||||
|
||||
@Override
|
||||
public ItemStack getToolDrop(final EntityPlayer p0) {
|
||||
public ItemStack getToolDrop(EntityPlayer playerIn) {
|
||||
return new ItemStack(ModBlocks.SOLID_FUEL_GENEREATOR);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Inventory getInventory() {
|
||||
return this.inventory;
|
||||
return inventory;
|
||||
}
|
||||
|
||||
public int getBurnTime() {
|
||||
return this.burnTime;
|
||||
return burnTime;
|
||||
}
|
||||
|
||||
public void setBurnTime(final int burnTime) {
|
||||
|
@ -163,7 +164,7 @@ public class TileSolidFuelGenerator extends TilePowerAcceptor implements IToolDr
|
|||
}
|
||||
|
||||
public int getTotalBurnTime() {
|
||||
return this.totalBurnTime;
|
||||
return totalBurnTime;
|
||||
}
|
||||
|
||||
public void setTotalBurnTime(final int totalBurnTime) {
|
||||
|
@ -171,7 +172,7 @@ public class TileSolidFuelGenerator extends TilePowerAcceptor implements IToolDr
|
|||
}
|
||||
|
||||
public int getScaledBurnTime(final int i) {
|
||||
return (int) ((float) this.burnTime / (float) this.totalBurnTime * i);
|
||||
return (int) ((float) burnTime / (float) totalBurnTime * i);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -52,7 +52,7 @@ public class TileThermalGenerator extends TileBaseFluidGenerator implements ICon
|
|||
}
|
||||
|
||||
@Override
|
||||
public ItemStack getToolDrop(final EntityPlayer entityPlayer) {
|
||||
public ItemStack getToolDrop(EntityPlayer entityPlayer) {
|
||||
return new ItemStack(ModBlocks.THERMAL_GENERATOR, 1);
|
||||
}
|
||||
|
||||
|
|
|
@ -57,12 +57,12 @@ public class TileWindMill extends TilePowerAcceptor implements IToolDrop {
|
|||
@Override
|
||||
public void update() {
|
||||
super.update();
|
||||
if (this.pos.getY() > 64) {
|
||||
if (pos.getY() > 64) {
|
||||
int actualPower = baseEnergy;
|
||||
if (this.world.isThundering()) {
|
||||
if (world.isThundering()) {
|
||||
actualPower *= thunderMultiplier;
|
||||
}
|
||||
this.addEnergy(actualPower); // Value taken from
|
||||
addEnergy(actualPower); // Value taken from
|
||||
// http://wiki.industrial-craft.net/?title=Wind_Mill
|
||||
// Not worth making more complicated
|
||||
}
|
||||
|
@ -74,12 +74,12 @@ public class TileWindMill extends TilePowerAcceptor implements IToolDrop {
|
|||
}
|
||||
|
||||
@Override
|
||||
public boolean canAcceptEnergy(final EnumFacing direction) {
|
||||
public boolean canAcceptEnergy(EnumFacing direction) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canProvideEnergy(final EnumFacing direction) {
|
||||
public boolean canProvideEnergy(EnumFacing direction) {
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -94,7 +94,7 @@ public class TileWindMill extends TilePowerAcceptor implements IToolDrop {
|
|||
}
|
||||
|
||||
@Override
|
||||
public ItemStack getToolDrop(final EntityPlayer p0) {
|
||||
public ItemStack getToolDrop(EntityPlayer playerIn) {
|
||||
return new ItemStack(ModBlocks.WIND_MILL);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue