From 6d6d15136cd3013bee0ad5d22d3ab6a0ca7126f5 Mon Sep 17 00:00:00 2001 From: Boblet Date: Wed, 29 Jul 2026 09:23:11 +0200 Subject: [PATCH] guh --- changelog | 7 ++++- .../recipes/AssemblyMachineRecipes.java | 2 +- .../saveddata/satellites/SatelliteBase.java | 2 +- .../satellites/SatelliteDetector.java | 2 +- .../saveddata/satellites/SatelliteMapper.java | 15 ++++++++++ .../saveddata/satellites/SatelliteRadar.java | 2 +- .../satellites/SatelliteRayScan.java | 2 +- .../satellites/XSatelliteRegistry.java | 30 ++++++++++++------- .../machine/TileEntityMachineSatDock.java | 2 +- .../assets/hbm/manual/satellite/detector.json | 11 +++++++ .../hbm/manual/satellite/rayscanner.json | 11 +++++++ .../hbm/manual/satellite/satellite.json | 2 +- .../assets/hbm/manual/satellite/spysat.json | 2 +- 13 files changed, 71 insertions(+), 19 deletions(-) create mode 100644 src/main/resources/assets/hbm/manual/satellite/detector.json create mode 100644 src/main/resources/assets/hbm/manual/satellite/rayscanner.json diff --git a/changelog b/changelog index f3b371e3a..5ae82e907 100644 --- a/changelog +++ b/changelog @@ -8,7 +8,12 @@ ## Changed * AUTOCAL's `first` and `last` instructions now support variable substitution +* Spy satellites now have the `getsmog` command, checking for soot pollution on the current target coordinate ## Fixed * Fixed pile fuel loader temperature reading not working -* Fixed mining satellite NEI handling \ No newline at end of file +* Fixed mining satellite NEI handling +* Fixed crash caused by non-miner satellite ID chips in the cargo landing pad +* Potentially fixed ID-shift affecting satellites launched pre-update +* Fixed xenium resonator item mapping being incorrect, creating a relay satellite instead +* Fixed a potential crash caused by accessing out-of-range data on the radar satellite \ No newline at end of file diff --git a/src/main/java/com/hbm/inventory/recipes/AssemblyMachineRecipes.java b/src/main/java/com/hbm/inventory/recipes/AssemblyMachineRecipes.java index f02a64217..34ff7cb6a 100644 --- a/src/main/java/com/hbm/inventory/recipes/AssemblyMachineRecipes.java +++ b/src/main/java/com/hbm/inventory/recipes/AssemblyMachineRecipes.java @@ -1028,7 +1028,7 @@ public class AssemblyMachineRecipes extends GenericRecipes { new ComparableStack(ModItems.circuit, 24, EnumCircuitType.BISMOID), new ComparableStack(ModItems.part_generic, 16, EnumPartType.LDE), new ComparableStack(ModItems.circuit, 1, EnumCircuitType.CONTROLLER_ADVANCED))); - this.register(new GenericRecipe("ass.detectorsat").setup(1_200, 25_000).outputItems(new ItemStack(ModItems.satellite, 1, EnumSatType.RAY_SCAN.ordinal())) + this.register(new GenericRecipe("ass.rayscansat").setup(1_200, 25_000).outputItems(new ItemStack(ModItems.satellite, 1, EnumSatType.RAY_SCAN.ordinal())) .inputItems(new OreDictStack(BIGMT.shell(), 16), new ComparableStack(ModItems.photo_panel, 32), new OreDictStack(SBD.wireDense(), 16), diff --git a/src/main/java/com/hbm/saveddata/satellites/SatelliteBase.java b/src/main/java/com/hbm/saveddata/satellites/SatelliteBase.java index aa23a163d..8dc201a85 100644 --- a/src/main/java/com/hbm/saveddata/satellites/SatelliteBase.java +++ b/src/main/java/com/hbm/saveddata/satellites/SatelliteBase.java @@ -24,7 +24,7 @@ public abstract class SatelliteBase { public String tx = ""; public int getID() { - return XSatelliteRegistry.satellites.indexOf(this.getClass()); + return XSatelliteRegistry.idToClass.inverse().get(this.getClass()); } public abstract String getType(); diff --git a/src/main/java/com/hbm/saveddata/satellites/SatelliteDetector.java b/src/main/java/com/hbm/saveddata/satellites/SatelliteDetector.java index a8716a19c..f2e08578a 100644 --- a/src/main/java/com/hbm/saveddata/satellites/SatelliteDetector.java +++ b/src/main/java/com/hbm/saveddata/satellites/SatelliteDetector.java @@ -53,7 +53,7 @@ public class SatelliteDetector extends SatelliteBase { public RadiationBurst getBurstFromIndex(String cmd) { if(cachedResults.size() <= 0) return null; - int index = IRORInteractive.parseInt(cmd, 0, cachedResults.size()) - 1; + int index = IRORInteractive.parseInt(cmd, 1, cachedResults.size()) - 1; return cachedResults.get(index); } diff --git a/src/main/java/com/hbm/saveddata/satellites/SatelliteMapper.java b/src/main/java/com/hbm/saveddata/satellites/SatelliteMapper.java index 9626df120..1e8dfff1b 100644 --- a/src/main/java/com/hbm/saveddata/satellites/SatelliteMapper.java +++ b/src/main/java/com/hbm/saveddata/satellites/SatelliteMapper.java @@ -4,12 +4,17 @@ import java.util.ArrayList; import java.util.List; import java.util.Locale; +import com.hbm.handler.pollution.PollutionHandler; +import com.hbm.handler.pollution.PollutionHandler.PollutionData; +import com.hbm.handler.pollution.PollutionHandler.PollutionType; + import net.minecraft.entity.player.EntityPlayer; import net.minecraft.world.World; public class SatelliteMapper extends SatelliteBase { public static final String CMD_TARGET_LOADED = "targetloaded"; + public static final String CMD_GETSMOG = "getsmog"; public static final String CMD_SPOT_PLAYER = "spotplayers"; public static final int SPOT_PLAYER_MAX_RANGE = 250; @@ -28,6 +33,16 @@ public class SatelliteMapper extends SatelliteBase { return; } + if(cmd[0].equals(CMD_GETSMOG)) { + + PollutionData data = PollutionHandler.getPollutionData(world, this.targetX, 255, this.targetZ); + if(data != null) { + float soot = data.pollution[PollutionType.SOOT.ordinal()]; + this.tx = "" + (int) Math.ceil(soot); + } + return; + } + if(cmd[0].equals(CMD_SPOT_PLAYER)) { List names = new ArrayList(); diff --git a/src/main/java/com/hbm/saveddata/satellites/SatelliteRadar.java b/src/main/java/com/hbm/saveddata/satellites/SatelliteRadar.java index 454d2980d..aeee767aa 100644 --- a/src/main/java/com/hbm/saveddata/satellites/SatelliteRadar.java +++ b/src/main/java/com/hbm/saveddata/satellites/SatelliteRadar.java @@ -103,7 +103,7 @@ public class SatelliteRadar extends SatelliteBase { public Entity getTargetFromIndex(String cmd) { if(filteredRadarResults.size() <= 0) return null; - int index = IRORInteractive.parseInt(cmd, 0, filteredRadarResults.size()) - 1; + int index = IRORInteractive.parseInt(cmd, 1, filteredRadarResults.size()) - 1; Entity target = filteredRadarResults.get(index); if(target.isDead) return null; return target; diff --git a/src/main/java/com/hbm/saveddata/satellites/SatelliteRayScan.java b/src/main/java/com/hbm/saveddata/satellites/SatelliteRayScan.java index 1190b767e..26e9c6f42 100644 --- a/src/main/java/com/hbm/saveddata/satellites/SatelliteRayScan.java +++ b/src/main/java/com/hbm/saveddata/satellites/SatelliteRayScan.java @@ -68,7 +68,7 @@ public class SatelliteRayScan extends SatelliteBase { public RayEvent getEventFromIndex(String cmd) { if(cachedResults.size() <= 0) return null; - int index = IRORInteractive.parseInt(cmd, 0, cachedResults.size()) - 1; + int index = IRORInteractive.parseInt(cmd, 1, cachedResults.size()) - 1; return cachedResults.get(index); } diff --git a/src/main/java/com/hbm/saveddata/satellites/XSatelliteRegistry.java b/src/main/java/com/hbm/saveddata/satellites/XSatelliteRegistry.java index d682dd0c2..b06e9f043 100644 --- a/src/main/java/com/hbm/saveddata/satellites/XSatelliteRegistry.java +++ b/src/main/java/com/hbm/saveddata/satellites/XSatelliteRegistry.java @@ -1,5 +1,6 @@ package com.hbm.saveddata.satellites; +import com.google.common.collect.HashBiMap; import com.hbm.inventory.RecipesCommon.ComparableStack; import com.hbm.items.ModItems; import com.hbm.items.special.ItemSatellite.EnumSatType; @@ -8,23 +9,36 @@ import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.world.World; -import java.util.ArrayList; import java.util.HashMap; -import java.util.List; public class XSatelliteRegistry { - public static final List> satellites = new ArrayList<>(); + public static final HashBiMap> idToClass = HashBiMap.create(20); public static final HashMap> itemToClass = new HashMap<>(); public static void register() { + // ID mapping + idToClass.put(0, SatelliteMapper.class); + idToClass.put(1, SatelliteScanner.class); + idToClass.put(2, SatelliteRadar.class); + idToClass.put(3, SatelliteDeathRay.class); + idToClass.put(4, SatelliteResonator.class); + idToClass.put(5, SatelliteRelay.class); + idToClass.put(6, SatelliteMiner.class); + idToClass.put(7, SatelliteLunarMiner.class); + idToClass.put(8, SatelliteHorizons.class); + idToClass.put(9, SatellitePrecisionLaser.class); + idToClass.put(10, SatelliteDetector.class); + idToClass.put(11, SatelliteRayScan.class); + + // item to sat type mapping registerSatellite(SatelliteMapper.class, new ComparableStack(ModItems.satellite, 1, EnumSatType.SPY)); registerSatellite(SatelliteScanner.class, new ComparableStack(ModItems.satellite, 1, EnumSatType.SCANNER)); registerSatellite(SatelliteRadar.class, new ComparableStack(ModItems.satellite, 1, EnumSatType.RADAR)); registerSatellite(SatelliteDeathRay.class, new ComparableStack(ModItems.satellite, 1, EnumSatType.DEATH_RAY)); registerSatellite(SatelliteResonator.class, new ComparableStack(ModItems.satellite, 1, EnumSatType.XENIUM_RESONATOR)); - registerSatellite(SatelliteRelay.class, new ComparableStack(ModItems.satellite, 1, EnumSatType.XENIUM_RESONATOR)); + registerSatellite(SatelliteRelay.class, new ComparableStack(ModItems.satellite, 1, EnumSatType.RELAY)); registerSatellite(SatelliteMiner.class, new ComparableStack(ModItems.satellite, 1, EnumSatType.MINER_ASTRO)); registerSatellite(SatelliteLunarMiner.class, new ComparableStack(ModItems.satellite, 1, EnumSatType.MINER_LUNAR)); registerSatellite(SatelliteHorizons.class, ModItems.sat_gerald); @@ -32,13 +46,12 @@ public class XSatelliteRegistry { registerSatellite(SatelliteDetector.class, new ComparableStack(ModItems.satellite, 1, EnumSatType.DETECTOR)); registerSatellite(SatelliteRayScan.class, new ComparableStack(ModItems.satellite, 1, EnumSatType.RAY_SCAN)); - + // and all the legacy crap registerSatellite(SatelliteMapper.class, ModItems.sat_mapper); registerSatellite(SatelliteScanner.class, ModItems.sat_scanner); registerSatellite(SatelliteRadar.class, ModItems.sat_radar); registerSatellite(SatelliteDeathRay.class, ModItems.sat_laser); registerSatellite(SatelliteResonator.class, ModItems.sat_resonator); - registerSatellite(SatelliteRelay.class, ModItems.sat_foeq); registerSatellite(SatelliteMiner.class, ModItems.sat_miner); registerSatellite(SatelliteLunarMiner.class, ModItems.sat_lunar_miner); } @@ -51,14 +64,12 @@ public class XSatelliteRegistry { @Deprecated public static void registerSatellite(Class sat, Item item) { if(!itemToClass.containsKey(item) && !itemToClass.containsValue(sat)) { - satellites.add(sat); itemToClass.put(new ComparableStack(item), sat); } } public static void registerSatellite(Class sat, ComparableStack item) { if(!itemToClass.containsKey(item) && !itemToClass.containsValue(sat)) { - satellites.add(sat); itemToClass.put(item, sat); } } @@ -67,7 +78,6 @@ public class XSatelliteRegistry { if(world.isRemote) return; SatelliteSavedData data = SatelliteSavedData.getData(world); - SatelliteBase existing = data.sats.get(freq); if(existing != null) { @@ -87,7 +97,7 @@ public class XSatelliteRegistry { public static SatelliteBase createFromId(int i) { try { - return satellites.get(i).newInstance(); + return idToClass.get(i).newInstance(); } catch(Exception e) { } return null; } diff --git a/src/main/java/com/hbm/tileentity/machine/TileEntityMachineSatDock.java b/src/main/java/com/hbm/tileentity/machine/TileEntityMachineSatDock.java index b8b5de866..da8cbe28a 100644 --- a/src/main/java/com/hbm/tileentity/machine/TileEntityMachineSatDock.java +++ b/src/main/java/com/hbm/tileentity/machine/TileEntityMachineSatDock.java @@ -182,7 +182,7 @@ public class TileEntityMachineSatDock extends TileEntity implements ISidedInvent if(rocket.getDataWatcher().getWatchableObjectInt(16) == 1 && rocket.timer == 50) { SatelliteBase sat = data.getSatFromFreq(ISatChip.getFreqS(slots[15])); - if(sat != null) unloadCargo((SatelliteMiner) sat); + if(sat instanceof SatelliteMiner) unloadCargo((SatelliteMiner) sat); } } diff --git a/src/main/resources/assets/hbm/manual/satellite/detector.json b/src/main/resources/assets/hbm/manual/satellite/detector.json new file mode 100644 index 000000000..6f632c35e --- /dev/null +++ b/src/main/resources/assets/hbm/manual/satellite/detector.json @@ -0,0 +1,11 @@ +{ + "name": "Wideband Radio Emission Detector Satellite", + "icon": ["hbm:item.satellite", 1, 9], + "trigger": [["hbm:item.satellite", 1, 9]], + "title": { + "en_US": "Wideband Radio Emission Detector Satellite" + }, + "content": { + "en_US": "The wideband radio emission detector is a type of [[satellite|Satellite]] that can detect certain types of high-energy events from the entire map, albeit with low accuracy. The detector can only give a very rough idea of where such an event is taking place, for more accurate results, the area needs to be scanned wither with a [[spy satellite|Spy Satellite]] or [[narrowband scanner|Narrowband Emission Scanning Satellite]].

