Compare commits

...

5 Commits

Author SHA1 Message Date
HbmMods
5eb2ac0ac6
Merge pull request #3062 from THOMASS47/master
Fix crash when cycling tool ability while looking fully up or down in a ladder
2026-07-27 15:48:11 +02:00
Boblet
a22faa0465 no sin evades his gaze 2026-07-27 14:58:54 +02:00
HbmMods
a34ca12047
Merge pull request #3064 from scratchcoder27/master
Added Variable Substitution support to `first` and `last` stmts in AUTOCAL
2026-07-27 13:02:47 +02:00
ScratchCoder027
3a8a3568bd first and last var. subs. support 2026-07-27 16:07:20 +05:30
THOMASS47
19851f636c Fix crash when cycling tool ability while looking fully up or down in a ladder 2026-07-27 08:34:01 +01:00
19 changed files with 195 additions and 22 deletions

View File

@ -11,8 +11,11 @@ import com.hbm.interfaces.IBomb;
import com.hbm.items.ModItems;
import com.hbm.items.weapon.sedna.factory.XFactoryCatapult;
import com.hbm.main.MainRegistry;
import com.hbm.main.NTMSounds;
import com.hbm.packet.PacketDispatcher;
import com.hbm.packet.toclient.AuxParticlePacketNT;
import com.hbm.saveddata.satellites.SatelliteDetector;
import com.hbm.saveddata.satellites.SatelliteDetector.BurstIntensity;
import com.hbm.tileentity.bomb.TileEntityLandmine;
import cpw.mods.fml.common.network.NetworkRegistry.TargetPoint;
@ -205,7 +208,8 @@ public class Landmine extends BlockContainer implements IBomb {
data.setBoolean("balefire", MainRegistry.polaroidID == 11 || world.rand.nextInt(100) == 0);
PacketDispatcher.wrapper.sendToAllAround(new AuxParticlePacketNT(data, x + 0.5, y + 0.5, z + 0.5), new TargetPoint(world.provider.dimensionId, x + 0.5, y + 0.5, z + 0.5, 250));
world.playSoundEffect(x + 0.5, y + 0.5, z + 0.5, "hbm:weapon.mukeExplosion", 25.0F, 0.9F); // this has to be the single worst solution ever
SatelliteDetector.reportEvent(world, SatelliteDetector.DURATION_LOW, BurstIntensity.LOW, x + 0.5, z + 0.5);
world.playSoundEffect(x + 0.5, y + 0.5, z + 0.5, NTMSounds.GUN_MINI_NUKE_EXPLOSION, 25.0F, 0.9F); // this has to be the single worst solution ever
}
}

View File

@ -18,6 +18,8 @@ import com.hbm.explosion.ExplosionSolinium;
import com.hbm.interfaces.Spaghetti;
import com.hbm.main.MainRegistry;
import com.hbm.packet.toclient.AuxParticlePacketNT;
import com.hbm.saveddata.satellites.SatelliteDetector;
import com.hbm.saveddata.satellites.SatelliteDetector.BurstIntensity;
import cpw.mods.fml.common.network.NetworkRegistry.TargetPoint;
import net.minecraft.entity.player.EntityPlayer;
@ -141,6 +143,7 @@ public class EntityNukeExplosionMK3 extends EntityExplosionChunkloading {
sol = new ExplosionSolinium((int) this.posX, (int) this.posY, (int) this.posZ, this.worldObj, this.destructionRange, this.coefficient, this.coefficient2);
}
SatelliteDetector.reportEvent(worldObj, SatelliteDetector.DURATION_HIGH, BurstIntensity.HIGH, posX, posZ);
this.did = true;
}

View File

