use of me.desht.pneumaticcraft.common.tileentity.TileEntityHeatSink in project pnc-repressurized by TeamPneumatic.
the class BlockHeatSink method onEntityCollidedWithBlock.
@Override
public void onEntityCollidedWithBlock(World world, BlockPos pos, IBlockState state, Entity entity) {
TileEntity te = world.getTileEntity(pos);
if (te instanceof TileEntityHeatSink && entity instanceof EntityLivingBase) {
IHeatExchangerLogic heat = ((TileEntityHeatSink) te).getHeatExchangerLogic(null);
int temp = (int) ((TileEntityHeatSink) te).getHeatExchangerLogic(null).getTemperature();
if (temp > 323) {
// +50C
entity.attackEntityFrom(DamageSource.HOT_FLOOR, 2);
if (temp > 373) {
// +100C
entity.setFire(3);
}
} else if (temp < 243) {
// -30C
int durationSec = (243 - (int) heat.getTemperature()) / 10;
int amplifier = (243 - (int) heat.getTemperature()) / 80;
((EntityLivingBase) entity).addPotionEffect(new PotionEffect(MobEffects.SLOWNESS, durationSec * 20, amplifier));
if (temp < 213) {
// -60C
entity.attackEntityFrom(DamageSourcePneumaticCraft.FREEZING, 2);
}
}
}
}
use of me.desht.pneumaticcraft.common.tileentity.TileEntityHeatSink in project pnc-repressurized by TeamPneumatic.
the class ModuleAirGrate method coolHeatSinks.
private void coolHeatSinks(World world, BlockPos pos, int range) {
if (grateRange > 2) {
int curTeIndex = (int) (world.getTotalWorldTime() % 27);
BlockPos curPos = pos.offset(dir, 2).add(-1 + curTeIndex % 3, -1 + curTeIndex / 3 % 3, -1 + curTeIndex / 9 % 3);
TileEntity te = world.getTileEntity(curPos);
if (te instanceof TileEntityHeatSink)
heatSinks.add((TileEntityHeatSink) te);
Iterator<TileEntityHeatSink> iterator = heatSinks.iterator();
while (iterator.hasNext()) {
TileEntityHeatSink heatSink = iterator.next();
if (heatSink.isInvalid()) {
iterator.remove();
} else {
for (int i = 0; i < 4; i++) heatSink.onFannedByAirGrate();
}
}
}
}
Aggregations