diff --git a/src/main/java/com/hbm/blocks/machine/rbmk/RBMKLever.java b/src/main/java/com/hbm/blocks/machine/rbmk/RBMKLever.java index 92efd07d2..99c1e4210 100644 --- a/src/main/java/com/hbm/blocks/machine/rbmk/RBMKLever.java +++ b/src/main/java/com/hbm/blocks/machine/rbmk/RBMKLever.java @@ -1,10 +1,15 @@ package com.hbm.blocks.machine.rbmk; +import org.lwjgl.opengl.GL11; + import com.hbm.main.MainRegistry; +import com.hbm.main.ResourceManager; import com.hbm.tileentity.machine.rbmk.TileEntityRBMKLever; import api.hbm.block.IToolable; import cpw.mods.fml.common.network.internal.FMLNetworkHandler; +import net.minecraft.block.Block; +import net.minecraft.client.Minecraft; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.tileentity.TileEntity; import net.minecraft.world.World; @@ -46,4 +51,26 @@ public class RBMKLever extends RBMKMiniPanelBase implements IToolable { return true; } + + @Override + public void renderInventoryBlock(Block block, int meta, int modelId, Object renderBlocks) { + super.renderInventoryBlock(block, meta, modelId, renderBlocks); + + GL11.glPushMatrix(); + GL11.glTranslated(0, -0.5, 0); + GL11.glRotated(-90, 0, 1, 0); + + Minecraft.getMinecraft().getTextureManager().bindTexture(ResourceManager.rbmk_lever_tex); + + for(int i = 0; i < 2; i++) { + + GL11.glPushMatrix(); + GL11.glTranslated(0.25, 0, i * -0.5 + 0.25); + ResourceManager.rbmk_lever.renderPart("Base"); + ResourceManager.rbmk_lever.renderPart("Lever"); + GL11.glPopMatrix(); + } + + GL11.glPopMatrix(); + } } diff --git a/src/main/java/com/hbm/main/ClientProxy.java b/src/main/java/com/hbm/main/ClientProxy.java index f1dd3c567..e81a6ae09 100644 --- a/src/main/java/com/hbm/main/ClientProxy.java +++ b/src/main/java/com/hbm/main/ClientProxy.java @@ -1758,10 +1758,12 @@ public class ClientProxy extends ServerProxy { } if("tau".equals(type)) { + boolean small = data.getBoolean("small"); - for(int i = 0; i < data.getByte("count"); i++) - Minecraft.getMinecraft().effectRenderer.addEffect(new ParticleSpark(world, x, y, z, rand.nextGaussian() * 0.05, 0.05, rand.nextGaussian() * 0.05)); - Minecraft.getMinecraft().effectRenderer.addEffect(new ParticleHadron(man, world, x, y, z)); + for(int i = 0; i < data.getByte("count"); i++) { + Minecraft.getMinecraft().effectRenderer.addEffect(new ParticleSpark(world, x, y, z, rand.nextGaussian() * 0.05, 0.05, rand.nextGaussian() * 0.05).makeSmall(small)); + } + Minecraft.getMinecraft().effectRenderer.addEffect(new ParticleHadron(man, world, x, y, z).makeSmall(small)); } if("vanish".equals(type)) { diff --git a/src/main/java/com/hbm/main/NTMSounds.java b/src/main/java/com/hbm/main/NTMSounds.java index 03b6eb62d..79a6a1768 100644 --- a/src/main/java/com/hbm/main/NTMSounds.java +++ b/src/main/java/com/hbm/main/NTMSounds.java @@ -100,6 +100,9 @@ public class NTMSounds { public static final String BLOCK_PLUSHY = "hbm:block.squeakyToy"; // squee public static final String BLOCK_HUNDUNS_MAGNIFICENT_HOWL = "hbm:block.hunduns_magnificent_howl"; // tragic yuri public static final String BLOCK_FALLOUT_3_POPUP = "hbm:block.bobble"; + public static final String LEVER_START = "hbm:block.leverStart"; + public static final String LEVER_STOP = "hbm:block.leverStop"; + public static final String SPARK = "hbm:block.spark"; /// MACHINE SOUNDS, MOSTLY LOOPS /// public static final String ELECTRIC_MOTOR_LOOP = "hbm:block.motor"; diff --git a/src/main/java/com/hbm/particle/ParticleHadron.java b/src/main/java/com/hbm/particle/ParticleHadron.java index 46b5e3d7c..3693aad33 100644 --- a/src/main/java/com/hbm/particle/ParticleHadron.java +++ b/src/main/java/com/hbm/particle/ParticleHadron.java @@ -25,11 +25,19 @@ public class ParticleHadron extends EntityFX { super(world, x, y, z); this.theRenderEngine = texman; this.particleMaxAge = 10; + this.particleScale = 1F; } public int getFXLayer() { return 3; } + + public ParticleHadron makeSmall(boolean small) { + if(!small) return this; + this.particleScale = 0.5F; + this.particleMaxAge = 5; + return this; + } public void renderParticle(Tessellator tess, float interp, float x, float y, float z, float tx, float tz) { @@ -49,7 +57,7 @@ public class ParticleHadron extends EntityFX { tess.setBrightness(240); this.particleAlpha = 1 - (((float)this.particleAge + interp) / (float)this.particleMaxAge); - float scale = (this.particleAge + interp) * 0.15F; + float scale = (this.particleAge + interp) * 0.15F * this.particleScale; tess.setColorRGBA_F(1.0F, 1.0F, 1.0F, this.particleAlpha); diff --git a/src/main/java/com/hbm/particle/ParticleSpark.java b/src/main/java/com/hbm/particle/ParticleSpark.java index 386bd3678..d32dda6a1 100644 --- a/src/main/java/com/hbm/particle/ParticleSpark.java +++ b/src/main/java/com/hbm/particle/ParticleSpark.java @@ -25,6 +25,15 @@ public class ParticleSpark extends EntityFX { public int getFXLayer() { return 3; } + + public ParticleSpark makeSmall(boolean small) { + if(!small) return this; + this.setSize(0.01F, 0.01F); + this.thresh = 3; + this.particleMaxAge = 2 + rand.nextInt(3); + this.motionY = -Math.abs(motionY); + return this; + } public void onUpdate() { diff --git a/src/main/java/com/hbm/tileentity/machine/rbmk/TileEntityRBMKLever.java b/src/main/java/com/hbm/tileentity/machine/rbmk/TileEntityRBMKLever.java index b02150762..865fae9ba 100644 --- a/src/main/java/com/hbm/tileentity/machine/rbmk/TileEntityRBMKLever.java +++ b/src/main/java/com/hbm/tileentity/machine/rbmk/TileEntityRBMKLever.java @@ -1,17 +1,22 @@ package com.hbm.tileentity.machine.rbmk; +import com.hbm.handler.threading.PacketThreading; import com.hbm.interfaces.IControlReceiver; import com.hbm.inventory.gui.GUIScreenRBMKLever; +import com.hbm.main.NTMSounds; +import com.hbm.packet.toclient.AuxParticlePacketNT; import com.hbm.tileentity.IGUIProvider; import com.hbm.tileentity.TileEntityLoadedBase; import com.hbm.tileentity.network.RTTYSystem; import com.hbm.util.BufferUtil; +import cpw.mods.fml.common.network.NetworkRegistry.TargetPoint; import io.netty.buffer.ByteBuf; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.inventory.Container; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.world.World; +import net.minecraftforge.common.util.ForgeDirection; public class TileEntityRBMKLever extends TileEntityLoadedBase implements IGUIProvider, IControlReceiver { @@ -49,6 +54,7 @@ public class TileEntityRBMKLever extends TileEntityLoadedBase implements IGUIPro public class LeverUnit { + public int index; /** If the output should be per tick, allows the lever to lock in place */ public boolean polling; /** Label on the lever as rendered on the panel */ @@ -70,19 +76,26 @@ public class TileEntityRBMKLever extends TileEntityLoadedBase implements IGUIPro public static final float FLIP_SPEED = 1F / 10F; // 0.5s public LeverUnit(int initialIndex) { + this.index = initialIndex; label = "Lever " + (initialIndex + 1); } public void click() { if(!active) return; + if(this.flipProgress <= 0 || this.flipProgress >= 1) + worldObj.playSoundEffect(xCoord + 0.5, yCoord + 0.5, zCoord + 0.5, NTMSounds.LEVER_START, 1F, 1F); + this.isTurningOn = !isTurningOn; TileEntityRBMKLever.this.markDirty(); } public void update() { + this.prevFlipProgress = this.flipProgress; if(!active) return; + boolean arcFlash = false; + if(polling) { if(this.flipProgress >= 1F && canSend(commandOn)) RTTYSystem.broadcast(worldObj, rtty, commandOn); if(this.flipProgress <= 0F && canSend(commandOff)) RTTYSystem.broadcast(worldObj, rtty, commandOff); @@ -95,15 +108,38 @@ public class TileEntityRBMKLever extends TileEntityLoadedBase implements IGUIPro this.flipProgress = 1F; // for non-polling levers, send one message if(!polling && canSend(commandOn)) RTTYSystem.broadcast(worldObj, rtty, commandOn); + worldObj.playSoundEffect(xCoord + 0.5, yCoord + 0.5, zCoord + 0.5, NTMSounds.LEVER_STOP, 0.5F, 1F); + arcFlash = true; } // turning off... } else if(!this.isTurningOn && this.flipProgress > 0F) { + if(this.prevFlipProgress >= 1) arcFlash = true; this.flipProgress -= FLIP_SPEED; if(this.flipProgress <= 0F) { this.flipProgress = 0F; // for non-polling levers, send the off message once upon return if(!polling && canSend(commandOff)) RTTYSystem.broadcast(worldObj, rtty, commandOff); + worldObj.playSoundEffect(xCoord + 0.5, yCoord + 0.5, zCoord + 0.5, NTMSounds.LEVER_STOP, 0.5F, 1F); + } + } + + if(arcFlash) { + + worldObj.playSoundEffect(xCoord + 0.5, yCoord + 0.5, zCoord + 0.5, NTMSounds.SPARK, 1F, 1F); + ForgeDirection dir = ForgeDirection.getOrientation(getBlockMetadata()); + ForgeDirection rot = dir.getRotation(ForgeDirection.UP); + + for(int i = 0; i < 2; i++) { + double x = xCoord + 0.5 + dir.offsetX * 0.4 - rot.offsetX * (index - 0.5) * (i == 0 ? 0.375 : 0.625); + double y = yCoord + 0.4375 - 0.03125; + double z = zCoord + 0.5 + dir.offsetZ * 0.4 - rot.offsetZ * (index - 0.5) * (i == 0 ? 0.375 : 0.625); + + NBTTagCompound dPart = new NBTTagCompound(); + dPart.setString("type", "tau"); + dPart.setByte("count", (byte)5); + dPart.setBoolean("small", true); + PacketThreading.createAllAroundThreadedPacket(new AuxParticlePacketNT(dPart, x, y, z), new TargetPoint(worldObj.provider.dimensionId, x, y, z, 25)); } } } diff --git a/src/main/resources/assets/hbm/manual/ror/panelbutton.json b/src/main/resources/assets/hbm/manual/ror/panelbutton.json index 683e9a4b2..bcc889a2d 100644 --- a/src/main/resources/assets/hbm/manual/ror/panelbutton.json +++ b/src/main/resources/assets/hbm/manual/ror/panelbutton.json @@ -6,6 +6,6 @@ "en_US": "Redstone-over-Radio Keypad" }, "content": { - "en_US": "Interactive [[redstone over radio|Redstone over Radio]] transmitting device, needs to be configured with a scredriver first. Up to four buttons can be enabled using the red buttons, each button can transmit one value over its own RoR channel. This is useful for [RoR controllers|Redstone-over-Radio Controller], allowing things like RBMK settings to be adjusted with the push of a button.

The color setting accepts hexadecimal values, i.e. up to six characters with groups of two representing red, green and blue color components respectively. As a rule of thumb: FF is full color, 80 is half color and 00 is no color. FF8000 (full red, half green and no blue) is therefore orange.

The polling setting on the keypad turns the button into a locking one, the button remains pressed, sending the RoR signal each tick, until it is unpressed. State change buttons only send the command once when initially pressed.

See also:
[Redstone-over-Radio Gauge]
[Redstone-over-Radio Numeric Display]
[Redstone-over-Radio Graph]
[Redstone-over-Radio Lever]" + "en_US": "Interactive [[redstone over radio|Redstone over Radio]] transmitting device, needs to be configured with a scredriver first. Up to four buttons can be enabled using the red buttons, each button can transmit one value over its own RoR channel. This is useful for [RoR controllers|Redstone-over-Radio Controller], allowing things like RBMK settings to be adjusted with the push of a button.

The color setting accepts hexadecimal values, i.e. up to six characters with groups of two representing red, green and blue color components respectively. As a rule of thumb: FF is full color, 80 is half color and 00 is no color. FF8000 (full red, half green and no blue) is therefore orange.

The polling setting on the keypad turns the button into a locking one, the button remains pressed, sending the RoR signal each tick, until it is unpressed. State change buttons only send the command once when initially pressed.

See also:
[[Redstone-over-Radio Gauge]]
[[Redstone-over-Radio Numeric Display]]
[[Redstone-over-Radio Graph]]
[[Redstone-over-Radio Lever]]" } } diff --git a/src/main/resources/assets/hbm/manual/ror/panelgauge.json b/src/main/resources/assets/hbm/manual/ror/panelgauge.json index 8208ea5e2..354ba369b 100644 --- a/src/main/resources/assets/hbm/manual/ror/panelgauge.json +++ b/src/main/resources/assets/hbm/manual/ror/panelgauge.json @@ -6,6 +6,6 @@ "en_US": "Redstone-over-Radio Gauge" }, "content": { - "en_US": "Aesthetic [[redstone over radio|Redstone over Radio]] receiving device, needs to be configured with a scredriver first. Can represent numeric RoR values using a gauge needle. Up to four gauges can be enabled using the red buttons, each gauge can receive one value over its own RoR channel. Minimum and maximum values need to be configured before the gauge can be used, if the minimum is set to a higher value than the maximum, then the needle will run in reverse. The needle can exceed the maximum value by up to 50%, entering the red section of the gauge.

See also:
[Redstone-over-Radio Keypad]
[Redstone-over-Radio Numeric Display]
[Redstone-over-Radio Graph]
[Redstone-over-Radio Lever]" + "en_US": "Aesthetic [[redstone over radio|Redstone over Radio]] receiving device, needs to be configured with a scredriver first. Can represent numeric RoR values using a gauge needle. Up to four gauges can be enabled using the red buttons, each gauge can receive one value over its own RoR channel. Minimum and maximum values need to be configured before the gauge can be used, if the minimum is set to a higher value than the maximum, then the needle will run in reverse. The needle can exceed the maximum value by up to 50%, entering the red section of the gauge.

See also:
[[Redstone-over-Radio Keypad]]
[[Redstone-over-Radio Numeric Display]]
[[Redstone-over-Radio Graph]]
[[Redstone-over-Radio Lever]]" } } diff --git a/src/main/resources/assets/hbm/manual/ror/panelgraph.json b/src/main/resources/assets/hbm/manual/ror/panelgraph.json index c0cdab766..6597ac27a 100644 --- a/src/main/resources/assets/hbm/manual/ror/panelgraph.json +++ b/src/main/resources/assets/hbm/manual/ror/panelgraph.json @@ -6,6 +6,6 @@ "en_US": "Redstone-over-Radio Graph" }, "content": { - "en_US": "Aesthetic [[redstone over radio|Redstone over Radio]] receiving device, needs to be configured with a scredriver first. Can represent numeric RoR values over time using a line graph. Values are updated every half second, and the graph can log up to 15 seconds of input. Up to two graphs can be enabled using the red buttons, each graphs can receive one value over its own RoR channel. Useful for displaying values where the change over time is important, such as temperature curves.

See also:
[Redstone-over-Radio Keypad]
[Redstone-over-Radio Gauge]
[Redstone-over-Radio Numeric Display]
[Redstone-over-Radio Lever]" + "en_US": "Aesthetic [[redstone over radio|Redstone over Radio]] receiving device, needs to be configured with a scredriver first. Can represent numeric RoR values over time using a line graph. Values are updated every half second, and the graph can log up to 15 seconds of input. Up to two graphs can be enabled using the red buttons, each graphs can receive one value over its own RoR channel. Useful for displaying values where the change over time is important, such as temperature curves.

See also:
[[Redstone-over-Radio Keypad]]
[[Redstone-over-Radio Gauge]]
[[Redstone-over-Radio Numeric Display]]
[[Redstone-over-Radio Lever]]" } } diff --git a/src/main/resources/assets/hbm/manual/ror/panellever.json b/src/main/resources/assets/hbm/manual/ror/panellever.json index ace275fef..371e19bad 100644 --- a/src/main/resources/assets/hbm/manual/ror/panellever.json +++ b/src/main/resources/assets/hbm/manual/ror/panellever.json @@ -6,6 +6,6 @@ "en_US": "Redstone-over-Radio Lever" }, "content": { - "en_US": "Interactive [[redstone over radio|Redstone over Radio]] transmitting device, needs to be configured with a scredriver first. Up to two large breaker switches can be enabled using the red buttons, each button can transmit one value over its own RoR channel. Levers behave similar to keypad buttons, except that they can transmit different values depending on whether they have been turned on or off. With polling enabled, the switch will continuously send the signal corresponding to whichevever state it is in, except when the lever is currently being flipped. State change causes it to only send a single pulse after it has been flipped.

See also:
[Redstone-over-Radio Keypad]
[Redstone-over-Radio Gauge]
[Redstone-over-Radio Numeric Display]
[Redstone-over-Radio Graph]" + "en_US": "Interactive [[redstone over radio|Redstone over Radio]] transmitting device, needs to be configured with a scredriver first. Up to two large breaker switches can be enabled using the red buttons, each button can transmit one value over its own RoR channel. Levers behave similar to keypad buttons, except that they can transmit different values depending on whether they have been turned on or off. With polling enabled, the switch will continuously send the signal corresponding to whichevever state it is in, except when the lever is currently being flipped. State change causes it to only send a single pulse after it has been flipped.

See also:
[[Redstone-over-Radio Keypad]]
[[Redstone-over-Radio Gauge]]
[[Redstone-over-Radio Numeric Display]]
[[Redstone-over-Radio Graph]]" } } diff --git a/src/main/resources/assets/hbm/manual/ror/panelnumitron.json b/src/main/resources/assets/hbm/manual/ror/panelnumitron.json index ecd21f2e4..37ededf7d 100644 --- a/src/main/resources/assets/hbm/manual/ror/panelnumitron.json +++ b/src/main/resources/assets/hbm/manual/ror/panelnumitron.json @@ -6,6 +6,6 @@ "en_US": "Redstone-over-Radio Numeric Display" }, "content": { - "en_US": "Aesthetic [[redstone over radio|Redstone over Radio]] receiving device, needs to be configured with a scredriver first. Can represent numeric RoR values using a seven segment number display. Up to two displays can be enabled using the red buttons, each display can receive one value over its own RoR channel. Large values displayed will be shortened, using SI suffixes. Also useful for displaying item counts provided by an [[RoR item counter|Redstone-over-Radio Item Counter]].

See also:
[Redstone-over-Radio Keypad]
[Redstone-over-Radio Gauge]
[Redstone-over-Radio Graph]
[Redstone-over-Radio Lever]" + "en_US": "Aesthetic [[redstone over radio|Redstone over Radio]] receiving device, needs to be configured with a scredriver first. Can represent numeric RoR values using a seven segment number display. Up to two displays can be enabled using the red buttons, each display can receive one value over its own RoR channel. Large values displayed will be shortened, using SI suffixes. Also useful for displaying item counts provided by an [[RoR item counter|Redstone-over-Radio Item Counter]].

See also:
[[Redstone-over-Radio Keypad]]
[[Redstone-over-Radio Gauge]]
[[Redstone-over-Radio Graph]]
[[Redstone-over-Radio Lever]]" } } diff --git a/src/main/resources/assets/hbm/sounds.json b/src/main/resources/assets/hbm/sounds.json index 571f1d7a2..05cc4631d 100644 --- a/src/main/resources/assets/hbm/sounds.json +++ b/src/main/resources/assets/hbm/sounds.json @@ -74,6 +74,9 @@ "block.assemblerStart": {"category": "block", "sounds": [{"name": "block/assemblerStart", "stream": false}]}, "block.assemblerStop": {"category": "block", "sounds": [{"name": "block/assemblerStop", "stream": false}]}, "block.assemblerCut": {"category": "block", "sounds": [{"name": "block/assemblerCut", "stream": false}]}, + "block.leverStart": {"category": "block", "sounds": [{"name": "block/leverStart", "stream": false}]}, + "block.leverStop": {"category": "block", "sounds": [{"name": "block/leverStop", "stream": false}]}, + "block.spark": {"category": "block", "sounds": ["block/spark1", "block/spark2", "block/spark3", "block/spark4", "block/spark5", "block/spar6"]}, "door.TransitionSealOpen": {"category": "block", "sounds": [{"name": "block/door/transition_seal_open", "stream": true}]}, "door.wghStart": {"category": "block", "sounds": [{"name": "block/door/wgh_start", "stream": true}]}, @@ -338,7 +341,7 @@ "entity.siegeIdle": {"category": "hostile", "sounds": ["entity/siegeIdle1"]}, "entity.siegeHurt": {"category": "hostile", "sounds": ["entity/siegeHurt1", "entity/siegeHurt2"]}, "entity.siegeDeath": {"category": "hostile", "sounds": ["entity/siegeDeath1", "entity/siegeDeath2", "entity/siegeDeath3"]}, - "entity.meteoriteFallingLoop": {"category": "block", "sounds": [{"name": "entity/meteoriteFallingLoop", "stream": false}]}, + "entity.meteoriteFallingLoop": {"category": "block", "sounds": [{"name": "entity/meteoriteFallingLoop", "stream": false}]}, "step.metal": {"category": "player", "sounds": [{"name": "footsteps/metal", "stream": false}]}, "step.iron_jump": {"category": "player", "sounds": [{"name": "footsteps/iron_jump", "stream": false}]}, diff --git a/src/main/resources/assets/hbm/sounds/block/leverStart.ogg b/src/main/resources/assets/hbm/sounds/block/leverStart.ogg new file mode 100644 index 000000000..1e264bdca Binary files /dev/null and b/src/main/resources/assets/hbm/sounds/block/leverStart.ogg differ diff --git a/src/main/resources/assets/hbm/sounds/block/leverStop.ogg b/src/main/resources/assets/hbm/sounds/block/leverStop.ogg new file mode 100644 index 000000000..40ed9fa29 Binary files /dev/null and b/src/main/resources/assets/hbm/sounds/block/leverStop.ogg differ diff --git a/src/main/resources/assets/hbm/sounds/block/spark1.ogg b/src/main/resources/assets/hbm/sounds/block/spark1.ogg new file mode 100644 index 000000000..e92614b80 Binary files /dev/null and b/src/main/resources/assets/hbm/sounds/block/spark1.ogg differ diff --git a/src/main/resources/assets/hbm/sounds/block/spark2.ogg b/src/main/resources/assets/hbm/sounds/block/spark2.ogg new file mode 100644 index 000000000..fe17f8753 Binary files /dev/null and b/src/main/resources/assets/hbm/sounds/block/spark2.ogg differ diff --git a/src/main/resources/assets/hbm/sounds/block/spark3.ogg b/src/main/resources/assets/hbm/sounds/block/spark3.ogg new file mode 100644 index 000000000..e917e8b69 Binary files /dev/null and b/src/main/resources/assets/hbm/sounds/block/spark3.ogg differ diff --git a/src/main/resources/assets/hbm/sounds/block/spark4.ogg b/src/main/resources/assets/hbm/sounds/block/spark4.ogg new file mode 100644 index 000000000..8090e7260 Binary files /dev/null and b/src/main/resources/assets/hbm/sounds/block/spark4.ogg differ diff --git a/src/main/resources/assets/hbm/sounds/block/spark5.ogg b/src/main/resources/assets/hbm/sounds/block/spark5.ogg new file mode 100644 index 000000000..973abd718 Binary files /dev/null and b/src/main/resources/assets/hbm/sounds/block/spark5.ogg differ diff --git a/src/main/resources/assets/hbm/sounds/block/spark6.ogg b/src/main/resources/assets/hbm/sounds/block/spark6.ogg new file mode 100644 index 000000000..6f85c42ea Binary files /dev/null and b/src/main/resources/assets/hbm/sounds/block/spark6.ogg differ