The types of events this satellite can pick up are as follows:
* Mini nuke explosions (low intensity, accuracy <10,000m)
* Radar (medium intensity, accuracy <2,500m)
* Particle accelerator operations (medium intensity, accuracy <2,500m)
Nuclear explosions (high intensity, accuracy <500m)

Events are timed, medium intense ones are the shortest lived as they only show up for half a second, while other events can show up for multiple seconds or even up to a minute. It is therefore important to scan any given area multiple times in rapid succession to get an accurate result.

* '§esurvey§r' will report any recent events that have not timed out yet. The detector's field of view covers the entire map, so there is no range limitations. All detected results are saved to an internal list.
* '§ecount§r' will write the amount of detected events to RX.
* '§egettype §eindex§r' will write the type (LOW/MEDIUM/HIGH) of the specified event to RX.
* '§egetposition §eindex§r' will write the estimated X/Z position of the specified event to RX. The coordinated are separated by semicolon.

See also:
* [[Satellite]]
* [[Satellite Ground Station]]" + } +} diff --git a/src/main/resources/assets/hbm/manual/satellite/rayscanner.json b/src/main/resources/assets/hbm/manual/satellite/rayscanner.json new file mode 100644 index 000000000..2e2b9face --- /dev/null +++ b/src/main/resources/assets/hbm/manual/satellite/rayscanner.json @@ -0,0 +1,11 @@ +{ + "name": "Narrowband Emission Scanning Satellite", + "icon": ["hbm:item.satellite", 1, 10], + "trigger": [["hbm:item.satellite", 1, 10]], + "title": { + "en_US": "Narrowband Emission Scanning Satellite" + }, + "content": { + "en_US": "The narrowband scanner can detect certain high-energy events with high precision in a small area. While the [[wideband detector|Wideband Radio Emission Detector Satellite]] can only give a rough estimation of where a small number of things are happening, the narrowband scanner can detect more types of emission and pinpint their location.

