Work on transporters, don't use them unless you like buggy item transport pipes that currently do nothing
This commit is contained in:
parent
5b44e0f409
commit
4b82ab6cc1
11 changed files with 556 additions and 8 deletions
|
@ -82,6 +82,26 @@ public class Object3D
|
|||
return new Object3D(nbtTags.getInteger("x"), nbtTags.getInteger("y"), nbtTags.getInteger("z"), nbtTags.getInteger("dimensionId"));
|
||||
}
|
||||
|
||||
public Object3D difference(Object3D other)
|
||||
{
|
||||
return new Object3D(xCoord-other.xCoord, yCoord-other.yCoord, zCoord-other.zCoord);
|
||||
}
|
||||
|
||||
public ForgeDirection sideDifference(Object3D other)
|
||||
{
|
||||
Object3D diff = difference(other);
|
||||
|
||||
for(ForgeDirection side : ForgeDirection.VALID_DIRECTIONS)
|
||||
{
|
||||
if(side.offsetX == xCoord && side.offsetY == yCoord && side.offsetZ == zCoord)
|
||||
{
|
||||
return side;
|
||||
}
|
||||
}
|
||||
|
||||
return ForgeDirection.UNKNOWN;
|
||||
}
|
||||
|
||||
public int distanceTo(Object3D obj)
|
||||
{
|
||||
int subX = xCoord - obj.xCoord;
|
||||
|
@ -95,6 +115,17 @@ public class Object3D
|
|||
return world.getBlockId(xCoord+side.offsetX, yCoord+side.offsetY, zCoord+side.offsetZ) == 0;
|
||||
}
|
||||
|
||||
public Object3D step(ForgeDirection side)
|
||||
{
|
||||
return translate(side.offsetX, side.offsetY, side.offsetZ);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString()
|
||||
{
|
||||
return "[Object3D: " + xCoord + ", " + yCoord + ", " + zCoord + "]";
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object obj)
|
||||
{
|
||||
|
|
|
@ -1,11 +1,16 @@
|
|||
package mekanism.client.render.tileentity;
|
||||
|
||||
import mekanism.api.Object3D;
|
||||
import mekanism.client.model.ModelTransmitter;
|
||||
import mekanism.common.TransporterStack;
|
||||
import mekanism.common.tileentity.TileEntityLogisticalTransporter;
|
||||
import mekanism.common.util.MekanismUtils;
|
||||
import mekanism.common.util.MekanismUtils.ResourceType;
|
||||
import mekanism.common.util.TransporterUtils;
|
||||
import net.minecraft.client.renderer.entity.RenderItem;
|
||||
import net.minecraft.client.renderer.entity.RenderManager;
|
||||
import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer;
|
||||
import net.minecraft.entity.item.EntityItem;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraftforge.common.ForgeDirection;
|
||||
|
||||
|
@ -19,6 +24,9 @@ public class RenderLogisticalTransporter extends TileEntitySpecialRenderer
|
|||
{
|
||||
private ModelTransmitter model = new ModelTransmitter();
|
||||
|
||||
private EntityItem entityItem = new EntityItem(null);
|
||||
private RenderItem renderer = (RenderItem)RenderManager.instance.getEntityClassRenderObject(EntityItem.class);
|
||||
|
||||
@Override
|
||||
public void renderTileEntityAt(TileEntity tileEntity, double x, double y, double z, float partialTick)
|
||||
{
|
||||
|
@ -43,6 +51,17 @@ public class RenderLogisticalTransporter extends TileEntitySpecialRenderer
|
|||
}
|
||||
|
||||
GL11.glEnable(GL11.GL_CULL_FACE);
|
||||
|
||||
for(TransporterStack stack : tileEntity.transit)
|
||||
{
|
||||
entityItem.setEntityItemStack(stack.itemStack);
|
||||
Object3D offset = new Object3D(0, 0, 0).step(ForgeDirection.getOrientation(stack.getSide(tileEntity)));
|
||||
|
||||
double progress = (double)stack.progress / 100D * 0.5D;
|
||||
|
||||
renderer.doRenderItem(entityItem, x + 0.5 + offset.xCoord*progress, y + 1.5 + offset.yCoord*progress, z + 0.5 + offset.zCoord*progress, 0, 0);
|
||||
}
|
||||
|
||||
GL11.glPopMatrix();
|
||||
}
|
||||
}
|
||||
|
|
258
common/mekanism/common/TransporterPathfinder.java
Normal file
258
common/mekanism/common/TransporterPathfinder.java
Normal file
|
@ -0,0 +1,258 @@
|
|||
package mekanism.common;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
import mekanism.api.Object3D;
|
||||
import mekanism.common.tileentity.TileEntityLogisticalTransporter;
|
||||
import mekanism.common.util.TransporterUtils;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.ForgeDirection;
|
||||
|
||||
public final class TransporterPathfinder
|
||||
{
|
||||
public static class Destination
|
||||
{
|
||||
public World worldObj;
|
||||
|
||||
public Set<TileEntityLogisticalTransporter> iterated = new HashSet<TileEntityLogisticalTransporter>();
|
||||
|
||||
public TileEntityLogisticalTransporter start;
|
||||
public Object3D destination;
|
||||
public Object3D finalNode;
|
||||
|
||||
public ItemStack itemStack;
|
||||
|
||||
public Destination(World world, TileEntityLogisticalTransporter tileEntity, ItemStack stack)
|
||||
{
|
||||
worldObj = world;
|
||||
start = tileEntity;
|
||||
itemStack = stack;
|
||||
}
|
||||
|
||||
public void loop(TileEntityLogisticalTransporter pointer)
|
||||
{
|
||||
if(pointer == null || destination != null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
iterated.add(pointer);
|
||||
|
||||
for(ForgeDirection side : ForgeDirection.VALID_DIRECTIONS)
|
||||
{
|
||||
TileEntity tile = Object3D.get(pointer).getFromSide(side).getTileEntity(worldObj);
|
||||
|
||||
if(TransporterUtils.canInsert(tile, itemStack) && !(tile instanceof TileEntityLogisticalTransporter))
|
||||
{
|
||||
destination = Object3D.get(tile);
|
||||
finalNode = Object3D.get(pointer);
|
||||
return;
|
||||
}
|
||||
|
||||
if(tile instanceof TileEntityLogisticalTransporter && !iterated.contains(tile))
|
||||
{
|
||||
loop((TileEntityLogisticalTransporter)tile);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public Object3D find()
|
||||
{
|
||||
loop(start);
|
||||
|
||||
return destination;
|
||||
}
|
||||
}
|
||||
|
||||
public static class Path
|
||||
{
|
||||
public final Set<Object3D> openSet, closedSet;
|
||||
|
||||
public final HashMap<Object3D, Object3D> navMap;
|
||||
|
||||
public final HashMap<Object3D, Double> gScore, fScore;
|
||||
|
||||
public final Object3D target;
|
||||
|
||||
public final Object3D start;
|
||||
|
||||
public final Object3D finalNode;
|
||||
|
||||
public List<Object3D> results;
|
||||
|
||||
private World worldObj;
|
||||
|
||||
public Path(World world, Object3D node, Object3D startObj, Object3D finishObj)
|
||||
{
|
||||
worldObj = world;
|
||||
finalNode = node;
|
||||
start = startObj;
|
||||
target = finishObj;
|
||||
|
||||
openSet = new HashSet<Object3D>();
|
||||
closedSet = new HashSet<Object3D>();
|
||||
|
||||
navMap = new HashMap<Object3D, Object3D>();
|
||||
|
||||
gScore = new HashMap<Object3D, Double>();
|
||||
fScore = new HashMap<Object3D, Double>();
|
||||
|
||||
results = new ArrayList<Object3D>();
|
||||
}
|
||||
|
||||
public boolean find(final Object3D start)
|
||||
{
|
||||
openSet.add(start);
|
||||
gScore.put(start, 0d);
|
||||
fScore.put(start, gScore.get(start) + getEstimate(start, finalNode));
|
||||
|
||||
int blockCount = 0;
|
||||
|
||||
for(int i = 0; i < 6; i++)
|
||||
{
|
||||
ForgeDirection direction = ForgeDirection.getOrientation(i);
|
||||
Object3D neighbor = finalNode.translate(direction.offsetX, direction.offsetY, direction.offsetZ);
|
||||
|
||||
if(!(neighbor.getTileEntity(worldObj) instanceof TileEntityLogisticalTransporter))
|
||||
{
|
||||
blockCount++;
|
||||
}
|
||||
}
|
||||
|
||||
if(blockCount >= 6)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
double maxSearchDistance = start.distanceTo(finalNode) * 2;
|
||||
|
||||
while(!openSet.isEmpty())
|
||||
{
|
||||
Object3D currentNode = null;
|
||||
double lowestFScore = 0;
|
||||
|
||||
for(Object3D node : openSet)
|
||||
{
|
||||
if(currentNode == null || fScore.get(node) < lowestFScore)
|
||||
{
|
||||
currentNode = node;
|
||||
lowestFScore = fScore.get(node);
|
||||
}
|
||||
}
|
||||
|
||||
if(currentNode == null && start.distanceTo(currentNode) > maxSearchDistance)
|
||||
{
|
||||
break;
|
||||
}
|
||||
|
||||
if(currentNode.equals(finalNode))
|
||||
{
|
||||
for(ForgeDirection side : ForgeDirection.VALID_DIRECTIONS)
|
||||
{
|
||||
TileEntity tile = currentNode.getFromSide(side).getTileEntity(worldObj);
|
||||
|
||||
if(tile != null && Object3D.get(tile).equals(target))
|
||||
{
|
||||
results = reconstructPath(navMap, finalNode);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
openSet.remove(currentNode);
|
||||
closedSet.add(currentNode);
|
||||
|
||||
for(int i = 0; i < 6; i++)
|
||||
{
|
||||
ForgeDirection direction = ForgeDirection.getOrientation(i);
|
||||
Object3D neighbor = currentNode.getFromSide(direction);
|
||||
|
||||
if(neighbor.getTileEntity(worldObj) instanceof TileEntityLogisticalTransporter)
|
||||
{
|
||||
double tentativeG = gScore.get(currentNode) + currentNode.distanceTo(neighbor);
|
||||
|
||||
if(closedSet.contains(neighbor))
|
||||
{
|
||||
if(tentativeG >= gScore.get(neighbor))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
if(!openSet.contains(neighbor) || tentativeG < gScore.get(neighbor))
|
||||
{
|
||||
navMap.put(neighbor, currentNode);
|
||||
gScore.put(neighbor, tentativeG);
|
||||
fScore.put(neighbor, gScore.get(neighbor) + getEstimate(neighbor, finalNode));
|
||||
openSet.add(neighbor);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public List<Object3D> getPath()
|
||||
{
|
||||
boolean foundPath = find(start);
|
||||
|
||||
if(foundPath)
|
||||
{
|
||||
results.add(0, target);
|
||||
return results;
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
private List<Object3D> reconstructPath(HashMap<Object3D, Object3D> naviMap, Object3D currentNode)
|
||||
{
|
||||
List<Object3D> path = new ArrayList<Object3D>();
|
||||
path.add(currentNode);
|
||||
|
||||
if(naviMap.containsKey(currentNode))
|
||||
{
|
||||
path.addAll(reconstructPath(naviMap, naviMap.get(currentNode)));
|
||||
}
|
||||
|
||||
return path;
|
||||
}
|
||||
|
||||
private double getEstimate(Object3D start, Object3D target2)
|
||||
{
|
||||
return start.distanceTo(target2);
|
||||
}
|
||||
}
|
||||
|
||||
public static List<Object3D> getNewPath(TileEntityLogisticalTransporter start, ItemStack stack)
|
||||
{
|
||||
Destination d = new Destination(start.worldObj, start, stack);
|
||||
Object3D closest = d.find();
|
||||
|
||||
if(closest == null)
|
||||
{
|
||||
System.out.println("No target");
|
||||
return null;
|
||||
}
|
||||
|
||||
System.out.println("Target found: " + closest);
|
||||
|
||||
Path p = new Path(d.worldObj, d.finalNode, Object3D.get(start), closest);
|
||||
return p.getPath();
|
||||
}
|
||||
|
||||
public static List<Object3D> getHomePath(TileEntityLogisticalTransporter start, Object3D home, Object3D prevHome)
|
||||
{
|
||||
Path p = new Path(start.worldObj, prevHome, Object3D.get(start), home);
|
||||
return p.getPath();
|
||||
}
|
||||
}
|
|
@ -1,11 +1,40 @@
|
|||
package mekanism.common;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import mekanism.api.Object3D;
|
||||
import mekanism.common.tileentity.TileEntityLogisticalTransporter;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
|
||||
import com.google.common.io.ByteArrayDataInput;
|
||||
|
||||
public class TransporterStack
|
||||
{
|
||||
public ItemStack transferStack;
|
||||
public ItemStack itemStack;
|
||||
|
||||
/** out of 100 */
|
||||
public int progress;
|
||||
|
||||
public List<Object3D> pathToTarget = new ArrayList<Object3D>();
|
||||
|
||||
public Object3D originalLocation;
|
||||
|
||||
public Object3D clientNext;
|
||||
public Object3D clientPrev;
|
||||
|
||||
public boolean goingHome = false;
|
||||
|
||||
public void write(ArrayList data)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public void read(ByteArrayDataInput dataStream)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public void write(NBTTagCompound nbtTags)
|
||||
{
|
||||
|
@ -16,4 +45,72 @@ public class TransporterStack
|
|||
{
|
||||
|
||||
}
|
||||
|
||||
public boolean hasPath()
|
||||
{
|
||||
return pathToTarget != null;
|
||||
}
|
||||
|
||||
public void recalculatePath(TileEntityLogisticalTransporter tileEntity)
|
||||
{
|
||||
pathToTarget = TransporterPathfinder.getNewPath(tileEntity, itemStack);
|
||||
}
|
||||
|
||||
public void sendHome(TileEntityLogisticalTransporter tileEntity)
|
||||
{
|
||||
pathToTarget = TransporterPathfinder.getHomePath(tileEntity, originalLocation, pathToTarget.get(pathToTarget.size()-1));
|
||||
goingHome = true;
|
||||
}
|
||||
|
||||
public boolean isFinal(TileEntityLogisticalTransporter tileEntity)
|
||||
{
|
||||
return pathToTarget.indexOf(Object3D.get(tileEntity)) == 1;
|
||||
}
|
||||
|
||||
public Object3D getNext(TileEntityLogisticalTransporter tileEntity)
|
||||
{
|
||||
if(!tileEntity.worldObj.isRemote)
|
||||
{
|
||||
int index = pathToTarget.indexOf(Object3D.get(tileEntity))-1;
|
||||
return pathToTarget.get(index);
|
||||
}
|
||||
else {
|
||||
return clientNext;
|
||||
}
|
||||
}
|
||||
|
||||
public Object3D getPrev(TileEntityLogisticalTransporter tileEntity)
|
||||
{
|
||||
if(!tileEntity.worldObj.isRemote)
|
||||
{
|
||||
int index = pathToTarget.indexOf(Object3D.get(tileEntity))+1;
|
||||
|
||||
if(pathToTarget.get(index) != null)
|
||||
{
|
||||
return pathToTarget.get(index);
|
||||
}
|
||||
else {
|
||||
return originalLocation;
|
||||
}
|
||||
}
|
||||
else {
|
||||
return clientPrev;
|
||||
}
|
||||
}
|
||||
|
||||
public int getSide(TileEntityLogisticalTransporter tileEntity)
|
||||
{
|
||||
if(progress < 50)
|
||||
{
|
||||
return Object3D.get(tileEntity).sideDifference(getPrev(tileEntity)).ordinal();
|
||||
}
|
||||
else {
|
||||
return Object3D.get(tileEntity).sideDifference(getNext(tileEntity)).ordinal();
|
||||
}
|
||||
}
|
||||
|
||||
public Object3D getDest()
|
||||
{
|
||||
return pathToTarget.get(0);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -12,6 +12,7 @@ import mekanism.api.transmitters.ITransmitter;
|
|||
import mekanism.client.ClientProxy;
|
||||
import mekanism.common.Mekanism;
|
||||
import mekanism.common.PipeUtils;
|
||||
import mekanism.common.TransporterPathfinder;
|
||||
import mekanism.common.tileentity.TileEntityLogisticalTransporter;
|
||||
import mekanism.common.tileentity.TileEntityMechanicalPipe;
|
||||
import mekanism.common.tileentity.TileEntityPressurizedTube;
|
||||
|
@ -292,6 +293,11 @@ public class BlockTransmitter extends Block
|
|||
{
|
||||
MinecraftForge.EVENT_BUS.post(new EnergyTileLoadEvent((IEnergyTile)tileEntity));
|
||||
}
|
||||
|
||||
if(tileEntity instanceof TileEntityLogisticalTransporter)
|
||||
{
|
||||
System.out.println(TransporterPathfinder.getPath((TileEntityLogisticalTransporter)tileEntity, new ItemStack(Item.appleRed)));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -20,6 +20,7 @@ import mekanism.common.tileentity.TileEntityMechanicalPipe;
|
|||
import mekanism.common.util.MekanismUtils;
|
||||
import net.minecraft.entity.item.EntityItem;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
|
@ -75,6 +76,12 @@ public class ItemConfigurator extends ItemEnergized
|
|||
return true;
|
||||
}
|
||||
}
|
||||
else if(world.getBlockTileEntity(x, y, z) instanceof TileEntityLogisticalTransporter)
|
||||
{
|
||||
TileEntityLogisticalTransporter transporter = (TileEntityLogisticalTransporter)world.getBlockTileEntity(x, y, z);
|
||||
transporter.insert(new Object3D(x, y, z).getFromSide(ForgeDirection.getOrientation(side)), new ItemStack(Item.appleRed));
|
||||
return true;
|
||||
}
|
||||
else if(world.getBlockTileEntity(x, y, z) instanceof ITransmitter)
|
||||
{
|
||||
((ITransmitter)world.getBlockTileEntity(x, y, z)).fixTransmitterNetwork();
|
||||
|
|
|
@ -2,6 +2,7 @@ package mekanism.common.tileentity;
|
|||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
|
||||
import mekanism.api.Object3D;
|
||||
import mekanism.api.transmitters.ITransmitter;
|
||||
|
@ -10,8 +11,10 @@ import mekanism.common.ITileNetwork;
|
|||
import mekanism.common.InventoryNetwork;
|
||||
import mekanism.common.PacketHandler;
|
||||
import mekanism.common.PacketHandler.Transmission;
|
||||
import mekanism.common.TransporterStack;
|
||||
import mekanism.common.network.PacketDataRequest;
|
||||
import mekanism.common.util.TransporterUtils;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.AxisAlignedBB;
|
||||
|
@ -27,6 +30,120 @@ public class TileEntityLogisticalTransporter extends TileEntityTransmitter<Inven
|
|||
/** This transporter's active state. */
|
||||
public boolean isActive = false;
|
||||
|
||||
public Set<TransporterStack> transit = new HashSet<TransporterStack>();
|
||||
|
||||
@Override
|
||||
public void updateEntity()
|
||||
{
|
||||
if(!worldObj.isRemote)
|
||||
{
|
||||
Set<TransporterStack> remove = new HashSet<TransporterStack>();
|
||||
|
||||
for(TransporterStack stack : transit)
|
||||
{
|
||||
stack.progress++;
|
||||
|
||||
if(stack.progress > 100)
|
||||
{
|
||||
if(stack.hasPath())
|
||||
{
|
||||
int currentIndex = stack.pathToTarget.indexOf(Object3D.get(this));
|
||||
Object3D next = stack.pathToTarget.get(currentIndex-1);
|
||||
|
||||
if(!stack.isFinal(this))
|
||||
{
|
||||
if(next != null && next.getTileEntity(worldObj) instanceof TileEntityLogisticalTransporter)
|
||||
{
|
||||
TileEntityLogisticalTransporter nextTile = (TileEntityLogisticalTransporter)next.getTileEntity(worldObj);
|
||||
nextTile.entityEntering(stack);
|
||||
remove.add(stack);
|
||||
|
||||
continue;
|
||||
}
|
||||
}
|
||||
else {
|
||||
if(!stack.goingHome)
|
||||
{
|
||||
|
||||
}
|
||||
else {
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
stack.sendHome(this);
|
||||
|
||||
if(!stack.hasPath())
|
||||
{
|
||||
//drop
|
||||
remove.add(stack);
|
||||
}
|
||||
}
|
||||
else if(stack.progress == 50)
|
||||
{
|
||||
if(stack.isFinal(this))
|
||||
{
|
||||
if(!TransporterUtils.canInsert(stack.getDest().getTileEntity(worldObj), stack.itemStack) && !stack.goingHome)
|
||||
{
|
||||
stack.sendHome(this);
|
||||
|
||||
if(!stack.hasPath())
|
||||
{
|
||||
//drop
|
||||
remove.add(stack);
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
if(!(stack.getNext(this).getTileEntity(worldObj) instanceof TileEntityLogisticalTransporter))
|
||||
{
|
||||
stack.sendHome(this);
|
||||
|
||||
if(!stack.hasPath())
|
||||
{
|
||||
//drop
|
||||
remove.add(stack);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for(TransporterStack stack : remove)
|
||||
{
|
||||
transit.remove(stack);
|
||||
}
|
||||
|
||||
for(TransporterStack stack : transit)
|
||||
{
|
||||
System.out.println(Object3D.get(this) + " " + stack.progress);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public boolean insert(Object3D original, ItemStack itemStack)
|
||||
{
|
||||
TransporterStack stack = new TransporterStack();
|
||||
stack.itemStack = itemStack;
|
||||
stack.originalLocation = original;
|
||||
stack.recalculatePath(this);
|
||||
|
||||
if(stack.hasPath())
|
||||
{
|
||||
transit.add(stack);
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public void entityEntering(TransporterStack stack)
|
||||
{
|
||||
stack.progress = 0;
|
||||
transit.add(stack);
|
||||
}
|
||||
|
||||
@Override
|
||||
public TransmissionType getTransmissionType()
|
||||
{
|
||||
|
@ -113,12 +230,6 @@ public class TileEntityLogisticalTransporter extends TileEntityTransmitter<Inven
|
|||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canUpdate()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void validate()
|
||||
{
|
||||
|
|
|
@ -5,8 +5,10 @@ import java.util.Arrays;
|
|||
import mekanism.api.Object3D;
|
||||
import mekanism.api.transmitters.ITransmitter;
|
||||
import mekanism.api.transmitters.TransmissionType;
|
||||
import mekanism.common.tileentity.TileEntityLogisticalTransporter;
|
||||
import net.minecraft.inventory.IInventory;
|
||||
import net.minecraft.inventory.ISidedInventory;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraftforge.common.ForgeDirection;
|
||||
|
||||
|
@ -108,4 +110,21 @@ public final class TransporterUtils
|
|||
|
||||
return inventories;
|
||||
}
|
||||
|
||||
public static boolean insert(TileEntity outputter, TileEntityLogisticalTransporter tileEntity, ItemStack itemStack)
|
||||
{
|
||||
return tileEntity.insert(Object3D.get(outputter), itemStack);
|
||||
}
|
||||
|
||||
public static boolean canInsert(TileEntity tileEntity, ItemStack itemStack)
|
||||
{
|
||||
if(!(tileEntity instanceof IInventory))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
IInventory inventory = (IInventory)tileEntity;
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
|
@ -226,7 +226,7 @@ public abstract class TileEntityGenerator extends TileEntityElectricBlock implem
|
|||
{
|
||||
PacketHandler.sendPacket(Transmission.ALL_CLIENTS, new PacketTileEntity().setParams(Object3D.get(this), getNetworkedData(new ArrayList())));
|
||||
|
||||
updateDelay = 10;
|
||||
updateDelay = Mekanism.UPDATE_DELAY;
|
||||
clientActive = active;
|
||||
}
|
||||
}
|
||||
|
|
Binary file not shown.
Before Width: | Height: | Size: 11 KiB After Width: | Height: | Size: 6.3 KiB |
Binary file not shown.
Before Width: | Height: | Size: 11 KiB After Width: | Height: | Size: 6.3 KiB |
Loading…
Reference in a new issue