mirror of
https://github.com/HbmMods/Hbm-s-Nuclear-Tech-GIT.git
synced 2026-01-25 10:32:49 +00:00
Merge branch 'aaargh' of https://github.com/70000hp/Hbm-s-Nuclear-Tech-GIT into aaargh
This commit is contained in:
commit
0bb49b1285
21
README.md
21
README.md
@ -94,6 +94,18 @@ If you want to make some changes to the mod, follow this guide:
|
||||
## Compatibility notice
|
||||
NTM has certain behaviors intended to fix vanilla code or to increase compatibility in certain cases where it otherwise would not be possible. These behaviors have the potential of not playing well with other mods, and while no such cases are currently known, here's a list of them.
|
||||
|
||||
### Thermos
|
||||
Thermos servers (along with its forks such as Crucible) have a "performance" feature that causes all tile entity ticking to slow down if there's no player present in the same chunk. For obvious reasons, this will heavily impact machines and cause phantom issues that, not having knowledge of this "performance" feature, are near impossible to diagnose. By default, NTM will crash on servers running the Thermos base code and print a lengthy message informing server owners about this "performance" feature as well as how to fix the issues it causes. The error message is printed in plain English on the top of the crash log, failure to read (as well as understand) it will leave the server inoperable.
|
||||
|
||||
### Optifine
|
||||
One of the most common "performance" mods on 1.7.10, Optifine, achieves an increase in performance by breaking small things in spots that are usually hard to notice, although this can cause severe issues with NTM. A short list of problems, along with some solutions, follows:
|
||||
* Get rid of Optifine and use one of the many [other, less intrusive performance mods](https://gist.github.com/makamys/7cb74cd71d93a4332d2891db2624e17c).
|
||||
* Blocks with connected textures may become invisible. This can be fixed by toggling triangulation (I do not know what or where this setting is, I just have been told that it exists and that it can fix the problem) or multicore chunk rendering (same here).
|
||||
* Entity "optimization" has a tendency to break chunkloading, this is especially noticeable with missiles which rely heavily on chunkloading to work, causing them to freeze mid-air. It's unclear what setting might fix this, and analysis of Optifine's source code (or rather, lack thereof) has not proven useful either.
|
||||
|
||||
### Angelica
|
||||
In older versions, Angelica caused issues regarding model rendering, often times making 3D models transparent. Ever since the switch to VBOs, models work fine. Another issue was blocks with connected textures not rendering at all, but this too was fixed, meaning as of time of writing there are no major incompatibilities known with Angelica.
|
||||
|
||||
### Skybox chainloader
|
||||
NTM adds a few small things to the skybox using a custom skybox renderer. Minecraft can only have a single skybox renderer loaded, so setting the skybox to the NTM custom one would break compatibility with other mods' skyboxes. To mend this, NTM employs a **chainloader**. This chainloader will detect if a different skybox is loaded, save a reference to that skybox and then use NTM's skybox, which when used will also make sure to run the previous modded skybox renderer. In the event that NTM's skybox were to cause trouble, it can be disabled with the config option `1.31_enableSkyboxes`.
|
||||
|
||||
@ -106,5 +118,14 @@ An often overlooked aspect of Minecraft is its stats, the game keeps track of ho
|
||||
### Keybind overlap
|
||||
An often annoying aspect of modded Minecraft is its keybinds. Even though multiple binds can be assigned the same key, all but one will show up as "conflicting" and only the non-conflicting one will work. Which one this is is usually arbitrary, and there is no reason to have such limitation. Often times keybinds are only applicable in certain scenarios, and a commonly found degree of overlap is within reason. Therefore, NTM will run its own key handling code which allows conflicting keybinds to work. If there should be any issues with this behavior, it can be disabled with the config option `1.34_enableKeybindOverlap`.
|
||||
|
||||
### Render distance capping
|
||||
There is a common crash caused by Minecraft's render distance slider going out of bounds, this usually happens when uninstalling a mod that extends the render distance (like Optifine) or when downgrading the Minecraft version (newer versions have higher render distance caps). To prevent crashes, the mod will attempt to decrease the render distance if it's above 16 unless Optifine is installed. If this behavior is not desired (for example, because another mod that allows higher render distance is being used), it can be disabled with the config option `1.25_enableRenderDistCheck`.
|
||||
|
||||
### Log spam caused by ComparableStack
|
||||
In some modpacks (exact mods needed to replicate this are unknown), it's possible that invalid registered items may cause problems for NEI handlers. To prevent crashes, the ComparableStack class used to represent stacks will default to a safe registered item, and print a log message. In certain situations, this may cause dozens of errors to be printed at once, potentially even lagging the game. If that happens, the log message (but not the error handling) can be disabled with the config option `1.28_enableSilentCompStackErrors`.
|
||||
|
||||
### Sound system limit
|
||||
By default, the sound system only allows a limited amount of sounds to run at once (28 regular sounds and 4 streaming sounds), this causes issues when there's many machines running at once, since their looped sounds will constantly interrupt each other, causing them to immediately restart, which in some isolated cases has proven to cause massive lagspikes. To prevent this, NTM will increase the sound limit to 1000 regular sounds and 50 streaming sounds, this can be disabled with the config option `1.39_enableSoundExtension`.
|
||||
|
||||
# License
|
||||
This software is licensed under the GNU Lesser General Public License version 3. In short: This software is free, you may run the software freely, create modified versions, distribute this software and distribute modified versions, as long as the modified software too has a free software license (with an exception for linking to this software, as stated by the "Lesser" part of the LGPL, where this may not be required). You win this round, Stallman. The full license can be found in the `LICENSE` and `LICENSE.LESSER` files.
|
||||
|
||||
35
changelog
35
changelog
@ -1,32 +1,13 @@
|
||||
## Added
|
||||
* PWR Heatsink
|
||||
* Increases the core heat capacity by 5% per block
|
||||
* Makes cooling channels and heat exchangers slightly less effective (each heatsink counts as one quarter of a fuel rod in the heat calculation)
|
||||
* Bismuth bronze and arsenic bronze
|
||||
* Kind of self-explanatory
|
||||
* Can be made into anvils, allows for an alternative that doesn't involve 10 entire ingots of bismuth for a single anvil
|
||||
|
||||
## Changed
|
||||
* All launch pad blocks can now accept items, not just ports
|
||||
* Removed the old watz pellets and titanium filter
|
||||
* Removed copper panels, cast copper plates now take its place in most use-cases
|
||||
* Removed generator bodies and rotors, recipes use 6 dense gold wires per generator instead
|
||||
* Removed reinforced turbine shafts, most turbines now use HSS pipes instead
|
||||
* Removed the steam batteries (why did we even have those?)
|
||||
* Removed some old remap items (from back when the ZIRNOX rods got remapped)
|
||||
* Large and small shells have been merged into a single item which uses material autogen
|
||||
* A copper variant for shells has been added which is used for artillery shells
|
||||
* Shells are now only directly craftable via anvil, however they can be cast using the crucible as well
|
||||
* Most instances of the expensive steel pipes as well as the decorative pipes which need tons of microcrafting have been replaced with a new pipe item
|
||||
* The new pipes also use autogen, being available in different materials
|
||||
* Some of the recipes that used the small shells now use pipes instead
|
||||
* Tenfolded the throughout of powered condensers
|
||||
* Regular and combo filters now work for blistering agents (like mustard gas or air pollution)
|
||||
* Wires now render two faces instead of one, making them appear equally thick from any viewed angle
|
||||
* Slag taps can now be toggled and filtered
|
||||
* Foundry channels now have twice the throughput (2 ingots)
|
||||
* RBMK ReaSim and steam connectors now have tooltips explaining how they work, as there is no other ingame documentation on them
|
||||
* Arsenic is now made from only 16 oils scrap (instead of 256) in an ore acidizer using high-performance solvent (instead of chemical plant using sulfuric acid)
|
||||
* Meteorite and starmetal anvils have been replaced with desh and saturnite ones
|
||||
|
||||
## Fixed
|
||||
* Fixed crash caused by invalid default loot pool configuration
|
||||
* Fixed enchantment glint not rendering on upscaled items like certain swords or tier 2 pickaxes
|
||||
* Fixed wire connections becoming invisible when pointing straight down, wires should now rotate correctly
|
||||
* Fixed connection issue allowing channels to output into slag taps sideways
|
||||
* Fixed the strand caster sometimes voiding small amounts of material
|
||||
* Limited assembler input to up to 10 attempts per ingredient, fixing a rare issue where the assembler freezes the server when pulling items
|
||||
* Fixed fallout effects not loading chunks
|
||||
* Fixed RBMK steam channel recycling recipe
|
||||
@ -1,21 +1,48 @@
|
||||
mod_version=1.0.27
|
||||
# Empty build number makes a release type
|
||||
mod_build_number=4921
|
||||
mod_build_number=4939
|
||||
|
||||
credits=HbMinecraft, rodolphito (explosion algorithms), grangerave (explosion algorithms),\
|
||||
\ Hoboy (textures, models), Doctor17 (russian localization), Drillgon200 (effects, models,\
|
||||
\ porting), UFFR (RTGs, guns, casings, euphemium capacitor), Pu-238 (Tom impact effects), Bismarck\
|
||||
\ (chinese localization), Frooz (models), Minecreep (models), VT-6/24 (models, textures), Pheo (textures,\
|
||||
\ various machines, models, weapons), Vær (gas centrifuges, better worldgen, ZIRNOX, CP-1 parts, starter guide),\
|
||||
\ Adam29 (liquid petroleum, ethanol, electric furnace), Pashtet (russian localization), MartinTheDragon\
|
||||
\ (calculator, chunk-based fallout, bendable cranes, pipe improvements), haru315 (spiral point algorithm),\
|
||||
\ Sten89 (models), Pixelguru26 (textures), TheBlueHat (textures), Alcater (GUI textures, porting), impbk2002\
|
||||
\ (project settings), Nos (models), Burningwater202 (laminate glass), OvermindDL1 (project settings), TehTemmie\
|
||||
\ (reacher radiation function), Toshayo (satellite loot system, project settings, gradle curse task), Silly541\
|
||||
\ (config for safe ME drives), Voxelstice (OpenComputers integration, turbine spinup), BallOfEnergy1\
|
||||
\ (OpenComputers integration), martemen (project settings), Pvndols (thorium fuel recipe, gas turbine),\
|
||||
\ JamesH2 (blood mechanics, nitric acid, particle emitter), sdddddf80 (recipe configs, chinese localization,\
|
||||
\ custom machine holograms, I18n improvements), SuperCraftAlex (tooltips) LePeep (coilgun model, BDCL QC),\
|
||||
\ 70k (textures, glyphid AI, strand caster), Maksymisio (polish localization) Ice-Arrow (research reactor tweaks),\
|
||||
\ 245tt (anvil GUI improvements), MellowArpeggiation (new animation system, turbine sounds, sound fixes,\
|
||||
\ industrial lights, better particle diodes), FOlkvangrField (custom machine parts)
|
||||
credits=HbMinecraft,\
|
||||
\ rodolphito (explosion algorithms),\
|
||||
\ grangerave (explosion algorithms),\
|
||||
\ Hoboy (textures, models),\
|
||||
\ Drillgon200 (effects, models, porting),\
|
||||
\ MartinTheDragon (calculator, chunk-based fallout, bendable cranes, pipe improvements, PWR sounds),\
|
||||
\ Alcater (GUI textures, porting),\
|
||||
\ MellowArpeggiation (new animation system, turbine sounds, sound fixes, industrial lights, better particle diodes),\
|
||||
\ Pheo (textures, various machines, models, weapons),\
|
||||
\ Vær (gas centrifuges, better worldgen, ZIRNOX, CP-1 parts, starter guide),\
|
||||
\ LePeep (coilgun model, BDCL QC),\
|
||||
\ Adam29 (liquid petroleum, ethanol, electric furnace),\
|
||||
\ Pvndols (thorium fuel recipe, gas turbine),\
|
||||
\ JamesH2 (blood mechanics, nitric acid, particle emitter),\
|
||||
\ Doctor17 (russian localization)),\
|
||||
\ Pashtet (russian localization),\
|
||||
\ Bismarck (chinese localization),\
|
||||
\ Maksymisio (polish localization)\
|
||||
\ Pu-238 (Tom impact effects),\
|
||||
\ UFFR (RTGs, guns, casings, euphemium capacitor),\
|
||||
\ Frooz (models),\
|
||||
\ VT-6/24 (models, textures),\
|
||||
\ Nos (models),\
|
||||
\ Minecreep (models),\
|
||||
\ 70k (textures, glyphid AI, strand caster),\
|
||||
\ haru315 (spiral point algorithm),\
|
||||
\ Sten89 (models),\
|
||||
\ Pixelguru26 (textures),\
|
||||
\ TheBlueHat (textures),\
|
||||
\ Burningwater202 (laminate glass),\
|
||||
\ TehTemmie (reacher radiation function),\
|
||||
\ Silly541 (config for safe ME drives),\
|
||||
\ Voxelstice (OpenComputers integration, turbine spinup),\
|
||||
\ BallOfEnergy1 (OpenComputers integration),\
|
||||
\ martemen (project settings),\
|
||||
\ sdddddf80 (recipe configs, chinese localization, custom machine holograms),\
|
||||
\ SuperCraftAlex (tooltips)\
|
||||
\ Ice-Arrow (research reactor tweaks),\
|
||||
\ 245tt (anvil GUI improvements),\
|
||||
\ KoblizekXD (doors),\
|
||||
\ FOlkvangrField (custom machine parts),\
|
||||
\ Toshayo (satellite loot system, project settings, gradle curse task),\
|
||||
\ OvermindDL1 (project settings),\
|
||||
\ impbk2002 (project settings),\
|
||||
|
||||
@ -1,160 +0,0 @@
|
||||
package api.hbm.energy;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
/**
|
||||
* For compatible cables with no buffer, using the IPowertNet. You can make your own cables with IEnergyConnector as well, but they won't join their power network.
|
||||
* @author hbm
|
||||
*/
|
||||
public interface IEnergyConductor extends IEnergyConnector {
|
||||
|
||||
public IPowerNet getPowerNet();
|
||||
|
||||
public void setPowerNet(IPowerNet network);
|
||||
|
||||
/**
|
||||
* A unique identifier for every conductor tile. Used to prevent duplicates when loading previously persistent unloaded tiles.
|
||||
* @return
|
||||
*/
|
||||
public default int getIdentity() {
|
||||
return getIdentityFromTile((TileEntity) this);
|
||||
}
|
||||
|
||||
public static int getIdentityFromTile(TileEntity te) {
|
||||
return getIdentityFromPos(te.xCoord, te.yCoord, te.zCoord);
|
||||
}
|
||||
|
||||
public static int getIdentityFromPos(int x, int y, int z) {
|
||||
final int prime = 27644437; // must be this large to minimize localized collisions
|
||||
int result = 1;
|
||||
result = prime * result + x;
|
||||
result = prime * result + y;
|
||||
result = prime * result + z;
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Whether the link should be part of reeval when the network is changed.
|
||||
* I.e. if this link should join any of the new networks (FALSE for switches that are turned off for example)
|
||||
* @return
|
||||
*/
|
||||
public default boolean canReevaluate() {
|
||||
return !((TileEntity) this).isInvalid();
|
||||
}
|
||||
|
||||
/**
|
||||
* When a link leaves the network, the net has to manually calculate the resulting networks.
|
||||
* Each link has to decide what other links will join the same net.
|
||||
* @param copy
|
||||
*/
|
||||
public default void reevaluate(HashMap<Integer, IEnergyConductor> copy, HashMap<Integer, Integer> proxies) {
|
||||
|
||||
for(int[] pos : getConnectionPoints()) {
|
||||
int newX = pos[0];
|
||||
int newY = pos[1];
|
||||
int newZ = pos[2];
|
||||
int id = IEnergyConductor.getIdentityFromPos(newX, newY, newZ);
|
||||
|
||||
IEnergyConductor neighbor = copy.get(id);
|
||||
|
||||
if(neighbor == null) {
|
||||
Integer newId = proxies.get(id);
|
||||
|
||||
if(newId != null) {
|
||||
neighbor = copy.get(newId);
|
||||
}
|
||||
}
|
||||
|
||||
if(neighbor != null && this.canReevaluate() && neighbor.canReevaluate()) {
|
||||
|
||||
if(neighbor.getPowerNet() != null) {
|
||||
|
||||
//neighbor net and no self net
|
||||
if(this.getPowerNet() == null) {
|
||||
neighbor.getPowerNet().joinLink(this);
|
||||
//neighbor net and self net
|
||||
} else {
|
||||
this.getPowerNet().joinNetworks(neighbor.getPowerNet());
|
||||
}
|
||||
|
||||
//bidirectional re-eval, experimental and technically optional, only useful as a fallback
|
||||
} /*else {
|
||||
|
||||
//no neighbor net and no self net
|
||||
if(this.getPowerNet() == null) {
|
||||
this.setPowerNet(new PowerNet().joinLink(this));
|
||||
neighbor.setPowerNet(this.getPowerNet().joinLink(neighbor));
|
||||
//no neighbor net and self net
|
||||
} else {
|
||||
neighbor.setPowerNet(this.getPowerNet().joinLink(neighbor));
|
||||
}
|
||||
}*/
|
||||
|
||||
//extensive debugging has shown that bidirectional re-eval is complete shit
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a list of positions for the re-eval process. In short - what positions should be considered as connected.
|
||||
* Also used by pylons to quickly figure out what positions to connect to.
|
||||
* DEFAULT: Connects to all six neighboring blocks.
|
||||
* @return
|
||||
*/
|
||||
public default List<int[]> getConnectionPoints() {
|
||||
|
||||
List<int[]> pos = new ArrayList();
|
||||
TileEntity tile = (TileEntity) this;
|
||||
|
||||
for(ForgeDirection dir : ForgeDirection.VALID_DIRECTIONS) {
|
||||
int newX = tile.xCoord + dir.offsetX;
|
||||
int newY = tile.yCoord + dir.offsetY;
|
||||
int newZ = tile.zCoord + dir.offsetZ;
|
||||
|
||||
pos.add(new int[] {newX, newY, newZ});
|
||||
}
|
||||
|
||||
return pos;
|
||||
}
|
||||
|
||||
/**
|
||||
* Since isLoaded is only currently used for weeding out unwanted subscribers, and cables shouldn't (although technically can) be
|
||||
* subscribers, we just default to true because I don't feel like wasting time implementing things that we don't actually need.
|
||||
* Perhaps this indicates a minor flaw in the new API, but I physically lack the ability to worry about it.
|
||||
*/
|
||||
@Override
|
||||
public default boolean isLoaded() {
|
||||
return true;
|
||||
}
|
||||
|
||||
//TODO: check if this standard implementation doesn't break anything (it shouldn't but right now it's a bit redundant) also: remove duplicate implementations
|
||||
@Override
|
||||
public default long transferPower(long power) {
|
||||
|
||||
if(this.getPowerNet() == null)
|
||||
return power;
|
||||
|
||||
return this.getPowerNet().transferPower(power);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns whether the conductor has mutliblock proxies which need to be taken into consideration for re-eval.
|
||||
* @return
|
||||
*/
|
||||
public default boolean hasProxies() {
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the identities (position-based) of proxies which resolve into the conductor's own identity.
|
||||
* @return
|
||||
*/
|
||||
public default List<Integer> getProxies() {
|
||||
return new ArrayList();
|
||||
}
|
||||
}
|
||||
@ -1,128 +0,0 @@
|
||||
package api.hbm.energy;
|
||||
|
||||
import com.hbm.packet.AuxParticlePacketNT;
|
||||
import com.hbm.packet.PacketDispatcher;
|
||||
import com.hbm.util.CompatEnergyControl;
|
||||
|
||||
import cpw.mods.fml.common.network.NetworkRegistry.TargetPoint;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.Vec3;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
/**
|
||||
* For anything that connects to power and can be transferred power to, the bottom-level interface.
|
||||
* This is mean for TILE ENTITIES
|
||||
* @author hbm
|
||||
*/
|
||||
public interface IEnergyConnector extends ILoadedTile {
|
||||
|
||||
/**
|
||||
* Returns the amount of power that remains in the source after transfer
|
||||
* @param power
|
||||
* @return
|
||||
*/
|
||||
public long transferPower(long power);
|
||||
|
||||
/**
|
||||
* Whether the given side can be connected to
|
||||
* dir refers to the side of this block, not the connecting block doing the check
|
||||
* @param dir
|
||||
* @return
|
||||
*/
|
||||
public default boolean canConnect(ForgeDirection dir) {
|
||||
return dir != ForgeDirection.UNKNOWN;
|
||||
}
|
||||
|
||||
/**
|
||||
* The current power of either the machine or an entire network
|
||||
* @return
|
||||
*/
|
||||
public long getPower();
|
||||
|
||||
/**
|
||||
* The capacity of either the machine or an entire network
|
||||
* @return
|
||||
*/
|
||||
public long getMaxPower();
|
||||
|
||||
public default long getTransferWeight() {
|
||||
return Math.max(getMaxPower() - getPower(), 0);
|
||||
}
|
||||
|
||||
/**
|
||||
* Basic implementation of subscribing to a nearby power grid
|
||||
* @param world
|
||||
* @param x
|
||||
* @param y
|
||||
* @param z
|
||||
*/
|
||||
public default void trySubscribe(World world, int x, int y, int z, ForgeDirection dir) {
|
||||
|
||||
TileEntity te = world.getTileEntity(x, y, z);
|
||||
boolean red = false;
|
||||
|
||||
if(te instanceof IEnergyConductor) {
|
||||
IEnergyConductor con = (IEnergyConductor) te;
|
||||
|
||||
if(!con.canConnect(dir.getOpposite()))
|
||||
return;
|
||||
|
||||
if(con.getPowerNet() != null && !con.getPowerNet().isSubscribed(this))
|
||||
con.getPowerNet().subscribe(this);
|
||||
|
||||
if(con.getPowerNet() != null)
|
||||
red = true;
|
||||
}
|
||||
|
||||
if(particleDebug) {
|
||||
NBTTagCompound data = new NBTTagCompound();
|
||||
data.setString("type", "network");
|
||||
data.setString("mode", "power");
|
||||
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 void tryUnsubscribe(World world, int x, int y, int z) {
|
||||
|
||||
TileEntity te = world.getTileEntity(x, y, z);
|
||||
|
||||
if(te instanceof IEnergyConductor) {
|
||||
IEnergyConductor con = (IEnergyConductor) te;
|
||||
|
||||
if(con.getPowerNet() != null && con.getPowerNet().isSubscribed(this))
|
||||
con.getPowerNet().unsubscribe(this);
|
||||
}
|
||||
}
|
||||
|
||||
public static final boolean particleDebug = false;
|
||||
|
||||
public default Vec3 getDebugParticlePos() {
|
||||
TileEntity te = (TileEntity) this;
|
||||
Vec3 vec = Vec3.createVectorHelper(te.xCoord + 0.5, te.yCoord + 1, te.zCoord + 0.5);
|
||||
return vec;
|
||||
}
|
||||
|
||||
/** Shortcut for adding energy data to tiles that implement IInfoProviderEC, should NOT be used externally for compat! Use IInfoProviderEC.provideInfo() instead! */
|
||||
public default void provideInfoForEC(NBTTagCompound data) {
|
||||
data.setLong(CompatEnergyControl.L_ENERGY_HE, this.getPower());
|
||||
data.setLong(CompatEnergyControl.L_CAPACITY_HE, this.getMaxPower());
|
||||
}
|
||||
|
||||
public default ConnectionPriority getPriority() {
|
||||
return ConnectionPriority.NORMAL;
|
||||
}
|
||||
|
||||
public enum ConnectionPriority {
|
||||
LOW,
|
||||
NORMAL,
|
||||
HIGH
|
||||
}
|
||||
}
|
||||
@ -1,19 +0,0 @@
|
||||
package api.hbm.energy;
|
||||
|
||||
public interface IEnergyGenerator extends IEnergyUser {
|
||||
|
||||
/**
|
||||
* Standard implementation for machines that can only send energy but never receive it.
|
||||
* @param power
|
||||
*/
|
||||
@Override
|
||||
public default long transferPower(long power) {
|
||||
return power;
|
||||
}
|
||||
|
||||
/* should stop making non-receivers from interfering by applying their weight which doesn't even matter */
|
||||
@Override
|
||||
public default long getTransferWeight() {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
@ -1,114 +0,0 @@
|
||||
package api.hbm.energy;
|
||||
|
||||
import com.hbm.packet.AuxParticlePacketNT;
|
||||
import com.hbm.packet.PacketDispatcher;
|
||||
|
||||
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;
|
||||
|
||||
/**
|
||||
* For machines and things that have an energy buffer and are affected by EMPs
|
||||
* @author hbm
|
||||
*/
|
||||
public interface IEnergyUser extends IEnergyConnector {
|
||||
|
||||
/**
|
||||
* Not to be used for actual energy transfer, rather special external things like EMPs and sync packets
|
||||
*/
|
||||
public void setPower(long power);
|
||||
|
||||
/**
|
||||
* Standard implementation for power transfer.
|
||||
* Turns out you can override interfaces to provide a default implementation. Neat.
|
||||
* @param long power
|
||||
*/
|
||||
@Override
|
||||
public default long transferPower(long power) {
|
||||
|
||||
if(this.getPower() + power > this.getMaxPower()) {
|
||||
|
||||
long overshoot = this.getPower() + power - this.getMaxPower();
|
||||
this.setPower(this.getMaxPower());
|
||||
return overshoot;
|
||||
}
|
||||
|
||||
if(this.getPower() + power < 0) return 0; //safeguard for negative energy or overflows
|
||||
|
||||
this.setPower(this.getPower() + power);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* Standard implementation of sending power
|
||||
* @param world
|
||||
* @param x
|
||||
* @param y
|
||||
* @param z
|
||||
* @param dir
|
||||
*/
|
||||
public default void sendPower(World world, int x, int y, int z, ForgeDirection dir) {
|
||||
|
||||
TileEntity te = world.getTileEntity(x, y, z);
|
||||
boolean wasSubscribed = false;
|
||||
boolean red = false;
|
||||
|
||||
// first we make sure we're not subscribed to the network that we'll be supplying
|
||||
if(te instanceof IEnergyConductor) {
|
||||
IEnergyConductor con = (IEnergyConductor) te;
|
||||
|
||||
if(con.canConnect(dir.getOpposite()) && con.getPowerNet() != null && con.getPowerNet().isSubscribed(this)) {
|
||||
con.getPowerNet().unsubscribe(this);
|
||||
wasSubscribed = true;
|
||||
}
|
||||
}
|
||||
|
||||
//then we add energy
|
||||
if(te instanceof IEnergyConnector) {
|
||||
IEnergyConnector con = (IEnergyConnector) te;
|
||||
|
||||
if(con.canConnect(dir.getOpposite())) {
|
||||
long oldPower = this.getPower();
|
||||
long transfer = oldPower - con.transferPower(oldPower);
|
||||
this.setPower(oldPower - transfer);
|
||||
red = true;
|
||||
}
|
||||
}
|
||||
|
||||
//then we subscribe if possible
|
||||
if(wasSubscribed && te instanceof IEnergyConductor) {
|
||||
IEnergyConductor con = (IEnergyConductor) te;
|
||||
|
||||
if(con.getPowerNet() != null && !con.getPowerNet().isSubscribed(this)) {
|
||||
con.getPowerNet().subscribe(this);
|
||||
}
|
||||
}
|
||||
|
||||
if(particleDebug) {
|
||||
NBTTagCompound data = new NBTTagCompound();
|
||||
data.setString("type", "network");
|
||||
data.setString("mode", "power");
|
||||
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 void updateStandardConnections(World world, TileEntity te) {
|
||||
updateStandardConnections(world, te.xCoord, te.yCoord, te.zCoord);
|
||||
}
|
||||
|
||||
public default void updateStandardConnections(World world, int x, int y, int z) {
|
||||
|
||||
for(ForgeDirection dir : ForgeDirection.VALID_DIRECTIONS) {
|
||||
this.trySubscribe(world, x + dir.offsetX, y + dir.offsetY, z + dir.offsetZ, dir);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1,37 +0,0 @@
|
||||
package api.hbm.energy;
|
||||
|
||||
import java.math.BigInteger;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Not mandatory to use, but making your cables IPowerNet-compliant will allow them to connect to NTM cables.
|
||||
* Cables will still work without it as long as they implement IEnergyConductor (or even IEnergyConnector) + self-built network code
|
||||
* @author hbm
|
||||
*/
|
||||
public interface IPowerNet {
|
||||
|
||||
public void joinNetworks(IPowerNet network);
|
||||
|
||||
public IPowerNet joinLink(IEnergyConductor conductor);
|
||||
public void leaveLink(IEnergyConductor conductor);
|
||||
|
||||
public void subscribe(IEnergyConnector connector);
|
||||
public void unsubscribe(IEnergyConnector connector);
|
||||
public boolean isSubscribed(IEnergyConnector connector);
|
||||
|
||||
public void destroy();
|
||||
|
||||
/**
|
||||
* When a link is removed, instead of destroying the network, causing it to be recreated from currently loaded conductors,
|
||||
* we re-evaluate it, creating new nets based on the previous links.
|
||||
*/
|
||||
public void reevaluate();
|
||||
|
||||
public boolean isValid();
|
||||
|
||||
public List<IEnergyConductor> getLinks();
|
||||
public List<IEnergyConnector> getSubscribers();
|
||||
|
||||
public long transferPower(long power);
|
||||
public BigInteger getTotalTransfer();
|
||||
}
|
||||
@ -1,257 +0,0 @@
|
||||
package api.hbm.energy;
|
||||
|
||||
import java.math.BigInteger;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
|
||||
import com.hbm.config.GeneralConfig;
|
||||
|
||||
import api.hbm.energy.IEnergyConnector.ConnectionPriority;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
|
||||
/**
|
||||
* Basic IPowerNet implementation. The behavior of this demo might change inbetween releases, but the API remains the same.
|
||||
* For more consistency please implement your own IPowerNet.
|
||||
* @author hbm
|
||||
*/
|
||||
public class PowerNet implements IPowerNet {
|
||||
|
||||
private boolean valid = true;
|
||||
private HashMap<Integer, IEnergyConductor> links = new HashMap();
|
||||
private HashMap<Integer, Integer> proxies = new HashMap();
|
||||
private List<IEnergyConnector> subscribers = new ArrayList();
|
||||
|
||||
public static List<PowerNet> trackingInstances = null;
|
||||
protected BigInteger totalTransfer = BigInteger.ZERO;
|
||||
|
||||
@Override
|
||||
public void joinNetworks(IPowerNet network) {
|
||||
|
||||
if(network == this)
|
||||
return; //wtf?!
|
||||
|
||||
for(IEnergyConductor conductor : network.getLinks()) {
|
||||
joinLink(conductor);
|
||||
}
|
||||
network.getLinks().clear();
|
||||
|
||||
for(IEnergyConnector connector : network.getSubscribers()) {
|
||||
this.subscribe(connector);
|
||||
}
|
||||
|
||||
network.destroy();
|
||||
}
|
||||
|
||||
@Override
|
||||
public IPowerNet joinLink(IEnergyConductor conductor) {
|
||||
|
||||
if(conductor.getPowerNet() != null)
|
||||
conductor.getPowerNet().leaveLink(conductor);
|
||||
|
||||
conductor.setPowerNet(this);
|
||||
int identity = conductor.getIdentity();
|
||||
this.links.put(identity, conductor);
|
||||
|
||||
if(conductor.hasProxies()) {
|
||||
for(Integer i : conductor.getProxies()) {
|
||||
this.proxies.put(i, identity);
|
||||
}
|
||||
}
|
||||
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void leaveLink(IEnergyConductor conductor) {
|
||||
conductor.setPowerNet(null);
|
||||
int identity = conductor.getIdentity();
|
||||
this.links.remove(identity);
|
||||
|
||||
if(conductor.hasProxies()) {
|
||||
for(Integer i : conductor.getProxies()) {
|
||||
this.proxies.remove(i);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void subscribe(IEnergyConnector connector) {
|
||||
this.subscribers.add(connector);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void unsubscribe(IEnergyConnector connector) {
|
||||
this.subscribers.remove(connector);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isSubscribed(IEnergyConnector connector) {
|
||||
return this.subscribers.contains(connector);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<IEnergyConductor> getLinks() {
|
||||
List<IEnergyConductor> linkList = new ArrayList();
|
||||
linkList.addAll(this.links.values());
|
||||
return linkList;
|
||||
}
|
||||
|
||||
public HashMap<Integer, Integer> getProxies() {
|
||||
HashMap<Integer, Integer> proxyCopy = new HashMap(proxies);
|
||||
return proxyCopy;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<IEnergyConnector> getSubscribers() {
|
||||
return this.subscribers;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void destroy() {
|
||||
this.valid = false;
|
||||
this.subscribers.clear();
|
||||
|
||||
for(IEnergyConductor link : this.links.values()) {
|
||||
link.setPowerNet(null);
|
||||
}
|
||||
|
||||
this.links.clear();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isValid() {
|
||||
return this.valid;
|
||||
}
|
||||
|
||||
@Override
|
||||
public BigInteger getTotalTransfer() {
|
||||
return this.totalTransfer;
|
||||
}
|
||||
|
||||
public long lastCleanup = System.currentTimeMillis();
|
||||
|
||||
@Override
|
||||
public long transferPower(long power) {
|
||||
|
||||
/*if(lastCleanup + 45 < System.currentTimeMillis()) {
|
||||
cleanup(this.subscribers);
|
||||
lastCleanup = System.currentTimeMillis();
|
||||
}*/
|
||||
|
||||
List<PowerNet> cache = new ArrayList();
|
||||
if(trackingInstances != null && !trackingInstances.isEmpty()) {
|
||||
cache.addAll(trackingInstances);
|
||||
}
|
||||
|
||||
trackingInstances = new ArrayList();
|
||||
trackingInstances.add(this);
|
||||
long result = fairTransfer(this.subscribers, power);
|
||||
trackingInstances.addAll(cache);
|
||||
return result;
|
||||
}
|
||||
|
||||
public static void cleanup(List<IEnergyConnector> subscribers) {
|
||||
|
||||
subscribers.removeIf(x ->
|
||||
x == null || !(x instanceof TileEntity) || ((TileEntity)x).isInvalid() || !x.isLoaded()
|
||||
);
|
||||
}
|
||||
|
||||
public static long fairTransfer(List<IEnergyConnector> subscribers, long power) {
|
||||
|
||||
if(power <= 0) return 0;
|
||||
|
||||
if(subscribers.isEmpty())
|
||||
return power;
|
||||
|
||||
cleanup(subscribers);
|
||||
|
||||
ConnectionPriority[] priorities = new ConnectionPriority[] {ConnectionPriority.HIGH, ConnectionPriority.NORMAL, ConnectionPriority.LOW};
|
||||
|
||||
long totalTransfer = 0;
|
||||
|
||||
for(ConnectionPriority p : priorities) {
|
||||
|
||||
List<IEnergyConnector> subList = new ArrayList();
|
||||
subscribers.forEach(x -> {
|
||||
if(x.getPriority() == p) {
|
||||
subList.add(x);
|
||||
}
|
||||
});
|
||||
|
||||
if(subList.isEmpty())
|
||||
continue;
|
||||
|
||||
List<Long> weight = new ArrayList();
|
||||
long totalReq = 0;
|
||||
|
||||
for(IEnergyConnector con : subList) {
|
||||
long req = con.getTransferWeight();
|
||||
weight.add(req);
|
||||
totalReq += req;
|
||||
}
|
||||
|
||||
if(totalReq == 0)
|
||||
continue;
|
||||
|
||||
long totalGiven = 0;
|
||||
|
||||
for(int i = 0; i < subList.size(); i++) {
|
||||
IEnergyConnector con = subList.get(i);
|
||||
long req = weight.get(i);
|
||||
double fraction = (double)req / (double)totalReq;
|
||||
|
||||
long given = (long) Math.floor(fraction * power);
|
||||
|
||||
totalGiven += (given - con.transferPower(given));
|
||||
|
||||
if(con instanceof TileEntity) {
|
||||
TileEntity tile = (TileEntity) con;
|
||||
tile.getWorldObj().markTileEntityChunkModified(tile.xCoord, tile.yCoord, tile.zCoord, tile);
|
||||
}
|
||||
}
|
||||
|
||||
power -= totalGiven;
|
||||
totalTransfer += totalGiven;
|
||||
}
|
||||
|
||||
if(trackingInstances != null) {
|
||||
|
||||
for(int i = 0; i < trackingInstances.size(); i++) {
|
||||
PowerNet net = trackingInstances.get(i);
|
||||
net.totalTransfer = net.totalTransfer.add(BigInteger.valueOf(totalTransfer));
|
||||
}
|
||||
|
||||
trackingInstances.clear();
|
||||
}
|
||||
|
||||
return power;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void reevaluate() {
|
||||
|
||||
if(!GeneralConfig.enableReEval) {
|
||||
this.destroy();
|
||||
return;
|
||||
}
|
||||
|
||||
HashMap<Integer, IEnergyConductor> copy = new HashMap(links);
|
||||
HashMap<Integer, Integer> proxyCopy = new HashMap(proxies);
|
||||
|
||||
for(IEnergyConductor link : copy.values()) {
|
||||
this.leaveLink(link);
|
||||
}
|
||||
|
||||
for(IEnergyConductor link : copy.values()) {
|
||||
|
||||
link.setPowerNet(null);
|
||||
link.reevaluate(copy, proxyCopy);
|
||||
|
||||
if(link.getPowerNet() == null) {
|
||||
link.setPowerNet(new PowerNet().joinLink(link));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1,4 +1,4 @@
|
||||
package api.hbm.energy;
|
||||
package api.hbm.energymk2;
|
||||
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
23
src/main/java/api/hbm/energymk2/IEnergyConductorMK2.java
Normal file
23
src/main/java/api/hbm/energymk2/IEnergyConductorMK2.java
Normal file
@ -0,0 +1,23 @@
|
||||
package api.hbm.energymk2;
|
||||
|
||||
import com.hbm.lib.Library;
|
||||
import com.hbm.util.fauxpointtwelve.BlockPos;
|
||||
import com.hbm.util.fauxpointtwelve.DirPos;
|
||||
|
||||
import api.hbm.energymk2.Nodespace.PowerNode;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
|
||||
public interface IEnergyConductorMK2 extends IEnergyConnectorMK2 {
|
||||
|
||||
public default PowerNode createNode() {
|
||||
TileEntity tile = (TileEntity) this;
|
||||
return new PowerNode(new BlockPos(tile.xCoord, tile.yCoord, tile.zCoord)).setConnections(
|
||||
new DirPos(tile.xCoord + 1, tile.yCoord, tile.zCoord, Library.POS_X),
|
||||
new DirPos(tile.xCoord - 1, tile.yCoord, tile.zCoord, Library.NEG_X),
|
||||
new DirPos(tile.xCoord, tile.yCoord + 1, tile.zCoord, Library.POS_Y),
|
||||
new DirPos(tile.xCoord, tile.yCoord - 1, tile.zCoord, Library.NEG_Y),
|
||||
new DirPos(tile.xCoord, tile.yCoord, tile.zCoord + 1, Library.POS_Z),
|
||||
new DirPos(tile.xCoord, tile.yCoord, tile.zCoord - 1, Library.NEG_Z)
|
||||
);
|
||||
}
|
||||
}
|
||||
@ -1,4 +1,4 @@
|
||||
package api.hbm.energy;
|
||||
package api.hbm.energymk2;
|
||||
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
16
src/main/java/api/hbm/energymk2/IEnergyConnectorMK2.java
Normal file
16
src/main/java/api/hbm/energymk2/IEnergyConnectorMK2.java
Normal file
@ -0,0 +1,16 @@
|
||||
package api.hbm.energymk2;
|
||||
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
public interface IEnergyConnectorMK2 {
|
||||
|
||||
/**
|
||||
* Whether the given side can be connected to
|
||||
* dir refers to the side of this block, not the connecting block doing the check
|
||||
* @param dir
|
||||
* @return
|
||||
*/
|
||||
public default boolean canConnect(ForgeDirection dir) {
|
||||
return dir != ForgeDirection.UNKNOWN;
|
||||
}
|
||||
}
|
||||
29
src/main/java/api/hbm/energymk2/IEnergyHandlerMK2.java
Normal file
29
src/main/java/api/hbm/energymk2/IEnergyHandlerMK2.java
Normal file
@ -0,0 +1,29 @@
|
||||
package api.hbm.energymk2;
|
||||
|
||||
import com.hbm.util.CompatEnergyControl;
|
||||
|
||||
import api.hbm.tile.ILoadedTile;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.Vec3;
|
||||
|
||||
/** DO NOT USE DIRECTLY! This is simply the common ancestor to providers and receivers, because all this behavior has to be excluded from conductors! */
|
||||
public interface IEnergyHandlerMK2 extends IEnergyConnectorMK2, ILoadedTile {
|
||||
|
||||
public long getPower();
|
||||
public void setPower(long power);
|
||||
public long getMaxPower();
|
||||
|
||||
public static final boolean particleDebug = false;
|
||||
|
||||
public default Vec3 getDebugParticlePosMK2() {
|
||||
TileEntity te = (TileEntity) this;
|
||||
Vec3 vec = Vec3.createVectorHelper(te.xCoord + 0.5, te.yCoord + 1, te.zCoord + 0.5);
|
||||
return vec;
|
||||
}
|
||||
|
||||
public default void provideInfoForECMK2(NBTTagCompound data) {
|
||||
data.setLong(CompatEnergyControl.L_ENERGY_HE, this.getPower());
|
||||
data.setLong(CompatEnergyControl.L_CAPACITY_HE, this.getMaxPower());
|
||||
}
|
||||
}
|
||||
67
src/main/java/api/hbm/energymk2/IEnergyProviderMK2.java
Normal file
67
src/main/java/api/hbm/energymk2/IEnergyProviderMK2.java
Normal file
@ -0,0 +1,67 @@
|
||||
package api.hbm.energymk2;
|
||||
|
||||
import com.hbm.packet.AuxParticlePacketNT;
|
||||
import com.hbm.packet.PacketDispatcher;
|
||||
|
||||
import api.hbm.energymk2.Nodespace.PowerNode;
|
||||
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;
|
||||
|
||||
/** If it sends energy, use this */
|
||||
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) {
|
||||
this.setPower(this.getPower() - power);
|
||||
}
|
||||
|
||||
public default long getProviderSpeed() {
|
||||
return this.getMaxPower();
|
||||
}
|
||||
|
||||
public default void tryProvide(World world, int x, int y, int z, ForgeDirection dir) {
|
||||
|
||||
TileEntity te = world.getTileEntity(x, y, z);
|
||||
boolean red = false;
|
||||
|
||||
if(te instanceof IEnergyConductorMK2) {
|
||||
IEnergyConductorMK2 con = (IEnergyConductorMK2) te;
|
||||
if(con.canConnect(dir.getOpposite())) {
|
||||
|
||||
PowerNode node = Nodespace.getNode(world, x, y, z);
|
||||
|
||||
if(node != null && node.net != null) {
|
||||
node.net.addProvider(this);
|
||||
red = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(te instanceof IEnergyReceiverMK2 && te != this) {
|
||||
IEnergyReceiverMK2 rec = (IEnergyReceiverMK2) te;
|
||||
if(rec.canConnect(dir.getOpposite())) {
|
||||
long provides = Math.min(this.getPower(), this.getProviderSpeed());
|
||||
long receives = Math.min(rec.getMaxPower() - rec.getPower(), rec.getReceiverSpeed());
|
||||
long toTransfer = Math.min(provides, receives);
|
||||
toTransfer -= rec.transferPower(toTransfer);
|
||||
this.usePower(toTransfer);
|
||||
}
|
||||
}
|
||||
|
||||
if(particleDebug) {
|
||||
NBTTagCompound data = new NBTTagCompound();
|
||||
data.setString("type", "network");
|
||||
data.setString("mode", "power");
|
||||
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));
|
||||
}
|
||||
}
|
||||
}
|
||||
108
src/main/java/api/hbm/energymk2/IEnergyReceiverMK2.java
Normal file
108
src/main/java/api/hbm/energymk2/IEnergyReceiverMK2.java
Normal file
@ -0,0 +1,108 @@
|
||||
package api.hbm.energymk2;
|
||||
|
||||
import com.hbm.packet.AuxParticlePacketNT;
|
||||
import com.hbm.packet.PacketDispatcher;
|
||||
|
||||
import api.hbm.energymk2.Nodespace.PowerNode;
|
||||
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;
|
||||
|
||||
/** If it receives energy, use this */
|
||||
public interface IEnergyReceiverMK2 extends IEnergyHandlerMK2 {
|
||||
|
||||
public default long transferPower(long power) {
|
||||
if(power + this.getPower() <= this.getMaxPower()) {
|
||||
this.setPower(power + this.getPower());
|
||||
return 0;
|
||||
}
|
||||
long capacity = this.getMaxPower() - this.getPower();
|
||||
long overshoot = power - capacity;
|
||||
this.setPower(this.getMaxPower());
|
||||
return overshoot;
|
||||
}
|
||||
|
||||
public default long getReceiverSpeed() {
|
||||
return this.getMaxPower();
|
||||
}
|
||||
|
||||
public default void trySubscribe(World world, int x, int y, int z, ForgeDirection dir) {
|
||||
|
||||
TileEntity te = world.getTileEntity(x, y, z);
|
||||
boolean red = false;
|
||||
|
||||
if(te instanceof IEnergyConductorMK2) {
|
||||
IEnergyConductorMK2 con = (IEnergyConductorMK2) te;
|
||||
if(!con.canConnect(dir.getOpposite())) return;
|
||||
|
||||
PowerNode node = Nodespace.getNode(world, x, y, z);
|
||||
|
||||
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", "power");
|
||||
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 void tryUnsubscribe(World world, int x, int y, int z) {
|
||||
|
||||
TileEntity te = world.getTileEntity(x, y, z);
|
||||
|
||||
if(te instanceof IEnergyConductorMK2) {
|
||||
IEnergyConductorMK2 con = (IEnergyConductorMK2) te;
|
||||
PowerNode node = con.createNode();
|
||||
|
||||
if(node != null && node.net != null) {
|
||||
node.net.removeReceiver(this);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Project MKUltra was an illegal human experiments program designed and undertaken by the U.S. Central Intelligence Agency (CIA)
|
||||
* to develop procedures and identify drugs that could be used during interrogations to weaken people and force confessions through
|
||||
* brainwashing and psychological torture. It began in 1953 and was halted in 1973. MKUltra used numerous methods to manipulate
|
||||
* its subjects' mental states and brain functions, such as the covert administration of high doses of psychoactive drugs (especially LSD)
|
||||
* and other chemicals without the subjects' consent, electroshocks, hypnosis, sensory deprivation, isolation, verbal and sexual
|
||||
* abuse, and other forms of torture.
|
||||
* MKUltra was preceded by Project Artichoke. It was organized through the CIA's Office of Scientific Intelligence and coordinated
|
||||
* with the United States Army Biological Warfare Laboratories. The program engaged in illegal activities, including the
|
||||
* use of U.S. and Canadian citizens as unwitting test subjects. MKUltra's scope was broad, with activities carried
|
||||
* out under the guise of research at more than 80 institutions aside from the military, including colleges and universities,
|
||||
* hospitals, prisons, and pharmaceutical companies. The CIA operated using front organizations, although some top officials at these
|
||||
* institutions were aware of the CIA's involvement.
|
||||
* MKUltra was revealed to the public in 1975 by the Church Committee of the United States Congress and Gerald Ford's United States
|
||||
* President's Commission on CIA activities within the United States (the Rockefeller Commission). Investigative efforts were hampered
|
||||
* by CIA Director Richard Helms's order that all MKUltra files be destroyed in 1973; the Church Committee and Rockefeller Commission
|
||||
* investigations relied on the sworn testimony of direct participants and on the small number of documents that survived Helms's order.
|
||||
* In 1977, a Freedom of Information Act request uncovered a cache of 20,000 documents relating to MKUltra, which led to Senate hearings.
|
||||
* Some surviving information about MKUltra was declassified in 2001.
|
||||
* */
|
||||
public default ConnectionPriority getPriority() {
|
||||
return ConnectionPriority.NORMAL;
|
||||
}
|
||||
|
||||
/** More is better-er */
|
||||
public enum ConnectionPriority {
|
||||
LOWEST,
|
||||
LOW,
|
||||
NORMAL,
|
||||
HIGH,
|
||||
HIGHEST
|
||||
}
|
||||
}
|
||||
193
src/main/java/api/hbm/energymk2/Nodespace.java
Normal file
193
src/main/java/api/hbm/energymk2/Nodespace.java
Normal file
@ -0,0 +1,193 @@
|
||||
package api.hbm.energymk2;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.Map.Entry;
|
||||
import java.util.Set;
|
||||
|
||||
import com.hbm.util.fauxpointtwelve.BlockPos;
|
||||
import com.hbm.util.fauxpointtwelve.DirPos;
|
||||
|
||||
import net.minecraft.server.MinecraftServer;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
/**
|
||||
* The "Nodespace" is an intermediate, "ethereal" layer of abstraction that tracks nodes (i.e. cables) even when they are no longer loaded, allowing continued operation even when unloaded
|
||||
* @author hbm
|
||||
*
|
||||
*/
|
||||
public class Nodespace {
|
||||
|
||||
/** Contains all "NodeWorld" instances, i.e. lists of nodes existing per world */
|
||||
public static HashMap<World, NodeWorld> worlds = new HashMap();
|
||||
public static Set<PowerNetMK2> activePowerNets = new HashSet();
|
||||
|
||||
public static PowerNode getNode(World world, int x, int y, int z) {
|
||||
NodeWorld nodeWorld = worlds.get(world);
|
||||
if(nodeWorld != null) return nodeWorld.nodes.get(new BlockPos(x, y, z));
|
||||
return null;
|
||||
}
|
||||
|
||||
public static void createNode(World world, PowerNode node) {
|
||||
NodeWorld nodeWorld = worlds.get(world);
|
||||
if(nodeWorld == null) {
|
||||
nodeWorld = new NodeWorld();
|
||||
worlds.put(world, nodeWorld);
|
||||
}
|
||||
nodeWorld.pushNode(node);
|
||||
}
|
||||
|
||||
public static void destroyNode(World world, int x, int y, int z) {
|
||||
PowerNode node = getNode(world, x, y, z);
|
||||
if(node != null) {
|
||||
worlds.get(world).popNode(node);
|
||||
}
|
||||
}
|
||||
|
||||
/** Goes over each node and manages connections */
|
||||
public static void updateNodespace() {
|
||||
|
||||
for(World world : MinecraftServer.getServer().worldServers) {
|
||||
NodeWorld nodes = worlds.get(world);
|
||||
|
||||
for(Entry<BlockPos, PowerNode> entry : nodes.nodes.entrySet()) {
|
||||
PowerNode node = entry.getValue();
|
||||
if(!node.hasValidNet() || node.recentlyChanged) {
|
||||
checkNodeConnection(world, node);
|
||||
node.recentlyChanged = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
updatePowerNets();
|
||||
}
|
||||
|
||||
private static void updatePowerNets() {
|
||||
|
||||
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 */
|
||||
private static void checkNodeConnection(World world, PowerNode node) {
|
||||
|
||||
for(DirPos con : node.connections) {
|
||||
|
||||
PowerNode conNode = getNode(world, con.getX(), con.getY(), con.getZ()); // get whatever neighbor node intersects with that connection
|
||||
|
||||
if(conNode != null) { // if there is a node at that place
|
||||
|
||||
if(conNode.hasValidNet() && conNode.net == node.net) continue; // if the net is valid and both nodes have the same net, skip
|
||||
|
||||
if(checkConnection(conNode, con, false)) {
|
||||
connectToNode(node, conNode);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(node.net == null || !node.net.isValid()) new PowerNetMK2().joinLink(node);
|
||||
}
|
||||
|
||||
public static boolean checkConnection(PowerNode connectsTo, DirPos connectFrom, boolean skipSideCheck) {
|
||||
|
||||
for(DirPos revCon : connectsTo.connections) {
|
||||
|
||||
if(revCon.getX() - revCon.getDir().offsetX == connectFrom.getX() && revCon.getY() - revCon.getDir().offsetY == connectFrom.getY() && revCon.getZ() - revCon.getDir().offsetZ == connectFrom.getZ() && (revCon.getDir() == connectFrom.getDir().getOpposite() || skipSideCheck)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/** Links two nodes with different or potentially no networks */
|
||||
private static void connectToNode(PowerNode origin, PowerNode connection) {
|
||||
|
||||
if(origin.hasValidNet() && connection.hasValidNet()) { // both nodes have nets, but the nets are different (previous assumption), join networks
|
||||
if(origin.net.links.size() > connection.net.links.size()) {
|
||||
origin.net.joinNetworks(connection.net);
|
||||
} else {
|
||||
connection.net.joinNetworks(origin.net);
|
||||
}
|
||||
} else if(!origin.hasValidNet() && connection.hasValidNet()) { // origin has no net, connection does, have origin join connection's net
|
||||
connection.net.joinLink(origin);
|
||||
} else if(origin.hasValidNet() && !connection.hasValidNet()) { // ...and vice versa
|
||||
origin.net.joinLink(connection);
|
||||
}
|
||||
}
|
||||
|
||||
public static class NodeWorld {
|
||||
|
||||
/** Contains a map showing where each node is, a node is every spot that a cable exists at.
|
||||
* Instead of the old proxy system, things like substation now create multiple nodes at their connection points */
|
||||
public static HashMap<BlockPos, PowerNode> nodes = new HashMap();
|
||||
|
||||
/** Adds a node at all its positions to the nodespace */
|
||||
public void pushNode(PowerNode node) {
|
||||
for(BlockPos pos : node.positions) {
|
||||
nodes.put(pos, node);
|
||||
}
|
||||
}
|
||||
|
||||
/** Removes the specified node from all positions from nodespace */
|
||||
public void popNode(PowerNode node) {
|
||||
if(node.net != null) node.net.destroy();
|
||||
for(BlockPos pos : node.positions) {
|
||||
nodes.remove(pos);
|
||||
node.expired = true;
|
||||
}
|
||||
}
|
||||
|
||||
/** Grabs the node at one position, then removes it from all positions it occupies */
|
||||
public void popNode(BlockPos pos) {
|
||||
PowerNode node = nodes.get(pos);
|
||||
if(node != null) popNode(node);
|
||||
}
|
||||
}
|
||||
|
||||
public static class PowerNode {
|
||||
|
||||
public BlockPos[] positions;
|
||||
public DirPos[] connections;
|
||||
public PowerNetMK2 net;
|
||||
public boolean expired = false;
|
||||
/**
|
||||
* Okay so here's the deal: The code has shit idiot brain fungus. I don't know why. I re-tested every part involved several times.
|
||||
* I don't know why. But for some reason, during neighbor checks, on certain arbitrary fucking places, the joining operation just fails.
|
||||
* Disallowing nodes to create new networks fixed the problem completely, which is hardly surprising since they wouldn't be able to make
|
||||
* a new net anyway and they will re-check neighbors until a net is found, so the solution is tautological in nature. So I tried limiting
|
||||
* creation of new networks. Didn't work. So what's there left to do? Hand out a mark to any node that has changed networks, and let those
|
||||
* recently modified nodes do another re-check. This creates a second layer of redundant operations, and in theory doubles (in practice,
|
||||
* it might be an extra 20% due to break-off section sizes) the amount of CPU time needed for re-building the networks after joining or
|
||||
* breaking, but it seems to allow those parts to connect back to their neighbor nets as they are supposed to. I am not proud of this solution,
|
||||
* this issue shouldn't exist to begin with and I am going fucking insane but it is what it is.
|
||||
*/
|
||||
public boolean recentlyChanged = true;
|
||||
|
||||
public PowerNode(BlockPos... positions) {
|
||||
this.positions = positions;
|
||||
}
|
||||
|
||||
public PowerNode setConnections(DirPos... connections) {
|
||||
this.connections = connections;
|
||||
return this;
|
||||
}
|
||||
|
||||
public PowerNode addConnection(DirPos connection) {
|
||||
DirPos[] newCons = new DirPos[this.connections.length + 1];
|
||||
for(int i = 0; i < this.connections.length; i++) newCons[i] = this.connections[i];
|
||||
newCons[newCons.length - 1] = connection;
|
||||
this.connections = newCons;
|
||||
return this;
|
||||
}
|
||||
|
||||
public boolean hasValidNet() {
|
||||
return this.net != null && this.net.isValid();
|
||||
}
|
||||
|
||||
public void setNet(PowerNetMK2 net) {
|
||||
this.net = net;
|
||||
this.recentlyChanged = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
345
src/main/java/api/hbm/energymk2/PowerNetMK2.java
Normal file
345
src/main/java/api/hbm/energymk2/PowerNetMK2.java
Normal file
@ -0,0 +1,345 @@
|
||||
package api.hbm.energymk2;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Comparator;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
import com.hbm.util.Tuple.Pair;
|
||||
|
||||
import java.util.Map.Entry;
|
||||
|
||||
import api.hbm.energymk2.IEnergyReceiverMK2.ConnectionPriority;
|
||||
import api.hbm.energymk2.Nodespace.PowerNode;
|
||||
|
||||
public class PowerNetMK2 {
|
||||
|
||||
public boolean valid = true;
|
||||
public Set<PowerNode> links = new HashSet();
|
||||
|
||||
/** Maps all active subscribers to a timestamp, handy for handling timeouts. In a good system this shouldn't be necessary, but the previous system taught me to be cautious anyway */
|
||||
public HashMap<IEnergyReceiverMK2, Long> receiverEntries = new HashMap();
|
||||
public HashMap<IEnergyProviderMK2, Long> providerEntries = new HashMap();
|
||||
|
||||
public long energyTracker = 0L;
|
||||
|
||||
public PowerNetMK2() {
|
||||
Nodespace.activePowerNets.add(this);
|
||||
}
|
||||
|
||||
/// SUBSCRIBER HANDLING ///
|
||||
public boolean isSubscribed(IEnergyReceiverMK2 receiver) {
|
||||
return this.receiverEntries.containsKey(receiver);
|
||||
}
|
||||
|
||||
public void addReceiver(IEnergyReceiverMK2 receiver) {
|
||||
this.receiverEntries.put(receiver, System.currentTimeMillis());
|
||||
}
|
||||
|
||||
public void removeReceiver(IEnergyReceiverMK2 receiver) {
|
||||
this.receiverEntries.remove(receiver);
|
||||
}
|
||||
|
||||
/// PROVIDER HANDLING ///
|
||||
public boolean isProvider(IEnergyProviderMK2 provider) {
|
||||
return this.providerEntries.containsKey(provider);
|
||||
}
|
||||
|
||||
public void addProvider(IEnergyProviderMK2 provider) {
|
||||
this.providerEntries.put(provider, System.currentTimeMillis());
|
||||
}
|
||||
|
||||
public void removeProvider(IEnergyProviderMK2 provider) {
|
||||
this.providerEntries.remove(provider);
|
||||
}
|
||||
|
||||
/// LINK JOINING ///
|
||||
|
||||
/** Combines two networks into one */
|
||||
public void joinNetworks(PowerNetMK2 network) {
|
||||
|
||||
if(network == this) return; //wtf?!
|
||||
|
||||
List<PowerNode> oldNodes = new ArrayList(network.links.size());
|
||||
oldNodes.addAll(network.links); // might prevent oddities related to joining - nvm it does nothing
|
||||
|
||||
for(PowerNode conductor : oldNodes) forceJoinLink(conductor);
|
||||
network.links.clear();
|
||||
|
||||
for(IEnergyReceiverMK2 connector : network.receiverEntries.keySet()) this.addReceiver(connector);
|
||||
for(IEnergyProviderMK2 connector : network.providerEntries.keySet()) this.addProvider(connector);
|
||||
network.destroy();
|
||||
}
|
||||
|
||||
/** Adds the power node as part of this network's links */
|
||||
public PowerNetMK2 joinLink(PowerNode node) {
|
||||
if(node.net != null) node.net.leaveLink(node);
|
||||
return forceJoinLink(node);
|
||||
}
|
||||
|
||||
/** Adds the power node as part of this network's links, skips the part about removing it from existing networks */
|
||||
public PowerNetMK2 forceJoinLink(PowerNode node) {
|
||||
this.links.add(node);
|
||||
node.setNet(this);
|
||||
return this;
|
||||
}
|
||||
|
||||
/** Removes the specified power node */
|
||||
public void leaveLink(PowerNode node) {
|
||||
node.setNet(null);
|
||||
this.links.remove(node);
|
||||
}
|
||||
|
||||
/// GENERAL POWER NET CONTROL ///
|
||||
public void invalidate() {
|
||||
this.valid = false;
|
||||
Nodespace.activePowerNets.remove(this);
|
||||
}
|
||||
|
||||
public boolean isValid() {
|
||||
return this.valid;
|
||||
}
|
||||
|
||||
public void destroy() {
|
||||
this.invalidate();
|
||||
for(PowerNode link : this.links) if(link.net == this) link.setNet(null);
|
||||
this.links.clear();
|
||||
this.receiverEntries.clear();
|
||||
this.providerEntries.clear();
|
||||
}
|
||||
|
||||
public void resetEnergyTracker() {
|
||||
this.energyTracker = 0;
|
||||
}
|
||||
|
||||
protected static int timeout = 3_000;
|
||||
|
||||
public void transferPower() {
|
||||
|
||||
if(providerEntries.isEmpty()) return;
|
||||
if(receiverEntries.isEmpty()) return;
|
||||
|
||||
long timestamp = System.currentTimeMillis();
|
||||
long transferCap = 100_000_000_000_000_00L;
|
||||
|
||||
List<Pair<IEnergyProviderMK2, Long>> providers = new ArrayList();
|
||||
long powerAvailable = 0;
|
||||
|
||||
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; }
|
||||
long src = Math.min(entry.getKey().getPower(), entry.getKey().getProviderSpeed());
|
||||
providers.add(new Pair(entry.getKey(), src));
|
||||
if(powerAvailable < transferCap) powerAvailable += src;
|
||||
}
|
||||
|
||||
powerAvailable = Math.min(powerAvailable, transferCap);
|
||||
|
||||
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];
|
||||
long totalDemand = 0;
|
||||
|
||||
Iterator<Entry<IEnergyReceiverMK2, Long>> recIt = receiverEntries.entrySet().iterator();
|
||||
|
||||
while(recIt.hasNext()) {
|
||||
Entry<IEnergyReceiverMK2, Long> entry = recIt.next();
|
||||
if(timestamp - entry.getValue() > timeout) { 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;
|
||||
}
|
||||
|
||||
long toTransfer = Math.min(powerAvailable, totalDemand);
|
||||
long energyUsed = 0;
|
||||
|
||||
for(int i = ConnectionPriority.values().length - 1; i >= 0; i--) {
|
||||
List<Pair<IEnergyReceiverMK2, Long>> list = receivers[i];
|
||||
long priorityDemand = demand[i];
|
||||
|
||||
for(Pair<IEnergyReceiverMK2, Long> entry : list) {
|
||||
double weight = (double) entry.getValue() / (double) (priorityDemand);
|
||||
long toSend = (long) Math.max(toTransfer * weight, 0D);
|
||||
energyUsed += (toSend - entry.getKey().transferPower(toSend)); //leftovers are subtracted from the intended amount to use up
|
||||
}
|
||||
|
||||
toTransfer -= energyUsed;
|
||||
}
|
||||
|
||||
for(Pair<IEnergyProviderMK2, Long> entry : providers) {
|
||||
double weight = (double) entry.getValue() / (double) powerAvailable;
|
||||
long toUse = (long) Math.max(energyUsed * weight, 0D);
|
||||
entry.getKey().usePower(toUse);
|
||||
}
|
||||
}
|
||||
|
||||
@Deprecated public void transferPowerOld() {
|
||||
|
||||
if(providerEntries.isEmpty()) return;
|
||||
if(receiverEntries.isEmpty()) return;
|
||||
|
||||
long timestamp = System.currentTimeMillis();
|
||||
long transferCap = 100_000_000_000_000_00L; // that ought to be enough
|
||||
|
||||
long supply = 0;
|
||||
long demand = 0;
|
||||
long[] priorityDemand = new long[ConnectionPriority.values().length];
|
||||
|
||||
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; }
|
||||
supply += Math.min(entry.getKey().getPower(), entry.getKey().getProviderSpeed());
|
||||
}
|
||||
|
||||
if(supply <= 0) return;
|
||||
|
||||
Iterator<Entry<IEnergyReceiverMK2, Long>> recIt = receiverEntries.entrySet().iterator();
|
||||
while(recIt.hasNext()) {
|
||||
Entry<IEnergyReceiverMK2, Long> entry = recIt.next();
|
||||
if(timestamp - entry.getValue() > timeout) { recIt.remove(); continue; }
|
||||
long rec = Math.min(entry.getKey().getMaxPower() - entry.getKey().getPower(), entry.getKey().getReceiverSpeed());
|
||||
demand += rec;
|
||||
for(int i = 0; i <= entry.getKey().getPriority().ordinal(); i++) priorityDemand[i] += rec;
|
||||
}
|
||||
|
||||
if(demand <= 0) return;
|
||||
|
||||
long toTransfer = Math.min(supply, demand);
|
||||
if(toTransfer > transferCap) toTransfer = transferCap;
|
||||
if(toTransfer <= 0) return;
|
||||
|
||||
List<IEnergyProviderMK2> buffers = new ArrayList();
|
||||
List<IEnergyProviderMK2> providers = new ArrayList();
|
||||
Set<IEnergyReceiverMK2> receiverSet = receiverEntries.keySet();
|
||||
for(IEnergyProviderMK2 provider : providerEntries.keySet()) {
|
||||
if(receiverSet.contains(provider)) {
|
||||
buffers.add(provider);
|
||||
} else {
|
||||
providers.add(provider);
|
||||
}
|
||||
}
|
||||
providers.addAll(buffers); //makes buffers go last
|
||||
List<IEnergyReceiverMK2> receivers = new ArrayList() {{ addAll(receiverSet); }};
|
||||
|
||||
receivers.sort(COMP);
|
||||
|
||||
int maxIteration = 1000;
|
||||
|
||||
//how much the current sender/receiver have already sent/received
|
||||
long prevSrc = 0;
|
||||
long prevDest = 0;
|
||||
|
||||
while(!receivers.isEmpty() && !providers.isEmpty() && maxIteration > 0) {
|
||||
maxIteration--;
|
||||
|
||||
IEnergyProviderMK2 src = providers.get(0);
|
||||
IEnergyReceiverMK2 dest = receivers.get(0);
|
||||
|
||||
if(src.getPower() <= 0) { providers.remove(0); prevSrc = 0; continue; }
|
||||
|
||||
if(src == dest) { // STALEMATE DETECTED
|
||||
//if this happens, a buffer will waste both its share of transfer and receiving potential and do effectively nothing, essentially breaking
|
||||
|
||||
//try if placing the conflicting provider at the end of the list does anything
|
||||
//we do this first because providers have no priority, so we may shuffle those around as much as we want
|
||||
if(providers.size() > 1) {
|
||||
providers.add(providers.get(0));
|
||||
providers.remove(0);
|
||||
prevSrc = 0; //this might cause slight issues due to the tracking being effectively lost while there still might be pending operations
|
||||
continue;
|
||||
}
|
||||
//if that didn't work, try shifting the receiver by one place (to minimize priority breakage)
|
||||
if(receivers.size() > 1) {
|
||||
receivers.add(2, receivers.get(0));
|
||||
receivers.remove(0);
|
||||
prevDest = 0; //ditto
|
||||
continue;
|
||||
}
|
||||
|
||||
//if neither option could be performed, the only conclusion is that this buffer mode battery is alone in the power net, in which case: not my provlem
|
||||
}
|
||||
|
||||
long pd = priorityDemand[dest.getPriority().ordinal()];
|
||||
|
||||
long receiverShare = Math.min((long) Math.ceil((double) Math.min(dest.getMaxPower() - dest.getPower(), dest.getReceiverSpeed()) * (double) supply / (double) pd), dest.getReceiverSpeed()) - prevDest;
|
||||
long providerShare = Math.min((long) Math.ceil((double) Math.min(src.getPower(), src.getProviderSpeed()) * (double) demand / (double) supply), src.getProviderSpeed()) - prevSrc;
|
||||
|
||||
long toDrain = Math.min((long) (src.getPower()), providerShare);
|
||||
long toFill = Math.min(dest.getMaxPower() - dest.getPower(), receiverShare);
|
||||
|
||||
long finalTransfer = Math.min(toDrain, toFill);
|
||||
if(toFill <= 0) { receivers.remove(0); prevDest = 0; continue; }
|
||||
|
||||
finalTransfer -= dest.transferPower(finalTransfer);
|
||||
src.usePower(finalTransfer);
|
||||
|
||||
prevSrc += finalTransfer;
|
||||
prevDest += finalTransfer;
|
||||
|
||||
if(prevSrc >= src.getProviderSpeed()) { providers.remove(0); prevSrc = 0; continue; }
|
||||
if(prevDest >= dest.getReceiverSpeed()) { receivers.remove(0); prevDest = 0; continue; }
|
||||
|
||||
toTransfer -= finalTransfer;
|
||||
this.energyTracker += finalTransfer;
|
||||
}
|
||||
}
|
||||
|
||||
public long sendPowerDiode(long power) {
|
||||
|
||||
if(receiverEntries.isEmpty()) return power;
|
||||
|
||||
long timestamp = System.currentTimeMillis();
|
||||
|
||||
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];
|
||||
long totalDemand = 0;
|
||||
|
||||
Iterator<Entry<IEnergyReceiverMK2, Long>> recIt = receiverEntries.entrySet().iterator();
|
||||
|
||||
while(recIt.hasNext()) {
|
||||
Entry<IEnergyReceiverMK2, Long> entry = recIt.next();
|
||||
if(timestamp - entry.getValue() > timeout) { 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;
|
||||
}
|
||||
|
||||
long toTransfer = Math.min(power, totalDemand);
|
||||
long energyUsed = 0;
|
||||
|
||||
for(int i = ConnectionPriority.values().length - 1; i >= 0; i--) {
|
||||
List<Pair<IEnergyReceiverMK2, Long>> list = receivers[i];
|
||||
long priorityDemand = demand[i];
|
||||
|
||||
for(Pair<IEnergyReceiverMK2, Long> entry : list) {
|
||||
double weight = (double) entry.getValue() / (double) (priorityDemand);
|
||||
long toSend = (long) Math.max(toTransfer * weight, 0D);
|
||||
energyUsed += (toSend - entry.getKey().transferPower(toSend)); //leftovers are subtracted from the intended amount to use up
|
||||
}
|
||||
|
||||
toTransfer -= energyUsed;
|
||||
}
|
||||
|
||||
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();
|
||||
}
|
||||
}
|
||||
}
|
||||
33
src/main/java/api/hbm/energymk2/package-info.java
Normal file
33
src/main/java/api/hbm/energymk2/package-info.java
Normal file
@ -0,0 +1,33 @@
|
||||
/**
|
||||
*
|
||||
*/
|
||||
/**
|
||||
* @author hbm
|
||||
*
|
||||
*/
|
||||
package api.hbm.energymk2;
|
||||
|
||||
// i have snorted two lines of pure caffeine and taken one large paracetamol laced with even more caffine, let's fucking go
|
||||
|
||||
//most of the new classes are just copy pasted mashed up shit from yesteryear, what a productive segment that was
|
||||
|
||||
/*
|
||||
|
||||
before my caffine high ends entirely and i black out, here's the gist:
|
||||
* diodes are handled like energy receiver and simply chain-load the power net they output into in a recursive function, this might be a bit laggy compared to the rest of the system, but it's still way less laggy than the old one
|
||||
* instead of power nets being bound to tile entities directly, tiles spawn ethereal "nodes" similar to the drone waypoints which can be saved using world data, meaning that breaking cables will delete nodes, but unloading them will keep them alive in "node space" which is what's actually used to check for connections
|
||||
* power nets may cache some positional info in order to limit the amount of nodes, this should prevent horrific freezes in the unlikely event that some retard makes a superflat world out of cables
|
||||
* general energy transmission will work in a similar fashion as martin explained his, but somewhat simplified; the system will determine supply and demand and then split those evenly if possible, retrying within one operation is only necessary for minor restrictions like priority, any leftovers from rounding don't have to be re-tried because the next tick will already take care of that
|
||||
* invest funds in more coal mare nudes
|
||||
* battery "fair share" transfer will most likely no longer work, but that's not really as relevant these days considering there's capacitors and because batteries have transfer speed limits anyway
|
||||
* most of the machine's functions will be repurposed, the "sendPower" method will no longer send power directly but register the machine to the network as a power source
|
||||
* if all else fails and martin still hasn't surrendered his code, i will beg greg for his wisdom (but without loss or tiering because fuck that)
|
||||
*
|
||||
* | | ||
|
||||
* ____|____
|
||||
* |
|
||||
* || | |_
|
||||
*
|
||||
* ...i said WITHOUT loss
|
||||
|
||||
*/
|
||||
@ -4,7 +4,7 @@ import com.hbm.inventory.fluid.FluidType;
|
||||
import com.hbm.packet.AuxParticlePacketNT;
|
||||
import com.hbm.packet.PacketDispatcher;
|
||||
|
||||
import api.hbm.energy.ILoadedTile;
|
||||
import api.hbm.tile.ILoadedTile;
|
||||
import cpw.mods.fml.common.network.NetworkRegistry.TargetPoint;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
package api.hbm.energy;
|
||||
package api.hbm.tile;
|
||||
|
||||
public interface ILoadedTile {
|
||||
|
||||
@ -773,6 +773,10 @@ public class ModBlocks {
|
||||
public static Block red_cable_gauge;
|
||||
public static Block red_connector;
|
||||
public static Block red_pylon;
|
||||
public static Block red_pylon_medium_wood;
|
||||
public static Block red_pylon_medium_wood_transformer;
|
||||
public static Block red_pylon_medium_steel;
|
||||
public static Block red_pylon_medium_steel_transformer;
|
||||
public static Block red_pylon_large;
|
||||
public static Block substation;
|
||||
public static Block cable_switch;
|
||||
@ -1075,10 +1079,11 @@ public class ModBlocks {
|
||||
public static Block anvil_iron;
|
||||
public static Block anvil_lead;
|
||||
public static Block anvil_steel;
|
||||
public static Block anvil_meteorite;
|
||||
public static Block anvil_starmetal;
|
||||
public static Block anvil_desh;
|
||||
public static Block anvil_saturnite;
|
||||
public static Block anvil_ferrouranium;
|
||||
public static Block anvil_bismuth;
|
||||
public static Block anvil_bismuth_bronze;
|
||||
public static Block anvil_arsenic_bronze;
|
||||
public static Block anvil_schrabidate;
|
||||
public static Block anvil_dnt;
|
||||
public static Block anvil_osmiridium;
|
||||
@ -1922,6 +1927,10 @@ public class ModBlocks {
|
||||
red_cable_gauge = new BlockCableGauge().setBlockName("red_cable_gauge").setHardness(5.0F).setResistance(10.0F).setCreativeTab(MainRegistry.machineTab);
|
||||
red_connector = new ConnectorRedWire(Material.iron).setBlockName("red_connector").setHardness(5.0F).setResistance(10.0F).setCreativeTab(MainRegistry.machineTab).setBlockTextureName(RefStrings.MODID + ":red_connector");
|
||||
red_pylon = new PylonRedWire(Material.iron).setBlockName("red_pylon").setHardness(5.0F).setResistance(10.0F).setCreativeTab(MainRegistry.machineTab).setBlockTextureName(RefStrings.MODID + ":red_pylon");
|
||||
red_pylon_medium_wood = new PylonMedium(Material.wood).setBlockName("red_pylon_medium_wood").setHardness(5.0F).setResistance(10.0F).setCreativeTab(MainRegistry.machineTab).setBlockTextureName(RefStrings.MODID + ":red_pylon");
|
||||
red_pylon_medium_wood_transformer = new PylonMedium(Material.wood).setBlockName("red_pylon_medium_wood_transformer").setHardness(5.0F).setResistance(10.0F).setCreativeTab(MainRegistry.machineTab).setBlockTextureName(RefStrings.MODID + ":red_pylon");
|
||||
red_pylon_medium_steel = new PylonMedium(Material.iron).setBlockName("red_pylon_medium_steel").setHardness(5.0F).setResistance(10.0F).setCreativeTab(MainRegistry.machineTab).setBlockTextureName(RefStrings.MODID + ":red_pylon");
|
||||
red_pylon_medium_steel_transformer = new PylonMedium(Material.iron).setBlockName("red_pylon_medium_steel_transformer").setHardness(5.0F).setResistance(10.0F).setCreativeTab(MainRegistry.machineTab).setBlockTextureName(RefStrings.MODID + ":red_pylon");
|
||||
red_pylon_large = new PylonLarge(Material.iron).setBlockName("red_pylon_large").setHardness(5.0F).setResistance(10.0F).setCreativeTab(MainRegistry.machineTab).setBlockTextureName(RefStrings.MODID + ":red_pylon_large");
|
||||
substation = new Substation(Material.iron).setBlockName("substation").setHardness(5.0F).setResistance(10.0F).setCreativeTab(MainRegistry.machineTab).setBlockTextureName(RefStrings.MODID + ":substation");
|
||||
cable_switch = new CableSwitch(Material.iron).setBlockName("cable_switch").setHardness(5.0F).setResistance(10.0F).setCreativeTab(MainRegistry.machineTab);
|
||||
@ -2119,7 +2128,7 @@ public class ModBlocks {
|
||||
tesla = new MachineTesla(Material.iron).setBlockName("tesla").setHardness(5.0F).setResistance(10.0F).setCreativeTab(MainRegistry.blockTab).setBlockTextureName(RefStrings.MODID + ":tesla");
|
||||
|
||||
launch_pad = new LaunchPad(Material.iron).setBlockName("launch_pad").setHardness(5.0F).setResistance(10.0F).setCreativeTab(MainRegistry.missileTab).setBlockTextureName(RefStrings.MODID + ":launch_pad");
|
||||
launch_pad_rusted = new LaunchPadRusted(Material.iron).setBlockName("launch_pad_rusted").setHardness(5.0F).setResistance(10.0F).setCreativeTab(MainRegistry.missileTab).setBlockTextureName(RefStrings.MODID + ":launch_pad_rusted");
|
||||
launch_pad_rusted = new LaunchPadRusted(Material.iron).setBlockName("launch_pad_rusted").setHardness(5.0F).setResistance(10.0F).setCreativeTab(MainRegistry.missileTab).setBlockTextureName(RefStrings.MODID + ":block_rust");
|
||||
launch_pad_large = new LaunchPadLarge(Material.iron).setBlockName("launch_pad_large").setHardness(5.0F).setResistance(10.0F).setCreativeTab(MainRegistry.missileTab).setBlockTextureName(RefStrings.MODID + ":block_steel");
|
||||
machine_radar = new MachineRadar(Material.iron).setBlockName("machine_radar").setHardness(5.0F).setResistance(10.0F).setCreativeTab(MainRegistry.missileTab).setBlockTextureName(RefStrings.MODID + ":machine_radar");
|
||||
machine_radar_large = new MachineRadarLarge(Material.iron).setBlockName("machine_radar_large").setHardness(5.0F).setResistance(10.0F).setCreativeTab(MainRegistry.missileTab).setBlockTextureName(RefStrings.MODID + ":block_steel");
|
||||
@ -2285,16 +2294,17 @@ public class ModBlocks {
|
||||
machine_autocrafter = new MachineAutocrafter().setBlockName("machine_autocrafter").setHardness(10.0F).setResistance(20.0F).setCreativeTab(MainRegistry.machineTab);
|
||||
machine_funnel = new MachineFunnel().setBlockName("machine_funnel").setHardness(10.0F).setResistance(20.0F).setCreativeTab(MainRegistry.machineTab);
|
||||
|
||||
anvil_iron = new NTMAnvil(Material.iron, 1).setBlockName("anvil_iron").setCreativeTab(MainRegistry.machineTab).setBlockTextureName(RefStrings.MODID + ":anvil_iron");
|
||||
anvil_lead = new NTMAnvil(Material.iron, 1).setBlockName("anvil_lead").setCreativeTab(MainRegistry.machineTab).setBlockTextureName(RefStrings.MODID + ":anvil_lead");
|
||||
anvil_steel = new NTMAnvil(Material.iron, 2).setBlockName("anvil_steel").setCreativeTab(MainRegistry.machineTab).setBlockTextureName(RefStrings.MODID + ":anvil_steel");
|
||||
anvil_meteorite = new NTMAnvil(Material.iron, 3).setBlockName("anvil_meteorite").setCreativeTab(MainRegistry.machineTab).setBlockTextureName(RefStrings.MODID + ":anvil_meteorite");
|
||||
anvil_starmetal = new NTMAnvil(Material.iron, 3).setBlockName("anvil_starmetal").setCreativeTab(MainRegistry.machineTab).setBlockTextureName(RefStrings.MODID + ":anvil_starmetal");
|
||||
anvil_ferrouranium = new NTMAnvil(Material.iron, 4).setBlockName("anvil_ferrouranium").setCreativeTab(MainRegistry.machineTab).setBlockTextureName(RefStrings.MODID + ":anvil_ferrouranium");
|
||||
anvil_bismuth = new NTMAnvil(Material.iron, 5).setBlockName("anvil_bismuth").setCreativeTab(MainRegistry.machineTab).setBlockTextureName(RefStrings.MODID + ":anvil_bismuth");
|
||||
anvil_schrabidate = new NTMAnvil(Material.iron, 6).setBlockName("anvil_schrabidate").setCreativeTab(MainRegistry.machineTab).setBlockTextureName(RefStrings.MODID + ":anvil_schrabidate");
|
||||
anvil_dnt = new NTMAnvil(Material.iron, 7).setBlockName("anvil_dnt").setCreativeTab(MainRegistry.machineTab).setBlockTextureName(RefStrings.MODID + ":anvil_dnt");
|
||||
anvil_osmiridium = new NTMAnvil(Material.iron, 8).setBlockName("anvil_osmiridium").setCreativeTab(MainRegistry.machineTab).setBlockTextureName(RefStrings.MODID + ":anvil_osmiridium");
|
||||
anvil_iron = new NTMAnvil(Material.iron, NTMAnvil.TIER_IRON).setBlockName("anvil_iron").setCreativeTab(MainRegistry.machineTab).setBlockTextureName(RefStrings.MODID + ":anvil_iron");
|
||||
anvil_lead = new NTMAnvil(Material.iron, NTMAnvil.TIER_IRON).setBlockName("anvil_lead").setCreativeTab(MainRegistry.machineTab).setBlockTextureName(RefStrings.MODID + ":anvil_lead");
|
||||
anvil_steel = new NTMAnvil(Material.iron, NTMAnvil.TIER_STEEL).setBlockName("anvil_steel").setCreativeTab(MainRegistry.machineTab).setBlockTextureName(RefStrings.MODID + ":anvil_steel");
|
||||
anvil_desh = new NTMAnvil(Material.iron, NTMAnvil.TIER_OIL).setBlockName("anvil_desh").setCreativeTab(MainRegistry.machineTab).setBlockTextureName(RefStrings.MODID + ":anvil_desh");
|
||||
anvil_saturnite = new NTMAnvil(Material.iron, NTMAnvil.TIER_OIL).setBlockName("anvil_saturnite").setCreativeTab(MainRegistry.machineTab).setBlockTextureName(RefStrings.MODID + ":anvil_saturnite");
|
||||
anvil_ferrouranium = new NTMAnvil(Material.iron, NTMAnvil.TIER_NUCLEAR).setBlockName("anvil_ferrouranium").setCreativeTab(MainRegistry.machineTab).setBlockTextureName(RefStrings.MODID + ":anvil_ferrouranium");
|
||||
anvil_bismuth_bronze = new NTMAnvil(Material.iron, NTMAnvil.TIER_RBMK).setBlockName("anvil_bismuth_bronze").setCreativeTab(MainRegistry.machineTab).setBlockTextureName(RefStrings.MODID + ":anvil_bismuth_bronze");
|
||||
anvil_arsenic_bronze = new NTMAnvil(Material.iron, NTMAnvil.TIER_RBMK).setBlockName("anvil_arsenic_bronze").setCreativeTab(MainRegistry.machineTab).setBlockTextureName(RefStrings.MODID + ":anvil_arsenic_bronze");
|
||||
anvil_schrabidate = new NTMAnvil(Material.iron, NTMAnvil.TIER_FUSION).setBlockName("anvil_schrabidate").setCreativeTab(MainRegistry.machineTab).setBlockTextureName(RefStrings.MODID + ":anvil_schrabidate");
|
||||
anvil_dnt = new NTMAnvil(Material.iron, NTMAnvil.TIER_PARTICLE).setBlockName("anvil_dnt").setCreativeTab(MainRegistry.machineTab).setBlockTextureName(RefStrings.MODID + ":anvil_dnt");
|
||||
anvil_osmiridium = new NTMAnvil(Material.iron, NTMAnvil.TIER_GERALD).setBlockName("anvil_osmiridium").setCreativeTab(MainRegistry.machineTab).setBlockTextureName(RefStrings.MODID + ":anvil_osmiridium");
|
||||
anvil_murky = new NTMAnvil(Material.iron, 1916169).setBlockName("anvil_murky").setCreativeTab(MainRegistry.machineTab).setBlockTextureName(RefStrings.MODID + ":anvil_steel");
|
||||
|
||||
machine_waste_drum = new WasteDrum(Material.iron).setBlockName("machine_waste_drum").setHardness(5.0F).setResistance(10.0F).setCreativeTab(MainRegistry.machineTab).setBlockTextureName(RefStrings.MODID + ":waste_drum");
|
||||
@ -3050,17 +3060,18 @@ public class ModBlocks {
|
||||
register(machine_autocrafter);
|
||||
register(machine_funnel);
|
||||
|
||||
GameRegistry.registerBlock(anvil_iron, ItemBlockBase.class, anvil_iron.getUnlocalizedName());
|
||||
GameRegistry.registerBlock(anvil_lead, ItemBlockBase.class, anvil_lead.getUnlocalizedName());
|
||||
GameRegistry.registerBlock(anvil_steel, ItemBlockBase.class, anvil_steel.getUnlocalizedName());
|
||||
GameRegistry.registerBlock(anvil_meteorite, ItemBlockBase.class, anvil_meteorite.getUnlocalizedName());
|
||||
GameRegistry.registerBlock(anvil_starmetal, ItemBlockBase.class, anvil_starmetal.getUnlocalizedName());
|
||||
GameRegistry.registerBlock(anvil_ferrouranium, ItemBlockBase.class, anvil_ferrouranium.getUnlocalizedName());
|
||||
GameRegistry.registerBlock(anvil_bismuth, ItemBlockBase.class, anvil_bismuth.getUnlocalizedName());
|
||||
GameRegistry.registerBlock(anvil_schrabidate, ItemBlockBase.class, anvil_schrabidate.getUnlocalizedName());
|
||||
GameRegistry.registerBlock(anvil_dnt, ItemBlockBase.class, anvil_dnt.getUnlocalizedName());
|
||||
GameRegistry.registerBlock(anvil_osmiridium, ItemBlockBase.class, anvil_osmiridium.getUnlocalizedName());
|
||||
GameRegistry.registerBlock(anvil_murky, ItemBlockBase.class, anvil_murky.getUnlocalizedName());
|
||||
register(anvil_iron);
|
||||
register(anvil_lead);
|
||||
register(anvil_steel);
|
||||
register(anvil_desh);
|
||||
register(anvil_saturnite);
|
||||
register(anvil_ferrouranium);
|
||||
register(anvil_bismuth_bronze);
|
||||
register(anvil_arsenic_bronze);
|
||||
register(anvil_schrabidate);
|
||||
register(anvil_dnt);
|
||||
register(anvil_osmiridium);
|
||||
register(anvil_murky);
|
||||
|
||||
GameRegistry.registerBlock(press_preheater, press_preheater.getUnlocalizedName());
|
||||
GameRegistry.registerBlock(machine_press, machine_press.getUnlocalizedName());
|
||||
@ -3196,6 +3207,10 @@ public class ModBlocks {
|
||||
GameRegistry.registerBlock(red_wire_coated, red_wire_coated.getUnlocalizedName());
|
||||
GameRegistry.registerBlock(red_connector, ItemBlockBase.class, red_connector.getUnlocalizedName());
|
||||
GameRegistry.registerBlock(red_pylon, ItemBlockBase.class, red_pylon.getUnlocalizedName());
|
||||
register(red_pylon_medium_wood);
|
||||
register(red_pylon_medium_wood_transformer);
|
||||
register(red_pylon_medium_steel);
|
||||
register(red_pylon_medium_steel_transformer);
|
||||
GameRegistry.registerBlock(red_pylon_large, ItemBlockBase.class, red_pylon_large.getUnlocalizedName());
|
||||
GameRegistry.registerBlock(substation, ItemBlockBase.class, substation.getUnlocalizedName());
|
||||
GameRegistry.registerBlock(cable_switch, cable_switch.getUnlocalizedName());
|
||||
|
||||
@ -7,8 +7,10 @@ import static net.minecraftforge.common.util.ForgeDirection.SOUTH;
|
||||
import static net.minecraftforge.common.util.ForgeDirection.UP;
|
||||
import static net.minecraftforge.common.util.ForgeDirection.WEST;
|
||||
|
||||
import java.awt.Color;
|
||||
import java.util.Random;
|
||||
|
||||
import com.hbm.blocks.ModBlocks;
|
||||
import com.hbm.potion.HbmPotion;
|
||||
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
@ -47,9 +49,9 @@ public class Balefire extends BlockFire {
|
||||
return icon;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateTick(World world, int x, int y, int z, Random rand) {
|
||||
if(world.getGameRules().getGameRuleBooleanValue("doFireTick")) {
|
||||
boolean onNetherrack = world.getBlock(x, y - 1, z).isFireSource(world, x, y - 1, z, UP);
|
||||
|
||||
if(!this.canPlaceBlockAt(world, x, y, z)) {
|
||||
world.setBlockToAir(x, y, z);
|
||||
@ -57,12 +59,10 @@ public class Balefire extends BlockFire {
|
||||
|
||||
int meta = world.getBlockMetadata(x, y, z);
|
||||
|
||||
world.scheduleBlockUpdate(x, y, z, this, this.tickRate(world) + rand.nextInt(10));
|
||||
if(meta < 15) world.scheduleBlockUpdate(x, y, z, this, this.tickRate(world) + rand.nextInt(10));
|
||||
|
||||
if(!onNetherrack && !this.canNeighborBurn(world, x, y, z)) {
|
||||
if(!World.doesBlockHaveSolidTopSurface(world, x, y - 1, z)) {
|
||||
world.setBlockToAir(x, y, z);
|
||||
}
|
||||
if(!this.canNeighborBurn(world, x, y, z) && !World.doesBlockHaveSolidTopSurface(world, x, y - 1, z)) {
|
||||
world.setBlockToAir(x, y, z);
|
||||
} else {
|
||||
if(meta < 15) {
|
||||
this.tryCatchFire(world, x + 1, y, z, 500, rand, meta, WEST);
|
||||
@ -71,31 +71,33 @@ public class Balefire extends BlockFire {
|
||||
this.tryCatchFire(world, x, y + 1, z, 300, rand, meta, DOWN);
|
||||
this.tryCatchFire(world, x, y, z - 1, 500, rand, meta, SOUTH);
|
||||
this.tryCatchFire(world, x, y, z + 1, 500, rand, meta, NORTH);
|
||||
}
|
||||
|
||||
int h = 3;
|
||||
|
||||
for(int i1 = x - 1; i1 <= x + 1; ++i1) {
|
||||
for(int j1 = z - 1; j1 <= z + 1; ++j1) {
|
||||
for(int k1 = y - 1; k1 <= y + 4; ++k1) {
|
||||
if(i1 != x || k1 != y || j1 != z) {
|
||||
int l1 = 100;
|
||||
for(int ix = x - h; ix <= x + h; ++ix) {
|
||||
for(int iz = z - h; iz <= z + h; ++iz) {
|
||||
for(int iy = y - 1; iy <= y + 4; ++iy) {
|
||||
|
||||
if(ix != x || iy != y || iz != z) {
|
||||
int fireLimit = 100;
|
||||
|
||||
if(k1 > y + 1) {
|
||||
l1 += (k1 - (y + 1)) * 100;
|
||||
}
|
||||
if(iy > y + 1) {
|
||||
fireLimit += (iy - (y + 1)) * 100;
|
||||
}
|
||||
|
||||
if(world.getBlock(ix, iy, iz) == ModBlocks.balefire && world.getBlockMetadata(ix, iy, iz) > meta + 1) {
|
||||
world.setBlock(ix, iy, iz, this, meta + 1, 3);
|
||||
continue;
|
||||
}
|
||||
|
||||
int i2 = this.getChanceOfNeighborsEncouragingFire(world, i1, k1, j1);
|
||||
int neighborFireChance = this.getChanceOfNeighborsEncouragingFire(world, ix, iy, iz);
|
||||
|
||||
if(i2 > 0) {
|
||||
int j2 = (i2 + 40 + world.difficultySetting.getDifficultyId() * 7) / (meta + 30);
|
||||
if(neighborFireChance > 0) {
|
||||
int adjustedFireChance = (neighborFireChance + 40 + world.difficultySetting.getDifficultyId() * 7) / (meta + 30);
|
||||
|
||||
if(j2 > 0 && rand.nextInt(l1) <= j2) {
|
||||
int k2 = meta + rand.nextInt(5) / 4;
|
||||
|
||||
if(k2 > 15) {
|
||||
k2 = 15;
|
||||
if(adjustedFireChance > 0 && rand.nextInt(fireLimit) <= adjustedFireChance) {
|
||||
world.setBlock(ix, iy, iz, this, meta + 1, 3);
|
||||
}
|
||||
|
||||
world.setBlock(i1, k1, j1, this, k2, 3);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -156,5 +158,15 @@ public class Balefire extends BlockFire {
|
||||
|
||||
if(entity instanceof EntityLivingBase) ((EntityLivingBase) entity).addPotionEffect(new PotionEffect(HbmPotion.radiation.id, 5 * 20, 9));
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public int colorMultiplier(IBlockAccess world, int x, int y, int z) {
|
||||
int meta = world.getBlockMetadata(x, y, z);
|
||||
return Color.HSBtoRGB(0F, 0F, 1F - meta / 30F);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getRenderType() {
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
@ -98,7 +98,7 @@ public class BlockCrashedBomb extends BlockContainer implements IBomb {
|
||||
if(!world.isRemote) {
|
||||
|
||||
world.setBlockToAir(x, y, z);
|
||||
EntityBalefire bf = new EntityBalefire(world).mute();
|
||||
EntityBalefire bf = new EntityBalefire(world);
|
||||
bf.posX = x;
|
||||
bf.posY = y;
|
||||
bf.posZ = z;
|
||||
|
||||
@ -2,7 +2,7 @@ package com.hbm.blocks.generic;
|
||||
|
||||
import com.hbm.blocks.BlockBase;
|
||||
|
||||
import api.hbm.energy.IEnergyConnectorBlock;
|
||||
import api.hbm.energymk2.IEnergyConnectorBlock;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
@ -3,7 +3,7 @@ package com.hbm.blocks.generic;
|
||||
import com.hbm.items.armor.ArmorFSB;
|
||||
import com.hbm.items.armor.ArmorFSBPowered;
|
||||
|
||||
import api.hbm.energy.IBatteryItem;
|
||||
import api.hbm.energymk2.IBatteryItem;
|
||||
import cpw.mods.fml.client.registry.RenderingRegistry;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.material.Material;
|
||||
|
||||
@ -7,7 +7,7 @@ import com.hbm.interfaces.IMultiblock;
|
||||
import com.hbm.inventory.fluid.FluidType;
|
||||
import com.hbm.tileentity.machine.TileEntityDummy;
|
||||
|
||||
import api.hbm.energy.IEnergyConnectorBlock;
|
||||
import api.hbm.energymk2.IEnergyConnectorBlock;
|
||||
import api.hbm.fluid.IFluidConnectorBlock;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockContainer;
|
||||
|
||||
@ -8,7 +8,7 @@ import com.hbm.lib.RefStrings;
|
||||
import com.hbm.main.MainRegistry;
|
||||
import com.hbm.tileentity.machine.TileEntityFWatzCore;
|
||||
|
||||
import api.hbm.energy.IEnergyConnectorBlock;
|
||||
import api.hbm.energymk2.IEnergyConnectorBlock;
|
||||
import api.hbm.fluid.IFluidConnectorBlock;
|
||||
import cpw.mods.fml.common.network.internal.FMLNetworkHandler;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
|
||||
@ -6,10 +6,8 @@ import com.hbm.tileentity.machine.TileEntityFoundrySlagtap;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.client.event.RenderGameOverlayEvent.Pre;
|
||||
|
||||
public class FoundrySlagtap extends FoundryOutlet {
|
||||
|
||||
|
||||
@ -17,7 +17,8 @@ import com.hbm.util.BobMathUtil;
|
||||
import com.hbm.util.I18nUtil;
|
||||
import com.hbm.util.fauxpointtwelve.BlockPos;
|
||||
|
||||
import api.hbm.energy.IEnergyUser;
|
||||
import api.hbm.energymk2.IEnergyProviderMK2;
|
||||
import api.hbm.energymk2.IEnergyReceiverMK2;
|
||||
import cpw.mods.fml.client.registry.RenderingRegistry;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
@ -145,11 +146,10 @@ public class MachineCapacitor extends BlockContainer implements ILookOverlay, IP
|
||||
player.addExhaustion(0.025F);
|
||||
}
|
||||
|
||||
public static class TileEntityCapacitor extends TileEntityLoadedBase implements IEnergyUser, INBTPacketReceiver, IPersistentNBT {
|
||||
public static class TileEntityCapacitor extends TileEntityLoadedBase implements IEnergyProviderMK2, IEnergyReceiverMK2, INBTPacketReceiver, IPersistentNBT {
|
||||
|
||||
public long power;
|
||||
protected long maxPower;
|
||||
public long prevPower;
|
||||
public long powerReceived;
|
||||
public long powerSent;
|
||||
|
||||
@ -164,8 +164,6 @@ public class MachineCapacitor extends BlockContainer implements ILookOverlay, IP
|
||||
|
||||
if(!worldObj.isRemote) {
|
||||
|
||||
long gain = power - prevPower;
|
||||
|
||||
ForgeDirection opp = ForgeDirection.getOrientation(this.getBlockMetadata());
|
||||
ForgeDirection dir = opp.getOpposite();
|
||||
|
||||
@ -187,26 +185,45 @@ public class MachineCapacitor extends BlockContainer implements ILookOverlay, IP
|
||||
pos = pos.offset(current);
|
||||
}
|
||||
|
||||
long preSend = power;
|
||||
if(pos != null && last != null) {
|
||||
this.tryUnsubscribe(worldObj, pos.getX(), pos.getY(), pos.getZ());
|
||||
this.sendPower(worldObj, pos.getX(), pos.getY(), pos.getZ(), last);
|
||||
this.tryProvide(worldObj, pos.getX(), pos.getY(), pos.getZ(), last);
|
||||
}
|
||||
long sent = preSend - power;
|
||||
|
||||
this.trySubscribe(worldObj, xCoord + opp.offsetX, yCoord+ opp.offsetY, zCoord + opp.offsetZ, opp);
|
||||
|
||||
NBTTagCompound data = new NBTTagCompound();
|
||||
data.setLong("power", power);
|
||||
data.setLong("maxPower", maxPower);
|
||||
data.setLong("rec", gain);
|
||||
data.setLong("sent", sent);
|
||||
data.setLong("rec", powerReceived);
|
||||
data.setLong("sent", powerSent);
|
||||
INBTPacketReceiver.networkPack(this, data, 15);
|
||||
|
||||
this.prevPower = power;
|
||||
this.powerSent = 0;
|
||||
this.powerReceived = 0;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public long transferPower(long power) {
|
||||
if(power + this.getPower() <= this.getMaxPower()) {
|
||||
this.setPower(power + this.getPower());
|
||||
this.powerReceived += power;
|
||||
return 0;
|
||||
}
|
||||
long capacity = this.getMaxPower() - this.getPower();
|
||||
long overshoot = power - capacity;
|
||||
this.powerReceived += (this.getMaxPower() - this.getPower());
|
||||
this.setPower(this.getMaxPower());
|
||||
return overshoot;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void usePower(long power) {
|
||||
this.powerSent += Math.min(this.getPower(), power);
|
||||
this.setPower(this.getPower() - power);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void networkUnpack(NBTTagCompound nbt) {
|
||||
this.power = nbt.getLong("power");
|
||||
|
||||
@ -5,7 +5,7 @@ import java.util.List;
|
||||
import com.hbm.blocks.ITooltipProvider;
|
||||
import com.hbm.lib.RefStrings;
|
||||
|
||||
import api.hbm.energy.IEnergyConnectorBlock;
|
||||
import api.hbm.energymk2.IEnergyConnectorBlock;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import net.minecraft.block.Block;
|
||||
|
||||
@ -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 + "%");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -7,7 +7,6 @@ import com.hbm.blocks.ILookOverlay;
|
||||
import com.hbm.handler.MultiblockHandlerXR;
|
||||
import com.hbm.inventory.material.Mats;
|
||||
import com.hbm.items.ModItems;
|
||||
import com.hbm.items.machine.ItemMold;
|
||||
import com.hbm.items.machine.ItemScraps;
|
||||
import com.hbm.tileentity.TileEntityProxyCombo;
|
||||
import com.hbm.tileentity.machine.TileEntityMachineStrandCaster;
|
||||
|
||||
@ -39,6 +39,15 @@ import net.minecraft.world.World;
|
||||
import net.minecraftforge.client.model.obj.WavefrontObject;
|
||||
|
||||
public class NTMAnvil extends BlockFallingNT implements ITooltipProvider, IGUIProvider {
|
||||
|
||||
public static final int TIER_IRON = 1;
|
||||
public static final int TIER_STEEL = 2;
|
||||
public static final int TIER_OIL = 3;
|
||||
public static final int TIER_NUCLEAR = 4;
|
||||
public static final int TIER_RBMK = 5;
|
||||
public static final int TIER_FUSION = 6;
|
||||
public static final int TIER_PARTICLE = 7;
|
||||
public static final int TIER_GERALD = 8;
|
||||
|
||||
public final int tier;
|
||||
|
||||
|
||||
@ -47,7 +47,7 @@ public class BlockGraphiteFuel extends BlockGraphiteDrilledTE implements IToolab
|
||||
@Override
|
||||
public int getComparatorInputOverride(World world, int x, int y, int z, int side) {
|
||||
TileEntityPileFuel pile = (TileEntityPileFuel)world.getTileEntity(x, y, z);
|
||||
return MathHelper.clamp_int((pile.progress * 16) / (pile.maxProgress - 1000), 0, 15); //potentially wip
|
||||
return MathHelper.clamp_int((pile.progress * 15) / (pile.maxProgress - 1000), 0, 15);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@ -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();
|
||||
|
||||
@ -7,12 +7,16 @@ import com.hbm.blocks.ILookOverlay;
|
||||
import com.hbm.blocks.ITooltipProvider;
|
||||
import com.hbm.tileentity.TileEntityLoadedBase;
|
||||
import com.hbm.util.BobMathUtil;
|
||||
import com.hbm.util.Compat;
|
||||
import com.hbm.util.I18nUtil;
|
||||
|
||||
import api.hbm.block.IToolable;
|
||||
import api.hbm.energy.IEnergyUser;
|
||||
import api.hbm.energy.IEnergyConnector.ConnectionPriority;
|
||||
import api.hbm.energy.IEnergyConnectorBlock;
|
||||
import api.hbm.energymk2.IEnergyConnectorBlock;
|
||||
import api.hbm.energymk2.IEnergyConnectorMK2;
|
||||
import api.hbm.energymk2.IEnergyReceiverMK2;
|
||||
import api.hbm.energymk2.Nodespace;
|
||||
import api.hbm.energymk2.Nodespace.PowerNode;
|
||||
import api.hbm.energymk2.IEnergyReceiverMK2.ConnectionPriority;
|
||||
import cpw.mods.fml.client.registry.RenderingRegistry;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
@ -98,7 +102,7 @@ public class CableDiode extends BlockContainer implements IEnergyConnectorBlock,
|
||||
|
||||
if(tool == ToolType.DEFUSER) {
|
||||
int p = te.priority.ordinal() + 1;
|
||||
if(p > 2) p = 0;
|
||||
if(p > 4) p = 0;
|
||||
te.priority = ConnectionPriority.values()[p];
|
||||
te.markDirty();
|
||||
world.markBlockForUpdate(x, y, z);
|
||||
@ -138,7 +142,7 @@ public class CableDiode extends BlockContainer implements IEnergyConnectorBlock,
|
||||
return new TileEntityDiode();
|
||||
}
|
||||
|
||||
public static class TileEntityDiode extends TileEntityLoadedBase implements IEnergyUser {
|
||||
public static class TileEntityDiode extends TileEntityLoadedBase implements IEnergyReceiverMK2 {
|
||||
|
||||
@Override
|
||||
public void readFromNBT(NBTTagCompound nbt) {
|
||||
@ -183,6 +187,9 @@ public class CableDiode extends BlockContainer implements IEnergyConnectorBlock,
|
||||
|
||||
this.trySubscribe(worldObj, xCoord + dir.offsetX, yCoord + dir.offsetY, zCoord + dir.offsetZ, dir);
|
||||
}
|
||||
|
||||
pulses = 0;
|
||||
this.setPower(0); //tick is over, reset our allowed transfe
|
||||
}
|
||||
}
|
||||
|
||||
@ -191,10 +198,9 @@ public class CableDiode extends BlockContainer implements IEnergyConnectorBlock,
|
||||
return dir != getDir();
|
||||
}
|
||||
|
||||
/** Used as an intra-tick tracker for how much energy has been transmitted, resets to 0 each tick and maxes out based on transfer */
|
||||
private long power;
|
||||
private boolean recursionBrake = false;
|
||||
private long subBuffer;
|
||||
private long contingent = 0;
|
||||
private long lastTransfer = 0;
|
||||
private int pulses = 0;
|
||||
public ConnectionPriority priority = ConnectionPriority.NORMAL;
|
||||
|
||||
@ -205,36 +211,40 @@ public class CableDiode extends BlockContainer implements IEnergyConnectorBlock,
|
||||
return power;
|
||||
|
||||
pulses++;
|
||||
|
||||
if(lastTransfer != worldObj.getTotalWorldTime()) {
|
||||
lastTransfer = worldObj.getTotalWorldTime();
|
||||
contingent = getMaxPower();
|
||||
pulses = 0;
|
||||
}
|
||||
|
||||
if(contingent <= 0 || pulses > 10)
|
||||
return power;
|
||||
|
||||
//this part turns "maxPower" from a glorified transfer weight into an actual transfer cap
|
||||
long overShoot = Math.max(0, power - contingent);
|
||||
power = Math.min(power, contingent);
|
||||
if(this.getPower() >= this.getMaxPower() || pulses > 10) return power; //if we have already maxed out transfer or max pulses, abort
|
||||
|
||||
recursionBrake = true;
|
||||
this.subBuffer = power;
|
||||
|
||||
ForgeDirection dir = getDir();
|
||||
this.sendPower(worldObj, xCoord + dir.offsetX, yCoord + dir.offsetY, zCoord + dir.offsetZ, dir);
|
||||
long ret = this.subBuffer;
|
||||
PowerNode node = Nodespace.getNode(worldObj, xCoord + dir.offsetX, yCoord + dir.offsetY, zCoord + dir.offsetZ);
|
||||
TileEntity te = Compat.getTileStandard(worldObj, xCoord + dir.offsetX, yCoord + dir.offsetY, zCoord + dir.offsetZ);
|
||||
|
||||
long sent = power - ret;
|
||||
contingent -= sent;
|
||||
if(node != null && !node.expired && node.hasValidNet() && te instanceof IEnergyConnectorMK2 && ((IEnergyConnectorMK2) te).canConnect(dir.getOpposite())) {
|
||||
long toTransfer = Math.min(power, this.getReceiverSpeed());
|
||||
long remainder = node.net.sendPowerDiode(toTransfer);
|
||||
long transferred = (toTransfer - remainder);
|
||||
this.power += transferred;
|
||||
power -= transferred;
|
||||
|
||||
} else if(te instanceof IEnergyReceiverMK2 && te != this) {
|
||||
IEnergyReceiverMK2 rec = (IEnergyReceiverMK2) te;
|
||||
if(rec.canConnect(dir.getOpposite())) {
|
||||
long toTransfer = Math.min(power, rec.getReceiverSpeed());
|
||||
long remainder = rec.transferPower(toTransfer);
|
||||
power -= (toTransfer - remainder);
|
||||
recursionBrake = false;
|
||||
return power;
|
||||
}
|
||||
}
|
||||
|
||||
this.subBuffer = 0;
|
||||
recursionBrake = false;
|
||||
|
||||
return ret + overShoot;
|
||||
return power;
|
||||
}
|
||||
|
||||
@Override
|
||||
public long getReceiverSpeed() {
|
||||
return this.getMaxPower() - this.getPower();
|
||||
}
|
||||
|
||||
@Override
|
||||
public long getMaxPower() {
|
||||
@ -243,12 +253,12 @@ public class CableDiode extends BlockContainer implements IEnergyConnectorBlock,
|
||||
|
||||
@Override
|
||||
public long getPower() {
|
||||
return subBuffer;
|
||||
return Math.min(power, this.getMaxPower());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setPower(long power) {
|
||||
this.subBuffer = power;
|
||||
this.power = power;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@ -6,6 +6,7 @@ import com.hbm.tileentity.network.TileEntityPylonBase;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockContainer;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
@ -41,4 +42,16 @@ public abstract class PylonBase extends BlockContainer implements ITooltipProvid
|
||||
public boolean renderAsNormalBlock() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@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()) {
|
||||
TileEntityPylonBase te = (TileEntityPylonBase) world.getTileEntity(x, y, z);
|
||||
return te.setColor(player.getHeldItem());
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -82,4 +82,17 @@ public class PylonLarge extends BlockDummyable implements ITooltipProvider {
|
||||
|
||||
return dir.ordinal() + offset;
|
||||
}
|
||||
|
||||
@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()) {
|
||||
int[] pos = this.findCore(world, x, y, z);
|
||||
TileEntityPylonBase te = (TileEntityPylonBase) world.getTileEntity(pos[0], pos[1], pos[2]);
|
||||
return te.setColor(player.getHeldItem());
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
66
src/main/java/com/hbm/blocks/network/PylonMedium.java
Normal file
66
src/main/java/com/hbm/blocks/network/PylonMedium.java
Normal file
@ -0,0 +1,66 @@
|
||||
package com.hbm.blocks.network;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.hbm.blocks.BlockDummyable;
|
||||
import com.hbm.blocks.ITooltipProvider;
|
||||
import com.hbm.tileentity.network.TileEntityPylonBase;
|
||||
import com.hbm.tileentity.network.TileEntityPylonMedium;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.EnumChatFormatting;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public class PylonMedium extends BlockDummyable implements ITooltipProvider {
|
||||
|
||||
public PylonMedium(Material mat) {
|
||||
super(mat);
|
||||
}
|
||||
|
||||
@Override
|
||||
public TileEntity createNewTileEntity(World world, int meta) {
|
||||
|
||||
if(meta >= 12) return new TileEntityPylonMedium();
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addInformation(ItemStack stack, EntityPlayer player, List list, boolean ext) {
|
||||
list.add(EnumChatFormatting.GOLD + "Connection Type: " + EnumChatFormatting.YELLOW + "Triple");
|
||||
list.add(EnumChatFormatting.GOLD + "Connection Range: " + EnumChatFormatting.YELLOW + "45m");
|
||||
}
|
||||
|
||||
@Override
|
||||
public int[] getDimensions() {
|
||||
return new int[] {6, 0, 0, 0, 0, 0};
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getOffset() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void breakBlock(World world, int x, int y, int z, Block b, int m) {
|
||||
TileEntity te = world.getTileEntity(x, y, z);
|
||||
if(te instanceof TileEntityPylonBase) ((TileEntityPylonBase)te).disconnectAll();
|
||||
super.breakBlock(world, x, y, z, b, m);
|
||||
}
|
||||
|
||||
@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()) {
|
||||
int[] pos = this.findCore(world, x, y, z);
|
||||
TileEntityPylonBase te = (TileEntityPylonBase) world.getTileEntity(pos[0], pos[1], pos[2]);
|
||||
return te.setColor(player.getHeldItem());
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -72,4 +72,17 @@ public class Substation extends BlockDummyable implements ITooltipProvider {
|
||||
this.makeExtra(world, x + dir.offsetX * o - 1, y, z + dir.offsetZ * o + 1);
|
||||
this.makeExtra(world, x + dir.offsetX * o - 1, y, z + dir.offsetZ * o - 1);
|
||||
}
|
||||
|
||||
@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()) {
|
||||
int[] pos = this.findCore(world, x, y, z);
|
||||
TileEntityPylonBase te = (TileEntityPylonBase) world.getTileEntity(pos[0], pos[1], pos[2]);
|
||||
return te.setColor(player.getHeldItem());
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -87,4 +87,21 @@ public class CommonConfig {
|
||||
return prop.getStringList();
|
||||
}
|
||||
|
||||
public static int parseStructureFlag(String flag) {
|
||||
if(flag == null) flag = "";
|
||||
|
||||
switch(flag.toLowerCase(Locale.US)) {
|
||||
case "true":
|
||||
case "on":
|
||||
case "yes":
|
||||
return 1;
|
||||
case "false":
|
||||
case "off":
|
||||
case "no":
|
||||
return 0;
|
||||
default:
|
||||
return 2;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -9,7 +9,7 @@ public class GeneralConfig {
|
||||
public static boolean enableDebugMode = true;
|
||||
public static boolean enableMycelium = false;
|
||||
public static boolean enablePlutoniumOre = false;
|
||||
public static boolean enableDungeons = true;
|
||||
public static int enableDungeons = 2;
|
||||
public static boolean enableMDOres = true;
|
||||
public static boolean enableMines = true;
|
||||
public static boolean enableRad = true;
|
||||
@ -26,7 +26,6 @@ public class GeneralConfig {
|
||||
public static boolean enableRenderDistCheck = true;
|
||||
public static boolean enableReEval = true;
|
||||
public static boolean enableSilentCompStackErrors = true;
|
||||
public static boolean enableChunkyNEIHandler = true;
|
||||
public static boolean enableSkyboxes = true;
|
||||
public static boolean enableImpactWorldProvider = true;
|
||||
public static boolean enableStatReRegistering = true;
|
||||
@ -35,6 +34,7 @@ public class GeneralConfig {
|
||||
public static boolean enableMOTD = true;
|
||||
public static boolean enableGuideBook = true;
|
||||
public static boolean enableSteamParticles = true;
|
||||
public static boolean enableSoundExtension = true;
|
||||
public static int hintPos = 0;
|
||||
|
||||
public static boolean enableExpensiveMode = false;
|
||||
@ -73,7 +73,10 @@ public class GeneralConfig {
|
||||
enableDebugMode = config.get(CATEGORY_GENERAL, "1.00_enableDebugMode", false, "Enable debugging mode").getBoolean(false);
|
||||
enableMycelium = config.get(CATEGORY_GENERAL, "1.01_enableMyceliumSpread", false, "Allows glowing mycelium to spread").getBoolean(false);
|
||||
enablePlutoniumOre = config.get(CATEGORY_GENERAL, "1.02_enablePlutoniumNetherOre", false, "Enables plutonium ore generation in the nether").getBoolean(false);
|
||||
enableDungeons = config.get(CATEGORY_GENERAL, "1.03_enableDungeonSpawn", true, "Allows structures and dungeons to spawn").getBoolean(true);
|
||||
|
||||
String unparsedDungeonFlag = config.get(CATEGORY_GENERAL, "1.03_enableDungeonSpawn", "flag", "Allows structures and dungeons to spawn. Valid values are true|false|flag - flag will respect the \"Generate Structures\" world flag.").getString();
|
||||
enableDungeons = CommonConfig.parseStructureFlag(unparsedDungeonFlag);
|
||||
|
||||
enableMDOres = config.get(CATEGORY_GENERAL, "1.04_enableOresInModdedDimensions", true, "Allows NTM ores to generate in modded dimensions").getBoolean(true);
|
||||
enableMines = config.get(CATEGORY_GENERAL, "1.05_enableLandmineSpawn", true, "Allows landmines to generate").getBoolean(true);
|
||||
enableRad = config.get(CATEGORY_GENERAL, "1.06_enableRadHotspotSpawn", true, "Allows radiation hotspots to generate").getBoolean(true);
|
||||
@ -91,7 +94,6 @@ public class GeneralConfig {
|
||||
enableReEval = config.get(CATEGORY_GENERAL, "1.27_enableReEval", true, "Allows re-evaluating power networks on link remove instead of destroying and recreating").getBoolean(true);
|
||||
enableSilentCompStackErrors = config.get(CATEGORY_GENERAL, "1.28_enableSilentCompStackErrors", false, "Enabling this will disable log spam created by unregistered items in ComparableStack instances.").getBoolean(false);
|
||||
hintPos = CommonConfig.createConfigInt(config, CATEGORY_GENERAL, "1.29_hudOverlayPosition", "0: Top left\n1: Top right\n2: Center right\n3: Center Left", 0);
|
||||
enableChunkyNEIHandler = config.get(CATEGORY_GENERAL, "1.30_enableChunkyNEIHandler", true, "If enabled, registers a NEI handler that will show the chosen item in a larger view.").getBoolean(true);
|
||||
enableSkyboxes = config.get(CATEGORY_GENERAL, "1.31_enableSkyboxes", true, "If enabled, will try to use NTM's custom skyboxes.").getBoolean(true);
|
||||
enableImpactWorldProvider = config.get(CATEGORY_GENERAL, "1.32_enableImpactWorldProvider", true, "If enabled, registers custom world provider which modifies lighting and sky colors for post impact effects.").getBoolean(true);
|
||||
enableStatReRegistering = config.get(CATEGORY_GENERAL, "1.33_enableStatReRegistering", true, "If enabled, will re-register item crafting/breaking/usage stats in order to fix a forge bug where modded items just won't show up.").getBoolean(true);
|
||||
@ -100,6 +102,7 @@ public class GeneralConfig {
|
||||
enableMOTD = config.get(CATEGORY_GENERAL, "1.36_enableMOTD", true, "If enabled, shows the 'Loaded mod!' chat message as well as update notifications when joining a world").getBoolean(true);
|
||||
enableGuideBook = config.get(CATEGORY_GENERAL, "1.37_enableGuideBook", true, "If enabled, gives players the guide book when joining the world for the first time").getBoolean(true);
|
||||
enableSteamParticles = config.get(CATEGORY_GENERAL, "1.38_enableSteamParticles",true, "If disabled, auxiliary cooling towers and large cooling towers will not emit steam particles when in use.").getBoolean(true);
|
||||
enableSoundExtension = config.get(CATEGORY_GENERAL, "1.39_enableSoundExtension",true, "If enabled, will change the limit for how many sounds can play at once.").getBoolean(true);
|
||||
|
||||
enableExpensiveMode = config.get(CATEGORY_GENERAL, "1.99_enableExpensiveMode", false, "It does what the name implies.").getBoolean(false);
|
||||
|
||||
|
||||
@ -8,7 +8,7 @@ import net.minecraftforge.common.config.Configuration;
|
||||
|
||||
public class StructureConfig {
|
||||
|
||||
public static boolean enableStructures = true;
|
||||
public static int enableStructures = 2;
|
||||
|
||||
public static int structureMinChunks = 8;
|
||||
public static int structureMaxChunks = 24;
|
||||
@ -18,7 +18,10 @@ public class StructureConfig {
|
||||
public static void loadFromConfig(Configuration config) {
|
||||
|
||||
final String CATEGORY_STRUCTURES = CommonConfig.CATEGORY_STRUCTURES;
|
||||
enableStructures = CommonConfig.createConfigBool(config, CATEGORY_STRUCTURES, "5.00_enableStructures", "Switch for whether structures using the MapGenStructure system spawn.", true);
|
||||
|
||||
String unparsedStructureFlag = CommonConfig.createConfigString(config, CATEGORY_STRUCTURES, "5.00_enableStructures", "Flag for whether modern NTM structures will spawn. Valid values are true|false|flag - flag will respect the \"Generate Structures\" world flag.", "flag");
|
||||
|
||||
enableStructures = CommonConfig.parseStructureFlag(unparsedStructureFlag);
|
||||
|
||||
structureMinChunks = CommonConfig.createConfigInt(config, CATEGORY_STRUCTURES, "5.01_structureMinChunks", "Minimum non-zero distance between structures in chunks (Settings lower than 8 may be problematic).", 8);
|
||||
structureMaxChunks = CommonConfig.createConfigInt(config, CATEGORY_STRUCTURES, "5.02_structureMaxChunks", "Maximum non-zero distance between structures in chunks.", 24);
|
||||
|
||||
@ -51,6 +51,7 @@ public class WorldConfig {
|
||||
public static int bedrockRedstoneSpawn = 50;
|
||||
public static int bedrockRareEarthSpawn = 50;
|
||||
public static int bedrockBauxiteSpawn = 100;
|
||||
public static int bedrockEmeraldSpawn = 50;
|
||||
public static int bedrockGlowstoneSpawn = 100;
|
||||
public static int bedrockPhosphorusSpawn = 50;
|
||||
public static int bedrockQuartzSpawn = 100;
|
||||
@ -171,6 +172,7 @@ public class WorldConfig {
|
||||
bedrockNeodymiumSpawn = CommonConfig.createConfigInt(config, CATEGORY_OREGEN, "2.B15_bedrockNeodymiumWeight", "Spawn weight for neodymium bedrock ore", 50);
|
||||
bedrockRareEarthSpawn = CommonConfig.createConfigInt(config, CATEGORY_OREGEN, "2.B16_bedrockRareEarthWeight", "Spawn weight for rare earth bedrock ore", 50);
|
||||
bedrockBauxiteSpawn = CommonConfig.createConfigInt(config, CATEGORY_OREGEN, "2.B17_bedrockBauxiteWeight", "Spawn weight for bauxite bedrock ore", 100);
|
||||
bedrockEmeraldSpawn = CommonConfig.createConfigInt(config, CATEGORY_OREGEN, "2.B18_bedrockEmeraldWeight", "Spawn weight for emerald bedrock ore", 50);
|
||||
|
||||
bedrockGlowstoneSpawn = CommonConfig.createConfigInt(config, CATEGORY_OREGEN, "2.BN00_bedrockGlowstoneWeight", "Spawn weight for glowstone bedrock ore", 100);
|
||||
bedrockPhosphorusSpawn = CommonConfig.createConfigInt(config, CATEGORY_OREGEN, "2.BN01_bedrockPhosphorusWeight", "Spawn weight for phosphorus bedrock ore", 50);
|
||||
|
||||
@ -6,13 +6,13 @@ import com.hbm.config.FalloutConfigJSON;
|
||||
import com.hbm.config.FalloutConfigJSON.FalloutEntry;
|
||||
import com.hbm.config.WorldConfig;
|
||||
import com.hbm.entity.item.EntityFallingBlockNT;
|
||||
import com.hbm.entity.logic.EntityExplosionChunkloading;
|
||||
import com.hbm.saveddata.AuxSavedData;
|
||||
import com.hbm.world.WorldUtil;
|
||||
import com.hbm.world.biome.BiomeGenCraterBase;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.util.Vec3;
|
||||
@ -24,7 +24,8 @@ import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
public class EntityFalloutRain extends Entity {
|
||||
public class EntityFalloutRain extends EntityExplosionChunkloading {
|
||||
|
||||
private boolean firstTick = true; // Of course Vanilla has it private in Entity...
|
||||
|
||||
public EntityFalloutRain(World p_i1582_1_) {
|
||||
@ -98,7 +99,8 @@ public class EntityFalloutRain extends Entity {
|
||||
if(biomeModified) WorldUtil.syncBiomeChange(worldObj, chunkPosX << 4, chunkPosZ << 4);
|
||||
|
||||
} else {
|
||||
setDead();
|
||||
this.clearChunkLoader();
|
||||
this.setDead();
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -169,7 +171,7 @@ public class EntityFalloutRain extends Entity {
|
||||
|
||||
Block b = worldObj.getBlock(x, y, z);
|
||||
|
||||
if(b.getMaterial() == Material.air) continue;
|
||||
if(b.getMaterial() == Material.air || b == ModBlocks.fallout) continue;
|
||||
if(b == Blocks.bedrock) return;
|
||||
|
||||
if(b == ModBlocks.volcano_core) {
|
||||
@ -240,6 +242,7 @@ public class EntityFalloutRain extends Entity {
|
||||
|
||||
@Override
|
||||
protected void entityInit() {
|
||||
super.entityInit();
|
||||
this.dataWatcher.addObject(16, 0);
|
||||
}
|
||||
|
||||
|
||||
@ -3,6 +3,7 @@ package com.hbm.entity.effect;
|
||||
import java.awt.Color;
|
||||
import java.util.ArrayList;
|
||||
|
||||
import com.hbm.main.MainRegistry;
|
||||
import com.hbm.util.BobMathUtil;
|
||||
import com.hbm.util.TrackerUtil;
|
||||
|
||||
@ -29,6 +30,9 @@ public class EntityNukeTorex extends Entity {
|
||||
public ArrayList<Cloudlet> cloudlets = new ArrayList();
|
||||
//public static int cloudletLife = 200;
|
||||
|
||||
public boolean didPlaySound = false;
|
||||
public boolean didShake = false;
|
||||
|
||||
public EntityNukeTorex(World world) {
|
||||
super(world);
|
||||
this.ignoreFrustumCheck = true;
|
||||
@ -104,6 +108,13 @@ public class EntityNukeTorex extends Entity {
|
||||
.setScale(7F, 2F)
|
||||
.setMotion(ticksExisted > 15 ? 0.75 : 0));
|
||||
}
|
||||
|
||||
if(!didPlaySound) {
|
||||
if(MainRegistry.proxy.me() != null && MainRegistry.proxy.me().getDistanceToEntity(this) < (ticksExisted * 1.5 + 1) * 1.5) {
|
||||
MainRegistry.proxy.playSoundClient(posX, posY, posZ, "hbm:weapon.nuclearExplosion", 10_000F, 1F);
|
||||
didPlaySound = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// spawn ring clouds
|
||||
|
||||
@ -17,7 +17,6 @@ public class EntityBalefire extends EntityExplosionChunkloading {
|
||||
public ExplosionBalefire exp;
|
||||
public int speed = 1;
|
||||
public boolean did = false;
|
||||
public boolean mute = false;
|
||||
|
||||
@Override
|
||||
protected void readEntityFromNBT(NBTTagCompound nbt) {
|
||||
@ -25,7 +24,6 @@ public class EntityBalefire extends EntityExplosionChunkloading {
|
||||
destructionRange = nbt.getInteger("destructionRange");
|
||||
speed = nbt.getInteger("speed");
|
||||
did = nbt.getBoolean("did");
|
||||
mute = nbt.getBoolean("mute");
|
||||
|
||||
|
||||
exp = new ExplosionBalefire((int)this.posX, (int)this.posY, (int)this.posZ, this.worldObj, this.destructionRange);
|
||||
@ -41,7 +39,6 @@ public class EntityBalefire extends EntityExplosionChunkloading {
|
||||
nbt.setInteger("destructionRange", destructionRange);
|
||||
nbt.setInteger("speed", speed);
|
||||
nbt.setBoolean("did", did);
|
||||
nbt.setBoolean("mute", mute);
|
||||
|
||||
if(exp != null)
|
||||
exp.saveToNbt(nbt, "exp_");
|
||||
@ -79,22 +76,10 @@ public class EntityBalefire extends EntityExplosionChunkloading {
|
||||
}
|
||||
}
|
||||
|
||||
if(!mute && rand.nextInt(5) == 0)
|
||||
this.worldObj.playSoundEffect(this.posX, this.posY, this.posZ, "random.explode", 10000.0F, 0.8F + this.rand.nextFloat() * 0.2F);
|
||||
|
||||
if(!flag) {
|
||||
|
||||
if(!mute)
|
||||
this.worldObj.playSoundEffect(this.posX, this.posY, this.posZ, "ambient.weather.thunder", 10000.0F, 0.8F + this.rand.nextFloat() * 0.2F);
|
||||
|
||||
ExplosionNukeGeneric.dealDamage(this.worldObj, this.posX, this.posY, this.posZ, this.destructionRange * 2);
|
||||
}
|
||||
|
||||
age++;
|
||||
}
|
||||
|
||||
public EntityBalefire mute() {
|
||||
this.mute = true;
|
||||
return this;
|
||||
}
|
||||
}
|
||||
|
||||
@ -37,7 +37,7 @@ public class EntityDeathBlast extends Entity {
|
||||
if(this.ticksExisted >= maxAge && !worldObj.isRemote) {
|
||||
this.setDead();
|
||||
|
||||
worldObj.spawnEntityInWorld(EntityNukeExplosionMK5.statFacNoRad(worldObj, 40, posX, posY, posZ).mute());
|
||||
worldObj.spawnEntityInWorld(EntityNukeExplosionMK5.statFacNoRad(worldObj, 40, posX, posY, posZ));
|
||||
|
||||
int count = 100;
|
||||
for(int i = 0; i < count; i++) {
|
||||
|
||||
@ -6,7 +6,7 @@ import java.util.List;
|
||||
import com.hbm.packet.PacketDispatcher;
|
||||
import com.hbm.packet.ParticleBurstPacket;
|
||||
|
||||
import api.hbm.energy.IEnergyUser;
|
||||
import api.hbm.energymk2.IEnergyHandlerMK2;
|
||||
import cofh.api.energy.IEnergyProvider;
|
||||
import cpw.mods.fml.common.network.NetworkRegistry.TargetPoint;
|
||||
import net.minecraft.block.Block;
|
||||
@ -44,19 +44,15 @@ public class EntityEMP extends Entity {
|
||||
private void allocate() {
|
||||
|
||||
machines = new ArrayList();
|
||||
|
||||
int radius = 100;
|
||||
|
||||
for(int x = -radius; x <= radius; x++) {
|
||||
|
||||
int x2 = (int) Math.pow(x, 2);
|
||||
|
||||
for(int y = -radius; y <= radius; y++) {
|
||||
|
||||
int y2 = (int) Math.pow(y, 2);
|
||||
|
||||
for(int z = -radius; z <= radius; z++) {
|
||||
|
||||
int z2 = (int) Math.pow(z, 2);
|
||||
|
||||
if(Math.sqrt(x2 + y2 + z2) <= radius) {
|
||||
@ -81,7 +77,7 @@ public class EntityEMP extends Entity {
|
||||
private void add(int x, int y, int z) {
|
||||
TileEntity te = worldObj.getTileEntity(x, y, z);
|
||||
|
||||
if (te != null && te instanceof IEnergyUser) {
|
||||
if (te != null && te instanceof IEnergyHandlerMK2) {
|
||||
machines.add(new int[] { x, y, z });
|
||||
} else if (te != null && te instanceof IEnergyProvider) {
|
||||
machines.add(new int[] { x, y, z });
|
||||
@ -94,9 +90,9 @@ public class EntityEMP extends Entity {
|
||||
|
||||
boolean flag = false;
|
||||
|
||||
if (te != null && te instanceof IEnergyUser) {
|
||||
if (te != null && te instanceof IEnergyHandlerMK2) {
|
||||
|
||||
((IEnergyUser)te).setPower(0);
|
||||
((IEnergyHandlerMK2)te).setPower(0);
|
||||
flag = true;
|
||||
}
|
||||
if (te != null && te instanceof IEnergyProvider) {
|
||||
|
||||
@ -29,8 +29,6 @@ public class EntityNukeExplosionMK5 extends EntityExplosionChunkloading {
|
||||
public int speed;
|
||||
public int length;
|
||||
|
||||
public boolean mute = false;
|
||||
|
||||
public boolean fallout = true;
|
||||
private int falloutAdd = 0;
|
||||
|
||||
@ -66,12 +64,6 @@ public class EntityNukeExplosionMK5 extends EntityExplosionChunkloading {
|
||||
radiate(2_500_000F / (this.ticksExisted * 5 + 1), this.length * 2);
|
||||
}
|
||||
|
||||
if(!mute) {
|
||||
this.worldObj.playSoundEffect(this.posX, this.posY, this.posZ, "ambient.weather.thunder", 10000.0F, 0.8F + this.rand.nextFloat() * 0.2F);
|
||||
if(rand.nextInt(5) == 0)
|
||||
this.worldObj.playSoundEffect(this.posX, this.posY, this.posZ, "random.explode", 10000.0F, 0.8F + this.rand.nextFloat() * 0.2F);
|
||||
}
|
||||
|
||||
ExplosionNukeGeneric.dealDamage(this.worldObj, this.posX, this.posY, this.posZ, this.length * 2);
|
||||
|
||||
if(explosion == null) {
|
||||
@ -135,9 +127,6 @@ public class EntityNukeExplosionMK5 extends EntityExplosionChunkloading {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void entityInit() { }
|
||||
|
||||
@Override
|
||||
protected void readEntityFromNBT(NBTTagCompound nbt) {
|
||||
this.ticksExisted = nbt.getInteger("ticksExisted");
|
||||
@ -177,9 +166,4 @@ public class EntityNukeExplosionMK5 extends EntityExplosionChunkloading {
|
||||
falloutAdd = fallout;
|
||||
return this;
|
||||
}
|
||||
|
||||
public EntityNukeExplosionMK5 mute() {
|
||||
this.mute = true;
|
||||
return this;
|
||||
}
|
||||
}
|
||||
|
||||
@ -120,7 +120,7 @@ public class EntityCreeperNuclear extends EntityCreeper {
|
||||
worldObj.playSoundEffect(posX, posY + 0.5, posZ, "hbm:weapon.mukeExplosion", 15.0F, 1.0F);
|
||||
|
||||
if(flag) {
|
||||
worldObj.spawnEntityInWorld(EntityNukeExplosionMK5.statFac(worldObj, 50, posX, posY, posZ).mute());
|
||||
worldObj.spawnEntityInWorld(EntityNukeExplosionMK5.statFac(worldObj, 50, posX, posY, posZ));
|
||||
} else {
|
||||
ExplosionNukeGeneric.dealDamage(worldObj, posX, posY + 0.5, posZ, 100);
|
||||
}
|
||||
|
||||
@ -74,7 +74,7 @@ public class EntityGlyphidBehemoth extends EntityGlyphid {
|
||||
super.onDeath(source);
|
||||
if (!worldObj.isRemote) {
|
||||
EntityMist mist = new EntityMist(worldObj);
|
||||
mist.setType(Fluids.ACID);
|
||||
mist.setType(Fluids.SULFURIC_ACID);
|
||||
mist.setPosition(posX, posY, posZ);
|
||||
mist.setArea(10, 4);
|
||||
mist.setDuration(120);
|
||||
@ -88,7 +88,7 @@ public class EntityGlyphidBehemoth extends EntityGlyphid {
|
||||
this.addPotionEffect(new PotionEffect(Potion.moveSlowdown.id, 2 * 20, 6));
|
||||
EntityChemical chem = new EntityChemical(worldObj, this);
|
||||
|
||||
chem.setFluid(Fluids.ACID);
|
||||
chem.setFluid(Fluids.SULFURIC_ACID);
|
||||
worldObj.spawnEntityInWorld(chem);
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,18 +1,104 @@
|
||||
package com.hbm.entity.mob.glyphid;
|
||||
|
||||
|
||||
import com.hbm.main.ResourceManager;
|
||||
|
||||
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.entity.SharedMonsterAttributes;
|
||||
import net.minecraft.util.DamageSource;
|
||||
import net.minecraft.util.MathHelper;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraft.util.Vec3;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
|
||||
public class EntityGlyphidBrawler extends EntityGlyphid {
|
||||
|
||||
public EntityGlyphidBrawler(World world) {
|
||||
super(world);
|
||||
this.setSize(2F, 1.125F);
|
||||
}
|
||||
|
||||
|
||||
public int timer = 0;
|
||||
protected Entity lastTarget;
|
||||
protected double lastX;
|
||||
protected double lastY;
|
||||
protected double lastZ;
|
||||
|
||||
@Override
|
||||
public void onUpdate(){
|
||||
super.onUpdate();
|
||||
Entity e = this.getEntityToAttack();
|
||||
if (e != null && this.isEntityAlive()) {
|
||||
|
||||
this.lastX = e.posX;
|
||||
this.lastY = e.posY;
|
||||
this.lastZ = e.posZ;
|
||||
|
||||
if (--timer <= 0) {
|
||||
leap();
|
||||
timer = 80 + worldObj.rand.nextInt(30);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/** Mainly composed of repurposed bombardier code**/
|
||||
public void leap() {
|
||||
if (!worldObj.isRemote && entityToAttack instanceof EntityLivingBase && this.getDistanceToEntity(entityToAttack) < 20) {
|
||||
Entity e = this.getEntityToAttack();
|
||||
|
||||
double velX = e.posX - lastX;
|
||||
double velY = e.posY - lastY;
|
||||
double velZ = e.posZ - lastZ;
|
||||
|
||||
if (this.lastTarget != e) {
|
||||
velX = velY = velZ = 0;
|
||||
}
|
||||
|
||||
int prediction = 60;
|
||||
Vec3 delta = Vec3.createVectorHelper(e.posX - posX + velX * prediction, (e.posY + e.height / 2) - (posY + 1) + velY * prediction, e.posZ - posZ + velZ * prediction);
|
||||
double len = delta.lengthVector();
|
||||
if (len < 3) return;
|
||||
double targetYaw = -Math.atan2(delta.xCoord, delta.zCoord);
|
||||
|
||||
double x = Math.sqrt(delta.xCoord * delta.xCoord + delta.zCoord * delta.zCoord);
|
||||
double y = delta.yCoord;
|
||||
double v0 = 1.5;
|
||||
double v02 = v0 * v0;
|
||||
double g = 0.01;
|
||||
double targetPitch = Math.atan((v02 + Math.sqrt(v02 * v02 - g * (g * x * x + 2 * y * v02)) * 1) / (g * x));
|
||||
Vec3 fireVec = null;
|
||||
if (!Double.isNaN(targetPitch)) {
|
||||
|
||||
fireVec = Vec3.createVectorHelper(v0, 0, 0);
|
||||
fireVec.rotateAroundZ((float) (-targetPitch / 3.5));
|
||||
fireVec.rotateAroundY((float) -(targetYaw + Math.PI * 0.5));
|
||||
}
|
||||
if (fireVec != null)
|
||||
this.setThrowableHeading(fireVec.xCoord, fireVec.yCoord, fireVec.zCoord, (float) v0, rand.nextFloat());
|
||||
}
|
||||
}
|
||||
//yeag this is now a motherfucking projectile
|
||||
public void setThrowableHeading(double motionX, double motionY, double motionZ, float velocity, float inaccuracy) {
|
||||
float throwLen = MathHelper.sqrt_double(motionX * motionX + motionY * motionY + motionZ * motionZ);
|
||||
motionX /= (double) throwLen;
|
||||
motionY /= (double) throwLen;
|
||||
motionZ /= (double) throwLen;
|
||||
motionX += this.rand.nextGaussian() * 0.0075D * (double) inaccuracy;
|
||||
motionY += this.rand.nextGaussian() * 0.0075D * (double) inaccuracy;
|
||||
motionZ += this.rand.nextGaussian() * 0.0075D * (double) inaccuracy;
|
||||
motionX *= (double) velocity;
|
||||
motionY *= (double) velocity;
|
||||
motionZ *= (double) velocity;
|
||||
this.motionX = motionX;
|
||||
this.motionY = motionY;
|
||||
this.motionZ = motionZ;
|
||||
float hyp = MathHelper.sqrt_double(motionX * motionX + motionZ * motionZ);
|
||||
this.prevRotationYaw = this.rotationYaw = (float) (Math.atan2(motionX, motionZ) * 180.0D / Math.PI);
|
||||
this.prevRotationPitch = this.rotationPitch = (float) (Math.atan2(motionY, (double) hyp) * 180.0D / Math.PI);
|
||||
}
|
||||
@Override
|
||||
public ResourceLocation getSkin() {
|
||||
return ResourceManager.glyphid_brawler_tex;
|
||||
@ -33,7 +119,19 @@ public class EntityGlyphidBrawler extends EntityGlyphid {
|
||||
|
||||
@Override public float getDivisorPerArmorPoint() { return GlyphidStats.getStats().getBrawler().divisor; }
|
||||
@Override public float getDamageThreshold() { return GlyphidStats.getStats().getBrawler().damageThreshold; }
|
||||
@Override
|
||||
public boolean attackEntityFrom(DamageSource source, float amount) {
|
||||
|
||||
/*NBTTagCompound data = new NBTTagCompound();
|
||||
data.setString("type", "debug");
|
||||
data.setInteger("color", 0x0000ff);
|
||||
data.setFloat("scale", 2.5F);
|
||||
data.setString("text", "" + (int) amount);
|
||||
PacketDispatcher.wrapper.sendToAllAround(new AuxParticlePacketNT(data, posX, posY + 2, posZ), new TargetPoint(dimension, posX, posY + 2, posZ, 50));*/
|
||||
//allows brawlers to get no damage on short leaps, but still affected by fall damage on big drops
|
||||
if(source == DamageSource.fall && amount <= 10) return false;
|
||||
return super.attackEntityFrom(source, amount);
|
||||
}
|
||||
@Override
|
||||
public boolean isArmorBroken(float amount) {
|
||||
return this.rand.nextInt(100) <= Math.min(Math.pow(amount * 0.25, 2), 100);
|
||||
|
||||
@ -73,7 +73,10 @@ public class EntityGlyphidScout extends EntityGlyphid {
|
||||
@Override
|
||||
public void onUpdate() {
|
||||
super.onUpdate();
|
||||
|
||||
//Updates to check whether the player still exists, important to make sure it wont stop doing work
|
||||
if(entityToAttack != null && ticksExisted % 60 == 0){
|
||||
entityToAttack = findPlayerToAttack();
|
||||
}
|
||||
if((getCurrentTask() != TASK_BUILD_HIVE || getCurrentTask() != TASK_TERRAFORM) && taskWaypoint == null) {
|
||||
|
||||
if(MobConfig.rampantGlyphidGuidance && PollutionHandler.targetCoords != null){
|
||||
@ -336,15 +339,13 @@ public class EntityGlyphidScout extends EntityGlyphid {
|
||||
int y = MathHelper.floor_double(this.boundingBox.minY);
|
||||
int z = MathHelper.floor_double(this.posZ);
|
||||
|
||||
int light = this.worldObj.getBlockLightValue(x, y, z);
|
||||
int skylightSubtracted = this.worldObj.skylightSubtracted;
|
||||
|
||||
if(this.worldObj.isThundering()) {
|
||||
int skylightSubtracted = this.worldObj.skylightSubtracted;
|
||||
this.worldObj.skylightSubtracted = 10;
|
||||
light = this.worldObj.getBlockLightValue(x, y, z);
|
||||
this.worldObj.skylightSubtracted = skylightSubtracted;
|
||||
}
|
||||
|
||||
if(this.worldObj.isThundering()) this.worldObj.skylightSubtracted = 10;
|
||||
int light = worldObj.getChunkFromChunkCoords(x >> 4, z >> 4).getBlockLightValue(x & 15, y, z & 15, worldObj.skylightSubtracted);
|
||||
|
||||
this.worldObj.skylightSubtracted = skylightSubtracted;
|
||||
return light <= 7;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@ -63,7 +63,7 @@ public class EntityBombletZeta extends EntityThrowable {
|
||||
ExplosionChaos.spawnChlorine(worldObj, this.posX + 0.5F - motionX, this.posY + 0.5F - motionY, this.posZ + 0.5F - motionZ, 75, 2, 0);
|
||||
}
|
||||
if(type == 4) {
|
||||
worldObj.spawnEntityInWorld(EntityNukeExplosionMK5.statFac(worldObj, (int) (BombConfig.fatmanRadius * 1.5), posX, posY, posZ).mute());
|
||||
worldObj.spawnEntityInWorld(EntityNukeExplosionMK5.statFac(worldObj, (int) (BombConfig.fatmanRadius * 1.5), posX, posY, posZ));
|
||||
|
||||
NBTTagCompound data = new NBTTagCompound();
|
||||
data.setString("type", "muke");
|
||||
|
||||
@ -465,7 +465,7 @@ public class EntityBulletBaseNT extends EntityThrowableInterp implements IBullet
|
||||
}
|
||||
|
||||
if(config.nuke > 0 && !worldObj.isRemote) {
|
||||
worldObj.spawnEntityInWorld(EntityNukeExplosionMK5.statFac(worldObj, config.nuke, posX, posY, posZ).mute());
|
||||
worldObj.spawnEntityInWorld(EntityNukeExplosionMK5.statFac(worldObj, config.nuke, posX, posY, posZ));
|
||||
NBTTagCompound data = new NBTTagCompound();
|
||||
data.setString("type", "muke");
|
||||
if(MainRegistry.polaroidID == 11 || rand.nextInt(100) == 0) data.setBoolean("balefire", true);
|
||||
|
||||
@ -2,7 +2,7 @@ package com.hbm.entity.train;
|
||||
|
||||
import com.hbm.items.ModItems;
|
||||
|
||||
import api.hbm.energy.IBatteryItem;
|
||||
import api.hbm.energymk2.IBatteryItem;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
|
||||
@ -7,7 +7,7 @@ import com.hbm.inventory.gui.GuiInfoContainer;
|
||||
import com.hbm.lib.RefStrings;
|
||||
import com.hbm.tileentity.IGUIProvider;
|
||||
|
||||
import api.hbm.energy.IBatteryItem;
|
||||
import api.hbm.energymk2.IBatteryItem;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import net.minecraft.client.Minecraft;
|
||||
|
||||
@ -31,7 +31,7 @@ import com.hbm.lib.Library;
|
||||
import com.hbm.lib.ModDamageSource;
|
||||
import com.hbm.util.ArmorUtil;
|
||||
|
||||
import api.hbm.energy.IEnergyUser;
|
||||
import api.hbm.energymk2.IEnergyHandlerMK2;
|
||||
import cofh.api.energy.IEnergyProvider;
|
||||
|
||||
public class ExplosionNukeGeneric {
|
||||
@ -425,12 +425,9 @@ public class ExplosionNukeGeneric {
|
||||
Block b = world.getBlock(x,y,z);
|
||||
TileEntity te = world.getTileEntity(x, y, z);
|
||||
|
||||
if (te != null && te instanceof IEnergyUser) {
|
||||
|
||||
((IEnergyUser)te).setPower(0);
|
||||
|
||||
if(random.nextInt(5) < 1)
|
||||
world.setBlock(x, y, z, ModBlocks.block_electrical_scrap);
|
||||
if (te != null && te instanceof IEnergyHandlerMK2) {
|
||||
((IEnergyHandlerMK2)te).setPower(0);
|
||||
if(random.nextInt(5) < 1) world.setBlock(x, y, z, ModBlocks.block_electrical_scrap);
|
||||
}
|
||||
if (te != null && te instanceof IEnergyProvider) {
|
||||
|
||||
|
||||
@ -32,7 +32,7 @@ public class ExplosionNukeSmall {
|
||||
if(params.shrapnelCount > 0) ExplosionLarge.spawnShrapnels(world, posX, posY, posZ, params.shrapnelCount);
|
||||
if(params.miniNuke && !params.safe) new ExplosionNT(world, null, posX, posY, posZ, params.blastRadius).addAllAttrib(params.explosionAttribs).overrideResolution(params.resolution).explode();
|
||||
if(params.killRadius > 0) ExplosionNukeGeneric.dealDamage(world, posX, posY, posZ, params.killRadius);
|
||||
if(!params.miniNuke) world.spawnEntityInWorld(EntityNukeExplosionMK5.statFac(world, (int) params.blastRadius, posX, posY, posZ).mute());
|
||||
if(!params.miniNuke) world.spawnEntityInWorld(EntityNukeExplosionMK5.statFac(world, (int) params.blastRadius, posX, posY, posZ));
|
||||
|
||||
if(params.miniNuke) {
|
||||
float radMod = params.radiationLevel / 3F;
|
||||
|
||||
@ -1,14 +0,0 @@
|
||||
package com.hbm.handler.imc;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
public interface ICompatNHNEI {
|
||||
/**First item on the list is the icon for the recipe in the NEI GUI, the rest are displayed on the sidebar
|
||||
* as other items that can be used for the same purpose**/
|
||||
ItemStack[] getMachinesForRecipe();
|
||||
|
||||
String getRecipeID();
|
||||
|
||||
}
|
||||
@ -7,8 +7,6 @@ import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Map.Entry;
|
||||
|
||||
import com.hbm.blocks.ModBlocks;
|
||||
import com.hbm.handler.imc.ICompatNHNEI;
|
||||
import com.hbm.inventory.gui.GUIDiFurnace;
|
||||
import com.hbm.inventory.recipes.BlastFurnaceRecipes;
|
||||
import com.hbm.inventory.recipes.MachineRecipes;
|
||||
@ -19,22 +17,10 @@ import codechicken.nei.recipe.TemplateRecipeHandler;
|
||||
import net.minecraft.client.gui.inventory.GuiContainer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
public class AlloyFurnaceRecipeHandler extends TemplateRecipeHandler implements ICompatNHNEI {
|
||||
public class AlloyFurnaceRecipeHandler extends TemplateRecipeHandler {
|
||||
|
||||
public static ArrayList<Fuel> fuels;
|
||||
|
||||
@Override
|
||||
public ItemStack[] getMachinesForRecipe() {
|
||||
return new ItemStack[]{
|
||||
new ItemStack(ModBlocks.machine_difurnace_off),
|
||||
new ItemStack(ModBlocks.machine_difurnace_rtg_off)};
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getRecipeID() {
|
||||
return "alloysmelting";
|
||||
}
|
||||
|
||||
public class SmeltingSet extends TemplateRecipeHandler.CachedRecipe {
|
||||
PositionedStack input1;
|
||||
PositionedStack input2;
|
||||
|
||||
@ -7,9 +7,7 @@ import java.util.ArrayList;
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
|
||||
import com.hbm.blocks.ModBlocks;
|
||||
import com.hbm.blocks.machine.NTMAnvil;
|
||||
import com.hbm.handler.imc.ICompatNHNEI;
|
||||
import com.hbm.inventory.RecipesCommon.AStack;
|
||||
import com.hbm.inventory.gui.GUIAnvil;
|
||||
import com.hbm.inventory.recipes.anvil.AnvilRecipes;
|
||||
@ -26,28 +24,7 @@ import net.minecraft.client.gui.inventory.GuiContainer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.EnumChatFormatting;
|
||||
|
||||
public class AnvilRecipeHandler extends TemplateRecipeHandler implements ICompatNHNEI {
|
||||
|
||||
@Override
|
||||
public ItemStack[] getMachinesForRecipe() {
|
||||
return new ItemStack[]{
|
||||
new ItemStack(ModBlocks.anvil_iron),
|
||||
new ItemStack(ModBlocks.anvil_lead),
|
||||
new ItemStack(ModBlocks.anvil_steel),
|
||||
new ItemStack(ModBlocks.anvil_starmetal),
|
||||
new ItemStack(ModBlocks.anvil_meteorite),
|
||||
new ItemStack(ModBlocks.anvil_ferrouranium),
|
||||
new ItemStack(ModBlocks.anvil_bismuth),
|
||||
new ItemStack(ModBlocks.anvil_schrabidate),
|
||||
new ItemStack(ModBlocks.anvil_dnt),
|
||||
new ItemStack(ModBlocks.anvil_osmiridium),
|
||||
new ItemStack(ModBlocks.anvil_murky)};
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getRecipeID() {
|
||||
return "ntmAnvil";
|
||||
}
|
||||
public class AnvilRecipeHandler extends TemplateRecipeHandler {
|
||||
|
||||
public LinkedList<RecipeTransferRect> transferRectsRec = new LinkedList<RecipeTransferRect>();
|
||||
public LinkedList<RecipeTransferRect> transferRectsGui = new LinkedList<RecipeTransferRect>();
|
||||
|
||||
@ -6,8 +6,6 @@ import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import com.hbm.blocks.ModBlocks;
|
||||
import com.hbm.handler.imc.ICompatNHNEI;
|
||||
import com.hbm.inventory.RecipesCommon.ComparableStack;
|
||||
import com.hbm.inventory.gui.GUIMachineAssembler;
|
||||
import com.hbm.inventory.recipes.AssemblerRecipes;
|
||||
@ -21,25 +19,13 @@ import codechicken.nei.recipe.TemplateRecipeHandler;
|
||||
import net.minecraft.client.gui.inventory.GuiContainer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
public class AssemblerRecipeHandler extends TemplateRecipeHandler implements ICompatNHNEI {
|
||||
public class AssemblerRecipeHandler extends TemplateRecipeHandler {
|
||||
|
||||
public LinkedList<RecipeTransferRect> transferRectsRec = new LinkedList<RecipeTransferRect>();
|
||||
public LinkedList<RecipeTransferRect> transferRectsGui = new LinkedList<RecipeTransferRect>();
|
||||
public LinkedList<Class<? extends GuiContainer>> guiRec = new LinkedList<Class<? extends GuiContainer>>();
|
||||
public LinkedList<Class<? extends GuiContainer>> guiGui = new LinkedList<Class<? extends GuiContainer>>();
|
||||
|
||||
@Override
|
||||
public ItemStack[] getMachinesForRecipe() {
|
||||
return new ItemStack[]{
|
||||
new ItemStack(ModBlocks.machine_assembler),
|
||||
new ItemStack(ModBlocks.machine_assemfac)};
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getRecipeID() {
|
||||
return "assembly";
|
||||
}
|
||||
|
||||
public class SmeltingSet extends TemplateRecipeHandler.CachedRecipe {
|
||||
|
||||
List<PositionedStack> input;
|
||||
|
||||
@ -4,8 +4,6 @@ import java.awt.Rectangle;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import com.hbm.blocks.ModBlocks;
|
||||
import com.hbm.handler.imc.ICompatNHNEI;
|
||||
import com.hbm.inventory.RecipesCommon.AStack;
|
||||
import com.hbm.inventory.RecipesCommon.ComparableStack;
|
||||
import com.hbm.inventory.RecipesCommon.OreDictStack;
|
||||
@ -16,22 +14,12 @@ import com.hbm.inventory.recipes.MagicRecipes.MagicRecipe;
|
||||
import codechicken.nei.NEIServerUtils;
|
||||
import codechicken.nei.PositionedStack;
|
||||
import codechicken.nei.recipe.TemplateRecipeHandler;
|
||||
import com.hbm.items.ModItems;
|
||||
import net.minecraft.client.gui.inventory.GuiContainer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
public class BookRecipeHandler extends TemplateRecipeHandler implements ICompatNHNEI {
|
||||
@Override
|
||||
public ItemStack[] getMachinesForRecipe() {
|
||||
return new ItemStack[]{
|
||||
new ItemStack(ModItems.book_of_)};
|
||||
}
|
||||
public class BookRecipeHandler extends TemplateRecipeHandler {
|
||||
|
||||
@Override
|
||||
public String getRecipeID() {
|
||||
return "book_of_boxcars";
|
||||
}
|
||||
public class RecipeSet extends TemplateRecipeHandler.CachedRecipe {
|
||||
public class RecipeSet extends TemplateRecipeHandler.CachedRecipe {
|
||||
|
||||
List<PositionedStack> input;
|
||||
PositionedStack result;
|
||||
|
||||
@ -5,8 +5,6 @@ import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import com.hbm.blocks.ModBlocks;
|
||||
import com.hbm.handler.imc.ICompatNHNEI;
|
||||
import com.hbm.inventory.gui.GUIMachineReactorBreeding;
|
||||
import com.hbm.inventory.recipes.BreederRecipes;
|
||||
import com.hbm.inventory.recipes.BreederRecipes.BreederRecipe;
|
||||
@ -18,18 +16,8 @@ import codechicken.nei.recipe.TemplateRecipeHandler;
|
||||
import net.minecraft.client.gui.inventory.GuiContainer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
public class BreederRecipeHandler extends TemplateRecipeHandler implements ICompatNHNEI {
|
||||
public class BreederRecipeHandler extends TemplateRecipeHandler {
|
||||
|
||||
@Override
|
||||
public ItemStack[] getMachinesForRecipe() {
|
||||
return new ItemStack[]{
|
||||
new ItemStack(ModBlocks.machine_reactor_breeding)};
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getRecipeID() {
|
||||
return "breeding";
|
||||
}
|
||||
public class BreedingSet extends TemplateRecipeHandler.CachedRecipe {
|
||||
|
||||
PositionedStack input;
|
||||
|
||||
@ -5,8 +5,6 @@ import java.util.ArrayList;
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
|
||||
import com.hbm.blocks.ModBlocks;
|
||||
import com.hbm.handler.imc.ICompatNHNEI;
|
||||
import com.hbm.inventory.FluidStack;
|
||||
import com.hbm.inventory.RecipesCommon.AStack;
|
||||
import com.hbm.inventory.gui.GUIMachineChemplant;
|
||||
@ -22,26 +20,14 @@ import codechicken.nei.recipe.TemplateRecipeHandler;
|
||||
import net.minecraft.client.gui.inventory.GuiContainer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
public class ChemplantRecipeHandler extends TemplateRecipeHandler implements ICompatNHNEI {
|
||||
public class ChemplantRecipeHandler extends TemplateRecipeHandler {
|
||||
|
||||
public LinkedList<RecipeTransferRect> transferRectsRec = new LinkedList<RecipeTransferRect>();
|
||||
public LinkedList<RecipeTransferRect> transferRectsGui = new LinkedList<RecipeTransferRect>();
|
||||
public LinkedList<Class<? extends GuiContainer>> guiRec = new LinkedList<Class<? extends GuiContainer>>();
|
||||
public LinkedList<Class<? extends GuiContainer>> guiGui = new LinkedList<Class<? extends GuiContainer>>();
|
||||
|
||||
@Override
|
||||
public ItemStack[] getMachinesForRecipe() {
|
||||
return new ItemStack[]{
|
||||
new ItemStack(ModBlocks.machine_chemplant),
|
||||
new ItemStack(ModBlocks.machine_chemfac)};
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getRecipeID() {
|
||||
return "chemistry";
|
||||
}
|
||||
public class RecipeSet extends TemplateRecipeHandler.CachedRecipe {
|
||||
|
||||
PositionedStack[] itemIn = new PositionedStack[4];
|
||||
PositionedStack[] fluidIn = new PositionedStack[2];
|
||||
PositionedStack[] itemOut = new PositionedStack[4];
|
||||
|
||||
@ -1,79 +0,0 @@
|
||||
package com.hbm.handler.nei;
|
||||
|
||||
import static codechicken.lib.gui.GuiDraw.drawTexturedModalRect;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import com.hbm.config.GeneralConfig;
|
||||
import com.hbm.lib.RefStrings;
|
||||
|
||||
import codechicken.nei.PositionedStack;
|
||||
import codechicken.nei.guihook.GuiContainerManager;
|
||||
import codechicken.nei.recipe.TemplateRecipeHandler;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.gui.FontRenderer;
|
||||
import net.minecraft.client.renderer.RenderHelper;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
public class ChunkyHandler extends TemplateRecipeHandler {
|
||||
|
||||
public class RecipeSet extends TemplateRecipeHandler.CachedRecipe {
|
||||
|
||||
ItemStack stack;
|
||||
|
||||
public RecipeSet(ItemStack stack) {
|
||||
this.stack = stack.copy();
|
||||
this.stack.stackSize = 1;
|
||||
}
|
||||
|
||||
@Override
|
||||
public PositionedStack getResult() {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getRecipeName() {
|
||||
return "";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getGuiTexture() {
|
||||
return RefStrings.MODID + ":textures/gui/nei/gui_nei.png";
|
||||
}
|
||||
|
||||
@Override
|
||||
public void loadCraftingRecipes(ItemStack result) {
|
||||
if(GeneralConfig.enableChunkyNEIHandler)
|
||||
this.arecipes.add(new RecipeSet(result));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void loadUsageRecipes(ItemStack ingredient) {
|
||||
if(GeneralConfig.enableChunkyNEIHandler)
|
||||
this.arecipes.add(new RecipeSet(ingredient));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawExtras(int recipe) {
|
||||
RecipeSet rec = (RecipeSet) this.arecipes.get(recipe);
|
||||
drawTexturedModalRect(145, 0, 20, 20, 20, 20);
|
||||
GL11.glPushMatrix();
|
||||
GL11.glTranslated(83, 50, 0);
|
||||
double scale = 5D;
|
||||
GL11.glScaled(scale, scale, scale);
|
||||
RenderHelper.enableGUIStandardItemLighting();
|
||||
GL11.glTranslated(-8, -8, 0);
|
||||
GuiContainerManager.drawItem(0, 0, rec.stack);
|
||||
GL11.glPopMatrix();
|
||||
RenderHelper.enableGUIStandardItemLighting();
|
||||
|
||||
FontRenderer font = Minecraft.getMinecraft().fontRenderer;
|
||||
|
||||
int w = 83;
|
||||
String top = "The same thing but in big";
|
||||
String bottom = "so you can really stare at it";
|
||||
font.drawString(top, w - font.getStringWidth(top) / 2, 100, 0x404040);
|
||||
font.drawString(bottom, w - font.getStringWidth(bottom) / 2, 110, 0x404040);
|
||||
}
|
||||
}
|
||||
@ -16,14 +16,6 @@ public class ConstructionHandler extends NEIUniversalHandler {
|
||||
super("Construction", getRecipes(true), getRecipes(false));
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack[] getMachinesForRecipe() {
|
||||
return new ItemStack[]{
|
||||
new ItemStack(ModItems.acetylene_torch),
|
||||
new ItemStack(ModItems.blowtorch),
|
||||
new ItemStack(ModItems.boltgun)};
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getKey() {
|
||||
return "ntmConstruction";
|
||||
|
||||
@ -6,7 +6,6 @@ import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
|
||||
import com.hbm.blocks.ModBlocks;
|
||||
import com.hbm.handler.imc.ICompatNHNEI;
|
||||
import com.hbm.inventory.material.Mats;
|
||||
import com.hbm.inventory.material.Mats.MaterialStack;
|
||||
import com.hbm.inventory.material.NTMMaterial;
|
||||
@ -21,16 +20,7 @@ import codechicken.nei.recipe.TemplateRecipeHandler;
|
||||
import net.minecraft.client.gui.inventory.GuiContainer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
public class CrucibleAlloyingHandler extends TemplateRecipeHandler implements ICompatNHNEI {
|
||||
@Override
|
||||
public ItemStack[] getMachinesForRecipe() {
|
||||
return new ItemStack[]{
|
||||
new ItemStack(ModBlocks.machine_crucible)};
|
||||
}
|
||||
@Override
|
||||
public String getRecipeID() {
|
||||
return "ntmCrucibleAlloying";
|
||||
}
|
||||
public class CrucibleAlloyingHandler extends TemplateRecipeHandler {
|
||||
|
||||
public LinkedList<RecipeTransferRect> transferRectsRec = new LinkedList<RecipeTransferRect>();
|
||||
public LinkedList<Class<? extends GuiContainer>> guiRec = new LinkedList<Class<? extends GuiContainer>>();
|
||||
|
||||
@ -6,8 +6,6 @@ import java.util.Arrays;
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
|
||||
import com.hbm.blocks.ModBlocks;
|
||||
import com.hbm.handler.imc.ICompatNHNEI;
|
||||
import com.hbm.inventory.material.Mats;
|
||||
import com.hbm.inventory.recipes.CrucibleRecipes;
|
||||
import com.hbm.items.machine.ItemMold;
|
||||
@ -19,19 +17,7 @@ import codechicken.nei.recipe.TemplateRecipeHandler;
|
||||
import net.minecraft.client.gui.inventory.GuiContainer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
public class CrucibleCastingHandler extends TemplateRecipeHandler implements ICompatNHNEI {
|
||||
|
||||
@Override
|
||||
public ItemStack[] getMachinesForRecipe() {
|
||||
return new ItemStack[]{
|
||||
new ItemStack(ModBlocks.foundry_basin),
|
||||
new ItemStack(ModBlocks.foundry_mold),
|
||||
new ItemStack(ModBlocks.machine_strand_caster)};
|
||||
}
|
||||
@Override
|
||||
public String getRecipeID() {
|
||||
return "ntmCrucibleFoundry";
|
||||
}
|
||||
public class CrucibleCastingHandler extends TemplateRecipeHandler {
|
||||
|
||||
public LinkedList<RecipeTransferRect> transferRectsRec = new LinkedList<RecipeTransferRect>();
|
||||
public LinkedList<Class<? extends GuiContainer>> guiRec = new LinkedList<Class<? extends GuiContainer>>();
|
||||
|
||||
@ -9,7 +9,6 @@ import java.util.List;
|
||||
import java.util.Map.Entry;
|
||||
|
||||
import com.hbm.blocks.ModBlocks;
|
||||
import com.hbm.handler.imc.ICompatNHNEI;
|
||||
import com.hbm.inventory.RecipesCommon.AStack;
|
||||
import com.hbm.inventory.recipes.CrucibleRecipes;
|
||||
import com.hbm.lib.RefStrings;
|
||||
@ -20,17 +19,8 @@ import codechicken.nei.recipe.TemplateRecipeHandler;
|
||||
import net.minecraft.client.gui.inventory.GuiContainer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
public class CrucibleSmeltingHandler extends TemplateRecipeHandler implements ICompatNHNEI {
|
||||
|
||||
@Override
|
||||
public ItemStack[] getMachinesForRecipe() {
|
||||
return new ItemStack[]{
|
||||
new ItemStack(ModBlocks.machine_crucible)};
|
||||
}
|
||||
@Override
|
||||
public String getRecipeID() {
|
||||
return "ntmCrucibleSmelting";
|
||||
}
|
||||
public class CrucibleSmeltingHandler extends TemplateRecipeHandler {
|
||||
|
||||
public LinkedList<RecipeTransferRect> transferRectsRec = new LinkedList<RecipeTransferRect>();
|
||||
public LinkedList<Class<? extends GuiContainer>> guiRec = new LinkedList<Class<? extends GuiContainer>>();
|
||||
|
||||
|
||||
@ -6,8 +6,6 @@ import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import com.hbm.blocks.ModBlocks;
|
||||
import com.hbm.handler.imc.ICompatNHNEI;
|
||||
import com.hbm.inventory.gui.GUIMachineCyclotron;
|
||||
import com.hbm.inventory.recipes.CyclotronRecipes;
|
||||
import com.hbm.lib.RefStrings;
|
||||
@ -18,17 +16,8 @@ import codechicken.nei.recipe.TemplateRecipeHandler;
|
||||
import net.minecraft.client.gui.inventory.GuiContainer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
public class CyclotronRecipeHandler extends TemplateRecipeHandler implements ICompatNHNEI {
|
||||
@Override
|
||||
public ItemStack[] getMachinesForRecipe() {
|
||||
return new ItemStack[]{
|
||||
new ItemStack(ModBlocks.machine_cyclotron)};
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getRecipeID() {
|
||||
return "cyclotronProcessing";
|
||||
}
|
||||
public class CyclotronRecipeHandler extends TemplateRecipeHandler {
|
||||
|
||||
public LinkedList<RecipeTransferRect> transferRectsRec = new LinkedList<RecipeTransferRect>();
|
||||
public LinkedList<RecipeTransferRect> transferRectsGui = new LinkedList<RecipeTransferRect>();
|
||||
public LinkedList<Class<? extends GuiContainer>> guiRec = new LinkedList<Class<? extends GuiContainer>>();
|
||||
|
||||
@ -5,10 +5,7 @@ import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import com.hbm.blocks.ModBlocks;
|
||||
import com.hbm.handler.imc.ICompatNHNEI;
|
||||
import com.hbm.inventory.recipes.MachineRecipes;
|
||||
import com.hbm.items.ModItems;
|
||||
import com.hbm.lib.RefStrings;
|
||||
|
||||
import codechicken.nei.NEIServerUtils;
|
||||
@ -17,23 +14,7 @@ import codechicken.nei.recipe.TemplateRecipeHandler;
|
||||
import net.minecraft.client.gui.inventory.GuiContainer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
public class FluidRecipeHandler extends TemplateRecipeHandler implements ICompatNHNEI {
|
||||
@Override
|
||||
public ItemStack[] getMachinesForRecipe() {
|
||||
return new ItemStack[]{
|
||||
new ItemStack(ModItems.fluid_barrel_empty),
|
||||
new ItemStack(ModItems.fluid_tank_empty),
|
||||
new ItemStack(ModItems.fluid_tank_lead_empty),
|
||||
new ItemStack(ModItems.canister_empty),
|
||||
new ItemStack(ModItems.gas_empty),
|
||||
new ItemStack(ModItems.cell_empty),
|
||||
new ItemStack(ModItems.disperser_canister_empty),
|
||||
new ItemStack(ModItems.glyphid_gland_empty)};
|
||||
}
|
||||
@Override
|
||||
public String getRecipeID() {
|
||||
return "fluidcons";
|
||||
}
|
||||
public class FluidRecipeHandler extends TemplateRecipeHandler {
|
||||
|
||||
public class SmeltingSet extends TemplateRecipeHandler.CachedRecipe
|
||||
{
|
||||
|
||||
@ -6,8 +6,6 @@ import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import com.hbm.blocks.ModBlocks;
|
||||
import com.hbm.handler.imc.ICompatNHNEI;
|
||||
import com.hbm.inventory.gui.GUIITER;
|
||||
import com.hbm.inventory.recipes.FusionRecipes;
|
||||
import com.hbm.lib.RefStrings;
|
||||
@ -18,17 +16,8 @@ import codechicken.nei.recipe.TemplateRecipeHandler;
|
||||
import net.minecraft.client.gui.inventory.GuiContainer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
public class FusionRecipeHandler extends TemplateRecipeHandler implements ICompatNHNEI {
|
||||
|
||||
@Override
|
||||
public ItemStack[] getMachinesForRecipe() {
|
||||
return new ItemStack[]{
|
||||
new ItemStack(ModBlocks.iter)};
|
||||
}
|
||||
@Override
|
||||
public String getRecipeID() {
|
||||
return "fusion";
|
||||
}
|
||||
public class FusionRecipeHandler extends TemplateRecipeHandler {
|
||||
|
||||
public LinkedList<RecipeTransferRect> transferRectsRec = new LinkedList<RecipeTransferRect>();
|
||||
public LinkedList<RecipeTransferRect> transferRectsGui = new LinkedList<RecipeTransferRect>();
|
||||
public LinkedList<Class<? extends GuiContainer>> guiRec = new LinkedList<Class<? extends GuiContainer>>();
|
||||
|
||||
@ -9,8 +9,6 @@ import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import com.hbm.blocks.ModBlocks;
|
||||
import com.hbm.handler.imc.ICompatNHNEI;
|
||||
import com.hbm.inventory.gui.GUIMachineGasCent;
|
||||
import com.hbm.inventory.recipes.GasCentrifugeRecipes;
|
||||
import com.hbm.inventory.recipes.MachineRecipes;
|
||||
@ -24,16 +22,8 @@ import net.minecraft.client.gui.FontRenderer;
|
||||
import net.minecraft.client.gui.inventory.GuiContainer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
public class GasCentrifugeRecipeHandler extends TemplateRecipeHandler implements ICompatNHNEI {
|
||||
@Override
|
||||
public ItemStack[] getMachinesForRecipe() {
|
||||
return new ItemStack[]{
|
||||
new ItemStack(ModBlocks.machine_gascent)};
|
||||
}
|
||||
@Override
|
||||
public String getRecipeID() {
|
||||
return "gascentprocessing";
|
||||
}
|
||||
public class GasCentrifugeRecipeHandler extends TemplateRecipeHandler {
|
||||
|
||||
public static ArrayList<Fuel> fuels;
|
||||
|
||||
public class SmeltingSet extends TemplateRecipeHandler.CachedRecipe {
|
||||
|
||||
@ -8,8 +8,6 @@ import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
|
||||
import com.hbm.blocks.ModBlocks;
|
||||
import com.hbm.handler.imc.ICompatNHNEI;
|
||||
import com.hbm.inventory.gui.GUIHadron;
|
||||
import com.hbm.inventory.recipes.HadronRecipes;
|
||||
import com.hbm.inventory.recipes.HadronRecipes.HadronRecipe;
|
||||
@ -23,17 +21,8 @@ import net.minecraft.client.gui.FontRenderer;
|
||||
import net.minecraft.client.gui.inventory.GuiContainer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
public class HadronRecipeHandler extends TemplateRecipeHandler implements ICompatNHNEI {
|
||||
public class HadronRecipeHandler extends TemplateRecipeHandler {
|
||||
|
||||
@Override
|
||||
public ItemStack[] getMachinesForRecipe() {
|
||||
return new ItemStack[]{
|
||||
new ItemStack(ModBlocks.hadron_core)};
|
||||
}
|
||||
@Override
|
||||
public String getRecipeID() {
|
||||
return "hadron";
|
||||
}
|
||||
public LinkedList<RecipeTransferRect> transferRectsRec = new LinkedList<RecipeTransferRect>();
|
||||
public LinkedList<RecipeTransferRect> transferRectsGui = new LinkedList<RecipeTransferRect>();
|
||||
public LinkedList<Class<? extends GuiContainer>> guiRec = new LinkedList<Class<? extends GuiContainer>>();
|
||||
|
||||
@ -10,8 +10,6 @@ import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
import java.util.Map.Entry;
|
||||
|
||||
import com.hbm.blocks.ModBlocks;
|
||||
import com.hbm.handler.imc.ICompatNHNEI;
|
||||
import com.hbm.lib.RefStrings;
|
||||
import com.hbm.util.InventoryUtil;
|
||||
|
||||
@ -23,13 +21,8 @@ import net.minecraft.client.gui.inventory.GuiContainer;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
public abstract class NEIUniversalHandler extends TemplateRecipeHandler implements ICompatNHNEI {
|
||||
|
||||
@Override
|
||||
public ItemStack[] getMachinesForRecipe() {
|
||||
return machine;
|
||||
}
|
||||
|
||||
public abstract class NEIUniversalHandler extends TemplateRecipeHandler {
|
||||
|
||||
public LinkedList<RecipeTransferRect> transferRectsRec = new LinkedList<RecipeTransferRect>();
|
||||
public LinkedList<RecipeTransferRect> transferRectsGui = new LinkedList<RecipeTransferRect>();
|
||||
public LinkedList<Class<? extends GuiContainer>> guiRec = new LinkedList<Class<? extends GuiContainer>>();
|
||||
@ -41,6 +34,7 @@ public abstract class NEIUniversalHandler extends TemplateRecipeHandler implemen
|
||||
public final HashMap<Object, Object> recipes;
|
||||
public HashMap<Object, Object> machineOverrides;
|
||||
/// SETUP ///
|
||||
|
||||
public NEIUniversalHandler(String display, ItemStack machine[], HashMap recipes) {
|
||||
this.display = display;
|
||||
this.machine = machine;
|
||||
@ -311,9 +305,4 @@ public abstract class NEIUniversalHandler extends TemplateRecipeHandler implemen
|
||||
}
|
||||
|
||||
public abstract String getKey();
|
||||
|
||||
@Override
|
||||
public String getRecipeID() {
|
||||
return getKey();
|
||||
}
|
||||
}
|
||||
|
||||
@ -7,8 +7,6 @@ import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import com.hbm.blocks.ModBlocks;
|
||||
import com.hbm.handler.imc.ICompatNHNEI;
|
||||
import com.hbm.interfaces.Untested;
|
||||
import com.hbm.inventory.RecipesCommon.AStack;
|
||||
import com.hbm.inventory.RecipesCommon.ComparableStack;
|
||||
@ -27,19 +25,8 @@ import net.minecraft.client.gui.inventory.GuiContainer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
@Untested
|
||||
public class PressRecipeHandler extends TemplateRecipeHandler implements ICompatNHNEI {
|
||||
public class PressRecipeHandler extends TemplateRecipeHandler {
|
||||
|
||||
@Override
|
||||
public ItemStack[] getMachinesForRecipe() {
|
||||
return new ItemStack[]{
|
||||
new ItemStack(ModBlocks.machine_press),
|
||||
new ItemStack(ModBlocks.machine_epress),
|
||||
new ItemStack(ModBlocks.machine_conveyor_press)};
|
||||
}
|
||||
@Override
|
||||
public String getRecipeID() {
|
||||
return "pressing";
|
||||
}
|
||||
public LinkedList<RecipeTransferRect> transferRectsRec = new LinkedList<RecipeTransferRect>();
|
||||
public LinkedList<RecipeTransferRect> transferRectsGui = new LinkedList<RecipeTransferRect>();
|
||||
public LinkedList<Class<? extends GuiContainer>> guiRec = new LinkedList<Class<? extends GuiContainer>>();
|
||||
|
||||
@ -8,8 +8,6 @@ import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
import java.util.Map.Entry;
|
||||
|
||||
import com.hbm.blocks.ModBlocks;
|
||||
import com.hbm.handler.imc.ICompatNHNEI;
|
||||
import com.hbm.inventory.gui.GUIRadiolysis;
|
||||
import com.hbm.inventory.recipes.RadiolysisRecipes;
|
||||
import com.hbm.lib.RefStrings;
|
||||
@ -20,17 +18,8 @@ import codechicken.nei.recipe.TemplateRecipeHandler;
|
||||
import net.minecraft.client.gui.inventory.GuiContainer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
public class RadiolysisRecipeHandler extends TemplateRecipeHandler implements ICompatNHNEI {
|
||||
|
||||
@Override
|
||||
public ItemStack[] getMachinesForRecipe() {
|
||||
return new ItemStack[]{
|
||||
new ItemStack(ModBlocks.machine_radiolysis)};
|
||||
}
|
||||
@Override
|
||||
public String getRecipeID() {
|
||||
return "ntmRadiolysis";
|
||||
}
|
||||
public class RadiolysisRecipeHandler extends TemplateRecipeHandler {
|
||||
|
||||
public LinkedList<RecipeTransferRect> transferRectsRec = new LinkedList<RecipeTransferRect>();
|
||||
public LinkedList<RecipeTransferRect> transferRectsGui = new LinkedList<RecipeTransferRect>();
|
||||
public LinkedList<Class<? extends GuiContainer>> guiRec = new LinkedList<Class<? extends GuiContainer>>();
|
||||
|
||||
@ -7,8 +7,6 @@ import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import com.hbm.blocks.ModBlocks;
|
||||
import com.hbm.handler.imc.ICompatNHNEI;
|
||||
import com.hbm.inventory.gui.GUIMachineRefinery;
|
||||
import com.hbm.inventory.recipes.RefineryRecipes;
|
||||
import com.hbm.lib.RefStrings;
|
||||
@ -18,17 +16,8 @@ import codechicken.nei.recipe.TemplateRecipeHandler;
|
||||
import net.minecraft.client.gui.inventory.GuiContainer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
public class RefineryRecipeHandler extends TemplateRecipeHandler implements ICompatNHNEI {
|
||||
public class RefineryRecipeHandler extends TemplateRecipeHandler {
|
||||
|
||||
@Override
|
||||
public ItemStack[] getMachinesForRecipe() {
|
||||
return new ItemStack[]{
|
||||
new ItemStack(ModBlocks.machine_refinery)};
|
||||
}
|
||||
@Override
|
||||
public String getRecipeID() {
|
||||
return "refinery";
|
||||
}
|
||||
public LinkedList<RecipeTransferRect> transferRectsRec = new LinkedList<RecipeTransferRect>();
|
||||
public LinkedList<RecipeTransferRect> transferRectsGui = new LinkedList<RecipeTransferRect>();
|
||||
public LinkedList<Class<? extends GuiContainer>> guiRec = new LinkedList<Class<? extends GuiContainer>>();
|
||||
|
||||
@ -7,8 +7,6 @@ import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import com.hbm.blocks.ModBlocks;
|
||||
import com.hbm.handler.imc.ICompatNHNEI;
|
||||
import com.hbm.inventory.gui.GUISILEX;
|
||||
import com.hbm.inventory.recipes.SILEXRecipes;
|
||||
import com.hbm.inventory.recipes.SILEXRecipes.SILEXRecipe;
|
||||
@ -26,17 +24,8 @@ import net.minecraft.client.gui.inventory.GuiContainer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.EnumChatFormatting;
|
||||
|
||||
public class SILEXRecipeHandler extends TemplateRecipeHandler implements ICompatNHNEI {
|
||||
public class SILEXRecipeHandler extends TemplateRecipeHandler {
|
||||
|
||||
@Override
|
||||
public ItemStack[] getMachinesForRecipe() {
|
||||
return new ItemStack[]{
|
||||
new ItemStack(ModBlocks.machine_silex)};
|
||||
}
|
||||
@Override
|
||||
public String getRecipeID() {
|
||||
return "silex";
|
||||
}
|
||||
public LinkedList<RecipeTransferRect> transferRectsRec = new LinkedList<RecipeTransferRect>();
|
||||
public LinkedList<RecipeTransferRect> transferRectsGui = new LinkedList<RecipeTransferRect>();
|
||||
public LinkedList<Class<? extends GuiContainer>> guiRec = new LinkedList<Class<? extends GuiContainer>>();
|
||||
|
||||
@ -7,8 +7,6 @@ import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import com.hbm.blocks.ModBlocks;
|
||||
import com.hbm.handler.imc.ICompatNHNEI;
|
||||
import com.hbm.inventory.RecipesCommon.ComparableStack;
|
||||
import com.hbm.inventory.gui.GUIMachineShredder;
|
||||
import com.hbm.inventory.recipes.MachineRecipes;
|
||||
@ -21,17 +19,8 @@ import codechicken.nei.recipe.TemplateRecipeHandler;
|
||||
import net.minecraft.client.gui.inventory.GuiContainer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
public class ShredderRecipeHandler extends TemplateRecipeHandler implements ICompatNHNEI {
|
||||
public class ShredderRecipeHandler extends TemplateRecipeHandler {
|
||||
|
||||
@Override
|
||||
public ItemStack[] getMachinesForRecipe() {
|
||||
return new ItemStack[]{
|
||||
new ItemStack(ModBlocks.machine_shredder)};
|
||||
}
|
||||
@Override
|
||||
public String getRecipeID() {
|
||||
return "ntmRadiolysis";
|
||||
}
|
||||
public static ArrayList<Fuel> fuels;
|
||||
|
||||
public LinkedList<RecipeTransferRect> transferRectsRec = new LinkedList<RecipeTransferRect>();
|
||||
|
||||
@ -5,8 +5,6 @@ import java.util.Arrays;
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
|
||||
import com.hbm.blocks.ModBlocks;
|
||||
import com.hbm.handler.imc.ICompatNHNEI;
|
||||
import com.hbm.inventory.gui.GUIAnvil;
|
||||
import com.hbm.inventory.recipes.anvil.AnvilRecipes;
|
||||
import com.hbm.inventory.recipes.anvil.AnvilSmithingRecipe;
|
||||
@ -20,27 +18,8 @@ import net.minecraft.client.gui.FontRenderer;
|
||||
import net.minecraft.client.gui.inventory.GuiContainer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
public class SmithingRecipeHandler extends TemplateRecipeHandler implements ICompatNHNEI {
|
||||
public class SmithingRecipeHandler extends TemplateRecipeHandler {
|
||||
|
||||
@Override
|
||||
public ItemStack[] getMachinesForRecipe() {
|
||||
return new ItemStack[]{
|
||||
new ItemStack(ModBlocks.anvil_lead),
|
||||
new ItemStack(ModBlocks.anvil_iron),
|
||||
new ItemStack(ModBlocks.anvil_steel),
|
||||
new ItemStack(ModBlocks.anvil_starmetal),
|
||||
new ItemStack(ModBlocks.anvil_meteorite),
|
||||
new ItemStack(ModBlocks.anvil_ferrouranium),
|
||||
new ItemStack(ModBlocks.anvil_bismuth),
|
||||
new ItemStack(ModBlocks.anvil_schrabidate),
|
||||
new ItemStack(ModBlocks.anvil_dnt),
|
||||
new ItemStack(ModBlocks.anvil_osmiridium),
|
||||
new ItemStack(ModBlocks.anvil_murky)};
|
||||
}
|
||||
@Override
|
||||
public String getRecipeID() {
|
||||
return "ntmSmithing";
|
||||
}
|
||||
public LinkedList<RecipeTransferRect> transferRectsRec = new LinkedList<RecipeTransferRect>();
|
||||
public LinkedList<RecipeTransferRect> transferRectsGui = new LinkedList<RecipeTransferRect>();
|
||||
public LinkedList<Class<? extends GuiContainer>> guiRec = new LinkedList<Class<? extends GuiContainer>>();
|
||||
|
||||
@ -1,17 +1,9 @@
|
||||
package com.hbm.handler.nei;
|
||||
|
||||
import com.hbm.blocks.generic.BlockToolConversion;
|
||||
import com.hbm.items.ModItems;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
public class ToolingHandler extends NEIUniversalHandler {
|
||||
@Override
|
||||
public ItemStack[] getMachinesForRecipe() {
|
||||
return new ItemStack[]{
|
||||
new ItemStack(ModItems.boltgun),
|
||||
new ItemStack(ModItems.blowtorch),
|
||||
new ItemStack(ModItems.acetylene_torch)};
|
||||
}
|
||||
|
||||
public ToolingHandler() {
|
||||
super("Tooling", BlockToolConversion.getRecipes(true), BlockToolConversion.getRecipes(false));
|
||||
}
|
||||
|
||||
@ -164,6 +164,10 @@ public class OreDictManager {
|
||||
public static final DictFrame TCALLOY = new DictFrame("TcAlloy");
|
||||
/** CADMIUM STEEL */
|
||||
public static final DictFrame CDALLOY = new DictFrame("CdAlloy");
|
||||
/** BISMUTH BRONZE */
|
||||
public static final DictFrame BBRONZE = new DictFrame("BismuthBronze");
|
||||
/** ARSENIC BRONZE */
|
||||
public static final DictFrame ABRONZE = new DictFrame("ArsenicBronze");
|
||||
/** LEAD */
|
||||
public static final DictFrame PB = new DictFrame("Lead");
|
||||
public static final DictFrame BI = new DictFrame("Bismuth");
|
||||
@ -290,6 +294,8 @@ public class OreDictManager {
|
||||
public static final DictGroup ANY_HARDPLASTIC = new DictGroup("AnyHardPlastic", PC, PVC);
|
||||
/** Any post nuclear steel like TCA or CDA */
|
||||
public static final DictGroup ANY_RESISTANTALLOY = new DictGroup("AnyResistantAlloy", TCALLOY, CDALLOY);
|
||||
/** Any post nuclear steel like TCA or CDA */
|
||||
public static final DictGroup ANY_BISMOIDBRONZE = new DictGroup("AnyBismoidBronze", BBRONZE, ABRONZE);
|
||||
/** Any "powder" propellant like gunpowder, ballistite and cordite */
|
||||
public static final DictFrame ANY_GUNPOWDER = new DictFrame("AnyPropellant");
|
||||
/** Any smokeless powder like ballistite and cordite */
|
||||
@ -363,6 +369,8 @@ public class OreDictManager {
|
||||
STEEL .ingot(ingot_steel) .dustSmall(powder_steel_tiny) .dust(powder_steel) .plate(plate_steel) .block(block_steel);
|
||||
TCALLOY .ingot(ingot_tcalloy) .dust(powder_tcalloy) .block(block_tcalloy);
|
||||
CDALLOY .ingot(ingot_cdalloy) .block(block_cdalloy);
|
||||
BBRONZE .ingot(ingot_bismuth_bronze);
|
||||
ABRONZE .ingot(ingot_arsenic_bronze);
|
||||
PB .nugget(nugget_lead) .ingot(ingot_lead) .dust(powder_lead) .plate(plate_lead) .block(block_lead) .ore(ore_lead, ore_meteor_lead);
|
||||
BI .nugget(nugget_bismuth) .billet(billet_bismuth) .ingot(ingot_bismuth) .dust(powder_bismuth) .block(block_bismuth);
|
||||
AS .nugget(nugget_arsenic) .ingot(ingot_arsenic);
|
||||
@ -627,6 +635,7 @@ public class OreDictManager {
|
||||
ANY_PLASTIC.addPrefix(INGOT, true).addPrefix(DUST, true).addPrefix(BLOCK, true);
|
||||
ANY_HARDPLASTIC.addPrefix(INGOT, true);
|
||||
ANY_RESISTANTALLOY.addPrefix(INGOT, true).addPrefix(DUST, true).addPrefix(PLATECAST, true).addPrefix(PLATEWELDED, true).addPrefix(HEAVY_COMPONENT, true).addPrefix(BLOCK, true);
|
||||
ANY_BISMOIDBRONZE.addPrefix(INGOT, true).addPrefix(PLATECAST, true);
|
||||
ANY_TAR.addPrefix(ANY, false);
|
||||
}
|
||||
|
||||
|
||||
28
src/main/java/com/hbm/inventory/SlotDeprecated.java
Normal file
28
src/main/java/com/hbm/inventory/SlotDeprecated.java
Normal file
@ -0,0 +1,28 @@
|
||||
package com.hbm.inventory;
|
||||
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import net.minecraft.inventory.IInventory;
|
||||
import net.minecraft.inventory.Slot;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
/**
|
||||
* Deprecated slots can hold items from previous versions, but are otherwise entirely uninteractable
|
||||
*/
|
||||
public class SlotDeprecated extends Slot {
|
||||
|
||||
public SlotDeprecated(IInventory inventory, int id, int x, int y) {
|
||||
super(inventory, id, x, y);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isItemValid(ItemStack stack) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public boolean func_111238_b() {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@ -6,7 +6,7 @@ import com.hbm.items.ModItems;
|
||||
import com.hbm.items.machine.ItemMachineUpgrade;
|
||||
import com.hbm.tileentity.machine.TileEntityMachineCentrifuge;
|
||||
|
||||
import api.hbm.energy.IBatteryItem;
|
||||
import api.hbm.energymk2.IBatteryItem;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.entity.player.InventoryPlayer;
|
||||
import net.minecraft.inventory.Container;
|
||||
|
||||
@ -5,7 +5,7 @@ import com.hbm.items.ModItems;
|
||||
import com.hbm.items.machine.IItemFluidIdentifier;
|
||||
import com.hbm.tileentity.machine.TileEntityMachineCombustionEngine;
|
||||
|
||||
import api.hbm.energy.IBatteryItem;
|
||||
import api.hbm.energymk2.IBatteryItem;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.entity.player.InventoryPlayer;
|
||||
import net.minecraft.inventory.Container;
|
||||
|
||||
@ -3,7 +3,7 @@ package com.hbm.inventory.container;
|
||||
import com.hbm.items.machine.IItemFluidIdentifier;
|
||||
import com.hbm.tileentity.machine.TileEntityMachineCompressor;
|
||||
|
||||
import api.hbm.energy.IBatteryItem;
|
||||
import api.hbm.energymk2.IBatteryItem;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.entity.player.InventoryPlayer;
|
||||
import net.minecraft.inventory.Container;
|
||||
|
||||
@ -7,7 +7,7 @@ import com.hbm.items.machine.IItemFluidIdentifier;
|
||||
import com.hbm.items.machine.ItemMachineUpgrade;
|
||||
import com.hbm.tileentity.machine.TileEntityMachineCrystallizer;
|
||||
|
||||
import api.hbm.energy.IBatteryItem;
|
||||
import api.hbm.energymk2.IBatteryItem;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.entity.player.InventoryPlayer;
|
||||
import net.minecraft.inventory.Container;
|
||||
|
||||
@ -6,7 +6,7 @@ import com.hbm.items.ModItems;
|
||||
import com.hbm.items.machine.ItemMachineUpgrade;
|
||||
import com.hbm.tileentity.machine.TileEntityMachineElectricFurnace;
|
||||
|
||||
import api.hbm.energy.IBatteryItem;
|
||||
import api.hbm.energymk2.IBatteryItem;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.entity.player.InventoryPlayer;
|
||||
import net.minecraft.inventory.Container;
|
||||
|
||||
@ -6,7 +6,7 @@ import com.hbm.items.machine.IItemFluidIdentifier;
|
||||
import com.hbm.items.machine.ItemMachineUpgrade;
|
||||
import com.hbm.tileentity.machine.TileEntityElectrolyser;
|
||||
|
||||
import api.hbm.energy.IBatteryItem;
|
||||
import api.hbm.energymk2.IBatteryItem;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.entity.player.InventoryPlayer;
|
||||
import net.minecraft.inventory.Container;
|
||||
|
||||
@ -5,7 +5,7 @@ import com.hbm.items.ModItems;
|
||||
import com.hbm.items.machine.ItemMachineUpgrade;
|
||||
import com.hbm.tileentity.machine.TileEntityElectrolyser;
|
||||
|
||||
import api.hbm.energy.IBatteryItem;
|
||||
import api.hbm.energymk2.IBatteryItem;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.entity.player.InventoryPlayer;
|
||||
import net.minecraft.inventory.Container;
|
||||
|
||||
@ -3,7 +3,6 @@ package com.hbm.inventory.container;
|
||||
import com.hbm.items.ModItems;
|
||||
import com.hbm.tileentity.machine.TileEntityFEL;
|
||||
|
||||
import api.hbm.energy.IBatteryItem;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.entity.player.InventoryPlayer;
|
||||
import net.minecraft.inventory.Container;
|
||||
@ -49,7 +48,7 @@ public class ContainerFEL extends Container {
|
||||
}
|
||||
} else {
|
||||
|
||||
if(rStack.getItem() instanceof IBatteryItem || rStack.getItem() == ModItems.battery_creative) {
|
||||
if(rStack.getItem() instanceof api.hbm.energymk2.IBatteryItem || rStack.getItem() == ModItems.battery_creative) {
|
||||
if(!this.mergeItemStack(stack, 0, 1, false)) return null;
|
||||
} else {
|
||||
if(!this.mergeItemStack(stack, 1, 2, false)) return null;
|
||||
|
||||
@ -5,7 +5,7 @@ import com.hbm.inventory.SlotTakeOnly;
|
||||
import com.hbm.items.ModItems;
|
||||
import com.hbm.tileentity.bomb.TileEntityLaunchPadBase;
|
||||
|
||||
import api.hbm.energy.IBatteryItem;
|
||||
import api.hbm.energymk2.IBatteryItem;
|
||||
import api.hbm.item.IDesignatorItem;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.entity.player.InventoryPlayer;
|
||||
|
||||
@ -4,7 +4,7 @@ import com.hbm.inventory.SlotSmelting;
|
||||
import com.hbm.items.ModItems;
|
||||
import com.hbm.tileentity.machine.TileEntityMachineArcFurnace;
|
||||
|
||||
import api.hbm.energy.IBatteryItem;
|
||||
import api.hbm.energymk2.IBatteryItem;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.entity.player.InventoryPlayer;
|
||||
import net.minecraft.inventory.Container;
|
||||
|
||||
@ -7,7 +7,7 @@ import com.hbm.items.machine.IItemFluidIdentifier;
|
||||
import com.hbm.items.machine.ItemMachineUpgrade;
|
||||
import com.hbm.tileentity.machine.TileEntityMachineArcWelder;
|
||||
|
||||
import api.hbm.energy.IBatteryItem;
|
||||
import api.hbm.energymk2.IBatteryItem;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.entity.player.InventoryPlayer;
|
||||
import net.minecraft.inventory.Container;
|
||||
|
||||
@ -6,7 +6,7 @@ import com.hbm.items.machine.ItemAssemblyTemplate;
|
||||
import com.hbm.items.machine.ItemMachineUpgrade;
|
||||
import com.hbm.tileentity.machine.TileEntityMachineAssembler;
|
||||
|
||||
import api.hbm.energy.IBatteryItem;
|
||||
import api.hbm.energymk2.IBatteryItem;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.entity.player.InventoryPlayer;
|
||||
import net.minecraft.inventory.Container;
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user