Add a separate sound for Marx misfirings

Add a texture for the tinnitus potion effect
This commit is contained in:
malte0811 2017-08-27 18:09:58 +02:00
parent e003367bf7
commit e200185235
7 changed files with 27 additions and 5 deletions

View file

@ -23,6 +23,8 @@ import net.minecraft.entity.EntityLivingBase;
import net.minecraft.potion.Potion;
import net.minecraft.util.ResourceLocation;
import net.minecraftforge.fml.common.registry.ForgeRegistries;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
import javax.annotation.Nonnull;
@ -32,8 +34,10 @@ public class IWPotions {
tinnitus = new PotionTinnitus();
}
static class PotionTinnitus extends Potion {
ResourceLocation tex = new ResourceLocation(IndustrialWires.MODID,"textures/gui/tinnitus.png");
protected PotionTinnitus() {
super(true, 0xffff0000);
setIconIndex(0, 0);
this.setRegistryName(new ResourceLocation(IndustrialWires.MODID, "tinnitus"));
ForgeRegistries.POTIONS.register(this);
}
@ -52,5 +56,13 @@ public class IWPotions {
}
}
}
@Override
@SideOnly(Side.CLIENT)
public int getStatusIconIndex()
{
Minecraft.getMinecraft().getTextureManager().bindTexture(tex);
return super.getStatusIconIndex();
}
}
}

View file

@ -292,7 +292,7 @@ public class TileEntityMarx extends TileEntityIWMultiblock implements ITickable,
net.updateValues();
NBTTagCompound data = new NBTTagCompound();
if (failed) {
energyStored = -1;
energyStored = -energyStored;
} else {
int seed = Utils.RAND.nextInt();
genDischarge((float) energyStored, seed);//TODO test on a dedicated server
@ -422,7 +422,7 @@ public class TileEntityMarx extends TileEntityIWMultiblock implements ITickable,
if (dischargeData==null) {
dischargeData = new Discharge(stageCount);
}
dischargeData.energy = -1;
dischargeData.energy = energy;
}
}

View file

@ -280,6 +280,7 @@ public class ClientProxy extends CommonProxy {
private static ResourceLocation jacobsMiddle = new ResourceLocation(IndustrialWires.MODID, "jacobs_ladder_middle");
private static ResourceLocation jacobsEnd = new ResourceLocation(IndustrialWires.MODID, "jacobs_ladder_end");//~210 ms ~= 4 ticks
private static ResourceLocation marxBang = new ResourceLocation(IndustrialWires.MODID, "marx_bang");
private static ResourceLocation marxPop = new ResourceLocation(IndustrialWires.MODID, "marx_pop");
@Override
public void playJacobsLadderSound(TileEntityJacobsLadder te, int phase, Vec3d soundPos) {
@ -308,10 +309,12 @@ public class ClientProxy extends CommonProxy {
@Override
public void playMarxBang(TileEntityMarx te, Vec3d pos, float energy) {
ResourceLocation soundLoc = marxBang;
if (energy<0) {
energy = .05F;
energy = -energy;
soundLoc = marxPop;
}
PositionedSoundRecord sound = new PositionedSoundRecord(marxBang, SoundCategory.BLOCKS, 5*energy, 1, false, 0, ISound.AttenuationType.LINEAR, (float) pos.x, (float) pos.y, (float) pos.z);
PositionedSoundRecord sound = new PositionedSoundRecord(soundLoc, SoundCategory.BLOCKS, 5*energy, 1, false, 0, ISound.AttenuationType.LINEAR, (float) pos.x, (float) pos.y, (float) pos.z);
ClientUtils.mc().getSoundHandler().playSound(sound);
playingSounds.put(te.getPos(), sound);
}

View file

@ -46,7 +46,7 @@ item.industrialwires.key.key_ring.name=Key Ring
industrialwires.subtitle.tinnitus=You have a tinnitus
industrialwires.subtitle.jacobs_ladder=Jacob's ladder hums
industrialwires.subtitle.marx_bang=Marx generator discharges
industrialwires.subtitle.marx_pop=Marx generator misfires
industrialwires.desc.wireLength=Wire length: %1s block(s)
industrialwires.desc.recipe=Please check the Engineer's manual for recipe details

View file

@ -33,5 +33,12 @@
"sounds": [
"industrialwires:marx_bang"
]
},
"marx_pop": {
"category": "block",
"subtitle": "industrialwires.subtitle.marx_pop",
"sounds": [
"industrialwires:marx_pop"
]
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB