mirror of
https://github.com/GTNewHorizons/Botania.git
synced 2026-11-27 23:45:57 +00:00
Mana Pools and Spreaders now add themselves back to the mana network case they get removed for whatever reason.
This commit is contained in:
1 parent
b83f460bbb
commit
fb9c1c40d8
3 files changed
+25
-8
No files matched your search
@@ -38,6 +38,7 @@ import vazkii.botania.client.lib.LibResources;
|
||||
import vazkii.botania.common.Botania;
|
||||
import vazkii.botania.common.block.ModBlocks;
|
||||
import vazkii.botania.common.block.tile.TileMod;
|
||||
import vazkii.botania.common.core.handler.ManaNetworkHandler;
|
||||
import vazkii.botania.common.item.ModItems;
|
||||
|
||||
public class TilePool extends TileMod implements IManaPool {
|
||||
@@ -57,7 +58,6 @@ public class TilePool extends TileMod implements IManaPool {
|
||||
int mana;
|
||||
int knownMana = -1;
|
||||
int craftCooldown = 20;
|
||||
boolean added = false;
|
||||
|
||||
@Override
|
||||
public boolean isFull() {
|
||||
@@ -147,10 +147,9 @@ public class TilePool extends TileMod implements IManaPool {
|
||||
|
||||
@Override
|
||||
public void updateEntity() {
|
||||
if(!added) {
|
||||
if(!ManaNetworkHandler.instance.isPoolIn(this))
|
||||
ManaNetworkEvent.addPool(this);
|
||||
added = true;
|
||||
}
|
||||
|
||||
if(worldObj.isRemote) {
|
||||
double particleChance = 1F - (double) getCurrentMana() / (double) MAX_MANA * 0.1;
|
||||
Color color = new Color(0x00C6FF);
|
||||
|
||||
@@ -46,6 +46,7 @@ import vazkii.botania.client.core.handler.HUDHandler;
|
||||
import vazkii.botania.client.lib.LibResources;
|
||||
import vazkii.botania.common.block.ModBlocks;
|
||||
import vazkii.botania.common.block.tile.TileSimpleInventory;
|
||||
import vazkii.botania.common.core.handler.ManaNetworkHandler;
|
||||
import vazkii.botania.common.core.helper.Vector3;
|
||||
import vazkii.botania.common.entity.EntityManaBurst;
|
||||
import vazkii.botania.common.entity.EntityManaBurst.PositionProperties;
|
||||
@@ -73,7 +74,6 @@ public class TileSpreader extends TileSimpleInventory implements IManaCollector,
|
||||
int mana;
|
||||
int knownMana = -1;
|
||||
public float rotationX, rotationY;
|
||||
boolean added = false;
|
||||
|
||||
boolean requestsClientUpdate = false;
|
||||
boolean hasReceivedInitialPacket = false;
|
||||
@@ -115,10 +115,8 @@ public class TileSpreader extends TileSimpleInventory implements IManaCollector,
|
||||
|
||||
@Override
|
||||
public void updateEntity() {
|
||||
if(!added) {
|
||||
if(!ManaNetworkHandler.instance.isCollectorIn(this))
|
||||
ManaNetworkEvent.addCollector(this);
|
||||
added = true;
|
||||
}
|
||||
|
||||
if(rotationTicks > 0) {
|
||||
rotationX += tickRotationX;
|
||||
|
||||
@@ -61,6 +61,26 @@ public final class ManaNetworkHandler implements IManaNetwork {
|
||||
return getClosest(manaCollectors.get(world), pos, world.isRemote, limit);
|
||||
return null;
|
||||
}
|
||||
|
||||
public boolean isCollectorIn(TileEntity tile) {
|
||||
return isIn(tile, manaCollectors);
|
||||
}
|
||||
|
||||
public boolean isPoolIn(TileEntity tile) {
|
||||
return isIn(tile, manaPools);
|
||||
}
|
||||
|
||||
private synchronized boolean isIn(TileEntity tile, Map<World, List<TileSignature>> map) {
|
||||
List<TileSignature> list = map.get(tile.getWorldObj());
|
||||
if(list == null)
|
||||
return false;
|
||||
|
||||
for(TileSignature sig : list)
|
||||
if(sig.tile == tile)
|
||||
return true;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
private synchronized TileEntity getClosest(List<TileSignature> tiles, ChunkCoordinates pos, boolean remoteCheck, int limit) {
|
||||
float closest = Float.MAX_VALUE;
|
||||
|
||||
Reference in new issue
Block a user