Fixed inability to inherit twice, changed INodeProvider interface
This commit is contained in:
parent
5888877b0d
commit
148152fc71
31 changed files with 150 additions and 162 deletions
|
@ -753,17 +753,4 @@ public class TileEngineeringTable extends TileInventory implements IPacketReceiv
|
|||
|
||||
return slots;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ForgeDirection getDirection()
|
||||
{
|
||||
return ForgeDirection.getOrientation(getBlockMetadata());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setDirection(ForgeDirection direction)
|
||||
{
|
||||
worldObj.setBlockMetadataWithNotify(xCoord, yCoord, zCoord, direction.ordinal(), 3);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -53,7 +53,7 @@ public class TileFilter extends TileFilterable implements IFilterable
|
|||
*/
|
||||
for (RecipeResource resoure : MachineRecipes.INSTANCE.getOutput(RecipeType.MIXER, "dust" + LanguageUtility.capitalizeFirst(ResourceGenerator.mixtureToMaterial(fluidBlock.getFluid().getName()))))
|
||||
{
|
||||
InventoryUtility.dropItemStack(worldObj, checkAbove.clone().add(0.5), resoure.getItemStack().copy(), 0, false);
|
||||
InventoryUtility.dropItemStack(worldObj, checkAbove.clone().add(0.5), resoure.getItemStack().copy(), 0, 0);
|
||||
}
|
||||
|
||||
// TODO: Check if this is correct?
|
||||
|
|
|
@ -57,7 +57,7 @@ public class TileGutter extends TilePressurizedNode
|
|||
{
|
||||
if (tile instanceof IPressureNodeProvider)
|
||||
{
|
||||
PressureNode check = ((IPressureNodeProvider) tile).getNode(dir.getOpposite());
|
||||
PressureNode check = ((IPressureNodeProvider) tile).getNode(PressureNode.class, dir.getOpposite());
|
||||
|
||||
if (check != null && canConnect(dir, check) && check.canConnect(dir.getOpposite(), this))
|
||||
{
|
||||
|
|
|
@ -1,16 +1,11 @@
|
|||
package resonantinduction.archaic.fluid.tank;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.creativetab.CreativeTabs;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraftforge.common.ForgeDirection;
|
||||
import net.minecraftforge.fluids.FluidContainerRegistry;
|
||||
import resonantinduction.api.mechanical.fluid.IPressure;
|
||||
import resonantinduction.core.fluid.FluidDistributionetwork;
|
||||
import resonantinduction.core.fluid.IFluidDistribution;
|
||||
import resonantinduction.core.fluid.TileFluidDistribution;
|
||||
|
@ -22,7 +17,7 @@ import calclavia.lib.utility.FluidUtility;
|
|||
import calclavia.lib.utility.WorldUtility;
|
||||
import calclavia.lib.utility.inventory.InventoryUtility;
|
||||
|
||||
public class TileTank extends TileFluidDistribution implements IPressure, IComparatorInputOverride
|
||||
public class TileTank extends TileFluidDistribution implements IComparatorInputOverride
|
||||
{
|
||||
public static final int VOLUME = 16;
|
||||
|
||||
|
@ -62,7 +57,7 @@ public class TileTank extends TileFluidDistribution implements IPressure, ICompa
|
|||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public int getComparatorInputOverride(int side)
|
||||
{
|
||||
|
@ -112,17 +107,4 @@ public class TileTank extends TileFluidDistribution implements IPressure, ICompa
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setPressure(int amount)
|
||||
{
|
||||
pressure = amount;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getPressure(ForgeDirection dir)
|
||||
{
|
||||
return 0;// (getInternalTank().getCapacity() - getInternalTank().getFluidAmount()) / 10;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -3,12 +3,11 @@ package resonantinduction.electrical.generator;
|
|||
import java.util.EnumSet;
|
||||
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraftforge.common.ForgeDirection;
|
||||
import resonantinduction.mechanical.energy.network.IMechanicalNodeProvider;
|
||||
import resonantinduction.mechanical.energy.network.MechanicalNode;
|
||||
import resonantinduction.core.grid.INodeProvider;
|
||||
import resonantinduction.core.grid.Node;
|
||||
import resonantinduction.mechanical.energy.grid.MechanicalNode;
|
||||
import universalelectricity.api.energy.EnergyStorageHandler;
|
||||
import universalelectricity.api.vector.Vector3;
|
||||
import calclavia.lib.prefab.tile.IRotatable;
|
||||
import calclavia.lib.prefab.tile.TileElectrical;
|
||||
|
||||
|
@ -17,7 +16,7 @@ import calclavia.lib.prefab.tile.TileElectrical;
|
|||
*
|
||||
* @author Calclavia
|
||||
*/
|
||||
public class TileGenerator extends TileElectrical implements IRotatable, IMechanicalNodeProvider
|
||||
public class TileGenerator extends TileElectrical implements IRotatable, INodeProvider
|
||||
{
|
||||
protected MechanicalNode node = new MechanicalNode(this)
|
||||
{
|
||||
|
@ -164,8 +163,10 @@ public class TileGenerator extends TileElectrical implements IRotatable, IMechan
|
|||
}
|
||||
|
||||
@Override
|
||||
public MechanicalNode getNode(ForgeDirection from)
|
||||
public <N extends Node> N getNode(Class<? super N> nodeType, ForgeDirection from)
|
||||
{
|
||||
return node;
|
||||
if (nodeType.isAssignableFrom(node.getClass()))
|
||||
return (N) node;
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -11,12 +11,13 @@ import net.minecraft.util.MovingObjectPosition;
|
|||
import net.minecraftforge.common.ForgeDirection;
|
||||
import net.minecraftforge.fluids.FluidTankInfo;
|
||||
import net.minecraftforge.fluids.IFluidHandler;
|
||||
import resonantinduction.api.mechanical.fluid.IPressure;
|
||||
import resonantinduction.core.ResonantInduction;
|
||||
import resonantinduction.core.grid.INodeProvider;
|
||||
import resonantinduction.core.grid.fluid.IPressureNodeProvider;
|
||||
import resonantinduction.core.grid.fluid.PressureNode;
|
||||
import resonantinduction.core.prefab.part.PartFace;
|
||||
import resonantinduction.electrical.Electrical;
|
||||
import resonantinduction.mechanical.energy.network.IMechanicalNodeProvider;
|
||||
import resonantinduction.mechanical.energy.network.MechanicalNode;
|
||||
import resonantinduction.mechanical.energy.grid.MechanicalNode;
|
||||
import universalelectricity.api.CompatibilityModule;
|
||||
import universalelectricity.api.electricity.IElectricalNetwork;
|
||||
import universalelectricity.api.energy.IConductor;
|
||||
|
@ -268,9 +269,9 @@ public class PartMultimeter extends PartFace implements IConnector<MultimeterNet
|
|||
}
|
||||
}
|
||||
|
||||
if (tileEntity instanceof IMechanicalNodeProvider)
|
||||
if (tileEntity instanceof INodeProvider)
|
||||
{
|
||||
MechanicalNode instance = ((IMechanicalNodeProvider) tileEntity).getNode(receivingSide);
|
||||
MechanicalNode instance = ((INodeProvider) tileEntity).getNode(MechanicalNode.class, receivingSide);
|
||||
|
||||
for (ForgeDirection dir : ForgeDirection.values())
|
||||
{
|
||||
|
@ -279,7 +280,7 @@ public class PartMultimeter extends PartFace implements IConnector<MultimeterNet
|
|||
break;
|
||||
}
|
||||
|
||||
instance = ((IMechanicalNodeProvider) tileEntity).getNode(dir);
|
||||
instance = ((INodeProvider) tileEntity).getNode(MechanicalNode.class, dir);
|
||||
}
|
||||
|
||||
if (instance != null)
|
||||
|
@ -305,9 +306,9 @@ public class PartMultimeter extends PartFace implements IConnector<MultimeterNet
|
|||
}
|
||||
}
|
||||
|
||||
if (tileEntity instanceof IPressure)
|
||||
if (tileEntity instanceof IPressureNodeProvider)
|
||||
{
|
||||
getNetwork().pressureGraph.queue(((IPressure) tileEntity).getPressure(receivingSide));
|
||||
getNetwork().pressureGraph.queue(((IPressureNodeProvider) tileEntity).getNode(PressureNode.class, receivingSide).getPressure(receivingSide));
|
||||
}
|
||||
|
||||
if (tileEntity instanceof ITemperature)
|
||||
|
|
|
@ -18,7 +18,8 @@ public class MultipartMechanical implements IPartFactory
|
|||
{
|
||||
MultiPartRegistry.registerParts(this, PART_TYPES);
|
||||
MultipartGenerator.registerPassThroughInterface("resonantinduction.core.grid.fluid.IPressureNodeProvider");
|
||||
MultipartGenerator.registerTrait("resonantinduction.mechanical.energy.network.IMechanicalNodeProvider", "resonantinduction.mechanical.trait.TraitMechanical");
|
||||
// TODO: Move to UE
|
||||
MultipartGenerator.registerTrait("resonantinduction.core.grid.INodeProvider", "resonantinduction.core.grid.TraitNodeProvider");
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -14,10 +14,10 @@ import net.minecraftforge.common.ForgeDirection;
|
|||
import resonantinduction.api.mechanical.IBelt;
|
||||
import resonantinduction.core.Reference;
|
||||
import resonantinduction.core.ResonantInduction;
|
||||
import resonantinduction.core.grid.INodeProvider;
|
||||
import resonantinduction.mechanical.Mechanical;
|
||||
import resonantinduction.mechanical.energy.network.IMechanicalNodeProvider;
|
||||
import resonantinduction.mechanical.energy.network.MechanicalNode;
|
||||
import resonantinduction.mechanical.energy.network.TileMechanical;
|
||||
import resonantinduction.mechanical.energy.grid.MechanicalNode;
|
||||
import resonantinduction.mechanical.energy.grid.TileMechanical;
|
||||
import universalelectricity.api.vector.Vector3;
|
||||
import calclavia.lib.prefab.tile.IRotatable;
|
||||
|
||||
|
@ -85,13 +85,13 @@ public class TileConveyorBelt extends TileMechanical implements IBelt, IRotatabl
|
|||
|
||||
if (tile instanceof TileConveyorBelt)
|
||||
{
|
||||
connections.put(((TileConveyorBelt) tile).getNode(dir.getOpposite()), dir);
|
||||
connections.put(((TileConveyorBelt) tile).getNode(MechanicalNode.class, dir.getOpposite()), dir);
|
||||
didRefresh = true;
|
||||
}
|
||||
}
|
||||
else if (tile instanceof IMechanicalNodeProvider)
|
||||
else if (tile instanceof INodeProvider)
|
||||
{
|
||||
MechanicalNode mechanical = ((IMechanicalNodeProvider) tile).getNode(dir.getOpposite());
|
||||
MechanicalNode mechanical = ((INodeProvider) tile).getNode(MechanicalNode.class, dir.getOpposite());
|
||||
|
||||
if (mechanical != null)
|
||||
{
|
||||
|
|
|
@ -12,11 +12,12 @@ import net.minecraft.util.MovingObjectPosition;
|
|||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.ForgeDirection;
|
||||
import resonantinduction.core.Reference;
|
||||
import resonantinduction.core.grid.INodeProvider;
|
||||
import resonantinduction.core.grid.Node;
|
||||
import resonantinduction.core.resource.ItemHandCrank;
|
||||
import resonantinduction.mechanical.Mechanical;
|
||||
import resonantinduction.mechanical.energy.network.IMechanicalNodeProvider;
|
||||
import resonantinduction.mechanical.energy.network.MechanicalNode;
|
||||
import resonantinduction.mechanical.energy.network.PartMechanical;
|
||||
import resonantinduction.mechanical.energy.grid.MechanicalNode;
|
||||
import resonantinduction.mechanical.energy.grid.PartMechanical;
|
||||
import calclavia.lib.multiblock.reference.IMultiBlockStructure;
|
||||
import calclavia.lib.multiblock.reference.MultiBlockHandler;
|
||||
import calclavia.lib.utility.WrenchUtility;
|
||||
|
@ -121,9 +122,9 @@ public class PartGear extends PartMechanical implements IMultiBlockStructure<Par
|
|||
/** Look for gears that are back-to-back with this gear. Equate torque. */
|
||||
TileEntity tileBehind = new universalelectricity.api.vector.Vector3(tile()).translate(placementSide).getTileEntity(world());
|
||||
|
||||
if (tileBehind instanceof IMechanicalNodeProvider)
|
||||
if (tileBehind instanceof INodeProvider)
|
||||
{
|
||||
MechanicalNode instance = ((IMechanicalNodeProvider) tileBehind).getNode(placementSide.getOpposite());
|
||||
MechanicalNode instance = ((INodeProvider) tileBehind).getNode(MechanicalNode.class, placementSide.getOpposite());
|
||||
|
||||
if (instance != null && instance != this && !(instance.parent instanceof PartGearShaft) && instance.canConnect(placementSide.getOpposite(), this))
|
||||
{
|
||||
|
@ -146,7 +147,7 @@ public class PartGear extends PartMechanical implements IMultiBlockStructure<Par
|
|||
tile = new universalelectricity.api.vector.Vector3(tile()).translate(checkDir).getTileEntity(world());
|
||||
}
|
||||
|
||||
if (tile instanceof IMechanicalNodeProvider)
|
||||
if (tile instanceof INodeProvider)
|
||||
{
|
||||
/**
|
||||
* If we're checking for the block that is opposite to the gear's
|
||||
|
@ -154,7 +155,7 @@ public class PartGear extends PartMechanical implements IMultiBlockStructure<Par
|
|||
* side
|
||||
* (the center), then we try to look for a gear shaft in the center.
|
||||
*/
|
||||
MechanicalNode instance = ((IMechanicalNodeProvider) tile).getNode(checkDir == placementSide.getOpposite() ? ForgeDirection.UNKNOWN : checkDir);
|
||||
MechanicalNode instance = ((INodeProvider) tile).getNode(MechanicalNode.class, checkDir == placementSide.getOpposite() ? ForgeDirection.UNKNOWN : checkDir);
|
||||
|
||||
if (!connections.containsValue(checkDir) && instance != this && checkDir != placementSide && instance != null && instance.canConnect(checkDir.getOpposite(), this))
|
||||
{
|
||||
|
@ -176,9 +177,9 @@ public class PartGear extends PartMechanical implements IMultiBlockStructure<Par
|
|||
ForgeDirection checkDir = ForgeDirection.getOrientation(Rotation.rotateSide(PartGear.this.placementSide.ordinal(), i));
|
||||
TileEntity checkTile = new universalelectricity.api.vector.Vector3(tile()).translate(checkDir, displaceCheck).getTileEntity(world());
|
||||
|
||||
if (!connections.containsValue(checkDir) && checkTile instanceof IMechanicalNodeProvider)
|
||||
if (!connections.containsValue(checkDir) && checkTile instanceof INodeProvider)
|
||||
{
|
||||
MechanicalNode instance = ((IMechanicalNodeProvider) checkTile).getNode(placementSide);
|
||||
MechanicalNode instance = ((INodeProvider) checkTile).getNode(MechanicalNode.class, placementSide);
|
||||
|
||||
if (instance != null && instance != this && instance.canConnect(checkDir.getOpposite(), this) && !(instance.parent instanceof PartGearShaft))
|
||||
{
|
||||
|
@ -206,7 +207,7 @@ public class PartGear extends PartMechanical implements IMultiBlockStructure<Par
|
|||
|
||||
if (with instanceof MechanicalNode)
|
||||
{
|
||||
IMechanicalNodeProvider parent = ((MechanicalNode) with).parent;
|
||||
INodeProvider parent = ((MechanicalNode) with).parent;
|
||||
|
||||
/**
|
||||
* Check for flat connections (gear face on gear face) to make sure it's
|
||||
|
@ -268,9 +269,9 @@ public class PartGear extends PartMechanical implements IMultiBlockStructure<Par
|
|||
/** Face to face stick connection. */
|
||||
TileEntity sourceTile = position().translate(from.getOpposite()).getTileEntity(world());
|
||||
|
||||
if (sourceTile instanceof IMechanicalNodeProvider)
|
||||
if (sourceTile instanceof INodeProvider)
|
||||
{
|
||||
MechanicalNode sourceInstance = ((IMechanicalNodeProvider) sourceTile).getNode(from);
|
||||
MechanicalNode sourceInstance = ((INodeProvider) sourceTile).getNode(MechanicalNode.class, from);
|
||||
return sourceInstance == with;
|
||||
}
|
||||
}
|
||||
|
@ -279,9 +280,9 @@ public class PartGear extends PartMechanical implements IMultiBlockStructure<Par
|
|||
/** Face to face stick connection. */
|
||||
TileEntity sourceTile = position().translate(from).getTileEntity(world());
|
||||
|
||||
if (sourceTile instanceof IMechanicalNodeProvider)
|
||||
if (sourceTile instanceof INodeProvider)
|
||||
{
|
||||
MechanicalNode sourceInstance = ((IMechanicalNodeProvider) sourceTile).getNode(from.getOpposite());
|
||||
MechanicalNode sourceInstance = ((INodeProvider) sourceTile).getNode(MechanicalNode.class, from.getOpposite());
|
||||
return sourceInstance == with;
|
||||
}
|
||||
}
|
||||
|
@ -289,7 +290,7 @@ public class PartGear extends PartMechanical implements IMultiBlockStructure<Par
|
|||
{
|
||||
TileEntity destinationTile = ((MechanicalNode) with).position().translate(from.getOpposite()).getTileEntity(world());
|
||||
|
||||
if (destinationTile instanceof IMechanicalNodeProvider && destinationTile instanceof TileMultipart)
|
||||
if (destinationTile instanceof INodeProvider && destinationTile instanceof TileMultipart)
|
||||
{
|
||||
TMultiPart destinationPart = ((TileMultipart) destinationTile).partMap(placementSide.ordinal());
|
||||
|
||||
|
@ -527,9 +528,11 @@ public class PartGear extends PartMechanical implements IMultiBlockStructure<Par
|
|||
}
|
||||
|
||||
@Override
|
||||
public MechanicalNode getNode(ForgeDirection from)
|
||||
public <N extends Node> N getNode(Class<? super N> nodeType, ForgeDirection from)
|
||||
{
|
||||
return getMultiBlock().get().node;
|
||||
if (nodeType.isAssignableFrom(node.getClass()))
|
||||
return (N) getMultiBlock().get().node;
|
||||
return null;
|
||||
}
|
||||
|
||||
/** Multipart Bounds */
|
||||
|
|
|
@ -7,10 +7,10 @@ import java.util.Set;
|
|||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraftforge.common.ForgeDirection;
|
||||
import resonantinduction.core.grid.INodeProvider;
|
||||
import resonantinduction.mechanical.Mechanical;
|
||||
import resonantinduction.mechanical.energy.network.IMechanicalNodeProvider;
|
||||
import resonantinduction.mechanical.energy.network.MechanicalNode;
|
||||
import resonantinduction.mechanical.energy.network.PartMechanical;
|
||||
import resonantinduction.mechanical.energy.grid.MechanicalNode;
|
||||
import resonantinduction.mechanical.energy.grid.PartMechanical;
|
||||
import codechicken.lib.raytracer.IndexedCuboid6;
|
||||
import codechicken.lib.vec.Cuboid6;
|
||||
import codechicken.lib.vec.Vector3;
|
||||
|
@ -98,7 +98,7 @@ public class PartGearShaft extends PartMechanical
|
|||
|
||||
if (checkDir == placementSide || checkDir == placementSide.getOpposite())
|
||||
{
|
||||
MechanicalNode instance = ((IMechanicalNodeProvider) tile()).getNode(checkDir);
|
||||
MechanicalNode instance = ((INodeProvider) tile()).getNode(MechanicalNode.class, checkDir);
|
||||
|
||||
if (instance != null && instance != this && instance.canConnect(checkDir.getOpposite(), this))
|
||||
{
|
||||
|
@ -116,9 +116,9 @@ public class PartGearShaft extends PartMechanical
|
|||
{
|
||||
TileEntity checkTile = new universalelectricity.api.vector.Vector3(tile()).translate(checkDir).getTileEntity(world());
|
||||
|
||||
if (checkTile instanceof IMechanicalNodeProvider)
|
||||
if (checkTile instanceof INodeProvider)
|
||||
{
|
||||
MechanicalNode instance = ((IMechanicalNodeProvider) checkTile).getNode(checkDir.getOpposite());
|
||||
MechanicalNode instance = ((INodeProvider) checkTile).getNode(MechanicalNode.class, checkDir.getOpposite());
|
||||
|
||||
// Only connect to shafts outside of this block space.
|
||||
if (instance != null && instance != this && instance.parent instanceof PartGearShaft && instance.canConnect(checkDir.getOpposite(), this))
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
package resonantinduction.mechanical.energy.network;
|
||||
package resonantinduction.mechanical.energy.grid;
|
||||
|
||||
import resonantinduction.core.grid.Grid;
|
||||
import resonantinduction.core.grid.INodeProvider;
|
|
@ -1,4 +1,4 @@
|
|||
package resonantinduction.mechanical.energy.network;
|
||||
package resonantinduction.mechanical.energy.grid;
|
||||
|
||||
import java.util.Iterator;
|
||||
import java.util.Map.Entry;
|
||||
|
@ -8,7 +8,6 @@ import net.minecraft.tileentity.TileEntity;
|
|||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.ForgeDirection;
|
||||
import resonantinduction.core.ResonantInduction;
|
||||
import resonantinduction.core.grid.Grid;
|
||||
import resonantinduction.core.grid.INodeProvider;
|
||||
import resonantinduction.core.grid.TickingGrid;
|
||||
import universalelectricity.api.vector.Vector3;
|
||||
|
@ -30,7 +29,7 @@ import codechicken.multipart.TMultiPart;
|
|||
*
|
||||
* @author Calclavia
|
||||
*/
|
||||
public class MechanicalNode extends EnergyNode<IMechanicalNodeProvider, TickingGrid, MechanicalNode>
|
||||
public class MechanicalNode extends EnergyNode<INodeProvider, TickingGrid, MechanicalNode>
|
||||
{
|
||||
public double torque = 0;
|
||||
public double prevAngularVelocity, angularVelocity = 0;
|
||||
|
@ -46,7 +45,7 @@ public class MechanicalNode extends EnergyNode<IMechanicalNodeProvider, TickingG
|
|||
|
||||
private double power = 0;
|
||||
|
||||
public MechanicalNode(IMechanicalNodeProvider parent)
|
||||
public MechanicalNode(INodeProvider parent)
|
||||
{
|
||||
super(parent);
|
||||
}
|
||||
|
@ -201,9 +200,9 @@ public class MechanicalNode extends EnergyNode<IMechanicalNodeProvider, TickingG
|
|||
{
|
||||
TileEntity tile = position().translate(dir).getTileEntity(world());
|
||||
|
||||
if (tile instanceof IMechanicalNodeProvider)
|
||||
if (tile instanceof INodeProvider)
|
||||
{
|
||||
MechanicalNode check = ((IMechanicalNodeProvider) tile).getNode(dir.getOpposite());
|
||||
MechanicalNode check = ((INodeProvider) tile).getNode(MechanicalNode.class, dir.getOpposite());
|
||||
|
||||
if (check != null && canConnect(dir, check) && check.canConnect(dir.getOpposite(), this))
|
||||
{
|
|
@ -1,4 +1,4 @@
|
|||
package resonantinduction.mechanical.energy.network;
|
||||
package resonantinduction.mechanical.energy.grid;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
|
@ -1,4 +1,4 @@
|
|||
package resonantinduction.mechanical.energy.network;
|
||||
package resonantinduction.mechanical.energy.grid;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
@ -7,12 +7,14 @@ import net.minecraft.item.ItemStack;
|
|||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.util.MovingObjectPosition;
|
||||
import net.minecraftforge.common.ForgeDirection;
|
||||
import resonantinduction.core.grid.INodeProvider;
|
||||
import resonantinduction.core.grid.Node;
|
||||
import resonantinduction.mechanical.energy.turbine.TileMechanicalTurbine;
|
||||
import codechicken.lib.data.MCDataInput;
|
||||
import codechicken.lib.data.MCDataOutput;
|
||||
import codechicken.multipart.JCuboidPart;
|
||||
import codechicken.multipart.JNormalOcclusion;
|
||||
import codechicken.multipart.TFacePart;
|
||||
import codechicken.multipart.TMultiPart;
|
||||
|
||||
/**
|
||||
* We assume all the force acting on the gear is 90 degrees.
|
||||
|
@ -20,7 +22,7 @@ import codechicken.multipart.TMultiPart;
|
|||
* @author Calclavia
|
||||
*
|
||||
*/
|
||||
public abstract class PartMechanical extends JCuboidPart implements JNormalOcclusion, TFacePart, IMechanicalNodeProvider
|
||||
public abstract class PartMechanical extends JCuboidPart implements JNormalOcclusion, TFacePart, INodeProvider
|
||||
{
|
||||
public MechanicalNode node;
|
||||
protected double prevAngularVelocity;
|
||||
|
@ -68,9 +70,12 @@ public abstract class PartMechanical extends JCuboidPart implements JNormalOcclu
|
|||
}
|
||||
}
|
||||
|
||||
public MechanicalNode getNode(ForgeDirection dir)
|
||||
@Override
|
||||
public <N extends Node> N getNode(Class<? super N> nodeType, ForgeDirection from)
|
||||
{
|
||||
return node;
|
||||
if (nodeType.isAssignableFrom(node.getClass()))
|
||||
return (N) node;
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
|
@ -1,9 +1,10 @@
|
|||
package resonantinduction.mechanical.energy.network;
|
||||
package resonantinduction.mechanical.energy.grid;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraftforge.common.ForgeDirection;
|
||||
import resonantinduction.core.ResonantInduction;
|
||||
import resonantinduction.core.grid.INodeProvider;
|
||||
import resonantinduction.core.grid.Node;
|
||||
import resonantinduction.mechanical.Mechanical;
|
||||
import universalelectricity.api.vector.Vector3;
|
||||
|
@ -13,7 +14,7 @@ import calclavia.lib.prefab.tile.TileAdvanced;
|
|||
|
||||
import com.google.common.io.ByteArrayDataInput;
|
||||
|
||||
public abstract class TileMechanical extends TileAdvanced implements IMechanicalNodeProvider, IPacketReceiver
|
||||
public abstract class TileMechanical extends TileAdvanced implements INodeProvider, IPacketReceiver
|
||||
{
|
||||
protected static final int PACKET_VELOCITY = Mechanical.contentRegistry.getNextPacketID();
|
||||
|
||||
|
@ -21,7 +22,7 @@ public abstract class TileMechanical extends TileAdvanced implements IMechanical
|
|||
|
||||
protected class PacketMechanicalNode extends MechanicalNode
|
||||
{
|
||||
public PacketMechanicalNode(IMechanicalNodeProvider parent)
|
||||
public PacketMechanicalNode(INodeProvider parent)
|
||||
{
|
||||
super(parent);
|
||||
}
|
||||
|
@ -69,9 +70,11 @@ public abstract class TileMechanical extends TileAdvanced implements IMechanical
|
|||
}
|
||||
|
||||
@Override
|
||||
public MechanicalNode getNode(Class<? extends Node> clazz, ForgeDirection dir)
|
||||
public <N extends Node> N getNode(Class<? super N> nodeType, ForgeDirection from)
|
||||
{
|
||||
return mechanicalNode;
|
||||
if (nodeType.isAssignableFrom(mechanicalNode.getClass()))
|
||||
return (N) mechanicalNode;
|
||||
return null;
|
||||
}
|
||||
|
||||
private void sendRotationPacket()
|
|
@ -1,8 +0,0 @@
|
|||
package resonantinduction.mechanical.energy.network;
|
||||
|
||||
import resonantinduction.core.grid.INodeProvider;
|
||||
|
||||
public interface IMechanicalNodeProvider extends INodeProvider
|
||||
{
|
||||
|
||||
}
|
|
@ -3,22 +3,23 @@ package resonantinduction.mechanical.energy.turbine;
|
|||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraftforge.common.ForgeDirection;
|
||||
import resonantinduction.mechanical.energy.network.IMechanicalNodeProvider;
|
||||
import resonantinduction.mechanical.energy.network.MechanicalNode;
|
||||
import resonantinduction.core.grid.INodeProvider;
|
||||
import resonantinduction.core.grid.Node;
|
||||
import resonantinduction.mechanical.energy.grid.MechanicalNode;
|
||||
import universalelectricity.api.energy.EnergyStorageHandler;
|
||||
import calclavia.lib.network.Synced.SyncedInput;
|
||||
import calclavia.lib.network.Synced.SyncedOutput;
|
||||
import calclavia.lib.prefab.turbine.TileTurbine;
|
||||
|
||||
public class TileMechanicalTurbine extends TileTurbine implements IMechanicalNodeProvider
|
||||
public class TileMechanicalTurbine extends TileTurbine implements INodeProvider
|
||||
{
|
||||
protected MechanicalNode node;
|
||||
protected MechanicalNode mechanicalNode;
|
||||
|
||||
public TileMechanicalTurbine()
|
||||
{
|
||||
super();
|
||||
energy = new EnergyStorageHandler(0);
|
||||
node = new MechanicalNode(this)
|
||||
mechanicalNode = new MechanicalNode(this)
|
||||
{
|
||||
@Override
|
||||
public boolean canConnect(ForgeDirection from, Object source)
|
||||
|
@ -30,9 +31,9 @@ public class TileMechanicalTurbine extends TileTurbine implements IMechanicalNod
|
|||
*/
|
||||
TileEntity sourceTile = position().translate(from).getTileEntity(getWorld());
|
||||
|
||||
if (sourceTile instanceof IMechanicalNodeProvider)
|
||||
if (sourceTile instanceof INodeProvider)
|
||||
{
|
||||
MechanicalNode sourceInstance = ((IMechanicalNodeProvider) sourceTile).getNode(from.getOpposite());
|
||||
MechanicalNode sourceInstance = ((INodeProvider) sourceTile).getNode(MechanicalNode.class, from.getOpposite());
|
||||
return sourceInstance == source && from == getDirection().getOpposite();
|
||||
}
|
||||
}
|
||||
|
@ -57,28 +58,30 @@ public class TileMechanicalTurbine extends TileTurbine implements IMechanicalNod
|
|||
@Override
|
||||
public void initiate()
|
||||
{
|
||||
node.reconstruct();
|
||||
mechanicalNode.reconstruct();
|
||||
super.initiate();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void invalidate()
|
||||
{
|
||||
node.deconstruct();
|
||||
mechanicalNode.deconstruct();
|
||||
super.invalidate();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onProduce()
|
||||
{
|
||||
node.torque += (torque - node.torque) / 10;
|
||||
node.angularVelocity += (angularVelocity - node.angularVelocity) / 10;
|
||||
mechanicalNode.torque += (torque - mechanicalNode.torque) / 10;
|
||||
mechanicalNode.angularVelocity += (angularVelocity - mechanicalNode.angularVelocity) / 10;
|
||||
}
|
||||
|
||||
@Override
|
||||
public MechanicalNode getNode(ForgeDirection dir)
|
||||
public <N extends Node> N getNode(Class<? super N> nodeType, ForgeDirection from)
|
||||
{
|
||||
return ((TileMechanicalTurbine) getMultiBlock().get()).node;
|
||||
if (nodeType.isAssignableFrom(mechanicalNode.getClass()))
|
||||
return (N) ((TileMechanicalTurbine) getMultiBlock().get()).mechanicalNode;
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -87,7 +90,7 @@ public class TileMechanicalTurbine extends TileTurbine implements IMechanicalNod
|
|||
{
|
||||
super.readFromNBT(nbt);
|
||||
tier = nbt.getInteger("tier");
|
||||
node.load(nbt);
|
||||
mechanicalNode.load(nbt);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -99,6 +102,6 @@ public class TileMechanicalTurbine extends TileTurbine implements IMechanicalNod
|
|||
{
|
||||
super.writeToNBT(nbt);
|
||||
nbt.setInteger("tier", tier);
|
||||
node.save(nbt);
|
||||
mechanicalNode.save(nbt);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -13,6 +13,7 @@ import net.minecraftforge.fluids.FluidTank;
|
|||
import net.minecraftforge.fluids.FluidTankInfo;
|
||||
import net.minecraftforge.fluids.IFluidHandler;
|
||||
import resonantinduction.core.ResonantInduction;
|
||||
import resonantinduction.core.grid.Node;
|
||||
import resonantinduction.core.grid.fluid.IPressureNodeProvider;
|
||||
import resonantinduction.core.grid.fluid.PressureNode;
|
||||
import resonantinduction.core.prefab.part.PartFramedNode;
|
||||
|
@ -59,7 +60,7 @@ public class PartPipe extends PartFramedNode<EnumPipeMaterial, PressureNode, IPr
|
|||
{
|
||||
if (tile instanceof IPressureNodeProvider)
|
||||
{
|
||||
PressureNode check = ((IPressureNodeProvider) tile).getNode(dir.getOpposite());
|
||||
PressureNode check = ((IPressureNodeProvider) tile).getNode(PressureNode.class, dir.getOpposite());
|
||||
|
||||
if (check != null && canConnect(dir, check) && check.canConnect(dir.getOpposite(), this))
|
||||
{
|
||||
|
@ -239,8 +240,6 @@ public class PartPipe extends PartFramedNode<EnumPipeMaterial, PressureNode, IPr
|
|||
return this.tank;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public void drawBreaking(RenderBlocks renderBlocks)
|
||||
{
|
||||
|
|
|
@ -49,8 +49,8 @@ public class RenderPipe implements ISimpleItemRenderer
|
|||
|
||||
GL11.glPushMatrix();
|
||||
|
||||
FluidStack fluid = part.getInternalTank().getFluid();
|
||||
int capacity = part.getInternalTank().getCapacity();
|
||||
FluidStack fluid = part.getPressureTank().getFluid();
|
||||
int capacity = part.getPressureTank().getCapacity();
|
||||
byte renderSides = part.getAllCurrentConnections();
|
||||
|
||||
if (fluid != null && fluid.amount > 0)
|
||||
|
|
|
@ -36,7 +36,7 @@ public class RenderPump extends TileEntitySpecialRenderer
|
|||
List<String> notRendered = new ArrayList<String>();
|
||||
|
||||
GL11.glPushMatrix();
|
||||
GL11.glRotated(Math.toDegrees((float) tile.getNode(null).angle), 0, 0, 1);
|
||||
GL11.glRotated(Math.toDegrees((float) tile.mechanicalNode.angle), 0, 0, 1);
|
||||
|
||||
for (int i = 1; i <= 12; i++)
|
||||
{
|
||||
|
|
|
@ -7,9 +7,10 @@ import net.minecraftforge.fluids.FluidStack;
|
|||
import net.minecraftforge.fluids.FluidTank;
|
||||
import net.minecraftforge.fluids.FluidTankInfo;
|
||||
import net.minecraftforge.fluids.IFluidHandler;
|
||||
import resonantinduction.core.grid.Node;
|
||||
import resonantinduction.core.grid.fluid.IPressureNodeProvider;
|
||||
import resonantinduction.core.grid.fluid.PressureNode;
|
||||
import resonantinduction.mechanical.energy.network.TileMechanical;
|
||||
import resonantinduction.mechanical.energy.grid.TileMechanical;
|
||||
import universalelectricity.api.vector.Vector3;
|
||||
import calclavia.lib.prefab.tile.IRotatable;
|
||||
|
||||
|
@ -39,7 +40,7 @@ public class TilePump extends TileMechanical implements IPressureNodeProvider, I
|
|||
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -129,4 +130,12 @@ public class TilePump extends TileMechanical implements IPressureNodeProvider, I
|
|||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public <N extends Node> N getNode(Class<? super N> nodeType, ForgeDirection from)
|
||||
{
|
||||
if (nodeType.isAssignableFrom(pressureNode.getClass()))
|
||||
return (N) pressureNode;
|
||||
|
||||
return super.getNode(nodeType, from);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -9,6 +9,7 @@ import net.minecraftforge.client.model.IModelCustom;
|
|||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import resonantinduction.core.Reference;
|
||||
import resonantinduction.core.grid.fluid.PressureNode;
|
||||
import calclavia.lib.render.RenderUtility;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
@ -33,7 +34,7 @@ public class RenderMechanicalPiston extends TileEntitySpecialRenderer
|
|||
RenderUtility.bind(TEXTURE);
|
||||
|
||||
// Angle in radians of the rotor.
|
||||
float angle = (float) tile.getNode(null).angle;
|
||||
float angle = (float) tile.mechanicalNode.angle;
|
||||
float radius = 0.5f;
|
||||
// Length of piston arm
|
||||
float length = 1f;
|
||||
|
|
|
@ -7,7 +7,7 @@ import net.minecraft.nbt.NBTTagCompound;
|
|||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.ForgeDirection;
|
||||
import resonantinduction.mechanical.energy.network.TileMechanical;
|
||||
import resonantinduction.mechanical.energy.grid.TileMechanical;
|
||||
import universalelectricity.api.vector.Vector3;
|
||||
import calclavia.lib.utility.MovementUtility;
|
||||
import cpw.mods.fml.common.Loader;
|
||||
|
|
|
@ -13,8 +13,8 @@ import resonantinduction.api.recipe.RecipeResource;
|
|||
import resonantinduction.archaic.filter.Timer;
|
||||
import resonantinduction.core.Reference;
|
||||
import resonantinduction.core.ResonantInduction;
|
||||
import resonantinduction.mechanical.energy.network.MechanicalNode;
|
||||
import resonantinduction.mechanical.energy.network.TileMechanical;
|
||||
import resonantinduction.mechanical.energy.grid.MechanicalNode;
|
||||
import resonantinduction.mechanical.energy.grid.TileMechanical;
|
||||
import universalelectricity.api.vector.Vector3;
|
||||
import calclavia.lib.prefab.tile.IRotatable;
|
||||
|
||||
|
|
|
@ -40,7 +40,7 @@ public class RenderMixer extends TileEntitySpecialRenderer implements ISimpleIte
|
|||
RenderUtility.bind(TEXTURE);
|
||||
MODEL.renderOnly("centerTop", "centerBase");
|
||||
glPushMatrix();
|
||||
glRotatef((float) Math.toDegrees((float) tile.getNode(null).angle), 0, 1, 0);
|
||||
glRotatef((float) Math.toDegrees((float) tile.mechanicalNode.angle), 0, 1, 0);
|
||||
MODEL.renderAllExcept("centerTop", "centerBase");
|
||||
glPopMatrix();
|
||||
glPopMatrix();
|
||||
|
|
|
@ -18,8 +18,8 @@ import resonantinduction.archaic.filter.Timer;
|
|||
import resonantinduction.core.Reference;
|
||||
import resonantinduction.core.resource.ResourceGenerator;
|
||||
import resonantinduction.core.resource.fluid.BlockFluidMixture;
|
||||
import resonantinduction.mechanical.energy.network.MechanicalNode;
|
||||
import resonantinduction.mechanical.energy.network.TileMechanical;
|
||||
import resonantinduction.mechanical.energy.grid.MechanicalNode;
|
||||
import resonantinduction.mechanical.energy.grid.TileMechanical;
|
||||
import universalelectricity.api.vector.Vector3;
|
||||
import calclavia.lib.utility.inventory.InventoryUtility;
|
||||
|
||||
|
@ -205,7 +205,7 @@ public class TileMixer extends TileMechanical implements IInventory
|
|||
if (!worldObj.isRemote)
|
||||
{
|
||||
Vector3 spawnVector = new Vector3(this).translate(ForgeDirection.getOrientation(worldObj.rand.nextInt(4) + 2)).translate(0.5);
|
||||
InventoryUtility.dropItemStack(worldObj, spawnVector, itemstack, 20, false);
|
||||
InventoryUtility.dropItemStack(worldObj, spawnVector, itemstack, 20, 0);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -6,6 +6,7 @@ import net.minecraftforge.fluids.FluidContainerRegistry;
|
|||
import net.minecraftforge.fluids.FluidStack;
|
||||
import net.minecraftforge.fluids.FluidTank;
|
||||
import net.minecraftforge.fluids.FluidTankInfo;
|
||||
import resonantinduction.core.grid.Node;
|
||||
import resonantinduction.core.grid.fluid.IPressureNodeProvider;
|
||||
import resonantinduction.core.grid.fluid.PressureNode;
|
||||
import calclavia.lib.network.IPacketReceiverWithID;
|
||||
|
@ -94,8 +95,10 @@ public abstract class TilePressurizedNode extends TileFluidNode implements IPres
|
|||
}
|
||||
|
||||
@Override
|
||||
public PressureNode getNode(ForgeDirection from)
|
||||
public <N extends Node> N getNode(Class<? super N> nodeType, ForgeDirection from)
|
||||
{
|
||||
return node;
|
||||
if (nodeType.isAssignableFrom(node.getClass()))
|
||||
return (N) node;
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -3,8 +3,6 @@ package resonantinduction.core.grid;
|
|||
import net.minecraftforge.common.ForgeDirection;
|
||||
|
||||
/**
|
||||
* Any inheritance of INodeProvider should have a method "getNode()"
|
||||
*
|
||||
* @author Calclavia
|
||||
*
|
||||
* @param <N> - Node type.
|
||||
|
@ -16,5 +14,5 @@ public interface INodeProvider
|
|||
* @param from - The direction.
|
||||
* @return Returns the node object.
|
||||
*/
|
||||
public Object getNode(Class<? extends Node> nodeType, ForgeDirection from);
|
||||
public <N extends Node> N getNode(Class<? super N> nodeType, ForgeDirection from);
|
||||
}
|
||||
|
|
|
@ -1,27 +1,25 @@
|
|||
package resonantinduction.mechanical.trait;
|
||||
package resonantinduction.core.grid;
|
||||
|
||||
import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
|
||||
import net.minecraftforge.common.ForgeDirection;
|
||||
import resonantinduction.mechanical.energy.network.IMechanicalNodeProvider;
|
||||
import resonantinduction.mechanical.energy.network.MechanicalNode;
|
||||
import codechicken.multipart.PartMap;
|
||||
import codechicken.multipart.TMultiPart;
|
||||
import codechicken.multipart.TileMultipart;
|
||||
|
||||
public class TraitMechanical extends TileMultipart implements IMechanicalNodeProvider
|
||||
public class TraitNodeProvider extends TileMultipart implements INodeProvider
|
||||
{
|
||||
public Set<IMechanicalNodeProvider> mechanicalInterfaces = new HashSet<IMechanicalNodeProvider>();
|
||||
public Set<INodeProvider> mechanicalInterfaces = new HashSet<INodeProvider>();
|
||||
|
||||
@Override
|
||||
public void copyFrom(TileMultipart that)
|
||||
{
|
||||
super.copyFrom(that);
|
||||
|
||||
if (that instanceof TraitMechanical)
|
||||
if (that instanceof TraitNodeProvider)
|
||||
{
|
||||
this.mechanicalInterfaces = ((TraitMechanical) that).mechanicalInterfaces;
|
||||
this.mechanicalInterfaces = ((TraitNodeProvider) that).mechanicalInterfaces;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -30,9 +28,9 @@ public class TraitMechanical extends TileMultipart implements IMechanicalNodePro
|
|||
{
|
||||
super.bindPart(part);
|
||||
|
||||
if (part instanceof IMechanicalNodeProvider)
|
||||
if (part instanceof INodeProvider)
|
||||
{
|
||||
this.mechanicalInterfaces.add((IMechanicalNodeProvider) part);
|
||||
this.mechanicalInterfaces.add((INodeProvider) part);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -41,7 +39,7 @@ public class TraitMechanical extends TileMultipart implements IMechanicalNodePro
|
|||
{
|
||||
super.partRemoved(part, p);
|
||||
|
||||
if (part instanceof IMechanicalNodeProvider)
|
||||
if (part instanceof INodeProvider)
|
||||
{
|
||||
this.mechanicalInterfaces.remove(part);
|
||||
}
|
||||
|
@ -55,7 +53,7 @@ public class TraitMechanical extends TileMultipart implements IMechanicalNodePro
|
|||
}
|
||||
|
||||
@Override
|
||||
public MechanicalNode getNode(ForgeDirection from)
|
||||
public <N extends Node> N getNode(Class<? super N> nodeType, ForgeDirection from)
|
||||
{
|
||||
TMultiPart part = this.partMap(from.ordinal());
|
||||
|
||||
|
@ -64,12 +62,11 @@ public class TraitMechanical extends TileMultipart implements IMechanicalNodePro
|
|||
part = partMap(PartMap.CENTER.ordinal());
|
||||
}
|
||||
|
||||
if (part instanceof IMechanicalNodeProvider)
|
||||
if (part instanceof INodeProvider)
|
||||
{
|
||||
return ((IMechanicalNodeProvider) part).getNode(from);
|
||||
return ((INodeProvider) part).getNode(nodeType, from);
|
||||
}
|
||||
|
||||
return null;
|
||||
|
||||
}
|
||||
}
|
|
@ -137,7 +137,7 @@ public class PressureNode extends Node<IPressureNodeProvider, TickingGrid, Objec
|
|||
{
|
||||
IFluidHandler fluidHandler = (IFluidHandler) obj;
|
||||
int pressure = getPressure(dir);
|
||||
int tankPressure = fluidHandler instanceof IPressureNodeProvider ? ((IPressureNodeProvider) fluidHandler).getNode(getClass(),dir.getOpposite()).getPressure(dir.getOpposite()) : 0;
|
||||
int tankPressure = fluidHandler instanceof IPressureNodeProvider ? ((IPressureNodeProvider) fluidHandler).getNode(PressureNode.class, dir.getOpposite()).getPressure(dir.getOpposite()) : 0;
|
||||
FluidTank sourceTank = parent.getPressureTank();
|
||||
|
||||
int transferAmount = (Math.max(pressure, tankPressure) - Math.min(pressure, tankPressure)) * getMaxFlowRate();
|
||||
|
@ -191,7 +191,7 @@ public class PressureNode extends Node<IPressureNodeProvider, TickingGrid, Objec
|
|||
|
||||
if (tile instanceof IPressureNodeProvider)
|
||||
{
|
||||
PressureNode check = ((IPressureNodeProvider) tile).getNode(dir.getOpposite());
|
||||
PressureNode check = ((IPressureNodeProvider) tile).getNode(PressureNode.class, dir.getOpposite());
|
||||
|
||||
if (check != null && canConnect(dir, check) && check.canConnect(dir.getOpposite(), this))
|
||||
{
|
||||
|
|
|
@ -224,7 +224,7 @@ public abstract class PartFramedNode<M extends Enum, N extends Node, T extends I
|
|||
{
|
||||
node.deconstruct();
|
||||
}
|
||||
|
||||
|
||||
public void copyFrom(PartFramedNode<M, N, T> other)
|
||||
{
|
||||
this.isInsulated = other.isInsulated;
|
||||
|
@ -264,7 +264,7 @@ public abstract class PartFramedNode<M extends Enum, N extends Node, T extends I
|
|||
{
|
||||
if (packetID == 0)
|
||||
{
|
||||
currentConnections= packet.readByte();
|
||||
currentConnections = packet.readByte();
|
||||
tile().markRender();
|
||||
}
|
||||
else
|
||||
|
@ -273,8 +273,12 @@ public abstract class PartFramedNode<M extends Enum, N extends Node, T extends I
|
|||
}
|
||||
}
|
||||
|
||||
public N getNode(ForgeDirection from)
|
||||
@SuppressWarnings("hiding")
|
||||
@Override
|
||||
public <N extends Node> N getNode(Class<? super N> nodeType, ForgeDirection from)
|
||||
{
|
||||
return node;
|
||||
if (nodeType.isAssignableFrom(node.getClass()))
|
||||
return (N) node;
|
||||
return null;
|
||||
}
|
||||
}
|
Loading…
Add table
Reference in a new issue