Merge remote-tracking branch 'upstream/master' into Optimization

# Conflicts:
#	src/main/java/api/hbm/fluid/IFluidConnector.java
#	src/main/java/api/hbm/fluid/IFluidUser.java
#	src/main/java/com/hbm/tileentity/machine/TileEntityWatz.java
#	src/main/java/com/hbm/tileentity/machine/storage/TileEntityMachineFluidTank.java
This commit is contained in:
BallOfEnergy 2025-03-19 13:28:38 -05:00
commit 0a59fa86a0
222 changed files with 9130 additions and 134741 deletions

View File

@ -4,6 +4,11 @@
* Can toggle `DAMAGE_COMPATIBILITY_MODE`, off by default, enables a more compatible (but slightly jankier) version of the bullet damage code
* `MINE_<xxx>_DAMAGE` can be used to adjust landmine damage
* `TAINT_TRAILS` now replaces the hardcore taint config option, making taint blocks more potent and the potion effect trail taint blocks
* New ammo types
* Explosive 7.62mm
* Explosive .50 BMG
* Explosive 10 gauge buckshot (unlike 12 gauge which has explosive slugs)
* Lincoln's repeater, a b-side to the lever action rifle
## Changed
* Fat mines now use the standardized mini nuke code
@ -21,9 +26,18 @@
* `enableGuns` config option now applies to SEDNA system guns, simply canceling all gun-related keybinds
* Cinnabar dust, if registered by another mod, can now be acidized into cinnabar using hydrogen peroxide
* Copper wires, like AA and gold, can now be welded into dense wires
* Removed the crafting recipe for the small geothermal generator and ZPE generators
* Removed the gemothermal, ZPE and ambient radiation generators from the creative menu
* Disabled the horrid flicker on the quad rocket launcher's antenna, making steered mode look less terrible
## Fixed
* Fixed animation error on the MAS-36
* Fixed animation errors on the MAS-36
* Fixed drone docks, requester and provider crates not dropping their contents when broken
* Fixed all missing texture errors that appear in the startup log
* Potentially fixed a crash with mekanism during the recipe change phase
* Potentially fixed a crash with mekanism during the recipe change phase
* Removed the coke to heavy oil recipe for allowing infinite oil loops
* Coke to syngas and coalgas recipes should be fine though, so they stay
* Potentially fixed another issue regarding NPCs firing belt-fed guns
* Chunk-loading drones may or may not be fixed
* Fixed disperser canisters not actually despawning on impact, endlessly spawning mist clouds
* Fixed issues where the new packet system didn't play nice with machines that are being sent packets by other machines, like watz segments and radar screens

View File

