mirror of
https://github.com/HbmMods/Hbm-s-Nuclear-Tech-GIT.git
synced 2026-01-25 10:32:49 +00:00
fixes
This commit is contained in:
parent
4482e10999
commit
edbe256217
@ -158,85 +158,87 @@ public class TileEntityPWRController extends TileEntityMachineBase implements IG
|
|||||||
this.tanks[0].setType(2, slots);
|
this.tanks[0].setType(2, slots);
|
||||||
setupTanks();
|
setupTanks();
|
||||||
|
|
||||||
for(BlockPos pos : ports) {
|
if(this.assembled) {
|
||||||
for(ForgeDirection dir : ForgeDirection.VALID_DIRECTIONS) {
|
for(BlockPos pos : ports) {
|
||||||
BlockPos portPos = pos.offset(dir);
|
for(ForgeDirection dir : ForgeDirection.VALID_DIRECTIONS) {
|
||||||
|
BlockPos portPos = pos.offset(dir);
|
||||||
if(tanks[1].getFill() > 0) this.sendFluid(tanks[1], worldObj, portPos.getX(), portPos.getY(), portPos.getZ(), dir);
|
|
||||||
if(worldObj.getTotalWorldTime() % 20 == 0) this.trySubscribe(tanks[0].getTankType(), worldObj, portPos.getX(), portPos.getY(), portPos.getZ(), dir);
|
if(tanks[1].getFill() > 0) this.sendFluid(tanks[1], worldObj, portPos.getX(), portPos.getY(), portPos.getZ(), dir);
|
||||||
}
|
if(worldObj.getTotalWorldTime() % 20 == 0) this.trySubscribe(tanks[0].getTankType(), worldObj, portPos.getX(), portPos.getY(), portPos.getZ(), dir);
|
||||||
}
|
|
||||||
|
|
||||||
if((typeLoaded == -1 || amountLoaded <= 0) && slots[0] != null && slots[0].getItem() == ModItems.pwr_fuel) {
|
|
||||||
typeLoaded = slots[0].getItemDamage();
|
|
||||||
amountLoaded++;
|
|
||||||
this.decrStackSize(0, 1);
|
|
||||||
this.markChanged();
|
|
||||||
} else if(slots[0] != null && slots[0].getItem() == ModItems.pwr_fuel && slots[0].getItemDamage() == typeLoaded && amountLoaded < rodCount){
|
|
||||||
amountLoaded++;
|
|
||||||
this.decrStackSize(0, 1);
|
|
||||||
this.markChanged();
|
|
||||||
}
|
|
||||||
|
|
||||||
if(this.rodTarget > this.rodLevel) this.rodLevel++;
|
|
||||||
if(this.rodTarget < this.rodLevel) this.rodLevel--;
|
|
||||||
|
|
||||||
int newFlux = this.sourceCount * 20;
|
|
||||||
|
|
||||||
if(typeLoaded != -1 && amountLoaded > 0) {
|
|
||||||
|
|
||||||
EnumPWRFuel fuel = EnumUtil.grabEnumSafely(EnumPWRFuel.class, typeLoaded);
|
|
||||||
double usedRods = getTotalProcessMultiplier();
|
|
||||||
double fluxPerRod = this.flux / this.rodCount;
|
|
||||||
double outputPerRod = fuel.function.effonix(fluxPerRod);
|
|
||||||
double totalOutput = outputPerRod * amountLoaded * usedRods;
|
|
||||||
double totalHeatOutput = totalOutput * fuel.heatEmission;
|
|
||||||
|
|
||||||
this.coreHeat += totalHeatOutput;
|
|
||||||
newFlux += totalOutput;
|
|
||||||
|
|
||||||
this.processTime = (int) fuel.yield;
|
|
||||||
this.progress += totalOutput;
|
|
||||||
|
|
||||||
if(this.progress >= this.processTime) {
|
|
||||||
this.progress -= this.processTime;
|
|
||||||
|
|
||||||
if(slots[1] == null) {
|
|
||||||
slots[1] = new ItemStack(ModItems.pwr_fuel_hot, 1, typeLoaded);
|
|
||||||
} else if(slots[1].getItem() == ModItems.pwr_fuel_hot && slots[1].getItemDamage() == typeLoaded && slots[1].stackSize < slots[1].getMaxStackSize()) {
|
|
||||||
slots[1].stackSize++;
|
|
||||||
}
|
}
|
||||||
|
}
|
||||||
this.amountLoaded--;
|
|
||||||
|
if((typeLoaded == -1 || amountLoaded <= 0) && slots[0] != null && slots[0].getItem() == ModItems.pwr_fuel) {
|
||||||
|
typeLoaded = slots[0].getItemDamage();
|
||||||
|
amountLoaded++;
|
||||||
|
this.decrStackSize(0, 1);
|
||||||
|
this.markChanged();
|
||||||
|
} else if(slots[0] != null && slots[0].getItem() == ModItems.pwr_fuel && slots[0].getItemDamage() == typeLoaded && amountLoaded < rodCount){
|
||||||
|
amountLoaded++;
|
||||||
|
this.decrStackSize(0, 1);
|
||||||
this.markChanged();
|
this.markChanged();
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
if(this.rodTarget > this.rodLevel) this.rodLevel++;
|
||||||
if(this.amountLoaded <= 0) {
|
if(this.rodTarget < this.rodLevel) this.rodLevel--;
|
||||||
this.typeLoaded = -1;
|
|
||||||
}
|
int newFlux = this.sourceCount * 20;
|
||||||
|
|
||||||
if(amountLoaded > rodCount) amountLoaded = rodCount;
|
if(typeLoaded != -1 && amountLoaded > 0) {
|
||||||
|
|
||||||
/* CORE COOLING */
|
EnumPWRFuel fuel = EnumUtil.grabEnumSafely(EnumPWRFuel.class, typeLoaded);
|
||||||
double coreCoolingApproachNum = getXOverE((double) this.heatexCount * 5 / (double) this.rodCount, 2) / 2D;
|
double usedRods = getTotalProcessMultiplier();
|
||||||
int averageCoreHeat = (this.coreHeat + this.hullHeat) / 2;
|
double fluxPerRod = this.flux / this.rodCount;
|
||||||
this.coreHeat -= (coreHeat - averageCoreHeat) * coreCoolingApproachNum;
|
double outputPerRod = fuel.function.effonix(fluxPerRod);
|
||||||
this.hullHeat -= (hullHeat - averageCoreHeat) * coreCoolingApproachNum;
|
double totalOutput = outputPerRod * amountLoaded * usedRods;
|
||||||
|
double totalHeatOutput = totalOutput * fuel.heatEmission;
|
||||||
updateCoolant();
|
|
||||||
|
this.coreHeat += totalHeatOutput;
|
||||||
this.coreHeat *= 0.999D;
|
newFlux += totalOutput;
|
||||||
this.hullHeat *= 0.999D;
|
|
||||||
|
this.processTime = (int) fuel.yield;
|
||||||
this.flux = newFlux;
|
this.progress += totalOutput;
|
||||||
|
|
||||||
if(tanks[0].getTankType().hasTrait(FT_PWRModerator.class) && tanks[0].getFill() > 0) {
|
if(this.progress >= this.processTime) {
|
||||||
this.flux *= tanks[0].getTankType().getTrait(FT_PWRModerator.class).getMultiplier();
|
this.progress -= this.processTime;
|
||||||
}
|
|
||||||
|
if(slots[1] == null) {
|
||||||
if(this.coreHeat > this.coreHeatCapacity) {
|
slots[1] = new ItemStack(ModItems.pwr_fuel_hot, 1, typeLoaded);
|
||||||
meltDown();
|
} else if(slots[1].getItem() == ModItems.pwr_fuel_hot && slots[1].getItemDamage() == typeLoaded && slots[1].stackSize < slots[1].getMaxStackSize()) {
|
||||||
|
slots[1].stackSize++;
|
||||||
|
}
|
||||||
|
|
||||||
|
this.amountLoaded--;
|
||||||
|
this.markChanged();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if(this.amountLoaded <= 0) {
|
||||||
|
this.typeLoaded = -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(amountLoaded > rodCount) amountLoaded = rodCount;
|
||||||
|
|
||||||
|
/* CORE COOLING */
|
||||||
|
double coreCoolingApproachNum = getXOverE((double) this.heatexCount * 5 / (double) this.rodCount, 2) / 2D;
|
||||||
|
int averageCoreHeat = (this.coreHeat + this.hullHeat) / 2;
|
||||||
|
this.coreHeat -= (coreHeat - averageCoreHeat) * coreCoolingApproachNum;
|
||||||
|
this.hullHeat -= (hullHeat - averageCoreHeat) * coreCoolingApproachNum;
|
||||||
|
|
||||||
|
updateCoolant();
|
||||||
|
|
||||||
|
this.coreHeat *= 0.999D;
|
||||||
|
this.hullHeat *= 0.999D;
|
||||||
|
|
||||||
|
this.flux = newFlux;
|
||||||
|
|
||||||
|
if(tanks[0].getTankType().hasTrait(FT_PWRModerator.class) && tanks[0].getFill() > 0) {
|
||||||
|
this.flux *= tanks[0].getTankType().getTrait(FT_PWRModerator.class).getMultiplier();
|
||||||
|
}
|
||||||
|
|
||||||
|
if(this.coreHeat > this.coreHeatCapacity) {
|
||||||
|
meltDown();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
NBTTagCompound data = new NBTTagCompound();
|
NBTTagCompound data = new NBTTagCompound();
|
||||||
|
|||||||
@ -494,6 +494,12 @@ public class TileEntityWatz extends TileEntityMachineBase implements IFluidStand
|
|||||||
setBrokenColumn(1, ModBlocks.watz_end, 1, 2, -2);
|
setBrokenColumn(1, ModBlocks.watz_end, 1, 2, -2);
|
||||||
setBrokenColumn(1, ModBlocks.watz_end, 1, -2, 2);
|
setBrokenColumn(1, ModBlocks.watz_end, 1, -2, 2);
|
||||||
setBrokenColumn(1, ModBlocks.watz_end, 1, -2, -2);
|
setBrokenColumn(1, ModBlocks.watz_end, 1, -2, -2);
|
||||||
|
|
||||||
|
List<EntityPlayer> players = worldObj.getEntitiesWithinAABB(EntityPlayer.class, AxisAlignedBB.getBoundingBox(xCoord + 0.5, yCoord + 0.5, zCoord + 0.5, xCoord + 0.5, yCoord + 0.5, zCoord + 0.5).expand(50, 50, 50));
|
||||||
|
|
||||||
|
for(EntityPlayer player : players) {
|
||||||
|
player.triggerAchievement(MainRegistry.achWatzBoom);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void setBrokenColumn(int minHeight, Block b, int meta, int x, int z) {
|
private void setBrokenColumn(int minHeight, Block b, int meta, int x, int z) {
|
||||||
|
|||||||
@ -1,8 +1,6 @@
|
|||||||
package com.hbm.tileentity.network;
|
package com.hbm.tileentity.network;
|
||||||
|
|
||||||
import com.hbm.tileentity.TileEntityMachineBase;
|
import com.hbm.tileentity.TileEntityMachineBase;
|
||||||
import cpw.mods.fml.relauncher.Side;
|
|
||||||
import cpw.mods.fml.relauncher.SideOnly;
|
|
||||||
import net.minecraft.nbt.NBTTagCompound;
|
import net.minecraft.nbt.NBTTagCompound;
|
||||||
import net.minecraft.network.NetworkManager;
|
import net.minecraft.network.NetworkManager;
|
||||||
import net.minecraft.network.Packet;
|
import net.minecraft.network.Packet;
|
||||||
@ -11,6 +9,7 @@ import net.minecraftforge.common.util.Constants;
|
|||||||
import net.minecraftforge.common.util.ForgeDirection;
|
import net.minecraftforge.common.util.ForgeDirection;
|
||||||
|
|
||||||
public abstract class TileEntityCraneBase extends TileEntityMachineBase {
|
public abstract class TileEntityCraneBase extends TileEntityMachineBase {
|
||||||
|
|
||||||
public TileEntityCraneBase(int scount) {
|
public TileEntityCraneBase(int scount) {
|
||||||
super(scount);
|
super(scount);
|
||||||
}
|
}
|
||||||
@ -19,15 +18,15 @@ public abstract class TileEntityCraneBase extends TileEntityMachineBase {
|
|||||||
// for compatibility purposes, normal meta values are still used by default
|
// for compatibility purposes, normal meta values are still used by default
|
||||||
private ForgeDirection outputOverride = ForgeDirection.UNKNOWN;
|
private ForgeDirection outputOverride = ForgeDirection.UNKNOWN;
|
||||||
|
|
||||||
// for extra stability in case the screwdriver action doesn't get synced to other clients
|
// for extra stability in case the screwdriver action doesn't get synced to
|
||||||
@SideOnly(Side.CLIENT)
|
// other clients
|
||||||
private ForgeDirection cachedOutputOverride = ForgeDirection.UNKNOWN;
|
private ForgeDirection cachedOutputOverride = ForgeDirection.UNKNOWN;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void updateEntity() {
|
public void updateEntity() {
|
||||||
if (hasWorldObj() && worldObj.isRemote) {
|
if(hasWorldObj() && worldObj.isRemote) {
|
||||||
if (cachedOutputOverride != outputOverride) {
|
if(cachedOutputOverride != outputOverride) {
|
||||||
worldObj.markBlockForUpdate(xCoord, yCoord, zCoord);
|
worldObj.markBlockForUpdate(xCoord, yCoord, zCoord);
|
||||||
cachedOutputOverride = outputOverride;
|
cachedOutputOverride = outputOverride;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -48,12 +47,11 @@ public abstract class TileEntityCraneBase extends TileEntityMachineBase {
|
|||||||
|
|
||||||
public void setOutputOverride(ForgeDirection direction) {
|
public void setOutputOverride(ForgeDirection direction) {
|
||||||
ForgeDirection oldSide = getOutputSide();
|
ForgeDirection oldSide = getOutputSide();
|
||||||
if (oldSide == direction)
|
if(oldSide == direction) direction = direction.getOpposite();
|
||||||
direction = direction.getOpposite();
|
|
||||||
|
|
||||||
outputOverride = direction;
|
outputOverride = direction;
|
||||||
|
|
||||||
if (direction == getInputSide())
|
if(direction == getInputSide())
|
||||||
setInput(oldSide);
|
setInput(oldSide);
|
||||||
else
|
else
|
||||||
onBlockChanged();
|
onBlockChanged();
|
||||||
@ -63,18 +61,17 @@ public abstract class TileEntityCraneBase extends TileEntityMachineBase {
|
|||||||
outputOverride = getOutputSide(); // save the current output, if it isn't saved yet
|
outputOverride = getOutputSide(); // save the current output, if it isn't saved yet
|
||||||
|
|
||||||
ForgeDirection oldSide = getInputSide();
|
ForgeDirection oldSide = getInputSide();
|
||||||
if (oldSide == direction)
|
if(oldSide == direction) direction = direction.getOpposite();
|
||||||
direction = direction.getOpposite();
|
|
||||||
|
|
||||||
boolean needSwapOutput = direction == getOutputSide();
|
boolean needSwapOutput = direction == getOutputSide();
|
||||||
worldObj.setBlockMetadataWithNotify(xCoord, yCoord, zCoord, direction.ordinal(), needSwapOutput ? 4 : 3);
|
worldObj.setBlockMetadataWithNotify(xCoord, yCoord, zCoord, direction.ordinal(), needSwapOutput ? 4 : 3);
|
||||||
|
|
||||||
if (needSwapOutput)
|
if(needSwapOutput)
|
||||||
setOutputOverride(oldSide);
|
setOutputOverride(oldSide);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void onBlockChanged() {
|
protected void onBlockChanged() {
|
||||||
if (!hasWorldObj()) return;
|
if(!hasWorldObj()) return;
|
||||||
worldObj.markBlockForUpdate(xCoord, yCoord, zCoord);
|
worldObj.markBlockForUpdate(xCoord, yCoord, zCoord);
|
||||||
worldObj.notifyBlockChange(xCoord, yCoord, zCoord, getBlockType());
|
worldObj.notifyBlockChange(xCoord, yCoord, zCoord, getBlockType());
|
||||||
markDirty();
|
markDirty();
|
||||||
@ -95,7 +92,7 @@ public abstract class TileEntityCraneBase extends TileEntityMachineBase {
|
|||||||
@Override
|
@Override
|
||||||
public void readFromNBT(NBTTagCompound nbt) {
|
public void readFromNBT(NBTTagCompound nbt) {
|
||||||
super.readFromNBT(nbt);
|
super.readFromNBT(nbt);
|
||||||
if (nbt.hasKey("CraneOutputOverride", Constants.NBT.TAG_BYTE))
|
if(nbt.hasKey("CraneOutputOverride", Constants.NBT.TAG_BYTE))
|
||||||
outputOverride = ForgeDirection.getOrientation(nbt.getByte("CraneOutputOverride"));
|
outputOverride = ForgeDirection.getOrientation(nbt.getByte("CraneOutputOverride"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user