Multipart and everything
|
@ -17,15 +17,15 @@ import net.minecraftforge.common.MinecraftForge;
|
||||||
import net.minecraftforge.event.Event;
|
import net.minecraftforge.event.Event;
|
||||||
import cpw.mods.fml.common.FMLCommonHandler;
|
import cpw.mods.fml.common.FMLCommonHandler;
|
||||||
|
|
||||||
public class GasNetwork extends DynamicNetwork<IGasAcceptor, GasNetwork>
|
public class GasNetwork extends DynamicNetwork<IGasAcceptor, GasNetwork, EnumGas>
|
||||||
{
|
{
|
||||||
public GasNetwork(ITransmitter<GasNetwork>... varPipes)
|
public GasNetwork(ITransmitter<GasNetwork, EnumGas>... varPipes)
|
||||||
{
|
{
|
||||||
transmitters.addAll(Arrays.asList(varPipes));
|
transmitters.addAll(Arrays.asList(varPipes));
|
||||||
register();
|
register();
|
||||||
}
|
}
|
||||||
|
|
||||||
public GasNetwork(Collection<ITransmitter<GasNetwork>> collection)
|
public GasNetwork(Collection<ITransmitter<GasNetwork, EnumGas>> collection)
|
||||||
{
|
{
|
||||||
transmitters.addAll(collection);
|
transmitters.addAll(collection);
|
||||||
register();
|
register();
|
||||||
|
@ -110,15 +110,15 @@ public class GasNetwork extends DynamicNetwork<IGasAcceptor, GasNetwork>
|
||||||
@Override
|
@Override
|
||||||
public void refresh()
|
public void refresh()
|
||||||
{
|
{
|
||||||
Set<ITransmitter<GasNetwork>> iterTubes = (Set<ITransmitter<GasNetwork>>)transmitters.clone();
|
Set<ITransmitter<GasNetwork, EnumGas>> iterTubes = (Set<ITransmitter<GasNetwork, EnumGas>>)transmitters.clone();
|
||||||
Iterator<ITransmitter<GasNetwork>> it = iterTubes.iterator();
|
Iterator<ITransmitter<GasNetwork, EnumGas>> it = iterTubes.iterator();
|
||||||
|
|
||||||
possibleAcceptors.clear();
|
possibleAcceptors.clear();
|
||||||
acceptorDirections.clear();
|
acceptorDirections.clear();
|
||||||
|
|
||||||
while(it.hasNext())
|
while(it.hasNext())
|
||||||
{
|
{
|
||||||
ITransmitter<GasNetwork> conductor = (ITransmitter<GasNetwork>)it.next();
|
ITransmitter<GasNetwork, EnumGas> conductor = (ITransmitter<GasNetwork, EnumGas>)it.next();
|
||||||
|
|
||||||
if(conductor == null || ((TileEntity)conductor).isInvalid())
|
if(conductor == null || ((TileEntity)conductor).isInvalid())
|
||||||
{
|
{
|
||||||
|
@ -130,7 +130,7 @@ public class GasNetwork extends DynamicNetwork<IGasAcceptor, GasNetwork>
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
for(ITransmitter<GasNetwork> pipe : transmitters)
|
for(ITransmitter<GasNetwork, EnumGas> pipe : transmitters)
|
||||||
{
|
{
|
||||||
IGasAcceptor[] acceptors = GasTransmission.getConnectedAcceptors((TileEntity)pipe);
|
IGasAcceptor[] acceptors = GasTransmission.getConnectedAcceptors((TileEntity)pipe);
|
||||||
|
|
||||||
|
@ -178,13 +178,13 @@ public class GasNetwork extends DynamicNetwork<IGasAcceptor, GasNetwork>
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected GasNetwork create(ITransmitter<GasNetwork>... varTransmitters)
|
protected GasNetwork create(ITransmitter<GasNetwork, EnumGas>... varTransmitters)
|
||||||
{
|
{
|
||||||
return new GasNetwork(varTransmitters);
|
return new GasNetwork(varTransmitters);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected GasNetwork create(Collection<ITransmitter<GasNetwork>> collection)
|
protected GasNetwork create(Collection<ITransmitter<GasNetwork, EnumGas>> collection)
|
||||||
{
|
{
|
||||||
return new GasNetwork(collection);
|
return new GasNetwork(collection);
|
||||||
}
|
}
|
||||||
|
|
|
@ -96,7 +96,7 @@ public final class GasTransmission
|
||||||
|
|
||||||
if(TransmissionType.checkTransmissionType(pointer, TransmissionType.GAS, sender))
|
if(TransmissionType.checkTransmissionType(pointer, TransmissionType.GAS, sender))
|
||||||
{
|
{
|
||||||
return ((ITransmitter<GasNetwork>)pointer).getTransmitterNetwork().emit(amount, type, sender);
|
return ((ITransmitter<GasNetwork, EnumGas>)pointer).getTransmitterNetwork().emit(amount, type, sender);
|
||||||
}
|
}
|
||||||
|
|
||||||
return amount;
|
return amount;
|
||||||
|
@ -122,7 +122,7 @@ public final class GasTransmission
|
||||||
|
|
||||||
if(TransmissionType.checkTransmissionType(sideTile, TransmissionType.GAS, pointer))
|
if(TransmissionType.checkTransmissionType(sideTile, TransmissionType.GAS, pointer))
|
||||||
{
|
{
|
||||||
networks.add(((ITransmitter<GasNetwork>)sideTile).getTransmitterNetwork());
|
networks.add(((ITransmitter<GasNetwork, EnumGas>)sideTile).getTransmitterNetwork());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -3,7 +3,7 @@ package mekanism.api.gas;
|
||||||
import mekanism.api.transmitters.ITransmitter;
|
import mekanism.api.transmitters.ITransmitter;
|
||||||
import net.minecraft.tileentity.TileEntity;
|
import net.minecraft.tileentity.TileEntity;
|
||||||
|
|
||||||
public interface IGasTransmitter extends ITransmitter<GasNetwork>
|
public interface IGasTransmitter extends ITransmitter<GasNetwork, EnumGas>
|
||||||
{
|
{
|
||||||
public boolean canTransferGasToTube(TileEntity tile);
|
public boolean canTransferGasToTube(TileEntity tile);
|
||||||
}
|
}
|
||||||
|
|
|
@ -15,9 +15,9 @@ import net.minecraft.tileentity.TileEntity;
|
||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
import net.minecraftforge.common.ForgeDirection;
|
import net.minecraftforge.common.ForgeDirection;
|
||||||
|
|
||||||
public abstract class DynamicNetwork<A, N> implements ITransmitterNetwork<A, N>
|
public abstract class DynamicNetwork<A, N extends DynamicNetwork<A, N, D>, D> implements ITransmitterNetwork<A, N, D>
|
||||||
{
|
{
|
||||||
public HashSet<ITransmitter<N>> transmitters = new HashSet<ITransmitter<N>>();
|
public HashSet<ITransmitter<N, D>> transmitters = new HashSet<ITransmitter<N, D>>();
|
||||||
|
|
||||||
public Set<A> possibleAcceptors = new HashSet<A>();
|
public Set<A> possibleAcceptors = new HashSet<A>();
|
||||||
public Map<A, ForgeDirection> acceptorDirections = new HashMap<A, ForgeDirection>();
|
public Map<A, ForgeDirection> acceptorDirections = new HashMap<A, ForgeDirection>();
|
||||||
|
@ -27,19 +27,19 @@ public abstract class DynamicNetwork<A, N> implements ITransmitterNetwork<A, N>
|
||||||
|
|
||||||
protected boolean fixed = false;
|
protected boolean fixed = false;
|
||||||
|
|
||||||
protected abstract ITransmitterNetwork<A, N> create(ITransmitter<N>... varTransmitters);
|
protected abstract ITransmitterNetwork<A, N, D> create(ITransmitter<N, D>... varTransmitters);
|
||||||
|
|
||||||
protected abstract ITransmitterNetwork<A, N> create(Collection<ITransmitter<N>> collection);
|
protected abstract ITransmitterNetwork<A, N, D> create(Collection<ITransmitter<N, D>> collection);
|
||||||
|
|
||||||
protected abstract ITransmitterNetwork<A, N> create(Set<N> networks);
|
protected abstract ITransmitterNetwork<A, N, D> create(Set<N> networks);
|
||||||
|
|
||||||
public void addAllTransmitters(Set<ITransmitter<N>> newTransmitters)
|
public void addAllTransmitters(Set<ITransmitter<N, D>> newTransmitters)
|
||||||
{
|
{
|
||||||
transmitters.addAll(newTransmitters);
|
transmitters.addAll(newTransmitters);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void removeTransmitter(ITransmitter<N> transmitter)
|
public void removeTransmitter(ITransmitter<N, D> transmitter)
|
||||||
{
|
{
|
||||||
transmitters.remove(transmitter);
|
transmitters.remove(transmitter);
|
||||||
|
|
||||||
|
@ -53,7 +53,7 @@ public abstract class DynamicNetwork<A, N> implements ITransmitterNetwork<A, N>
|
||||||
public void register()
|
public void register()
|
||||||
{
|
{
|
||||||
try {
|
try {
|
||||||
ITransmitter<N> aTransmitter = transmitters.iterator().next();
|
ITransmitter<N, D> aTransmitter = transmitters.iterator().next();
|
||||||
|
|
||||||
if(aTransmitter instanceof TileEntity && !((TileEntity)aTransmitter).worldObj.isRemote)
|
if(aTransmitter instanceof TileEntity && !((TileEntity)aTransmitter).worldObj.isRemote)
|
||||||
{
|
{
|
||||||
|
@ -97,13 +97,13 @@ public abstract class DynamicNetwork<A, N> implements ITransmitterNetwork<A, N>
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void fixMessedUpNetwork(ITransmitter<N> transmitter)
|
public void fixMessedUpNetwork(ITransmitter<N, D> transmitter)
|
||||||
{
|
{
|
||||||
if(transmitter instanceof TileEntity)
|
if(transmitter instanceof TileEntity)
|
||||||
{
|
{
|
||||||
NetworkFinder finder = new NetworkFinder(((TileEntity)transmitter).getWorldObj(), getTransmissionType(), Object3D.get((TileEntity)transmitter));
|
NetworkFinder finder = new NetworkFinder(((TileEntity)transmitter).getWorldObj(), getTransmissionType(), Object3D.get((TileEntity)transmitter));
|
||||||
List<Object3D> partNetwork = finder.exploreNetwork();
|
List<Object3D> partNetwork = finder.exploreNetwork();
|
||||||
Set<ITransmitter<N>> newTransporters = new HashSet<ITransmitter<N>>();
|
Set<ITransmitter<N, D>> newTransporters = new HashSet<ITransmitter<N, D>>();
|
||||||
|
|
||||||
for(Object3D node : partNetwork)
|
for(Object3D node : partNetwork)
|
||||||
{
|
{
|
||||||
|
@ -111,12 +111,12 @@ public abstract class DynamicNetwork<A, N> implements ITransmitterNetwork<A, N>
|
||||||
|
|
||||||
if(TransmissionType.checkTransmissionType(nodeTile, getTransmissionType(), (TileEntity) transmitter))
|
if(TransmissionType.checkTransmissionType(nodeTile, getTransmissionType(), (TileEntity) transmitter))
|
||||||
{
|
{
|
||||||
((ITransmitter<N>)nodeTile).removeFromTransmitterNetwork();
|
((ITransmitter<N, D>)nodeTile).removeFromTransmitterNetwork();
|
||||||
newTransporters.add((ITransmitter<N>)nodeTile);
|
newTransporters.add((ITransmitter<N, D>)nodeTile);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ITransmitterNetwork<A, N> newNetwork = create(newTransporters);
|
ITransmitterNetwork<A, N, D> newNetwork = create(newTransporters);
|
||||||
newNetwork.refresh();
|
newNetwork.refresh();
|
||||||
newNetwork.setFixed(true);
|
newNetwork.setFixed(true);
|
||||||
deregister();
|
deregister();
|
||||||
|
@ -124,7 +124,7 @@ public abstract class DynamicNetwork<A, N> implements ITransmitterNetwork<A, N>
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void split(ITransmitter<N> splitPoint)
|
public void split(ITransmitter<N, D> splitPoint)
|
||||||
{
|
{
|
||||||
if(splitPoint instanceof TileEntity)
|
if(splitPoint instanceof TileEntity)
|
||||||
{
|
{
|
||||||
|
@ -165,7 +165,7 @@ public abstract class DynamicNetwork<A, N> implements ITransmitterNetwork<A, N>
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Set<ITransmitter<N>> newNetCables = new HashSet<ITransmitter<N>>();
|
Set<ITransmitter<N, D>> newNetCables = new HashSet<ITransmitter<N, D>>();
|
||||||
|
|
||||||
for(Object3D node : finder.iterated)
|
for(Object3D node : finder.iterated)
|
||||||
{
|
{
|
||||||
|
@ -175,12 +175,12 @@ public abstract class DynamicNetwork<A, N> implements ITransmitterNetwork<A, N>
|
||||||
{
|
{
|
||||||
if(nodeTile != splitPoint)
|
if(nodeTile != splitPoint)
|
||||||
{
|
{
|
||||||
newNetCables.add((ITransmitter<N>)nodeTile);
|
newNetCables.add((ITransmitter<N, D>)nodeTile);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ITransmitterNetwork<A, N> newNetwork = create(newNetCables);
|
ITransmitterNetwork<A, N, D> newNetwork = create(newNetCables);
|
||||||
newNetwork.refresh();
|
newNetwork.refresh();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -240,7 +240,7 @@ public abstract class DynamicNetwork<A, N> implements ITransmitterNetwork<A, N>
|
||||||
{
|
{
|
||||||
TileEntity tileEntity = obj.getTileEntity(worldObj);
|
TileEntity tileEntity = obj.getTileEntity(worldObj);
|
||||||
|
|
||||||
if(TransmissionType.checkTransmissionType(tileEntity, transmissionType, location.getTileEntity(worldObj)))
|
if(TransmissionType.checkTransmissionType(tileEntity, transmissionType, location.getTileEntity(worldObj)) && ((ITransmitter<?, ?>)tileEntity).canConnectMutual(direction.getOpposite()))
|
||||||
{
|
{
|
||||||
loopAll(obj);
|
loopAll(obj);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,8 +1,9 @@
|
||||||
package mekanism.api.transmitters;
|
package mekanism.api.transmitters;
|
||||||
|
|
||||||
import net.minecraft.tileentity.TileEntity;
|
import net.minecraft.tileentity.TileEntity;
|
||||||
|
import net.minecraftforge.common.ForgeDirection;
|
||||||
|
|
||||||
public interface ITransmitter<N>
|
public interface ITransmitter<N extends DynamicNetwork<?, N, D>, D>
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* Get the transmitter's transmission type
|
* Get the transmitter's transmission type
|
||||||
|
@ -48,13 +49,23 @@ public interface ITransmitter<N>
|
||||||
*/
|
*/
|
||||||
public void fixTransmitterNetwork();
|
public void fixTransmitterNetwork();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return whether the transmitter can connect in the given direction.
|
||||||
|
*/
|
||||||
|
public boolean canConnect(ForgeDirection side);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return whether the transmitter can connect in the given direction,
|
||||||
|
* and the tile in the given direction isn't prevented from connecting.
|
||||||
|
*/
|
||||||
|
public boolean canConnectMutual(ForgeDirection side);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Update a client-side transmitter. This tells the client how much the
|
||||||
|
* transmitter is transmitting.
|
||||||
|
* @param data Should represent what the transmitter can transmit.
|
||||||
|
*/
|
||||||
|
public void clientUpdate(D data);
|
||||||
|
|
||||||
public boolean areTransmitterNetworksEqual(TileEntity tileEntity);
|
public boolean areTransmitterNetworksEqual(TileEntity tileEntity);
|
||||||
|
|
||||||
public int getTransmitterNetworkSize();
|
|
||||||
|
|
||||||
public int getTransmitterNetworkAcceptorSize();
|
|
||||||
|
|
||||||
public String getTransmitterNetworkNeeded();
|
|
||||||
|
|
||||||
public String getTransmitterNetworkFlow();
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,7 +2,7 @@ package mekanism.api.transmitters;
|
||||||
|
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
||||||
public interface ITransmitterNetwork<A, N>
|
public interface ITransmitterNetwork<A, N extends DynamicNetwork<A, N, D>, D>
|
||||||
{
|
{
|
||||||
public void tick();
|
public void tick();
|
||||||
|
|
||||||
|
@ -16,15 +16,15 @@ public interface ITransmitterNetwork<A, N>
|
||||||
|
|
||||||
public Set<A> getAcceptors(Object... data);
|
public Set<A> getAcceptors(Object... data);
|
||||||
|
|
||||||
public void removeTransmitter(ITransmitter<N> transmitter);
|
public void removeTransmitter(ITransmitter<N, D> transmitter);
|
||||||
|
|
||||||
public void refresh();
|
public void refresh();
|
||||||
|
|
||||||
public void split(ITransmitter<N> splitPoint);
|
public void split(ITransmitter<N, D> splitPoint);
|
||||||
|
|
||||||
public void merge(N network);
|
public void merge(N network);
|
||||||
|
|
||||||
public void fixMessedUpNetwork(ITransmitter<N> transmitter);
|
public void fixMessedUpNetwork(ITransmitter<N, D> transmitter);
|
||||||
|
|
||||||
public void register();
|
public void register();
|
||||||
|
|
||||||
|
|
|
@ -24,7 +24,7 @@ public enum TransmissionType
|
||||||
{
|
{
|
||||||
if(sideTile instanceof ITransmitter)
|
if(sideTile instanceof ITransmitter)
|
||||||
{
|
{
|
||||||
if(((ITransmitter<?>)sideTile).getTransmissionType() == this)
|
if(((ITransmitter<?, ?>)sideTile).getTransmissionType() == this)
|
||||||
{
|
{
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -106,6 +106,18 @@ public class TransmitterNetworkRegistry implements ITickHandler
|
||||||
return "Network Registry:\n" + networks;
|
return "Network Registry:\n" + networks;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public String[] toStrings()
|
||||||
|
{
|
||||||
|
String[] strings = new String[networks.size()];
|
||||||
|
int i = 0;
|
||||||
|
for(ITransmitterNetwork<?,?,?> network : networks)
|
||||||
|
{
|
||||||
|
strings[i] = network.toString();
|
||||||
|
++i;
|
||||||
|
}
|
||||||
|
return strings;
|
||||||
|
}
|
||||||
|
|
||||||
public static class NetworkLoader
|
public static class NetworkLoader
|
||||||
{
|
{
|
||||||
@ForgeSubscribe
|
@ForgeSubscribe
|
||||||
|
|
|
@ -33,6 +33,7 @@ import mekanism.client.gui.GuiTeleporter;
|
||||||
import mekanism.client.gui.GuiTheoreticalElementizer;
|
import mekanism.client.gui.GuiTheoreticalElementizer;
|
||||||
import mekanism.client.gui.GuiWeatherOrb;
|
import mekanism.client.gui.GuiWeatherOrb;
|
||||||
import mekanism.client.render.MekanismRenderer;
|
import mekanism.client.render.MekanismRenderer;
|
||||||
|
import mekanism.client.render.RenderPartTransmitter;
|
||||||
import mekanism.client.render.RenderTickHandler;
|
import mekanism.client.render.RenderTickHandler;
|
||||||
import mekanism.client.render.block.BasicRenderingHandler;
|
import mekanism.client.render.block.BasicRenderingHandler;
|
||||||
import mekanism.client.render.block.MachineRenderingHandler;
|
import mekanism.client.render.block.MachineRenderingHandler;
|
||||||
|
@ -242,6 +243,8 @@ public class ClientProxy extends CommonProxy
|
||||||
@Override
|
@Override
|
||||||
public void registerRenderInformation()
|
public void registerRenderInformation()
|
||||||
{
|
{
|
||||||
|
RenderPartTransmitter.init();
|
||||||
|
|
||||||
//Register entity rendering handlers
|
//Register entity rendering handlers
|
||||||
RenderingRegistry.registerEntityRenderingHandler(EntityObsidianTNT.class, new RenderObsidianTNT());
|
RenderingRegistry.registerEntityRenderingHandler(EntityObsidianTNT.class, new RenderObsidianTNT());
|
||||||
RenderingRegistry.registerEntityRenderingHandler(EntityRobit.class, new RenderRobit());
|
RenderingRegistry.registerEntityRenderingHandler(EntityRobit.class, new RenderRobit());
|
||||||
|
|
|
@ -2,10 +2,10 @@ package mekanism.client;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
import mekanism.api.transmitters.ITransmitter;
|
||||||
import mekanism.api.transmitters.TransmissionType;
|
import mekanism.api.transmitters.TransmissionType;
|
||||||
import mekanism.api.transmitters.DynamicNetwork.NetworkFinder;
|
import mekanism.api.transmitters.DynamicNetwork.NetworkFinder;
|
||||||
import mekanism.api.Object3D;
|
import mekanism.api.Object3D;
|
||||||
import mekanism.common.tileentity.TileEntityUniversalCable;
|
|
||||||
import net.minecraft.tileentity.TileEntity;
|
import net.minecraft.tileentity.TileEntity;
|
||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
|
|
||||||
|
@ -27,14 +27,14 @@ public class EnergyClientUpdate
|
||||||
public void clientUpdate()
|
public void clientUpdate()
|
||||||
{
|
{
|
||||||
List<Object3D> found = finder.exploreNetwork();
|
List<Object3D> found = finder.exploreNetwork();
|
||||||
|
System.out.println(energyScale);
|
||||||
for(Object3D object : found)
|
for(Object3D object : found)
|
||||||
{
|
{
|
||||||
TileEntity tileEntity = object.getTileEntity(worldObj);
|
TileEntity tileEntity = object.getTileEntity(worldObj);
|
||||||
|
|
||||||
if(tileEntity instanceof TileEntityUniversalCable)
|
if(tileEntity instanceof ITransmitter && ((ITransmitter<?, ?>)tileEntity).getTransmissionType() == TransmissionType.ENERGY)
|
||||||
{
|
{
|
||||||
((TileEntityUniversalCable)tileEntity).setCachedEnergy(energyScale);
|
((ITransmitter<?, Double>)tileEntity).clientUpdate(energyScale);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,10 +2,10 @@ package mekanism.client;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
import mekanism.api.transmitters.ITransmitter;
|
||||||
import mekanism.api.transmitters.TransmissionType;
|
import mekanism.api.transmitters.TransmissionType;
|
||||||
import mekanism.api.transmitters.DynamicNetwork.NetworkFinder;
|
import mekanism.api.transmitters.DynamicNetwork.NetworkFinder;
|
||||||
import mekanism.api.Object3D;
|
import mekanism.api.Object3D;
|
||||||
import mekanism.common.tileentity.TileEntityMechanicalPipe;
|
|
||||||
import net.minecraft.tileentity.TileEntity;
|
import net.minecraft.tileentity.TileEntity;
|
||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
import net.minecraftforge.fluids.FluidStack;
|
import net.minecraftforge.fluids.FluidStack;
|
||||||
|
@ -33,9 +33,9 @@ public class FluidClientUpdate
|
||||||
{
|
{
|
||||||
TileEntity tileEntity = object.getTileEntity(worldObj);
|
TileEntity tileEntity = object.getTileEntity(worldObj);
|
||||||
|
|
||||||
if(tileEntity instanceof TileEntityMechanicalPipe)
|
if(tileEntity instanceof ITransmitter && ((ITransmitter<?,?>)tileEntity).getTransmissionType() == TransmissionType.FLUID)
|
||||||
{
|
{
|
||||||
((TileEntityMechanicalPipe)tileEntity).onTransfer(fluidStack);
|
((ITransmitter<?, FluidStack>)tileEntity).clientUpdate(fluidStack);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,10 +3,10 @@ package mekanism.client;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import mekanism.api.gas.EnumGas;
|
import mekanism.api.gas.EnumGas;
|
||||||
|
import mekanism.api.transmitters.ITransmitter;
|
||||||
import mekanism.api.transmitters.TransmissionType;
|
import mekanism.api.transmitters.TransmissionType;
|
||||||
import mekanism.api.transmitters.DynamicNetwork.NetworkFinder;
|
import mekanism.api.transmitters.DynamicNetwork.NetworkFinder;
|
||||||
import mekanism.api.Object3D;
|
import mekanism.api.Object3D;
|
||||||
import mekanism.common.tileentity.TileEntityPressurizedTube;
|
|
||||||
import net.minecraft.tileentity.TileEntity;
|
import net.minecraft.tileentity.TileEntity;
|
||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
|
|
||||||
|
@ -33,9 +33,9 @@ public class GasClientUpdate
|
||||||
{
|
{
|
||||||
TileEntity tileEntity = object.getTileEntity(worldObj);
|
TileEntity tileEntity = object.getTileEntity(worldObj);
|
||||||
|
|
||||||
if(tileEntity instanceof TileEntityPressurizedTube)
|
if(tileEntity instanceof ITransmitter && ((ITransmitter<?, ?>)tileEntity).getTransmissionType() == TransmissionType.GAS)
|
||||||
{
|
{
|
||||||
((TileEntityPressurizedTube)tileEntity).onTransfer(gasType);
|
((ITransmitter<?,EnumGas>)tileEntity).clientUpdate(gasType);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
371
common/mekanism/client/render/RenderPartTransmitter.java
Normal file
|
@ -0,0 +1,371 @@
|
||||||
|
package mekanism.client.render;
|
||||||
|
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
import org.lwjgl.opengl.GL11;
|
||||||
|
|
||||||
|
import codechicken.lib.colour.Colour;
|
||||||
|
import codechicken.lib.colour.ColourRGBA;
|
||||||
|
import codechicken.lib.lighting.LightModel;
|
||||||
|
import codechicken.lib.render.CCModel;
|
||||||
|
import codechicken.lib.render.CCRenderState;
|
||||||
|
import codechicken.lib.render.ColourMultiplier;
|
||||||
|
import codechicken.lib.render.IconTransformation;
|
||||||
|
import codechicken.lib.render.TextureUtils;
|
||||||
|
import codechicken.lib.render.TextureUtils.IIconRegister;
|
||||||
|
import codechicken.lib.vec.Translation;
|
||||||
|
import codechicken.lib.vec.Vector3;
|
||||||
|
import net.minecraft.block.Block;
|
||||||
|
import net.minecraft.client.renderer.texture.IconRegister;
|
||||||
|
import net.minecraft.util.Icon;
|
||||||
|
import net.minecraft.util.ResourceLocation;
|
||||||
|
import net.minecraftforge.common.ForgeDirection;
|
||||||
|
import net.minecraftforge.fluids.Fluid;
|
||||||
|
import net.minecraftforge.fluids.FluidRegistry;
|
||||||
|
import mekanism.api.transmitters.TransmissionType;
|
||||||
|
import mekanism.client.render.MekanismRenderer.DisplayInteger;
|
||||||
|
import mekanism.client.render.MekanismRenderer.Model3D;
|
||||||
|
import mekanism.common.multipart.PartLogisticalTransporter;
|
||||||
|
import mekanism.common.multipart.PartMechanicalPipe;
|
||||||
|
import mekanism.common.multipart.PartPressurizedTube;
|
||||||
|
import mekanism.common.multipart.PartTransmitter;
|
||||||
|
import mekanism.common.multipart.PartUniversalCable;
|
||||||
|
|
||||||
|
public class RenderPartTransmitter implements IIconRegister
|
||||||
|
{
|
||||||
|
public static RenderPartTransmitter INSTANCE;
|
||||||
|
|
||||||
|
public static Icon[] uniCableTextures = new Icon[2];
|
||||||
|
public static Icon[] mechPipeTextures = new Icon[2];
|
||||||
|
public static Icon[] pressTubeTextures = new Icon[2];
|
||||||
|
public static Icon[] logiTransporterTextures = new Icon[2];
|
||||||
|
public static Icon liquidEnergyTexture;
|
||||||
|
public static Icon sideTexture;
|
||||||
|
public static Map<TransmissionType, Icon[]> typeMap = new HashMap<TransmissionType, Icon[]>();
|
||||||
|
public static Map<String, CCModel> models;
|
||||||
|
public static Map<String, CCModel> cableContentsModels;
|
||||||
|
|
||||||
|
private static final int stages = 40;
|
||||||
|
private static final double offset = 0.015;
|
||||||
|
private HashMap<ForgeDirection, HashMap<Fluid, DisplayInteger[]>> cachedLiquids = new HashMap<ForgeDirection, HashMap<Fluid, DisplayInteger[]>>();
|
||||||
|
|
||||||
|
static
|
||||||
|
{
|
||||||
|
models = CCModel.parseObjModels(new ResourceLocation("mekanism", "models/transmitter.obj"), 7, null);
|
||||||
|
for (CCModel c : models.values()) {
|
||||||
|
c.apply(new Translation(.5, .5, .5));
|
||||||
|
c.computeLighting(LightModel.standardLightModel);
|
||||||
|
c.shrinkUVs(0.0005);
|
||||||
|
}
|
||||||
|
|
||||||
|
cableContentsModels = CCModel.parseObjModels(new ResourceLocation("mekanism", "models/transmitterEnergy.obj"), 7, null);
|
||||||
|
for (CCModel c : cableContentsModels.values()) {
|
||||||
|
c.apply(new Translation(.5, .5, .5));
|
||||||
|
c.computeLighting(LightModel.standardLightModel);
|
||||||
|
c.shrinkUVs(0.0005);
|
||||||
|
}
|
||||||
|
|
||||||
|
typeMap.put(TransmissionType.ENERGY, uniCableTextures);
|
||||||
|
typeMap.put(TransmissionType.FLUID, mechPipeTextures);
|
||||||
|
typeMap.put(TransmissionType.GAS, pressTubeTextures);
|
||||||
|
typeMap.put(TransmissionType.ITEM, logiTransporterTextures);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static RenderPartTransmitter getInstance()
|
||||||
|
{
|
||||||
|
return INSTANCE;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void init()
|
||||||
|
{
|
||||||
|
INSTANCE = new RenderPartTransmitter();
|
||||||
|
TextureUtils.addIconRegistrar(INSTANCE);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void push()
|
||||||
|
{
|
||||||
|
GL11.glPushMatrix();
|
||||||
|
GL11.glPushAttrib(GL11.GL_ENABLE_BIT);
|
||||||
|
GL11.glEnable(GL11.GL_CULL_FACE);
|
||||||
|
GL11.glEnable(GL11.GL_BLEND);
|
||||||
|
GL11.glDisable(GL11.GL_LIGHTING);
|
||||||
|
GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void pop()
|
||||||
|
{
|
||||||
|
GL11.glPopAttrib();
|
||||||
|
GL11.glPopMatrix();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void renderContents(PartUniversalCable cable, Vector3 pos)
|
||||||
|
{
|
||||||
|
if(cable.transmitting == 0)
|
||||||
|
return;
|
||||||
|
GL11.glPushMatrix();
|
||||||
|
CCRenderState.reset();
|
||||||
|
CCRenderState.useNormals(true);
|
||||||
|
CCRenderState.useModelColours(true);
|
||||||
|
//CCRenderState.setBrightness(255);
|
||||||
|
CCRenderState.startDrawing(7);
|
||||||
|
GL11.glTranslated(pos.x, pos.y, pos.z);
|
||||||
|
for (ForgeDirection side : ForgeDirection.VALID_DIRECTIONS)
|
||||||
|
{
|
||||||
|
renderEnergySide(side, cable);
|
||||||
|
}
|
||||||
|
//MekanismRenderer.glowOn();
|
||||||
|
CCRenderState.draw();
|
||||||
|
//MekanismRenderer.glowOff();
|
||||||
|
GL11.glPopMatrix();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void renderContents(PartMechanicalPipe pipe, Vector3 pos)
|
||||||
|
{
|
||||||
|
if(pipe.fluidScale > 0 && pipe.transmitting != null)
|
||||||
|
{
|
||||||
|
push();
|
||||||
|
|
||||||
|
if(pipe.transmitting.getFluid() == FluidRegistry.LAVA)
|
||||||
|
{
|
||||||
|
MekanismRenderer.glowOn();
|
||||||
|
}
|
||||||
|
|
||||||
|
CCRenderState.changeTexture((MekanismRenderer.getLiquidTexture()));
|
||||||
|
GL11.glTranslated(pos.x, pos.y, pos.z);
|
||||||
|
|
||||||
|
for (ForgeDirection side : ForgeDirection.VALID_DIRECTIONS)
|
||||||
|
{
|
||||||
|
if(PartTransmitter.connectionMapContainsSide(pipe.getAllCurrentConnections(), side))
|
||||||
|
{
|
||||||
|
DisplayInteger[] displayLists = getListAndRender(side, pipe.transmitting.getFluid());
|
||||||
|
|
||||||
|
if(displayLists != null)
|
||||||
|
{
|
||||||
|
displayLists[Math.max(3, (int)((float)pipe.fluidScale*(stages-1)))].render();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
DisplayInteger[] displayLists = getListAndRender(ForgeDirection.UNKNOWN, pipe.transmitting.getFluid());
|
||||||
|
|
||||||
|
if(displayLists != null)
|
||||||
|
{
|
||||||
|
displayLists[Math.max(3, (int)((float)pipe.fluidScale*(stages-1)))].render();
|
||||||
|
}
|
||||||
|
|
||||||
|
if(pipe.transmitting.getFluid() == FluidRegistry.LAVA)
|
||||||
|
{
|
||||||
|
MekanismRenderer.glowOff();
|
||||||
|
}
|
||||||
|
|
||||||
|
pop();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
private DisplayInteger[] getListAndRender(ForgeDirection side, Fluid fluid)
|
||||||
|
{
|
||||||
|
if(side == null || fluid == null || fluid.getIcon() == null)
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(cachedLiquids.containsKey(side) && cachedLiquids.get(side).containsKey(fluid))
|
||||||
|
{
|
||||||
|
return cachedLiquids.get(side).get(fluid);
|
||||||
|
}
|
||||||
|
|
||||||
|
Model3D toReturn = new Model3D();
|
||||||
|
toReturn.baseBlock = Block.waterStill;
|
||||||
|
toReturn.setTexture(fluid.getIcon());
|
||||||
|
|
||||||
|
toReturn.setSideRender(side, false);
|
||||||
|
toReturn.setSideRender(side.getOpposite(), false);
|
||||||
|
|
||||||
|
DisplayInteger[] displays = new DisplayInteger[stages];
|
||||||
|
|
||||||
|
if(cachedLiquids.containsKey(side))
|
||||||
|
{
|
||||||
|
cachedLiquids.get(side).put(fluid, displays);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
HashMap<Fluid, DisplayInteger[]> map = new HashMap<Fluid, DisplayInteger[]>();
|
||||||
|
map.put(fluid, displays);
|
||||||
|
cachedLiquids.put(side, map);
|
||||||
|
}
|
||||||
|
|
||||||
|
MekanismRenderer.colorFluid(fluid);
|
||||||
|
|
||||||
|
for(int i = 0; i < stages; i++)
|
||||||
|
{
|
||||||
|
displays[i] = DisplayInteger.createAndStart();
|
||||||
|
|
||||||
|
switch(side)
|
||||||
|
{
|
||||||
|
case UNKNOWN:
|
||||||
|
{
|
||||||
|
toReturn.minX = 0.3 + offset;
|
||||||
|
toReturn.minY = 0.3 + offset;
|
||||||
|
toReturn.minZ = 0.3 + offset;
|
||||||
|
|
||||||
|
toReturn.maxX = 0.7 - offset;
|
||||||
|
toReturn.maxY = 0.3 - offset + ((float)i / (float)100);
|
||||||
|
toReturn.maxZ = 0.7 - offset;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case DOWN:
|
||||||
|
{
|
||||||
|
toReturn.minX = 0.5 + offset - ((float)i / (float)100)/2;
|
||||||
|
toReturn.minY = 0.0;
|
||||||
|
toReturn.minZ = 0.5 + offset - ((float)i / (float)100)/2;
|
||||||
|
|
||||||
|
toReturn.maxX = 0.5 - offset + ((float)i / (float)100)/2;
|
||||||
|
toReturn.maxY = 0.3 + offset;
|
||||||
|
toReturn.maxZ = 0.5 - offset + ((float)i / (float)100)/2;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case UP:
|
||||||
|
{
|
||||||
|
toReturn.minX = 0.5 + offset - ((float)i / (float)100)/2;
|
||||||
|
toReturn.minY = 0.3 - offset + ((float)i / (float)100);
|
||||||
|
toReturn.minZ = 0.5 + offset - ((float)i / (float)100)/2;
|
||||||
|
|
||||||
|
toReturn.maxX = 0.5 - offset + ((float)i / (float)100)/2;
|
||||||
|
toReturn.maxY = 1.0;
|
||||||
|
toReturn.maxZ = 0.5 - offset + ((float)i / (float)100)/2;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case NORTH:
|
||||||
|
{
|
||||||
|
toReturn.minX = 0.3 + offset;
|
||||||
|
toReturn.minY = 0.3 + offset;
|
||||||
|
toReturn.minZ = 0.0;
|
||||||
|
|
||||||
|
toReturn.maxX = 0.7 - offset;
|
||||||
|
toReturn.maxY = 0.3 - offset + ((float)i / (float)100);
|
||||||
|
toReturn.maxZ = 0.3 + offset;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case SOUTH:
|
||||||
|
{
|
||||||
|
toReturn.minX = 0.3 + offset;
|
||||||
|
toReturn.minY = 0.3 + offset;
|
||||||
|
toReturn.minZ = 0.7 - offset;
|
||||||
|
|
||||||
|
toReturn.maxX = 0.7 - offset;
|
||||||
|
toReturn.maxY = 0.3 - offset + ((float)i / (float)100);
|
||||||
|
toReturn.maxZ = 1.0;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case WEST:
|
||||||
|
{
|
||||||
|
toReturn.minX = 0.0;
|
||||||
|
toReturn.minY = 0.3 + offset;
|
||||||
|
toReturn.minZ = 0.3 + offset;
|
||||||
|
|
||||||
|
toReturn.maxX = 0.3 + offset;
|
||||||
|
toReturn.maxY = 0.3 - offset + ((float)i / (float)100);
|
||||||
|
toReturn.maxZ = 0.7 - offset;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case EAST:
|
||||||
|
{
|
||||||
|
toReturn.minX = 0.7 - offset;
|
||||||
|
toReturn.minY = 0.3 + offset;
|
||||||
|
toReturn.minZ = 0.3 + offset;
|
||||||
|
|
||||||
|
toReturn.maxX = 1.0;
|
||||||
|
toReturn.maxY = 0.3 - offset + ((float)i / (float)100);
|
||||||
|
toReturn.maxZ = 0.7 - offset;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
MekanismRenderer.renderObject(toReturn);
|
||||||
|
DisplayInteger.endList();
|
||||||
|
}
|
||||||
|
|
||||||
|
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
|
||||||
|
|
||||||
|
return displays;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void renderContents(PartPressurizedTube transmitter, Vector3 pos)
|
||||||
|
{
|
||||||
|
System.out.println("specific");
|
||||||
|
}
|
||||||
|
|
||||||
|
public void renderContents(PartLogisticalTransporter transmitter, Vector3 pos)
|
||||||
|
{
|
||||||
|
System.out.println("specific");
|
||||||
|
}
|
||||||
|
|
||||||
|
public void renderStatic(PartTransmitter<?, ?> transmitter)
|
||||||
|
{
|
||||||
|
TextureUtils.bindAtlas(0);
|
||||||
|
CCRenderState.reset();
|
||||||
|
CCRenderState.useModelColours(true);
|
||||||
|
CCRenderState.setBrightness(transmitter.world(), transmitter.x(), transmitter.y(), transmitter.z());
|
||||||
|
for (ForgeDirection side : ForgeDirection.VALID_DIRECTIONS)
|
||||||
|
{
|
||||||
|
renderSide(side, transmitter);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public void renderSide(ForgeDirection side, PartTransmitter<?, ?> transmitter)
|
||||||
|
{
|
||||||
|
boolean connected = PartTransmitter.connectionMapContainsSide(transmitter.getAllCurrentConnections(), side);
|
||||||
|
String name = side.name().toLowerCase();
|
||||||
|
name += connected ? "Out" : "In";
|
||||||
|
Icon renderIcon = connected ? sideTexture : getIconForPart(transmitter);
|
||||||
|
renderPart(renderIcon, models.get(name), transmitter.x(), transmitter.y(), transmitter.z());
|
||||||
|
}
|
||||||
|
|
||||||
|
public void renderEnergySide(ForgeDirection side, PartUniversalCable cable)
|
||||||
|
{
|
||||||
|
boolean connected = PartTransmitter.connectionMapContainsSide(cable.getAllCurrentConnections(), side);
|
||||||
|
String name = side.name().toLowerCase();
|
||||||
|
name += connected ? "Out" : "In";
|
||||||
|
renderTransparency(liquidEnergyTexture, cableContentsModels.get(name), new ColourRGBA(1.0, 1.0, 1.0, cable.transmitting));
|
||||||
|
}
|
||||||
|
|
||||||
|
public void renderPart(Icon icon, CCModel cc, double x, double y, double z) {
|
||||||
|
cc.render(0, cc.verts.length,
|
||||||
|
new Translation(x, y, z), new IconTransformation(icon), null);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void renderTransparency(Icon icon, CCModel cc, Colour colour) {
|
||||||
|
cc.render(0, cc.verts.length,
|
||||||
|
new Translation(0, 0, 0), new IconTransformation(icon), new ColourMultiplier(colour));
|
||||||
|
}
|
||||||
|
|
||||||
|
public Icon getIconForPart(PartTransmitter<?, ?> part)
|
||||||
|
{
|
||||||
|
Icon[] icons = typeMap.get(part.getTransmissionType());
|
||||||
|
return icons[part.isActive ? 1 : 0];
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void registerIcons(IconRegister register)
|
||||||
|
{
|
||||||
|
sideTexture = register.registerIcon("mekanism:models/TransmitterSide");
|
||||||
|
uniCableTextures[0] = register.registerIcon("mekanism:models/UniversalCable");
|
||||||
|
uniCableTextures[1] = uniCableTextures[0];
|
||||||
|
pressTubeTextures[0] = register.registerIcon("mekanism:models/PressurizedTube");
|
||||||
|
pressTubeTextures[1] = pressTubeTextures[0];
|
||||||
|
mechPipeTextures[0] = register.registerIcon("mekanism:models/MechanicalPipe");
|
||||||
|
mechPipeTextures[1] = register.registerIcon("mekanism:models/MechanicalPipeActive");
|
||||||
|
logiTransporterTextures[0] = register.registerIcon("mekanism:models/LogisticalTransporter");
|
||||||
|
logiTransporterTextures[1] = register.registerIcon("mekanism:models/LogisticalTransporterActive");
|
||||||
|
|
||||||
|
liquidEnergyTexture = register.registerIcon("mekanism:LiquidEnergy");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int atlasIndex()
|
||||||
|
{
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
}
|
|
@ -56,10 +56,10 @@ public class RenderUniversalCable extends TileEntitySpecialRenderer
|
||||||
|
|
||||||
connectable = CableUtils.getConnections(tileEntity);
|
connectable = CableUtils.getConnections(tileEntity);
|
||||||
|
|
||||||
model.renderCenter(connectable);
|
//model.renderCenter(connectable);
|
||||||
for(int i = 0; i < 6; i++)
|
for(int i = 0; i < 6; i++)
|
||||||
{
|
{
|
||||||
model.renderSide(ForgeDirection.getOrientation(i), connectable[i]);
|
//model.renderSide(ForgeDirection.getOrientation(i), connectable[i]);
|
||||||
}
|
}
|
||||||
|
|
||||||
GL11.glEnable(GL11.GL_CULL_FACE);
|
GL11.glEnable(GL11.GL_CULL_FACE);
|
||||||
|
@ -73,7 +73,7 @@ public class RenderUniversalCable extends TileEntitySpecialRenderer
|
||||||
push();
|
push();
|
||||||
|
|
||||||
MekanismRenderer.glowOn();
|
MekanismRenderer.glowOn();
|
||||||
GL11.glColor4f(1.F, 1.F, 1.F, tileEntity.getEnergyScale());
|
GL11.glColor4f(1.F, 1.F, 1.F, 0.6F);
|
||||||
bindTexture(MekanismUtils.getResource(ResourceType.TEXTURE_ITEMS, "LiquidEnergy.png"));
|
bindTexture(MekanismUtils.getResource(ResourceType.TEXTURE_ITEMS, "LiquidEnergy.png"));
|
||||||
GL11.glTranslatef((float)x, (float)y, (float)z);
|
GL11.glTranslatef((float)x, (float)y, (float)z);
|
||||||
|
|
||||||
|
|
|
@ -28,19 +28,19 @@ import buildcraft.api.power.PowerHandler.PowerReceiver;
|
||||||
import buildcraft.api.power.PowerHandler.Type;
|
import buildcraft.api.power.PowerHandler.Type;
|
||||||
import cpw.mods.fml.common.FMLCommonHandler;
|
import cpw.mods.fml.common.FMLCommonHandler;
|
||||||
|
|
||||||
public class EnergyNetwork extends DynamicNetwork<TileEntity, EnergyNetwork>
|
public class EnergyNetwork extends DynamicNetwork<TileEntity, EnergyNetwork, Double>
|
||||||
{
|
{
|
||||||
private double lastPowerScale = 0;
|
private double lastPowerScale = 0;
|
||||||
private double joulesTransmitted = 0;
|
private double joulesTransmitted = 0;
|
||||||
private double joulesLastTick = 0;
|
private double joulesLastTick = 0;
|
||||||
|
|
||||||
public EnergyNetwork(ITransmitter<EnergyNetwork>... varCables)
|
public EnergyNetwork(ITransmitter<EnergyNetwork, Double>... varCables)
|
||||||
{
|
{
|
||||||
transmitters.addAll(Arrays.asList(varCables));
|
transmitters.addAll(Arrays.asList(varCables));
|
||||||
register();
|
register();
|
||||||
}
|
}
|
||||||
|
|
||||||
public EnergyNetwork(Collection<ITransmitter<EnergyNetwork>> collection)
|
public EnergyNetwork(Collection<ITransmitter<EnergyNetwork, Double>> collection)
|
||||||
{
|
{
|
||||||
transmitters.addAll(collection);
|
transmitters.addAll(collection);
|
||||||
register();
|
register();
|
||||||
|
@ -203,15 +203,15 @@ public class EnergyNetwork extends DynamicNetwork<TileEntity, EnergyNetwork>
|
||||||
@Override
|
@Override
|
||||||
public void refresh()
|
public void refresh()
|
||||||
{
|
{
|
||||||
Set<ITransmitter<EnergyNetwork>> iterCables = (Set<ITransmitter<EnergyNetwork>>) transmitters.clone();
|
Set<ITransmitter<EnergyNetwork, Double>> iterCables = (Set<ITransmitter<EnergyNetwork, Double>>) transmitters.clone();
|
||||||
Iterator<ITransmitter<EnergyNetwork>> it = iterCables.iterator();
|
Iterator<ITransmitter<EnergyNetwork, Double>> it = iterCables.iterator();
|
||||||
|
|
||||||
possibleAcceptors.clear();
|
possibleAcceptors.clear();
|
||||||
acceptorDirections.clear();
|
acceptorDirections.clear();
|
||||||
|
|
||||||
while(it.hasNext())
|
while(it.hasNext())
|
||||||
{
|
{
|
||||||
ITransmitter<EnergyNetwork> conductor = (ITransmitter<EnergyNetwork>)it.next();
|
ITransmitter<EnergyNetwork, Double> conductor = (ITransmitter<EnergyNetwork, Double>)it.next();
|
||||||
|
|
||||||
if(conductor == null || ((TileEntity)conductor).isInvalid())
|
if(conductor == null || ((TileEntity)conductor).isInvalid())
|
||||||
{
|
{
|
||||||
|
@ -223,7 +223,7 @@ public class EnergyNetwork extends DynamicNetwork<TileEntity, EnergyNetwork>
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
for(ITransmitter<EnergyNetwork> cable : iterCables)
|
for(ITransmitter<EnergyNetwork, Double> cable : iterCables)
|
||||||
{
|
{
|
||||||
TileEntity[] acceptors = CableUtils.getConnectedEnergyAcceptors((TileEntity)cable);
|
TileEntity[] acceptors = CableUtils.getConnectedEnergyAcceptors((TileEntity)cable);
|
||||||
|
|
||||||
|
@ -298,7 +298,7 @@ public class EnergyNetwork extends DynamicNetwork<TileEntity, EnergyNetwork>
|
||||||
|
|
||||||
public double getPowerScale()
|
public double getPowerScale()
|
||||||
{
|
{
|
||||||
return joulesLastTick == 0 ? 0 : Math.min(Math.ceil(Math.log10(getPower())*2)/10, 1);
|
return joulesLastTick == 0 ? 0 : Math.min(Math.ceil(Math.log10(getPower()))/10, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void clearJoulesTransmitted()
|
public void clearJoulesTransmitted()
|
||||||
|
@ -313,13 +313,13 @@ public class EnergyNetwork extends DynamicNetwork<TileEntity, EnergyNetwork>
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected EnergyNetwork create(ITransmitter<EnergyNetwork>... varTransmitters)
|
protected EnergyNetwork create(ITransmitter<EnergyNetwork, Double>... varTransmitters)
|
||||||
{
|
{
|
||||||
return new EnergyNetwork(varTransmitters);
|
return new EnergyNetwork(varTransmitters);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected EnergyNetwork create(Collection<ITransmitter<EnergyNetwork>> collection)
|
protected EnergyNetwork create(Collection<ITransmitter<EnergyNetwork, Double>> collection)
|
||||||
{
|
{
|
||||||
return new EnergyNetwork(collection);
|
return new EnergyNetwork(collection);
|
||||||
}
|
}
|
||||||
|
|
|
@ -23,15 +23,15 @@ import net.minecraftforge.fluids.FluidStack;
|
||||||
import net.minecraftforge.fluids.IFluidHandler;
|
import net.minecraftforge.fluids.IFluidHandler;
|
||||||
import cpw.mods.fml.common.FMLCommonHandler;
|
import cpw.mods.fml.common.FMLCommonHandler;
|
||||||
|
|
||||||
public class FluidNetwork extends DynamicNetwork<IFluidHandler, FluidNetwork>
|
public class FluidNetwork extends DynamicNetwork<IFluidHandler, FluidNetwork, FluidStack>
|
||||||
{
|
{
|
||||||
public FluidNetwork(ITransmitter<FluidNetwork>... varPipes)
|
public FluidNetwork(ITransmitter<FluidNetwork, FluidStack>... varPipes)
|
||||||
{
|
{
|
||||||
transmitters.addAll(Arrays.asList(varPipes));
|
transmitters.addAll(Arrays.asList(varPipes));
|
||||||
register();
|
register();
|
||||||
}
|
}
|
||||||
|
|
||||||
public FluidNetwork(Collection<ITransmitter<FluidNetwork>> collection)
|
public FluidNetwork(Collection<ITransmitter<FluidNetwork, FluidStack>> collection)
|
||||||
{
|
{
|
||||||
transmitters.addAll(collection);
|
transmitters.addAll(collection);
|
||||||
register();
|
register();
|
||||||
|
@ -134,7 +134,7 @@ public class FluidNetwork extends DynamicNetwork<IFluidHandler, FluidNetwork>
|
||||||
@Override
|
@Override
|
||||||
public void refresh()
|
public void refresh()
|
||||||
{
|
{
|
||||||
Set<ITransmitter<FluidNetwork>> iterPipes = (Set<ITransmitter<FluidNetwork>>)transmitters.clone();
|
Set<ITransmitter<FluidNetwork, FluidStack>> iterPipes = (Set<ITransmitter<FluidNetwork, FluidStack>>)transmitters.clone();
|
||||||
Iterator it = iterPipes.iterator();
|
Iterator it = iterPipes.iterator();
|
||||||
|
|
||||||
possibleAcceptors.clear();
|
possibleAcceptors.clear();
|
||||||
|
@ -142,7 +142,7 @@ public class FluidNetwork extends DynamicNetwork<IFluidHandler, FluidNetwork>
|
||||||
|
|
||||||
while(it.hasNext())
|
while(it.hasNext())
|
||||||
{
|
{
|
||||||
ITransmitter<FluidNetwork> conductor = (ITransmitter<FluidNetwork>)it.next();
|
ITransmitter<FluidNetwork, FluidStack> conductor = (ITransmitter<FluidNetwork, FluidStack>)it.next();
|
||||||
|
|
||||||
if(conductor == null || ((TileEntity)conductor).isInvalid())
|
if(conductor == null || ((TileEntity)conductor).isInvalid())
|
||||||
{
|
{
|
||||||
|
@ -154,7 +154,7 @@ public class FluidNetwork extends DynamicNetwork<IFluidHandler, FluidNetwork>
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
for(ITransmitter<FluidNetwork> pipe : iterPipes)
|
for(ITransmitter<FluidNetwork, FluidStack> pipe : iterPipes)
|
||||||
{
|
{
|
||||||
if(pipe instanceof TileEntityMechanicalPipe && ((TileEntityMechanicalPipe)pipe).isActive) continue;
|
if(pipe instanceof TileEntityMechanicalPipe && ((TileEntityMechanicalPipe)pipe).isActive) continue;
|
||||||
IFluidHandler[] acceptors = PipeUtils.getConnectedAcceptors((TileEntity)pipe);
|
IFluidHandler[] acceptors = PipeUtils.getConnectedAcceptors((TileEntity)pipe);
|
||||||
|
@ -203,13 +203,13 @@ public class FluidNetwork extends DynamicNetwork<IFluidHandler, FluidNetwork>
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected FluidNetwork create(ITransmitter<FluidNetwork>... varTransmitters)
|
protected FluidNetwork create(ITransmitter<FluidNetwork, FluidStack>... varTransmitters)
|
||||||
{
|
{
|
||||||
return new FluidNetwork(varTransmitters);
|
return new FluidNetwork(varTransmitters);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected FluidNetwork create(Collection<ITransmitter<FluidNetwork>> collection)
|
protected FluidNetwork create(Collection<ITransmitter<FluidNetwork, FluidStack>> collection)
|
||||||
{
|
{
|
||||||
return new FluidNetwork(collection);
|
return new FluidNetwork(collection);
|
||||||
}
|
}
|
||||||
|
|
|
@ -11,18 +11,19 @@ import mekanism.api.transmitters.ITransmitter;
|
||||||
import mekanism.api.transmitters.TransmissionType;
|
import mekanism.api.transmitters.TransmissionType;
|
||||||
import mekanism.common.util.TransporterUtils;
|
import mekanism.common.util.TransporterUtils;
|
||||||
import net.minecraft.inventory.IInventory;
|
import net.minecraft.inventory.IInventory;
|
||||||
|
import net.minecraft.item.ItemStack;
|
||||||
import net.minecraft.tileentity.TileEntity;
|
import net.minecraft.tileentity.TileEntity;
|
||||||
import net.minecraftforge.common.ForgeDirection;
|
import net.minecraftforge.common.ForgeDirection;
|
||||||
|
|
||||||
public class InventoryNetwork extends DynamicNetwork<IInventory, InventoryNetwork>
|
public class InventoryNetwork extends DynamicNetwork<IInventory, InventoryNetwork, ItemStack>
|
||||||
{
|
{
|
||||||
public InventoryNetwork(ITransmitter<InventoryNetwork>... varTransporters)
|
public InventoryNetwork(ITransmitter<InventoryNetwork, ItemStack>... varTransporters)
|
||||||
{
|
{
|
||||||
transmitters.addAll(Arrays.asList(varTransporters));
|
transmitters.addAll(Arrays.asList(varTransporters));
|
||||||
register();
|
register();
|
||||||
}
|
}
|
||||||
|
|
||||||
public InventoryNetwork(Collection<ITransmitter<InventoryNetwork>> collection)
|
public InventoryNetwork(Collection<ITransmitter<InventoryNetwork, ItemStack>> collection)
|
||||||
{
|
{
|
||||||
transmitters.addAll(collection);
|
transmitters.addAll(collection);
|
||||||
register();
|
register();
|
||||||
|
@ -52,7 +53,7 @@ public class InventoryNetwork extends DynamicNetwork<IInventory, InventoryNetwor
|
||||||
@Override
|
@Override
|
||||||
public void refresh()
|
public void refresh()
|
||||||
{
|
{
|
||||||
Set<ITransmitter<InventoryNetwork>> iterTransmitters = (Set<ITransmitter<InventoryNetwork>>)transmitters.clone();
|
Set<ITransmitter<InventoryNetwork, ItemStack>> iterTransmitters = (Set<ITransmitter<InventoryNetwork, ItemStack>>)transmitters.clone();
|
||||||
Iterator it = iterTransmitters.iterator();
|
Iterator it = iterTransmitters.iterator();
|
||||||
|
|
||||||
possibleAcceptors.clear();
|
possibleAcceptors.clear();
|
||||||
|
@ -60,7 +61,7 @@ public class InventoryNetwork extends DynamicNetwork<IInventory, InventoryNetwor
|
||||||
|
|
||||||
while(it.hasNext())
|
while(it.hasNext())
|
||||||
{
|
{
|
||||||
ITransmitter<InventoryNetwork> conductor = (ITransmitter<InventoryNetwork>)it.next();
|
ITransmitter<InventoryNetwork, ItemStack> conductor = (ITransmitter<InventoryNetwork, ItemStack>)it.next();
|
||||||
|
|
||||||
if(conductor == null || ((TileEntity)conductor).isInvalid())
|
if(conductor == null || ((TileEntity)conductor).isInvalid())
|
||||||
{
|
{
|
||||||
|
@ -72,7 +73,7 @@ public class InventoryNetwork extends DynamicNetwork<IInventory, InventoryNetwor
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
for(ITransmitter<InventoryNetwork> transmitter : iterTransmitters)
|
for(ITransmitter<InventoryNetwork, ItemStack> transmitter : iterTransmitters)
|
||||||
{
|
{
|
||||||
IInventory[] inventories = TransporterUtils.getConnectedInventories((TileEntity)transmitter);
|
IInventory[] inventories = TransporterUtils.getConnectedInventories((TileEntity)transmitter);
|
||||||
|
|
||||||
|
@ -107,13 +108,13 @@ public class InventoryNetwork extends DynamicNetwork<IInventory, InventoryNetwor
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected InventoryNetwork create(ITransmitter<InventoryNetwork>... varTransmitters)
|
protected InventoryNetwork create(ITransmitter<InventoryNetwork, ItemStack>... varTransmitters)
|
||||||
{
|
{
|
||||||
return new InventoryNetwork(varTransmitters);
|
return new InventoryNetwork(varTransmitters);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected InventoryNetwork create(Collection<ITransmitter<InventoryNetwork>> collection)
|
protected InventoryNetwork create(Collection<ITransmitter<InventoryNetwork, ItemStack>> collection)
|
||||||
{
|
{
|
||||||
return new InventoryNetwork(collection);
|
return new InventoryNetwork(collection);
|
||||||
}
|
}
|
||||||
|
|
|
@ -55,6 +55,8 @@ import mekanism.common.item.ItemRobit;
|
||||||
import mekanism.common.item.ItemStopwatch;
|
import mekanism.common.item.ItemStopwatch;
|
||||||
import mekanism.common.item.ItemStorageTank;
|
import mekanism.common.item.ItemStorageTank;
|
||||||
import mekanism.common.item.ItemWeatherOrb;
|
import mekanism.common.item.ItemWeatherOrb;
|
||||||
|
import mekanism.common.multipart.ItemPartTransmitter;
|
||||||
|
import mekanism.common.multipart.MultipartMekanism;
|
||||||
import mekanism.common.network.PacketConfiguratorState;
|
import mekanism.common.network.PacketConfiguratorState;
|
||||||
import mekanism.common.network.PacketControlPanel;
|
import mekanism.common.network.PacketControlPanel;
|
||||||
import mekanism.common.network.PacketDataRequest;
|
import mekanism.common.network.PacketDataRequest;
|
||||||
|
@ -199,6 +201,7 @@ public class Mekanism
|
||||||
public static Item TeleportationCore;
|
public static Item TeleportationCore;
|
||||||
public static Item Configurator;
|
public static Item Configurator;
|
||||||
public static Item NetworkReader;
|
public static Item NetworkReader;
|
||||||
|
public static Item PartTransmitter;
|
||||||
|
|
||||||
//Blocks
|
//Blocks
|
||||||
public static Block BasicBlock;
|
public static Block BasicBlock;
|
||||||
|
@ -622,6 +625,12 @@ public class Mekanism
|
||||||
LanguageRegistry.instance().addStringLocalization("item.glowstoneIngot.name", "Glowstone Ingot");
|
LanguageRegistry.instance().addStringLocalization("item.glowstoneIngot.name", "Glowstone Ingot");
|
||||||
LanguageRegistry.instance().addStringLocalization("item.steelIngot.name", "Steel Ingot");
|
LanguageRegistry.instance().addStringLocalization("item.steelIngot.name", "Steel Ingot");
|
||||||
|
|
||||||
|
//Localization for Multipart Transmitters
|
||||||
|
LanguageRegistry.instance().addStringLocalization("item.MultipartTransmitter.energy.name", "Universal Cable");
|
||||||
|
LanguageRegistry.instance().addStringLocalization("item.MultipartTransmitter.fluid.name", "Mechanical Pipe");
|
||||||
|
LanguageRegistry.instance().addStringLocalization("item.MultipartTransmitter.gas.name", "Pressurized Tube");
|
||||||
|
LanguageRegistry.instance().addStringLocalization("item.MultipartTransmitter.items.name", "Logistical Transporter");
|
||||||
|
|
||||||
//Localization for Mekanism creative tab
|
//Localization for Mekanism creative tab
|
||||||
LanguageRegistry.instance().addStringLocalization("itemGroup.tabMekanism", "Mekanism");
|
LanguageRegistry.instance().addStringLocalization("itemGroup.tabMekanism", "Mekanism");
|
||||||
}
|
}
|
||||||
|
@ -660,6 +669,7 @@ public class Mekanism
|
||||||
DirtyDust = new ItemDirtyDust(configuration.getItem("DirtyDust", 11220).getInt()-256);
|
DirtyDust = new ItemDirtyDust(configuration.getItem("DirtyDust", 11220).getInt()-256);
|
||||||
Configurator = new ItemConfigurator(configuration.getItem("Configurator", 11221).getInt()).setUnlocalizedName("Configurator");
|
Configurator = new ItemConfigurator(configuration.getItem("Configurator", 11221).getInt()).setUnlocalizedName("Configurator");
|
||||||
NetworkReader = new ItemNetworkReader(configuration.getItem("NetworkReader", 11222).getInt()).setUnlocalizedName("NetworkReader");
|
NetworkReader = new ItemNetworkReader(configuration.getItem("NetworkReader", 11222).getInt()).setUnlocalizedName("NetworkReader");
|
||||||
|
PartTransmitter = new ItemPartTransmitter(configuration.getItem("MultipartTransmitter", 11223).getInt()).setUnlocalizedName("MultipartTransmitter");
|
||||||
configuration.save();
|
configuration.save();
|
||||||
|
|
||||||
//Registrations
|
//Registrations
|
||||||
|
@ -1187,6 +1197,8 @@ public class Mekanism
|
||||||
InfuseRegistry.registerInfuseType(new InfuseType("CARBON", MekanismUtils.getResource(ResourceType.INFUSE, "Infusions.png"), 0, 0));
|
InfuseRegistry.registerInfuseType(new InfuseType("CARBON", MekanismUtils.getResource(ResourceType.INFUSE, "Infusions.png"), 0, 0));
|
||||||
InfuseRegistry.registerInfuseType(new InfuseType("TIN", MekanismUtils.getResource(ResourceType.INFUSE, "Infusions.png"), 4, 0));
|
InfuseRegistry.registerInfuseType(new InfuseType("TIN", MekanismUtils.getResource(ResourceType.INFUSE, "Infusions.png"), 4, 0));
|
||||||
InfuseRegistry.registerInfuseType(new InfuseType("DIAMOND", MekanismUtils.getResource(ResourceType.INFUSE, "Infusions.png"), 8, 0));
|
InfuseRegistry.registerInfuseType(new InfuseType("DIAMOND", MekanismUtils.getResource(ResourceType.INFUSE, "Infusions.png"), 8, 0));
|
||||||
|
|
||||||
|
new MultipartMekanism().init();
|
||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler
|
@EventHandler
|
||||||
|
|
|
@ -263,4 +263,10 @@ public class ItemConfigurator extends ItemEnergized
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean shouldPassSneakingClickToBlock(World world, int x, int y, int z)
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -32,21 +32,25 @@ public class ItemNetworkReader extends ItemEnergized
|
||||||
{
|
{
|
||||||
setEnergy(stack, getEnergy(stack)-ENERGY_PER_USE);
|
setEnergy(stack, getEnergy(stack)-ENERGY_PER_USE);
|
||||||
|
|
||||||
ITransmitter transmitter = (ITransmitter)tileEntity;
|
ITransmitter<?, ?> transmitter = (ITransmitter<?, ?>)tileEntity;
|
||||||
|
|
||||||
player.sendChatToPlayer(ChatMessageComponent.createFromText(EnumColor.GREY + "------------- " + EnumColor.DARK_BLUE + "[Mekanism]" + EnumColor.GREY + " -------------"));
|
player.sendChatToPlayer(ChatMessageComponent.createFromText(EnumColor.GREY + "------------- " + EnumColor.DARK_BLUE + "[Mekanism]" + EnumColor.GREY + " -------------"));
|
||||||
player.sendChatToPlayer(ChatMessageComponent.createFromText(EnumColor.GREY + " *Transmitters: " + EnumColor.DARK_GREY + transmitter.getTransmitterNetworkSize()));
|
player.sendChatToPlayer(ChatMessageComponent.createFromText(EnumColor.GREY + " *Transmitters: " + EnumColor.DARK_GREY + transmitter.getTransmitterNetwork().getSize()));
|
||||||
player.sendChatToPlayer(ChatMessageComponent.createFromText(EnumColor.GREY + " *Acceptors: " + EnumColor.DARK_GREY + transmitter.getTransmitterNetworkAcceptorSize()));
|
player.sendChatToPlayer(ChatMessageComponent.createFromText(EnumColor.GREY + " *Acceptors: " + EnumColor.DARK_GREY + transmitter.getTransmitterNetwork().getAcceptorSize()));
|
||||||
player.sendChatToPlayer(ChatMessageComponent.createFromText(EnumColor.GREY + " *Needed: " + EnumColor.DARK_GREY + transmitter.getTransmitterNetworkNeeded()));
|
player.sendChatToPlayer(ChatMessageComponent.createFromText(EnumColor.GREY + " *Needed: " + EnumColor.DARK_GREY + transmitter.getTransmitterNetwork().getNeeded()));
|
||||||
player.sendChatToPlayer(ChatMessageComponent.createFromText(EnumColor.GREY + " *Power: " + EnumColor.DARK_GREY + transmitter.getTransmitterNetworkFlow() ));
|
player.sendChatToPlayer(ChatMessageComponent.createFromText(EnumColor.GREY + " *Power: " + EnumColor.DARK_GREY + transmitter.getTransmitterNetwork().getFlow() ));
|
||||||
player.sendChatToPlayer(ChatMessageComponent.createFromText(EnumColor.GREY + "------------- " + EnumColor.DARK_BLUE + "[=======]" + EnumColor.GREY + " -------------"));
|
player.sendChatToPlayer(ChatMessageComponent.createFromText(EnumColor.GREY + "------------- " + EnumColor.DARK_BLUE + "[=======]" + EnumColor.GREY + " -------------"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(player.isSneaking() && Mekanism.debug)
|
if(player.isSneaking() && Mekanism.debug)
|
||||||
{
|
{
|
||||||
|
String[] strings = TransmitterNetworkRegistry.getInstance().toStrings();
|
||||||
player.sendChatToPlayer(ChatMessageComponent.createFromText(EnumColor.GREY + "---------- " + EnumColor.DARK_BLUE + "[Mekanism Debug]" + EnumColor.GREY + " ----------"));
|
player.sendChatToPlayer(ChatMessageComponent.createFromText(EnumColor.GREY + "---------- " + EnumColor.DARK_BLUE + "[Mekanism Debug]" + EnumColor.GREY + " ----------"));
|
||||||
player.sendChatToPlayer(ChatMessageComponent.createFromText(EnumColor.GREY + " *Networks: " + EnumColor.DARK_GREY + TransmitterNetworkRegistry.getInstance().toString()));
|
for(String s : strings)
|
||||||
|
{
|
||||||
|
player.sendChatToPlayer(ChatMessageComponent.createFromText(EnumColor.DARK_GREY + s));
|
||||||
|
}
|
||||||
player.sendChatToPlayer(ChatMessageComponent.createFromText(EnumColor.GREY + "------------- " + EnumColor.DARK_BLUE + "[=======]" + EnumColor.GREY + " -------------"));
|
player.sendChatToPlayer(ChatMessageComponent.createFromText(EnumColor.GREY + "------------- " + EnumColor.DARK_BLUE + "[=======]" + EnumColor.GREY + " -------------"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
62
common/mekanism/common/multipart/ItemPartTransmitter.java
Normal file
|
@ -0,0 +1,62 @@
|
||||||
|
package mekanism.common.multipart;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import mekanism.api.transmitters.TransmissionType;
|
||||||
|
import mekanism.client.render.RenderPartTransmitter;
|
||||||
|
import mekanism.common.Mekanism;
|
||||||
|
import net.minecraft.client.renderer.texture.IconRegister;
|
||||||
|
import net.minecraft.creativetab.CreativeTabs;
|
||||||
|
import net.minecraft.entity.player.EntityPlayer;
|
||||||
|
import net.minecraft.item.ItemStack;
|
||||||
|
import net.minecraft.world.World;
|
||||||
|
import codechicken.lib.vec.BlockCoord;
|
||||||
|
import codechicken.lib.vec.Vector3;
|
||||||
|
import codechicken.multipart.JItemMultiPart;
|
||||||
|
import codechicken.multipart.TMultiPart;
|
||||||
|
import cpw.mods.fml.relauncher.Side;
|
||||||
|
import cpw.mods.fml.relauncher.SideOnly;
|
||||||
|
|
||||||
|
|
||||||
|
public class ItemPartTransmitter extends JItemMultiPart
|
||||||
|
{
|
||||||
|
|
||||||
|
public ItemPartTransmitter(int id)
|
||||||
|
{
|
||||||
|
super(id);
|
||||||
|
setHasSubtypes(true);
|
||||||
|
setCreativeTab(Mekanism.tabMekanism);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public TMultiPart newPart(ItemStack arg0, EntityPlayer arg1, World arg2, BlockCoord arg3, int arg4, Vector3 arg5)
|
||||||
|
{
|
||||||
|
return PartTransmitter.getPartType(TransmissionType.values()[this.getDamage(arg0)]);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int getMetadata(int damage)
|
||||||
|
{
|
||||||
|
return damage;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void getSubItems(int itemID, CreativeTabs tab, List listToAddTo) {
|
||||||
|
for (TransmissionType type : TransmissionType.values()) {
|
||||||
|
listToAddTo.add(new ItemStack(itemID, 1, type.ordinal()));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
@SideOnly(Side.CLIENT)
|
||||||
|
public int getSpriteNumber()
|
||||||
|
{
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getUnlocalizedName(ItemStack stack)
|
||||||
|
{
|
||||||
|
return getUnlocalizedName()+"."+TransmissionType.values()[stack.getItemDamage()].name().toLowerCase();
|
||||||
|
}
|
||||||
|
}
|
29
common/mekanism/common/multipart/MultipartMekanism.java
Normal file
|
@ -0,0 +1,29 @@
|
||||||
|
package mekanism.common.multipart;
|
||||||
|
|
||||||
|
import codechicken.multipart.MultiPartRegistry;
|
||||||
|
import codechicken.multipart.MultiPartRegistry.IPartFactory;
|
||||||
|
import codechicken.multipart.MultipartGenerator;
|
||||||
|
import codechicken.multipart.TMultiPart;
|
||||||
|
|
||||||
|
public class MultipartMekanism implements IPartFactory
|
||||||
|
{
|
||||||
|
@Override
|
||||||
|
public TMultiPart createPart(String name, boolean client)
|
||||||
|
{
|
||||||
|
if(name == "mekanism:universal_cable")
|
||||||
|
return new PartUniversalCable();
|
||||||
|
if(name == "mekanism:mechanical_pipe")
|
||||||
|
return new PartMechanicalPipe();
|
||||||
|
if(name == "mekanism:pressurized_tube")
|
||||||
|
return new PartPressurizedTube();
|
||||||
|
if(name == "mekanism:logistical_transporter")
|
||||||
|
return new PartLogisticalTransporter();
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void init()
|
||||||
|
{
|
||||||
|
MultiPartRegistry.registerParts(this, new String[]{"mekanism:universal_cable", "mekanism:mechanical_pipe", "mekanism:pressurized_tube", "mekanism:logistical_transporter"});
|
||||||
|
MultipartGenerator.registerPassThroughInterface("mekanism.api.transmitters.ITransmitter");
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,45 @@
|
||||||
|
package mekanism.common.multipart;
|
||||||
|
|
||||||
|
import java.util.Set;
|
||||||
|
|
||||||
|
import net.minecraft.inventory.IInventory;
|
||||||
|
import net.minecraft.item.ItemStack;
|
||||||
|
import net.minecraft.tileentity.TileEntity;
|
||||||
|
import net.minecraftforge.common.ForgeDirection;
|
||||||
|
import mekanism.api.transmitters.ITransmitter;
|
||||||
|
import mekanism.api.transmitters.TransmissionType;
|
||||||
|
import mekanism.common.InventoryNetwork;
|
||||||
|
|
||||||
|
public class PartLogisticalTransporter extends PartTransmitter<InventoryNetwork, ItemStack>
|
||||||
|
{
|
||||||
|
@Override
|
||||||
|
public String getType()
|
||||||
|
{
|
||||||
|
return "mekanism:logistical_transporter";
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public TransmissionType getTransmissionType()
|
||||||
|
{
|
||||||
|
return TransmissionType.ITEM;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isValidAcceptor(TileEntity tile, ForgeDirection side)
|
||||||
|
{
|
||||||
|
return tile instanceof IInventory;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public InventoryNetwork createNetworkFromSingleTransmitter(ITransmitter<InventoryNetwork, ItemStack> transmitter)
|
||||||
|
{
|
||||||
|
return new InventoryNetwork(transmitter);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public InventoryNetwork createNetworkByMergingSet(Set<InventoryNetwork> networks)
|
||||||
|
{
|
||||||
|
return new InventoryNetwork(networks);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
164
common/mekanism/common/multipart/PartMechanicalPipe.java
Normal file
|
@ -0,0 +1,164 @@
|
||||||
|
package mekanism.common.multipart;
|
||||||
|
|
||||||
|
import java.util.Arrays;
|
||||||
|
import java.util.Set;
|
||||||
|
|
||||||
|
import codechicken.lib.vec.Vector3;
|
||||||
|
import cpw.mods.fml.relauncher.Side;
|
||||||
|
import cpw.mods.fml.relauncher.SideOnly;
|
||||||
|
import mekanism.api.Object3D;
|
||||||
|
import mekanism.api.transmitters.ITransmitter;
|
||||||
|
import mekanism.api.transmitters.TransmissionType;
|
||||||
|
import mekanism.client.render.RenderPartTransmitter;
|
||||||
|
import mekanism.common.FluidNetwork;
|
||||||
|
import mekanism.common.PipeUtils;
|
||||||
|
import net.minecraft.tileentity.TileEntity;
|
||||||
|
import net.minecraftforge.common.ForgeDirection;
|
||||||
|
import net.minecraftforge.fluids.Fluid;
|
||||||
|
import net.minecraftforge.fluids.FluidContainerRegistry;
|
||||||
|
import net.minecraftforge.fluids.FluidStack;
|
||||||
|
import net.minecraftforge.fluids.FluidTank;
|
||||||
|
import net.minecraftforge.fluids.FluidTankInfo;
|
||||||
|
import net.minecraftforge.fluids.IFluidHandler;
|
||||||
|
|
||||||
|
public class PartMechanicalPipe extends PartTransmitter<FluidNetwork, FluidStack> implements IFluidHandler
|
||||||
|
{
|
||||||
|
/** The fake tank used for fluid transfer calculations. */
|
||||||
|
public FluidTank dummyTank = new FluidTank(FluidContainerRegistry.BUCKET_VOLUME);
|
||||||
|
|
||||||
|
/** The scale (0F -> 1F) of this pipe's fluid level. */
|
||||||
|
public float fluidScale;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getType()
|
||||||
|
{
|
||||||
|
return "mekanism:mechanical_pipe";
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public TransmissionType getTransmissionType()
|
||||||
|
{
|
||||||
|
return TransmissionType.FLUID;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void clientUpdate(FluidStack fluidStack)
|
||||||
|
{
|
||||||
|
if(fluidStack.isFluidEqual(transmitting))
|
||||||
|
{
|
||||||
|
fluidScale = Math.min(1, fluidScale+((float)fluidStack.amount/50F));
|
||||||
|
}
|
||||||
|
else if(transmitting == null)
|
||||||
|
{
|
||||||
|
transmitting = fluidStack.copy();
|
||||||
|
fluidScale += Math.min(1, ((float)fluidStack.amount/50F));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isValidAcceptor(TileEntity tile, ForgeDirection side)
|
||||||
|
{
|
||||||
|
return tile instanceof IFluidHandler;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public FluidNetwork createNetworkFromSingleTransmitter(ITransmitter<FluidNetwork, FluidStack> transmitter)
|
||||||
|
{
|
||||||
|
return new FluidNetwork(transmitter);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public FluidNetwork createNetworkByMergingSet(Set<FluidNetwork> networks)
|
||||||
|
{
|
||||||
|
return new FluidNetwork(networks);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
@SideOnly(Side.CLIENT)
|
||||||
|
public void renderDynamic(Vector3 pos, float f, int pass)
|
||||||
|
{
|
||||||
|
RenderPartTransmitter.getInstance().renderContents(this, pos);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int fill(ForgeDirection from, FluidStack resource, boolean doFill)
|
||||||
|
{
|
||||||
|
if(!isActive)
|
||||||
|
{
|
||||||
|
return getTransmitterNetwork().emit(resource, doFill, Object3D.get(tile()).getFromSide(from).getTileEntity(world()));
|
||||||
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public FluidStack drain(ForgeDirection from, int maxDrain, boolean doDrain)
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public FluidStack drain(ForgeDirection from, FluidStack resource, boolean doDrain)
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean canFill(ForgeDirection from, Fluid fluid)
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean canDrain(ForgeDirection from, Fluid fluid)
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public FluidTankInfo[] getTankInfo(ForgeDirection from)
|
||||||
|
{
|
||||||
|
return new FluidTankInfo[] {dummyTank.getInfo()};
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean doesTick()
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void update()
|
||||||
|
{
|
||||||
|
if(world().isRemote)
|
||||||
|
{
|
||||||
|
if(fluidScale > 0)
|
||||||
|
{
|
||||||
|
fluidScale -= .01;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
transmitting = null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
if(isActive)
|
||||||
|
{
|
||||||
|
IFluidHandler[] connectedAcceptors = PipeUtils.getConnectedAcceptors(tile());
|
||||||
|
|
||||||
|
for(IFluidHandler container : connectedAcceptors)
|
||||||
|
{
|
||||||
|
ForgeDirection side = ForgeDirection.getOrientation(Arrays.asList(connectedAcceptors).indexOf(container));
|
||||||
|
|
||||||
|
if(container != null)
|
||||||
|
{
|
||||||
|
FluidStack received = container.drain(side, 100, false);
|
||||||
|
|
||||||
|
if(received != null && received.amount != 0)
|
||||||
|
{
|
||||||
|
container.drain(side, getTransmitterNetwork().emit(received, true, Object3D.get(tile()).getFromSide(side).getTileEntity(world())), true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
44
common/mekanism/common/multipart/PartPressurizedTube.java
Normal file
|
@ -0,0 +1,44 @@
|
||||||
|
package mekanism.common.multipart;
|
||||||
|
|
||||||
|
import java.util.Set;
|
||||||
|
|
||||||
|
import mekanism.api.gas.EnumGas;
|
||||||
|
import mekanism.api.gas.GasNetwork;
|
||||||
|
import mekanism.api.gas.IGasAcceptor;
|
||||||
|
import mekanism.api.transmitters.ITransmitter;
|
||||||
|
import mekanism.api.transmitters.TransmissionType;
|
||||||
|
import net.minecraft.tileentity.TileEntity;
|
||||||
|
import net.minecraftforge.common.ForgeDirection;
|
||||||
|
|
||||||
|
public class PartPressurizedTube extends PartTransmitter<GasNetwork, EnumGas>
|
||||||
|
{
|
||||||
|
@Override
|
||||||
|
public String getType()
|
||||||
|
{
|
||||||
|
return "mekanism:pressurized_tube";
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public TransmissionType getTransmissionType()
|
||||||
|
{
|
||||||
|
return TransmissionType.GAS;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isValidAcceptor(TileEntity tile, ForgeDirection side)
|
||||||
|
{
|
||||||
|
return tile instanceof IGasAcceptor;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public GasNetwork createNetworkFromSingleTransmitter(ITransmitter<GasNetwork, EnumGas> transmitter)
|
||||||
|
{
|
||||||
|
return new GasNetwork(transmitter);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public GasNetwork createNetworkByMergingSet(Set<GasNetwork> networks)
|
||||||
|
{
|
||||||
|
return new GasNetwork(networks);
|
||||||
|
}
|
||||||
|
}
|
465
common/mekanism/common/multipart/PartTransmitter.java
Normal file
|
@ -0,0 +1,465 @@
|
||||||
|
package mekanism.common.multipart;
|
||||||
|
|
||||||
|
import java.util.Collection;
|
||||||
|
import java.util.Collections;
|
||||||
|
import java.util.HashSet;
|
||||||
|
import java.util.Set;
|
||||||
|
|
||||||
|
import buildcraft.api.tools.IToolWrench;
|
||||||
|
import net.minecraft.client.particle.EffectRenderer;
|
||||||
|
import net.minecraft.entity.player.EntityPlayer;
|
||||||
|
import net.minecraft.item.ItemStack;
|
||||||
|
import net.minecraft.tileentity.TileEntity;
|
||||||
|
import net.minecraft.util.Icon;
|
||||||
|
import net.minecraft.util.MovingObjectPosition;
|
||||||
|
import net.minecraftforge.common.ForgeDirection;
|
||||||
|
import mekanism.api.Object3D;
|
||||||
|
import mekanism.api.transmitters.DynamicNetwork;
|
||||||
|
import mekanism.api.transmitters.ITransmitter;
|
||||||
|
import mekanism.api.transmitters.TransmissionType;
|
||||||
|
import mekanism.client.render.RenderPartTransmitter;
|
||||||
|
import mekanism.common.Mekanism;
|
||||||
|
import mekanism.common.item.ItemConfigurator;
|
||||||
|
import codechicken.lib.data.MCDataInput;
|
||||||
|
import codechicken.lib.data.MCDataOutput;
|
||||||
|
import codechicken.lib.lighting.LazyLightMatrix;
|
||||||
|
import codechicken.lib.raytracer.IndexedCuboid6;
|
||||||
|
import codechicken.lib.vec.Cuboid6;
|
||||||
|
import codechicken.lib.vec.Vector3;
|
||||||
|
import codechicken.microblock.IHollowConnect;
|
||||||
|
import codechicken.multipart.IconHitEffects;
|
||||||
|
import codechicken.multipart.JIconHitEffects;
|
||||||
|
import codechicken.multipart.JNormalOcclusion;
|
||||||
|
import codechicken.multipart.NormalOcclusionTest;
|
||||||
|
import codechicken.multipart.PartMap;
|
||||||
|
import codechicken.multipart.TMultiPart;
|
||||||
|
import codechicken.multipart.TSlottedPart;
|
||||||
|
import codechicken.multipart.TileMultipart;
|
||||||
|
import cpw.mods.fml.relauncher.Side;
|
||||||
|
import cpw.mods.fml.relauncher.SideOnly;
|
||||||
|
|
||||||
|
|
||||||
|
public abstract class PartTransmitter<N extends DynamicNetwork<?,N, D>, D> extends TMultiPart implements TSlottedPart, JNormalOcclusion, IHollowConnect, JIconHitEffects, ITransmitter<N, D>
|
||||||
|
{
|
||||||
|
public N theNetwork;
|
||||||
|
public D transmitting;
|
||||||
|
public static IndexedCuboid6[] sides = new IndexedCuboid6[7];
|
||||||
|
public ForgeDirection testingSide = null;
|
||||||
|
public byte currentAcceptorConnections = 0x00;
|
||||||
|
public byte currentTransmitterConnections = 0x00;
|
||||||
|
public boolean isActive = false;
|
||||||
|
|
||||||
|
static
|
||||||
|
{
|
||||||
|
sides[0] = new IndexedCuboid6(0, new Cuboid6(0.3, 0.0, 0.3, 0.7, 0.3, 0.7));
|
||||||
|
sides[1] = new IndexedCuboid6(1, new Cuboid6(0.3, 0.7, 0.3, 0.7, 1.0, 0.7));
|
||||||
|
sides[2] = new IndexedCuboid6(2, new Cuboid6(0.3, 0.3, 0.0, 0.7, 0.7, 0.3));
|
||||||
|
sides[3] = new IndexedCuboid6(3, new Cuboid6(0.3, 0.3, 0.7, 0.7, 0.7, 1.0));
|
||||||
|
sides[4] = new IndexedCuboid6(4, new Cuboid6(0.0, 0.3, 0.3, 0.3, 0.7, 0.7));
|
||||||
|
sides[5] = new IndexedCuboid6(5, new Cuboid6(0.7, 0.3, 0.3, 1.0, 0.7, 0.7));
|
||||||
|
sides[6] = new IndexedCuboid6(6, new Cuboid6(0.3, 0.3, 0.3, 0.7, 0.7, 0.7));
|
||||||
|
}
|
||||||
|
|
||||||
|
public static TMultiPart getPartType(TransmissionType type)
|
||||||
|
{
|
||||||
|
switch(type)
|
||||||
|
{
|
||||||
|
case ENERGY:
|
||||||
|
return new PartUniversalCable();
|
||||||
|
case FLUID:
|
||||||
|
return new PartMechanicalPipe();
|
||||||
|
case GAS:
|
||||||
|
return new PartPressurizedTube();
|
||||||
|
case ITEM:
|
||||||
|
return new PartLogisticalTransporter();
|
||||||
|
default:
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void bind(TileMultipart t)
|
||||||
|
{
|
||||||
|
if (tile() != null && theNetwork != null)
|
||||||
|
{
|
||||||
|
this.getTransmitterNetwork().transmitters.remove(tile());
|
||||||
|
super.bind(t);
|
||||||
|
this.getTransmitterNetwork().transmitters.add((ITransmitter<N, D>) tile());
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
super.bind(t);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static boolean connectionMapContainsSide(byte connections, ForgeDirection side)
|
||||||
|
{
|
||||||
|
byte tester = (byte) (1 << side.ordinal());
|
||||||
|
return ((connections & tester) > 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
public byte getPossibleTransmitterConnections()
|
||||||
|
{
|
||||||
|
byte connections = 0x00;
|
||||||
|
if(world().isBlockIndirectlyGettingPowered(x(), y(), z()))
|
||||||
|
return connections;
|
||||||
|
|
||||||
|
for(ForgeDirection side : ForgeDirection.VALID_DIRECTIONS)
|
||||||
|
{
|
||||||
|
if (canConnectMutual(side))
|
||||||
|
{
|
||||||
|
TileEntity tileEntity = Object3D.get(tile()).getFromSide(side).getTileEntity(world());
|
||||||
|
if(TransmissionType.checkTransmissionType(tileEntity, getTransmissionType()))
|
||||||
|
{
|
||||||
|
connections |= 1 << side.ordinal();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return connections;
|
||||||
|
}
|
||||||
|
|
||||||
|
public byte getPossibleAcceptorConnections()
|
||||||
|
{
|
||||||
|
byte connections = 0x00;
|
||||||
|
if(world().isBlockIndirectlyGettingPowered(x(), y(), z()))
|
||||||
|
return connections;
|
||||||
|
|
||||||
|
for(ForgeDirection side : ForgeDirection.VALID_DIRECTIONS)
|
||||||
|
{
|
||||||
|
if (canConnectMutual(side))
|
||||||
|
{
|
||||||
|
TileEntity tileEntity = Object3D.get(tile()).getFromSide(side).getTileEntity(world());
|
||||||
|
|
||||||
|
if(isValidAcceptor(tileEntity, side))
|
||||||
|
{
|
||||||
|
connections |= 1 << side.ordinal();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return connections;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void refreshTransmitterNetwork()
|
||||||
|
{
|
||||||
|
if(!world().isRemote)
|
||||||
|
{
|
||||||
|
byte possibleTransmitters = getPossibleTransmitterConnections();
|
||||||
|
byte possibleAcceptors = getPossibleAcceptorConnections();
|
||||||
|
|
||||||
|
if(possibleTransmitters != currentTransmitterConnections)
|
||||||
|
{
|
||||||
|
byte or = (byte)(possibleTransmitters | currentTransmitterConnections);
|
||||||
|
if(or != possibleTransmitters)
|
||||||
|
{
|
||||||
|
((DynamicNetwork<?,N, D>)getTransmitterNetwork()).split((ITransmitter<N, D>)tile());
|
||||||
|
setTransmitterNetwork(null);
|
||||||
|
}
|
||||||
|
|
||||||
|
for(ForgeDirection side : ForgeDirection.VALID_DIRECTIONS)
|
||||||
|
{
|
||||||
|
if(connectionMapContainsSide(possibleTransmitters, side))
|
||||||
|
{
|
||||||
|
TileEntity tileEntity = Object3D.get(tile()).getFromSide(side).getTileEntity(world());
|
||||||
|
|
||||||
|
if(TransmissionType.checkTransmissionType(tileEntity, getTransmissionType()))
|
||||||
|
((DynamicNetwork<?,N, D>)getTransmitterNetwork()).merge(((ITransmitter<N, D>)tileEntity).getTransmitterNetwork());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
currentTransmitterConnections = possibleTransmitters;
|
||||||
|
currentAcceptorConnections = possibleAcceptors;
|
||||||
|
|
||||||
|
((DynamicNetwork<?,N, D>)getTransmitterNetwork()).refresh();
|
||||||
|
|
||||||
|
sendDescUpdate();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public byte getAllCurrentConnections()
|
||||||
|
{
|
||||||
|
return (byte) (currentTransmitterConnections | currentAcceptorConnections);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean occlusionTest(TMultiPart other)
|
||||||
|
{
|
||||||
|
return NormalOcclusionTest.apply(this, other);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Iterable<IndexedCuboid6> getSubParts()
|
||||||
|
{
|
||||||
|
Set<IndexedCuboid6> subParts = new HashSet<IndexedCuboid6>();
|
||||||
|
if(tile() != null)
|
||||||
|
{
|
||||||
|
for(ForgeDirection side : ForgeDirection.VALID_DIRECTIONS)
|
||||||
|
{
|
||||||
|
int ord = side.ordinal();
|
||||||
|
byte connections = getAllCurrentConnections();
|
||||||
|
if(connectionMapContainsSide(connections, side) || side == this.testingSide) subParts.add(sides[ord]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
subParts.add(sides[6]);
|
||||||
|
return subParts;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Iterable<Cuboid6> getCollisionBoxes()
|
||||||
|
{
|
||||||
|
Set<Cuboid6> collisionBoxes = new HashSet<Cuboid6>();
|
||||||
|
collisionBoxes.addAll((Collection<? extends Cuboid6>) getSubParts());
|
||||||
|
return collisionBoxes;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Iterable<Cuboid6> getOcclusionBoxes()
|
||||||
|
{
|
||||||
|
return getCollisionBoxes();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int getSlotMask()
|
||||||
|
{
|
||||||
|
return PartMap.CENTER.mask;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Icon getBreakingIcon(Object subPart, int side)
|
||||||
|
{
|
||||||
|
return RenderPartTransmitter.getInstance().getIconForPart(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Icon getBrokenIcon(int side)
|
||||||
|
{
|
||||||
|
return RenderPartTransmitter.getInstance().getIconForPart(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Cuboid6 getBounds()
|
||||||
|
{
|
||||||
|
return sides[6];
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int getHollowSize()
|
||||||
|
{
|
||||||
|
return 7;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
@SideOnly(Side.CLIENT)
|
||||||
|
public void renderStatic(Vector3 pos, LazyLightMatrix olm, int pass)
|
||||||
|
{
|
||||||
|
RenderPartTransmitter.getInstance().renderStatic(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void addHitEffects(MovingObjectPosition hit, EffectRenderer effectRenderer)
|
||||||
|
{
|
||||||
|
IconHitEffects.addHitEffects(this, hit, effectRenderer);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void addDestroyEffects(EffectRenderer effectRenderer)
|
||||||
|
{
|
||||||
|
IconHitEffects.addDestroyEffects(this, effectRenderer, false);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setTransmitterNetwork(N network)
|
||||||
|
{
|
||||||
|
if(network != theNetwork)
|
||||||
|
{
|
||||||
|
removeFromTransmitterNetwork();
|
||||||
|
theNetwork = network;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean areTransmitterNetworksEqual(TileEntity tileEntity)
|
||||||
|
{
|
||||||
|
return tileEntity instanceof ITransmitter && getTransmissionType() == ((ITransmitter)tileEntity).getTransmissionType();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public N getTransmitterNetwork()
|
||||||
|
{
|
||||||
|
return getTransmitterNetwork(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public N getTransmitterNetwork(boolean createIfNull)
|
||||||
|
{
|
||||||
|
if(theNetwork == null && createIfNull)
|
||||||
|
{
|
||||||
|
byte possibleTransmitters = getPossibleTransmitterConnections();
|
||||||
|
HashSet<N> connectedNets = new HashSet<N>();
|
||||||
|
|
||||||
|
for(ForgeDirection side : ForgeDirection.VALID_DIRECTIONS)
|
||||||
|
{
|
||||||
|
if(connectionMapContainsSide(possibleTransmitters, side))
|
||||||
|
{
|
||||||
|
TileEntity cable = Object3D.get(tile()).getFromSide(side).getTileEntity(world());
|
||||||
|
if(TransmissionType.checkTransmissionType(cable, TransmissionType.ENERGY) && ((ITransmitter<N, D>)cable).getTransmitterNetwork(false) != null)
|
||||||
|
{
|
||||||
|
connectedNets.add(((ITransmitter<N, D>)cable).getTransmitterNetwork());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if(connectedNets.size() == 0 || world().isRemote)
|
||||||
|
{
|
||||||
|
theNetwork = createNetworkFromSingleTransmitter((ITransmitter<N, D>)tile());
|
||||||
|
}
|
||||||
|
else if(connectedNets.size() == 1)
|
||||||
|
{
|
||||||
|
theNetwork = connectedNets.iterator().next();
|
||||||
|
theNetwork.transmitters.add((ITransmitter<N, D>)tile());
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
theNetwork = createNetworkByMergingSet(connectedNets);
|
||||||
|
theNetwork.transmitters.add((ITransmitter<N, D>)tile());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return theNetwork;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void removeFromTransmitterNetwork()
|
||||||
|
{
|
||||||
|
if(theNetwork != null)
|
||||||
|
{
|
||||||
|
theNetwork.removeTransmitter((ITransmitter<N, D>) tile());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void fixTransmitterNetwork()
|
||||||
|
{
|
||||||
|
getTransmitterNetwork().fixMessedUpNetwork((ITransmitter<N, D>) tile());
|
||||||
|
}
|
||||||
|
|
||||||
|
public abstract boolean isValidAcceptor(TileEntity tile, ForgeDirection side);
|
||||||
|
|
||||||
|
public abstract N createNetworkFromSingleTransmitter(ITransmitter<N, D> transmitter);
|
||||||
|
|
||||||
|
public abstract N createNetworkByMergingSet(Set<N> networks);
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean canConnectMutual(ForgeDirection side)
|
||||||
|
{
|
||||||
|
if(!canConnect(side)) return false;
|
||||||
|
|
||||||
|
TileEntity tile = Object3D.get(tile()).getFromSide(side).getTileEntity(world());
|
||||||
|
return (!(tile instanceof ITransmitter) || ((ITransmitter<?, ?>)tile).canConnect(side.getOpposite()));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean canConnect(ForgeDirection side)
|
||||||
|
{
|
||||||
|
if(world().isBlockIndirectlyGettingPowered(x(), y(), z()))
|
||||||
|
return false;
|
||||||
|
testingSide = side;
|
||||||
|
boolean unblocked = tile().canReplacePart(this, this);
|
||||||
|
testingSide = null;
|
||||||
|
return unblocked;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void readDesc(MCDataInput packet)
|
||||||
|
{
|
||||||
|
currentTransmitterConnections = packet.readByte();
|
||||||
|
currentAcceptorConnections = packet.readByte();
|
||||||
|
isActive = packet.readBoolean();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void writeDesc(MCDataOutput packet)
|
||||||
|
{
|
||||||
|
packet.writeByte(currentTransmitterConnections);
|
||||||
|
packet.writeByte(currentAcceptorConnections);
|
||||||
|
packet.writeBoolean(isActive);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean activate(EntityPlayer player, MovingObjectPosition part, ItemStack item)
|
||||||
|
{
|
||||||
|
if(item.getItem() instanceof ItemConfigurator && player.isSneaking())
|
||||||
|
{
|
||||||
|
isActive ^= true;
|
||||||
|
tile().markRender();
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
if(item.getItem() instanceof IToolWrench && player.isSneaking())
|
||||||
|
{
|
||||||
|
if(!world().isRemote)
|
||||||
|
{
|
||||||
|
tile().dropItems(getDrops());
|
||||||
|
tile().remPart(this);
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Iterable<ItemStack> getDrops()
|
||||||
|
{
|
||||||
|
return Collections.singletonList(new ItemStack(Mekanism.PartTransmitter, 1, getTransmissionType().ordinal()));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void clientUpdate(D data)
|
||||||
|
{
|
||||||
|
transmitting = data;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void preRemove()
|
||||||
|
{
|
||||||
|
if (!this.world().isRemote && tile() instanceof ITransmitter)
|
||||||
|
{
|
||||||
|
this.getTransmitterNetwork().split((ITransmitter<N, D>)tile());
|
||||||
|
}
|
||||||
|
|
||||||
|
super.preRemove();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean doesTick()
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onAdded()
|
||||||
|
{
|
||||||
|
super.onAdded();
|
||||||
|
refreshTransmitterNetwork();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onChunkLoad()
|
||||||
|
{
|
||||||
|
super.onChunkLoad();
|
||||||
|
refreshTransmitterNetwork();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onNeighborChanged()
|
||||||
|
{
|
||||||
|
super.onNeighborChanged();
|
||||||
|
refreshTransmitterNetwork();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onPartChanged(TMultiPart part)
|
||||||
|
{
|
||||||
|
super.onPartChanged(part);
|
||||||
|
refreshTransmitterNetwork();
|
||||||
|
}
|
||||||
|
}
|
126
common/mekanism/common/multipart/PartUniversalCable.java
Normal file
|
@ -0,0 +1,126 @@
|
||||||
|
package mekanism.common.multipart;
|
||||||
|
|
||||||
|
import ic2.api.energy.tile.IEnergyAcceptor;
|
||||||
|
import ic2.api.energy.tile.IEnergySource;
|
||||||
|
|
||||||
|
import java.util.Set;
|
||||||
|
|
||||||
|
import codechicken.lib.vec.Vector3;
|
||||||
|
import cpw.mods.fml.relauncher.Side;
|
||||||
|
import cpw.mods.fml.relauncher.SideOnly;
|
||||||
|
import universalelectricity.core.block.IElectrical;
|
||||||
|
import buildcraft.api.power.IPowerEmitter;
|
||||||
|
import buildcraft.api.power.IPowerReceptor;
|
||||||
|
import net.minecraft.tileentity.TileEntity;
|
||||||
|
import net.minecraftforge.common.ForgeDirection;
|
||||||
|
import mekanism.api.energy.ICableOutputter;
|
||||||
|
import mekanism.api.energy.IStrictEnergyAcceptor;
|
||||||
|
import mekanism.api.transmitters.ITransmitter;
|
||||||
|
import mekanism.api.transmitters.TransmissionType;
|
||||||
|
import mekanism.client.render.RenderPartTransmitter;
|
||||||
|
import mekanism.common.EnergyNetwork;
|
||||||
|
import mekanism.common.Mekanism;
|
||||||
|
|
||||||
|
public class PartUniversalCable extends PartTransmitter<EnergyNetwork, Double>
|
||||||
|
{
|
||||||
|
public Double setLevel = 0.0;
|
||||||
|
private int ticks;
|
||||||
|
|
||||||
|
public PartUniversalCable()
|
||||||
|
{
|
||||||
|
super();
|
||||||
|
transmitting = 0.0;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getType()
|
||||||
|
{
|
||||||
|
return "mekanism:universal_cable";
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public TransmissionType getTransmissionType()
|
||||||
|
{
|
||||||
|
return TransmissionType.ENERGY;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public EnergyNetwork createNetworkFromSingleTransmitter(ITransmitter<EnergyNetwork, Double> transmitter)
|
||||||
|
{
|
||||||
|
return new EnergyNetwork(transmitter);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public EnergyNetwork createNetworkByMergingSet(Set<EnergyNetwork> networks)
|
||||||
|
{
|
||||||
|
return new EnergyNetwork(networks);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isValidAcceptor(TileEntity acceptor, ForgeDirection side)
|
||||||
|
{
|
||||||
|
if(acceptor instanceof ITransmitter)
|
||||||
|
return false;
|
||||||
|
|
||||||
|
//Mekanism
|
||||||
|
if(acceptor instanceof ICableOutputter && ((ICableOutputter)acceptor).canOutputTo(side.getOpposite()))
|
||||||
|
return true;
|
||||||
|
|
||||||
|
if(acceptor instanceof IStrictEnergyAcceptor && ((IStrictEnergyAcceptor)acceptor).canReceiveEnergy(side.getOpposite()))
|
||||||
|
return true;
|
||||||
|
|
||||||
|
//UE
|
||||||
|
if(acceptor instanceof IElectrical && ((IElectrical)acceptor).canConnect(side.getOpposite()))
|
||||||
|
return true;
|
||||||
|
|
||||||
|
//IC2
|
||||||
|
if(Mekanism.hooks.IC2Loaded)
|
||||||
|
{
|
||||||
|
if(acceptor instanceof IEnergySource && ((IEnergySource)acceptor).emitsEnergyTo(tile(), side.getOpposite()))
|
||||||
|
return true;
|
||||||
|
|
||||||
|
if(acceptor instanceof IEnergyAcceptor && ((IEnergyAcceptor)acceptor).acceptsEnergyFrom(tile(), side.getOpposite()))
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
//Buildcraft
|
||||||
|
if(Mekanism.hooks.BuildCraftLoaded)
|
||||||
|
{
|
||||||
|
if(acceptor instanceof IPowerReceptor && ((IPowerReceptor)acceptor).getPowerReceiver(side.getOpposite()) != null)
|
||||||
|
return true;
|
||||||
|
|
||||||
|
if(acceptor instanceof IPowerEmitter && ((IPowerEmitter)acceptor).canEmitPowerFrom(side.getOpposite()))
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
@SideOnly(Side.CLIENT)
|
||||||
|
public void renderDynamic(Vector3 pos, float frame, int pass)
|
||||||
|
{
|
||||||
|
if(pass == 1)
|
||||||
|
RenderPartTransmitter.getInstance().renderContents(this, pos);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void clientUpdate(Double level)
|
||||||
|
{
|
||||||
|
setLevel = level;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void update()
|
||||||
|
{
|
||||||
|
if(world().isRemote)
|
||||||
|
{
|
||||||
|
if(transmitting != setLevel)
|
||||||
|
{
|
||||||
|
transmitting = (transmitting *4.0 + setLevel)/5.0;
|
||||||
|
if(Math.max(transmitting - setLevel, setLevel - transmitting) < 0.05)
|
||||||
|
transmitting = setLevel;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -12,6 +12,7 @@ import mekanism.common.PacketHandler;
|
||||||
import mekanism.common.PacketHandler.Transmission;
|
import mekanism.common.PacketHandler.Transmission;
|
||||||
import mekanism.common.network.PacketDataRequest;
|
import mekanism.common.network.PacketDataRequest;
|
||||||
import mekanism.common.util.TransporterUtils;
|
import mekanism.common.util.TransporterUtils;
|
||||||
|
import net.minecraft.item.ItemStack;
|
||||||
import net.minecraft.nbt.NBTTagCompound;
|
import net.minecraft.nbt.NBTTagCompound;
|
||||||
import net.minecraft.tileentity.TileEntity;
|
import net.minecraft.tileentity.TileEntity;
|
||||||
import net.minecraft.util.AxisAlignedBB;
|
import net.minecraft.util.AxisAlignedBB;
|
||||||
|
@ -22,7 +23,7 @@ import com.google.common.io.ByteArrayDataInput;
|
||||||
import cpw.mods.fml.relauncher.Side;
|
import cpw.mods.fml.relauncher.Side;
|
||||||
import cpw.mods.fml.relauncher.SideOnly;
|
import cpw.mods.fml.relauncher.SideOnly;
|
||||||
|
|
||||||
public class TileEntityLogisticalTransporter extends TileEntityTransmitter<InventoryNetwork> implements ITileNetwork
|
public class TileEntityLogisticalTransporter extends TileEntityTransmitter<InventoryNetwork, ItemStack> implements ITileNetwork
|
||||||
{
|
{
|
||||||
/** This transporter's active state. */
|
/** This transporter's active state. */
|
||||||
public boolean isActive = false;
|
public boolean isActive = false;
|
||||||
|
@ -33,6 +34,12 @@ public class TileEntityLogisticalTransporter extends TileEntityTransmitter<Inven
|
||||||
return TransmissionType.ITEM;
|
return TransmissionType.ITEM;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void clientUpdate(ItemStack stack)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public InventoryNetwork getTransmitterNetwork(boolean createIfNull)
|
public InventoryNetwork getTransmitterNetwork(boolean createIfNull)
|
||||||
{
|
{
|
||||||
|
@ -44,9 +51,9 @@ public class TileEntityLogisticalTransporter extends TileEntityTransmitter<Inven
|
||||||
|
|
||||||
for(TileEntity transporter : adjacentTransporters)
|
for(TileEntity transporter : adjacentTransporters)
|
||||||
{
|
{
|
||||||
if(TransmissionType.checkTransmissionType(transporter, getTransmissionType()) && ((ITransmitter<InventoryNetwork>)transporter).getTransmitterNetwork(false) != null)
|
if(TransmissionType.checkTransmissionType(transporter, getTransmissionType()) && ((ITransmitter<InventoryNetwork, ItemStack>)transporter).getTransmitterNetwork(false) != null)
|
||||||
{
|
{
|
||||||
connectedNets.add(((ITransmitter<InventoryNetwork>)transporter).getTransmitterNetwork());
|
connectedNets.add(((ITransmitter<InventoryNetwork, ItemStack>)transporter).getTransmitterNetwork());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -105,7 +112,7 @@ public class TileEntityLogisticalTransporter extends TileEntityTransmitter<Inven
|
||||||
|
|
||||||
if(TransmissionType.checkTransmissionType(tileEntity, getTransmissionType()))
|
if(TransmissionType.checkTransmissionType(tileEntity, getTransmissionType()))
|
||||||
{
|
{
|
||||||
getTransmitterNetwork().merge(((ITransmitter<InventoryNetwork>)tileEntity).getTransmitterNetwork());
|
getTransmitterNetwork().merge(((ITransmitter<InventoryNetwork, ItemStack>)tileEntity).getTransmitterNetwork());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -165,28 +172,4 @@ public class TileEntityLogisticalTransporter extends TileEntityTransmitter<Inven
|
||||||
{
|
{
|
||||||
return INFINITE_EXTENT_AABB;
|
return INFINITE_EXTENT_AABB;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public int getTransmitterNetworkSize()
|
|
||||||
{
|
|
||||||
return getTransmitterNetwork().getSize();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public int getTransmitterNetworkAcceptorSize()
|
|
||||||
{
|
|
||||||
return getTransmitterNetwork().getAcceptorSize();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String getTransmitterNetworkNeeded()
|
|
||||||
{
|
|
||||||
return getTransmitterNetwork().getNeeded();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String getTransmitterNetworkFlow()
|
|
||||||
{
|
|
||||||
return getTransmitterNetwork().getFlow();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -29,7 +29,7 @@ import com.google.common.io.ByteArrayDataInput;
|
||||||
import cpw.mods.fml.relauncher.Side;
|
import cpw.mods.fml.relauncher.Side;
|
||||||
import cpw.mods.fml.relauncher.SideOnly;
|
import cpw.mods.fml.relauncher.SideOnly;
|
||||||
|
|
||||||
public class TileEntityMechanicalPipe extends TileEntityTransmitter<FluidNetwork> implements IFluidHandler, ITileNetwork
|
public class TileEntityMechanicalPipe extends TileEntityTransmitter<FluidNetwork, FluidStack> implements IFluidHandler, ITileNetwork
|
||||||
{
|
{
|
||||||
/** The fake tank used for fluid transfer calculations. */
|
/** The fake tank used for fluid transfer calculations. */
|
||||||
public FluidTank dummyTank = new FluidTank(FluidContainerRegistry.BUCKET_VOLUME);
|
public FluidTank dummyTank = new FluidTank(FluidContainerRegistry.BUCKET_VOLUME);
|
||||||
|
@ -43,7 +43,7 @@ public class TileEntityMechanicalPipe extends TileEntityTransmitter<FluidNetwork
|
||||||
/** The scale (0F -> 1F) of this pipe's fluid level. */
|
/** The scale (0F -> 1F) of this pipe's fluid level. */
|
||||||
public float fluidScale;
|
public float fluidScale;
|
||||||
|
|
||||||
public void onTransfer(FluidStack fluidStack)
|
public void clientUpdate(FluidStack fluidStack)
|
||||||
{
|
{
|
||||||
if(fluidStack.isFluidEqual(refFluid))
|
if(fluidStack.isFluidEqual(refFluid))
|
||||||
{
|
{
|
||||||
|
@ -72,9 +72,9 @@ public class TileEntityMechanicalPipe extends TileEntityTransmitter<FluidNetwork
|
||||||
|
|
||||||
for(TileEntity pipe : adjacentPipes)
|
for(TileEntity pipe : adjacentPipes)
|
||||||
{
|
{
|
||||||
if(TransmissionType.checkTransmissionType(pipe, getTransmissionType()) && ((ITransmitter<FluidNetwork>)pipe).getTransmitterNetwork(false) != null)
|
if(TransmissionType.checkTransmissionType(pipe, getTransmissionType()) && ((ITransmitter<FluidNetwork, FluidStack>)pipe).getTransmitterNetwork(false) != null)
|
||||||
{
|
{
|
||||||
connectedNets.add(((ITransmitter<FluidNetwork>)pipe).getTransmitterNetwork());
|
connectedNets.add(((ITransmitter<FluidNetwork, FluidStack>)pipe).getTransmitterNetwork());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -133,7 +133,7 @@ public class TileEntityMechanicalPipe extends TileEntityTransmitter<FluidNetwork
|
||||||
|
|
||||||
if(TransmissionType.checkTransmissionType(tileEntity, getTransmissionType()))
|
if(TransmissionType.checkTransmissionType(tileEntity, getTransmissionType()))
|
||||||
{
|
{
|
||||||
getTransmitterNetwork().merge(((ITransmitter<FluidNetwork>)tileEntity).getTransmitterNetwork());
|
getTransmitterNetwork().merge(((ITransmitter<FluidNetwork, FluidStack>)tileEntity).getTransmitterNetwork());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -270,28 +270,4 @@ public class TileEntityMechanicalPipe extends TileEntityTransmitter<FluidNetwork
|
||||||
{
|
{
|
||||||
return new FluidTankInfo[] {dummyTank.getInfo()};
|
return new FluidTankInfo[] {dummyTank.getInfo()};
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public int getTransmitterNetworkSize()
|
|
||||||
{
|
|
||||||
return getTransmitterNetwork().getSize();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public int getTransmitterNetworkAcceptorSize()
|
|
||||||
{
|
|
||||||
return getTransmitterNetwork().getAcceptorSize();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String getTransmitterNetworkNeeded()
|
|
||||||
{
|
|
||||||
return getTransmitterNetwork().getNeeded();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String getTransmitterNetworkFlow()
|
|
||||||
{
|
|
||||||
return getTransmitterNetwork().getFlow();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -13,7 +13,7 @@ import mekanism.api.transmitters.TransmissionType;
|
||||||
import net.minecraft.tileentity.TileEntity;
|
import net.minecraft.tileentity.TileEntity;
|
||||||
import net.minecraftforge.common.ForgeDirection;
|
import net.minecraftforge.common.ForgeDirection;
|
||||||
|
|
||||||
public class TileEntityPressurizedTube extends TileEntityTransmitter<GasNetwork> implements ITubeConnection, IGasTransmitter
|
public class TileEntityPressurizedTube extends TileEntityTransmitter<GasNetwork, EnumGas> implements ITubeConnection, IGasTransmitter
|
||||||
{
|
{
|
||||||
/** The gas currently displayed in this tube. */
|
/** The gas currently displayed in this tube. */
|
||||||
public EnumGas refGas = null;
|
public EnumGas refGas = null;
|
||||||
|
@ -37,9 +37,9 @@ public class TileEntityPressurizedTube extends TileEntityTransmitter<GasNetwork>
|
||||||
|
|
||||||
for(TileEntity tube : adjacentTubes)
|
for(TileEntity tube : adjacentTubes)
|
||||||
{
|
{
|
||||||
if(TransmissionType.checkTransmissionType(tube, TransmissionType.GAS, this) && ((ITransmitter<GasNetwork>)tube).getTransmitterNetwork(false) != null)
|
if(TransmissionType.checkTransmissionType(tube, TransmissionType.GAS, this) && ((ITransmitter<GasNetwork, EnumGas>)tube).getTransmitterNetwork(false) != null)
|
||||||
{
|
{
|
||||||
connectedNets.add(((ITransmitter<GasNetwork>)tube).getTransmitterNetwork());
|
connectedNets.add(((ITransmitter<GasNetwork, EnumGas>)tube).getTransmitterNetwork());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -98,7 +98,7 @@ public class TileEntityPressurizedTube extends TileEntityTransmitter<GasNetwork>
|
||||||
|
|
||||||
if(TransmissionType.checkTransmissionType(tileEntity, TransmissionType.GAS, this))
|
if(TransmissionType.checkTransmissionType(tileEntity, TransmissionType.GAS, this))
|
||||||
{
|
{
|
||||||
getTransmitterNetwork().merge(((ITransmitter<GasNetwork>)tileEntity).getTransmitterNetwork());
|
getTransmitterNetwork().merge(((ITransmitter<GasNetwork, EnumGas>)tileEntity).getTransmitterNetwork());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -106,7 +106,7 @@ public class TileEntityPressurizedTube extends TileEntityTransmitter<GasNetwork>
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void onTransfer(EnumGas type)
|
public void clientUpdate(EnumGas type)
|
||||||
{
|
{
|
||||||
if(type == refGas)
|
if(type == refGas)
|
||||||
{
|
{
|
||||||
|
@ -131,30 +131,6 @@ public class TileEntityPressurizedTube extends TileEntityTransmitter<GasNetwork>
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public int getTransmitterNetworkSize()
|
|
||||||
{
|
|
||||||
return getTransmitterNetwork().getSize();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public int getTransmitterNetworkAcceptorSize()
|
|
||||||
{
|
|
||||||
return getTransmitterNetwork().getAcceptorSize();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String getTransmitterNetworkNeeded()
|
|
||||||
{
|
|
||||||
return getTransmitterNetwork().getNeeded();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String getTransmitterNetworkFlow()
|
|
||||||
{
|
|
||||||
return getTransmitterNetwork().getFlow();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean canTransferGasToTube(TileEntity tile)
|
public boolean canTransferGasToTube(TileEntity tile)
|
||||||
{
|
{
|
||||||
|
|
|
@ -2,12 +2,15 @@ package mekanism.common.tileentity;
|
||||||
|
|
||||||
import cpw.mods.fml.relauncher.Side;
|
import cpw.mods.fml.relauncher.Side;
|
||||||
import cpw.mods.fml.relauncher.SideOnly;
|
import cpw.mods.fml.relauncher.SideOnly;
|
||||||
|
import mekanism.api.Object3D;
|
||||||
|
import mekanism.api.transmitters.DynamicNetwork;
|
||||||
import mekanism.api.transmitters.ITransmitter;
|
import mekanism.api.transmitters.ITransmitter;
|
||||||
import mekanism.api.transmitters.TransmitterNetworkRegistry;
|
import mekanism.api.transmitters.TransmitterNetworkRegistry;
|
||||||
import net.minecraft.tileentity.TileEntity;
|
import net.minecraft.tileentity.TileEntity;
|
||||||
import net.minecraft.util.AxisAlignedBB;
|
import net.minecraft.util.AxisAlignedBB;
|
||||||
|
import net.minecraftforge.common.ForgeDirection;
|
||||||
|
|
||||||
public abstract class TileEntityTransmitter<N> extends TileEntity implements ITransmitter<N>
|
public abstract class TileEntityTransmitter<N extends DynamicNetwork<?, N, D>, D> extends TileEntity implements ITransmitter<N, D>
|
||||||
{
|
{
|
||||||
public N theNetwork;
|
public N theNetwork;
|
||||||
|
|
||||||
|
@ -46,4 +49,19 @@ public abstract class TileEntityTransmitter<N> extends TileEntity implements ITr
|
||||||
{
|
{
|
||||||
return getTransmitterNetwork(true);
|
return getTransmitterNetwork(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean canConnectMutual(ForgeDirection side)
|
||||||
|
{
|
||||||
|
if(!canConnect(side)) return false;
|
||||||
|
|
||||||
|
TileEntity tile = Object3D.get(this).getFromSide(side).getTileEntity(worldObj);
|
||||||
|
return (!(tile instanceof ITransmitter) || ((ITransmitter<?, ?>)tile).canConnect(side.getOpposite()));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean canConnect(ForgeDirection side)
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -26,7 +26,7 @@ import buildcraft.api.power.IPowerReceptor;
|
||||||
import buildcraft.api.power.PowerHandler;
|
import buildcraft.api.power.PowerHandler;
|
||||||
import buildcraft.api.power.PowerHandler.PowerReceiver;
|
import buildcraft.api.power.PowerHandler.PowerReceiver;
|
||||||
|
|
||||||
public class TileEntityUniversalCable extends TileEntityTransmitter<EnergyNetwork> implements IPowerReceptor, IEnergyTile, IEnergySink, IConductor
|
public class TileEntityUniversalCable extends TileEntityTransmitter<EnergyNetwork, Double> implements IPowerReceptor, IEnergyTile, IEnergySink, IConductor
|
||||||
{
|
{
|
||||||
/** A fake power handler used to initiate energy transfer calculations. */
|
/** A fake power handler used to initiate energy transfer calculations. */
|
||||||
public PowerHandler powerHandler;
|
public PowerHandler powerHandler;
|
||||||
|
@ -65,9 +65,9 @@ public class TileEntityUniversalCable extends TileEntityTransmitter<EnergyNetwor
|
||||||
|
|
||||||
for(TileEntity cable : adjacentCables)
|
for(TileEntity cable : adjacentCables)
|
||||||
{
|
{
|
||||||
if(TransmissionType.checkTransmissionType(cable, TransmissionType.ENERGY) && ((ITransmitter<EnergyNetwork>)cable).getTransmitterNetwork(false) != null)
|
if(TransmissionType.checkTransmissionType(cable, TransmissionType.ENERGY) && ((ITransmitter<EnergyNetwork, Double>)cable).getTransmitterNetwork(false) != null)
|
||||||
{
|
{
|
||||||
connectedNets.add(((ITransmitter<EnergyNetwork>)cable).getTransmitterNetwork());
|
connectedNets.add(((ITransmitter<EnergyNetwork, Double>)cable).getTransmitterNetwork());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -131,7 +131,7 @@ public class TileEntityUniversalCable extends TileEntityTransmitter<EnergyNetwor
|
||||||
|
|
||||||
if(TransmissionType.checkTransmissionType(tileEntity, TransmissionType.ENERGY))
|
if(TransmissionType.checkTransmissionType(tileEntity, TransmissionType.ENERGY))
|
||||||
{
|
{
|
||||||
getTransmitterNetwork().merge(((ITransmitter<EnergyNetwork>)tileEntity).getTransmitterNetwork());
|
getTransmitterNetwork().merge(((ITransmitter<EnergyNetwork, Double>)tileEntity).getTransmitterNetwork());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -154,7 +154,7 @@ public class TileEntityUniversalCable extends TileEntityTransmitter<EnergyNetwor
|
||||||
@Override
|
@Override
|
||||||
public void doWork(PowerHandler workProvider) {}
|
public void doWork(PowerHandler workProvider) {}
|
||||||
|
|
||||||
public void setCachedEnergy(double scale)
|
public void clientUpdate(Double scale)
|
||||||
{
|
{
|
||||||
energyScale = scale;
|
energyScale = scale;
|
||||||
}
|
}
|
||||||
|
@ -190,30 +190,6 @@ public class TileEntityUniversalCable extends TileEntityTransmitter<EnergyNetwor
|
||||||
return 2048;
|
return 2048;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public int getTransmitterNetworkSize()
|
|
||||||
{
|
|
||||||
return getTransmitterNetwork().getSize();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public int getTransmitterNetworkAcceptorSize()
|
|
||||||
{
|
|
||||||
return getTransmitterNetwork().getAcceptorSize();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String getTransmitterNetworkNeeded()
|
|
||||||
{
|
|
||||||
return getTransmitterNetwork().getNeeded();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String getTransmitterNetworkFlow()
|
|
||||||
{
|
|
||||||
return getTransmitterNetwork().getFlow();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public IElectricityNetwork getNetwork()
|
public IElectricityNetwork getNetwork()
|
||||||
{
|
{
|
||||||
|
|
|
@ -197,7 +197,7 @@ public final class CableUtils
|
||||||
|
|
||||||
if(TransmissionType.checkTransmissionType(pointer, TransmissionType.ENERGY))
|
if(TransmissionType.checkTransmissionType(pointer, TransmissionType.ENERGY))
|
||||||
{
|
{
|
||||||
ITransmitter<EnergyNetwork> cable = (ITransmitter<EnergyNetwork>)pointer;
|
ITransmitter<EnergyNetwork, Double> cable = (ITransmitter<EnergyNetwork, Double>)pointer;
|
||||||
|
|
||||||
ArrayList<TileEntity> ignored = new ArrayList<TileEntity>();
|
ArrayList<TileEntity> ignored = new ArrayList<TileEntity>();
|
||||||
ignored.add(sender);
|
ignored.add(sender);
|
||||||
|
@ -230,7 +230,7 @@ public final class CableUtils
|
||||||
|
|
||||||
if(TransmissionType.checkTransmissionType(sideTile, TransmissionType.ENERGY) && !ignored.contains(sideTile))
|
if(TransmissionType.checkTransmissionType(sideTile, TransmissionType.ENERGY) && !ignored.contains(sideTile))
|
||||||
{
|
{
|
||||||
networks.add(((ITransmitter<EnergyNetwork>)sideTile).getTransmitterNetwork());
|
networks.add(((ITransmitter<EnergyNetwork, Double>)sideTile).getTransmitterNetwork());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
BIN
resources/assets/mekanism/models/transmitter.blend
Normal file
197
resources/assets/mekanism/models/transmitter.obj
Normal file
|
@ -0,0 +1,197 @@
|
||||||
|
# Blender v2.66 (sub 1) OBJ File: 'transmitter.blend'
|
||||||
|
# www.blender.org
|
||||||
|
mtllib transmitter.mtl
|
||||||
|
g downOut
|
||||||
|
v -0.187500 -0.187500 -0.187500
|
||||||
|
v -0.187500 -0.500000 -0.187500
|
||||||
|
v -0.187500 -0.500000 0.187500
|
||||||
|
v -0.187500 -0.187500 0.187500
|
||||||
|
v 0.187500 -0.187500 -0.187500
|
||||||
|
v 0.187500 -0.500000 -0.187500
|
||||||
|
v 0.187500 -0.500000 0.187500
|
||||||
|
v 0.187500 -0.187500 0.187500
|
||||||
|
vt 0.000000 0.916667
|
||||||
|
vt 0.000000 0.083333
|
||||||
|
vt 1.000000 0.083333
|
||||||
|
vt 1.000000 0.916667
|
||||||
|
vn 0.000000 0.000000 -1.000000
|
||||||
|
vn -0.000000 0.000000 1.000000
|
||||||
|
vn -1.000000 -0.000000 0.000000
|
||||||
|
vn 1.000000 0.000000 -0.000000
|
||||||
|
usemtl None
|
||||||
|
s off
|
||||||
|
f 5/1/1 6/2/1 2/3/1 1/4/1
|
||||||
|
f 7/3/2 8/4/2 4/1/2 3/2/2
|
||||||
|
f 1/1/3 2/2/3 3/3/3 4/4/3
|
||||||
|
f 8/1/4 7/2/4 6/3/4 5/4/4
|
||||||
|
g upOut
|
||||||
|
v 0.187500 0.187500 -0.187500
|
||||||
|
v 0.187500 0.500000 -0.187500
|
||||||
|
v 0.187500 0.500000 0.187500
|
||||||
|
v 0.187500 0.187500 0.187500
|
||||||
|
v -0.187500 0.187500 -0.187500
|
||||||
|
v -0.187500 0.500000 -0.187500
|
||||||
|
v -0.187500 0.500000 0.187500
|
||||||
|
v -0.187500 0.187500 0.187500
|
||||||
|
vt 1.000000 0.083333
|
||||||
|
vt 1.000000 0.916667
|
||||||
|
vt 0.000000 0.916667
|
||||||
|
vt 0.000000 0.083333
|
||||||
|
usemtl None
|
||||||
|
s off
|
||||||
|
f 13/5/1 14/6/1 10/7/1 9/8/1
|
||||||
|
f 15/7/2 16/8/2 12/5/2 11/6/2
|
||||||
|
f 9/5/4 10/6/4 11/7/4 12/8/4
|
||||||
|
f 16/5/3 15/6/3 14/7/3 13/8/3
|
||||||
|
g southOut
|
||||||
|
v 0.187500 -0.187500 0.187500
|
||||||
|
v 0.187500 -0.187500 0.500000
|
||||||
|
v -0.187500 -0.187500 0.500000
|
||||||
|
v -0.187500 -0.187500 0.187500
|
||||||
|
v 0.187500 0.187500 0.187500
|
||||||
|
v 0.187500 0.187500 0.500000
|
||||||
|
v -0.187500 0.187500 0.500000
|
||||||
|
v -0.187500 0.187500 0.187500
|
||||||
|
vt 1.000000 0.083333
|
||||||
|
vt 1.000000 0.916667
|
||||||
|
vt 0.000000 0.916667
|
||||||
|
vt 0.000000 0.083333
|
||||||
|
vn 1.000000 0.000000 -0.000001
|
||||||
|
vn -1.000000 0.000000 0.000001
|
||||||
|
vn 0.000000 -1.000000 0.000000
|
||||||
|
vn 0.000000 1.000000 0.000000
|
||||||
|
usemtl None
|
||||||
|
s off
|
||||||
|
f 21/9/5 22/10/5 18/11/5 17/12/5
|
||||||
|
f 23/11/6 24/12/6 20/9/6 19/10/6
|
||||||
|
f 17/9/7 18/10/7 19/11/7 20/12/7
|
||||||
|
f 24/9/8 23/10/8 22/11/8 21/12/8
|
||||||
|
g westOut
|
||||||
|
v -0.187500 -0.187500 0.187500
|
||||||
|
v -0.500000 -0.187500 0.187500
|
||||||
|
v -0.500000 -0.187500 -0.187500
|
||||||
|
v -0.187500 -0.187500 -0.187500
|
||||||
|
v -0.187500 0.187500 0.187500
|
||||||
|
v -0.500000 0.187500 0.187500
|
||||||
|
v -0.500000 0.187500 -0.187500
|
||||||
|
v -0.187500 0.187500 -0.187500
|
||||||
|
vt 0.000000 0.916667
|
||||||
|
vt 0.000000 0.083333
|
||||||
|
vt 1.000000 0.083333
|
||||||
|
vt 1.000000 0.916667
|
||||||
|
usemtl None
|
||||||
|
s off
|
||||||
|
f 29/13/2 30/14/2 26/15/2 25/16/2
|
||||||
|
f 31/15/1 32/16/1 28/13/1 27/14/1
|
||||||
|
f 25/13/7 26/14/7 27/15/7 28/16/7
|
||||||
|
f 32/13/8 31/14/8 30/15/8 29/16/8
|
||||||
|
g northOut
|
||||||
|
v -0.187500 -0.187500 -0.187500
|
||||||
|
v -0.187500 -0.187500 -0.500000
|
||||||
|
v 0.187500 -0.187500 -0.500000
|
||||||
|
v 0.187500 -0.187500 -0.187500
|
||||||
|
v -0.187500 0.187500 -0.187500
|
||||||
|
v -0.187500 0.187500 -0.500000
|
||||||
|
v 0.187500 0.187500 -0.500000
|
||||||
|
v 0.187500 0.187500 -0.187500
|
||||||
|
vt 0.000000 0.916667
|
||||||
|
vt 0.000000 0.083333
|
||||||
|
vt 1.000000 0.083333
|
||||||
|
vt 1.000000 0.916667
|
||||||
|
usemtl None
|
||||||
|
s off
|
||||||
|
f 37/17/3 38/18/3 34/19/3 33/20/3
|
||||||
|
f 39/19/4 40/20/4 36/17/4 35/18/4
|
||||||
|
f 33/17/7 34/18/7 35/19/7 36/20/7
|
||||||
|
f 40/17/8 39/18/8 38/19/8 37/20/8
|
||||||
|
g eastOut
|
||||||
|
v 0.187500 -0.187500 -0.187500
|
||||||
|
v 0.500000 -0.187500 -0.187500
|
||||||
|
v 0.500000 -0.187500 0.187500
|
||||||
|
v 0.187500 -0.187500 0.187500
|
||||||
|
v 0.187500 0.187500 -0.187500
|
||||||
|
v 0.500000 0.187500 -0.187500
|
||||||
|
v 0.500000 0.187500 0.187500
|
||||||
|
v 0.187500 0.187500 0.187500
|
||||||
|
vt 1.000000 0.083333
|
||||||
|
vt 1.000000 0.916667
|
||||||
|
vt 0.000000 0.916667
|
||||||
|
vt 0.000000 0.083333
|
||||||
|
usemtl None
|
||||||
|
s off
|
||||||
|
f 45/21/1 46/22/1 42/23/1 41/24/1
|
||||||
|
f 47/23/2 48/24/2 44/21/2 43/22/2
|
||||||
|
f 41/21/7 42/22/7 43/23/7 44/24/7
|
||||||
|
f 48/21/8 47/22/8 46/23/8 45/24/8
|
||||||
|
g southIn
|
||||||
|
v 0.187500 -0.187500 0.187500
|
||||||
|
v -0.187500 -0.187500 0.187500
|
||||||
|
v 0.187500 0.187500 0.187500
|
||||||
|
v -0.187500 0.187500 0.187500
|
||||||
|
vt 1.000000 0.000000
|
||||||
|
vt 1.000000 1.000000
|
||||||
|
vt 0.000000 1.000000
|
||||||
|
vt 0.000000 0.000000
|
||||||
|
usemtl Material
|
||||||
|
s off
|
||||||
|
f 49/25/2 51/26/2 52/27/2 50/28/2
|
||||||
|
g westIn
|
||||||
|
v -0.187500 -0.187500 0.187500
|
||||||
|
v -0.187500 -0.187500 -0.187500
|
||||||
|
v -0.187500 0.187500 0.187500
|
||||||
|
v -0.187500 0.187500 -0.187500
|
||||||
|
vt 1.000000 0.000000
|
||||||
|
vt 1.000000 1.000000
|
||||||
|
vt 0.000000 1.000000
|
||||||
|
vt 0.000000 0.000000
|
||||||
|
usemtl Material
|
||||||
|
s off
|
||||||
|
f 53/29/3 55/30/3 56/31/3 54/32/3
|
||||||
|
g northIn
|
||||||
|
v -0.187500 -0.187500 -0.187500
|
||||||
|
v 0.187500 -0.187500 -0.187500
|
||||||
|
v -0.187500 0.187500 -0.187500
|
||||||
|
v 0.187500 0.187500 -0.187500
|
||||||
|
vt 1.000000 0.000000
|
||||||
|
vt 1.000000 1.000000
|
||||||
|
vt 0.000000 1.000000
|
||||||
|
vt 0.000000 0.000000
|
||||||
|
usemtl Material
|
||||||
|
s off
|
||||||
|
f 57/33/1 59/34/1 60/35/1 58/36/1
|
||||||
|
g eastIn
|
||||||
|
v 0.187500 0.187500 -0.187500
|
||||||
|
v 0.187500 0.187500 0.187500
|
||||||
|
v 0.187500 -0.187500 -0.187500
|
||||||
|
v 0.187500 -0.187500 0.187500
|
||||||
|
vt 1.000000 0.000000
|
||||||
|
vt 1.000000 1.000000
|
||||||
|
vt 0.000000 1.000000
|
||||||
|
vt 0.000000 0.000000
|
||||||
|
usemtl Material
|
||||||
|
s off
|
||||||
|
f 63/37/4 61/38/4 62/39/4 64/40/4
|
||||||
|
g upIn
|
||||||
|
v 0.187500 0.187500 0.187500
|
||||||
|
v -0.187500 0.187500 0.187500
|
||||||
|
v -0.187500 0.187500 -0.187500
|
||||||
|
v 0.187500 0.187500 -0.187500
|
||||||
|
vt 1.000000 0.000000
|
||||||
|
vt 1.000000 1.000000
|
||||||
|
vt 0.000000 1.000000
|
||||||
|
vt 0.000000 0.000000
|
||||||
|
usemtl Material
|
||||||
|
s off
|
||||||
|
f 65/41/8 68/42/8 67/43/8 66/44/8
|
||||||
|
g downIn
|
||||||
|
v -0.187500 -0.187500 0.187500
|
||||||
|
v -0.187500 -0.187500 -0.187500
|
||||||
|
v 0.187500 -0.187500 -0.187500
|
||||||
|
v 0.187500 -0.187500 0.187500
|
||||||
|
vt 1.000000 0.000000
|
||||||
|
vt 1.000000 1.000000
|
||||||
|
vt 0.000000 1.000000
|
||||||
|
vt 0.000000 0.000000
|
||||||
|
usemtl Material
|
||||||
|
s off
|
||||||
|
f 69/45/7 70/46/7 71/47/7 72/48/7
|
BIN
resources/assets/mekanism/models/transmitterEnergy.blend
Normal file
197
resources/assets/mekanism/models/transmitterEnergy.obj
Normal file
|
@ -0,0 +1,197 @@
|
||||||
|
# Blender v2.66 (sub 1) OBJ File: 'transmitterEnergy.blend'
|
||||||
|
# www.blender.org
|
||||||
|
mtllib transmitterEnergy.mtl
|
||||||
|
g downOut
|
||||||
|
v -0.178125 -0.178125 -0.178125
|
||||||
|
v -0.178125 -0.500000 -0.178125
|
||||||
|
v -0.178125 -0.500000 0.178125
|
||||||
|
v -0.178125 -0.178125 0.178125
|
||||||
|
v 0.178125 -0.178125 -0.178125
|
||||||
|
v 0.178125 -0.500000 -0.178125
|
||||||
|
v 0.178125 -0.500000 0.178125
|
||||||
|
v 0.178125 -0.178125 0.178125
|
||||||
|
vt 0.000000 0.916667
|
||||||
|
vt 0.000000 0.083333
|
||||||
|
vt 1.000000 0.083333
|
||||||
|
vt 1.000000 0.916667
|
||||||
|
vn 0.000000 0.000000 -1.000000
|
||||||
|
vn -0.000000 0.000000 1.000000
|
||||||
|
vn -1.000000 -0.000000 0.000000
|
||||||
|
vn 1.000000 0.000000 -0.000000
|
||||||
|
usemtl None
|
||||||
|
s off
|
||||||
|
f 5/1/1 6/2/1 2/3/1 1/4/1
|
||||||
|
f 7/3/2 8/4/2 4/1/2 3/2/2
|
||||||
|
f 1/1/3 2/2/3 3/3/3 4/4/3
|
||||||
|
f 8/1/4 7/2/4 6/3/4 5/4/4
|
||||||
|
g upOut
|
||||||
|
v 0.178125 0.178125 -0.178125
|
||||||
|
v 0.178125 0.500000 -0.178125
|
||||||
|
v 0.178125 0.500000 0.178125
|
||||||
|
v 0.178125 0.178125 0.178125
|
||||||
|
v -0.178125 0.178125 -0.178125
|
||||||
|
v -0.178125 0.500000 -0.178125
|
||||||
|
v -0.178125 0.500000 0.178125
|
||||||
|
v -0.178125 0.178125 0.178125
|
||||||
|
vt 1.000000 0.083333
|
||||||
|
vt 1.000000 0.916667
|
||||||
|
vt 0.000000 0.916667
|
||||||
|
vt 0.000000 0.083333
|
||||||
|
usemtl None
|
||||||
|
s off
|
||||||
|
f 13/5/1 14/6/1 10/7/1 9/8/1
|
||||||
|
f 15/7/2 16/8/2 12/5/2 11/6/2
|
||||||
|
f 9/5/4 10/6/4 11/7/4 12/8/4
|
||||||
|
f 16/5/3 15/6/3 14/7/3 13/8/3
|
||||||
|
g southOut
|
||||||
|
v 0.178125 -0.178125 0.178125
|
||||||
|
v 0.178125 -0.178125 0.500000
|
||||||
|
v -0.178125 -0.178125 0.500000
|
||||||
|
v -0.178125 -0.178125 0.178125
|
||||||
|
v 0.178125 0.178125 0.178125
|
||||||
|
v 0.178125 0.178125 0.500000
|
||||||
|
v -0.178125 0.178125 0.500000
|
||||||
|
v -0.178125 0.178125 0.178125
|
||||||
|
vt 1.000000 0.083333
|
||||||
|
vt 1.000000 0.916667
|
||||||
|
vt 0.000000 0.916667
|
||||||
|
vt 0.000000 0.083333
|
||||||
|
vn 1.000000 0.000000 -0.000001
|
||||||
|
vn -1.000000 0.000000 0.000001
|
||||||
|
vn 0.000000 -1.000000 0.000000
|
||||||
|
vn 0.000000 1.000000 0.000000
|
||||||
|
usemtl None
|
||||||
|
s off
|
||||||
|
f 21/9/5 22/10/5 18/11/5 17/12/5
|
||||||
|
f 23/11/6 24/12/6 20/9/6 19/10/6
|
||||||
|
f 17/9/7 18/10/7 19/11/7 20/12/7
|
||||||
|
f 24/9/8 23/10/8 22/11/8 21/12/8
|
||||||
|
g westOut
|
||||||
|
v -0.178125 -0.178125 0.178125
|
||||||
|
v -0.500000 -0.178125 0.178125
|
||||||
|
v -0.500000 -0.178125 -0.178125
|
||||||
|
v -0.178125 -0.178125 -0.178125
|
||||||
|
v -0.178125 0.178125 0.178125
|
||||||
|
v -0.500000 0.178125 0.178125
|
||||||
|
v -0.500000 0.178125 -0.178125
|
||||||
|
v -0.178125 0.178125 -0.178125
|
||||||
|
vt 0.000000 0.916667
|
||||||
|
vt 0.000000 0.083333
|
||||||
|
vt 1.000000 0.083333
|
||||||
|
vt 1.000000 0.916667
|
||||||
|
usemtl None
|
||||||
|
s off
|
||||||
|
f 29/13/2 30/14/2 26/15/2 25/16/2
|
||||||
|
f 31/15/1 32/16/1 28/13/1 27/14/1
|
||||||
|
f 25/13/7 26/14/7 27/15/7 28/16/7
|
||||||
|
f 32/13/8 31/14/8 30/15/8 29/16/8
|
||||||
|
g northOut
|
||||||
|
v -0.178125 -0.178125 -0.178125
|
||||||
|
v -0.178125 -0.178125 -0.500000
|
||||||
|
v 0.178125 -0.178125 -0.500000
|
||||||
|
v 0.178125 -0.178125 -0.178125
|
||||||
|
v -0.178125 0.178125 -0.178125
|
||||||
|
v -0.178125 0.178125 -0.500000
|
||||||
|
v 0.178125 0.178125 -0.500000
|
||||||
|
v 0.178125 0.178125 -0.178125
|
||||||
|
vt 0.000000 0.916667
|
||||||
|
vt 0.000000 0.083333
|
||||||
|
vt 1.000000 0.083333
|
||||||
|
vt 1.000000 0.916667
|
||||||
|
usemtl None
|
||||||
|
s off
|
||||||
|
f 37/17/3 38/18/3 34/19/3 33/20/3
|
||||||
|
f 39/19/4 40/20/4 36/17/4 35/18/4
|
||||||
|
f 33/17/7 34/18/7 35/19/7 36/20/7
|
||||||
|
f 40/17/8 39/18/8 38/19/8 37/20/8
|
||||||
|
g eastOut
|
||||||
|
v 0.178125 -0.178125 -0.178125
|
||||||
|
v 0.500000 -0.178125 -0.178125
|
||||||
|
v 0.500000 -0.178125 0.178125
|
||||||
|
v 0.178125 -0.178125 0.178125
|
||||||
|
v 0.178125 0.178125 -0.178125
|
||||||
|
v 0.500000 0.178125 -0.178125
|
||||||
|
v 0.500000 0.178125 0.178125
|
||||||
|
v 0.178125 0.178125 0.178125
|
||||||
|
vt 1.000000 0.083333
|
||||||
|
vt 1.000000 0.916667
|
||||||
|
vt 0.000000 0.916667
|
||||||
|
vt 0.000000 0.083333
|
||||||
|
usemtl None
|
||||||
|
s off
|
||||||
|
f 45/21/1 46/22/1 42/23/1 41/24/1
|
||||||
|
f 47/23/2 48/24/2 44/21/2 43/22/2
|
||||||
|
f 41/21/7 42/22/7 43/23/7 44/24/7
|
||||||
|
f 48/21/8 47/22/8 46/23/8 45/24/8
|
||||||
|
g southIn
|
||||||
|
v 0.178125 -0.178125 0.178125
|
||||||
|
v -0.178125 -0.178125 0.178125
|
||||||
|
v 0.178125 0.178125 0.178125
|
||||||
|
v -0.178125 0.178125 0.178125
|
||||||
|
vt 1.000000 0.000000
|
||||||
|
vt 1.000000 1.000000
|
||||||
|
vt 0.000000 1.000000
|
||||||
|
vt 0.000000 0.000000
|
||||||
|
usemtl Material
|
||||||
|
s off
|
||||||
|
f 49/25/2 51/26/2 52/27/2 50/28/2
|
||||||
|
g westIn
|
||||||
|
v -0.178125 -0.178125 0.178125
|
||||||
|
v -0.178125 -0.178125 -0.178125
|
||||||
|
v -0.178125 0.178125 0.178125
|
||||||
|
v -0.178125 0.178125 -0.178125
|
||||||
|
vt 1.000000 0.000000
|
||||||
|
vt 1.000000 1.000000
|
||||||
|
vt 0.000000 1.000000
|
||||||
|
vt 0.000000 0.000000
|
||||||
|
usemtl Material
|
||||||
|
s off
|
||||||
|
f 53/29/3 55/30/3 56/31/3 54/32/3
|
||||||
|
g northIn
|
||||||
|
v -0.178125 -0.178125 -0.178125
|
||||||
|
v 0.178125 -0.178125 -0.178125
|
||||||
|
v -0.178125 0.178125 -0.178125
|
||||||
|
v 0.178125 0.178125 -0.178125
|
||||||
|
vt 1.000000 0.000000
|
||||||
|
vt 1.000000 1.000000
|
||||||
|
vt 0.000000 1.000000
|
||||||
|
vt 0.000000 0.000000
|
||||||
|
usemtl Material
|
||||||
|
s off
|
||||||
|
f 57/33/1 59/34/1 60/35/1 58/36/1
|
||||||
|
g eastIn
|
||||||
|
v 0.178125 0.178125 -0.178125
|
||||||
|
v 0.178125 0.178125 0.178125
|
||||||
|
v 0.178125 -0.178125 -0.178125
|
||||||
|
v 0.178125 -0.178125 0.178125
|
||||||
|
vt 1.000000 0.000000
|
||||||
|
vt 1.000000 1.000000
|
||||||
|
vt 0.000000 1.000000
|
||||||
|
vt 0.000000 0.000000
|
||||||
|
usemtl Material
|
||||||
|
s off
|
||||||
|
f 63/37/4 61/38/4 62/39/4 64/40/4
|
||||||
|
g upIn
|
||||||
|
v 0.178125 0.178125 0.178125
|
||||||
|
v -0.178125 0.178125 0.178125
|
||||||
|
v -0.178125 0.178125 -0.178125
|
||||||
|
v 0.178125 0.178125 -0.178125
|
||||||
|
vt 1.000000 0.000000
|
||||||
|
vt 1.000000 1.000000
|
||||||
|
vt 0.000000 1.000000
|
||||||
|
vt 0.000000 0.000000
|
||||||
|
usemtl Material
|
||||||
|
s off
|
||||||
|
f 65/41/8 68/42/8 67/43/8 66/44/8
|
||||||
|
g downIn
|
||||||
|
v -0.178125 -0.178125 0.178125
|
||||||
|
v -0.178125 -0.178125 -0.178125
|
||||||
|
v 0.178125 -0.178125 -0.178125
|
||||||
|
v 0.178125 -0.178125 0.178125
|
||||||
|
vt 1.000000 0.000000
|
||||||
|
vt 1.000000 1.000000
|
||||||
|
vt 0.000000 1.000000
|
||||||
|
vt 0.000000 0.000000
|
||||||
|
usemtl Material
|
||||||
|
s off
|
||||||
|
f 69/45/7 70/46/7 71/47/7 72/48/7
|
BIN
resources/assets/mekanism/textures/blocks/LiquidEnergy.png
Normal file
After Width: | Height: | Size: 17 KiB |
|
@ -0,0 +1,5 @@
|
||||||
|
{
|
||||||
|
"animation": {
|
||||||
|
"frametime": 2
|
||||||
|
}
|
||||||
|
}
|
BIN
resources/assets/mekanism/textures/blocks/LiquidEnergyStatic.png
Normal file
After Width: | Height: | Size: 3.2 KiB |
BIN
resources/assets/mekanism/textures/blocks/LiquidHydrogen.png
Normal file
After Width: | Height: | Size: 9.7 KiB |
32
resources/assets/mekanism/textures/blocks/LiquidHydrogen.txt
Normal file
|
@ -0,0 +1,32 @@
|
||||||
|
0*2
|
||||||
|
1*2
|
||||||
|
2*2
|
||||||
|
3*2
|
||||||
|
4*2
|
||||||
|
5*2
|
||||||
|
6*2
|
||||||
|
7*2
|
||||||
|
8*2
|
||||||
|
9*2
|
||||||
|
10*2
|
||||||
|
11*2
|
||||||
|
12*2
|
||||||
|
13*2
|
||||||
|
14*2
|
||||||
|
15*2
|
||||||
|
16*2
|
||||||
|
17*2
|
||||||
|
18*2
|
||||||
|
19*2
|
||||||
|
20*2
|
||||||
|
21*2
|
||||||
|
22*2
|
||||||
|
23*2
|
||||||
|
24*2
|
||||||
|
25*2
|
||||||
|
26*2
|
||||||
|
27*2
|
||||||
|
28*2
|
||||||
|
29*2
|
||||||
|
30*2
|
||||||
|
31*2
|
BIN
resources/assets/mekanism/textures/blocks/LiquidOxygen.png
Normal file
After Width: | Height: | Size: 14 KiB |
32
resources/assets/mekanism/textures/blocks/LiquidOxygen.txt
Normal file
|
@ -0,0 +1,32 @@
|
||||||
|
0*2
|
||||||
|
1*2
|
||||||
|
2*2
|
||||||
|
3*2
|
||||||
|
4*2
|
||||||
|
5*2
|
||||||
|
6*2
|
||||||
|
7*2
|
||||||
|
8*2
|
||||||
|
9*2
|
||||||
|
10*2
|
||||||
|
11*2
|
||||||
|
12*2
|
||||||
|
13*2
|
||||||
|
14*2
|
||||||
|
15*2
|
||||||
|
16*2
|
||||||
|
17*2
|
||||||
|
18*2
|
||||||
|
19*2
|
||||||
|
20*2
|
||||||
|
21*2
|
||||||
|
22*2
|
||||||
|
23*2
|
||||||
|
24*2
|
||||||
|
25*2
|
||||||
|
26*2
|
||||||
|
27*2
|
||||||
|
28*2
|
||||||
|
29*2
|
||||||
|
30*2
|
||||||
|
31*2
|
After Width: | Height: | Size: 1.7 KiB |
After Width: | Height: | Size: 1.7 KiB |
After Width: | Height: | Size: 1.8 KiB |
After Width: | Height: | Size: 1.8 KiB |
After Width: | Height: | Size: 1.9 KiB |
After Width: | Height: | Size: 1.5 KiB |
After Width: | Height: | Size: 1.9 KiB |