From f97076bb949b8b12cd8bb174f33396a61a8ef38d Mon Sep 17 00:00:00 2001 From: Bob Date: Fri, 2 Aug 2024 23:43:19 +0200 Subject: [PATCH] guh --- changelog | 16 +------- .../com/hbm/main/ModEventHandlerClient.java | 37 ------------------- .../hbm/particle/helper/ExplosionCreator.java | 12 +++--- .../machine/TileEntityICFStruct.java | 6 +-- .../machine/TileEntityMachineRadiolysis.java | 36 ++++++------------ src/main/java/com/hbm/util/ShadyUtil.java | 1 + 6 files changed, 23 insertions(+), 85 deletions(-) diff --git a/changelog b/changelog index a66af51eb..30f6f84b8 100644 --- a/changelog +++ b/changelog @@ -1,15 +1,3 @@ -## Changed -* Removed most legacy boilers - * Electric boilers have been completely removed - * Fired boilers no longer have an on-state, GUI or functionality - * Fired boilers still sometimes spawn in certain structures as loot, they drop 3-6 steel scraps containing 1 ingot worth of steel each -* The rare earth chunk texture is now consistent with the bedrock ores -* Removed the unused watz control elements - ## Fixed -* Fixed automatic crafting table filters being broken -* Fixed missing localization for black lung death messages -* Fixed disconnect caused by using a filter on the autocrafter's template output slot -* Fixed sentry turret "Brown" being uncraftable -* Fixed instant crash caused by processing some bedrock ores in an electrolyzer -* Disabled unused debug code for reflection testing \ No newline at end of file +* Fixed crash caused by decontaminating items with the radiolysis machine +* Fixed ICFs not forming correctly depending on the orientation \ No newline at end of file diff --git a/src/main/java/com/hbm/main/ModEventHandlerClient.java b/src/main/java/com/hbm/main/ModEventHandlerClient.java index 03d3100b1..317e05ba7 100644 --- a/src/main/java/com/hbm/main/ModEventHandlerClient.java +++ b/src/main/java/com/hbm/main/ModEventHandlerClient.java @@ -3,7 +3,6 @@ package com.hbm.main; import java.lang.reflect.Method; import java.util.ArrayList; import java.util.Arrays; -import java.util.Iterator; import java.util.List; import java.util.Locale; import java.util.Random; @@ -155,8 +154,6 @@ public class ModEventHandlerClient { public static long flashTimestamp; public static final int shakeDuration = 1_500; public static long shakeTimestamp; - public static List delayedSounds = new ArrayList(); - public static boolean soundLock = false; // for thread safety or some bullshit @SubscribeEvent public void onOverlayRender(RenderGameOverlayEvent.Pre event) { @@ -1385,23 +1382,6 @@ public class ModEventHandlerClient { client.sendQueue.addToSendQueue(new C0CPacketInput(client.moveStrafing, client.moveForward, client.movementInput.jump, client.movementInput.sneak)); } } - - if(event.phase == event.phase.START) { - - while(soundLock); - soundLock = true; - Iterator it = delayedSounds.iterator(); - - while(it.hasNext()) { - DelayedSound sound = it.next(); - if(sound.delay == 0) { - MainRegistry.proxy.playSoundClient(sound.x, sound.y, sound.z, sound.sound, sound.volume, sound.pitch); - it.remove(); - } - sound.delay--; - } - soundLock = false; - } } @SubscribeEvent @@ -1432,21 +1412,4 @@ public class ModEventHandlerClient { else if(d < 0.2) main.splashText = "Can someone tell me what corrosive fumes the people on Reddit are huffing so I can avoid those more effectively?"; } } - - public static class DelayedSound { - public String sound; - public int delay; - public double x, y, z; - public float volume, pitch; - - public DelayedSound(String sound, int delay, double x, double y, double z, float volume, float pitch) { - this.sound = sound; - this.delay = delay; - this.x = x; - this.y = y; - this.z = z; - this.volume = volume; - this.pitch = pitch; - } - } } diff --git a/src/main/java/com/hbm/particle/helper/ExplosionCreator.java b/src/main/java/com/hbm/particle/helper/ExplosionCreator.java index 2e553a958..dc59694ff 100644 --- a/src/main/java/com/hbm/particle/helper/ExplosionCreator.java +++ b/src/main/java/com/hbm/particle/helper/ExplosionCreator.java @@ -2,8 +2,6 @@ package com.hbm.particle.helper; import java.util.Random; -import com.hbm.main.ModEventHandlerClient; -import com.hbm.main.ModEventHandlerClient.DelayedSound; import com.hbm.particle.ParticleDebris; import com.hbm.particle.ParticleMukeWave; import com.hbm.particle.ParticleRocketFlame; @@ -13,16 +11,18 @@ import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; import net.minecraft.block.Block; import net.minecraft.client.Minecraft; +import net.minecraft.client.audio.PositionedSoundRecord; import net.minecraft.client.renderer.texture.TextureManager; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.init.Blocks; import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.util.ResourceLocation; import net.minecraft.util.Vec3; import net.minecraft.world.World; public class ExplosionCreator implements IParticleCreator { - public static final double speedOfSound = (17.15D) * 0.33; + public static final double speedOfSound = (17.15D) * 0.5; public static void composeEffect(World world, double x, double y, double z, int cloudCount, float cloudScale, float cloudSpeedMult, float waveScale, int debrisCount, int debrisSize, int debrisRetry, float debrisVelocity, float debrisHorizontalDeviation, float debrisVerticalOffset, float soundRange) { @@ -71,11 +71,9 @@ public class ExplosionCreator implements IParticleCreator { float dist = (float) player.getDistance(x, y, z); if(dist <= soundRange) { - while(ModEventHandlerClient.soundLock); - ModEventHandlerClient.soundLock = true; String sound = dist <= soundRange * 0.4 ? "hbm:weapon.explosionLargeNear" : "hbm:weapon.explosionLargeFar"; - ModEventHandlerClient.delayedSounds.add(new DelayedSound(sound, (int) (dist / speedOfSound), x, y, z, 1000F, 0.9F + rand.nextFloat() * 0.2F)); - ModEventHandlerClient.soundLock = false; + PositionedSoundRecord positionedsoundrecord = new PositionedSoundRecord(new ResourceLocation(sound), 1000F, 0.9F + rand.nextFloat() * 0.2F, (float) x, (float) y, (float) z); + Minecraft.getMinecraft().getSoundHandler().playDelayedSound(positionedsoundrecord, (int) (dist / speedOfSound)); } // WAVE diff --git a/src/main/java/com/hbm/tileentity/machine/TileEntityICFStruct.java b/src/main/java/com/hbm/tileentity/machine/TileEntityICFStruct.java index 79f124134..57711f8eb 100644 --- a/src/main/java/com/hbm/tileentity/machine/TileEntityICFStruct.java +++ b/src/main/java/com/hbm/tileentity/machine/TileEntityICFStruct.java @@ -41,12 +41,12 @@ public class TileEntityICFStruct extends TileEntity { } /** check block at relative position */ - public boolean cbarp(Block block, int meta, int x, int y, int z, ForgeDirection dir) { + public boolean cbarp(Block block, int meta, int widthwiseOffset, int y, int lengthwiseOffset, ForgeDirection dir) { ForgeDirection rot = dir.getRotation(ForgeDirection.UP); - int ix = xCoord + dir.offsetX * z + rot.offsetX * z; + int ix = xCoord + rot.offsetX * lengthwiseOffset + dir.offsetX * widthwiseOffset; int iy = yCoord + y; - int iz = zCoord + dir.offsetZ * x + rot.offsetZ * x; + int iz = zCoord + rot.offsetZ * lengthwiseOffset + dir.offsetZ * widthwiseOffset; return worldObj.getBlock(ix, iy, iz) == block && worldObj.getBlockMetadata(ix, iy, iz) == meta; } diff --git a/src/main/java/com/hbm/tileentity/machine/TileEntityMachineRadiolysis.java b/src/main/java/com/hbm/tileentity/machine/TileEntityMachineRadiolysis.java index 612cdabfd..e311a05d0 100644 --- a/src/main/java/com/hbm/tileentity/machine/TileEntityMachineRadiolysis.java +++ b/src/main/java/com/hbm/tileentity/machine/TileEntityMachineRadiolysis.java @@ -210,50 +210,38 @@ public class TileEntityMachineRadiolysis extends TileEntityMachineBase implement private void sterilize() { if(slots[12] != null) { if(slots[12].getItem() instanceof ItemFood && !(slots[12].getItem() == ModItems.pancake)) { - slots[12].stackSize -= 1; - if(slots[12].stackSize <= 0) - slots[12] = null; + this.decrStackSize(12, 1); } - if(!checkIfValid()) - return; + if(!checkIfValid()) return; ItemStack output = slots[12].copy(); output.stackSize = 1; if(slots[13] == null) { - slots[12].stackSize -= output.stackSize; - if(slots[12].stackSize <= 0) - slots[12] = null; + this.decrStackSize(12, output.stackSize); slots[13] = output; slots[13].stackTagCompound.removeTag("ntmContagion"); if(slots[13].stackTagCompound.hasNoTags()) { slots[13].stackTagCompound = null; } } else if(slots[13].isItemEqual(output) && slots[13].stackSize + output.stackSize <= slots[13].getMaxStackSize()) { - slots[12].stackSize -= output.stackSize; - if(slots[12].stackSize <= 0) - slots[12] = null; - + this.decrStackSize(12, output.stackSize); slots[13].stackSize += output.stackSize; - slots[13].stackTagCompound.removeTag("ntmContagion"); - if(slots[13].stackTagCompound.hasNoTags()) { - slots[13].stackTagCompound = null; + if(slots[13].hasTagCompound()) { // redundant but just to be sure + slots[13].stackTagCompound.removeTag("ntmContagion"); + if(slots[13].stackTagCompound.hasNoTags()) { + slots[13].stackTagCompound = null; + } } } } } private boolean checkIfValid() { - if(slots[12] == null) - return false; - - if(!slots[12].hasTagCompound()) - return false; - - if(!slots[12].getTagCompound().getBoolean("ntmContagion")) - return false; - + if(slots[12] == null) return false; + if(!slots[12].hasTagCompound()) return false; + if(!slots[12].getTagCompound().getBoolean("ntmContagion")) return false; return true; } diff --git a/src/main/java/com/hbm/util/ShadyUtil.java b/src/main/java/com/hbm/util/ShadyUtil.java index 35ea12722..df3fd7f8c 100644 --- a/src/main/java/com/hbm/util/ShadyUtil.java +++ b/src/main/java/com/hbm/util/ShadyUtil.java @@ -72,6 +72,7 @@ public class ShadyUtil { public static Set contributors = Sets.newHashSet(new String[] { "06ab7c03-55ce-43f8-9d3c-2850e3c652de", //mustang_rudolf "5bf069bc-5b46-4179-aafe-35c0a07dee8b", //JMF781 + "ccd9aa1c-26b9-4dde-8f37-b96f8d99de22", //kakseao }); // simple cryptographic utils