mirror of
https://github.com/HbmMods/Hbm-s-Nuclear-Tech-GIT.git
synced 2026-01-25 10:32:49 +00:00
alright i'm tired
This commit is contained in:
parent
23928d3d7b
commit
a78dae4a8e
@ -3,7 +3,7 @@ package api.hbm.energymk2;
|
|||||||
import com.hbm.packet.PacketDispatcher;
|
import com.hbm.packet.PacketDispatcher;
|
||||||
import com.hbm.packet.toclient.AuxParticlePacketNT;
|
import com.hbm.packet.toclient.AuxParticlePacketNT;
|
||||||
import com.hbm.uninos.IGenProvider;
|
import com.hbm.uninos.IGenProvider;
|
||||||
import com.hbm.uninos.networkproviders.PowerProvider;
|
import com.hbm.uninos.networkproviders.PowerNetProvider;
|
||||||
import com.hbm.util.Compat;
|
import com.hbm.util.Compat;
|
||||||
|
|
||||||
import api.hbm.energymk2.Nodespace.PowerNode;
|
import api.hbm.energymk2.Nodespace.PowerNode;
|
||||||
@ -14,7 +14,7 @@ import net.minecraft.world.World;
|
|||||||
import net.minecraftforge.common.util.ForgeDirection;
|
import net.minecraftforge.common.util.ForgeDirection;
|
||||||
|
|
||||||
/** If it sends energy, use this */
|
/** If it sends energy, use this */
|
||||||
public interface IEnergyProviderMK2 extends IEnergyHandlerMK2, IGenProvider<PowerProvider> {
|
public interface IEnergyProviderMK2 extends IEnergyHandlerMK2, IGenProvider<PowerNetProvider> {
|
||||||
|
|
||||||
/** Uses up available power, default implementation has no sanity checking, make sure that the requested power is lequal to the current power */
|
/** Uses up available power, default implementation has no sanity checking, make sure that the requested power is lequal to the current power */
|
||||||
public default void usePower(long power) {
|
public default void usePower(long power) {
|
||||||
|
|||||||
@ -4,7 +4,7 @@ import com.hbm.interfaces.NotableComments;
|
|||||||
import com.hbm.packet.PacketDispatcher;
|
import com.hbm.packet.PacketDispatcher;
|
||||||
import com.hbm.packet.toclient.AuxParticlePacketNT;
|
import com.hbm.packet.toclient.AuxParticlePacketNT;
|
||||||
import com.hbm.uninos.IGenReceiver;
|
import com.hbm.uninos.IGenReceiver;
|
||||||
import com.hbm.uninos.networkproviders.PowerProvider;
|
import com.hbm.uninos.networkproviders.PowerNetProvider;
|
||||||
import com.hbm.util.Compat;
|
import com.hbm.util.Compat;
|
||||||
|
|
||||||
import api.hbm.energymk2.Nodespace.PowerNode;
|
import api.hbm.energymk2.Nodespace.PowerNode;
|
||||||
@ -16,7 +16,7 @@ import net.minecraftforge.common.util.ForgeDirection;
|
|||||||
|
|
||||||
/** If it receives energy, use this */
|
/** If it receives energy, use this */
|
||||||
@NotableComments
|
@NotableComments
|
||||||
public interface IEnergyReceiverMK2 extends IEnergyHandlerMK2, IGenReceiver<PowerProvider> {
|
public interface IEnergyReceiverMK2 extends IEnergyHandlerMK2, IGenReceiver<PowerNetProvider> {
|
||||||
|
|
||||||
public default long transferPower(long power) {
|
public default long transferPower(long power) {
|
||||||
if(power + this.getPower() <= this.getMaxPower()) {
|
if(power + this.getPower() <= this.getMaxPower()) {
|
||||||
|
|||||||
@ -3,7 +3,7 @@ package api.hbm.energymk2;
|
|||||||
import com.hbm.interfaces.NotableComments;
|
import com.hbm.interfaces.NotableComments;
|
||||||
import com.hbm.uninos.GenNode;
|
import com.hbm.uninos.GenNode;
|
||||||
import com.hbm.uninos.UniNodespace;
|
import com.hbm.uninos.UniNodespace;
|
||||||
import com.hbm.uninos.networkproviders.PowerProvider;
|
import com.hbm.uninos.networkproviders.PowerNetProvider;
|
||||||
import com.hbm.util.fauxpointtwelve.BlockPos;
|
import com.hbm.util.fauxpointtwelve.BlockPos;
|
||||||
import com.hbm.util.fauxpointtwelve.DirPos;
|
import com.hbm.util.fauxpointtwelve.DirPos;
|
||||||
|
|
||||||
@ -18,7 +18,7 @@ import net.minecraft.world.World;
|
|||||||
*/
|
*/
|
||||||
public class Nodespace {
|
public class Nodespace {
|
||||||
|
|
||||||
public static final PowerProvider THE_POWER_PROVIDER = new PowerProvider();
|
public static final PowerNetProvider THE_POWER_PROVIDER = new PowerNetProvider();
|
||||||
|
|
||||||
@Deprecated public static PowerNode getNode(World world, int x, int y, int z) {
|
@Deprecated public static PowerNode getNode(World world, int x, int y, int z) {
|
||||||
return (PowerNode) UniNodespace.getNode(world, x, y, z, THE_POWER_PROVIDER);
|
return (PowerNode) UniNodespace.getNode(world, x, y, z, THE_POWER_PROVIDER);
|
||||||
|
|||||||
11
src/main/java/api/hbm/fluidmk2/FluidNetMK2.java
Normal file
11
src/main/java/api/hbm/fluidmk2/FluidNetMK2.java
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
package api.hbm.fluidmk2;
|
||||||
|
|
||||||
|
import com.hbm.uninos.NodeNet;
|
||||||
|
|
||||||
|
public class FluidNetMK2 extends NodeNet {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void update() {
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
19
src/main/java/api/hbm/fluidmk2/FluidNode.java
Normal file
19
src/main/java/api/hbm/fluidmk2/FluidNode.java
Normal file
@ -0,0 +1,19 @@
|
|||||||
|
package api.hbm.fluidmk2;
|
||||||
|
|
||||||
|
import com.hbm.uninos.GenNode;
|
||||||
|
import com.hbm.uninos.INetworkProvider;
|
||||||
|
import com.hbm.util.fauxpointtwelve.BlockPos;
|
||||||
|
import com.hbm.util.fauxpointtwelve.DirPos;
|
||||||
|
|
||||||
|
public class FluidNode extends GenNode<FluidNetMK2> {
|
||||||
|
|
||||||
|
public FluidNode(INetworkProvider<FluidNetMK2> provider, BlockPos... positions) {
|
||||||
|
super(provider, positions);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public FluidNode setConnections(DirPos... connections) {
|
||||||
|
super.setConnections(connections);
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
}
|
||||||
12
src/main/java/api/hbm/fluidmk2/IFluidConnectorBlockMK2.java
Normal file
12
src/main/java/api/hbm/fluidmk2/IFluidConnectorBlockMK2.java
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
package api.hbm.fluidmk2;
|
||||||
|
|
||||||
|
import com.hbm.inventory.fluid.FluidType;
|
||||||
|
|
||||||
|
import net.minecraft.world.IBlockAccess;
|
||||||
|
import net.minecraftforge.common.util.ForgeDirection;
|
||||||
|
|
||||||
|
public interface IFluidConnectorBlockMK2 {
|
||||||
|
|
||||||
|
/** dir is the face that is connected to, the direction going outwards from the block */
|
||||||
|
public boolean canConnect(FluidType type, IBlockAccess world, int x, int y, int z, ForgeDirection dir);
|
||||||
|
}
|
||||||
17
src/main/java/api/hbm/fluidmk2/IFluidConnectorMK2.java
Normal file
17
src/main/java/api/hbm/fluidmk2/IFluidConnectorMK2.java
Normal file
@ -0,0 +1,17 @@
|
|||||||
|
package api.hbm.fluidmk2;
|
||||||
|
|
||||||
|
import com.hbm.inventory.fluid.FluidType;
|
||||||
|
|
||||||
|
import net.minecraftforge.common.util.ForgeDirection;
|
||||||
|
|
||||||
|
public interface IFluidConnectorMK2 {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Whether the given side can be connected to
|
||||||
|
* @param dir
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public default boolean canConnect(FluidType type, ForgeDirection dir) {
|
||||||
|
return dir != ForgeDirection.UNKNOWN;
|
||||||
|
}
|
||||||
|
}
|
||||||
23
src/main/java/api/hbm/fluidmk2/IFluidPipeMK2.java
Normal file
23
src/main/java/api/hbm/fluidmk2/IFluidPipeMK2.java
Normal file
@ -0,0 +1,23 @@
|
|||||||
|
package api.hbm.fluidmk2;
|
||||||
|
|
||||||
|
import com.hbm.inventory.fluid.FluidType;
|
||||||
|
import com.hbm.lib.Library;
|
||||||
|
import com.hbm.util.fauxpointtwelve.BlockPos;
|
||||||
|
import com.hbm.util.fauxpointtwelve.DirPos;
|
||||||
|
|
||||||
|
import net.minecraft.tileentity.TileEntity;
|
||||||
|
|
||||||
|
public interface IFluidPipeMK2 {
|
||||||
|
|
||||||
|
public default FluidNode createNode(FluidType type) {
|
||||||
|
TileEntity tile = (TileEntity) this;
|
||||||
|
return new FluidNode(type.getNetworkProvider(), new BlockPos(tile.xCoord, tile.yCoord, tile.zCoord)).setConnections(
|
||||||
|
new DirPos(tile.xCoord + 1, tile.yCoord, tile.zCoord, Library.POS_X),
|
||||||
|
new DirPos(tile.xCoord - 1, tile.yCoord, tile.zCoord, Library.NEG_X),
|
||||||
|
new DirPos(tile.xCoord, tile.yCoord + 1, tile.zCoord, Library.POS_Y),
|
||||||
|
new DirPos(tile.xCoord, tile.yCoord - 1, tile.zCoord, Library.NEG_Y),
|
||||||
|
new DirPos(tile.xCoord, tile.yCoord, tile.zCoord + 1, Library.POS_Z),
|
||||||
|
new DirPos(tile.xCoord, tile.yCoord, tile.zCoord - 1, Library.NEG_Z)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
11
src/main/java/api/hbm/fluidmk2/IFluidProviderMK2.java
Normal file
11
src/main/java/api/hbm/fluidmk2/IFluidProviderMK2.java
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
package api.hbm.fluidmk2;
|
||||||
|
|
||||||
|
import com.hbm.inventory.fluid.FluidType;
|
||||||
|
import com.hbm.uninos.IGenProvider;
|
||||||
|
import com.hbm.uninos.networkproviders.FluidNetProvider;
|
||||||
|
|
||||||
|
public interface IFluidProviderMK2 extends IGenProvider<FluidNetProvider> {
|
||||||
|
|
||||||
|
public void useUpFluid(FluidType type, int pressure, long amount);
|
||||||
|
public long getProviderSpeed(FluidType type, int pressure);
|
||||||
|
}
|
||||||
12
src/main/java/api/hbm/fluidmk2/IFluidReceiverMK2.java
Normal file
12
src/main/java/api/hbm/fluidmk2/IFluidReceiverMK2.java
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
package api.hbm.fluidmk2;
|
||||||
|
|
||||||
|
import com.hbm.inventory.fluid.FluidType;
|
||||||
|
import com.hbm.uninos.IGenReceiver;
|
||||||
|
import com.hbm.uninos.networkproviders.FluidNetProvider;
|
||||||
|
|
||||||
|
public interface IFluidReceiverMK2 extends IGenReceiver<FluidNetProvider> {
|
||||||
|
|
||||||
|
/** Sends fluid of the desired type and pressure to the receiver, returns the remainder */
|
||||||
|
public long transferFluid(FluidType type, int pressure, long amount);
|
||||||
|
public long getReceiverSpeed(FluidType type, int pressure);
|
||||||
|
}
|
||||||
16
src/main/java/api/hbm/fluidmk2/package-info.java
Normal file
16
src/main/java/api/hbm/fluidmk2/package-info.java
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
/**
|
||||||
|
* @author hbm
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
package api.hbm.fluidmk2;
|
||||||
|
|
||||||
|
/*
|
||||||
|
|
||||||
|
It's rather shrimple: the shiny new energy system using universal nodespace, but hit with a hammer until it works with fluids.
|
||||||
|
Has a few extra bits and pieces for handling, but the concept is basically the same.
|
||||||
|
Sounds good?
|
||||||
|
|
||||||
|
*/
|
||||||
@ -13,8 +13,10 @@ import com.hbm.inventory.fluid.trait.*;
|
|||||||
import com.hbm.inventory.fluid.trait.FluidTraitSimple.*;
|
import com.hbm.inventory.fluid.trait.FluidTraitSimple.*;
|
||||||
import com.hbm.lib.RefStrings;
|
import com.hbm.lib.RefStrings;
|
||||||
import com.hbm.render.util.EnumSymbol;
|
import com.hbm.render.util.EnumSymbol;
|
||||||
|
import com.hbm.uninos.INetworkProvider;
|
||||||
import com.hbm.util.I18nUtil;
|
import com.hbm.util.I18nUtil;
|
||||||
|
|
||||||
|
import api.hbm.fluidmk2.FluidNetMK2;
|
||||||
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 net.minecraft.tileentity.TileEntity;
|
import net.minecraft.tileentity.TileEntity;
|
||||||
@ -252,4 +254,8 @@ public class FluidType {
|
|||||||
public String name() {
|
public String name() {
|
||||||
return this.stringId;
|
return this.stringId;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public INetworkProvider<FluidNetMK2> getNetworkProvider() {
|
||||||
|
return null; //TBI
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -10,6 +10,7 @@ public class GenNode<N extends NodeNet> {
|
|||||||
public N net;
|
public N net;
|
||||||
public boolean expired = false;
|
public boolean expired = false;
|
||||||
public boolean recentlyChanged = true;
|
public boolean recentlyChanged = true;
|
||||||
|
/** Used for distinguishing the node type when saving it to UNINOS' node map */
|
||||||
public INetworkProvider networkProvider;
|
public INetworkProvider networkProvider;
|
||||||
|
|
||||||
public GenNode(INetworkProvider<N> provider, BlockPos... positions) {
|
public GenNode(INetworkProvider<N> provider, BlockPos... positions) {
|
||||||
|
|||||||
@ -0,0 +1,13 @@
|
|||||||
|
package com.hbm.uninos.networkproviders;
|
||||||
|
|
||||||
|
import com.hbm.uninos.INetworkProvider;
|
||||||
|
|
||||||
|
import api.hbm.fluidmk2.FluidNetMK2;
|
||||||
|
|
||||||
|
public class FluidNetProvider implements INetworkProvider<FluidNetMK2> {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public FluidNetMK2 provideNetwork() {
|
||||||
|
return new FluidNetMK2();
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -4,7 +4,7 @@ import com.hbm.uninos.INetworkProvider;
|
|||||||
|
|
||||||
import api.hbm.energymk2.PowerNetMK2;
|
import api.hbm.energymk2.PowerNetMK2;
|
||||||
|
|
||||||
public class PowerProvider implements INetworkProvider<PowerNetMK2> {
|
public class PowerNetProvider implements INetworkProvider<PowerNetMK2> {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public PowerNetMK2 provideNetwork() {
|
public PowerNetMK2 provideNetwork() {
|
||||||
Loading…
x
Reference in New Issue
Block a user