@ -11,6 +11,8 @@ import com.hbm.entity.effect.EntityFalloutRain;
import com.hbm.explosion.ExplosionNukeGeneric;
import com.hbm.explosion.ExplosionNukeRayBatched;
import com.hbm.main.MainRegistry;
import com.hbm.saveddata.satellites.SatelliteDetector;
import com.hbm.saveddata.satellites.SatelliteDetector.BurstIntensity;
import com.hbm.util.ContaminationUtil;
import com.hbm.util.ContaminationUtil.ContaminationType;
import com.hbm.util.ContaminationUtil.HazardType;
@ -74,6 +76,8 @@ public class EntityNukeExplosionMK5 extends EntityExplosionChunkloading {
//} else {
explosion = new ExplosionNukeRayBatched(worldObj, (int) posX, (int) posY, (int) posZ, strength, speed, length);
//}
SatelliteDetector.reportEvent(worldObj, SatelliteDetector.DURATION_HIGH, BurstIntensity.HIGH, posX, posZ);
}
if(!explosion.isComplete()) {

View File

@ -24,7 +24,8 @@ public class ItemSatellite extends ItemEnumMulti implements ISatChip {
PRECISION_LASER,
DEATH_RAY,
XENIUM_RESONATOR,
RELAY
RELAY,
DETECTOR,
}
@Override

View File

@ -569,7 +569,7 @@ public class ItemToolAbility extends ItemTool implements IDepthRockTool, IGUIPro
EntityPlayerMP playerMP = (EntityPlayerMP) player;
MovingObjectPosition mop = EntityDamageUtil.getMouseOver(playerMP, playerMP.theItemInWorldManager.getBlockReachDistance());
if(mop.typeOfHit == mop.typeOfHit.BLOCK) {
if(mop != null && mop.typeOfHit == mop.typeOfHit.BLOCK) {
// this is horrifying and won't always produce the correct results, but it beats not having anything
// simply put, we check if we are aiming at a block, and if we do, we compare that block's onBlockActivated
// method to the one from Block.class. If the declaring class doesn't match, it's overridden, and we

View File

@ -33,6 +33,8 @@ import com.hbm.items.weapon.sedna.factory.XFactoryCatapult;
import com.hbm.main.MainRegistry;
import com.hbm.main.NTMSounds;
import com.hbm.packet.toclient.AuxParticlePacketNT;
import com.hbm.saveddata.satellites.SatelliteDetector;
import com.hbm.saveddata.satellites.SatelliteDetector.BurstIntensity;
import com.hbm.util.DamageResistanceHandler.DamageClass;
import cpw.mods.fml.common.network.NetworkRegistry.TargetPoint;
@ -245,6 +247,7 @@ public class ItemGrenadeFilling extends ItemEnumMulti {
}
public static void spawnMush(EntityGrenadeUniversal grenade) {
SatelliteDetector.reportEvent(grenade.worldObj, SatelliteDetector.DURATION_LOW, BurstIntensity.LOW, grenade.posX, grenade.posZ);
grenade.worldObj.playSoundEffect(grenade.posX, grenade.posY, grenade.posZ, NTMSounds.GUN_MINI_NUKE_EXPLOSION, 15.0F, 1.0F);
NBTTagCompound data = new NBTTagCompound();
data.setString("type", "muke");

View File

@ -33,6 +33,8 @@ import com.hbm.render.anim.AnimationEnums.GunAnimation;
import com.hbm.render.anim.BusAnimation;
import com.hbm.render.anim.BusAnimationSequence;
import com.hbm.render.anim.BusAnimationKeyframe.IType;
import com.hbm.saveddata.satellites.SatelliteDetector;
import com.hbm.saveddata.satellites.SatelliteDetector.BurstIntensity;
import cpw.mods.fml.common.network.NetworkRegistry.TargetPoint;
import net.minecraft.item.ItemStack;
@ -103,6 +105,7 @@ public class XFactoryCatapult {
incrementRad(bullet.worldObj, mop.hitVec.xCoord, mop.hitVec.yCoord, mop.hitVec.zCoord, 1.5F);
SatelliteDetector.reportEvent(bullet.worldObj, SatelliteDetector.DURATION_LOW, BurstIntensity.LOW, bullet.posX, bullet.posZ);
bullet.worldObj.playSoundEffect(mop.hitVec.xCoord, mop.hitVec.yCoord + 0.5, mop.hitVec.zCoord, NTMSounds.GUN_MINI_NUKE_EXPLOSION, 15.0F, 1.0F);
NBTTagCompound data = new NBTTagCompound();
data.setString("type", "muke");
@ -120,6 +123,7 @@ public class XFactoryCatapult {
}
public static void spawnMush(EntityBulletBaseMK4 bullet, MovingObjectPosition mop) {
SatelliteDetector.reportEvent(bullet.worldObj, SatelliteDetector.DURATION_LOW, BurstIntensity.LOW, bullet.posX, bullet.posZ);
bullet.worldObj.playSoundEffect(mop.hitVec.xCoord, mop.hitVec.yCoord + 0.5, mop.hitVec.zCoord, NTMSounds.GUN_MINI_NUKE_EXPLOSION, 15.0F, 1.0F);
NBTTagCompound data = new NBTTagCompound();
data.setString("type", "muke");
@ -138,6 +142,7 @@ public class XFactoryCatapult {
vnt.explode();
incrementRad(bullet.worldObj, mop.hitVec.xCoord, mop.hitVec.yCoord, mop.hitVec.zCoord, 0.25F);
SatelliteDetector.reportEvent(bullet.worldObj, SatelliteDetector.DURATION_LOW, BurstIntensity.LOW, bullet.posX, bullet.posZ);
bullet.worldObj.playSoundEffect(mop.hitVec.xCoord, mop.hitVec.yCoord + 0.5, mop.hitVec.zCoord, NTMSounds.GUN_MINI_NUKE_EXPLOSION, 15.0F, 1.0F);
NBTTagCompound data = new NBTTagCompound();
data.setString("type", "tinytot");

View File

@ -48,6 +48,7 @@ import com.hbm.packet.toclient.PlayerInformPacket;
import com.hbm.packet.toclient.SerializableRecipePacket;
import com.hbm.particle.helper.BlackPowderCreator;
import com.hbm.potion.HbmPotion;
import com.hbm.saveddata.satellites.SatelliteDetector;
import com.hbm.tileentity.machine.TileEntityMachineRadarNT;
import com.hbm.tileentity.machine.rbmk.RBMKDials;
import com.hbm.tileentity.network.RTTYSystem;
@ -633,6 +634,8 @@ public class ModEventHandler {
if(event.phase == Phase.START) {
BossSpawnHandler.rollTheDice(world);
TimedGenerator.automaton(world, 100);
SatelliteDetector.updateSystem(world);
}
}

View File

@ -93,7 +93,7 @@ public class ParseMSES1Ext1 extends ParseMSES1 {
if(lower.startsWith("first ")) {
if(line.length() <= 6) return EnumStatementReturn.PARAMETER_ERROR;
try {
int length = Integer.parseInt(line.substring(6));
int length = Integer.parseInt(substitute(ctx, line.substring(6), true));
int max = ctx.readBuffer().length();
if(length > max) length = max;
ctx.writeBuffer(ctx.readBuffer().substring(0, length));
@ -105,7 +105,7 @@ public class ParseMSES1Ext1 extends ParseMSES1 {
if(lower.startsWith("last ")) {
if(line.length() <= 5) return EnumStatementReturn.PARAMETER_ERROR;
try {
int length = Integer.parseInt(line.substring(5));
int length = Integer.parseInt(substitute(ctx, line.substring(5), true));
int max = ctx.readBuffer().length();
if(length > max) length = max;
ctx.writeBuffer(ctx.readBuffer().substring(max - length, max));

View File

@ -4,6 +4,7 @@ import com.hbm.tileentity.network.RTTYSystem;
import api.hbm.redstoneoverradio.IRORInteractive;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.world.World;
@ -40,12 +41,16 @@ public abstract class SatelliteBase {
this.tx = nbt.getString("tx");
}
/** When a satellite is created, i.e. this frequency is occupied for the first time */
public void onOrbit(World world, double x, double y, double z) {
setTarget((int) Math.floor(x), (int) Math.floor(z));
RTTYSystem.broadcast(world, CHAN_SATLINK, "Established connection to " + getType() + " at " + targetX + " / " + targetZ);
}
/** For subsequent items sent under the same frequency as an existing satellite */
public void onPartDelivered(World world, ItemStack part) { }
public void onCommand(World world, String... cmd) {
onCommandTarget(world, cmd);
onCommandImpl(world, cmd);

View File

@ -0,0 +1,114 @@
package com.hbm.saveddata.satellites;
import java.util.ArrayList;
import java.util.List;
import api.hbm.redstoneoverradio.IRORInteractive;
import net.minecraft.world.World;
public class SatelliteDetector extends SatelliteBase {
public List<RadiationBurst> cachedResults = new ArrayList();
public static final String CMD_SURVEY = "survey";
public static final String CMD_COUNT = "count";
public static final String CMD_GETTYPE = "gettype";
public static final String CMD_GETPOSITION = "getposition";
public SatelliteDetector() { }
@Override
public String getType() {
return "RAY_DETECTOR";
}
@Override
public void onCommandImpl(World world, String... cmd) {
if(cmd.length <= 0) return;
if(cmd[0].equals(CMD_SURVEY)) {
cachedResults.clear();
for(RadiationBurst burst : bursts) {
if(world.provider.dimensionId == burst.dimension) cachedResults.add(burst);
}
}
if(cmd[0].equals(CMD_COUNT)) {
this.tx = "" + cachedResults.size();
return;
}
if(cmd[0].equals(CMD_GETTYPE) && cmd.length == 2) {
RadiationBurst burst = getBurstFromIndex(cmd[1]);
if(burst == null) { this.tx = ""; return; }
this.tx = "" + burst.intensity.name();
return;
}
if(cmd[0].equals(CMD_GETPOSITION) && cmd.length == 2) {
RadiationBurst burst = getBurstFromIndex(cmd[1]);
if(burst == null) { this.tx = ""; return; }
this.tx = burst.x + ";" + burst.z;
return;
}
}
public RadiationBurst getBurstFromIndex(String cmd) {
if(cachedResults.size() <= 0) return null;
int index = IRORInteractive.parseInt(cmd, 0, cachedResults.size()) - 1;
return cachedResults.get(index);
}
public static List<RadiationBurst> bursts = new ArrayList();
public static final int DURATION_LOW = 15 * 20;
public static final int DURATION_MEDIUM = 20 / 2;
public static final int DURATION_HIGH = 60 * 20;
public static final double INACCURACY_LOW = 10_000;
public static final double INACCURACY_MEDIUM = 2_500;
public static final double INARRCURACY_HIGH = 500;
public static void reportEvent(World world, int lifetime, BurstIntensity intensity, double x, double z) {
bursts.add(new RadiationBurst(world, lifetime, intensity, (int) Math.floor(x), (int) Math.floor(z)));
}
public static void updateSystem(World world) {
bursts.removeIf(b -> {
return world.provider.dimensionId == b.dimension && world.getTotalWorldTime() > b.expiresOn;
});
}
public static class RadiationBurst {
public int dimension;
public long expiresOn;
public BurstIntensity intensity;
public int x;
public int z;
public RadiationBurst(World world, int lifetime, BurstIntensity intensity, int x, int z) {
this.dimension = world.provider.dimensionId;
this.expiresOn = world.getTotalWorldTime() + lifetime;
this.intensity = intensity;
this.x = x;
this.z = z;
double inaccuracy =
intensity == BurstIntensity.LOW ? INACCURACY_LOW :
intensity == BurstIntensity.MEDIUM ? INACCURACY_MEDIUM :
INARRCURACY_HIGH;
this.x += world.rand.nextGaussian() * inaccuracy;
this.z += world.rand.nextGaussian() * inaccuracy;
}
}
public static enum BurstIntensity {
LOW, // mini nukes, detectable for 15 seconds
MEDIUM, // particle accelerators and radar, detectable only briefly for half a second
HIGH; // full sized nukes, show up for a full minute
}
}

View File

@ -4,6 +4,8 @@ import com.hbm.itempool.ItemPoolsSatellite;
public class SatelliteLunarMiner extends SatelliteMiner {
@Override public String getType() { return "LUNAR_MINER"; }
static {
SatelliteMiner.registerCargo(SatelliteLunarMiner.class, ItemPoolsSatellite.POOL_SAT_LUNAR);
}

View File

@ -29,6 +29,7 @@ public class XSatelliteRegistry {
registerSatellite(SatelliteLunarMiner.class, new ComparableStack(ModItems.satellite, 1, EnumSatType.MINER_LUNAR));
registerSatellite(SatelliteHorizons.class, ModItems.sat_gerald);
registerSatellite(SatellitePrecisionLaser.class, new ComparableStack(ModItems.satellite, 1, EnumSatType.PRECISION_LASER));
registerSatellite(SatelliteDetector.class, new ComparableStack(ModItems.satellite, 1, EnumSatType.DETECTOR));
registerSatellite(SatelliteMapper.class, ModItems.sat_mapper);
@ -64,15 +65,24 @@ public class XSatelliteRegistry {
public static void orbit(World world, ItemStack stack, int freq, double x, double y, double z) {
if(world.isRemote) return;
SatelliteSavedData data = SatelliteSavedData.getData(world);
SatelliteBase existing = data.sats.get(freq);
if(existing != null) {
existing.onPartDelivered(world, stack);
} else {
SatelliteBase sat = createFromItem(stack);
if(sat != null) {
SatelliteSavedData data = SatelliteSavedData.getData(world);
data.sats.put(freq, sat);
sat.onOrbit(world, x, y, z);
data.markDirty();
}
}
}
public static SatelliteBase createFromId(int i) {
try {

View File

@ -20,6 +20,8 @@ import com.hbm.lib.Library;
import com.hbm.main.MainRegistry;
import com.hbm.saveddata.SatelliteSavedData;
import com.hbm.saveddata.satellites.SatelliteBase;
import com.hbm.saveddata.satellites.SatelliteDetector;
import com.hbm.saveddata.satellites.SatelliteDetector.BurstIntensity;
import com.hbm.tileentity.IConfigurableMachine;
import com.hbm.tileentity.IGUIProvider;
import com.hbm.tileentity.IRadarCommandReceiver;
@ -359,6 +361,9 @@ public class TileEntityMachineRadarNT extends TileEntityMachineBase implements I
}
}
}
if(worldObj.getTotalWorldTime() % 20 == 0)
SatelliteDetector.reportEvent(worldObj, SatelliteDetector.DURATION_MEDIUM, BurstIntensity.MEDIUM, xCoord, zCoord);
}
public int getRedPower() {

View File

@ -10,6 +10,8 @@ import com.hbm.inventory.recipes.ParticleAcceleratorRecipes.ParticleAcceleratorR
import com.hbm.items.ModItems;
import com.hbm.lib.Library;
import com.hbm.main.MainRegistry;
import com.hbm.saveddata.satellites.SatelliteDetector;
import com.hbm.saveddata.satellites.SatelliteDetector.BurstIntensity;
import com.hbm.tileentity.IGUIProvider;
import com.hbm.tileentity.machine.albion.TileEntityPASource.PAState;
import com.hbm.tileentity.machine.albion.TileEntityPASource.Particle;
@ -160,6 +162,7 @@ public class TileEntityPADetector extends TileEntityCooledBase implements IGUIPr
for(EntityPlayer player : players) player.triggerAchievement(MainRegistry.achOmega12);
}
SatelliteDetector.reportEvent(worldObj, SatelliteDetector.DURATION_MEDIUM, BurstIntensity.MEDIUM, xCoord, zCoord);
particle.crash(PAState.SUCCESS);
return;
}

View File

@ -262,7 +262,7 @@ public class TileEntityPileLoader extends TileEntityPileDeviceBase implements IS
EnumPileRod rod = EnumUtil.grabEnumSafely(EnumPileRod.class, this.channelStack.getItemDamage());
return "" + (int) Math.round(rod.life);
}
if(name.equals(PREFIX_VALUE + "meta")) {
if(name.equals(PREFIX_VALUE + "temp")) {
return "" + (int) Math.round(this.channelTemp);
}

View File

@ -3297,6 +3297,16 @@ item.sat_miner.name=Asteroiden-Förderschiff (LEGACY)
item.sat_radar.name=Radar-Überwachungssatellit (LEGACY)
item.sat_resonator.name=Xenium-Resonator-Satellit (LEGACY)
item.sat_scanner.name=Satellit mit Tiefenscanning-Modul (LEGACY)
item.satellite.death_ray.name=Orbitaler Todesstrahl
item.satellite.detector.name=Weitband-Emissionsdetektor-Satellit
item.satellite.miner_astro.name=Asteroiden-Förderschiff
item.satellite.miner_lunar.name=Mond-Förderschiff
item.satellite.precision_laser.name=Orbitaler Präzisionslaser
item.satellite.radar.name=Radar-Überwachungssatellit
item.satellite.relay.name=Relais-Satellit
item.satellite.scanner.name=Tiefenscan-Satellit
item.satellite.spy.name=Spionagesatellit
item.satellite.xenium_resonator.name=Xenium-Resonator-Satellit
item.sawblade.name=Sägeblatt
item.schnitzel_vegan.name=Veganes Schnitzel
item.schrabidium_axe.name=Schrabidiumaxt

View File

@ -4410,6 +4410,7 @@ item.sat_radar.name=Radar Survey Satellite (LEGACY)
item.sat_resonator.name=Xenium Resonator Satellite (LEGACY)
item.sat_scanner.name=Satellite with Depth-Resource Scanning Module (LEGACY)
item.satellite.death_ray.name=Orbital Death Ray
item.satellite.detector.name=Wideband Radio Emission Detector Satellite
item.satellite.miner_astro.name=Asteroid Mining Ship
item.satellite.miner_lunar.name=Lunar Mining Ship
item.satellite.precision_laser.name=Orbital Precision Laser

Binary file not shown.

After

Width:  |  Height:  |  Size: 467 B