@ -2,8 +2,6 @@ package api.hbm.energymk2;
import com.hbm.handler.threading.PacketThreading;
import com.hbm.packet.toclient.AuxParticlePacketNT;
import com.hbm.uninos.IGenProvider;
import com.hbm.uninos.networkproviders.PowerNetProvider;
import com.hbm.util.Compat;
import api.hbm.energymk2.Nodespace.PowerNode;
@ -14,7 +12,7 @@ import net.minecraft.world.World;
import net.minecraftforge.common.util.ForgeDirection;
/** If it sends energy, use this */
public interface IEnergyProviderMK2 extends IEnergyHandlerMK2, IGenProvider<PowerNetProvider> {
public interface IEnergyProviderMK2 extends IEnergyHandlerMK2 {
/** 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) {

View File

@ -3,8 +3,6 @@ package api.hbm.energymk2;
import com.hbm.handler.threading.PacketThreading;
import com.hbm.interfaces.NotableComments;
import com.hbm.packet.toclient.AuxParticlePacketNT;
import com.hbm.uninos.IGenReceiver;
import com.hbm.uninos.networkproviders.PowerNetProvider;
import com.hbm.util.Compat;
import api.hbm.energymk2.Nodespace.PowerNode;
@ -16,7 +14,7 @@ import net.minecraftforge.common.util.ForgeDirection;
/** If it receives energy, use this */
@NotableComments
public interface IEnergyReceiverMK2 extends IEnergyHandlerMK2, IGenReceiver<PowerNetProvider> {
public interface IEnergyReceiverMK2 extends IEnergyHandlerMK2 {
public default long transferPower(long power) {
if(power + this.getPower() <= this.getMaxPower()) {
@ -85,4 +83,8 @@ public interface IEnergyReceiverMK2 extends IEnergyHandlerMK2, IGenReceiver<Powe
HIGH,
HIGHEST
}
public default ConnectionPriority getPriority() {
return ConnectionPriority.NORMAL;
}
}

View File

@ -1,7 +1,6 @@
package api.hbm.energymk2;
import java.util.ArrayList;
import java.util.Comparator;
import java.util.Iterator;
import java.util.List;
@ -37,15 +36,19 @@ public class PowerNetMK2 extends NodeNet<IEnergyReceiverMK2, IEnergyProviderMK2,
List<Pair<IEnergyProviderMK2, Long>> providers = new ArrayList();
long powerAvailable = 0;
// sum up available power
Iterator<Entry<IEnergyProviderMK2, Long>> provIt = providerEntries.entrySet().iterator();
while(provIt.hasNext()) {
Entry<IEnergyProviderMK2, Long> entry = provIt.next();
if(timestamp - entry.getValue() > timeout) { provIt.remove(); continue; }
if(timestamp - entry.getValue() > timeout || isBadLink(entry.getKey())) { provIt.remove(); continue; }
long src = Math.min(entry.getKey().getPower(), entry.getKey().getProviderSpeed());
providers.add(new Pair(entry.getKey(), src));
powerAvailable += src;
if(src > 0) {
providers.add(new Pair(entry.getKey(), src));
powerAvailable += src;
}
}
// sum up total demand, categorized by priority
List<Pair<IEnergyReceiverMK2, Long>>[] receivers = new ArrayList[ConnectionPriority.values().length];
for(int i = 0; i < receivers.length; i++) receivers[i] = new ArrayList();
long[] demand = new long[ConnectionPriority.values().length];
@ -55,17 +58,20 @@ public class PowerNetMK2 extends NodeNet<IEnergyReceiverMK2, IEnergyProviderMK2,
while(recIt.hasNext()) {
Entry<IEnergyReceiverMK2, Long> entry = recIt.next();
if(timestamp - entry.getValue() > timeout) { recIt.remove(); continue; }
if(timestamp - entry.getValue() > timeout || isBadLink(entry.getKey())) { recIt.remove(); continue; }
long rec = Math.min(entry.getKey().getMaxPower() - entry.getKey().getPower(), entry.getKey().getReceiverSpeed());
int p = entry.getKey().getPriority().ordinal();
receivers[p].add(new Pair(entry.getKey(), rec));
demand[p] += rec;
totalDemand += rec;
if(rec > 0) {
int p = entry.getKey().getPriority().ordinal();
receivers[p].add(new Pair(entry.getKey(), rec));
demand[p] += rec;
totalDemand += rec;
}
}
long toTransfer = Math.min(powerAvailable, totalDemand);
long energyUsed = 0;
// add power to receivers, ordered by priority
for(int i = ConnectionPriority.values().length - 1; i >= 0; i--) {
List<Pair<IEnergyReceiverMK2, Long>> list = receivers[i];
long priorityDemand = demand[i];
@ -82,6 +88,7 @@ public class PowerNetMK2 extends NodeNet<IEnergyReceiverMK2, IEnergyProviderMK2,
this.energyTracker += energyUsed;
long leftover = energyUsed;
// remove power from providers
for(Pair<IEnergyProviderMK2, Long> entry : providers) {
double weight = (double) entry.getValue() / (double) powerAvailable;
long toUse = (long) Math.max(energyUsed * weight, 0D);
@ -89,7 +96,7 @@ public class PowerNetMK2 extends NodeNet<IEnergyReceiverMK2, IEnergyProviderMK2,
leftover -= toUse;
}
//rounding error compensation, detects surplus that hasn't been used and removes it from random providers
// rounding error compensation, detects surplus that hasn't been used and removes it from random providers
int iterationsLeft = 100; // whiles without emergency brakes are a bad idea
while(iterationsLeft > 0 && leftover > 0 && providers.size() > 0) {
iterationsLeft--;
@ -146,14 +153,4 @@ public class PowerNetMK2 extends NodeNet<IEnergyReceiverMK2, IEnergyProviderMK2,
return power - energyUsed;
}
public static final ReceiverComparator COMP = new ReceiverComparator();
public static class ReceiverComparator implements Comparator<IEnergyReceiverMK2> {
@Override
public int compare(IEnergyReceiverMK2 o1, IEnergyReceiverMK2 o2) {
return o2.getPriority().ordinal() - o1.getPriority().ordinal();
}
}
}

View File

@ -1,17 +0,0 @@
package api.hbm.fluid;
import com.hbm.uninos.NodeNet;
public class FluidNet extends NodeNet { // yeah i don't feel like it, gonna do that shit tomorrow or sth
public long tracker = 0L;
protected static int timeout = 3_000;
@Override public void resetTrackers() { this.tracker = 0; }
@Override
public void update() {
}
}

View File

@ -1,19 +0,0 @@
package api.hbm.fluid;
import com.hbm.inventory.fluid.FluidType;
public interface IFluidConductor extends IFluidConnector {
public IPipeNet getPipeNet(FluidType type);
public void setPipeNet(FluidType type, IPipeNet network);
@Override
public default long transferFluid(FluidType type, int pressure, long amount) {
if(this.getPipeNet(type) == null)
return amount;
return this.getPipeNet(type).transferFluid(amount, pressure);
}
}

View File

@ -1,93 +1,6 @@
package api.hbm.fluid;
import com.hbm.handler.threading.PacketThreading;
import com.hbm.inventory.fluid.FluidType;
import com.hbm.packet.toclient.AuxParticlePacketNT;
import com.hbm.util.Compat;
import api.hbm.fluidmk2.IFluidConnectorMK2;
import api.hbm.tile.ILoadedTile;
import cpw.mods.fml.common.network.NetworkRegistry.TargetPoint;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.world.World;
import net.minecraftforge.common.util.ForgeDirection;
public interface IFluidConnector extends ILoadedTile {
/**
* Returns the amount of fluid that remains
* @param power
* @return
*/
public long transferFluid(FluidType type, int pressure, long fluid);
/**
* Whether the given side can be connected to
* @param dir
* @return
*/
public default boolean canConnect(FluidType type, ForgeDirection dir) {
return dir != ForgeDirection.UNKNOWN;
}
/**
* Returns the amount of fluid that this machine is able to receive
* @param type
* @return
*/
public long getDemand(FluidType type, int pressure);
/**
* Basic implementation of subscribing to a nearby power grid
* @param world
* @param x
* @param y
* @param z
*/
public default void trySubscribe(FluidType type, World world, int x, int y, int z, ForgeDirection dir) {
TileEntity te = Compat.getTileStandard(world, x, y, z);
boolean red = false;
if(te instanceof IFluidConductor) {
IFluidConductor con = (IFluidConductor) te;
if(!con.canConnect(type, dir))
return;
if(con.getPipeNet(type) != null && !con.getPipeNet(type).isSubscribed(this))
con.getPipeNet(type).subscribe(this);
if(con.getPipeNet(type) != null)
red = true;
}
if(particleDebug) {
NBTTagCompound data = new NBTTagCompound();
data.setString("type", "network");
data.setString("mode", "fluid");
data.setInteger("color", type.getColor());
double posX = x + 0.5 + dir.offsetX * 0.5 + world.rand.nextDouble() * 0.5 - 0.25;
double posY = y + 0.5 + dir.offsetY * 0.5 + world.rand.nextDouble() * 0.5 - 0.25;
double posZ = z + 0.5 + dir.offsetZ * 0.5 + world.rand.nextDouble() * 0.5 - 0.25;
data.setDouble("mX", -dir.offsetX * (red ? 0.025 : 0.1));
data.setDouble("mY", -dir.offsetY * (red ? 0.025 : 0.1));
data.setDouble("mZ", -dir.offsetZ * (red ? 0.025 : 0.1));
PacketThreading.createAllAroundThreadedPacket(new AuxParticlePacketNT(data, posX, posY, posZ), new TargetPoint(world.provider.dimensionId, posX, posY, posZ, 25));
}
}
public default void tryUnsubscribe(FluidType type, World world, int x, int y, int z) {
TileEntity te = world.getTileEntity(x, y, z);
if(te instanceof IFluidConductor) {
IFluidConductor con = (IFluidConductor) te;
if(con.getPipeNet(type) != null && con.getPipeNet(type).isSubscribed(this))
con.getPipeNet(type).unsubscribe(this);
}
}
public static final boolean particleDebug = false;
}
@Deprecated
public interface IFluidConnector extends IFluidConnectorMK2 { }

View File

@ -1,12 +1,6 @@
package api.hbm.fluid;
import com.hbm.inventory.fluid.FluidType;
import api.hbm.fluidmk2.IFluidConnectorBlockMK2;
import net.minecraft.world.IBlockAccess;
import net.minecraftforge.common.util.ForgeDirection;
public interface IFluidConnectorBlock {
/** 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);
}
@Deprecated
public interface IFluidConnectorBlock extends IFluidConnectorBlockMK2 { }

View File

@ -1,49 +1,35 @@
package api.hbm.fluid;
import com.hbm.inventory.fluid.FluidType;
import com.hbm.inventory.fluid.tank.FluidTank;
import com.hbm.uninos.GenNode;
import com.hbm.uninos.UniNodespace;
/**
* Uses default implementation to make the underlying interfaces easier to use for the most common fluid users.
* Only handles a single input tank of the same type.
* Uses standard FluidTanks which use int32.
* Don't use this as part of the API!
* @author hbm
*
*/
public interface IFluidStandardReceiver extends IFluidUser {
import api.hbm.fluidmk2.IFluidStandardReceiverMK2;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.world.World;
import net.minecraftforge.common.util.ForgeDirection;
@Deprecated
public interface IFluidStandardReceiver extends IFluidStandardReceiverMK2 {
@Override
public default long transferFluid(FluidType type, int pressure, long amount) {
for(FluidTank tank : getReceivingTanks()) {
if(tank.getTankType() == type && tank.getPressure() == pressure) {
tank.setFill(tank.getFill() + (int) amount);
if(tank.getFill() > tank.getMaxFill()) {
long overshoot = tank.getFill() - tank.getMaxFill();
tank.setFill(tank.getMaxFill());
return overshoot;
}
return 0;
}
}
return amount;
public default void subscribeToAllAround(FluidType type, TileEntity tile) {
subscribeToAllAround(type, tile.getWorldObj(), tile.xCoord, tile.yCoord, tile.zCoord);
}
public FluidTank[] getReceivingTanks();
@Override
public default long getDemand(FluidType type, int pressure) {
for(FluidTank tank : getReceivingTanks()) {
if(tank.getTankType() == type && tank.getPressure() == pressure) {
return tank.getMaxFill() - tank.getFill();
}
public default void subscribeToAllAround(FluidType type, World world, int x, int y, int z) {
for(ForgeDirection dir : ForgeDirection.VALID_DIRECTIONS) {
trySubscribe(type, world, x, y, z, dir);
}
}
public default void tryUnsubscribe(FluidType type, World world, int x, int y, int z) {
GenNode node = UniNodespace.getNode(world, x, y, z, type.getNetworkProvider());
if(node != null && node.net != null) node.net.removeReceiver(this);
}
public default void unsubscribeToAllAround(FluidType type, TileEntity tile) {
for(ForgeDirection dir : ForgeDirection.VALID_DIRECTIONS) {
tryUnsubscribe(type, tile.getWorldObj(), tile.xCoord + dir.offsetX, tile.yCoord + dir.offsetY, tile.zCoord + dir.offsetZ);
}
return 0;
}
}

View File

@ -1,50 +1,22 @@
package api.hbm.fluid;
import com.hbm.inventory.fluid.FluidType;
import com.hbm.inventory.fluid.tank.FluidTank;
/**
* Uses default implementation to make the underlying interfaces easier to use for the most common fluid users.
* Only handles a single output tank of the same type.
* Uses standard FluidTanks which use int32.
* Don't use this as part of the API!
* @author hbm
*
*/
public interface IFluidStandardSender extends IFluidUser {
import api.hbm.fluidmk2.IFluidStandardSenderMK2;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.world.World;
import net.minecraftforge.common.util.ForgeDirection;
public FluidTank[] getSendingTanks();
@Override
public default long getTotalFluidForSend(FluidType type, int pressure) {
for(FluidTank tank : getSendingTanks()) {
if(tank.getTankType() == type && tank.getPressure() == pressure) {
return tank.getFill();
}
@Deprecated
public interface IFluidStandardSender extends IFluidStandardSenderMK2 {
public default void sendFluid(FluidTank tank, World world, int x, int y, int z, ForgeDirection dir) {
tryProvide(tank, world, x, y, z, dir);
}
public default void sendFluidToAll(FluidTank tank, TileEntity tile) {
for(ForgeDirection dir : ForgeDirection.VALID_DIRECTIONS) {
tryProvide(tank, tile.getWorldObj(), tile.xCoord + dir.offsetX, tile.yCoord + dir.offsetY, tile.zCoord + dir.offsetZ, dir);
}
return 0;
}
@Override
public default void removeFluidForTransfer(FluidType type, int pressure, long amount) {
for(FluidTank tank : getSendingTanks()) {
if(tank.getTankType() == type && tank.getPressure() == pressure) {
tank.setFill(tank.getFill() - (int) amount);
return;
}
}
}
@Override
public default long transferFluid(FluidType type, int pressure, long fluid) {
return fluid;
}
@Override
public default long getDemand(FluidType type, int pressure) {
return 0;
}
}

View File

@ -1,79 +1,4 @@
package api.hbm.fluid;
import com.hbm.inventory.fluid.FluidType;
import com.hbm.inventory.fluid.tank.FluidTank;
/**
* transceiver [trăn-vər], noun
*
* 1. A transmitter and receiver housed together in a single unit and having some circuits in common, often for portable or mobile use.
* 2. A combined radio transmitter and receiver.
* 3. A device that performs transmitting and receiving functions, especially if using common components.
*
* The American Heritage® Dictionary of the English Language, 5th Edition.
*
* Only supports one tank per type (for in- and output separately)
*
* @author hbm
*
*/
public interface IFluidStandardTransceiver extends IFluidUser {
public FluidTank[] getSendingTanks();
public FluidTank[] getReceivingTanks();
@Override
public default long getTotalFluidForSend(FluidType type, int pressure) {
for(FluidTank tank : getSendingTanks()) {
if(tank.getTankType() == type && tank.getPressure() == pressure) {
return tank.getFill();
}
}
return 0;
}
@Override
public default void removeFluidForTransfer(FluidType type, int pressure, long amount) {
for(FluidTank tank : getSendingTanks()) {
if(tank.getTankType() == type && tank.getPressure() == pressure) {
tank.setFill(tank.getFill() - (int) amount);
return;
}
}
}
@Override
public default long getDemand(FluidType type, int pressure) {
for(FluidTank tank : getReceivingTanks()) {
if(tank.getTankType() == type && tank.getPressure() == pressure) {
return tank.getMaxFill() - tank.getFill();
}
}
return 0;
}
@Override
public default long transferFluid(FluidType type, int pressure, long amount) {
for(FluidTank tank : getReceivingTanks()) {
if(tank.getTankType() == type && tank.getPressure() == pressure) {
tank.setFill(tank.getFill() + (int) amount);
if(tank.getFill() > tank.getMaxFill()) {
long overshoot = tank.getFill() - tank.getMaxFill();
tank.setFill(tank.getMaxFill());
return overshoot;
}
return 0;
}
}
return amount;
}
}
@Deprecated
public interface IFluidStandardTransceiver extends IFluidStandardReceiver, IFluidStandardSender { }

View File

@ -1,130 +0,0 @@
package api.hbm.fluid;
import com.hbm.handler.threading.PacketThreading;
import com.hbm.inventory.fluid.FluidType;
import com.hbm.inventory.fluid.tank.FluidTank;
import com.hbm.packet.toclient.AuxParticlePacketNT;
import com.hbm.util.Compat;
import cpw.mods.fml.common.network.NetworkRegistry.TargetPoint;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.world.World;
import net.minecraftforge.common.util.ForgeDirection;
public interface IFluidUser extends IFluidConnector {
public default void sendFluid(FluidTank tank, World world, int x, int y, int z, ForgeDirection dir) {
sendFluid(tank.getTankType(), tank.getPressure(), world, x, y, z, dir);
}
public default void sendFluid(FluidType type, int pressure, World world, int x, int y, int z, ForgeDirection dir) {
TileEntity te = world.getTileEntity(x, y, z);
boolean wasSubscribed = false;
boolean red = false;
if(te instanceof IFluidConductor) {
IFluidConductor con = (IFluidConductor) te;
if(con.getPipeNet(type) != null && con.getPipeNet(type).isSubscribed(this)) {
con.getPipeNet(type).unsubscribe(this);
wasSubscribed = true;
}
}
if(te instanceof IFluidConnector) {
IFluidConnector con = (IFluidConnector) te;
if(con.canConnect(type, dir.getOpposite())) {
long toSend = this.getTotalFluidForSend(type, pressure);
if(toSend > 0) {
long transfer = toSend - con.transferFluid(type, pressure, toSend);
this.removeFluidForTransfer(type, pressure, transfer);
}
red = true;
}
}
if(wasSubscribed && te instanceof IFluidConductor) {
IFluidConductor con = (IFluidConductor) te;
if(con.getPipeNet(type) != null && !con.getPipeNet(type).isSubscribed(this)) {
con.getPipeNet(type).subscribe(this);
}
}
if(particleDebug) {
NBTTagCompound data = new NBTTagCompound();
data.setString("type", "network");
data.setString("mode", "fluid");
data.setInteger("color", type.getColor());
double posX = x + 0.5 - dir.offsetX * 0.5 + world.rand.nextDouble() * 0.5 - 0.25;
double posY = y + 0.5 - dir.offsetY * 0.5 + world.rand.nextDouble() * 0.5 - 0.25;
double posZ = z + 0.5 - dir.offsetZ * 0.5 + world.rand.nextDouble() * 0.5 - 0.25;
data.setDouble("mX", dir.offsetX * (red ? 0.025 : 0.1));
data.setDouble("mY", dir.offsetY * (red ? 0.025 : 0.1));
data.setDouble("mZ", dir.offsetZ * (red ? 0.025 : 0.1));
PacketThreading.createAllAroundThreadedPacket(new AuxParticlePacketNT(data, posX, posY, posZ), new TargetPoint(world.provider.dimensionId, posX, posY, posZ, 25));
}
}
public static IPipeNet getPipeNet(World world, int x, int y, int z, FluidType type) {
TileEntity te = Compat.getTileStandard(world, x, y, z);
if(te instanceof IFluidConductor) {
IFluidConductor con = (IFluidConductor) te;
if(con.getPipeNet(type) != null) {
return con.getPipeNet(type);
}
}
return null;
}
/** Use more common conPos method instead */
@Deprecated public default void sendFluidToAll(FluidTank tank, TileEntity te) {
sendFluidToAll(tank.getTankType(), tank.getPressure(), te);
}
/** Use more common conPos method instead */
@Deprecated public default void sendFluidToAll(FluidType type, int pressure, TileEntity te) {
for(ForgeDirection dir : ForgeDirection.VALID_DIRECTIONS) {
sendFluid(type, pressure, te.getWorldObj(), te.xCoord + dir.offsetX, te.yCoord + dir.offsetY, te.zCoord + dir.offsetZ, dir);
}
}
public default long getTotalFluidForSend(FluidType type, int pressure) { return 0; }
public default void removeFluidForTransfer(FluidType type, int pressure, long amount) { }
public default void subscribeToAllAround(FluidType type, TileEntity te) {
subscribeToAllAround(type, te.getWorldObj(), te.xCoord, te.yCoord, te.zCoord);
}
public default void subscribeToAllAround(FluidType type, World world, int x, int y, int z) {
for(ForgeDirection dir : ForgeDirection.VALID_DIRECTIONS)
this.trySubscribe(type, world, x + dir.offsetX, y + dir.offsetY, z + dir.offsetZ, dir);
}
public default void unsubscribeToAllAround(FluidType type, TileEntity te) {
unsubscribeToAllAround(type, te.getWorldObj(), te.xCoord, te.yCoord, te.zCoord);
}
public default void unsubscribeToAllAround(FluidType type, World world, int x, int y, int z) {
for(ForgeDirection dir : ForgeDirection.VALID_DIRECTIONS)
this.tryUnsubscribe(type, world, x + dir.offsetX, y + dir.offsetY, z + dir.offsetZ);
}
/**
* Returns all internal tanks of this tile. Not used by the fluid network, it should only be used for display purposes or edge cases that can't be solved otherwise.
* The array is either composed of the original tank or outright the original tank array, so changes done to this array will extend to the IFluidUser.
* @return
*/
public FluidTank[] getAllTanks();
}

View File

@ -1,30 +0,0 @@
package api.hbm.fluid;
import java.math.BigInteger;
import java.util.HashSet;
import java.util.List;
import com.hbm.inventory.fluid.FluidType;
public interface IPipeNet {
public void joinNetworks(IPipeNet network);
public List<IFluidConductor> getLinks();
public HashSet<IFluidConnector> getSubscribers();
public IPipeNet joinLink(IFluidConductor conductor);
public void leaveLink(IFluidConductor conductor);
public void subscribe(IFluidConnector connector);
public void unsubscribe(IFluidConnector connector);
public boolean isSubscribed(IFluidConnector connector);
public void destroy();
public boolean isValid();
public long transferFluid(long fill, int pressure);
public FluidType getType();
public BigInteger getTotalTransfer();
}

View File

@ -1,205 +0,0 @@
package api.hbm.fluid;
import java.math.BigInteger;
import java.util.ArrayList;
import java.util.HashSet;
import java.util.List;
import com.hbm.inventory.fluid.FluidType;
import net.minecraft.tileentity.TileEntity;
public class PipeNet implements IPipeNet {
private boolean valid = true;
private FluidType type;
private List<IFluidConductor> links = new ArrayList();
private HashSet<IFluidConnector> subscribers = new HashSet();
public static List<PipeNet> trackingInstances = null;
protected BigInteger totalTransfer = BigInteger.ZERO;
public List<String> debug = new ArrayList();
public PipeNet(FluidType type) {
this.type = type;
}
@Override
public void joinNetworks(IPipeNet network) {
if(network == this)
return;
for(IFluidConductor conductor : network.getLinks()) {
conductor.setPipeNet(type, this);
this.getLinks().add(conductor);
}
network.getLinks().clear();
for(IFluidConnector connector : network.getSubscribers()) {
this.subscribe(connector);
}
network.destroy();
}
@Override
public List<IFluidConductor> getLinks() {
return links;
}
@Override
public HashSet<IFluidConnector> getSubscribers() {
return subscribers;
}
@Override
public IPipeNet joinLink(IFluidConductor conductor) {
if(conductor.getPipeNet(type) != null)
conductor.getPipeNet(type).leaveLink(conductor);
conductor.setPipeNet(type, this);
this.links.add(conductor);
return this;
}
@Override
public void leaveLink(IFluidConductor conductor) {
conductor.setPipeNet(type, null);
this.links.remove(conductor);
}
@Override
public void subscribe(IFluidConnector connector) {
this.subscribers.add(connector);
}
@Override
public void unsubscribe(IFluidConnector connector) {
this.subscribers.remove(connector);
}
@Override
public boolean isSubscribed(IFluidConnector connector) {
return this.subscribers.contains(connector);
}
@Override
public long transferFluid(long fill, int pressure) {
subscribers.removeIf(x ->
x == null || !(x instanceof TileEntity) || ((TileEntity)x).isInvalid() || !x.isLoaded()
);
if(this.subscribers.isEmpty())
return fill;
trackingInstances = new ArrayList();
trackingInstances.add(this);
List<IFluidConnector> subList = new ArrayList(subscribers);
return fairTransfer(subList, type, pressure, fill);
}
public static long fairTransfer(List<IFluidConnector> subList, FluidType type, int pressure, long fill) {
if(fill <= 0) return 0;
List<Long> weight = new ArrayList();
long totalReq = 0;
for(IFluidConnector con : subList) {
long req = con.getDemand(type, pressure);
weight.add(req);
totalReq += req;
}
if(totalReq == 0)
return fill;
long totalGiven = 0;
for(int i = 0; i < subList.size(); i++) {
IFluidConnector con = subList.get(i);
long req = weight.get(i);
double fraction = (double)req / (double)totalReq;
long given = (long) Math.floor(fraction * fill);
if(given > 0) {
totalGiven += (given - con.transferFluid(type, pressure, given));
if(con instanceof TileEntity) {
TileEntity tile = (TileEntity) con;
tile.getWorldObj().markTileEntityChunkModified(tile.xCoord, tile.yCoord, tile.zCoord, tile);
}
/* debug code
if(trackingInstances != null) {
for(int j = 0; j < trackingInstances.size(); j++) {
PipeNet net = trackingInstances.get(j);
SimpleDateFormat sdf = new SimpleDateFormat("HH:mm:ss:SSS");
sdf.setTimeZone(TimeZone.getTimeZone("UTC"));
log(net, sdf.format(new Date(System.currentTimeMillis())) + " Sending " + given + "mB to " + conToString(con));
}
}
*/
}
}
if(trackingInstances != null) {
for(int i = 0; i < trackingInstances.size(); i++) {
PipeNet net = trackingInstances.get(i);
net.totalTransfer = net.totalTransfer.add(BigInteger.valueOf(totalGiven));
}
}
return fill - totalGiven;
}
@Override
public FluidType getType() {
return type;
}
@Override
public void destroy() {
this.valid = false;
this.subscribers.clear();
for(IFluidConductor con : this.links)
con.setPipeNet(type, null);
this.links.clear();
}
@Override
public boolean isValid() {
return this.valid;
}
@Override
public BigInteger getTotalTransfer() {
return this.totalTransfer;
}
public static void log(PipeNet net, String msg) {
net.debug.add(msg);
while(net.debug.size() > 50) {
net.debug.remove(0);
}
}
public static String conToString(IFluidConnector con) {
if(con instanceof TileEntity) {
TileEntity tile = (TileEntity) con;
return tile.getClass().getSimpleName() + " @ " + tile.xCoord + "/" + tile.yCoord + "/" + tile.zCoord;
}
return "" + con;
}
}

View File

@ -1,11 +1,148 @@
package api.hbm.fluidmk2;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import java.util.Map.Entry;
import com.hbm.inventory.fluid.FluidType;
import com.hbm.uninos.NodeNet;
import com.hbm.util.Tuple.Pair;
public class FluidNetMK2 extends NodeNet {
import api.hbm.energymk2.IEnergyReceiverMK2.ConnectionPriority;
public class FluidNetMK2 extends NodeNet<IFluidReceiverMK2, IFluidProviderMK2, FluidNode> {
public long fluidTracker = 0L;
protected static int timeout = 3_000;
protected static long currentTime = 0;
protected FluidType type;
public FluidNetMK2(FluidType type) {
this.type = type;
for(int i = 0; i < IFluidUserMK2.HIGHEST_VALID_PRESSURE + 1; i++) providers[i] = new ArrayList();
for(int i = 0; i < IFluidUserMK2.HIGHEST_VALID_PRESSURE + 1; i++) for(int j = 0; j < ConnectionPriority.values().length; j++) receivers[i][j] = new ArrayList();
}
@Override public void resetTrackers() { this.fluidTracker = 0; }
@Override
public void update() {
if(providerEntries.isEmpty()) return;
if(receiverEntries.isEmpty()) return;
currentTime = System.currentTimeMillis();
setupFluidProviders();
setupFluidReceivers();
transferFluid();
cleanUp();
}
//this sucks ass, but it makes the code just a smidge more structured
public long[] fluidAvailable = new long[IFluidUserMK2.HIGHEST_VALID_PRESSURE + 1];
public List<Pair<IFluidProviderMK2, Long>>[] providers = new ArrayList[IFluidUserMK2.HIGHEST_VALID_PRESSURE + 1];
public long[][] fluidDemand = new long[IFluidUserMK2.HIGHEST_VALID_PRESSURE + 1][ConnectionPriority.values().length];
public List<Pair<IFluidReceiverMK2, Long>>[][] receivers = new ArrayList[IFluidUserMK2.HIGHEST_VALID_PRESSURE + 1][ConnectionPriority.values().length];
public long[] transfered = new long[IFluidUserMK2.HIGHEST_VALID_PRESSURE + 1];
public void setupFluidProviders() {
Iterator<Entry<IFluidProviderMK2, Long>> iterator = providerEntries.entrySet().iterator();
while(iterator.hasNext()) {
Entry<IFluidProviderMK2, Long> entry = iterator.next();
if(currentTime - entry.getValue() > timeout || isBadLink(entry.getKey())) { iterator.remove(); continue; }
IFluidProviderMK2 provider = entry.getKey();
int[] pressureRange = provider.getProvidingPressureRange(type);
for(int p = pressureRange[0]; p <= pressureRange[1]; p++) {
long available = Math.min(provider.getFluidAvailable(type, p), provider.getProviderSpeed(type, p));
providers[p].add(new Pair(provider, available));
fluidAvailable[p] += available;
}
}
}
public void setupFluidReceivers() {
Iterator<Entry<IFluidReceiverMK2, Long>> iterator = receiverEntries.entrySet().iterator();
while(iterator.hasNext()) {
Entry<IFluidReceiverMK2, Long> entry = iterator.next();
if(currentTime - entry.getValue() > timeout || isBadLink(entry.getKey())) { iterator.remove(); continue; }
IFluidReceiverMK2 receiver = entry.getKey();
int[] pressureRange = receiver.getReceivingPressureRange(type);
for(int p = pressureRange[0]; p <= pressureRange[1]; p++) {
long required = Math.min(receiver.getDemand(type, p), receiver.getReceiverSpeed(type, p));
int priority = receiver.getFluidPriority().ordinal();
receivers[p][priority].add(new Pair(receiver, required));
fluidDemand[p][priority] += required;
}
}
}
public void transferFluid() {
long[] received = new long[IFluidUserMK2.HIGHEST_VALID_PRESSURE + 1];
long[] notAccountedFor = new long[IFluidUserMK2.HIGHEST_VALID_PRESSURE + 1];
for(int p = 0; p <= IFluidUserMK2.HIGHEST_VALID_PRESSURE; p++) { // if the pressure range were ever to increase, we might have to rethink this
for(int i = ConnectionPriority.values().length - 1; i >= 0; i--) {
long toTransfer = Math.min(fluidDemand[p][i], fluidAvailable[p]);
if(toTransfer <= 0) continue;
long priorityDemand = fluidDemand[p][i];
for(Pair<IFluidReceiverMK2, Long> entry : receivers[p][i]) {
double weight = (double) entry.getValue() / (double) (priorityDemand);
long toSend = (long) Math.max(toTransfer * weight, 0D);
toSend -= entry.getKey().transferFluid(type, p, toSend);
received[p] += toSend;
fluidTracker += toSend;
}
}
notAccountedFor[p] = received[p];
}
for(int p = 0; p <= IFluidUserMK2.HIGHEST_VALID_PRESSURE; p++) {
for(Pair<IFluidProviderMK2, Long> entry : providers[p]) {
double weight = (double) entry.getValue() / (double) fluidAvailable[p];
long toUse = (long) Math.max(received[p] * weight, 0D);
entry.getKey().useUpFluid(type, p, toUse);
notAccountedFor[p] -= toUse;
}
}
for(int p = 0; p <= IFluidUserMK2.HIGHEST_VALID_PRESSURE; p++) {
int iterationsLeft = 100;
while(iterationsLeft > 0 && notAccountedFor[p] > 0 && providers[p].size() > 0) {
iterationsLeft--;
Pair<IFluidProviderMK2, Long> selected = providers[p].get(rand.nextInt(providers[p].size()));
IFluidProviderMK2 scapegoat = selected.getKey();
long toUse = Math.min(notAccountedFor[p], scapegoat.getFluidAvailable(type, p));
scapegoat.useUpFluid(type, p, toUse);
notAccountedFor[p] -= toUse;
}
}
}
public void cleanUp() {
for(int i = 0; i < IFluidUserMK2.HIGHEST_VALID_PRESSURE + 1; i++) {
fluidAvailable[i] = 0;
providers[i].clear();
transfered[i] = 0;
for(int j = 0; j < ConnectionPriority.values().length; j++) {
fluidDemand[i][j] = 0;
receivers[i][j].clear();
}
}
}
}

View File

@ -1,4 +1,4 @@
package api.hbm.fluid;
package api.hbm.fluidmk2;
import com.hbm.inventory.fluid.FluidType;

View File

@ -7,7 +7,11 @@ import com.hbm.util.fauxpointtwelve.DirPos;
import net.minecraft.tileentity.TileEntity;
public interface IFluidPipeMK2 {
/**
* IFluidConductorMK2 with added node creation method
* @author hbm
*/
public interface IFluidPipeMK2 extends IFluidConnectorMK2 {
public default FluidNode createNode(FluidType type) {
TileEntity tile = (TileEntity) this;

View File

@ -1,11 +1,12 @@
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 interface IFluidProviderMK2 extends IFluidUserMK2 {
public void useUpFluid(FluidType type, int pressure, long amount);
public long getProviderSpeed(FluidType type, int pressure);
public default long getProviderSpeed(FluidType type, int pressure) { return 1_000_000_000; }
public long getFluidAvailable(FluidType type, int pressure);
public default int[] getProvidingPressureRange(FluidType type) { return DEFAULT_PRESSURE_RANGE; }
}

View File

@ -1,12 +1,64 @@
package api.hbm.fluidmk2;
import com.hbm.inventory.fluid.FluidType;
import com.hbm.uninos.IGenReceiver;
import com.hbm.uninos.networkproviders.FluidNetProvider;
import com.hbm.packet.PacketDispatcher;
import com.hbm.packet.toclient.AuxParticlePacketNT;
import com.hbm.uninos.GenNode;
import com.hbm.uninos.UniNodespace;
import com.hbm.util.Compat;
import com.hbm.util.fauxpointtwelve.DirPos;
public interface IFluidReceiverMK2 extends IGenReceiver<FluidNetProvider> {
import api.hbm.energymk2.IEnergyReceiverMK2.ConnectionPriority;
import cpw.mods.fml.common.network.NetworkRegistry.TargetPoint;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.world.World;
import net.minecraftforge.common.util.ForgeDirection;
public interface IFluidReceiverMK2 extends IFluidUserMK2 {
/** 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);
public default long getReceiverSpeed(FluidType type, int pressure) { return 1_000_000_000; }
public long getDemand(FluidType type, int pressure);
public default int[] getReceivingPressureRange(FluidType type) { return DEFAULT_PRESSURE_RANGE; }
public default void trySubscribe(FluidType type, World world, DirPos pos) { trySubscribe(type, world, pos.getX(), pos.getY(), pos.getZ(), pos.getDir()); }
public default void trySubscribe(FluidType type, World world, int x, int y, int z, ForgeDirection dir) {
TileEntity te = Compat.getTileStandard(world, x, y, z);
boolean red = false;
if(te instanceof IFluidConnectorMK2) {
IFluidConnectorMK2 con = (IFluidConnectorMK2) te;
if(!con.canConnect(type, dir.getOpposite())) return;
GenNode node = UniNodespace.getNode(world, x, y, z, type.getNetworkProvider());
if(node != null && node.net != null) {
node.net.addReceiver(this);
red = true;
}
}
if(particleDebug) {
NBTTagCompound data = new NBTTagCompound();
data.setString("type", "network");
data.setString("mode", "fluid");
data.setInteger("color", type.getColor());
double posX = x + 0.5 + dir.offsetX * 0.5 + world.rand.nextDouble() * 0.5 - 0.25;
double posY = y + 0.5 + dir.offsetY * 0.5 + world.rand.nextDouble() * 0.5 - 0.25;
double posZ = z + 0.5 + dir.offsetZ * 0.5 + world.rand.nextDouble() * 0.5 - 0.25;
data.setDouble("mX", -dir.offsetX * (red ? 0.025 : 0.1));
data.setDouble("mY", -dir.offsetY * (red ? 0.025 : 0.1));
data.setDouble("mZ", -dir.offsetZ * (red ? 0.025 : 0.1));
PacketDispatcher.wrapper.sendToAllAround(new AuxParticlePacketNT(data, posX, posY, posZ), new TargetPoint(world.provider.dimensionId, posX, posY, posZ, 25));
}
}
public default ConnectionPriority getFluidPriority() {
return ConnectionPriority.NORMAL;
}
}

View File

@ -0,0 +1,68 @@
package api.hbm.fluidmk2;
import com.hbm.inventory.fluid.FluidType;
import com.hbm.inventory.fluid.tank.FluidTank;
/**
* IFluidReceiverMK2 with standard implementation for transfer and demand getter.
* @author hbm
*/
public interface IFluidStandardReceiverMK2 extends IFluidReceiverMK2 {
public FluidTank[] getReceivingTanks();
@Override
public default long getDemand(FluidType type, int pressure) {
long amount = 0;
for(FluidTank tank : getReceivingTanks()) {
if(tank.getTankType() == type && tank.getPressure() == pressure) amount += (tank.getMaxFill() - tank.getFill());
}
return amount;
}
@Override
public default long transferFluid(FluidType type, int pressure, long amount) {
int tanks = 0;
for(FluidTank tank : getReceivingTanks()) {
if(tank.getTankType() == type && tank.getPressure() == pressure) tanks++;
}
if(tanks > 1) {
int firstRound = (int) Math.floor((double) amount / (double) tanks);
for(FluidTank tank : getReceivingTanks()) {
if(tank.getTankType() == type && tank.getPressure() == pressure) {
int toAdd = Math.min(firstRound, tank.getMaxFill() - tank.getFill());
tank.setFill(tank.getFill() + toAdd);
amount -= toAdd;
}
}
}
if(amount > 0) for(FluidTank tank : getReceivingTanks()) {
if(tank.getTankType() == type && tank.getPressure() == pressure) {
int toAdd = (int) Math.min(amount, tank.getMaxFill() - tank.getFill());
tank.setFill(tank.getFill() + toAdd);
amount -= toAdd;
}
}
return amount;
}
@Override
public default int[] getReceivingPressureRange(FluidType type) {
int lowest = HIGHEST_VALID_PRESSURE;
int highest = 0;
for(FluidTank tank : getReceivingTanks()) {
if(tank.getTankType() == type) {
if(tank.getPressure() < lowest) lowest = tank.getPressure();
if(tank.getPressure() > highest) highest = tank.getPressure();
}
}
return lowest <= highest ? new int[] {lowest, highest} : DEFAULT_PRESSURE_RANGE;
}
@Override
public default long getReceiverSpeed(FluidType type, int pressure) {
return 1_000_000_000;
}
}

View File

@ -0,0 +1,130 @@
package api.hbm.fluidmk2;
import com.hbm.inventory.fluid.tank.FluidTank;
import com.hbm.inventory.fluid.FluidType;
import com.hbm.packet.PacketDispatcher;
import com.hbm.packet.toclient.AuxParticlePacketNT;
import com.hbm.uninos.GenNode;
import com.hbm.uninos.UniNodespace;
import com.hbm.util.Compat;
import com.hbm.util.fauxpointtwelve.DirPos;
import cpw.mods.fml.common.network.NetworkRegistry.TargetPoint;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.world.World;
import net.minecraftforge.common.util.ForgeDirection;
/**
* IFluidProviderMK2 with standard implementation for fluid provision and fluid removal.
* @author hbm
*/
public interface IFluidStandardSenderMK2 extends IFluidProviderMK2 {
public default void tryProvide(FluidTank tank, World world, DirPos pos) { tryProvide(tank.getTankType(), tank.getPressure(), world, pos.getX(), pos.getY(), pos.getZ(), pos.getDir()); }
public default void tryProvide(FluidType type, World world, DirPos pos) { tryProvide(type, 0, world, pos.getX(), pos.getY(), pos.getZ(), pos.getDir()); }
public default void tryProvide(FluidType type, int pressure, World world, DirPos pos) { tryProvide(type, pressure, world, pos.getX(), pos.getY(), pos.getZ(), pos.getDir()); }
public default void tryProvide(FluidTank tank, World world, int x, int y, int z, ForgeDirection dir) { tryProvide(tank.getTankType(), tank.getPressure(), world, x, y, z, dir); }
public default void tryProvide(FluidType type, World world, int x, int y, int z, ForgeDirection dir) { tryProvide(type, 0, world, x, y, z, dir); }
public default void tryProvide(FluidType type, int pressure, World world, int x, int y, int z, ForgeDirection dir) {
TileEntity te = Compat.getTileStandard(world, x, y, z);
boolean red = false;
if(te instanceof IFluidConnectorMK2) {
IFluidConnectorMK2 con = (IFluidConnectorMK2) te;
if(con.canConnect(type, dir.getOpposite())) {
GenNode<FluidNetMK2> node = UniNodespace.getNode(world, x, y, z, type.getNetworkProvider());
if(node != null && node.net != null) {
node.net.addProvider(this);
red = true;
}
}
}
if(te instanceof IFluidReceiverMK2 && te != this) {
IFluidReceiverMK2 rec = (IFluidReceiverMK2) te;
if(rec.canConnect(type, dir.getOpposite())) {
long provides = Math.min(this.getFluidAvailable(type, pressure), this.getProviderSpeed(type, pressure));
long receives = Math.min(rec.getDemand(type, pressure), rec.getReceiverSpeed(type, pressure));
long toTransfer = Math.min(provides, receives);
toTransfer -= rec.transferFluid(type, pressure, toTransfer);
this.useUpFluid(type, pressure, toTransfer);
}
}
if(particleDebug) {
NBTTagCompound data = new NBTTagCompound();
data.setString("type", "network");
data.setString("mode", "fluid");
data.setInteger("color", type.getColor());
double posX = x + 0.5 - dir.offsetX * 0.5 + world.rand.nextDouble() * 0.5 - 0.25;
double posY = y + 0.5 - dir.offsetY * 0.5 + world.rand.nextDouble() * 0.5 - 0.25;
double posZ = z + 0.5 - dir.offsetZ * 0.5 + world.rand.nextDouble() * 0.5 - 0.25;
data.setDouble("mX", dir.offsetX * (red ? 0.025 : 0.1));
data.setDouble("mY", dir.offsetY * (red ? 0.025 : 0.1));
data.setDouble("mZ", dir.offsetZ * (red ? 0.025 : 0.1));
PacketDispatcher.wrapper.sendToAllAround(new AuxParticlePacketNT(data, posX, posY, posZ), new TargetPoint(world.provider.dimensionId, posX, posY, posZ, 25));
}
}
public FluidTank[] getSendingTanks();
@Override
public default long getFluidAvailable(FluidType type, int pressure) {
long amount = 0;
for(FluidTank tank : getSendingTanks()) {
if(tank.getTankType() == type && tank.getPressure() == pressure) amount += tank.getFill();
}
return amount;
}
@Override
public default void useUpFluid(FluidType type, int pressure, long amount) {
int tanks = 0;
for(FluidTank tank : getSendingTanks()) {
if(tank.getTankType() == type && tank.getPressure() == pressure) tanks++;
}
if(tanks > 1) {
int firstRound = (int) Math.floor((double) amount / (double) tanks);
for(FluidTank tank : getSendingTanks()) {
if(tank.getTankType() == type && tank.getPressure() == pressure) {
int toRem = Math.min(firstRound, tank.getFill());
tank.setFill(tank.getFill() - toRem);
amount -= toRem;
}
}
}
if(amount > 0) for(FluidTank tank : getSendingTanks()) {
if(tank.getTankType() == type && tank.getPressure() == pressure) {
int toRem = (int) Math.min(amount, tank.getFill());
tank.setFill(tank.getFill() - toRem);
amount -= toRem;
}
}
}
@Override
public default int[] getProvidingPressureRange(FluidType type) {
int lowest = HIGHEST_VALID_PRESSURE;
int highest = 0;
for(FluidTank tank : getSendingTanks()) {
if(tank.getTankType() == type) {
if(tank.getPressure() < lowest) lowest = tank.getPressure();
if(tank.getPressure() > highest) highest = tank.getPressure();
}
}
return lowest <= highest ? new int[] {lowest, highest} : DEFAULT_PRESSURE_RANGE;
}
@Override
public default long getProviderSpeed(FluidType type, int pressure) {
return 1_000_000_000;
}
}

View File

@ -0,0 +1,5 @@
package api.hbm.fluidmk2;
public interface IFluidStandardTransceiverMK2 extends IFluidStandardReceiverMK2, IFluidStandardSenderMK2 {
}

View File

@ -0,0 +1,15 @@
package api.hbm.fluidmk2;
import com.hbm.inventory.fluid.tank.FluidTank;
import api.hbm.tile.ILoadedTile;
public interface IFluidUserMK2 extends IFluidConnectorMK2, ILoadedTile {
public static final int HIGHEST_VALID_PRESSURE = 5;
public static final int[] DEFAULT_PRESSURE_RANGE = new int[] {0, 0};
public static final boolean particleDebug = false;
public FluidTank[] getAllTanks();
}

View File

@ -1,5 +1,6 @@
package api.hbm.tile;
/** For anything that should be removed off networks when considered unloaded, only affects providers and receivers, not links. Must not necessarily be a tile. */
public interface ILoadedTile {
public boolean isLoaded();

View File

@ -47,8 +47,7 @@ import java.util.ArrayList;
public class ModBlocks {
public static void mainRegistry()
{
public static void mainRegistry() {
initializeBlock();
registerBlock();
}
@ -464,6 +463,7 @@ public class ModBlocks {
public static Block glass_polonium;
public static Block glass_ash;
public static Block glass_quartz;
public static Block glass_polarized;
public static Block mush;
public static Block mush_block;
@ -1042,6 +1042,7 @@ public class ModBlocks {
public static Block machine_keyforge;
public static Block machine_armor_table;
public static Block machine_weapon_table;
public static Block reactor_research;
public static Block reactor_zirnox;
@ -1648,6 +1649,7 @@ public class ModBlocks {
glass_polonium = new BlockNTMGlassCT(1, RefStrings.MODID + ":glass_polonium", Material.glass).setBlockName("glass_polonium").setLightLevel(5F/15F).setStepSound(Block.soundTypeGlass).setCreativeTab(MainRegistry.machineTab).setHardness(0.3F);
glass_ash = new BlockNTMGlassCT(1, RefStrings.MODID + ":glass_ash", Material.glass).setBlockName("glass_ash").setStepSound(Block.soundTypeGlass).setCreativeTab(MainRegistry.machineTab).setHardness(3F);
glass_quartz = new BlockNTMGlassCT(0, RefStrings.MODID + ":glass_quartz", Material.packedIce, true).setBlockName("glass_quartz").setCreativeTab(MainRegistry.blockTab).setStepSound(Block.soundTypeGlass).setHardness(1.0F).setResistance(40.0F).setBlockTextureName(RefStrings.MODID + "glass_quartz");
glass_polarized = new BlockNTMGlassCT(0, RefStrings.MODID + ":glass_polarized", Material.glass).setBlockName("glass_polarized").setStepSound(Block.soundTypeGlass).setCreativeTab(MainRegistry.machineTab).setHardness(0.3F);
mush = new BlockMush(Material.plants).setBlockName("mush").setCreativeTab(MainRegistry.blockTab).setLightLevel(0.5F).setStepSound(Block.soundTypeGrass).setBlockTextureName(RefStrings.MODID + ":mush");
mush_block = new BlockMushHuge(Material.plants).setBlockName("mush_block").setLightLevel(1.0F).setStepSound(Block.soundTypeGrass).setHardness(0.2F).setBlockTextureName(RefStrings.MODID + ":mush_block_skin");
@ -1875,8 +1877,8 @@ public class ModBlocks {
field_disturber = new MachineFieldDisturber().setBlockName("field_disturber").setHardness(5.0F).setResistance(200.0F).setCreativeTab(null).setBlockTextureName(RefStrings.MODID + ":field_disturber");
machine_rtg_grey = new MachineRTG(Material.iron).setBlockName("machine_rtg_grey").setHardness(5.0F).setResistance(10.0F).setCreativeTab(MainRegistry.machineTab).setBlockTextureName(RefStrings.MODID + ":rtg");
machine_amgen = new MachineAmgen(Material.iron).setBlockName("machine_amgen").setHardness(5.0F).setResistance(10.0F).setCreativeTab(MainRegistry.machineTab);
machine_geo = new MachineAmgen(Material.iron).setBlockName("machine_geo").setHardness(5.0F).setResistance(10.0F).setCreativeTab(MainRegistry.machineTab);
machine_amgen = new MachineAmgen(Material.iron).setBlockName("machine_amgen").setHardness(5.0F).setResistance(10.0F);
machine_geo = new MachineAmgen(Material.iron).setBlockName("machine_geo").setHardness(5.0F).setResistance(10.0F);
machine_minirtg = new MachineMiniRTG(Material.iron).setBlockName("machine_minirtg").setHardness(5.0F).setResistance(10.0F).setCreativeTab(MainRegistry.machineTab).setBlockTextureName(RefStrings.MODID + ":rtg_cell");
machine_powerrtg = new MachineMiniRTG(Material.iron).setBlockName("machine_powerrtg").setHardness(5.0F).setResistance(10.0F).setCreativeTab(MainRegistry.machineTab).setBlockTextureName(RefStrings.MODID + ":rtg_polonium");
machine_radiolysis = new MachineRadiolysis(Material.iron).setBlockName("machine_radiolysis").setHardness(10.0F).setResistance(10.0F).setCreativeTab(MainRegistry.machineTab).setBlockTextureName(RefStrings.MODID + ":block_steel_machine");
@ -1915,7 +1917,6 @@ public class ModBlocks {
conveyor = new BlockConveyor().setBlockName("conveyor").setHardness(2.0F).setResistance(2.0F).setCreativeTab(MainRegistry.machineTab).setBlockTextureName(RefStrings.MODID + ":conveyor");
conveyor_express = new BlockConveyorExpress().setBlockName("conveyor_express").setHardness(2.0F).setResistance(2.0F).setCreativeTab(MainRegistry.machineTab).setBlockTextureName(RefStrings.MODID + ":conveyor_express");
//conveyor_classic = new BlockConveyorClassic().setBlockName("conveyor_classic").setHardness(2.0F).setResistance(2.0F).setCreativeTab(MainRegistry.machineTab).setBlockTextureName(RefStrings.MODID + ":conveyor");
conveyor_double = new BlockConveyorDouble().setBlockName("conveyor_double").setHardness(2.0F).setResistance(2.0F).setCreativeTab(MainRegistry.machineTab).setBlockTextureName(RefStrings.MODID + ":conveyor_double");
conveyor_triple = new BlockConveyorTriple().setBlockName("conveyor_triple").setHardness(2.0F).setResistance(2.0F).setCreativeTab(MainRegistry.machineTab).setBlockTextureName(RefStrings.MODID + ":conveyor_triple");
conveyor_chute = new BlockConveyorChute().setBlockName("conveyor_chute").setHardness(2.0F).setResistance(2.0F).setCreativeTab(MainRegistry.machineTab).setBlockTextureName(RefStrings.MODID + ":conveyor");
@ -1966,6 +1967,7 @@ public class ModBlocks {
machine_satlinker = new MachineSatLinker(Material.iron).setBlockName("machine_satlinker").setHardness(5.0F).setResistance(10.0F).setCreativeTab(MainRegistry.missileTab).setBlockTextureName(RefStrings.MODID + ":machine_satlinker_side");
machine_keyforge = new MachineKeyForge(Material.iron).setBlockName("machine_keyforge").setHardness(5.0F).setResistance(10.0F).setCreativeTab(MainRegistry.consumableTab).setBlockTextureName(RefStrings.MODID + ":machine_keyforge_side");
machine_armor_table = new BlockArmorTable(Material.iron).setBlockName("machine_armor_table").setHardness(5.0F).setResistance(10.0F).setCreativeTab(MainRegistry.consumableTab);
machine_weapon_table = new BlockWeaponTable().setBlockName("machine_weapon_table").setHardness(5.0F).setResistance(10.0F).setCreativeTab(MainRegistry.consumableTab);
machine_solar_boiler = new MachineSolarBoiler(Material.iron).setBlockName("machine_solar_boiler").setHardness(5.0F).setResistance(10.0F).setCreativeTab(MainRegistry.machineTab).setBlockTextureName(RefStrings.MODID + ":machine_solar_boiler");
solar_mirror = new SolarMirror(Material.iron).setBlockName("solar_mirror").setHardness(5.0F).setResistance(10.0F).setCreativeTab(MainRegistry.machineTab).setBlockTextureName(RefStrings.MODID + ":solar_mirror");
@ -2266,8 +2268,8 @@ public class ModBlocks {
machine_siren = new MachineSiren(Material.iron).setBlockName("machine_siren").setHardness(5.0F).setResistance(10.0F).setCreativeTab(MainRegistry.machineTab).setBlockTextureName(RefStrings.MODID + ":machine_siren");
machine_spp_bottom = new SPPBottom(Material.iron).setBlockName("machine_spp_bottom").setHardness(5.0F).setResistance(10.0F).setCreativeTab(MainRegistry.machineTab);
machine_spp_top = new SPPTop(Material.iron).setBlockName("machine_spp_top").setHardness(5.0F).setResistance(10.0F).setCreativeTab(MainRegistry.machineTab);
machine_spp_bottom = new SPPBottom(Material.iron).setBlockName("machine_spp_bottom").setHardness(5.0F).setResistance(10.0F);
machine_spp_top = new SPPTop(Material.iron).setBlockName("machine_spp_top").setHardness(5.0F).setResistance(10.0F);
radiobox = new Radiobox(Material.iron).setBlockName("radiobox").setHardness(5.0F).setResistance(10.0F).setCreativeTab(MainRegistry.machineTab).setBlockTextureName(RefStrings.MODID + ":radiobox");
radiorec = new RadioRec(Material.iron).setBlockName("radiorec").setHardness(5.0F).setResistance(10.0F).setCreativeTab(MainRegistry.machineTab).setBlockTextureName(RefStrings.MODID + ":radiorec");
@ -2940,6 +2942,7 @@ public class ModBlocks {
GameRegistry.registerBlock(glass_polonium, glass_polonium.getUnlocalizedName());
GameRegistry.registerBlock(glass_ash, glass_ash.getUnlocalizedName());
GameRegistry.registerBlock(glass_quartz, glass_quartz.getUnlocalizedName());
GameRegistry.registerBlock(glass_polarized, glass_polarized.getUnlocalizedName());
//Silo Hatch
GameRegistry.registerBlock(seal_frame, seal_frame.getUnlocalizedName());
@ -3285,6 +3288,7 @@ public class ModBlocks {
GameRegistry.registerBlock(machine_satlinker, machine_satlinker.getUnlocalizedName());
GameRegistry.registerBlock(machine_keyforge, machine_keyforge.getUnlocalizedName());
GameRegistry.registerBlock(machine_armor_table, machine_armor_table.getUnlocalizedName());
GameRegistry.registerBlock(machine_weapon_table, machine_weapon_table.getUnlocalizedName());
GameRegistry.registerBlock(machine_forcefield, machine_forcefield.getUnlocalizedName());
GameRegistry.registerBlock(radiorec, radiorec.getUnlocalizedName());
GameRegistry.registerBlock(radiobox, radiobox.getUnlocalizedName());

View File

@ -18,7 +18,7 @@ import com.hbm.render.block.RenderBlockMultipass;
import com.hbm.util.EnumUtil;
import com.hbm.util.I18nUtil;
import api.hbm.fluid.IFillableItem;
import api.hbm.fluidmk2.IFillableItem;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import net.minecraft.block.BlockContainer;

View File

@ -7,6 +7,7 @@ import java.util.Random;
import com.hbm.blocks.BlockEnumMulti;
import com.hbm.blocks.ModBlocks;
import com.hbm.items.ModItems;
import com.hbm.util.EnumUtil;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
@ -29,11 +30,18 @@ public class BlockOreBasalt extends BlockEnumMulti {
}
public static enum EnumBasaltOreType {
SULFUR,
FLUORITE,
ASBESTOS,
GEM,
MOLYSITE
SULFUR(ModItems.sulfur),
FLUORITE(ModItems.fluorite),
ASBESTOS(ModItems.ingot_asbestos),
GEM(ModItems.gem_volcanic),
MOLYSITE(ModItems.powder_molysite);
public Item drop;
private EnumBasaltOreType(Item drop) {
this.drop = drop;
if(drop == null) throw new IllegalStateException("EnumBasaltOreType initialized before ModItems!");
}
}
public String getTextureMultiName(Enum num) {
@ -46,12 +54,8 @@ public class BlockOreBasalt extends BlockEnumMulti {
@Override
public Item getItemDropped(int meta, Random rand, int fortune) {
if(meta == EnumBasaltOreType.SULFUR.ordinal()) return ModItems.sulfur;
if(meta == EnumBasaltOreType.FLUORITE.ordinal()) return ModItems.fluorite;
if(meta == EnumBasaltOreType.ASBESTOS.ordinal()) return ModItems.ingot_asbestos;
if(meta == EnumBasaltOreType.GEM.ordinal()) return ModItems.gem_volcanic;
if(meta == EnumBasaltOreType.MOLYSITE.ordinal()) return ModItems.powder_molysite;
return super.getItemDropped(meta, rand, fortune);
EnumBasaltOreType type = EnumUtil.grabEnumSafely(EnumBasaltOreType.class, meta);
return type.drop;
}
@Override

View File

@ -4,13 +4,14 @@ import java.util.Random;
import com.hbm.blocks.ModBlocks;
import com.hbm.inventory.fluid.FluidType;
import com.hbm.inventory.fluid.tank.FluidTank;
import com.hbm.lib.RefStrings;
import com.hbm.render.block.ct.CT;
import com.hbm.render.block.ct.CTStitchReceiver;
import com.hbm.render.block.ct.IBlockCT;
import com.hbm.tileentity.machine.TileEntityPWRController;
import api.hbm.fluid.IFluidConnector;
import api.hbm.fluidmk2.IFluidReceiverMK2;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import net.minecraft.block.Block;
@ -97,7 +98,7 @@ public class BlockPWR extends BlockContainer implements IBlockCT {
super.breakBlock(world, x, y, z, block, meta);
}
public static class TileEntityBlockPWR extends TileEntity implements IFluidConnector, ISidedInventory {
public static class TileEntityBlockPWR extends TileEntity implements IFluidReceiverMK2, ISidedInventory {
public Block block;
public int coreX;
@ -189,15 +190,22 @@ public class BlockPWR extends BlockContainer implements IBlockCT {
@Override
public long getDemand(FluidType type, int pressure) {
if(this.getBlockMetadata() != 1) return 0;
if(block == null) return 0;
TileEntityPWRController controller = this.getCore();
if(controller != null) return controller.getDemand(type, pressure);
return 0;
}
@Override
public FluidTank[] getAllTanks() {
if(this.getBlockMetadata() != 1) return FluidTank.EMPTY_ARRAY;
if(block == null) return FluidTank.EMPTY_ARRAY;
TileEntityPWRController controller = this.getCore();
if(controller != null) return controller.getAllTanks();
return FluidTank.EMPTY_ARRAY;
}
@Override
public boolean canConnect(FluidType type, ForgeDirection dir) {
return this.getBlockMetadata() == 1;

View File

@ -0,0 +1,62 @@
package com.hbm.blocks.machine;
import com.hbm.inventory.container.ContainerWeaponTable;
import com.hbm.inventory.gui.GUIWeaponTable;
import com.hbm.lib.RefStrings;
import com.hbm.main.MainRegistry;
import com.hbm.tileentity.IGUIProvider;
import cpw.mods.fml.common.network.internal.FMLNetworkHandler;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import net.minecraft.block.Block;
import net.minecraft.block.material.Material;
import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.inventory.Container;
import net.minecraft.util.IIcon;
import net.minecraft.world.World;
public class BlockWeaponTable extends Block implements IGUIProvider {
@SideOnly(Side.CLIENT) private IIcon iconTop;
@SideOnly(Side.CLIENT) private IIcon iconBottom;
public BlockWeaponTable() {
super(Material.iron);
}
@Override
@SideOnly(Side.CLIENT)
public void registerBlockIcons(IIconRegister iconRegister) {
this.iconTop = iconRegister.registerIcon(RefStrings.MODID + ":armor_table_top");
this.iconBottom = iconRegister.registerIcon(RefStrings.MODID + ":armor_table_bottom");
this.blockIcon = iconRegister.registerIcon(RefStrings.MODID + ":armor_table_side");
}
@Override
@SideOnly(Side.CLIENT)
public IIcon getIcon(int side, int metadata) {
return side == 0 ? this.iconBottom : (side == 1 ? this.iconTop : this.blockIcon);
}
@Override
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int side, float hitX, float hitY, float hitZ) {
if(world.isRemote) {
return true;
} else if(!player.isSneaking()) {
FMLNetworkHandler.openGui(player, MainRegistry.instance, 0, world, x, y, z);
return true;
}
return false;
}
@Override
public Container provideContainer(int ID, EntityPlayer player, World world, int x, int y, int z) { return new ContainerWeaponTable(player.inventory); }
@Override
@SideOnly(Side.CLIENT)
public Object provideGUI(int ID, EntityPlayer player, World world, int x, int y, int z) { return new GUIWeaponTable(player.inventory); }
}

View File

@ -1,6 +1,5 @@
package com.hbm.blocks.machine;
import com.hbm.blocks.ModBlocks;
import com.hbm.lib.RefStrings;
import com.hbm.tileentity.machine.TileEntityMachineAmgen;
@ -30,21 +29,6 @@ public class MachineAmgen extends BlockContainer {
@Override
@SideOnly(Side.CLIENT)
public void registerBlockIcons(IIconRegister iconRegister) {
if(this == ModBlocks.machine_amgen) {
this.iconTop = iconRegister.registerIcon(RefStrings.MODID + ":machine_amgen_top");
this.blockIcon = iconRegister.registerIcon(RefStrings.MODID + ":machine_amgen_side");
}
if(this == ModBlocks.machine_geo) {
this.iconTop = iconRegister.registerIcon(RefStrings.MODID + ":machine_geo_top");
this.blockIcon = iconRegister.registerIcon(RefStrings.MODID + ":machine_geo_side");
}
this.blockIcon = iconRegister.registerIcon(RefStrings.MODID + ":block_deprecated");
}
@Override
@SideOnly(Side.CLIENT)
public IIcon getIcon(int side, int metadata) {
return side == 1 ? this.iconTop : (side == 0 ? this.iconTop : this.blockIcon);
}
}

View File

@ -9,14 +9,9 @@ import net.minecraft.block.BlockContainer;
import net.minecraft.block.material.Material;
import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.IIcon;
import net.minecraft.world.World;
public class SPPBottom extends BlockContainer {
@SideOnly(Side.CLIENT)
private IIcon iconTop;
private IIcon iconBottom;
public SPPBottom(Material p_i45386_1_) {
super(p_i45386_1_);
@ -30,15 +25,7 @@ public class SPPBottom extends BlockContainer {
@Override
@SideOnly(Side.CLIENT)
public void registerBlockIcons(IIconRegister iconRegister) {
this.iconTop = iconRegister.registerIcon(RefStrings.MODID + (":machine_spp_b_top"));
this.iconBottom = iconRegister.registerIcon(RefStrings.MODID + (":machine_spp_blank"));
this.blockIcon = iconRegister.registerIcon(RefStrings.MODID + ":machine_spp_b_side");
}
@Override
@SideOnly(Side.CLIENT)
public IIcon getIcon(int side, int metadata) {
return side == 1 ? this.iconTop : (side == 0 ? this.iconBottom : this.blockIcon);
this.blockIcon = iconRegister.registerIcon(RefStrings.MODID + ":block_deprecated");
}
}

View File

@ -7,13 +7,8 @@ import cpw.mods.fml.relauncher.SideOnly;
import net.minecraft.block.Block;
import net.minecraft.block.material.Material;
import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.util.IIcon;
public class SPPTop extends Block {
@SideOnly(Side.CLIENT)
private IIcon iconTop;
private IIcon iconBottom;
public SPPTop(Material p_i45394_1_) {
super(p_i45394_1_);
@ -22,15 +17,6 @@ public class SPPTop extends Block {
@Override
@SideOnly(Side.CLIENT)
public void registerBlockIcons(IIconRegister iconRegister) {
this.iconTop = iconRegister.registerIcon(RefStrings.MODID + (":machine_spp_blank"));
this.iconBottom = iconRegister.registerIcon(RefStrings.MODID + (":machine_spp_t_bottom"));
this.blockIcon = iconRegister.registerIcon(RefStrings.MODID + ":machine_spp_t_side");
this.blockIcon = iconRegister.registerIcon(RefStrings.MODID + ":block_deprecated");
}
@Override
@SideOnly(Side.CLIENT)
public IIcon getIcon(int side, int metadata) {
return side == 1 ? this.iconTop : (side == 0 ? this.iconBottom : this.blockIcon);
}
}

View File

@ -1,7 +1,5 @@
package com.hbm.blocks.network;
import api.hbm.fluid.IPipeNet;
import api.hbm.fluid.PipeNet;
import com.hbm.blocks.IAnalyzable;
import com.hbm.extprop.HbmPlayerProps;
import com.hbm.handler.HbmKeybinds;
@ -9,6 +7,10 @@ import com.hbm.inventory.fluid.FluidType;
import com.hbm.items.machine.IItemFluidIdentifier;
import com.hbm.items.machine.ItemFluidIDMulti;
import com.hbm.tileentity.network.TileEntityPipeBaseNT;
import com.hbm.uninos.UniNodespace;
import api.hbm.fluidmk2.FluidNetMK2;
import api.hbm.fluidmk2.FluidNode;
import net.minecraft.block.Block;
import net.minecraft.block.BlockContainer;
import net.minecraft.block.material.Material;
@ -123,19 +125,17 @@ public class FluidDuctBase extends BlockContainer implements IBlockFluidDuct, IA
FluidType type = pipe.getType();
if(type != null) {
IPipeNet net = pipe.getPipeNet(type);
if(net instanceof PipeNet) {
PipeNet pipeNet = (PipeNet) net;
FluidNode node = (FluidNode) UniNodespace.getNode(world, x, y, z, type.getNetworkProvider());
if(node != null && node.net != null) {
FluidNetMK2 net = node.net;
List<String> debug = new ArrayList();
debug.add("=== DEBUG START ===");
debug.addAll(pipeNet.debug);
debug.add("=== DEBUG END ===");
debug.add("Links: " + pipeNet.getLinks().size());
debug.add("Subscribers: " + pipeNet.getSubscribers().size());
debug.add("Transfer: " + pipeNet.getTotalTransfer());
debug.add("Links: " + net.links.size());
debug.add("Subscribers: " + net.receiverEntries.size());
debug.add("Providers: " + net.providerEntries.size());
debug.add("Transfer: " + net.fluidTracker);
return debug;
}
}

View File

@ -1,6 +1,7 @@
package com.hbm.blocks.network;
import api.hbm.fluid.IPipeNet;
import api.hbm.fluidmk2.FluidNetMK2;
import com.hbm.blocks.IBlockMultiPass;
import com.hbm.blocks.ILookOverlay;
import com.hbm.blocks.ITooltipProvider;
@ -30,7 +31,6 @@ import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;
import net.minecraftforge.client.event.RenderGameOverlayEvent.Pre;
import java.math.BigInteger;
import java.util.ArrayList;
import java.util.List;
import java.util.Locale;
@ -109,7 +109,6 @@ public class FluidDuctGauge extends FluidDuctBase implements IBlockMultiPass, IL
@Optional.InterfaceList({@Optional.Interface(iface = "li.cil.oc.api.network.SimpleComponent", modid = "OpenComputers")})
public static class TileEntityPipeGauge extends TileEntityPipeBaseNT implements SimpleComponent, CompatHandler.OCComponent {
private BigInteger lastMeasurement = BigInteger.valueOf(10);
private long deltaTick = 0;
private long deltaSecond = 0;
private long deltaLastSecond = 0;
@ -120,22 +119,14 @@ public class FluidDuctGauge extends FluidDuctBase implements IBlockMultiPass, IL
if(!worldObj.isRemote) {
IPipeNet net = this.getPipeNet(this.getType());
if(this.node != null && this.node.net != null && this.getType() != Fluids.NONE) {
if(net != null && this.getType() != Fluids.NONE) {
BigInteger total = net.getTotalTransfer();
BigInteger delta = total.subtract(this.lastMeasurement);
this.lastMeasurement = total;
try {
this.deltaTick = delta.longValueExact();
if(worldObj.getTotalWorldTime() % 20 == 0) {
this.deltaLastSecond = this.deltaSecond;
this.deltaSecond = 0;
}
this.deltaSecond += deltaTick;
} catch(Exception ex) { }
this.deltaTick = ((FluidNetMK2) this.node.net).fluidTracker;
if(worldObj.getTotalWorldTime() % 20 == 0) {
this.deltaLastSecond = this.deltaSecond;
this.deltaSecond = 0;
}
this.deltaSecond += deltaTick;
}
networkPackNT(25);

View File

@ -54,6 +54,7 @@ public class WeaponRecipes {
CraftingManager.addRecipeAuto(new ItemStack(ModItems.gun_light_revolver, 1), new Object[] { "BRM", " G", 'B', STEEL.lightBarrel(), 'R', STEEL.lightReceiver(), 'M', GUNMETAL.mechanism(), 'G', WOOD.grip() });
CraftingManager.addRecipeAuto(new ItemStack(ModItems.gun_light_revolver_atlas, 1), new Object[] { " M ", "MAM", " M ", 'M', WEAPONSTEEL.mechanism(), 'A', ModItems.gun_light_revolver });
CraftingManager.addRecipeAuto(new ItemStack(ModItems.gun_henry, 1), new Object[] { "BRP", "BMS", 'B', STEEL.lightBarrel(), 'R', GUNMETAL.lightReceiver(), 'M', GUNMETAL.mechanism(), 'S', WOOD.stock(), 'P', GUNMETAL.plate() });
CraftingManager.addRecipeAuto(new ItemStack(ModItems.gun_henry_lincoln, 1), new Object[] { " M ", "PGP", " M ", 'M', WEAPONSTEEL.mechanism(), 'P', GOLD.plateCast(), 'G', ModItems.gun_henry });
CraftingManager.addRecipeAuto(new ItemStack(ModItems.gun_greasegun, 1), new Object[] { "BRS", "SMG", 'B', STEEL.lightBarrel(), 'R', STEEL.lightReceiver(), 'S', STEEL.bolt(), 'M', GUNMETAL.mechanism(), 'G', STEEL.grip() });
CraftingManager.addRecipeAuto(new ItemStack(ModItems.gun_maresleg, 1), new Object[] { "BRM", "BGS", 'B', STEEL.lightBarrel(), 'R', STEEL.lightReceiver(), 'M', GUNMETAL.mechanism(), 'G', STEEL.bolt(), 'S', WOOD.stock() });
CraftingManager.addRecipeAuto(new ItemStack(ModItems.gun_maresleg_akimbo, 1), new Object[] { "SMS", 'S', ModItems.gun_maresleg, 'M', WEAPONSTEEL.mechanism() });

View File

@ -10,16 +10,16 @@ import net.minecraft.world.World;
public class EntityDisperserCanister extends EntityGrenadeBase {
public EntityDisperserCanister(World p_i1773_1_) {
super(p_i1773_1_);
public EntityDisperserCanister(World world) {
super(world);
}
public EntityDisperserCanister(World p_i1774_1_, EntityLivingBase p_i1774_2_) {
super(p_i1774_1_, p_i1774_2_);
public EntityDisperserCanister(World world, EntityLivingBase living) {
super(world, living);
}
public EntityDisperserCanister(World p_i1775_1_, double p_i1775_2_, double p_i1775_4_, double p_i1775_6_) {
super(p_i1775_1_, p_i1775_2_, p_i1775_4_, p_i1775_6_);
public EntityDisperserCanister(World world, double x, double y, double z) {
super(world, x, y, z);
}
public EntityDisperserCanister setFluid(int id) {
@ -55,6 +55,7 @@ public class EntityDisperserCanister extends EntityGrenadeBase {
mist.setArea(10, 5);
mist.setDuration(80);
worldObj.spawnEntityInWorld(mist);
this.setDead();
}
}

View File

@ -7,6 +7,7 @@ import com.hbm.inventory.fluid.Fluids;
import com.hbm.items.ModItems;
import com.hbm.main.MainRegistry;
import com.hbm.util.ChunkShapeHelper;
import net.minecraft.entity.Entity;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.inventory.IInventory;
@ -20,13 +21,13 @@ import net.minecraftforge.common.ForgeChunkManager.Ticket;
import net.minecraftforge.common.ForgeChunkManager.Type;
public class EntityDeliveryDrone extends EntityDroneBase implements IInventory, IChunkLoader {
protected ItemStack[] slots = new ItemStack[this.getSizeInventory()];
public FluidStack fluid;
protected boolean chunkLoading = false;
private Ticket loaderTicket;
public EntityDeliveryDrone(World world) {
super(world);
}
@ -60,32 +61,22 @@ public class EntityDeliveryDrone extends EntityDroneBase implements IInventory,
super.entityInit();
this.dataWatcher.addObject(11, new Byte((byte) 0));
}
public EntityDeliveryDrone setChunkLoading() {
public void setChunkLoading() {
init(ForgeChunkManager.requestTicket(MainRegistry.instance, worldObj, Type.ENTITY));
this.chunkLoading = true;
return this;
}
@Override
public void onUpdate() {
if(!worldObj.isRemote) {
loadNeighboringChunks((int)Math.floor(posX / 16D), (int)Math.floor(posZ / 16D));
}
super.onUpdate();
}
@Override
public double getSpeed() {
return this.dataWatcher.getWatchableObjectByte(11) == 1 ? 0.375 * 3 : 0.375;
}
@Override
protected void writeEntityToNBT(NBTTagCompound nbt) {
super.writeEntityToNBT(nbt);
NBTTagList nbttaglist = new NBTTagList();
for(int i = 0; i < this.slots.length; ++i) {
@ -98,7 +89,7 @@ public class EntityDeliveryDrone extends EntityDroneBase implements IInventory,
}
nbt.setTag("Items", nbttaglist);
if(fluid != null) {
nbt.setInteger("fluidType", fluid.type.getID());
nbt.setInteger("fluidAmount", fluid.fill);
@ -111,7 +102,7 @@ public class EntityDeliveryDrone extends EntityDroneBase implements IInventory,
@Override
protected void readEntityFromNBT(NBTTagCompound nbt) {
super.readEntityFromNBT(nbt);
NBTTagList nbttaglist = nbt.getTagList("Items", 10);
this.slots = new ItemStack[this.getSizeInventory()];
@ -123,14 +114,14 @@ public class EntityDeliveryDrone extends EntityDroneBase implements IInventory,
this.slots[j] = ItemStack.loadItemStackFromNBT(nbttagcompound1);
}
}
if(nbt.hasKey("fluidType")) {
FluidType type = Fluids.fromNameCompat(nbt.getString("fluidType"));
if(type != Fluids.NONE) {
nbt.removeTag(nbt.getString("fluidType"));
} else
type = Fluids.fromID(nbt.getInteger("fluidType"));
this.fluid = new FluidStack(type, nbt.getInteger("fluidAmount"));
}
@ -142,7 +133,7 @@ public class EntityDeliveryDrone extends EntityDroneBase implements IInventory,
public ItemStack getStackInSlot(int slot) {
return slots[slot];
}
@Override
public ItemStack decrStackSize(int slot, int amount) {
if(this.slots[slot] != null) {
@ -197,20 +188,23 @@ public class EntityDeliveryDrone extends EntityDroneBase implements IInventory,
@Override public void openInventory() { }
@Override public void closeInventory() { }
public void loadNeighboringChunks(int newChunkX, int newChunkZ) {
@Override
protected void loadNeighboringChunks() {
if(!worldObj.isRemote && loaderTicket != null) {
clearChunkLoader();
ForgeChunkManager.forceChunk(loaderTicket, new ChunkCoordIntPair(newChunkX, newChunkZ));
ForgeChunkManager.forceChunk(loaderTicket, new ChunkCoordIntPair((int) Math.ceil((this.posX + this.motionX) / 16D), (int) Math.ceil((this.posZ + this.motionZ) / 16D)));
// This is the lowest padding that worked with my drone waypoint path. if they stop getting loaded crank up paddingSize
for (ChunkCoordIntPair chunk : ChunkShapeHelper.getChunksAlongLineSegment((int) this.posX, (int) this.posZ, (int) (this.posX + this.motionX), (int) (this.posZ + this.motionZ), 4)){
ForgeChunkManager.forceChunk(loaderTicket, chunk);
}
}
}
@Override
public void setDead() {
super.setDead();
this.clearChunkLoader();
}
public void clearChunkLoader() {
if(!worldObj.isRemote && loaderTicket != null) {
for(ChunkCoordIntPair chunk : loaderTicket.getChunkList()) {
@ -227,7 +221,7 @@ public class EntityDeliveryDrone extends EntityDroneBase implements IInventory,
loaderTicket.bindEntity(this);
loaderTicket.getModData();
}
ForgeChunkManager.forceChunk(loaderTicket, new ChunkCoordIntPair(chunkCoordX, chunkCoordZ));
this.loadNeighboringChunks();
}
}
}

View File

@ -9,7 +9,7 @@ import net.minecraft.util.Vec3;
import net.minecraft.world.World;
public abstract class EntityDroneBase extends Entity {
protected int turnProgress;
protected double syncPosX;
protected double syncPosY;
@ -26,7 +26,7 @@ public abstract class EntityDroneBase extends Entity {
super(world);
this.setSize(1.5F, 2.0F);
}
public void setTarget(double x, double y, double z) {
this.targetX = x;
this.targetY = y;
@ -49,7 +49,7 @@ public abstract class EntityDroneBase extends Entity {
if(attacker instanceof EntityPlayer) {
this.setDead();
}
return false;
}
@ -62,7 +62,7 @@ public abstract class EntityDroneBase extends Entity {
protected void entityInit() {
this.dataWatcher.addObject(10, new Byte((byte) 0));
}
/**
* 0: Empty<br>
* 1: Crate<br>
@ -71,14 +71,14 @@ public abstract class EntityDroneBase extends Entity {
public void setAppearance(int style) {
this.dataWatcher.updateObject(10, (byte) style);
}
public int getAppearance() {
return this.dataWatcher.getWatchableObjectByte(10);
}
@Override
public void onUpdate() {
if(worldObj.isRemote) {
if(this.turnProgress > 0) {
double interpX = this.posX + (this.syncPosX - this.posX) / (double) this.turnProgress;
@ -99,12 +99,12 @@ public abstract class EntityDroneBase extends Entity {
this.motionX = 0;
this.motionY = 0;
this.motionZ = 0;
if(this.targetY != -1) {
Vec3 dist = Vec3.createVectorHelper(targetX - posX, targetY - posY, targetZ - posZ);
double speed = Math.min(getSpeed(), dist.lengthVector());
dist = dist.normalize();
this.motionX = dist.xCoord * speed;
this.motionY = dist.yCoord * speed;
@ -113,21 +113,26 @@ public abstract class EntityDroneBase extends Entity {
if(isCollidedHorizontally){
motionY += 1;
}
this.loadNeighboringChunks();
this.moveEntity(motionX, motionY, motionZ);
}
super.onUpdate();
}
protected void loadNeighboringChunks() {}
public double getSpeed() {
return 0.125D;
}
@SideOnly(Side.CLIENT)
public void setVelocity(double motionX, double motionY, double motionZ) {
this.velocityX = this.motionX = motionX;
this.velocityY = this.motionY = motionY;
this.velocityZ = this.motionZ = motionZ;
}
@SideOnly(Side.CLIENT)
public void setPositionAndRotation2(double x, double y, double z, float yaw, float pitch, int theNumberThree) {
this.syncPosX = x;
@ -138,7 +143,7 @@ public abstract class EntityDroneBase extends Entity {
this.motionY = this.velocityY;
this.motionZ = this.velocityZ;
}
@Override
protected void writeEntityToNBT(NBTTagCompound nbt) {
@ -157,7 +162,7 @@ public abstract class EntityDroneBase extends Entity {
this.targetY = nbt.getDouble("tY");
this.targetZ = nbt.getDouble("tZ");
}
this.dataWatcher.updateObject(10, nbt.getByte("app"));
}
}

View File

@ -28,6 +28,7 @@ public class EntityProcessorCross implements IEntityProcessor {
protected double nodeDist = 2D;
protected IEntityRangeMutator range;
protected ICustomDamageHandler damage;
protected double knockbackMult = 1D;
protected boolean allowSelfDamage = false;
public EntityProcessorCross(double nodeDist) {
@ -38,6 +39,11 @@ public class EntityProcessorCross implements IEntityProcessor {
this.allowSelfDamage = true;
return this;
}
public EntityProcessorCross setKnockback(double mult) {
this.knockbackMult = mult;
return this;
}
@Override
public HashMap<EntityPlayer, Vec3> process(ExplosionVNT explosion, World world, double x, double y, double z, float size) {
@ -104,13 +110,13 @@ public class EntityProcessorCross implements IEntityProcessor {
double enchKnockback = EnchantmentProtection.func_92092_a(entity, knockback);
if(!(entity instanceof EntityBulletBaseMK4)) {
entity.motionX += deltaX * enchKnockback;
entity.motionY += deltaY * enchKnockback;
entity.motionZ += deltaZ * enchKnockback;
entity.motionX += deltaX * enchKnockback * knockbackMult;
entity.motionY += deltaY * enchKnockback * knockbackMult;
entity.motionZ += deltaZ * enchKnockback * knockbackMult;
}
if(entity instanceof EntityPlayer) {
affectedPlayers.put((EntityPlayer) entity, Vec3.createVectorHelper(deltaX * knockback, deltaY * knockback, deltaZ * knockback));
affectedPlayers.put((EntityPlayer) entity, Vec3.createVectorHelper(deltaX * knockback * knockbackMult, deltaY * knockback * knockbackMult, deltaZ * knockback * knockbackMult));
}
}
}

View File

@ -0,0 +1,27 @@
package com.hbm.explosion.vanillant.standard;
import com.hbm.explosion.vanillant.ExplosionVNT;
import com.hbm.explosion.vanillant.interfaces.IExplosionSFX;
import com.hbm.packet.PacketDispatcher;
import com.hbm.packet.toclient.AuxParticlePacketNT;
import cpw.mods.fml.common.network.NetworkRegistry.TargetPoint;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.world.World;
public class ExplosionEffectTiny implements IExplosionSFX {
@Override
public void doEffect(ExplosionVNT explosion, World world, double x, double y, double z, float size) {
if(world.isRemote) return;
world.playSoundEffect(x, y, z, "hbm:weapon.explosionTiny", 15.0F, 1.0F);
NBTTagCompound data = new NBTTagCompound();
data.setString("type", "vanillaExt");
data.setString("mode", "largeexplode");
data.setFloat("size", 1.5F);
data.setByte("count", (byte)1);
PacketDispatcher.wrapper.sendToAllAround(new AuxParticlePacketNT(data, x, y, z), new TargetPoint(world.provider.dimensionId, x, y, z, 100));
}
}

View File

@ -26,6 +26,7 @@ public class HbmPlayerProps implements IExtendedEntityProperties {
public boolean enableHUD = true;
public boolean enableBackpack = true;
public boolean enableMagnet = true;
private boolean[] keysPressed = new boolean[EnumKeybind.values().length];
@ -71,6 +72,10 @@ public class HbmPlayerProps implements IExtendedEntityProperties {
return this.enableBackpack && getKeyPressed(EnumKeybind.JETPACK);
}
public boolean isMagnetActive(){
return this.enableMagnet;
}
public void setKeyPressed(EnumKeybind key, boolean pressed) {
if(!getKeyPressed(key) && pressed) {
@ -86,6 +91,16 @@ public class HbmPlayerProps implements IExtendedEntityProperties {
MainRegistry.proxy.displayTooltip(EnumChatFormatting.RED + "Jetpack OFF", MainRegistry.proxy.ID_JETPACK);
}
}
if (key == EnumKeybind.TOGGLE_MAGNET){
if (!player.worldObj.isRemote){
this.enableMagnet = !this.enableMagnet;
if(this.enableMagnet)
MainRegistry.proxy.displayTooltip(EnumChatFormatting.GREEN + "Magnet ON", MainRegistry.proxy.ID_MAGNET);
else
MainRegistry.proxy.displayTooltip(EnumChatFormatting.RED + "Magnet OFF", MainRegistry.proxy.ID_MAGNET);
}
}
if(key == EnumKeybind.TOGGLE_HEAD) {
if(!player.worldObj.isRemote) {
@ -174,6 +189,7 @@ public class HbmPlayerProps implements IExtendedEntityProperties {
buf.writeBoolean(this.enableHUD);
buf.writeInt(this.reputation);
buf.writeBoolean(this.isOnLadder);
buf.writeBoolean(this.enableMagnet);
}
public void deserialize(ByteBuf buf) {
@ -185,6 +201,7 @@ public class HbmPlayerProps implements IExtendedEntityProperties {
this.enableHUD = buf.readBoolean();
this.reputation = buf.readInt();
this.isOnLadder = buf.readBoolean();
this.enableMagnet = buf.readBoolean();
}
}
@ -198,6 +215,7 @@ public class HbmPlayerProps implements IExtendedEntityProperties {
props.setFloat("shield", shield);
props.setFloat("maxShield", maxShield);
props.setBoolean("enableBackpack", enableBackpack);
props.setBoolean("enableMagnet", enableMagnet);
props.setBoolean("enableHUD", enableHUD);
props.setInteger("reputation", reputation);
props.setBoolean("isOnLadder", isOnLadder);
@ -216,6 +234,7 @@ public class HbmPlayerProps implements IExtendedEntityProperties {
this.shield = props.getFloat("shield");
this.maxShield = props.getFloat("maxShield");
this.enableBackpack = props.getBoolean("enableBackpack");
this.enableMagnet = props.getBoolean("enableMagnet");
this.enableHUD = props.getBoolean("enableHUD");
this.reputation = props.getInteger("reputation");
this.isOnLadder = props.getBoolean("isOnLadder");

View File

@ -22,6 +22,7 @@ public class HbmKeybinds {
public static KeyBinding calculatorKey = new KeyBinding(category + ".calculator", Keyboard.KEY_N, category);
public static KeyBinding jetpackKey = new KeyBinding(category + ".toggleBack", Keyboard.KEY_C, category);
public static KeyBinding magnetKey = new KeyBinding(category + ".toggleMagnet", Keyboard.KEY_Z, category);
public static KeyBinding hudKey = new KeyBinding(category + ".toggleHUD", Keyboard.KEY_V, category);
public static KeyBinding dashKey = new KeyBinding(category + ".dash", Keyboard.KEY_LSHIFT, category);
public static KeyBinding trainKey = new KeyBinding(category + ".trainInv", Keyboard.KEY_R, category);
@ -43,6 +44,7 @@ public class HbmKeybinds {
public static void register() {
ClientRegistry.registerKeyBinding(calculatorKey);
ClientRegistry.registerKeyBinding(jetpackKey);
ClientRegistry.registerKeyBinding(magnetKey);
ClientRegistry.registerKeyBinding(hudKey);
ClientRegistry.registerKeyBinding(dashKey);
ClientRegistry.registerKeyBinding(trainKey);
@ -98,6 +100,7 @@ public class HbmKeybinds {
public static enum EnumKeybind {
JETPACK,
TOGGLE_JETPACK,
TOGGLE_MAGNET,
TOGGLE_HEAD,
DASH,
TRAIN,

View File

@ -128,7 +128,6 @@ public class SatelliteHandler extends TemplateRecipeHandler implements ICompatNH
public RecipeSet(Object in, List<ItemStack> out) {
//not the prettiest of solutions but certainly the most pleasant to work with
int inLine = 1;
int outLine = 1;
int inOX = 0;
int inOY = 0;

View File

@ -0,0 +1,148 @@
package com.hbm.inventory.container;
import com.hbm.items.weapon.sedna.ItemGunBaseNT;
import com.hbm.items.weapon.sedna.mods.WeaponModManager;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.inventory.Container;
import net.minecraft.inventory.IInventory;
import net.minecraft.inventory.InventoryBasic;
import net.minecraft.inventory.InventoryCraftResult;
import net.minecraft.inventory.Slot;
import net.minecraft.item.ItemStack;
public class ContainerWeaponTable extends Container {
public InventoryBasic mods = new InventoryBasic("Mods", false, 7);
public IInventory gun = new InventoryCraftResult();
public ContainerWeaponTable(InventoryPlayer inventory) {
for(int i = 0; i < 7; i++) this.addSlotToContainer(new ModSlot(mods, i, 44 + 18 * i, 108));
this.addSlotToContainer(new Slot(gun, 0, 8, 108) {
@Override
public boolean isItemValid(ItemStack stack) {
return stack.getItem() instanceof ItemGunBaseNT;
}
@Override
public void putStack(ItemStack stack) {
if(stack != null) {
ItemStack[] mods = WeaponModManager.getUpgradeItems(stack);
if(mods != null) for(int i = 0; i < Math.min(mods.length, 7); i++) {
ContainerWeaponTable.this.mods.setInventorySlotContents(i, mods[i]);
}
}
super.putStack(stack);
}
@Override
public void onPickupFromSlot(EntityPlayer player, ItemStack stack) {
super.onPickupFromSlot(player, stack);
WeaponModManager.install(
stack,
mods.getStackInSlot(0),
mods.getStackInSlot(1),
mods.getStackInSlot(2),
mods.getStackInSlot(3),
mods.getStackInSlot(4),
mods.getStackInSlot(5),
mods.getStackInSlot(6));
for(int i = 0; i < 7; i++) {
ItemStack mod = ContainerWeaponTable.this.mods.getStackInSlot(i);
if(WeaponModManager.isApplicable(stack, mod, false)) ContainerWeaponTable.this.mods.setInventorySlotContents(i, null);
}
}
});
for(int i = 0; i < 3; i++) {
for(int j = 0; j < 9; j++) {
this.addSlotToContainer(new Slot(inventory, j + i * 9 + 9, 8 + j * 18, 158 + i * 18));
}
}
for(int i = 0; i < 9; i++) {
this.addSlotToContainer(new Slot(inventory, i, 8 + i * 18, 216));
}
this.onCraftMatrixChanged(this.mods);
}
@Override
public void onContainerClosed(EntityPlayer player) {
super.onContainerClosed(player);
if(!player.worldObj.isRemote) {
for(int i = 0; i < this.mods.getSizeInventory(); ++i) {
ItemStack itemstack = this.mods.getStackInSlotOnClosing(i);
if(itemstack != null) {
player.dropPlayerItemWithRandomChoice(itemstack, false);
}
}
ItemStack itemstack = this.gun.getStackInSlotOnClosing(0);
if(itemstack != null) {
WeaponModManager.uninstall(itemstack);
player.dropPlayerItemWithRandomChoice(itemstack, false);
}
}
}
@Override
public boolean canInteractWith(EntityPlayer player) {
return true;
}
@Override
public ItemStack transferStackInSlot(EntityPlayer p_82846_1_, int par2) {
return null;
}
public class ModSlot extends Slot {
public ModSlot(IInventory inventory, int index, int x, int y) {
super(inventory, index, x, y);
}
@Override
public boolean isItemValid(ItemStack stack) {
return gun.getStackInSlot(0) != null && WeaponModManager.isApplicable(gun.getStackInSlot(0), stack, true);
}
@Override
public void putStack(ItemStack stack) {
super.putStack(stack);
refreshInstalledMods();
}
@Override
public void onPickupFromSlot(EntityPlayer player, ItemStack stack) {
super.onPickupFromSlot(player, stack);
refreshInstalledMods();
}
public void refreshInstalledMods() {
if(gun.getStackInSlot(0) == null) return;
WeaponModManager.uninstall(gun.getStackInSlot(0));
WeaponModManager.install(
gun.getStackInSlot(0),
mods.getStackInSlot(0),
mods.getStackInSlot(1),
mods.getStackInSlot(2),
mods.getStackInSlot(3),
mods.getStackInSlot(4),
mods.getStackInSlot(5),
mods.getStackInSlot(6)); //miscalculated, slot array isn't visible - fuck!
}
}
}

View File

@ -14,6 +14,7 @@ import com.hbm.inventory.fluid.trait.FluidTraitSimple.*;
import com.hbm.lib.RefStrings;
import com.hbm.render.util.EnumSymbol;
import com.hbm.uninos.INetworkProvider;
import com.hbm.uninos.networkproviders.FluidNetProvider;
import com.hbm.util.I18nUtil;
import api.hbm.fluidmk2.FluidNetMK2;
@ -255,7 +256,9 @@ public class FluidType {
return this.stringId;
}
protected INetworkProvider<FluidNetMK2> NETWORK_PROVIDER = new FluidNetProvider(this);
public INetworkProvider<FluidNetMK2> getNetworkProvider() {
return null; //TBI
return NETWORK_PROVIDER;
}
}

View File

@ -3,7 +3,7 @@ package com.hbm.inventory.fluid.tank;
import com.hbm.handler.ArmorModHandler;
import com.hbm.inventory.fluid.FluidType;
import api.hbm.fluid.IFillableItem;
import api.hbm.fluidmk2.IFillableItem;
import net.minecraft.item.ItemArmor;
import net.minecraft.item.ItemStack;

View File

@ -26,6 +26,8 @@ import net.minecraft.util.EnumChatFormatting;
import net.minecraft.util.MathHelper;
public class FluidTank {
public static final FluidTank[] EMPTY_ARRAY = new FluidTank[0];
public static final List<FluidLoadingHandler> loadingHandlers = new ArrayList<FluidLoadingHandler>();
public static final Set<Item> noDualUnload = new HashSet<Item>();

View File

@ -0,0 +1,42 @@
package com.hbm.inventory.gui;
import org.lwjgl.opengl.GL11;
import com.hbm.inventory.container.ContainerWeaponTable;
import com.hbm.lib.RefStrings;
import net.minecraft.client.resources.I18n;
import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.util.ResourceLocation;
public class GUIWeaponTable extends GuiInfoContainer {
public static ResourceLocation texture = new ResourceLocation(RefStrings.MODID + ":textures/gui/machine/gui_weapon_modifier.png");
public int left;
public int top;
public GUIWeaponTable(InventoryPlayer player) {
super(new ContainerWeaponTable(player));
this.xSize = 176;
this.ySize = 240;
guiLeft = (this.width - this.xSize) / 2;
guiTop = (this.height - this.ySize) / 2;
}
@Override
protected void drawGuiContainerForegroundLayer(int mX, int mY) {
String name = I18n.format("container.armorTable");
this.fontRendererObj.drawString(name, (this.xSize - 22) / 2 - this.fontRendererObj.getStringWidth(name) / 2 + 22, 6, 4210752);
this.fontRendererObj.drawString(I18n.format("container.inventory"), 8 + 22, this.ySize - 96 + 2, 4210752);
}
@Override
protected void drawGuiContainerBackgroundLayer(float inter, int mX, int mY) {
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
this.mc.getTextureManager().bindTexture(texture);
drawTexturedModalRect(guiLeft, guiTop, 0, 0, xSize, ySize);
}
}

View File

@ -101,9 +101,6 @@ public class PyroOvenRecipes extends SerializableRecipe {
recipes.add(new PyroOvenRecipe(100)
.in(new FluidStack(Fluids.HYDROGEN, 500)).in(new OreDictStack(COAL.dust()))
.out(new FluidStack(Fluids.HEAVYOIL, 1_000)));
recipes.add(new PyroOvenRecipe(100)
.in(new FluidStack(Fluids.HYDROGEN, 250)).in(new OreDictStack(ANY_COKE.gem()))
.out(new FluidStack(Fluids.HEAVYOIL, 1_000)));
//coalgas from coal
recipes.add(new PyroOvenRecipe(50)
.in(new FluidStack(Fluids.HEAVYOIL, 500)).in(new OreDictStack(COAL.gem()))

View File

@ -1456,6 +1456,7 @@ public class ModItems {
public static Item gun_light_revolver_atlas;
public static Item gun_light_revolver_dani;
public static Item gun_henry;
public static Item gun_henry_lincoln;
public static Item gun_greasegun;
public static Item gun_maresleg;
public static Item gun_maresleg_akimbo;
@ -1505,6 +1506,8 @@ public class ModItems {
public static Item ammo_standard;
public static Item ammo_secret;
public static Item weapon_mod_test;
public static Item crucible;
public static Item stick_dynamite;
@ -6405,16 +6408,6 @@ public class ModItems {
GameRegistry.registerItem(mp_chip_4, mp_chip_4.getUnlocalizedName());
GameRegistry.registerItem(mp_chip_5, mp_chip_5.getUnlocalizedName());
/*GameRegistry.registerItem(missile_skin_camo, missile_skin_camo.getUnlocalizedName());
GameRegistry.registerItem(missile_skin_desert, missile_skin_desert.getUnlocalizedName());
GameRegistry.registerItem(missile_skin_flames, missile_skin_flames.getUnlocalizedName());
GameRegistry.registerItem(missile_skin_manly_pink, missile_skin_manly_pink.getUnlocalizedName());
GameRegistry.registerItem(missile_skin_orange_insulation, missile_skin_orange_insulation.getUnlocalizedName());
GameRegistry.registerItem(missile_skin_sleek, missile_skin_sleek.getUnlocalizedName());
GameRegistry.registerItem(missile_skin_soviet_glory, missile_skin_soviet_glory.getUnlocalizedName());
GameRegistry.registerItem(missile_skin_soviet_stank, missile_skin_soviet_stank.getUnlocalizedName());
GameRegistry.registerItem(missile_skin_metal, missile_skin_metal.getUnlocalizedName());*/
//Satellites
GameRegistry.registerItem(sat_mapper, sat_mapper.getUnlocalizedName());
GameRegistry.registerItem(sat_scanner, sat_scanner.getUnlocalizedName());
@ -6445,6 +6438,7 @@ public class ModItems {
GameRegistry.registerItem(gun_light_revolver_atlas, gun_light_revolver_atlas.getUnlocalizedName());
GameRegistry.registerItem(gun_light_revolver_dani, gun_light_revolver_dani.getUnlocalizedName());
GameRegistry.registerItem(gun_henry, gun_henry.getUnlocalizedName());
GameRegistry.registerItem(gun_henry_lincoln, gun_henry_lincoln.getUnlocalizedName());
GameRegistry.registerItem(gun_greasegun, gun_greasegun.getUnlocalizedName());
GameRegistry.registerItem(gun_maresleg, gun_maresleg.getUnlocalizedName());
GameRegistry.registerItem(gun_maresleg_akimbo, gun_maresleg_akimbo.getUnlocalizedName());
@ -6493,6 +6487,8 @@ public class ModItems {
GameRegistry.registerItem(ammo_standard, ammo_standard.getUnlocalizedName());
GameRegistry.registerItem(ammo_secret, ammo_secret.getUnlocalizedName());
GameRegistry.registerItem(weapon_mod_test, weapon_mod_test.getUnlocalizedName());
//Ammo
GameRegistry.registerItem(gun_b92_ammo, gun_b92_ammo.getUnlocalizedName());

View File

@ -5,7 +5,7 @@ import java.util.List;
import com.hbm.inventory.fluid.FluidType;
import com.hbm.util.BobMathUtil;
import api.hbm.fluid.IFillableItem;
import api.hbm.fluidmk2.IFillableItem;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import net.minecraft.entity.player.EntityPlayer;

View File

@ -2,6 +2,7 @@ package com.hbm.items.armor;
import java.util.List;
import com.hbm.extprop.HbmPlayerProps;
import com.hbm.handler.ArmorModHandler;
import net.minecraft.entity.EntityLivingBase;
@ -36,7 +37,10 @@ public class ItemModLodestone extends ItemArmorMod {
@Override
public void modUpdate(EntityLivingBase entity, ItemStack armor) {
// No magnet if keybind toggled
if (entity instanceof EntityPlayer && !HbmPlayerProps.getData((EntityPlayer) entity).isMagnetActive()) return;
List<EntityItem> items = entity.worldObj.getEntitiesWithinAABB(EntityItem.class, entity.boundingBox.expand(range, range, range));
for(EntityItem item : items) {

View File

@ -5,7 +5,7 @@ import java.util.List;
import com.hbm.handler.ArmorModHandler;
import com.hbm.inventory.fluid.FluidType;
import api.hbm.fluid.IFillableItem;
import api.hbm.fluidmk2.IFillableItem;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;

View File

@ -12,7 +12,7 @@ import com.hbm.items.weapon.ItemGunBase;
import com.hbm.lib.ModDamageSource;
import com.hbm.potion.HbmPotion;
import api.hbm.fluid.IFillableItem;
import api.hbm.fluidmk2.IFillableItem;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import net.minecraft.entity.EntityLivingBase;

View File

@ -13,7 +13,7 @@ import com.hbm.packet.toclient.AuxParticlePacketNT;
import api.hbm.block.IToolable;
import api.hbm.block.IToolable.ToolType;
import api.hbm.fluid.IFillableItem;
import api.hbm.fluidmk2.IFillableItem;
import cpw.mods.fml.common.network.NetworkRegistry.TargetPoint;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;

View File

@ -1,12 +1,11 @@
package com.hbm.items.tool;
import api.hbm.fluid.IFillableItem;
import com.hbm.inventory.fluid.FluidType;
import com.hbm.inventory.fluid.Fluids;
import com.hbm.items.ModItems;
import com.hbm.util.I18nUtil;
import api.hbm.fluidmk2.IFillableItem;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;

View File

@ -5,7 +5,7 @@ import java.util.List;
import com.hbm.inventory.fluid.FluidType;
import api.hbm.fluid.IFillableItem;
import api.hbm.fluidmk2.IFillableItem;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import net.minecraft.entity.player.EntityPlayer;

View File

@ -10,6 +10,7 @@ import com.hbm.items.weapon.sedna.ItemGunBaseNT.SmokeNode;
import com.hbm.items.weapon.sedna.factory.GunStateDecider;
import com.hbm.items.weapon.sedna.factory.Lego;
import com.hbm.items.weapon.sedna.hud.IHUDComponent;
import com.hbm.items.weapon.sedna.mods.WeaponModManager;
import com.hbm.render.anim.BusAnimation;
import com.hbm.render.anim.HbmAnimations.AnimType;
@ -51,6 +52,7 @@ public class GunConfig {
/* FIELDS */
public int index;
/** List of receivers used by the gun, primary and secondary are usually indices 0 and 1 respectively, if applicable */
protected Receiver[] receivers_DNA;
protected float durability_DNA;
@ -83,32 +85,32 @@ public class GunConfig {
/* GETTERS */
public Receiver[] getReceivers(ItemStack stack) { return WeaponUpgradeManager.eval(receivers_DNA, stack, O_RECEIVERS, this); }
public float getDurability(ItemStack stack) { return WeaponUpgradeManager.eval(durability_DNA, stack, F_DURABILITY, this); }
public int getDrawDuration(ItemStack stack) { return WeaponUpgradeManager.eval(drawDuration_DNA, stack, I_DRAWDURATION, this); }
public int getInspectDuration(ItemStack stack) { return WeaponUpgradeManager.eval(inspectDuration_DNA, stack, I_INSPECTDURATION, this); }
public boolean getInspectCancel(ItemStack stack) { return WeaponUpgradeManager.eval(inspectCancel_DNA, stack, I_INSPECTCANCEL, this); }
public Crosshair getCrosshair(ItemStack stack) { return WeaponUpgradeManager.eval(crosshair_DNA, stack, O_CROSSHAIR, this); }
public boolean getHideCrosshair(ItemStack stack) { return WeaponUpgradeManager.eval(hideCrosshair_DNA, stack, B_HIDECROSSHAIR, this); }
public boolean getReloadAnimSequential(ItemStack stack) { return WeaponUpgradeManager.eval(reloadAnimationsSequential_DNA, stack, B_RELOADANIMATIONSEQUENTIAL, this); }
public ResourceLocation getScopeTexture(ItemStack stack) { return WeaponUpgradeManager.eval(scopeTexture_DNA, stack, O_SCOPETEXTURE, this); }
public BiConsumer<ItemStack, LambdaContext> getSmokeHandler(ItemStack stack) { return WeaponUpgradeManager.eval(smokeHandler_DNA, stack, CON_SMOKE, this); }
public BiConsumer<ItemStack, LambdaContext> getOrchestra(ItemStack stack) { return WeaponUpgradeManager.eval(this.orchestra_DNA, stack, CON_ORCHESTRA, this); }
public Receiver[] getReceivers(ItemStack stack) { return WeaponModManager.eval(receivers_DNA, stack, O_RECEIVERS, this); }
public float getDurability(ItemStack stack) { return WeaponModManager.eval(durability_DNA, stack, F_DURABILITY, this); }
public int getDrawDuration(ItemStack stack) { return WeaponModManager.eval(drawDuration_DNA, stack, I_DRAWDURATION, this); }
public int getInspectDuration(ItemStack stack) { return WeaponModManager.eval(inspectDuration_DNA, stack, I_INSPECTDURATION, this); }
public boolean getInspectCancel(ItemStack stack) { return WeaponModManager.eval(inspectCancel_DNA, stack, I_INSPECTCANCEL, this); }
public Crosshair getCrosshair(ItemStack stack) { return WeaponModManager.eval(crosshair_DNA, stack, O_CROSSHAIR, this); }
public boolean getHideCrosshair(ItemStack stack) { return WeaponModManager.eval(hideCrosshair_DNA, stack, B_HIDECROSSHAIR, this); }
public boolean getReloadAnimSequential(ItemStack stack) { return WeaponModManager.eval(reloadAnimationsSequential_DNA, stack, B_RELOADANIMATIONSEQUENTIAL, this); }
public ResourceLocation getScopeTexture(ItemStack stack) { return WeaponModManager.eval(scopeTexture_DNA, stack, O_SCOPETEXTURE, this); }
public BiConsumer<ItemStack, LambdaContext> getSmokeHandler(ItemStack stack) { return WeaponModManager.eval(smokeHandler_DNA, stack, CON_SMOKE, this); }
public BiConsumer<ItemStack, LambdaContext> getOrchestra(ItemStack stack) { return WeaponModManager.eval(this.orchestra_DNA, stack, CON_ORCHESTRA, this); }
public BiConsumer<ItemStack, LambdaContext> getPressPrimary(ItemStack stack) { return WeaponUpgradeManager.eval(this.onPressPrimary_DNA, stack, CON_ONPRESSPRIMARY, this); }
public BiConsumer<ItemStack, LambdaContext> getPressSecondary(ItemStack stack) { return WeaponUpgradeManager.eval(this.onPressSecondary_DNA, stack, CON_ONPRESSSECONDARY, this); }
public BiConsumer<ItemStack, LambdaContext> getPressTertiary(ItemStack stack) { return WeaponUpgradeManager.eval(this.onPressTertiary_DNA, stack, CON_ONPRESSTERTIARY, this); }
public BiConsumer<ItemStack, LambdaContext> getPressReload(ItemStack stack) { return WeaponUpgradeManager.eval(this.onPressReload_DNA, stack, CON_ONPRESSRELOAD, this); }
public BiConsumer<ItemStack, LambdaContext> getPressPrimary(ItemStack stack) { return WeaponModManager.eval(this.onPressPrimary_DNA, stack, CON_ONPRESSPRIMARY, this); }
public BiConsumer<ItemStack, LambdaContext> getPressSecondary(ItemStack stack) { return WeaponModManager.eval(this.onPressSecondary_DNA, stack, CON_ONPRESSSECONDARY, this); }
public BiConsumer<ItemStack, LambdaContext> getPressTertiary(ItemStack stack) { return WeaponModManager.eval(this.onPressTertiary_DNA, stack, CON_ONPRESSTERTIARY, this); }
public BiConsumer<ItemStack, LambdaContext> getPressReload(ItemStack stack) { return WeaponModManager.eval(this.onPressReload_DNA, stack, CON_ONPRESSRELOAD, this); }
public BiConsumer<ItemStack, LambdaContext> getReleasePrimary(ItemStack stack) { return WeaponUpgradeManager.eval(this.onReleasePrimary_DNA, stack, CON_ONRELEASEPRIMARY, this); }
public BiConsumer<ItemStack, LambdaContext> getReleaseSecondary(ItemStack stack) { return WeaponUpgradeManager.eval(this.onReleaseSecondary_DNA, stack, CON_ONRELEASESECONDARY, this); }
public BiConsumer<ItemStack, LambdaContext> getReleaseTertiary(ItemStack stack) { return WeaponUpgradeManager.eval(this.onReleaseTertiary_DNA, stack, CON_ONRELEASETERTIARY, this); }
public BiConsumer<ItemStack, LambdaContext> getReleaseReload(ItemStack stack) { return WeaponUpgradeManager.eval(this.onReleaseReload_DNA, stack, CON_ONRELEASERELOAD, this); }
public BiConsumer<ItemStack, LambdaContext> getReleasePrimary(ItemStack stack) { return WeaponModManager.eval(this.onReleasePrimary_DNA, stack, CON_ONRELEASEPRIMARY, this); }
public BiConsumer<ItemStack, LambdaContext> getReleaseSecondary(ItemStack stack) { return WeaponModManager.eval(this.onReleaseSecondary_DNA, stack, CON_ONRELEASESECONDARY, this); }
public BiConsumer<ItemStack, LambdaContext> getReleaseTertiary(ItemStack stack) { return WeaponModManager.eval(this.onReleaseTertiary_DNA, stack, CON_ONRELEASETERTIARY, this); }
public BiConsumer<ItemStack, LambdaContext> getReleaseReload(ItemStack stack) { return WeaponModManager.eval(this.onReleaseReload_DNA, stack, CON_ONRELEASERELOAD, this); }
public BiConsumer<ItemStack, LambdaContext> getDecider(ItemStack stack) { return WeaponUpgradeManager.eval(this.decider_DNA, stack, CON_DECIDER, this); }
public BiConsumer<ItemStack, LambdaContext> getDecider(ItemStack stack) { return WeaponModManager.eval(this.decider_DNA, stack, CON_DECIDER, this); }
public BiFunction<ItemStack, AnimType, BusAnimation> getAnims(ItemStack stack) { return WeaponUpgradeManager.eval(this.animations_DNA, stack, FUN_ANIMNATIONS, this); }
public IHUDComponent[] getHUDComponents(ItemStack stack) { return WeaponUpgradeManager.eval(this.hudComponents_DNA, stack, O_HUDCOMPONENTS, this); }
public BiFunction<ItemStack, AnimType, BusAnimation> getAnims(ItemStack stack) { return WeaponModManager.eval(this.animations_DNA, stack, FUN_ANIMNATIONS, this); }
public IHUDComponent[] getHUDComponents(ItemStack stack) { return WeaponModManager.eval(this.hudComponents_DNA, stack, O_HUDCOMPONENTS, this); }
/* SETTERS */

View File

@ -12,6 +12,7 @@ import com.hbm.items.IEquipReceiver;
import com.hbm.items.IKeybindReceiver;
import com.hbm.items.weapon.sedna.hud.IHUDComponent;
import com.hbm.items.weapon.sedna.mags.IMagazine;
import com.hbm.items.weapon.sedna.mods.WeaponModManager;
import com.hbm.lib.RefStrings;
import com.hbm.main.MainRegistry;
import com.hbm.packet.PacketDispatcher;
@ -97,7 +98,8 @@ public class ItemGunBaseNT extends Item implements IKeybindReceiver, IEquipRecei
public GunConfig getConfig(ItemStack stack, int index) {
GunConfig cfg = configs_DNA[index];
return WeaponUpgradeManager.eval(cfg, stack, O_GUNCONFIG + index, this);
if(stack == null) return cfg;
return WeaponModManager.eval(cfg, stack, O_GUNCONFIG + index, this);
}
public int getConfigCount() {
@ -109,6 +111,7 @@ public class ItemGunBaseNT extends Item implements IKeybindReceiver, IEquipRecei
this.configs_DNA = cfg;
this.quality = quality;
this.lastShot = new long[cfg.length];
for(int i = 0; i < cfg.length; i++) cfg[i].index = i;
if(quality == WeaponQuality.A_SIDE || quality == WeaponQuality.SPECIAL) this.setCreativeTab(MainRegistry.weaponTab);
if(quality == WeaponQuality.LEGENDARY || quality == WeaponQuality.SECRET) this.secrets.add(this);
this.setTextureName(RefStrings.MODID + ":gun_darter");
@ -157,6 +160,10 @@ public class ItemGunBaseNT extends Item implements IKeybindReceiver, IEquipRecei
case SECRET: list.add((BobMathUtil.getBlink() ? EnumChatFormatting.DARK_RED : EnumChatFormatting.RED) + "SECRET"); break;
case DEBUG: list.add((BobMathUtil.getBlink() ? EnumChatFormatting.YELLOW : EnumChatFormatting.GOLD) + "DEBUG"); break;
}
for(ItemStack upgrade : WeaponModManager.getUpgradeItems(stack)) {
list.add(EnumChatFormatting.YELLOW + upgrade.getDisplayName()); break;
}
}
@Override
@ -262,6 +269,7 @@ public class ItemGunBaseNT extends Item implements IKeybindReceiver, IEquipRecei
}
}
this.setIsAiming(stack, false);
this.setReloadCancel(stack, false);
return;
}

View File

@ -6,6 +6,7 @@ import java.util.function.BiFunction;
import com.hbm.items.weapon.sedna.ItemGunBaseNT.LambdaContext;
import com.hbm.items.weapon.sedna.factory.Lego;
import com.hbm.items.weapon.sedna.mags.IMagazine;
import com.hbm.items.weapon.sedna.mods.WeaponModManager;
import net.minecraft.item.ItemStack;
import net.minecraft.util.Vec3;
@ -84,36 +85,36 @@ public class Receiver {
protected BiConsumer<ItemStack, LambdaContext> onRecoil_DNA;
/* GETTERS */
public float getBaseDamage(ItemStack stack) { return WeaponUpgradeManager.eval(this.baseDamage_DNA, stack, F_BASEDAMAGE, this); }
public int getDelayAfterFire(ItemStack stack) { return WeaponUpgradeManager.eval(this.delayAfterFire_DNA, stack, I_DELAYAFTERFIRE, this); }
public int getDelayAfterDryFire(ItemStack stack) { return WeaponUpgradeManager.eval(this.delayAfterDryFire_DNA, stack, I_DELAYAFTERDRYFIRE, this); }
public int getRoundsPerCycle(ItemStack stack) { return WeaponUpgradeManager.eval(this.roundsPerCycle_DNA, stack, I_ROUNDSPERCYCLE, this); }
public float getInnateSpread(ItemStack stack) { return WeaponUpgradeManager.eval(this.spreadInnate_DNA, stack, F_SPRADINNATE, this); }
public float getAmmoSpread(ItemStack stack) { return WeaponUpgradeManager.eval(this.spreadMultAmmo_DNA, stack, F_SPREADAMMO, this); }
public float getHipfireSpread(ItemStack stack) { return WeaponUpgradeManager.eval(this.spreadPenaltyHipfire_DNA, stack, F_SPREADHIPFIRE, this); }
public float getDurabilitySpread(ItemStack stack) { return WeaponUpgradeManager.eval(this.spreadDurability_DNA, stack, F_SPREADDURABILITY, this); }
public boolean getRefireOnHold(ItemStack stack) { return WeaponUpgradeManager.eval(this.refireOnHold_DNA, stack, B_REFIREONHOLD, this); }
public boolean getRefireAfterDry(ItemStack stack) { return WeaponUpgradeManager.eval(this.refireAfterDry_DNA, stack, B_REFIREAFTERDRY, this); }
public boolean getDoesDryFire(ItemStack stack) { return WeaponUpgradeManager.eval(this.doesDryFire_DNA, stack, B_DOESDRYFIRE, this); }
public boolean getDoesDryFireAfterAuto(ItemStack stack) { return WeaponUpgradeManager.eval(this.doesDryFireAfterAuto_DNA, stack, B_DOESDRYFIREAFTERAUTO, this); }
public boolean getEjectOnFire(ItemStack stack) { return WeaponUpgradeManager.eval(this.ejectOnFire_DNA, stack, B_EJECTONFIRE, this); }
public boolean getReloadOnEmpty(ItemStack stack) { return WeaponUpgradeManager.eval(this.reloadOnEmpty_DNA, stack, B_RELOADONEMPTY, this); }
public int getReloadBeginDuration(ItemStack stack) { return WeaponUpgradeManager.eval(this.reloadBeginDuration_DNA, stack, I_RELOADBEGINDURATION, this); }
public int getReloadCycleDuration(ItemStack stack) { return WeaponUpgradeManager.eval(this.reloadCycleDuration_DNA, stack, I_RELOADCYCLEDURATION, this); }
public int getReloadEndDuration(ItemStack stack) { return WeaponUpgradeManager.eval(this.reloadEndDuration_DNA, stack, I_RELOADENDDURATION, this); }
public int getReloadCockOnEmptyPre(ItemStack stack) { return WeaponUpgradeManager.eval(this.reloadCockOnEmptyPre_DNA, stack, I_RELOADCOCKONEMPTYPRE, this); }
public int getReloadCockOnEmptyPost(ItemStack stack) { return WeaponUpgradeManager.eval(this.reloadCockOnEmptyPost_DNA, stack, I_RELOADCOCKONEMPTYPOST, this); }
public int getJamDuration(ItemStack stack) { return WeaponUpgradeManager.eval(this.jamDuration_DNA, stack, I_JAMDURATION, this); }
public String getFireSound(ItemStack stack) { return WeaponUpgradeManager.eval(this.fireSound_DNA, stack, S_FIRESOUND, this); }
public float getFireVolume(ItemStack stack) { return WeaponUpgradeManager.eval(this.fireVolume_DNA, stack, F_FIREVOLUME, this); }
public float getFirePitch(ItemStack stack) { return WeaponUpgradeManager.eval(this.firePitch_DNA, stack, F_FIREPITCH, this); }
public IMagazine getMagazine(ItemStack stack) { return WeaponUpgradeManager.eval(this.magazine_DNA, stack, O_MAGAZINE, this); }
public Vec3 getProjectileOffset(ItemStack stack) { return WeaponUpgradeManager.eval(this.projectileOffset_DNA, stack, O_PROJECTILEOFFSET, this); }
public Vec3 getProjectileOffsetScoped(ItemStack stack) { return WeaponUpgradeManager.eval(this.projectileOffsetScoped_DNA, stack, O_PROJECTILEOFFSETSCOPED, this); }
public float getBaseDamage(ItemStack stack) { return WeaponModManager.eval(this.baseDamage_DNA, stack, F_BASEDAMAGE, this); }
public int getDelayAfterFire(ItemStack stack) { return WeaponModManager.eval(this.delayAfterFire_DNA, stack, I_DELAYAFTERFIRE, this); }
public int getDelayAfterDryFire(ItemStack stack) { return WeaponModManager.eval(this.delayAfterDryFire_DNA, stack, I_DELAYAFTERDRYFIRE, this); }
public int getRoundsPerCycle(ItemStack stack) { return WeaponModManager.eval(this.roundsPerCycle_DNA, stack, I_ROUNDSPERCYCLE, this); }
public float getInnateSpread(ItemStack stack) { return WeaponModManager.eval(this.spreadInnate_DNA, stack, F_SPRADINNATE, this); }
public float getAmmoSpread(ItemStack stack) { return WeaponModManager.eval(this.spreadMultAmmo_DNA, stack, F_SPREADAMMO, this); }
public float getHipfireSpread(ItemStack stack) { return WeaponModManager.eval(this.spreadPenaltyHipfire_DNA, stack, F_SPREADHIPFIRE, this); }
public float getDurabilitySpread(ItemStack stack) { return WeaponModManager.eval(this.spreadDurability_DNA, stack, F_SPREADDURABILITY, this); }
public boolean getRefireOnHold(ItemStack stack) { return WeaponModManager.eval(this.refireOnHold_DNA, stack, B_REFIREONHOLD, this); }
public boolean getRefireAfterDry(ItemStack stack) { return WeaponModManager.eval(this.refireAfterDry_DNA, stack, B_REFIREAFTERDRY, this); }
public boolean getDoesDryFire(ItemStack stack) { return WeaponModManager.eval(this.doesDryFire_DNA, stack, B_DOESDRYFIRE, this); }
public boolean getDoesDryFireAfterAuto(ItemStack stack) { return WeaponModManager.eval(this.doesDryFireAfterAuto_DNA, stack, B_DOESDRYFIREAFTERAUTO, this); }
public boolean getEjectOnFire(ItemStack stack) { return WeaponModManager.eval(this.ejectOnFire_DNA, stack, B_EJECTONFIRE, this); }
public boolean getReloadOnEmpty(ItemStack stack) { return WeaponModManager.eval(this.reloadOnEmpty_DNA, stack, B_RELOADONEMPTY, this); }
public int getReloadBeginDuration(ItemStack stack) { return WeaponModManager.eval(this.reloadBeginDuration_DNA, stack, I_RELOADBEGINDURATION, this); }
public int getReloadCycleDuration(ItemStack stack) { return WeaponModManager.eval(this.reloadCycleDuration_DNA, stack, I_RELOADCYCLEDURATION, this); }
public int getReloadEndDuration(ItemStack stack) { return WeaponModManager.eval(this.reloadEndDuration_DNA, stack, I_RELOADENDDURATION, this); }
public int getReloadCockOnEmptyPre(ItemStack stack) { return WeaponModManager.eval(this.reloadCockOnEmptyPre_DNA, stack, I_RELOADCOCKONEMPTYPRE, this); }
public int getReloadCockOnEmptyPost(ItemStack stack) { return WeaponModManager.eval(this.reloadCockOnEmptyPost_DNA, stack, I_RELOADCOCKONEMPTYPOST, this); }
public int getJamDuration(ItemStack stack) { return WeaponModManager.eval(this.jamDuration_DNA, stack, I_JAMDURATION, this); }
public String getFireSound(ItemStack stack) { return WeaponModManager.eval(this.fireSound_DNA, stack, S_FIRESOUND, this); }
public float getFireVolume(ItemStack stack) { return WeaponModManager.eval(this.fireVolume_DNA, stack, F_FIREVOLUME, this); }
public float getFirePitch(ItemStack stack) { return WeaponModManager.eval(this.firePitch_DNA, stack, F_FIREPITCH, this); }
public IMagazine getMagazine(ItemStack stack) { return WeaponModManager.eval(this.magazine_DNA, stack, O_MAGAZINE, this); }
public Vec3 getProjectileOffset(ItemStack stack) { return WeaponModManager.eval(this.projectileOffset_DNA, stack, O_PROJECTILEOFFSET, this); }
public Vec3 getProjectileOffsetScoped(ItemStack stack) { return WeaponModManager.eval(this.projectileOffsetScoped_DNA, stack, O_PROJECTILEOFFSETSCOPED, this); }
public BiFunction<ItemStack, LambdaContext, Boolean> getCanFire(ItemStack stack) { return WeaponUpgradeManager.eval(this.canFire_DNA, stack, FUN_CANFIRE, this); }
public BiConsumer<ItemStack, LambdaContext> getOnFire(ItemStack stack) { return WeaponUpgradeManager.eval(this.onFire_DNA, stack, CON_ONFIRE, this); }
public BiConsumer<ItemStack, LambdaContext> getRecoil(ItemStack stack) { return WeaponUpgradeManager.eval(this.onRecoil_DNA, stack, CON_ONRECOIL, this); }
public BiFunction<ItemStack, LambdaContext, Boolean> getCanFire(ItemStack stack) { return WeaponModManager.eval(this.canFire_DNA, stack, FUN_CANFIRE, this); }
public BiConsumer<ItemStack, LambdaContext> getOnFire(ItemStack stack) { return WeaponModManager.eval(this.onFire_DNA, stack, CON_ONFIRE, this); }
public BiConsumer<ItemStack, LambdaContext> getRecoil(ItemStack stack) { return WeaponModManager.eval(this.onRecoil_DNA, stack, CON_ONRECOIL, this); }
/* SETTERS */
public Receiver dmg(float dmg) { this.baseDamage_DNA = dmg; return this; }

View File

@ -1,36 +0,0 @@
package com.hbm.items.weapon.sedna;
import net.minecraft.item.ItemStack;
/**
* The upgrade manager operates by scraping upgrades from a gun, then iterating over them and evaluating the given value, passing the modified value to successive mods.
* The way that mods stack (additive vs multiplicative) depends on the order the mod is installed in
*
* @author hbm
*/
public class WeaponUpgradeManager {
//TODO: add caching so this doesn't have to run 15 times per single action
public static ItemStack[] getUpgrades(ItemStack stack) {
return null; // TBI
}
/** Scrapes all upgrades, iterates over them and evaluates the given value. The parent (i.e. holder of the base value)
* is passed for context (so upgrades can differentiate primary and secondary receivers for example). Passing a null
* stack causes the base value to be returned. */
public static <T> T eval(T base, ItemStack stack, String key, Object parent) {
if(stack == null) return base;
ItemStack[] upgrades = getUpgrades(stack);
if(upgrades != null) for(ItemStack upgradeStack : upgrades) {
if(upgradeStack.getItem() instanceof IWeaponUpgrade) {
IWeaponUpgrade upgrade = (IWeaponUpgrade) upgradeStack.getItem();
base = upgrade.eval(base, upgradeStack, key, parent);
}
}
return base;
}
}

View File

@ -66,6 +66,8 @@ public class GunFactory {
XFactoryTurret.init();
XFactory10ga.init();
XFactory35800.init();
ModItems.weapon_mod_test = new ItemEnumMulti(EnumModTest.class, true, true).setUnlocalizedName("weapon_mod_test");
/// PROXY BULLSHIT ///
MainRegistry.proxy.registerGunCfg();
@ -81,7 +83,7 @@ public class GunFactory {
R762_SP, R762_FMJ, R762_JHP, R762_AP, R762_DU,
BMG50_SP, BMG50_FMJ, BMG50_JHP, BMG50_AP, BMG50_DU,
B75, B75_INC, B75_EXP,
G12_BP, G12_BP_MAGNUM, G12_BP_SLUG, G12, G12_SLUG, G12_FLECHETTE, G12_MAGNUM, G12_EXPLOSIVE, G12_PHOSPHORUS, //G12_ANTHRAX,
G12_BP, G12_BP_MAGNUM, G12_BP_SLUG, G12, G12_SLUG, G12_FLECHETTE, G12_MAGNUM, G12_EXPLOSIVE, G12_PHOSPHORUS,
G26_FLARE, G26_FLARE_SUPPLY, G26_FLARE_WEAPON,
G40_HE, G40_HEAT, G40_DEMO, G40_INC, G40_PHOSPHORUS,
ROCKET_HE, ROCKET_HEAT, ROCKET_DEMO, ROCKET_INC, ROCKET_PHOSPHORUS,
@ -91,6 +93,7 @@ public class GunFactory {
COIL_TUNGSTEN, COIL_FERROURANIUM,
NUKE_STANDARD, NUKE_DEMO, NUKE_HIGH, NUKE_TOTS, NUKE_HIVE,
G10, G10_SHRAPNEL, G10_DU, G10_SLUG,
R762_HE, BMG50_HE, G10_EXPLOSIVE
//ONLY ADD NEW ENTRIES AT THE BOTTOM TO AVOID SHIFTING!
;
@ -103,11 +106,11 @@ public class GunFactory {
P22_SP, P22_FMJ, P22_JHP, P22_AP,
P9_SP, P9_FMJ, P9_JHP, P9_AP,
R556_SP, R556_FMJ, R556_JHP, R556_AP,
R762_SP, R762_FMJ, R762_JHP, R762_AP, R762_DU,
BMG50_SP, BMG50_FMJ, BMG50_JHP, BMG50_AP, BMG50_DU,
R762_SP, R762_FMJ, R762_JHP, R762_AP, R762_DU, R762_HE,
BMG50_SP, BMG50_FMJ, BMG50_JHP, BMG50_AP, BMG50_DU, BMG50_HE,
B75, B75_INC, B75_EXP,
G12_BP, G12_BP_MAGNUM, G12_BP_SLUG, G12, G12_SLUG, G12_FLECHETTE, G12_MAGNUM, G12_EXPLOSIVE, G12_PHOSPHORUS,
G10, G10_SHRAPNEL, G10_DU, G10_SLUG,
G10, G10_SHRAPNEL, G10_DU, G10_SLUG, G10_EXPLOSIVE,
G26_FLARE, G26_FLARE_SUPPLY, G26_FLARE_WEAPON,
G40_HE, G40_HEAT, G40_DEMO, G40_INC, G40_PHOSPHORUS,
ROCKET_HE, ROCKET_HEAT, ROCKET_DEMO, ROCKET_INC, ROCKET_PHOSPHORUS,
@ -128,4 +131,8 @@ public class GunFactory {
M44_EQUESTRIAN, G12_EQUESTRIAN, BMG50_EQUESTRIAN,
P35_800
}
public static enum EnumModTest {
FIRERATE, DAMAGE, MULTI;
}
}

View File

@ -42,7 +42,8 @@ public class GunFactoryClient {
MinecraftForgeClient.registerItemRenderer(ModItems.gun_light_revolver, new ItemRenderAtlas(ResourceManager.bio_revolver_tex));
MinecraftForgeClient.registerItemRenderer(ModItems.gun_light_revolver_atlas, new ItemRenderAtlas(ResourceManager.bio_revolver_atlas_tex));
MinecraftForgeClient.registerItemRenderer(ModItems.gun_light_revolver_dani, new ItemRenderDANI());
MinecraftForgeClient.registerItemRenderer(ModItems.gun_henry, new ItemRenderHenry());
MinecraftForgeClient.registerItemRenderer(ModItems.gun_henry, new ItemRenderHenry(ResourceManager.henry_tex));
MinecraftForgeClient.registerItemRenderer(ModItems.gun_henry_lincoln, new ItemRenderHenry(ResourceManager.henry_lincoln_tex));
MinecraftForgeClient.registerItemRenderer(ModItems.gun_greasegun, new ItemRenderGreasegun());
MinecraftForgeClient.registerItemRenderer(ModItems.gun_maresleg, new ItemRenderMaresleg(ResourceManager.maresleg_tex));
MinecraftForgeClient.registerItemRenderer(ModItems.gun_maresleg_akimbo, new ItemRenderMareslegAkimbo());
@ -132,12 +133,14 @@ public class GunFactoryClient {
r762_jhp.setRenderer(LegoClient.RENDER_STANDARD_BULLET);
r762_ap.setRenderer(LegoClient.RENDER_AP_BULLET);
r762_du.setRenderer(LegoClient.RENDER_DU_BULLET);
r762_he.setRenderer(LegoClient.RENDER_HE_BULLET);
bmg50_sp.setRenderer(LegoClient.RENDER_STANDARD_BULLET);
bmg50_fmj.setRenderer(LegoClient.RENDER_STANDARD_BULLET);
bmg50_jhp.setRenderer(LegoClient.RENDER_STANDARD_BULLET);
bmg50_ap.setRenderer(LegoClient.RENDER_AP_BULLET);
bmg50_du.setRenderer(LegoClient.RENDER_DU_BULLET);
bmg50_he.setRenderer(LegoClient.RENDER_HE_BULLET);
b75.setRenderer(LegoClient.RENDER_AP_BULLET);
b75_inc.setRenderer(LegoClient.RENDER_AP_BULLET);
@ -168,6 +171,7 @@ public class GunFactoryClient {
g10_shrapnel.setRenderer(LegoClient.RENDER_STANDARD_BULLET);
g10_du.setRenderer(LegoClient.RENDER_DU_BULLET);
g10_slug.setRenderer(LegoClient.RENDER_STANDARD_BULLET);
g10_explosive.setRenderer(LegoClient.RENDER_HE_BULLET);
g26_flare.setRenderer(LegoClient.RENDER_FLARE);
g26_flare_supply.setRenderer(LegoClient.RENDER_FLARE_SUPPLY);
@ -204,6 +208,7 @@ public class GunFactoryClient {
((ItemGunBaseNT) ModItems.gun_light_revolver) .getConfig(null, 0).hud(LegoClient.HUD_COMPONENT_DURABILITY, LegoClient.HUD_COMPONENT_AMMO);
((ItemGunBaseNT) ModItems.gun_light_revolver_atlas) .getConfig(null, 0).hud(LegoClient.HUD_COMPONENT_DURABILITY, LegoClient.HUD_COMPONENT_AMMO);
((ItemGunBaseNT) ModItems.gun_henry) .getConfig(null, 0).hud(LegoClient.HUD_COMPONENT_DURABILITY, LegoClient.HUD_COMPONENT_AMMO);
((ItemGunBaseNT) ModItems.gun_henry_lincoln) .getConfig(null, 0).hud(LegoClient.HUD_COMPONENT_DURABILITY, LegoClient.HUD_COMPONENT_AMMO);
((ItemGunBaseNT) ModItems.gun_greasegun) .getConfig(null, 0).hud(LegoClient.HUD_COMPONENT_DURABILITY, LegoClient.HUD_COMPONENT_AMMO);
((ItemGunBaseNT) ModItems.gun_maresleg) .getConfig(null, 0).hud(LegoClient.HUD_COMPONENT_DURABILITY, LegoClient.HUD_COMPONENT_AMMO);
((ItemGunBaseNT) ModItems.gun_maresleg_broken) .getConfig(null, 0).hud(LegoClient.HUD_COMPONENT_AMMO);

View File

@ -10,6 +10,7 @@ import com.hbm.entity.projectile.EntityBulletBaseMK4CL;
import com.hbm.entity.projectile.EntityBulletBeamBase;
import com.hbm.explosion.vanillant.ExplosionVNT;
import com.hbm.explosion.vanillant.standard.EntityProcessorCrossSmooth;
import com.hbm.explosion.vanillant.standard.ExplosionEffectTiny;
import com.hbm.explosion.vanillant.standard.ExplosionEffectWeapon;
import com.hbm.explosion.vanillant.standard.PlayerProcessorStandard;
import com.hbm.interfaces.NotableComments;
@ -33,6 +34,7 @@ import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.util.MovingObjectPosition;
import net.minecraft.util.Vec3;
import net.minecraftforge.common.util.ForgeDirection;
/**
* "LEGO" - i.e. standardized building blocks which can be used to set up gun configs easily.
@ -283,6 +285,20 @@ public class Lego {
vnt.setSFX(new ExplosionEffectWeapon(10, 2.5F, 1F));
vnt.explode();
}
public static void tinyExplode(EntityBulletBaseMK4 bullet, MovingObjectPosition mop, float range) { tinyExplode(bullet, mop, range, 1F); }
public static void tinyExplode(EntityBulletBaseMK4 bullet, MovingObjectPosition mop, float range, float damageMod) {
ForgeDirection dir = ForgeDirection.getOrientation(mop.sideHit);
double x = mop.hitVec.xCoord + dir.offsetX * 0.25D;
double y = mop.hitVec.yCoord + dir.offsetY * 0.25D;
double z = mop.hitVec.zCoord + dir.offsetZ * 0.25D;
ExplosionVNT vnt = new ExplosionVNT(bullet.worldObj, x, y, z, range, bullet.getThrower());
vnt.setEntityProcessor(new EntityProcessorCrossSmooth(1, bullet.damage * damageMod)
.setupPiercing(bullet.config.armorThresholdNegation, bullet.config.armorPiercingPercent).setKnockback(0.25D));
vnt.setPlayerProcessor(new PlayerProcessorStandard());
vnt.setSFX(new ExplosionEffectTiny());
vnt.explode();
}
/** anims for the DEBUG revolver, mostly a copy of the li'lpip but with some fixes regarding the cylinder movement */
@SuppressWarnings("incomplete-switch") public static BiFunction<ItemStack, AnimType, BusAnimation> LAMBDA_DEBUG_ANIMS = (stack, type) -> {

View File

@ -62,6 +62,12 @@ public class LegoClient {
renderBulletStandard(Tessellator.instance, 0x5CCD41, 0xE9FF8D, length, false);
};
public static BiConsumer<EntityBulletBaseMK4, Float> RENDER_HE_BULLET = (bullet, interp) -> {
double length = bullet.prevVelocity + (bullet.velocity - bullet.prevVelocity) * interp;
if(length <= 0) return;
renderBulletStandard(Tessellator.instance, 0xD8CA00, 0xFFF19D, length, true);
};
public static BiConsumer<EntityBulletBaseMK4, Float> RENDER_TRACER_BULLET = (bullet, interp) -> {
double length = bullet.prevVelocity + (bullet.velocity - bullet.prevVelocity) * interp;
if(length <= 0) return;

View File

@ -3,6 +3,7 @@ package com.hbm.items.weapon.sedna.factory;
import java.util.function.BiConsumer;
import java.util.function.BiFunction;
import com.hbm.entity.projectile.EntityBulletBaseMK4;
import com.hbm.items.ModItems;
import com.hbm.items.ItemEnums.EnumCasingType;
import com.hbm.items.weapon.sedna.BulletConfig;
@ -22,6 +23,7 @@ import com.hbm.render.anim.BusAnimationKeyframe.IType;
import com.hbm.render.anim.HbmAnimations.AnimType;
import net.minecraft.item.ItemStack;
import net.minecraft.util.MovingObjectPosition;
public class XFactory10ga {
@ -29,6 +31,12 @@ public class XFactory10ga {
public static BulletConfig g10_shrapnel;
public static BulletConfig g10_du;
public static BulletConfig g10_slug;
public static BulletConfig g10_explosive;
public static BiConsumer<EntityBulletBaseMK4, MovingObjectPosition> LAMBDA_TINY_EXPLODE = (bullet, mop) -> {
if(mop.typeOfHit == mop.typeOfHit.ENTITY && bullet.ticksExisted < 3 && mop.entityHit == bullet.getThrower()) return;
Lego.tinyExplode(bullet, mop, 2F); bullet.setDead();
};
public static void init() {
@ -37,12 +45,13 @@ public class XFactory10ga {
g10_shrapnel = new BulletConfig().setItem(EnumAmmo.G10_SHRAPNEL).setCasing(EnumCasingType.BUCKSHOT_ADVANCED, 4).setProjectiles(10).setDamage(1F/10F).setSpread(buckshotSpread).setRicochetAngle(90).setRicochetCount(15).setThresholdNegation(5F).setCasing(new SpentCasing(CasingType.SHOTGUN).setColor(0xE5DD00, SpentCasing.COLOR_CASE_12GA).setScale(1F).register("10GAShrapnel"));
g10_du = new BulletConfig().setItem(EnumAmmo.G10_DU).setCasing(EnumCasingType.BUCKSHOT_ADVANCED, 4).setProjectiles(10).setDamage(1F/4F).setSpread(buckshotSpread).setRicochetAngle(15).setThresholdNegation(10F).setArmorPiercing(0.2F).setDoesPenetrate(true).setDamageFalloutByPen(false).setCasing(new SpentCasing(CasingType.SHOTGUN).setColor(0x538D53, SpentCasing.COLOR_CASE_12GA).setScale(1F).register("10GADU"));
g10_slug = new BulletConfig().setItem(EnumAmmo.G10_SLUG).setCasing(EnumCasingType.BUCKSHOT_ADVANCED, 4).setRicochetAngle(15).setThresholdNegation(10F).setArmorPiercing(0.1F).setDoesPenetrate(true).setCasing(new SpentCasing(CasingType.SHOTGUN).setColor(0x808080, SpentCasing.COLOR_CASE_12GA).setScale(1F).register("10GASlug"));
g10_explosive = new BulletConfig().setItem(EnumAmmo.G10_EXPLOSIVE).setCasing(EnumCasingType.BUCKSHOT_ADVANCED, 4).setWear(3F).setProjectiles(10).setDamage(1F/4F).setSpread(buckshotSpread).setCasing(new SpentCasing(CasingType.SHOTGUN).setColor(0xFAC943, SpentCasing.COLOR_CASE_12GA).setScale(1F).register("10GAEXP")).setOnImpact(LAMBDA_TINY_EXPLODE);
ModItems.gun_double_barrel = new ItemGunBaseNT(WeaponQuality.SPECIAL, new GunConfig()
.dura(1000).draw(10).inspect(39).crosshair(Crosshair.L_CIRCLE).smoke(Lego.LAMBDA_STANDARD_SMOKE)
.rec(new Receiver(0)
.dmg(30F).rounds(2).delay(10).reload(41).reloadOnEmpty(true).sound("hbm:weapon.fire.shotgun", 1.0F, 0.9F)
.mag(new MagazineFullReload(0, 2).addConfigs(g10, g10_shrapnel, g10_du, g10_slug))
.mag(new MagazineFullReload(0, 2).addConfigs(g10, g10_shrapnel, g10_du, g10_slug, g10_explosive))
.offset(0.75, -0.0625, -0.1875)
.setupStandardFire().recoil(LAMBDA_RECOIL_DOUBLE_BARREL))
.setupStandardConfiguration()
@ -52,7 +61,7 @@ public class XFactory10ga {
.dura(6000).draw(10).inspect(39).crosshair(Crosshair.L_CIRCLE).smoke(Lego.LAMBDA_STANDARD_SMOKE)
.rec(new Receiver(0)
.dmg(45F).spreadAmmo(1.35F).rounds(2).delay(10).reload(41).reloadOnEmpty(true).sound("hbm:weapon.fire.shotgun", 1.0F, 0.9F)
.mag(new MagazineFullReload(0, 2).addConfigs(g10, g10_shrapnel, g10_du, g10_slug))
.mag(new MagazineFullReload(0, 2).addConfigs(g10, g10_shrapnel, g10_du, g10_slug, g10_explosive))
.offset(0.75, -0.0625, -0.1875)
.setupStandardFire().recoil(LAMBDA_RECOIL_DOUBLE_BARREL))
.setupStandardConfiguration()

View File

@ -94,6 +94,16 @@ public class XFactory44 {
.setupStandardConfiguration()
.anim(LAMBDA_HENRY_ANIMS).orchestra(Orchestras.ORCHESTRA_HENRY)
).setUnlocalizedName("gun_henry");
ModItems.gun_henry_lincoln = new ItemGunBaseNT(WeaponQuality.B_SIDE, new GunConfig()
.dura(300).draw(15).inspect(23).reloadSequential(true).crosshair(Crosshair.CIRCLE).smoke(Lego.LAMBDA_STANDARD_SMOKE)
.rec(new Receiver(0)
.dmg(20F).spreadHipfire(0F).delay(20).reload(25, 11, 14, 8).jam(45).sound("hbm:weapon.fire.rifle", 1.0F, 1.25F)
.mag(new MagazineSingleReload(0, 14).addConfigs(m44_bp, m44_sp, m44_fmj, m44_jhp, m44_ap, m44_express))
.offset(0.75, -0.0625, -0.1875D)
.setupStandardFire().recoil(LAMBDA_RECOIL_HENRY))
.setupStandardConfiguration()
.anim(LAMBDA_HENRY_ANIMS).orchestra(Orchestras.ORCHESTRA_HENRY)
).setUnlocalizedName("gun_henry_lincoln");
ModItems.gun_heavy_revolver = new ItemGunBaseNT(WeaponQuality.A_SIDE, new GunConfig()
.dura(600).draw(10).inspect(23).crosshair(Crosshair.L_CLASSIC).smoke(Lego.LAMBDA_STANDARD_SMOKE)

View File

@ -3,6 +3,7 @@ package com.hbm.items.weapon.sedna.factory;
import java.util.function.BiConsumer;
import java.util.function.BiFunction;
import com.hbm.entity.projectile.EntityBulletBaseMK4;
import com.hbm.items.ModItems;
import com.hbm.items.ItemEnums.EnumCasingType;
import com.hbm.items.weapon.sedna.BulletConfig;
@ -22,6 +23,7 @@ import com.hbm.render.anim.BusAnimationKeyframe.IType;
import com.hbm.render.anim.HbmAnimations.AnimType;
import net.minecraft.item.ItemStack;
import net.minecraft.util.MovingObjectPosition;
public class XFactory50 {
@ -30,6 +32,12 @@ public class XFactory50 {
public static BulletConfig bmg50_jhp;
public static BulletConfig bmg50_ap;
public static BulletConfig bmg50_du;
public static BulletConfig bmg50_he;
public static BiConsumer<EntityBulletBaseMK4, MovingObjectPosition> LAMBDA_STANDARD_EXPLODE = (bullet, mop) -> {
if(mop.typeOfHit == mop.typeOfHit.ENTITY && bullet.ticksExisted < 3 && mop.entityHit == bullet.getThrower()) return;
Lego.tinyExplode(bullet, mop, 3.5F); bullet.setDead();
};
public static void init() {
SpentCasing casing762 = new SpentCasing(CasingType.BOTTLENECK).setColor(SpentCasing.COLOR_CASE_BRASS).setScale(1.5F);
@ -43,12 +51,14 @@ public class XFactory50 {
.setCasing(casing762.clone().setColor(SpentCasing.COLOR_CASE_44).register("bmg50ap"));
bmg50_du = new BulletConfig().setItem(EnumAmmo.BMG50_DU).setCasing(EnumCasingType.LARGE_STEEL, 12).setDoesPenetrate(true).setDamageFalloutByPen(false).setDamage(2.5F).setThresholdNegation(21F).setArmorPiercing(0.25F)
.setCasing(casing762.clone().setColor(SpentCasing.COLOR_CASE_44).register("bmg50du"));
bmg50_he = new BulletConfig().setItem(EnumAmmo.BMG50_HE).setCasing(EnumCasingType.LARGE_STEEL, 12).setWear(3F).setDoesPenetrate(true).setDamageFalloutByPen(false).setDamage(2F).setOnImpact(LAMBDA_STANDARD_EXPLODE)
.setCasing(casing762.clone().setColor(SpentCasing.COLOR_CASE_44).register("bmg50he"));
ModItems.gun_m2 = new ItemGunBaseNT(WeaponQuality.A_SIDE, new GunConfig()
.dura(3_000).draw(10).inspect(31).crosshair(Crosshair.L_CIRCLE).smoke(LAMBDA_SMOKE)
.rec(new Receiver(0)
.dmg(7.5F).delay(2).dry(10).auto(true).spread(0.005F).sound("hbm:turret.chekhov_fire", 1.0F, 1.0F)
.mag(new MagazineBelt().addConfigs(bmg50_sp, bmg50_fmj, bmg50_jhp, bmg50_ap, bmg50_du))
.mag(new MagazineBelt().addConfigs(bmg50_sp, bmg50_fmj, bmg50_jhp, bmg50_ap, bmg50_du, bmg50_he))
.offset(1, -0.0625 * 2.5, -0.25D)
.setupStandardFire().recoil(LAMBDA_RECOIL_M2))
.setupStandardConfiguration()

View File

@ -3,6 +3,7 @@ package com.hbm.items.weapon.sedna.factory;
import java.util.function.BiConsumer;
import java.util.function.BiFunction;
import com.hbm.entity.projectile.EntityBulletBaseMK4;
import com.hbm.items.ModItems;
import com.hbm.items.ItemEnums.EnumCasingType;
import com.hbm.items.weapon.sedna.BulletConfig;
@ -25,6 +26,7 @@ import com.hbm.render.anim.HbmAnimations.AnimType;
import com.hbm.util.DamageResistanceHandler.DamageClass;
import net.minecraft.item.ItemStack;
import net.minecraft.util.MovingObjectPosition;
public class XFactory762mm {
@ -33,10 +35,16 @@ public class XFactory762mm {
public static BulletConfig r762_jhp;
public static BulletConfig r762_ap;
public static BulletConfig r762_du;
public static BulletConfig r762_he;
public static BulletConfig energy_lacunae;
public static BulletConfig energy_lacunae_overcharge;
public static BulletConfig energy_lacunae_ir;
public static BiConsumer<EntityBulletBaseMK4, MovingObjectPosition> LAMBDA_TINY_EXPLODE = (bullet, mop) -> {
if(mop.typeOfHit == mop.typeOfHit.ENTITY && bullet.ticksExisted < 3 && mop.entityHit == bullet.getThrower()) return;
Lego.tinyExplode(bullet, mop, 2F); bullet.setDead();
};
public static void init() {
SpentCasing casing762 = new SpentCasing(CasingType.BOTTLENECK).setColor(SpentCasing.COLOR_CASE_BRASS);
@ -50,6 +58,8 @@ public class XFactory762mm {
.setCasing(casing762.clone().setColor(SpentCasing.COLOR_CASE_44).register("r762ap"));
r762_du = new BulletConfig().setItem(EnumAmmo.R762_DU).setCasing(EnumCasingType.SMALL_STEEL, 6).setDoesPenetrate(true).setDamageFalloutByPen(false).setDamage(2.5F).setThresholdNegation(15F).setArmorPiercing(0.25F)
.setCasing(casing762.clone().setColor(SpentCasing.COLOR_CASE_44).register("r762du"));
r762_he = new BulletConfig().setItem(EnumAmmo.R762_HE).setCasing(EnumCasingType.SMALL_STEEL, 6).setWear(3F).setDamage(2F).setOnImpact(LAMBDA_TINY_EXPLODE)
.setCasing(casing762.clone().setColor(SpentCasing.COLOR_CASE_44).register("r762he"));
energy_lacunae = new BulletConfig().setItem(EnumAmmo.CAPACITOR).setCasing(new ItemStack(ModItems.ingot_polymer, 2), 4 * 40).setupDamageClass(DamageClass.LASER).setBeam().setReloadCount(40).setSpread(0.0F).setLife(5).setRenderRotations(false).setOnBeamImpact(BulletConfig.LAMBDA_STANDARD_BEAM_HIT);
energy_lacunae_overcharge = new BulletConfig().setItem(EnumAmmo.CAPACITOR_OVERCHARGE).setCasing(new ItemStack(ModItems.ingot_polymer, 2), 4 * 40).setupDamageClass(DamageClass.LASER).setBeam().setReloadCount(40).setSpread(0.0F).setLife(5).setRenderRotations(false).setDoesPenetrate(true).setOnBeamImpact(BulletConfig.LAMBDA_STANDARD_BEAM_HIT);
@ -59,7 +69,7 @@ public class XFactory762mm {
.dura(3_000).draw(10).inspect(31).reloadSequential(true).crosshair(Crosshair.CIRCLE).smoke(LAMBDA_SMOKE)
.rec(new Receiver(0)
.dmg(15F).delay(5).dry(15).spread(0.0F).reload(30, 0, 15, 0).jam(60).sound("hbm:weapon.fire.blackPowder", 1.0F, 1.0F)
.mag(new MagazineFullReload(0, 14).addConfigs(r762_sp, r762_fmj, r762_jhp, r762_ap, r762_du))
.mag(new MagazineFullReload(0, 14).addConfigs(r762_sp, r762_fmj, r762_jhp, r762_ap, r762_du, r762_he))
.offset(1, -0.0625 * 2.5, -0.25D)
.setupStandardFire().recoil(LAMBDA_RECOIL_CARBINE))
.setupStandardConfiguration()
@ -70,7 +80,7 @@ public class XFactory762mm {
.dura(50_000).draw(20).inspect(20).crosshair(Crosshair.L_CIRCLE).smoke(LAMBDA_SMOKE)
.rec(new Receiver(0)
.dmg(6F).delay(1).auto(true).dry(15).spread(0.01F).sound("hbm:weapon.calShoot", 1.0F, 1.0F)
.mag(new MagazineBelt().addConfigs(r762_sp, r762_fmj, r762_jhp, r762_ap, r762_du))
.mag(new MagazineBelt().addConfigs(r762_sp, r762_fmj, r762_jhp, r762_ap, r762_du, r762_he))
.offset(1, -0.0625 * 2.5, -0.25D)
.setupStandardFire().recoil(LAMBDA_RECOIL_MINIGUN))
.setupStandardConfiguration()
@ -91,7 +101,7 @@ public class XFactory762mm {
.dura(5_000).draw(20).inspect(31).reloadSequential(true).crosshair(Crosshair.CIRCLE).smoke(LAMBDA_SMOKE)
.rec(new Receiver(0)
.dmg(30F).delay(25).dry(25).spread(0.0F).reload(43).jam(43).sound("hbm:weapon.fire.rifleHeavy", 1.0F, 1.0F)
.mag(new MagazineFullReload(0, 7).addConfigs(r762_sp, r762_fmj, r762_jhp, r762_ap, r762_du))
.mag(new MagazineFullReload(0, 7).addConfigs(r762_sp, r762_fmj, r762_jhp, r762_ap, r762_du, r762_he))
.offset(1, -0.0625 * 1.5, -0.25D)
.setupStandardFire().recoil(LAMBDA_RECOIL_CARBINE))
.setupStandardConfiguration()

View File

@ -13,7 +13,7 @@ import com.hbm.items.weapon.sedna.mags.IMagazine;
import com.hbm.items.weapon.sedna.mags.MagazineFluid;
import com.hbm.render.anim.HbmAnimations.AnimType;
import api.hbm.fluid.IFillableItem;
import api.hbm.fluidmk2.IFillableItem;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;

View File

@ -28,6 +28,7 @@ public class MagazineBelt implements IMagazine<BulletConfig> {
@Override
public void useUpAmmo(ItemStack stack, IInventory inventory, int amount) {
if(inventory == null) return;
BulletConfig first = this.getFirstConfig(stack, inventory);

View File

@ -1,14 +1,13 @@
package com.hbm.items.weapon.sedna;
package com.hbm.items.weapon.sedna.mods;
import net.minecraft.item.ItemStack;
public interface IWeaponUpgrade {
public interface IWeaponMod {
/** Lower numbers get installed and therefore evaluated first. Important when multiplicative and additive bonuses are supposed to stack */
public int getModPriority(ItemStack stack);
/** Which "slots" this upgrade occupies, can be any value, upgrades that have at least one matching slot are incompatible */
public String[] getSlots(ItemStack stack);
public int getModPriority();
public String[] getSlots();
/** The meat and bones of the upgrade eval. Requires the base value, the held gun, the value's
* identifier and the yet unmodified parent (i.e. if the value is part of the receiver, that receiver) */
public default <T> T eval(T base, ItemStack stack, String key, Object parent) { return base; }
public <T> T eval(T base, ItemStack gun, String key, Object parent);
}

View File

@ -0,0 +1,24 @@
package com.hbm.items.weapon.sedna.mods;
public abstract class WeaponModBase implements IWeaponMod {
public String[] slots;
public int priority = 0;
public WeaponModBase(int id, String... slots) { this.slots = slots; WeaponModManager.idToMod.put(id, this); }
public WeaponModBase setPriority(int priority) { this.priority = priority; return this; }
@Override public int getModPriority() { return priority; }
@Override public String[] getSlots() { return slots; }
/**
* Java generics are cool and all but once you actually get to use them, they suck ass.
* This piece of shit only exists to prevent double cast, casting from int to <T> would require (T) (Integer) int, which makes me want to vomit.
* Using this method here implicitly casts the int (or whatever it is) to Object, and Object can be cast to <T>.
* @param The value that needs to be cast
* @param Any value with the type that should be cast to
* @return
*/
public <T> T fagSlop(Object arg, T castTo) { return (T) arg; } //TODO: rename this to something more tactful
}

View File

@ -0,0 +1,159 @@
package com.hbm.items.weapon.sedna.mods;
import java.util.ArrayList;
import java.util.Comparator;
import java.util.HashMap;
import java.util.List;
import com.google.common.collect.HashBiMap;
import com.hbm.inventory.RecipesCommon.ComparableStack;
import com.hbm.items.ModItems;
import com.hbm.items.weapon.sedna.factory.GunFactory.EnumModTest;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
/**
* The mod manager operates by scraping upgrades from a gun, then iterating over them and evaluating the given value, passing the modified value to successive mods.
* The way that mods stack (additive vs multiplicative) depends on the order the mod is installed in
*
* @author hbm
*/
public class WeaponModManager {
public static final String KEY_MOD_LIST = "KEY_MOD_LIST";
/** Mapping of mods to IDs, keep the register order consistent! */
public static HashBiMap<Integer, IWeaponMod> idToMod = HashBiMap.create();
/** Mapping of mod items to mod definitions */
public static HashMap<ComparableStack, WeaponModDefinition> stackToMod = new HashMap();
/** Map for turning individual mods back into their item form, used when uninstaling mods */
public static HashMap<IWeaponMod, ItemStack> modToStack = new HashMap();
/** Assigns the IWeaponMod instances to items */
public static void init() {
/* ORDER MATTERS! */
/* CTOR contains registering to the ID_LIST, avoid reordering to prevent ID shifting! */
IWeaponMod TEST_FIRERATE = new WeaponModTestFirerate(0);
IWeaponMod TEST_DAMAGE = new WeaponModTestDamage(1);
IWeaponMod TEST_MULTI = new WeaponModTestMulti(2);
new WeaponModDefinition(new ItemStack(ModItems.weapon_mod_test, 1, EnumModTest.FIRERATE.ordinal())).addDefault(TEST_FIRERATE);
new WeaponModDefinition(new ItemStack(ModItems.weapon_mod_test, 1, EnumModTest.DAMAGE.ordinal())).addDefault(TEST_DAMAGE);
new WeaponModDefinition(new ItemStack(ModItems.weapon_mod_test, 1, EnumModTest.MULTI.ordinal())).addDefault(TEST_MULTI);
}
public static ItemStack[] getUpgradeItems(ItemStack stack) {
if(!stack.hasTagCompound()) return new ItemStack[0];
int[] modIds = stack.stackTagCompound.getIntArray(KEY_MOD_LIST);
if(modIds.length == 0) return new ItemStack[0];
ItemStack[] mods = new ItemStack[modIds.length];
for(int i = 0; i < mods.length; i++) {
IWeaponMod mod = idToMod.get(modIds[i]);
if(mod != null) {
mods[i] = mod != null ? modToStack.get(mod) : null;
if(mods[i] != null) mods[i] = mods[i].copy();
}
}
return mods;
}
/** Installs the supplied mods to the gun */
public static void install(ItemStack stack, ItemStack... mods) {
List<IWeaponMod> toInstall = new ArrayList();
ComparableStack gun = new ComparableStack(stack);
for(ItemStack mod : mods) {
if(mod == null) continue;
ComparableStack comp = new ComparableStack(mod);
WeaponModDefinition def = stackToMod.get(comp);
if(def != null) {
IWeaponMod forGun = def.modByGun.get(gun);
if(forGun != null) toInstall.add(forGun); //since this code only runs for upgrading, we can just indexOf because who cares
else {
forGun = def.modByGun.get(null);
if(forGun != null) toInstall.add(forGun);
}
}
}
if(toInstall.isEmpty()) return;
toInstall.sort(modSorter);
if(!stack.hasTagCompound()) stack.stackTagCompound = new NBTTagCompound();
int[] modIds = new int[toInstall.size()];
for(int i = 0; i < modIds.length; i++) modIds[i] = idToMod.inverse().get(toInstall.get(i));
stack.stackTagCompound.setIntArray(KEY_MOD_LIST, modIds);
}
/** Wipes all mods from the gun */
public static void uninstall(ItemStack stack) {
if(stack.hasTagCompound()) {
stack.stackTagCompound.removeTag(KEY_MOD_LIST);
//no need to clean up empty stackTagCompound because gun NBT is never empty anyway
}
}
public static boolean isApplicable(ItemStack gun, ItemStack mod, boolean checkMutex) {
if(gun == null || mod == null) return false; //if either stacks are null
WeaponModDefinition def = stackToMod.get(new ComparableStack(mod));
if(def == null) return false; //if the mod stack doesn't have a mod definition
IWeaponMod newMod = def.modByGun.get(new ComparableStack(gun));
if(newMod == null) newMod = def.modByGun.get(null); //if there's no per-gun mod, default to null key
if(newMod == null) return false; //if there's just no mod applicable
if(checkMutex) for(int i : gun.stackTagCompound.getIntArray(KEY_MOD_LIST)) {
IWeaponMod iMod = idToMod.get(i);
if(iMod != null) for(String mutex0 : newMod.getSlots()) for(String mutex1 : iMod.getSlots()) if(mutex0.equals(mutex1)) return false; //if any of the mod's slots are already taken
}
return true; //yippie!
}
public static Comparator<IWeaponMod> modSorter = new Comparator<IWeaponMod>() {
@Override
public int compare(IWeaponMod o1, IWeaponMod o2) {
return o2.getModPriority() - o1.getModPriority();
}
};
/** Scrapes all upgrades, iterates over them and evaluates the given value. The parent (i.e. holder of the base value)
* is passed for context (so upgrades can differentiate primary and secondary receivers for example). Passing a null
* stack causes the base value to be returned. */
public static <T> T eval(T base, ItemStack stack, String key, Object parent) {
if(stack == null) return base;
if(!stack.hasTagCompound()) return base;
for(int i : stack.stackTagCompound.getIntArray(KEY_MOD_LIST)) {
IWeaponMod mod = idToMod.get(i);
if(mod != null) base = mod.eval(base, stack, key, parent);
}
return base;
}
public static class WeaponModDefinition {
/** Holds the weapon mod handlers for each given gun. Key null refers to mods that apply to ALL guns that are otherwise not included. */
public HashMap<ComparableStack, IWeaponMod> modByGun = new HashMap();
public ItemStack stack;
public WeaponModDefinition(ItemStack stack) {
this.stack = stack;
stackToMod.put(new ComparableStack(stack), this);
}
public WeaponModDefinition addMod(ItemStack gun, IWeaponMod mod) { return addMod(new ComparableStack(gun), mod); }
public WeaponModDefinition addMod(Item gun, IWeaponMod mod) { return addMod(new ComparableStack(gun), mod); }
public WeaponModDefinition addMod(ComparableStack gun, IWeaponMod mod) {
modByGun.put(gun, mod);
modToStack.put(mod, stack);
return this;
}
public WeaponModDefinition addDefault(IWeaponMod mod) {
return addMod((ComparableStack) null, mod);
}
}
}

View File

@ -0,0 +1,22 @@
package com.hbm.items.weapon.sedna.mods;
import com.hbm.items.weapon.sedna.Receiver;
import net.minecraft.item.ItemStack;
public class WeaponModTestDamage extends WeaponModBase {
public WeaponModTestDamage(int id, String... slots) {
super(id, slots);
}
@Override
public <T> T eval(T base, ItemStack gun, String key, Object parent) {
if(parent instanceof Receiver && key == Receiver.F_BASEDAMAGE && base instanceof Float) {
return fagSlop((float) base * 1.5F, base);
}
return base;
}
}

View File

@ -0,0 +1,22 @@
package com.hbm.items.weapon.sedna.mods;
import com.hbm.items.weapon.sedna.Receiver;
import net.minecraft.item.ItemStack;
public class WeaponModTestFirerate extends WeaponModBase {
public WeaponModTestFirerate(int id, String... slots) {
super(id, slots);
}
@Override
public <T> T eval(T base, ItemStack gun, String key, Object parent) {
if(parent instanceof Receiver && key == Receiver.I_DELAYAFTERFIRE && base instanceof Integer) {
return fagSlop(Math.max((int) base / 2, 1), base);
}
return base;
}
}

View File

@ -0,0 +1,22 @@
package com.hbm.items.weapon.sedna.mods;
import com.hbm.items.weapon.sedna.Receiver;
import net.minecraft.item.ItemStack;
public class WeaponModTestMulti extends WeaponModBase {
public WeaponModTestMulti(int id, String... slots) {
super(id, slots);
}
@Override
public <T> T eval(T base, ItemStack gun, String key, Object parent) {
if(parent instanceof Receiver && key == Receiver.I_ROUNDSPERCYCLE && base instanceof Integer) {
return fagSlop((int) base * 3, base);
}
return base;
}
}

View File

@ -3,8 +3,9 @@ package com.hbm.lib;
import api.hbm.energymk2.IBatteryItem;
import api.hbm.energymk2.IEnergyConnectorBlock;
import api.hbm.energymk2.IEnergyConnectorMK2;
import api.hbm.fluid.IFluidConnector;
import api.hbm.fluid.IFluidConnectorBlock;
import api.hbm.fluidmk2.IFluidConnectorBlockMK2;
import api.hbm.fluidmk2.IFluidConnectorMK2;
import com.hbm.blocks.ModBlocks;
import com.hbm.entity.mob.EntityHunterChopper;
import com.hbm.entity.projectile.EntityChopperMine;
@ -83,8 +84,8 @@ public class Library {
Block b = world.getBlock(x, y, z);
if(b instanceof IFluidConnectorBlock) {
IFluidConnectorBlock con = (IFluidConnectorBlock) b;
if(b instanceof IFluidConnectorBlockMK2) {
IFluidConnectorBlockMK2 con = (IFluidConnectorBlockMK2) b;
if(con.canConnect(type, world, x, y, z, dir.getOpposite() /* machine's connecting side */))
return true;
@ -92,8 +93,8 @@ public class Library {
TileEntity te = world.getTileEntity(x, y, z);
if(te instanceof IFluidConnector) {
IFluidConnector con = (IFluidConnector) te;
if(te instanceof IFluidConnectorMK2) {
IFluidConnectorMK2 con = (IFluidConnectorMK2) te;
if(con.canConnect(type, dir.getOpposite() /* machine's connecting side */))
return true;

View File

@ -2038,6 +2038,7 @@ public class ClientProxy extends ServerProxy {
switch(key){
case JETPACK: return Minecraft.getMinecraft().gameSettings.keyBindJump.getIsKeyPressed();
case TOGGLE_JETPACK: return HbmKeybinds.jetpackKey.getIsKeyPressed();
case TOGGLE_MAGNET: return HbmKeybinds.magnetKey.getIsKeyPressed();
case TOGGLE_HEAD: return HbmKeybinds.hudKey.getIsKeyPressed();
case RELOAD: return HbmKeybinds.reloadKey.getIsKeyPressed();
case DASH: return HbmKeybinds.dashKey.getIsKeyPressed();

View File

@ -658,7 +658,6 @@ public class CraftingManager {
addRecipeAuto(new ItemStack(ModBlocks.absorber_green, 1), new Object[] { "ICI", "CPC", "ICI", 'I', ANY_PLASTIC.ingot(), 'C', ModItems.powder_desh_mix, 'P', ModBlocks.absorber_red });
addRecipeAuto(new ItemStack(ModBlocks.absorber_pink, 1), new Object[] { "ICI", "CPC", "ICI", 'I', BIGMT.ingot(), 'C', ModItems.powder_nitan_mix, 'P', ModBlocks.absorber_green });
addRecipeAuto(new ItemStack(ModBlocks.decon, 1), new Object[] { "BGB", "SAS", "BSB", 'B', BE.ingot(), 'G', Blocks.iron_bars, 'S', STEEL.ingot(), 'A', ModBlocks.absorber });
addRecipeAuto(new ItemStack(ModBlocks.machine_geo, 1), new Object[] { "ITI", "PCP", "ITI", 'I', DURA.ingot(), 'T', ModItems.thermo_element, 'P', CU.plateCast(), 'C', ModBlocks.red_wire_coated });
addRecipeAuto(new ItemStack(ModBlocks.machine_minirtg, 1), new Object[] { "LLL", "PPP", "TRT", 'L', PB.plate(), 'P', PU238.billet(), 'T', ModItems.thermo_element, 'R', ModItems.rtg_unit });
addRecipeAuto(new ItemStack(ModBlocks.machine_powerrtg, 1), new Object[] { "SRS", "PTP", "SRS", 'S', STAR.ingot(), 'R', ModItems.rtg_unit, 'P', PO210.billet(), 'T', TS.dust() });
@ -1056,10 +1055,6 @@ public class CraftingManager {
}
if(!GeneralConfig.enable528) {
addRecipeAuto(new ItemStack(ModBlocks.machine_spp_bottom), new Object[] { "MDM", "LCL", "LWL", 'M', MAGTUNG.ingot(), 'D', ModItems.plate_desh, 'L', PB.plate(), 'C', DictFrame.fromOne(ModItems.circuit, EnumCircuitType.ADVANCED), 'W', ModItems.coil_magnetized_tungsten });
addRecipeAuto(new ItemStack(ModBlocks.machine_spp_top), new Object[] { "LWL", "LCL", "MDM", 'M', MAGTUNG.ingot(), 'D', ModItems.plate_desh, 'L', PB.plate(), 'C', DictFrame.fromOne(ModItems.circuit, EnumCircuitType.ADVANCED), 'W', ModItems.coil_magnetized_tungsten });
addShapelessAuto(new ItemStack(ModBlocks.machine_spp_bottom), new Object[] { ModBlocks.machine_spp_top });
addShapelessAuto(new ItemStack(ModBlocks.machine_spp_top), new Object[] { ModBlocks.machine_spp_bottom });
addRecipeAuto(new ItemStack(ModBlocks.struct_launcher_core, 1), new Object[] { "SCS", "SIS", "BEB", 'S', ModBlocks.steel_scaffold, 'I', Blocks.iron_bars, 'C', DictFrame.fromOne(ModItems.circuit, EnumCircuitType.BASIC), 'B', ModBlocks.struct_launcher, 'E', ModBlocks.machine_battery });
addRecipeAuto(new ItemStack(ModBlocks.struct_launcher_core_large, 1), new Object[] { "SIS", "ICI", "BEB", 'S', DictFrame.fromOne(ModItems.circuit, EnumCircuitType.ADVANCED), 'I', Blocks.iron_bars, 'C', DictFrame.fromOne(ModItems.circuit, EnumCircuitType.ADVANCED), 'B', ModBlocks.struct_launcher, 'E', ModBlocks.machine_battery });
addRecipeAuto(new ItemStack(ModBlocks.struct_soyuz_core, 1), new Object[] { "CUC", "TST", "TBT", 'C', DictFrame.fromOne(ModItems.circuit, EnumCircuitType.ADVANCED), 'U', ModItems.upgrade_power_3, 'T', ModBlocks.barrel_steel, 'S', ModBlocks.steel_scaffold, 'B', ModBlocks.machine_lithium_battery });

View File

@ -33,6 +33,7 @@ import com.hbm.items.ItemEnums.EnumAchievementType;
import com.hbm.items.ModItems;
import com.hbm.items.tool.ItemFertilizer;
import com.hbm.items.weapon.ItemGenericGrenade;
import com.hbm.items.weapon.sedna.mods.WeaponModManager;
import com.hbm.lib.HbmWorld;
import com.hbm.lib.RefStrings;
import com.hbm.packet.PacketDispatcher;
@ -290,6 +291,7 @@ public class MainRegistry {
SiegeTier.registerTiers();
HazardRegistry.registerItems();
HazardRegistry.registerTrafos();
WeaponModManager.init();
OreDictManager oreMan = new OreDictManager();
MinecraftForge.EVENT_BUS.register(oreMan); //OreRegisterEvent

View File

@ -1093,6 +1093,9 @@ public class ModEventHandlerClient {
return null;
}
public static boolean renderLodeStar = false; // GENUINELY shut the fuck up i'm not kidding
public static long lastStarCheck = 0L;
@SideOnly(Side.CLIENT)
@SubscribeEvent(priority = EventPriority.LOWEST)
@ -1123,6 +1126,24 @@ public class ModEventHandlerClient {
world.provider.setSkyRenderer(new RenderNTMSkyboxChainloader(sky));
}
}
EntityPlayer player = Minecraft.getMinecraft().thePlayer;
long millis = System.currentTimeMillis();
if(lastStarCheck + 200 < millis) {
renderLodeStar = false; // GENUINELY shut the fuck up i'm not kidding
lastStarCheck = millis;
if(player != null) { // GENUINELY shut the fuck up i'm not kidding
Vec3NT pos = new Vec3NT(player.posX, player.posY, player.posZ); // GENUINELY shut the fuck up i'm not kidding
Vec3NT lodestarHeading = new Vec3NT(0, 0, -1D).rotateAroundXDeg(-15).multiply(25); // GENUINELY shut the fuck up i'm not kidding
Vec3NT nextPos = new Vec3NT(pos).add(lodestarHeading.xCoord,lodestarHeading.yCoord, lodestarHeading.zCoord); // GENUINELY shut the fuck up i'm not kidding
MovingObjectPosition mop = world.func_147447_a(pos, nextPos, false, true, false); // GENUINELY shut the fuck up i'm not kidding
if(mop != null && mop.typeOfHit == mop.typeOfHit.BLOCK && world.getBlock(mop.blockX, mop.blockY, mop.blockZ) == ModBlocks.glass_polarized) { // GENUINELY shut the fuck up i'm not kidding
renderLodeStar = true; // GENUINELY shut the fuck up i'm not kidding
}
}
}
}
if(event.phase == Phase.START) {
@ -1422,7 +1443,9 @@ public class ModEventHandlerClient {
}
}
if(event.phase == event.phase.END) ItemCustomLore.updateSystem();
if(event.phase == event.phase.END) {
ItemCustomLore.updateSystem();
}
}
@SubscribeEvent

View File

@ -821,40 +821,16 @@ public class ResourceManager {
public static final IModelCustom shimmer_sledge = AdvancedModelLoader.loadModel(new ResourceLocation(RefStrings.MODID, "models/shimmer_sledge.obj"));
public static final IModelCustom shimmer_axe = AdvancedModelLoader.loadModel(new ResourceLocation(RefStrings.MODID, "models/shimmer_axe.obj"));
public static final IModelCustom stopsign = AdvancedModelLoader.loadModel(new ResourceLocation(RefStrings.MODID, "models/weapons/stopsign.obj"));
public static final IModelCustom gavel = new HFRWavefrontObject(new ResourceLocation(RefStrings.MODID, "models/weapons/gavel.obj"));
public static final IModelCustom crucible = new HFRWavefrontObject(new ResourceLocation(RefStrings.MODID, "models/weapons/crucible.obj"));
public static final IModelCustom chainsaw = new HFRWavefrontObject(new ResourceLocation(RefStrings.MODID, "models/weapons/chainsaw.obj"), false);
public static final IModelCustom boltgun = new HFRWavefrontObject(new ResourceLocation(RefStrings.MODID, "models/weapons/boltgun.obj"));
public static final IModelCustom hk69 = new HFRWavefrontObject(new ResourceLocation(RefStrings.MODID, "models/weapons/hk69.obj"));
public static final IModelCustom deagle = new HFRWavefrontObject(new ResourceLocation(RefStrings.MODID, "models/weapons/deagle.obj"));
public static final IModelCustom shotty = new HFRWavefrontObject(new ResourceLocation(RefStrings.MODID, "models/weapons/supershotty.obj"));
public static final IModelCustom ks23 = new HFRWavefrontObject(new ResourceLocation(RefStrings.MODID, "models/weapons/ks23.obj"));
public static final IModelCustom flechette = new HFRWavefrontObject(new ResourceLocation(RefStrings.MODID, "models/weapons/flechette.obj"));
public static final IModelCustom sauergun = new HFRWavefrontObject(new ResourceLocation(RefStrings.MODID, "models/weapons/sauergun.obj"));
public static final IModelCustom vortex = new HFRWavefrontObject(new ResourceLocation(RefStrings.MODID, "models/weapons/vortex.obj"));
public static final IModelCustom thompson = new HFRWavefrontObject(new ResourceLocation(RefStrings.MODID, "models/weapons/thompson.obj"));
public static final IModelCustom bolter = new HFRWavefrontObject(new ResourceLocation(RefStrings.MODID, "models/weapons/bolter.obj"));
public static final IModelCustom ff_python = new HFRWavefrontObject(new ResourceLocation(RefStrings.MODID, "models/weapons/python.obj"));
public static final IModelCustom ff_maresleg = new HFRWavefrontObject(new ResourceLocation(RefStrings.MODID, "models/weapons/maresleg.obj"));
public static final IModelCustom gavel = new HFRWavefrontObject(new ResourceLocation(RefStrings.MODID, "models/weapons/gavel.obj")).asVBO();
public static final IModelCustom crucible = new HFRWavefrontObject(new ResourceLocation(RefStrings.MODID, "models/weapons/crucible.obj")).asVBO();
public static final IModelCustom chainsaw = new HFRWavefrontObject(new ResourceLocation(RefStrings.MODID, "models/weapons/chainsaw.obj"), false).asVBO();
public static final IModelCustom boltgun = new HFRWavefrontObject(new ResourceLocation(RefStrings.MODID, "models/weapons/boltgun.obj")).asVBO();
public static final IModelCustom bolter = new HFRWavefrontObject(new ResourceLocation(RefStrings.MODID, "models/weapons/bolter.obj")).asVBO();
public static final IModelCustom detonator_laser = new HFRWavefrontObject(new ResourceLocation(RefStrings.MODID, "models/weapons/detonator_laser.obj")).asVBO();
public static final IModelCustom fireext = new HFRWavefrontObject(new ResourceLocation(RefStrings.MODID, "models/weapons/fireext.obj")).asVBO();
public static final IModelCustom ff_nightmare = new HFRWavefrontObject(new ResourceLocation(RefStrings.MODID, "models/weapons/nightmare.obj"));
public static final IModelCustom fireext = new HFRWavefrontObject(new ResourceLocation(RefStrings.MODID, "models/weapons/fireext.obj"));
public static final IModelCustom ar15 = new HFRWavefrontObject(new ResourceLocation(RefStrings.MODID, "models/weapons/ar15.obj"));
public static final IModelCustom mg42 = new HFRWavefrontObject(new ResourceLocation(RefStrings.MODID, "models/weapons/mg42.obj"));
public static final IModelCustom rem700 = new HFRWavefrontObject(new ResourceLocation(RefStrings.MODID, "models/weapons/rem700.obj"));
public static final IModelCustom rem700poly = new HFRWavefrontObject(new ResourceLocation(RefStrings.MODID, "models/weapons/rem700poly.obj"));
public static final IModelCustom rem700sat = new HFRWavefrontObject(new ResourceLocation(RefStrings.MODID, "models/weapons/rem700sat.obj"));
public static final IModelCustom cursed_revolver = new HFRWavefrontObject(new ResourceLocation(RefStrings.MODID, "models/weapons/cursed.obj"));
public static final IModelCustom detonator_laser = new HFRWavefrontObject(new ResourceLocation(RefStrings.MODID, "models/weapons/detonator_laser.obj"));
public static final IModelCustom remington = new HFRWavefrontObject(new ResourceLocation(RefStrings.MODID, "models/weapons/remington.obj"));
public static final IModelCustom nightmare_dark = new HFRWavefrontObject(new ResourceLocation(RefStrings.MODID, "models/weapons/nightmare_dark.obj"));
public static final IModelCustom glass_cannon = new HFRWavefrontObject(new ResourceLocation(RefStrings.MODID, "models/weapons/glass_cannon.obj"));
public static final IModelCustom novac = new HFRWavefrontObject(new ResourceLocation(RefStrings.MODID, "models/weapons/novac.obj"));
public static final IModelCustom lunatic_sniper = new HFRWavefrontObject(new ResourceLocation(RefStrings.MODID, "models/weapons/lunatic_sniper.obj")).asVBO();
public static final IModelCustom benelli = new HFRWavefrontObject(new ResourceLocation(RefStrings.MODID, "models/weapons/benelli_new.obj")).asVBO();
public static final IModelCustom coilgun = new HFRWavefrontObject(new ResourceLocation(RefStrings.MODID, "models/weapons/coilgun.obj")).asVBO();
public static final IModelCustom cryocannon = new HFRWavefrontObject(new ResourceLocation(RefStrings.MODID, "models/weapons/cryo_cannon.obj")).asVBO();
public static final IModelCustom uac_pistol = new HFRWavefrontObject(new ResourceLocation(RefStrings.MODID, "models/weapons/UAC pistol.obj")).asVBO();
public static final IModelCustom pepperbox = new HFRWavefrontObject(new ResourceLocation(RefStrings.MODID, "models/weapons/pepperbox.obj")).asVBO();
public static final IModelCustom bio_revolver = new HFRWavefrontObject(new ResourceLocation(RefStrings.MODID, "models/weapons/bio_revolver.obj")).asVBO();
@ -891,13 +867,7 @@ public class ResourceManager {
public static final IModelCustom aberrator = new HFRWavefrontObject(new ResourceLocation(RefStrings.MODID, "models/weapons/aberrator.obj")).asVBO();
public static final IModelCustom mas36 = new HFRWavefrontObject(new ResourceLocation(RefStrings.MODID, "models/weapons/mas36.obj")).asVBO();
public static final HashMap<String, BusAnimation> python_anim = AnimationLoader.load(new ResourceLocation(RefStrings.MODID, "models/weapons/animations/python.json"));
public static final HashMap<String, BusAnimation> cursed_anim = AnimationLoader.load(new ResourceLocation(RefStrings.MODID, "models/weapons/animations/cursed.json"));
public static final HashMap<String, BusAnimation> novac_anim = AnimationLoader.load(new ResourceLocation(RefStrings.MODID, "models/weapons/animations/novac.json"));
public static final HashMap<String, BusAnimation> ks23_anim = AnimationLoader.load(new ResourceLocation(RefStrings.MODID, "models/weapons/animations/ks23.json"));
public static final HashMap<String, BusAnimation> spas_12_anim = AnimationLoader.load(new ResourceLocation(RefStrings.MODID, "models/weapons/animations/spas12.json"));
public static final HashMap<String, BusAnimation> supershotty_anim = AnimationLoader.load(new ResourceLocation(RefStrings.MODID, "models/weapons/animations/supershotty.json"));
public static final HashMap<String, BusAnimation> benelli_anim = AnimationLoader.load(new ResourceLocation(RefStrings.MODID, "models/weapons/animations/benelli.json"));
public static final HashMap<String, BusAnimation> congolake_anim = AnimationLoader.load(new ResourceLocation(RefStrings.MODID, "models/weapons/animations/congolake.json"));
public static final HashMap<String, BusAnimation> am180_anim = AnimationLoader.load(new ResourceLocation(RefStrings.MODID, "models/weapons/animations/am180.json"));
public static final HashMap<String, BusAnimation> flamethrower_anim = AnimationLoader.load(new ResourceLocation(RefStrings.MODID, "models/weapons/animations/flamethrower.json"));
@ -948,51 +918,19 @@ public class ResourceManager {
public static final ResourceLocation chainsaw_tex = new ResourceLocation(RefStrings.MODID, "textures/models/weapons/chainsaw.png");
public static final ResourceLocation boltgun_tex = new ResourceLocation(RefStrings.MODID, "textures/models/weapons/boltgun.png");
public static final ResourceLocation hk69_tex = new ResourceLocation(RefStrings.MODID, "textures/models/weapons/hk69.png");
public static final ResourceLocation deagle_tex = new ResourceLocation(RefStrings.MODID, "textures/models/weapons/deagle.png");
public static final ResourceLocation ks23_tex = new ResourceLocation(RefStrings.MODID, "textures/models/weapons/ks23.png");
public static final ResourceLocation shotty_tex = new ResourceLocation(RefStrings.MODID, "textures/models/weapons/shotty.png");
public static final ResourceLocation flechette_body = new ResourceLocation(RefStrings.MODID, "textures/models/weapons/flechette_body.png");
public static final ResourceLocation flechette_barrel = new ResourceLocation(RefStrings.MODID, "textures/models/weapons/flechette_barrel.png");
public static final ResourceLocation flechette_gren_tube = new ResourceLocation(RefStrings.MODID, "textures/models/weapons/flechette_gren_tube.png");
public static final ResourceLocation flechette_grenades = new ResourceLocation(RefStrings.MODID, "textures/models/weapons/flechette_grenades.png");
public static final ResourceLocation flechette_pivot = new ResourceLocation(RefStrings.MODID, "textures/models/weapons/flechette_pivot.png");
public static final ResourceLocation flechette_top = new ResourceLocation(RefStrings.MODID, "textures/models/weapons/flechette_top.png");
public static final ResourceLocation flechette_chamber = new ResourceLocation(RefStrings.MODID, "textures/models/weapons/flechette_chamber.png");
public static final ResourceLocation flechette_base = new ResourceLocation(RefStrings.MODID, "textures/models/weapons/flechette_base.png");
public static final ResourceLocation flechette_drum = new ResourceLocation(RefStrings.MODID, "textures/models/weapons/flechette_drum.png");
public static final ResourceLocation flechette_trigger = new ResourceLocation(RefStrings.MODID, "textures/models/weapons/flechette_trigger.png");
public static final ResourceLocation flechette_stock = new ResourceLocation(RefStrings.MODID, "textures/models/weapons/flechette_stock.png");
public static final ResourceLocation sauergun_tex = new ResourceLocation(RefStrings.MODID, "textures/models/weapons/sauergun.png");
public static final ResourceLocation vortex_tex = new ResourceLocation(RefStrings.MODID, "textures/models/weapons/vortex.png");
public static final ResourceLocation thompson_tex = new ResourceLocation(RefStrings.MODID, "textures/models/weapons/thompson.png");
public static final ResourceLocation bolter_tex = new ResourceLocation(RefStrings.MODID, "textures/models/weapons/bolter.png");
public static final ResourceLocation bolter_digamma_tex = new ResourceLocation(RefStrings.MODID, "textures/models/weapons/bolter_digamma.png");
public static final ResourceLocation fireext_tex = new ResourceLocation(RefStrings.MODID, "textures/models/weapons/fireext_normal.png");
public static final ResourceLocation fireext_foam_tex = new ResourceLocation(RefStrings.MODID, "textures/models/weapons/fireext_foam.png");
public static final ResourceLocation fireext_sand_tex = new ResourceLocation(RefStrings.MODID, "textures/models/weapons/fireext_sand.png");
public static final ResourceLocation ar15_tex = new ResourceLocation(RefStrings.MODID, "textures/models/weapons/carbine.png");
public static final ResourceLocation stinger_tex = new ResourceLocation(RefStrings.MODID, "textures/models/weapons/stinger.png");
public static final ResourceLocation sky_stinger_tex = new ResourceLocation(RefStrings.MODID, "textures/models/weapons/sky_stinger.png");
public static final ResourceLocation mg42_tex = new ResourceLocation(RefStrings.MODID, "textures/models/weapons/ff/mg42.png");
public static final ResourceLocation rem700_tex = new ResourceLocation(RefStrings.MODID, "textures/models/weapons/ff/rem700.png");
public static final ResourceLocation rem700poly_tex = new ResourceLocation(RefStrings.MODID, "textures/models/weapons/ff/rem700poly.png");
public static final ResourceLocation rem700sat_tex = new ResourceLocation(RefStrings.MODID, "textures/models/weapons/ff/rem700sat.png");
public static final ResourceLocation detonator_laser_tex = new ResourceLocation(RefStrings.MODID, "textures/models/weapons/detonator_laser.png");
public static final ResourceLocation remington_tex = new ResourceLocation(RefStrings.MODID, "textures/models/weapons/remington.png");
public static final ResourceLocation spas_12_tex = new ResourceLocation(RefStrings.MODID, "textures/models/weapons/spas-12.png");
public static final ResourceLocation glass_cannon_panel_tex = new ResourceLocation(RefStrings.MODID, "textures/models/weapons/glass_cannon_panel.png");
public static final ResourceLocation chemthrower_tex = new ResourceLocation(RefStrings.MODID, "textures/models/weapons/chemthrower.png");
public static final ResourceLocation novac_tex = new ResourceLocation(RefStrings.MODID, "textures/models/weapons/novac.png");
public static final ResourceLocation blackjack_tex = new ResourceLocation(RefStrings.MODID, "textures/models/weapons/blackjack.png");
public static final ResourceLocation lent_gun_tex = new ResourceLocation(RefStrings.MODID, "textures/models/weapons/lent_gun.png");
public static final ResourceLocation red_key_tex = new ResourceLocation(RefStrings.MODID, "textures/models/weapons/red_key.png");
public static final ResourceLocation m2_tex = new ResourceLocation(RefStrings.MODID, "textures/models/weapons/m2_browning.png");
public static final ResourceLocation lunatic_sniper_tex = new ResourceLocation(RefStrings.MODID, "textures/models/weapons/lunatic_sniper.png");
public static final ResourceLocation benelli_tex = new ResourceLocation(RefStrings.MODID, "textures/models/weapons/benelli_tex.png");
public static final ResourceLocation coilgun_tex = new ResourceLocation(RefStrings.MODID, "textures/models/weapons/coilgun.png");
public static final ResourceLocation cryocannon_tex = new ResourceLocation(RefStrings.MODID, "textures/models/weapons/cryo_cannon.png");
public static final ResourceLocation uac_pistol_tex = new ResourceLocation(RefStrings.MODID, "textures/models/weapons/pistol_texture.png");
public static final ResourceLocation congolake_tex = new ResourceLocation(RefStrings.MODID, "textures/models/weapons/congolake.png");
public static final ResourceLocation debug_gun_tex = new ResourceLocation(RefStrings.MODID, "textures/models/weapons/debug_gun.png");
@ -1002,6 +940,7 @@ public class ResourceManager {
public static final ResourceLocation dani_celestial_tex = new ResourceLocation(RefStrings.MODID, "textures/models/weapons/dani_celestial.png");
public static final ResourceLocation dani_lunar_tex = new ResourceLocation(RefStrings.MODID, "textures/models/weapons/dani_lunar.png");
public static final ResourceLocation henry_tex = new ResourceLocation(RefStrings.MODID, "textures/models/weapons/henry.png");
public static final ResourceLocation henry_lincoln_tex = new ResourceLocation(RefStrings.MODID, "textures/models/weapons/henry_lincoln.png");
public static final ResourceLocation greasegun_tex = new ResourceLocation(RefStrings.MODID, "textures/models/weapons/greasegun.png");
public static final ResourceLocation maresleg_tex = new ResourceLocation(RefStrings.MODID, "textures/models/weapons/maresleg.png");
public static final ResourceLocation maresleg_broken_tex = new ResourceLocation(RefStrings.MODID, "textures/models/weapons/maresleg_broken.png");
@ -1044,19 +983,9 @@ public class ResourceManager {
public static final ResourceLocation lance_tex = new ResourceLocation(RefStrings.MODID, "textures/models/weapons/lance.png");
public static final ResourceLocation ff_gold = new ResourceLocation(RefStrings.MODID, "textures/models/weapons/ff/gold.png");
public static final ResourceLocation ff_gun_bright = new ResourceLocation(RefStrings.MODID, "textures/models/weapons/ff/gun_bright.png");
public static final ResourceLocation ff_gun_dark = new ResourceLocation(RefStrings.MODID, "textures/models/weapons/ff/gun_dark.png");
public static final ResourceLocation ff_gun_normal = new ResourceLocation(RefStrings.MODID, "textures/models/weapons/ff/gun_normal.png");
public static final ResourceLocation ff_iron = new ResourceLocation(RefStrings.MODID, "textures/models/weapons/ff/iron.png");
public static final ResourceLocation ff_lead = new ResourceLocation(RefStrings.MODID, "textures/models/weapons/ff/lead.png");
public static final ResourceLocation ff_saturnite = new ResourceLocation(RefStrings.MODID, "textures/models/weapons/ff/saturnite.png");
public static final ResourceLocation ff_schrabidium = new ResourceLocation(RefStrings.MODID, "textures/models/weapons/ff/schrabidium.png");
public static final ResourceLocation ff_wood = new ResourceLocation(RefStrings.MODID, "textures/models/weapons/ff/wood.png");
public static final ResourceLocation ff_wood_red = new ResourceLocation(RefStrings.MODID, "textures/models/weapons/ff/wood_red.png");
public static final ResourceLocation ff_cursed = new ResourceLocation(RefStrings.MODID, "textures/models/weapons/ff/cursed.png");
public static final ResourceLocation ff_nightmare_tex = new ResourceLocation(RefStrings.MODID, "textures/models/weapons/ff/nightmare.png");
public static final ResourceLocation ff_nightmare_orig_tex = new ResourceLocation(RefStrings.MODID, "textures/models/weapons/ff/nightmare_orig.png");
public static final ResourceLocation grenade_mk2 = new ResourceLocation(RefStrings.MODID, "textures/models/weapons/grenade_mk2.png");
public static final ResourceLocation grenade_aschrab_tex = new ResourceLocation(RefStrings.MODID, "textures/models/weapons/grenade_aschrab.png");

View File

@ -21,12 +21,13 @@ public class ServerProxy {
public static final int ID_CABLE = 3;
public static final int ID_DRONE = 4;
public static final int ID_JETPACK = 5;
public static final int ID_HUD = 6;
public static final int ID_DETONATOR = 7;
public static final int ID_FLUID_ID = 8;
public static final int ID_TOOLABILITY = 9;
public static final int ID_GUN_MODE = 10;
public static final int ID_GAS_HAZARD = 11;
public static final int ID_MAGNET = 6;
public static final int ID_HUD = 7;
public static final int ID_DETONATOR = 8;
public static final int ID_FLUID_ID = 9;
public static final int ID_TOOLABILITY = 10;
public static final int ID_GUN_MODE = 11;
public static final int ID_GAS_HAZARD = 12;
public void registerPreRenderInfo() { }
public void registerRenderInfo() { }

View File

@ -991,8 +991,6 @@ public class ItemRenderLibrary {
ResourceManager.rbmk_crane_console.renderPart("JoyStick");
ResourceManager.rbmk_crane_console.renderPart("Meter1");
ResourceManager.rbmk_crane_console.renderPart("Meter2");
bindTexture(ResourceManager.ks23_tex); ResourceManager.rbmk_crane_console.renderPart("Shotgun");
bindTexture(ResourceManager.mini_nuke_tex); ResourceManager.rbmk_crane_console.renderPart("MiniNuke");
GL11.glShadeModel(GL11.GL_FLAT);
}});

View File

@ -8,8 +8,15 @@ import com.hbm.render.anim.HbmAnimations;
import net.minecraft.client.Minecraft;
import net.minecraft.item.ItemStack;
import net.minecraft.util.ResourceLocation;
public class ItemRenderHenry extends ItemRenderWeaponBase {
public ResourceLocation texture;
public ItemRenderHenry(ResourceLocation texture) {
this.texture = texture;
}
@Override
protected float getTurnMagnitude(ItemStack stack) { return ItemGunBaseNT.getIsAiming(stack) ? 2.5F : -0.5F; }
@ -38,7 +45,7 @@ public class ItemRenderHenry extends ItemRenderWeaponBase {
public void renderFirstPerson(ItemStack stack) {
ItemGunBaseNT gun = (ItemGunBaseNT) stack.getItem();
Minecraft.getMinecraft().renderEngine.bindTexture(ResourceManager.henry_tex);
Minecraft.getMinecraft().renderEngine.bindTexture(texture);
double scale = 0.375D;
GL11.glScaled(scale, scale, scale);
@ -150,7 +157,7 @@ public class ItemRenderHenry extends ItemRenderWeaponBase {
GL11.glEnable(GL11.GL_LIGHTING);
GL11.glShadeModel(GL11.GL_SMOOTH);
Minecraft.getMinecraft().renderEngine.bindTexture(ResourceManager.henry_tex);
Minecraft.getMinecraft().renderEngine.bindTexture(texture);
ResourceManager.henry.renderAll();
GL11.glShadeModel(GL11.GL_FLAT);
}

View File

@ -76,9 +76,9 @@ public class ItemRenderMAS36 extends ItemRenderWeaponBase {
GL11.glPopMatrix();
GL11.glPushMatrix();
GL11.glTranslated(0, 1.125, 0);
GL11.glTranslated(0, 0.0625 * 18.5, 0);
GL11.glRotated(boltTurn[2], 0, 0, 1);
GL11.glTranslated(0, -1.125, 0);
GL11.glTranslated(0, 0.0625 * -18.5, 0);
GL11.glTranslated(0, 0, boltPull[2]);
ResourceManager.mas36.renderPart("Bolt");
GL11.glPopMatrix();

View File

@ -88,8 +88,7 @@ public class ItemRenderQuadro extends ItemRenderWeaponBase {
GL11.glTranslated(-(font.getStringWidth(label) / 2) * f3, 0, 0);
GL11.glScalef(f3, -f3, f3);
GL11.glNormal3f(0.0F, 0.0F, -1.0F * f3);
float variance = 0.7F + player.getRNG().nextFloat() * 0.3F;
font.drawString(label, 0, 0, new Color(0F, variance, variance).getRGB());
font.drawString(label, 0, 0, new Color(0F, 1F, 1F).getRGB());
GL11.glColor3f(1F, 1F, 1F);
GL11.glEnable(GL11.GL_LIGHTING);

View File

@ -61,10 +61,10 @@ public class RenderCraneConsole extends TileEntitySpecialRenderer {
ResourceManager.rbmk_crane_console.renderPart("Meter2");
GL11.glPopMatrix();
bindTexture(ResourceManager.ks23_tex);
/*bindTexture(ResourceManager.ks23_tex);
ResourceManager.rbmk_crane_console.renderPart("Shotgun");
bindTexture(ResourceManager.mini_nuke_tex);
ResourceManager.rbmk_crane_console.renderPart("MiniNuke");
ResourceManager.rbmk_crane_console.renderPart("MiniNuke");*/
GL11.glDisable(GL11.GL_TEXTURE_2D);
GL11.glPushAttrib(GL11.GL_LIGHTING_BIT);

View File

@ -14,7 +14,7 @@ import net.minecraft.util.Vec3;
import net.minecraft.world.World;
public abstract class RenderPylonBase extends TileEntitySpecialRenderer {
/**
* The closest we have to a does-all solution. It will figure out if it needs to draw multiple lines,
* iterate through all the mounting points, try to find the matching mounting points and then draw the lines.
@ -24,27 +24,25 @@ public abstract class RenderPylonBase extends TileEntitySpecialRenderer {
* @param z
*/
public void renderLinesGeneric(TileEntityPylonBase pyl, double x, double y, double z) {
this.bindTexture(pyl.color == 0 ? ResourceManager.wire_tex : ResourceManager.wire_greyscale_tex);
for(int i = 0; i < pyl.connected.size(); i++) {
int[] wire = pyl.connected.get(i);
this.bindTexture(pyl.color == 0 ? ResourceManager.wire_tex : ResourceManager.wire_greyscale_tex);
pyl.getConnected().forEach(wire -> {
TileEntity tile = pyl.getWorldObj().getTileEntity(wire[0], wire[1], wire[2]);
if(tile instanceof TileEntityPylonBase) {
TileEntityPylonBase pylon = (TileEntityPylonBase) tile;
Vec3[] m1 = pyl.getMountPos();
Vec3[] m2 = pylon.getMountPos();
int lineCount = Math.min(m1.length, m2.length);
for(int line = 0; line < lineCount; line++) {
Vec3 first = m1[line % m1.length];
int secondIndex = line % m2.length;
/*
* hacky hacky hack
* this will shift the mount point order by 2 to prevent wires from crossing
@ -55,17 +53,17 @@ public abstract class RenderPylonBase extends TileEntitySpecialRenderer {
if(lineCount == 4 && (
(pyl.getBlockMetadata() - 10 == 5 && pylon.getBlockMetadata() - 10 == 2) ||
(pyl.getBlockMetadata() - 10 == 2 && pylon.getBlockMetadata() - 10 == 5))) {
secondIndex += 2;
secondIndex %= m2.length;
}
Vec3 second = m2[secondIndex];
double sX = second.xCoord + pylon.xCoord - pyl.xCoord;
double sY = second.yCoord + pylon.yCoord - pyl.yCoord;
double sZ = second.zCoord + pylon.zCoord - pyl.zCoord;
renderLine(pyl.getWorldObj(), pyl, x, y, z,
first.xCoord,
first.yCoord,
@ -75,9 +73,9 @@ public abstract class RenderPylonBase extends TileEntitySpecialRenderer {
first.zCoord + (sZ - first.zCoord) * 0.5);
}
}
}
});
}
/**
* Renders half a line
* First coords: the relative render position
@ -101,12 +99,12 @@ public abstract class RenderPylonBase extends TileEntitySpecialRenderer {
GL11.glTranslated(x, y, z);
float count = 10;
Tessellator tess = Tessellator.instance;
GL11.glDisable(GL11.GL_LIGHTING);
GL11.glDisable(GL11.GL_CULL_FACE);
tess.startDrawingQuads();
Vec3 delta = Vec3.createVectorHelper(x0 - x1, y0 - y1, z0 - z1);
double girth = 0.03125D;
double hyp = Math.sqrt(delta.xCoord * delta.xCoord + delta.zCoord * delta.zCoord);
double yaw = Math.atan2(delta.xCoord, delta.zCoord);
@ -124,31 +122,31 @@ public abstract class RenderPylonBase extends TileEntitySpecialRenderer {
tess.setColorOpaque_I(pyl.color == 0 ? 0xffffff : pyl.color);
drawLineSegment(tess, x0, y0, z0, x1, y1, z1, iX, iY, iZ, jX, jZ);
} else {
double hang = Math.min(delta.lengthVector() / 15D, 2.5D);
for(float j = 0; j < count; j++) {
float k = j + 1;
double sagJ = Math.sin(j / count * Math.PI * 0.5) * hang;
double sagK = Math.sin(k / count * Math.PI * 0.5) * hang;
double sagMean = (sagJ + sagK) / 2D;
double deltaX = x1 - x0;
double deltaY = y1 - y0;
double deltaZ = z1 - z0;
double ja = j + 0.5D;
double ix = pyl.xCoord + x0 + deltaX / (double)(count) * ja;
double iy = pyl.yCoord + y0 + deltaY / (double)(count) * ja - sagMean;
double iz = pyl.zCoord + z0 + deltaZ / (double)(count) * ja;
int brightness = world.getLightBrightnessForSkyBlocks(MathHelper.floor_double(ix), MathHelper.floor_double(iy), MathHelper.floor_double(iz), 0);
tess.setBrightness(brightness);
tess.setColorOpaque_I(pyl.color == 0 ? 0xffffff : pyl.color);
drawLineSegment(tess,
x0 + (deltaX * j / count),
y0 + (deltaY * j / count) - sagJ,
@ -162,10 +160,10 @@ public abstract class RenderPylonBase extends TileEntitySpecialRenderer {
tess.draw();
GL11.glEnable(GL11.GL_LIGHTING);
GL11.glEnable(GL11.GL_CULL_FACE);
GL11.glPopMatrix();
}
/**
* Draws a single segment from the first to the second 3D coordinate.
* Not fantastic but it looks good enough.
@ -178,19 +176,19 @@ public abstract class RenderPylonBase extends TileEntitySpecialRenderer {
* @param c
*/
public void drawLineSegment(Tessellator tessellator, double x, double y, double z, double a, double b, double c, double iX, double iY, double iZ, double jX, double jZ) {
double deltaX = a - x;
double deltaY = b - y;
double deltaZ = c - z;
double length = Math.sqrt(deltaX * deltaX + deltaY * deltaY + deltaZ * deltaZ);
int wrap = (int) Math.ceil(length * 8);
if(deltaX + deltaZ < 0) {
wrap *= -1;
jZ *= -1;
jX *= -1;
}
tessellator.addVertexWithUV(x + iX, y + iY, z + iZ, 0, 0);
tessellator.addVertexWithUV(x - iX, y - iY, z - iZ, 0, 1);
tessellator.addVertexWithUV(a - iX, b - iY, c - iZ, wrap, 1);
@ -200,6 +198,6 @@ public abstract class RenderPylonBase extends TileEntitySpecialRenderer {
tessellator.addVertexWithUV(a - jX, b, c - jZ, wrap, 1);
tessellator.addVertexWithUV(a + jX, b, c + jZ, wrap, 0);
}
public static final int LINE_COLOR = 0xBB3311;
}

View File

@ -3,6 +3,7 @@ package com.hbm.render.world;
import org.lwjgl.opengl.GL11;
import com.hbm.extprop.HbmLivingProps;
import com.hbm.main.ModEventHandlerClient;
import cpw.mods.fml.client.FMLClientHandler;
import net.minecraft.client.Minecraft;
@ -23,6 +24,7 @@ public class RenderNTMSkyboxChainloader extends IRenderHandler { //why an abstra
private IRenderHandler parent;
private static final ResourceLocation digammaStar = new ResourceLocation("hbm:textures/misc/star_digamma.png");
private static final ResourceLocation lodeStar = new ResourceLocation("hbm:textures/misc/star_lode.png");
private static final ResourceLocation bobmazonSat = new ResourceLocation("hbm:textures/misc/sat_bobmazon.png");
/*
@ -54,6 +56,8 @@ public class RenderNTMSkyboxChainloader extends IRenderHandler { //why an abstra
world.provider.setSkyRenderer(this);
}
Tessellator tessellator = Tessellator.instance;
GL11.glPushMatrix();
GL11.glDepthMask(false);
@ -68,6 +72,25 @@ public class RenderNTMSkyboxChainloader extends IRenderHandler { //why an abstra
GL11.glColor4f(brightness, brightness, brightness, 1.0F);
float var12 = 1F + world.rand.nextFloat() * 0.5F;
double dist = 100D;
if(ModEventHandlerClient.renderLodeStar) {
GL11.glPushMatrix();
GL11.glRotatef(-75.0F, 1.0F, 0.0F, 0.0F);
GL11.glRotatef(10.0F, 0.0F, 1.0F, 0.0F);
FMLClientHandler.instance().getClient().renderEngine.bindTexture(lodeStar); // GENUINELY shut the fuck up i'm not kidding
tessellator.startDrawingQuads();
tessellator.addVertexWithUV(-var12, dist, -var12, 0.0D, 0.0D);
tessellator.addVertexWithUV(var12, dist, -var12, 0.0D, 1.0D);
tessellator.addVertexWithUV(var12, dist, var12, 1.0D, 1.0D);
tessellator.addVertexWithUV(-var12, dist, var12, 1.0D, 0.0D);
tessellator.draw();
GL11.glPopMatrix();
}
GL11.glPushMatrix();
GL11.glRotatef(-90.0F, 0.0F, 1.0F, 0.0F);
GL11.glRotatef(world.getCelestialAngle(partialTicks) * 360.0F, 1.0F, 0.0F, 0.0F);
@ -77,10 +100,9 @@ public class RenderNTMSkyboxChainloader extends IRenderHandler { //why an abstra
FMLClientHandler.instance().getClient().renderEngine.bindTexture(digammaStar);
float digamma = HbmLivingProps.getDigamma(Minecraft.getMinecraft().thePlayer);
float var12 = 1F * (1 + digamma * 0.25F);
double dist = 100D - digamma * 2.5;
var12 = 1F * (1 + digamma * 0.25F);
dist = 100D - digamma * 2.5;
Tessellator tessellator = Tessellator.instance;
tessellator.startDrawingQuads();
tessellator.addVertexWithUV(-var12, dist, -var12, 0.0D, 0.0D);
tessellator.addVertexWithUV(var12, dist, -var12, 0.0D, 1.0D);

View File

@ -1,11 +1,12 @@
package com.hbm.tileentity;
import api.hbm.fluid.IFluidStandardTransceiver;
import api.hbm.fluid.IFluidUser;
import com.hbm.interfaces.ICopiable;
import com.hbm.inventory.fluid.Fluids;
import com.hbm.inventory.fluid.tank.FluidTank;
import com.hbm.util.BobMathUtil;
import api.hbm.fluidmk2.IFluidStandardTransceiverMK2;
import api.hbm.fluidmk2.IFluidUserMK2;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.tileentity.TileEntity;
@ -20,7 +21,7 @@ public interface IFluidCopiable extends ICopiable {
* none if there is no alt paste support
*/
default int[] getFluidIDToCopy() {
IFluidUser tile = (IFluidUser) this;
IFluidUserMK2 tile = (IFluidUserMK2) this;
ArrayList<Integer> types = new ArrayList<>();
for(FluidTank tank : tile.getAllTanks()) {
@ -33,8 +34,8 @@ public interface IFluidCopiable extends ICopiable {
default FluidTank getTankToPaste() {
TileEntity te = (TileEntity) this;
if(te instanceof IFluidStandardTransceiver) {
IFluidStandardTransceiver tile = (IFluidStandardTransceiver) this;
if(te instanceof IFluidStandardTransceiverMK2) { // why are we using the transceiver here?
IFluidStandardTransceiverMK2 tile = (IFluidStandardTransceiverMK2) this;
return tile.getReceivingTanks() != null ? tile.getReceivingTanks()[0] : null;
}
return null;

View File

@ -6,7 +6,8 @@ import com.hbm.inventory.fluid.FluidType;
import com.hbm.inventory.fluid.Fluids;
import com.hbm.inventory.fluid.tank.FluidTank;
import api.hbm.fluid.IFluidUser;
import api.hbm.fluid.IFluidStandardSender;
import com.hbm.inventory.fluid.trait.FT_Polluting;
import com.hbm.inventory.fluid.trait.FluidTrait;
import net.minecraft.nbt.NBTTagCompound;
@ -15,7 +16,7 @@ import net.minecraftforge.common.util.ForgeDirection;
import java.util.HashMap;
import java.util.Map;
public abstract class TileEntityMachinePolluting extends TileEntityMachineBase implements IFluidUser {
public abstract class TileEntityMachinePolluting extends TileEntityMachineBase implements IFluidStandardSender {
public FluidTank smoke;
public FluidTank smoke_leaded;

View File

@ -4,9 +4,11 @@ import api.hbm.block.ICrucibleAcceptor;
import com.hbm.handler.CompatHandler;
import com.hbm.handler.CompatHandler.OCComponent;
import com.hbm.inventory.fluid.FluidType;
import com.hbm.inventory.fluid.tank.FluidTank;
import api.hbm.energymk2.IEnergyReceiverMK2;
import api.hbm.fluid.IFluidConnector;
import api.hbm.fluidmk2.IFluidConnectorMK2;
import api.hbm.fluidmk2.IFluidReceiverMK2;
import api.hbm.tile.IHeatSource;
import com.hbm.inventory.material.Mats;
import cpw.mods.fml.common.Loader;
@ -26,7 +28,7 @@ import net.minecraftforge.common.util.ForgeDirection;
@Optional.Interface(iface = "com.hbm.handler.CompatHandler.OCComponent", modid = "opencomputers"),
@Optional.Interface(iface = "li.cil.oc.api.network.SimpleComponent", modid = "opencomputers")
})
public class TileEntityProxyCombo extends TileEntityProxyBase implements IEnergyReceiverMK2, ISidedInventory, IFluidConnector, IHeatSource, ICrucibleAcceptor, SimpleComponent, OCComponent {
public class TileEntityProxyCombo extends TileEntityProxyBase implements IEnergyReceiverMK2, ISidedInventory, IFluidReceiverMK2, IHeatSource, ICrucibleAcceptor, SimpleComponent, OCComponent {
TileEntity tile;
boolean inventory;
@ -143,6 +145,53 @@ public class TileEntityProxyCombo extends TileEntityProxyBase implements IEnergy
return true;
}
public static final FluidTank[] EMPTY_TANKS = new FluidTank[0];
@Override
public FluidTank[] getAllTanks() {
if(!fluid) return EMPTY_TANKS;
if(getTile() instanceof IFluidReceiverMK2) {
return ((IFluidReceiverMK2)getTile()).getAllTanks();
}
return EMPTY_TANKS;
}
@Override
public long transferFluid(FluidType type, int pressure, long amount) {
if(!fluid) return amount;
if(getTile() instanceof IFluidReceiverMK2) {
return ((IFluidReceiverMK2)getTile()).transferFluid(type, pressure, amount);
}
return amount;
}
@Override
public long getDemand(FluidType type, int pressure) {
if(!fluid) return 0;
if(getTile() instanceof IFluidReceiverMK2) {
return ((IFluidReceiverMK2)getTile()).getDemand(type, pressure);
}
return 0;
}
@Override
public boolean canConnect(FluidType type, ForgeDirection dir) {
if(!this.fluid)
return false;
if(getTile() instanceof IFluidConnectorMK2) {
return ((IFluidConnectorMK2) getTile()).canConnect(type, dir);
}
return true;
}
@Override
public int getSizeInventory() {
@ -368,42 +417,6 @@ public class TileEntityProxyCombo extends TileEntityProxyBase implements IEnergy
nbt.setString("ocname", componentName);
}
@Override
public long transferFluid(FluidType type, int pressure, long fluid) {
if(!this.fluid)
return fluid;
if(getTile() instanceof IFluidConnector) {
return ((IFluidConnector)getTile()).transferFluid(type, pressure, fluid);
}
return fluid;
}
@Override
public long getDemand(FluidType type, int pressure) {
if(!this.fluid)
return 0;
if(getTile() instanceof IFluidConnector) {
return ((IFluidConnector)getTile()).getDemand(type, pressure);
}
return 0;
}
@Override
public boolean canConnect(FluidType type, ForgeDirection dir) {
if(!this.fluid)
return false;
if(getTile() instanceof IFluidConnector) {
return ((IFluidConnector)getTile()).canConnect(type, dir);
}
return true;
}
@Override
public int getHeatStored() {

View File

@ -9,12 +9,12 @@ import com.hbm.lib.Library;
import com.hbm.tileentity.IBufPacketReceiver;
import com.hbm.tileentity.TileEntityLoadedBase;
import api.hbm.fluid.IFluidUser;
import api.hbm.fluidmk2.IFluidReceiverMK2;
import io.netty.buffer.ByteBuf;
import net.minecraft.tileentity.TileEntity;
import net.minecraftforge.common.util.ForgeDirection;
public abstract class TileEntityChimneyBase extends TileEntityLoadedBase implements IFluidUser, IBufPacketReceiver {
public abstract class TileEntityChimneyBase extends TileEntityLoadedBase implements IFluidReceiverMK2, IBufPacketReceiver {
public long ashTick = 0;
public long sootTick = 0;

View File

@ -81,7 +81,7 @@ public class TileEntityMachineChemfac extends TileEntityMachineChemplantBase imp
for(DirPos pos : getConPos()) for(FluidTank tank : outTanks()) {
if(tank.getTankType() != Fluids.NONE && tank.getFill() > 0) {
this.sendFluid(tank, worldObj, pos.getX(), pos.getY(), pos.getZ(), pos.getDir());
this.tryProvide(tank, worldObj, pos);
}
}

View File

@ -5,7 +5,6 @@ import java.util.HashMap;
import java.util.List;
import com.hbm.inventory.RecipesCommon.AStack;
import com.hbm.inventory.fluid.FluidType;
import com.hbm.inventory.fluid.Fluids;
import com.hbm.inventory.fluid.tank.FluidTank;
import com.hbm.inventory.recipes.ChemplantRecipes;
@ -19,7 +18,7 @@ import com.hbm.util.ItemStackUtil;
import com.hbm.util.fauxpointtwelve.DirPos;
import api.hbm.energymk2.IEnergyReceiverMK2;
import api.hbm.fluid.IFluidUser;
import api.hbm.fluidmk2.IFluidStandardTransceiverMK2;
import net.minecraft.inventory.IInventory;
import net.minecraft.inventory.ISidedInventory;
import net.minecraft.item.ItemStack;
@ -34,7 +33,7 @@ import net.minecraft.tileentity.TileEntity;
* Tanks follow the order R1(I1, I2, O1, O2), R2(I1, I2, O1, O2) ...
* @author hbm
*/
public abstract class TileEntityMachineChemplantBase extends TileEntityMachineBase implements IEnergyReceiverMK2, IFluidUser, IGUIProvider {
public abstract class TileEntityMachineChemplantBase extends TileEntityMachineBase implements IEnergyReceiverMK2, IFluidStandardTransceiverMK2, IGUIProvider {
public long power;
public int[] progress;
@ -344,39 +343,6 @@ public abstract class TileEntityMachineChemplantBase extends TileEntityMachineBa
this.power = power;
}
/*public int getFluidFill(FluidType type) {
int fill = 0;
for(FluidTank tank : inTanks()) {
if(tank.getTankType() == type) {
fill += tank.getFill();
}
}
for(FluidTank tank : outTanks()) {
if(tank.getTankType() == type) {
fill += tank.getFill();
}
}
return fill;
}*/
/* For input only! */
public int getMaxFluidFill(FluidType type) {
int maxFill = 0;
for(FluidTank tank : inTanks()) {
if(tank.getTankType() == type) {
maxFill += tank.getMaxFill();
}
}
return maxFill;
}
protected List<FluidTank> inTanks() {
List<FluidTank> inTanks = new ArrayList();
@ -391,113 +357,6 @@ public abstract class TileEntityMachineChemplantBase extends TileEntityMachineBa
return inTanks;
}
/*public void receiveFluid(int amount, FluidType type) {
if(amount <= 0)
return;
List<FluidTank> rec = new ArrayList();
for(FluidTank tank : inTanks()) {
if(tank.getTankType() == type) {
rec.add(tank);
}
}
if(rec.size() == 0)
return;
int demand = 0;
List<Integer> weight = new ArrayList();
for(FluidTank tank : rec) {
int fillWeight = tank.getMaxFill() - tank.getFill();
demand += fillWeight;
weight.add(fillWeight);
}
for(int i = 0; i < rec.size(); i++) {
if(demand <= 0)
break;
FluidTank tank = rec.get(i);
int fillWeight = weight.get(i);
int part = (int) (Math.min((long)amount, (long)demand) * (long)fillWeight / (long)demand);
tank.setFill(tank.getFill() + part);
}
}*/
public int getFluidFillForTransfer(FluidType type, int pressure) {
int fill = 0;
for(FluidTank tank : outTanks()) {
if(tank.getTankType() == type && tank.getPressure() == pressure) {
fill += tank.getFill();
}
}
return fill;
}
public void transferFluid(int amount, FluidType type, int pressure) {
/*
* this whole new fluid mumbo jumbo extra abstraction layer might just be a bandaid
* on the gushing wound that is the current fluid systemm but i'll be damned if it
* didn't at least do what it's supposed to. half a decade and we finally have multi
* tank support for tanks with matching fluid types!!
*/
if(amount <= 0)
return;
List<FluidTank> send = new ArrayList();
for(FluidTank tank : outTanks()) {
if(tank.getTankType() == type && tank.getPressure() == pressure) {
send.add(tank);
}
}
if(send.size() == 0)
return;
int offer = 0;
List<Integer> weight = new ArrayList();
for(FluidTank tank : send) {
int fillWeight = tank.getFill();
offer += fillWeight;
weight.add(fillWeight);
}
int tracker = amount;
for(int i = 0; i < send.size(); i++) {
FluidTank tank = send.get(i);
int fillWeight = weight.get(i);
int part = amount * fillWeight / offer;
tank.setFill(tank.getFill() - part);
tracker -= part;
}
//making sure to properly deduct even the last mB lost by rounding errors
for(int i = 0; i < 100 && tracker > 0; i++) {
FluidTank tank = send.get(i % send.size());
if(tank.getFill() > 0) {
int total = Math.min(tank.getFill(), tracker);
tracker -= total;
tank.setFill(tank.getFill() - total);
}
}
}
protected List<FluidTank> outTanks() {
List<FluidTank> outTanks = new ArrayList();
@ -512,69 +371,21 @@ public abstract class TileEntityMachineChemplantBase extends TileEntityMachineBa
return outTanks;
}
@Override
public FluidTank[] getReceivingTanks() {
return this.inTanks().toArray(new FluidTank[0]);
}
@Override
public FluidTank[] getSendingTanks() {
return this.outTanks().toArray(new FluidTank[0]);
}
@Override
public FluidTank[] getAllTanks() {
return tanks;
}
@Override
public long transferFluid(FluidType type, int pressure, long fluid) {
int amount = (int) fluid;
if(amount <= 0)
return 0;
List<FluidTank> rec = new ArrayList();
for(FluidTank tank : inTanks()) {
if(tank.getTankType() == type && tank.getPressure() == pressure) {
rec.add(tank);
}
}
if(rec.size() == 0)
return fluid;
int demand = 0;
List<Integer> weight = new ArrayList();
for(FluidTank tank : rec) {
int fillWeight = tank.getMaxFill() - tank.getFill();
demand += fillWeight;
weight.add(fillWeight);
}
for(int i = 0; i < rec.size(); i++) {
if(demand <= 0)
break;
FluidTank tank = rec.get(i);
int fillWeight = weight.get(i);
int part = (int) (Math.min((long)amount, (long)demand) * (long)fillWeight / (long)demand);
tank.setFill(tank.getFill() + part);
fluid -= part;
}
return fluid;
}
@Override
public long getDemand(FluidType type, int pressure) {
return getMaxFluidFill(type) - getFluidFillForTransfer(type, pressure);
}
@Override
public long getTotalFluidForSend(FluidType type, int pressure) {
return getFluidFillForTransfer(type, pressure);
}
@Override
public void removeFluidForTransfer(FluidType type, int pressure, long amount) {
this.transferFluid((int) amount, type, pressure);
}
@Override
public void readFromNBT(NBTTagCompound nbt) {
super.readFromNBT(nbt);

View File

@ -212,7 +212,7 @@ public class TileEntityMachineRadarNT extends TileEntityMachineBase implements I
screen.refZ = zCoord;
screen.range = this.getRange();
screen.linked = true;
networkPackNT(25);
screen.networkPackNT(25);
}
}
}

View File

@ -50,11 +50,11 @@ public class TileEntityMachineRotaryFurnace extends TileEntityMachinePolluting i
public boolean isProgressing;
public float progress;
public int burnTime;
public double burnHeat = 1D;
public int maxBurnTime;
public int steamUsed = 0;
public boolean isVenting;
public MaterialStack output;
public ItemStack lastFuel;
public static final int maxOutput = MaterialShapes.BLOCK.q(16);
public int anim;
@ -132,14 +132,14 @@ public class TileEntityMachineRotaryFurnace extends TileEntityMachinePolluting i
if(recipe != null) {
if(this.burnTime <= 0 && slots[4] != null && TileEntityFurnace.isItemFuel(slots[4])) {
lastFuel = slots[4];
this.maxBurnTime = this.burnTime = burnModule.getBurnTime(lastFuel) / 2;
this.burnHeat = burnModule.getMod(slots[4], burnModule.getModHeat());
this.maxBurnTime = this.burnTime = burnModule.getBurnTime(slots[4]) / 2;
this.decrStackSize(4, 1);
this.markChanged();
}
if(this.canProcess(recipe)) {
float speed = Math.max((float) burnModule.getMod(lastFuel, burnModule.getModHeat()), 1);
float speed = Math.max((float) burnHeat, 1);
this.progress += speed / recipe.duration;
speed = (float)(13 * Math.log10(speed) + 1);
@ -257,14 +257,12 @@ public class TileEntityMachineRotaryFurnace extends TileEntityMachinePolluting i
this.tanks[2].readFromNBT(nbt, "t2");
this.progress = nbt.getFloat("prog");
this.burnTime = nbt.getInteger("burn");
this.burnHeat = nbt.getDouble("heat");
this.maxBurnTime = nbt.getInteger("maxBurn");
if (nbt.hasKey("outType")) {
NTMMaterial mat = Mats.matById.get(nbt.getInteger("outType"));
this.output = new MaterialStack(mat, nbt.getInteger("outAmount"));
}
ItemStack nbtFuel = ItemStack.loadItemStackFromNBT(nbt.getCompoundTag("lastFuel"));
if(nbtFuel != null)
this.lastFuel = nbtFuel;
}
@Override
@ -275,8 +273,8 @@ public class TileEntityMachineRotaryFurnace extends TileEntityMachinePolluting i
this.tanks[2].writeToNBT(nbt, "t2");
nbt.setFloat("prog", progress);
nbt.setInteger("burn", burnTime);
nbt.setDouble("heat", burnHeat);
nbt.setInteger("maxBurn", maxBurnTime);
nbt.setTag("lastFuel", lastFuel.writeToNBT(new NBTTagCompound()));
if (this.output != null) {
nbt.setInteger("outType", this.output.material.id);
nbt.setInteger("outAmount", this.output.amount);

View File

@ -10,8 +10,8 @@ import com.hbm.main.MainRegistry;
import com.hbm.tileentity.TileEntityLoadedBase;
import com.hbm.util.BobMathUtil;
import api.hbm.fluid.IFillableItem;
import api.hbm.fluid.IFluidStandardReceiver;
import api.hbm.fluidmk2.IFillableItem;
import io.netty.buffer.ByteBuf;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemArmor;

Some files were not shown because too many files have changed in this diff Show More