Jump to content

FatalEU

Members
  • Posts

    2
  • Joined

  • Last visited

Converted

  • Gender
    Undisclosed
  • Personal Text
    I am new!

FatalEU's Achievements

Tree Puncher

Tree Puncher (2/8)

0

Reputation

  1. Never mind everyone I did it; [/img] I added this into the ModEntity class; public ArrayList<ForgeDirection> directions = new ArrayList(); and in each of my tileentity classes I added directions public TileEntityContainer() { directions.add(ForgeDirection.DOWN); } then for the pipes I changed the shouldConnectTo function to take both the entity and the direction private boolean shouldConnectTo(TileEntity entity, ForgeDirection forgeDirection) { if(entity instanceof ModEntity && ((ModEntity) entity).directions.contains(forgeDirection)){ return true; } return false; }
  2. So I have a a class called Pipes that I have; import java.util.HashMap; import java.util.HashSet; import java.util.Map; import java.util.Set; import com.fataleu.mod.helpers.ModEntity; import net.minecraft.tileentity.TileEntity; import net.minecraftforge.common.ForgeDirection; public class TileEntityPipe extends ModEntity { public Map<ForgeDirection, TileEntity> getConnectedSides() { Map<ForgeDirection, TileEntity> connect = new HashMap<ForgeDirection, TileEntity>(); connect.put(ForgeDirection.WEST, getBlockTileEntity(xCoord + 1, yCoord, zCoord)); connect.put(ForgeDirection.EAST, getBlockTileEntity(xCoord - 1, yCoord, zCoord)); connect.put(ForgeDirection.UP, getBlockTileEntity(xCoord, yCoord + 1, zCoord)); connect.put(ForgeDirection.DOWN, getBlockTileEntity(xCoord, yCoord - 1, zCoord)); connect.put(ForgeDirection.NORTH, getBlockTileEntity(xCoord, yCoord, zCoord + 1)); connect.put(ForgeDirection.SOUTH, getBlockTileEntity(xCoord, yCoord, zCoord - 1)); Map<ForgeDirection, TileEntity> _Map = new HashMap<ForgeDirection, TileEntity>(); for (Map.Entry<ForgeDirection, TileEntity> entry : connect.entrySet()) { if (shouldConnectTo(entry.getValue())) { _Map .put(entry.getKey(), entry.getValue()); } } return _Map ; } private boolean shouldConnectTo(TileEntity entity) { if(entity instanceof ModEntity){ return true; } return false; } } This works good if you only want to connect to any side of a given entity but I want to have it so that you can only connect to certain sides depending on the entity. For instance a containerEntity would only connect at the top side but a pipe would bee all sides. Does anyone have any suggestions on how to go about this
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.