mirror of
https://github.com/Thorfusion/Mekanism-Community-Edition.git
synced 2026-11-26 06:42:56 +00:00
* Don't check Y height for sending update packets. Seems to fix compat with cubic chunks #5262 * First pass transitioning from using sendToReceivers to using built in forge stuff * Make code cleaner to read with helper methods * Fix accidental extra code from a local branch issue I had * Further improve readability * Rename method * shortcut if player not in same dimension & use EMP.server for the reference
48 lines
1.4 KiB
Java
48 lines
1.4 KiB
Java
package mekanism.common.tile;
|
|
|
|
import mekanism.common.Mekanism;
|
|
import mekanism.common.content.boiler.SynchronizedBoilerData;
|
|
import mekanism.common.multiblock.TileEntityInternalMultiblock;
|
|
import mekanism.common.util.MekanismUtils;
|
|
import net.minecraft.util.ITickable;
|
|
|
|
public class TileEntitySuperheatingElement extends TileEntityInternalMultiblock implements ITickable {
|
|
|
|
public boolean prevHot;
|
|
|
|
@Override
|
|
public void update() {
|
|
super.update();
|
|
}
|
|
|
|
@Override
|
|
public void setMultiblock(String id) {
|
|
boolean packet = false;
|
|
if (id == null && multiblockUUID != null) {
|
|
SynchronizedBoilerData.clientHotMap.remove(multiblockUUID);
|
|
packet = true;
|
|
} else if (id != null && multiblockUUID == null) {
|
|
packet = true;
|
|
}
|
|
|
|
super.setMultiblock(id);
|
|
|
|
if (packet && !world.isRemote) {
|
|
Mekanism.packetHandler.sendUpdatePacket(this);
|
|
}
|
|
}
|
|
|
|
@Override
|
|
public void onUpdate() {
|
|
if (world.isRemote) {
|
|
boolean newHot = false;
|
|
if (multiblockUUID != null && SynchronizedBoilerData.clientHotMap.get(multiblockUUID) != null) {
|
|
newHot = SynchronizedBoilerData.clientHotMap.get(multiblockUUID);
|
|
}
|
|
if (prevHot != newHot) {
|
|
MekanismUtils.updateBlock(world, getPos());
|
|
prevHot = newHot;
|
|
}
|
|
}
|
|
}
|
|
} |