Skip to content

Commit

Permalink
Merge branch 'master' into windows-95
Browse files Browse the repository at this point in the history
  • Loading branch information
70000hp committed Feb 27, 2025
2 parents 3a7e974 + fb414ad commit 1574f90
Show file tree
Hide file tree
Showing 101 changed files with 19,078 additions and 7,411 deletions.
43 changes: 21 additions & 22 deletions changelog
Original file line number Diff line number Diff line change
@@ -1,25 +1,24 @@
## Added
* Refueling station
* Like a charging station, but for fluids

## Changed
* Particle detectors now print an error for when the recipe could not be completed
* Night Vision Goggles toggles with armor HUD
* Removed "no ore dict data" line from tooltips with extended view enabled
* Added a client config called `GUN_ANIMATION_SPEED` which allows the speed of gun animations to be changed
* Mostly for debugging, since it only applies to the bus animation system, things like smoke trails and muzzle flashes are unaffected
* Item filters can now filter by bedrock ore grade
* Meteorite dungeons now use a new structure system
* The rooms have been completely changed, and the dungeons are no longer single-level with fixed room sizes
* Dungeons no longer lag the game to hell when generating
* Decimated bobmazon
* All books have been merged into one with way fewer offers
* Sells things like basic gear, MREs, plushies, snow globes, and certain things only found in worldgen like jungle tree saplings and NTM flowers (including mustard willow)
* Updated russian localization
* Large deposits (hematite, malachite, bauxite) and caves (sulfur, asbestos) can now be toggled in the config
* Removed recipes for most old particle accelerator parts
* Dense coils no longer have recipes either for the most part, all coils with no recipes can be recycled back into dense wires
* Natural gas can now be processed in a pyrolysis oven, 12k of gas yields 8k hydrogen and one graphite ingot
* Saturnite now has an alternate recipe, adding one pile of borax for doubled output
* All mass storage units (except wood) are now substantially cheaper
* Reduced base spread for all 12 and 10 gauge buckshot shells from 0.05 to 0.035
* Reduced legendary 12 lever action's spread multiplier from x1.35 to x1.15
* Bullet casings now spawn with randomized angular velocity
* Bullet casings now correctly bounce off walls, and change angles when bouncing

## Fixed
* Fixed items being annihilated when shift clicking them into the particle source
* Fixed packet optimization not allowing packets to be sent when the day night cycle is halted
* Fixed particle detectors not always using power when they should
* Fixed rotary furnace voiding low pressure steam when dealing with input numbers not divisible by 100
* Fixed state leak causing smoke from the right akimbo weapon to glow when the first one is fired
* Fixed incorrect default values for new RBMK dials
* Fixed an issue where `/ntmreload` would load fluids after recipes, meaning that recipes using newly added fluids would not work correctly, as the fluids don't exist by the time the recipe is loaded
* Fixed bedrock coltan being way too common, drowning out almost all other bedrock ores
* Fixed rotary furnace not saving its output stack
* Fixed strand caster water check being incorrect, creating negative water by allowing operations with insufficient cooling
* Fixed radar not using the small remaining amount of power, causing the animation getting stuck
* Fixed the new system structures being way too common
* Fixed RBMKs losing all their flux when reloading the world
* Fixed issue where DODD fuel item stats would only update when the GUI was open
* Fixed muzzle flashes not being fullbright
* Fixed guns having their name permanently visible over the toolbar
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
mod_version=1.0.27
# Empty build number makes a release type
mod_build_number=5230
mod_build_number=5243

credits=HbMinecraft,\
\ rodolphito (explosion algorithms),\
Expand Down
4 changes: 3 additions & 1 deletion src/main/java/api/hbm/energymk2/IEnergyProviderMK2.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

import com.hbm.packet.PacketDispatcher;
import com.hbm.packet.toclient.AuxParticlePacketNT;
import com.hbm.uninos.IGenProvider;
import com.hbm.uninos.networkproviders.PowerProvider;
import com.hbm.util.Compat;

import api.hbm.energymk2.Nodespace.PowerNode;
Expand All @@ -12,7 +14,7 @@
import net.minecraftforge.common.util.ForgeDirection;

/** If it sends energy, use this */
public interface IEnergyProviderMK2 extends IEnergyHandlerMK2 {
public interface IEnergyProviderMK2 extends IEnergyHandlerMK2, IGenProvider<PowerProvider> {

/** 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) {
Expand Down
29 changes: 3 additions & 26 deletions src/main/java/api/hbm/energymk2/IEnergyReceiverMK2.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
import com.hbm.interfaces.NotableComments;
import com.hbm.packet.PacketDispatcher;
import com.hbm.packet.toclient.AuxParticlePacketNT;
import com.hbm.uninos.IGenReceiver;
import com.hbm.uninos.networkproviders.PowerProvider;
import com.hbm.util.Compat;

import api.hbm.energymk2.Nodespace.PowerNode;
Expand All @@ -14,7 +16,7 @@

/** If it receives energy, use this */
@NotableComments
public interface IEnergyReceiverMK2 extends IEnergyHandlerMK2 {
public interface IEnergyReceiverMK2 extends IEnergyHandlerMK2, IGenReceiver<PowerProvider> {

public default long transferPower(long power) {
if(power + this.getPower() <= this.getMaxPower()) {
Expand Down Expand Up @@ -76,31 +78,6 @@ public default void tryUnsubscribe(World world, int x, int y, int z) {
}
}

/**
* 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,
Expand Down
173 changes: 18 additions & 155 deletions src/main/java/api/hbm/energymk2/Nodespace.java
Original file line number Diff line number Diff line change
@@ -1,161 +1,40 @@
package api.hbm.energymk2;

import java.util.HashMap;
import java.util.HashSet;
import java.util.Map.Entry;
import java.util.Set;

import com.hbm.interfaces.NotableComments;
import com.hbm.uninos.GenNode;
import com.hbm.uninos.UniNodespace;
import com.hbm.uninos.networkproviders.PowerProvider;
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
* The dead fucking corpse of nodespace MK1.
* A fantastic proof of concept, but ultimately it was killed for being just not that versatile.
* This class is mostly just a compatibility husk that should allow uninodespace to slide into the mod with as much lubrication as it deserves.
*
* @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);

if(nodes == null)
continue;

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 final PowerProvider THE_POWER_PROVIDER = new PowerProvider();

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;
@Deprecated public static PowerNode getNode(World world, int x, int y, int z) {
return (PowerNode) UniNodespace.getNode(world, x, y, z, THE_POWER_PROVIDER);
}

/** 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);
}
@Deprecated public static void createNode(World world, PowerNode node) {
UniNodespace.createNode(world, node);
}

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 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);
}
@Deprecated public static void destroyNode(World world, int x, int y, int z) {
UniNodespace.destroyNode(world, x, y, z, THE_POWER_PROVIDER);
}

@NotableComments
public static class PowerNode {
public static class PowerNode extends GenNode<PowerNetMK2> {

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.
Expand All @@ -167,32 +46,16 @@ public static class PowerNode {
* 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) {
super(THE_POWER_PROVIDER, positions);
this.positions = positions;
}

@Override
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;
super.setConnections(connections);
return this;
}

public boolean hasValidNet() {
return this.net != null && this.net.isValid();
}

public void setNet(PowerNetMK2 net) {
this.net = net;
this.recentlyChanged = true;
}
}
}
Loading

0 comments on commit 1574f90

Please sign in to comment.