Started work on implementation of Dynamic Tank cache merging, fixed Salination Tank not rendering at height 3, made sure all multiblocks load after partial chunk load
This commit is contained in:
parent
4090fcf490
commit
1cfe6fc352
5 changed files with 70 additions and 36 deletions
|
@ -7,6 +7,7 @@ import mekanism.api.Coord4D;
|
|||
import mekanism.client.render.MekanismRenderer;
|
||||
import mekanism.client.render.MekanismRenderer.DisplayInteger;
|
||||
import mekanism.client.render.MekanismRenderer.Model3D;
|
||||
import mekanism.common.Mekanism;
|
||||
import mekanism.common.tank.TankUpdateProtocol;
|
||||
import mekanism.common.tile.TileEntitySalinationController;
|
||||
import net.minecraft.client.renderer.tileentity.TileEntityRendererDispatcher;
|
||||
|
@ -43,7 +44,7 @@ public class RenderSalinationController extends TileEntitySpecialRenderer
|
|||
|
||||
bindTexture(MekanismRenderer.getBlocksTexture());
|
||||
|
||||
if(data.height >= 2 && tileEntity.waterTank.getCapacity() > 0)
|
||||
if(data.height >= 1 && tileEntity.waterTank.getCapacity() > 0)
|
||||
{
|
||||
Coord4D renderLoc = tileEntity.getRenderLocation();
|
||||
|
||||
|
|
|
@ -1,6 +1,8 @@
|
|||
package mekanism.common.tank;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
import mekanism.api.Coord4D;
|
||||
|
@ -379,7 +381,8 @@ public class TankUpdateProtocol
|
|||
}
|
||||
}
|
||||
|
||||
int idFound = -1;
|
||||
List<Integer> idsFound = new ArrayList<Integer>();
|
||||
int idToUse = -1;
|
||||
|
||||
for(Coord4D obj : structureFound.locations)
|
||||
{
|
||||
|
@ -387,22 +390,26 @@ public class TankUpdateProtocol
|
|||
|
||||
if(tileEntity.inventoryID != -1)
|
||||
{
|
||||
idFound = tileEntity.inventoryID;
|
||||
break;
|
||||
idsFound.add(tileEntity.inventoryID);
|
||||
}
|
||||
}
|
||||
|
||||
DynamicTankCache cache = new DynamicTankCache();
|
||||
|
||||
if(idFound != -1)
|
||||
if(!idsFound.isEmpty())
|
||||
{
|
||||
if(Mekanism.dynamicInventories.get(idFound) != null)
|
||||
for(int id : idsFound)
|
||||
{
|
||||
cache = MekanismUtils.pullInventory(pointer.getWorldObj(), idFound);
|
||||
if(Mekanism.dynamicInventories.get(id) != null)
|
||||
{
|
||||
cache = MekanismUtils.pullInventory(pointer.getWorldObj(), id);
|
||||
idToUse = id;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
idFound = MekanismUtils.getUniqueInventoryID();
|
||||
idToUse = MekanismUtils.getUniqueInventoryID();
|
||||
}
|
||||
|
||||
cache.apply(structureFound);
|
||||
|
@ -416,7 +423,7 @@ public class TankUpdateProtocol
|
|||
{
|
||||
TileEntityDynamicTank tileEntity = (TileEntityDynamicTank)obj.getTileEntity(pointer.getWorldObj());
|
||||
|
||||
tileEntity.inventoryID = idFound;
|
||||
tileEntity.inventoryID = idToUse;
|
||||
tileEntity.structure = structureFound;
|
||||
|
||||
tileEntity.cachedData.sync(structureFound);
|
||||
|
|
|
@ -11,7 +11,9 @@ import net.minecraftforge.common.util.ForgeDirection;
|
|||
|
||||
public class TileEntitySalinationBlock extends TileEntityContainerBlock
|
||||
{
|
||||
TileEntitySalinationController master;
|
||||
public TileEntitySalinationController master;
|
||||
|
||||
public boolean attempted;
|
||||
|
||||
public TileEntitySalinationBlock()
|
||||
{
|
||||
|
@ -28,7 +30,15 @@ public class TileEntitySalinationBlock extends TileEntityContainerBlock
|
|||
}
|
||||
|
||||
@Override
|
||||
public void onUpdate() {};
|
||||
public void onUpdate()
|
||||
{
|
||||
if(!worldObj.isRemote && ticker == 5 && !attempted && master == null)
|
||||
{
|
||||
updateController();
|
||||
}
|
||||
|
||||
attempted = false;
|
||||
}
|
||||
|
||||
public void addToStructure(TileEntitySalinationController controller)
|
||||
{
|
||||
|
@ -63,15 +73,20 @@ public class TileEntitySalinationBlock extends TileEntityContainerBlock
|
|||
master.refresh();
|
||||
}
|
||||
else {
|
||||
if(!(this instanceof TileEntitySalinationController))
|
||||
{
|
||||
TileEntitySalinationController found = new ControllerFinder().find();
|
||||
|
||||
if(found != null)
|
||||
{
|
||||
found.refresh();
|
||||
}
|
||||
}
|
||||
updateController();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void updateController()
|
||||
{
|
||||
if(!(this instanceof TileEntitySalinationController))
|
||||
{
|
||||
TileEntitySalinationController found = new ControllerFinder().find();
|
||||
|
||||
if(found != null)
|
||||
{
|
||||
found.refresh();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -97,6 +112,8 @@ public class TileEntitySalinationBlock extends TileEntityContainerBlock
|
|||
|
||||
if(!iterated.contains(coord) && coord.getTileEntity(worldObj) instanceof TileEntitySalinationBlock)
|
||||
{
|
||||
((TileEntitySalinationBlock)coord.getTileEntity(worldObj)).attempted = true;
|
||||
|
||||
if(coord.getTileEntity(worldObj) instanceof TileEntitySalinationController)
|
||||
{
|
||||
found = (TileEntitySalinationController)coord.getTileEntity(worldObj);
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
package mekanism.generators.common.tile.reactor;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.EnumSet;
|
||||
import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
|
@ -8,8 +7,6 @@ import java.util.Set;
|
|||
import mekanism.api.Coord4D;
|
||||
import mekanism.api.reactor.IFusionReactor;
|
||||
import mekanism.api.reactor.IReactorBlock;
|
||||
import mekanism.common.Mekanism;
|
||||
import mekanism.common.network.PacketTileEntity.TileEntityMessage;
|
||||
import mekanism.common.tile.TileEntityElectricBlock;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
@ -18,6 +15,8 @@ public abstract class TileEntityReactorBlock extends TileEntityElectricBlock imp
|
|||
{
|
||||
public IFusionReactor fusionReactor;
|
||||
|
||||
public boolean attempted;
|
||||
|
||||
public boolean changed;
|
||||
|
||||
public TileEntityReactorBlock()
|
||||
|
@ -68,6 +67,13 @@ public abstract class TileEntityReactorBlock extends TileEntityElectricBlock imp
|
|||
{
|
||||
changed = false;
|
||||
}
|
||||
|
||||
if(!worldObj.isRemote && ticker == 5 && !attempted && (getReactor() == null || !getReactor().isFormed()))
|
||||
{
|
||||
updateController();
|
||||
}
|
||||
|
||||
attempted = false;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -105,15 +111,20 @@ public abstract class TileEntityReactorBlock extends TileEntityElectricBlock imp
|
|||
getReactor().formMultiblock();
|
||||
}
|
||||
else {
|
||||
if(!(this instanceof TileEntityReactorController))
|
||||
{
|
||||
TileEntityReactorController found = new ControllerFinder().find();
|
||||
|
||||
if(found != null && (found.getReactor() == null || !found.getReactor().isFormed()))
|
||||
{
|
||||
found.formMultiblock();
|
||||
}
|
||||
}
|
||||
updateController();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void updateController()
|
||||
{
|
||||
if(!(this instanceof TileEntityReactorController))
|
||||
{
|
||||
TileEntityReactorController found = new ControllerFinder().find();
|
||||
|
||||
if(found != null && (found.getReactor() == null || !found.getReactor().isFormed()))
|
||||
{
|
||||
found.formMultiblock();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -139,6 +150,8 @@ public abstract class TileEntityReactorBlock extends TileEntityElectricBlock imp
|
|||
|
||||
if(!iterated.contains(coord) && coord.getTileEntity(worldObj) instanceof TileEntityReactorBlock)
|
||||
{
|
||||
((TileEntityReactorBlock)coord.getTileEntity(worldObj)).attempted = true;
|
||||
|
||||
if(coord.getTileEntity(worldObj) instanceof TileEntityReactorController)
|
||||
{
|
||||
found = (TileEntityReactorController)coord.getTileEntity(worldObj);
|
||||
|
|
|
@ -104,10 +104,6 @@ public class TileEntityReactorController extends TileEntityReactorBlock implemen
|
|||
clientTemp = getReactor().getPlasmaTemp();
|
||||
}
|
||||
}
|
||||
else if(ticker == 5 && !worldObj.isRemote)
|
||||
{
|
||||
formMultiblock();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
Loading…
Add table
Reference in a new issue