Types of emissions that can be detected include:
* '§6NEUTRON_EMISSION§r' from nuclear reactors
* '§6HIGH_ENERGY_PARTICLES§r' from fusion reacotrs and particle accelerators
* '§6RADAR_WAVES§r' from terrestrial radar
* '§6RADIO_WAVES§r' from satellite ground stations with active TX

Like with the wideband detector, these emissions are timed, certain events only happen once or in a time interval, so for best results, repeated scans over a timespan are recommended.

* '§esurvey§r' will perform a scan with a radius of 250m around the target location. The results are saved in an internal list.
* '§ecount§r' will write the amount of scan results to RX.
* '§egetinfo §eindex§r' will write the specified entry's emission type to RX.
* '§egetposition §eindex§r' will write the X/Z position of the specified event to RX. The coordinated are separated by semicolon.

See also:
* [[Satellite]]
* [[Satellite Ground Station]]" + } +} diff --git a/src/main/resources/assets/hbm/manual/satellite/satellite.json b/src/main/resources/assets/hbm/manual/satellite/satellite.json index 4aa613831..d52d9f81e 100644 --- a/src/main/resources/assets/hbm/manual/satellite/satellite.json +++ b/src/main/resources/assets/hbm/manual/satellite/satellite.json @@ -6,6 +6,6 @@ "en_US": "Satellite" }, "content": { - "en_US": "Satellites can be launched into earth orbit using a [[Soyuz]] rocket. Satellites communicate with items and blocks on earth using frequencies, so in order to actually use one, it's necessary to set a random frequency in the satellite ID manager, and then copying that ID to another item, for example a satellite chip.

