mirror of
https://github.com/HbmMods/Hbm-s-Nuclear-Tech-GIT.git
synced 2026-01-25 10:32:49 +00:00
i can hear satan's voice, he's telling me to invest in apple.
what does this mean? why does he want me to buy apples??
This commit is contained in:
parent
ba58f42ef2
commit
c16818c15d
@ -56,19 +56,6 @@ public class Nodespace {
|
||||
checkNodeConnection(world, node);
|
||||
node.recentlyChanged = false;
|
||||
}
|
||||
|
||||
/*if(node.hasValidNet()) {
|
||||
|
||||
for(BlockPos pos : node.positions) {
|
||||
NBTTagCompound data = new NBTTagCompound();
|
||||
data.setString("type", "marker");
|
||||
data.setInteger("color", node.net.hashCode() % 0xffffff);
|
||||
data.setInteger("expires", 250);
|
||||
data.setDouble("dist", 50D);
|
||||
data.setString("label", "" + node.net.links.size());
|
||||
PacketDispatcher.wrapper.sendToAllAround(new AuxParticlePacketNT(data, pos.getX(), pos.getY(), pos.getZ()), new TargetPoint(world.provider.dimensionId, pos.getX(), pos.getY(), pos.getZ(), 50));
|
||||
}
|
||||
}*/
|
||||
}
|
||||
}
|
||||
|
||||
@ -76,10 +63,9 @@ public class Nodespace {
|
||||
}
|
||||
|
||||
private static void updatePowerNets() {
|
||||
|
||||
for(PowerNetMK2 net : activePowerNets) {
|
||||
net.transferPower();
|
||||
}
|
||||
|
||||
for(PowerNetMK2 net : activePowerNets) net.resetEnergyTracker(); //reset has to be done before everything else
|
||||
for(PowerNetMK2 net : activePowerNets) net.transferPower();
|
||||
}
|
||||
|
||||
/** Goes over each connection point of the given node, tries to find neighbor nodes and to join networks with them */
|
||||
|
||||
@ -19,6 +19,8 @@ public class PowerNetMK2 {
|
||||
public HashMap<IEnergyReceiverMK2, Long> receiverEntries = new HashMap();
|
||||
public HashMap<IEnergyProviderMK2, Long> providerEntries = new HashMap();
|
||||
|
||||
public long energyTracker = 0L;
|
||||
|
||||
public PowerNetMK2() {
|
||||
Nodespace.activePowerNets.add(this);
|
||||
}
|
||||
@ -104,6 +106,10 @@ public class PowerNetMK2 {
|
||||
this.providerEntries.clear();
|
||||
}
|
||||
|
||||
public void resetEnergyTracker() {
|
||||
this.energyTracker = 0;
|
||||
}
|
||||
|
||||
public void transferPower() {
|
||||
|
||||
int timeout = 3_000;
|
||||
@ -167,6 +173,7 @@ public class PowerNetMK2 {
|
||||
prevDest += finalTransfer;
|
||||
|
||||
toTransfer -= finalTransfer;
|
||||
this.energyTracker += finalTransfer;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -1,10 +1,7 @@
|
||||
package com.hbm.blocks.machine;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
|
||||
import com.hbm.blocks.ITooltipProvider;
|
||||
import com.hbm.inventory.fluid.trait.FT_Combustible.FuelGrade;
|
||||
import com.hbm.main.MainRegistry;
|
||||
import com.hbm.tileentity.machine.TileEntityMachineSeleniumEngine;
|
||||
|
||||
@ -18,11 +15,10 @@ import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.EnumChatFormatting;
|
||||
import net.minecraft.util.MathHelper;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public class MachineSeleniumEngine extends BlockContainer implements ITooltipProvider {
|
||||
public class MachineSeleniumEngine extends BlockContainer {
|
||||
|
||||
private final Random field_149933_a = new Random();
|
||||
private static boolean keepInventory;
|
||||
@ -127,18 +123,4 @@ public class MachineSeleniumEngine extends BlockContainer implements ITooltipPro
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addInformation(ItemStack stack, EntityPlayer player, List list, boolean ext) {
|
||||
|
||||
list.add(EnumChatFormatting.YELLOW + "Fuel efficiency:");
|
||||
for(FuelGrade grade : FuelGrade.values()) {
|
||||
Double efficiency = TileEntityMachineSeleniumEngine.fuelEfficiency.get(grade);
|
||||
|
||||
if(efficiency != null) {
|
||||
int eff = (int) (efficiency * 100);
|
||||
list.add(EnumChatFormatting.YELLOW + "-" + grade.getGrade() + ": " + EnumChatFormatting.RED + "" + eff + "%");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,6 +1,5 @@
|
||||
package com.hbm.blocks.network;
|
||||
|
||||
import java.math.BigInteger;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
@ -14,6 +13,7 @@ import com.hbm.tileentity.network.TileEntityCableBaseNT;
|
||||
import com.hbm.util.BobMathUtil;
|
||||
import com.hbm.util.I18nUtil;
|
||||
|
||||
import api.hbm.energymk2.PowerNetMK2;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import net.minecraft.block.BlockContainer;
|
||||
@ -100,7 +100,6 @@ public class BlockCableGauge extends BlockContainer implements IBlockMultiPass,
|
||||
|
||||
public static class TileEntityCableGauge extends TileEntityCableBaseNT implements INBTPacketReceiver {
|
||||
|
||||
private BigInteger lastMeasurement = BigInteger.valueOf(10);
|
||||
private long deltaTick = 0;
|
||||
private long deltaSecond = 0;
|
||||
private long deltaLastSecond = 0;
|
||||
@ -111,20 +110,16 @@ public class BlockCableGauge extends BlockContainer implements IBlockMultiPass,
|
||||
|
||||
if(!worldObj.isRemote) {
|
||||
|
||||
if(network != null) {
|
||||
BigInteger total = network.getTotalTransfer();
|
||||
BigInteger delta = total.subtract(this.lastMeasurement);
|
||||
this.lastMeasurement = total;
|
||||
if(this.node != null && this.node.net != null) {
|
||||
|
||||
try {
|
||||
this.deltaTick = delta.longValueExact();
|
||||
if(worldObj.getTotalWorldTime() % 20 == 0) {
|
||||
this.deltaLastSecond = this.deltaSecond;
|
||||
this.deltaSecond = 0;
|
||||
}
|
||||
this.deltaSecond += deltaTick;
|
||||
|
||||
} catch(Exception ex) { }
|
||||
PowerNetMK2 net = this.node.net;
|
||||
|
||||
this.deltaTick = net.energyTracker;
|
||||
if(worldObj.getTotalWorldTime() % 20 == 0) {
|
||||
this.deltaLastSecond = this.deltaSecond;
|
||||
this.deltaSecond = 0;
|
||||
}
|
||||
this.deltaSecond += deltaTick;
|
||||
}
|
||||
|
||||
NBTTagCompound data = new NBTTagCompound();
|
||||
|
||||
@ -15,6 +15,7 @@ import com.hbm.tileentity.machine.TileEntitySoyuzLauncher;
|
||||
import com.hbm.tileentity.machine.storage.TileEntityBarrel;
|
||||
import com.hbm.tileentity.machine.storage.TileEntityMachineBattery;
|
||||
|
||||
import api.hbm.energymk2.IEnergyReceiverMK2.ConnectionPriority;
|
||||
import cpw.mods.fml.common.network.simpleimpl.IMessage;
|
||||
import cpw.mods.fml.common.network.simpleimpl.IMessageHandler;
|
||||
import cpw.mods.fml.common.network.simpleimpl.MessageContext;
|
||||
@ -67,6 +68,7 @@ public class AuxButtonPacket implements IMessage {
|
||||
|
||||
public static class Handler implements IMessageHandler<AuxButtonPacket, IMessage> {
|
||||
|
||||
@SuppressWarnings("incomplete-switch")
|
||||
@Override
|
||||
public IMessage onMessage(AuxButtonPacket m, MessageContext ctx) {
|
||||
|
||||
|
||||
@ -16,16 +16,23 @@ public class TileEntityCableBaseNT extends TileEntity implements IEnergyConducto
|
||||
if(!worldObj.isRemote) {
|
||||
|
||||
if(this.node == null || this.node.expired) {
|
||||
this.node = Nodespace.getNode(worldObj, xCoord, yCoord, zCoord);
|
||||
|
||||
if(this.node == null || this.node.expired) {
|
||||
this.node = this.createNode();
|
||||
Nodespace.createNode(worldObj, this.node);
|
||||
if(this.shouldCreateNode()) {
|
||||
this.node = Nodespace.getNode(worldObj, xCoord, yCoord, zCoord);
|
||||
|
||||
if(this.node == null || this.node.expired) {
|
||||
this.node = this.createNode();
|
||||
Nodespace.createNode(worldObj, this.node);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public boolean shouldCreateNode() {
|
||||
return true;
|
||||
}
|
||||
|
||||
public void onNodeDestroyedCallback() {
|
||||
this.node = null;
|
||||
}
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
package com.hbm.tileentity.network;
|
||||
|
||||
import api.hbm.energy.PowerNet;
|
||||
import api.hbm.energymk2.Nodespace;
|
||||
|
||||
public class TileEntityCableSwitch extends TileEntityCableBaseNT {
|
||||
|
||||
@ -13,21 +13,14 @@ public class TileEntityCableSwitch extends TileEntityCableBaseNT {
|
||||
|
||||
//if the meta is 0 (OFF) and there is a net present, destroy and de-reference it.
|
||||
//that should be all, since the state being 0 also prevents the TE from updating and joining the new net.
|
||||
if(this.getBlockMetadata() == 0 && this.network != null) {
|
||||
this.network.reevaluate();
|
||||
this.network = null;
|
||||
}
|
||||
|
||||
if(this.getBlockMetadata() == 1) {
|
||||
this.connect();
|
||||
|
||||
if(this.getPowerNet() == null) {
|
||||
new PowerNet().joinLink(this);
|
||||
}
|
||||
if(this.getBlockMetadata() == 0 && this.node != null) {
|
||||
Nodespace.destroyNode(worldObj, xCoord, yCoord, zCoord);
|
||||
this.node = null;
|
||||
}
|
||||
}
|
||||
|
||||
public boolean canReevaluate() {
|
||||
return super.canReevaluate() && this.getBlockMetadata() == 1;
|
||||
@Override
|
||||
public boolean shouldCreateNode() {
|
||||
return this.getBlockMetadata() == 1;
|
||||
}
|
||||
}
|
||||
|
||||
@ -3,13 +3,13 @@ package com.hbm.tileentity.network;
|
||||
import com.hbm.calc.Location;
|
||||
import com.hbm.tileentity.TileEntityLoadedBase;
|
||||
|
||||
import api.hbm.energy.IEnergyConnector;
|
||||
import api.hbm.energymk2.IEnergyReceiverMK2;
|
||||
import cofh.api.energy.IEnergyHandler;
|
||||
import cofh.api.energy.IEnergyReceiver;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
public class TileEntityConverterHeRf extends TileEntityLoadedBase implements IEnergyConnector, IEnergyHandler {
|
||||
public class TileEntityConverterHeRf extends TileEntityLoadedBase implements IEnergyReceiverMK2, IEnergyHandler {
|
||||
|
||||
//Thanks to the great people of Fusion Warfare for helping me with the original implementation of the RF energy API
|
||||
|
||||
@ -22,30 +22,13 @@ public class TileEntityConverterHeRf extends TileEntityLoadedBase implements IEn
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canConnectEnergy(ForgeDirection from) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int extractEnergy(ForgeDirection from, int maxExtract, boolean simulate) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getEnergyStored(ForgeDirection from) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMaxEnergyStored(ForgeDirection from) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public long getPower() {
|
||||
return 0;
|
||||
}
|
||||
@Override public boolean canConnectEnergy(ForgeDirection from) { return true; }
|
||||
@Override public int receiveEnergy(ForgeDirection from, int maxReceive, boolean simulate) { return 0; }
|
||||
@Override public int extractEnergy(ForgeDirection from, int maxExtract, boolean simulate) { return 0; }
|
||||
@Override public int getEnergyStored(ForgeDirection from) { return 0; }
|
||||
@Override public int getMaxEnergyStored(ForgeDirection from) { return 0; }
|
||||
@Override public long getPower() { return 0; }
|
||||
@Override public void setPower(long power) { }
|
||||
|
||||
@Override
|
||||
public long getMaxPower() {
|
||||
@ -55,7 +38,7 @@ public class TileEntityConverterHeRf extends TileEntityLoadedBase implements IEn
|
||||
private long lastTransfer = 0;
|
||||
|
||||
@Override
|
||||
public long getTransferWeight() {
|
||||
public long getReceiverSpeed() {
|
||||
|
||||
if(lastTransfer > 0) {
|
||||
return lastTransfer * 2;
|
||||
@ -63,11 +46,6 @@ public class TileEntityConverterHeRf extends TileEntityLoadedBase implements IEn
|
||||
return getMaxPower();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public int receiveEnergy(ForgeDirection from, int maxReceive, boolean simulate) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
private boolean recursionBrake = false;
|
||||
|
||||
|
||||
@ -3,11 +3,11 @@ package com.hbm.tileentity.network;
|
||||
import com.hbm.interfaces.Untested;
|
||||
import com.hbm.tileentity.TileEntityLoadedBase;
|
||||
|
||||
import api.hbm.energy.IEnergyGenerator;
|
||||
import api.hbm.energymk2.IEnergyProviderMK2;
|
||||
import cofh.api.energy.IEnergyHandler;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
public class TileEntityConverterRfHe extends TileEntityLoadedBase implements IEnergyGenerator, IEnergyHandler {
|
||||
public class TileEntityConverterRfHe extends TileEntityLoadedBase implements IEnergyProviderMK2, IEnergyHandler {
|
||||
|
||||
@Override
|
||||
public void setPower(long power) {
|
||||
@ -48,7 +48,7 @@ public class TileEntityConverterRfHe extends TileEntityLoadedBase implements IEn
|
||||
subBuffer = capacity;
|
||||
|
||||
for(ForgeDirection dir : ForgeDirection.VALID_DIRECTIONS) {
|
||||
this.sendPower(worldObj, xCoord + dir.offsetX, yCoord + dir.offsetY, zCoord + dir.offsetZ, dir);
|
||||
this.tryProvide(worldObj, xCoord + dir.offsetX, yCoord + dir.offsetY, zCoord + dir.offsetZ, dir);
|
||||
}
|
||||
|
||||
recursionBrake = false;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user