mirror of
https://github.com/Ellpeck/ActuallyAdditions.git
synced 2024-11-22 15:18:34 +01:00
possibly fixed laser relays sometimes disconnecting (finally? D:)
This commit is contained in:
parent
f7576c652a
commit
d9695923d8
2 changed files with 8 additions and 26 deletions
|
@ -10,6 +10,7 @@
|
|||
|
||||
package de.ellpeck.actuallyadditions.mod.blocks;
|
||||
|
||||
import de.ellpeck.actuallyadditions.api.ActuallyAdditionsAPI;
|
||||
import de.ellpeck.actuallyadditions.api.laser.Network;
|
||||
import de.ellpeck.actuallyadditions.mod.ActuallyAdditions;
|
||||
import de.ellpeck.actuallyadditions.mod.blocks.base.BlockContainerBase;
|
||||
|
@ -273,6 +274,13 @@ public class BlockLaserRelay extends BlockContainerBase implements IHudDisplay{
|
|||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void breakBlock(World world, BlockPos pos, IBlockState state){
|
||||
super.breakBlock(world, pos, state);
|
||||
|
||||
ActuallyAdditionsAPI.connectionHandler.removeRelayFromNetwork(pos, world);
|
||||
}
|
||||
|
||||
public enum Type{
|
||||
ENERGY_BASIC,
|
||||
ENERGY_ADVANCED,
|
||||
|
|
|
@ -28,8 +28,6 @@ import net.minecraftforge.fml.relauncher.Side;
|
|||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
import net.minecraftforge.items.IItemHandler;
|
||||
|
||||
import java.util.Set;
|
||||
|
||||
public abstract class TileEntityLaserRelay extends TileEntityInventoryBase{
|
||||
|
||||
public static final int MAX_DISTANCE = 15;
|
||||
|
@ -41,8 +39,6 @@ public abstract class TileEntityLaserRelay extends TileEntityInventoryBase{
|
|||
private int changeAmountAtCaching = -1;
|
||||
private int lastRange;
|
||||
|
||||
private Set<IConnectionPair> tempConnectionStorage;
|
||||
|
||||
public TileEntityLaserRelay(String name, LaserType type){
|
||||
super(1, name);
|
||||
this.type = type;
|
||||
|
@ -153,28 +149,6 @@ public abstract class TileEntityLaserRelay extends TileEntityInventoryBase{
|
|||
return this.cachedNetwork;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void invalidate(){
|
||||
super.invalidate();
|
||||
//This is because Minecraft randomly invalidates tiles on world join and then validates them again
|
||||
//We need to compensate for this so that connections don't get broken randomly
|
||||
this.tempConnectionStorage = ActuallyAdditionsAPI.connectionHandler.getConnectionsFor(this.pos, this.world);
|
||||
|
||||
ActuallyAdditionsAPI.connectionHandler.removeRelayFromNetwork(this.pos, this.world);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void validate(){
|
||||
if(this.tempConnectionStorage != null){
|
||||
for(IConnectionPair pair : this.tempConnectionStorage){
|
||||
ActuallyAdditionsAPI.connectionHandler.addConnection(pair.getPositions()[0], pair.getPositions()[1], pair.getType(), this.world, pair.doesSuppressRender());
|
||||
}
|
||||
this.tempConnectionStorage = null;
|
||||
}
|
||||
|
||||
super.validate();
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public AxisAlignedBB getRenderBoundingBox(){
|
||||
|
|
Loading…
Reference in a new issue