Some satellites can perform minor tasks when linked with certain items, like the [[depth scanning satellite|Depth Scanning Satellite]] enabling the neutrino lens, or the [[xenium resonator satellite|Xenium Resonator Satellite]] connected to a satellite laser designator allowing for short range line of sight teleportation. Satellites however are the most powerful when paired with [[Redstone over Radio]] by linking them to a [[ground station|Satellite Ground Station]].

By using a [[RoR reader|Redstone-over-Radio Reader]], ground stations can receive the RX value, which is received from the connected satellite. Each satellite can only provide one RX value at a time, and the value persists until it changes. The contents of RX depend on what function the satellite has performed prior.

By using a ground station's TX command, commands can be relayed to the connected satellite. Most commands vary between satellite types, however all satellites have a ground target, i.e. the spot on the surface they are aiming at.

The common target commands are as follows:
* '§esettarget §ex §ez§r' (Example RoR: '§6tx!settarget §6200 §6300§r')
* '§egettarget§r' (Example RoR: '§6tx!gettarget§r'), writes the current target X and Z separated by semicolon to the ground station's RX
* '§egettargetx§r'
* '§egettargetz§r'

See also:
* [[Spy Satellite]]
* [[Depth Scanning Satellite]]
* [[Radar Satellite]]
* [[Asteroid Mining Ship]]
* [[Lunar Mining Ship]]
* [[Orbital Precision Laser]]
* [[Orbital Death Ray]]
* [[Xenium Resonator Satellite]]
* [[Relay Satellite]]" + "en_US": "Satellites can be launched into earth orbit using a [[Soyuz]] rocket. Satellites communicate with items and blocks on earth using frequencies, so in order to actually use one, it's necessary to set a random frequency in the satellite ID manager, and then copying that ID to another item, for example a satellite chip.

Some satellites can perform minor tasks when linked with certain items, like the [[depth scanning satellite|Depth Scanning Satellite]] enabling the neutrino lens, or the [[xenium resonator satellite|Xenium Resonator Satellite]] connected to a satellite laser designator allowing for short range line of sight teleportation. Satellites however are the most powerful when paired with [[Redstone over Radio]] by linking them to a [[ground station|Satellite Ground Station]].

By using a [[RoR reader|Redstone-over-Radio Reader]], ground stations can receive the RX value, which is received from the connected satellite. Each satellite can only provide one RX value at a time, and the value persists until it changes. The contents of RX depend on what function the satellite has performed prior.

By using a ground station's TX command, commands can be relayed to the connected satellite. Most commands vary between satellite types, however all satellites have a ground target, i.e. the spot on the surface they are aiming at.

The common target commands are as follows:
* '§esettarget §ex §ez§r' (Example RoR: '§6tx!settarget §6200 §6300§r')
* '§egettarget§r' (Example RoR: '§6tx!gettarget§r'), writes the current target X and Z separated by semicolon to the ground station's RX
* '§egettargetx§r'
* '§egettargetz§r'

See also:
* [[Spy Satellite]]
* [[Depth Scanning Satellite]]
* [[Radar Satellite]]
* [[Asteroid Mining Ship]]
* [[Lunar Mining Ship]]
* [[Orbital Precision Laser]]
* [[Orbital Death Ray]]
* [[Xenium Resonator Satellite]]
* [[Relay Satellite]]
* [[Wideband Radio Emission Detector Satellite]]" } } diff --git a/src/main/resources/assets/hbm/manual/satellite/spysat.json b/src/main/resources/assets/hbm/manual/satellite/spysat.json index c886755bc..10284f232 100644 --- a/src/main/resources/assets/hbm/manual/satellite/spysat.json +++ b/src/main/resources/assets/hbm/manual/satellite/spysat.json @@ -6,6 +6,6 @@ "en_US": "Spy Satellite" }, "content": { - "en_US": "The spy satellite allows remote viewing of earth's surface. Due to RoR pixel displays not existing as of now, surface mapping functionality does not yet work. However, they can be used in detecting loaded chunks and spotting players in a small radius.

* '§etargetloaded§r' writes 'TRUE' or 'FALSE' to RX depending on if the chunk that the satellite is pointed at is loaded or not.
* '§espotplayers§r' detects surface players in a 250 block radius and writes all names separated by semicolon to RX.

See also:
* [[Satellite]]
* [[Satellite Ground Station]]" + "en_US": "The spy satellite allows remote viewing of earth's surface. Due to RoR pixel displays not existing as of now, surface mapping functionality does not yet work. However, they can be used in detecting loaded chunks and spotting players in a small radius.

* '§etargetloaded§r' writes 'TRUE' or 'FALSE' to RX depending on if the chunk that the satellite is pointed at is loaded or not.
* '$egetsmog$r' writes the numeric value (rounded up) of the current target position's soot pollution to RX.
* '§espotplayers§r' detects surface players in a 250 block radius and writes all names separated by semicolon to RX.

See also:
* [[Satellite]]
* [[Satellite Ground Station]]" } }