Add sound for locating spells using the lectern

This commit is contained in:
Electroblob77
2020-04-09 21:07:06 +01:00
parent 1833ed9c56
commit f973099fd3
3 changed files with 9 additions and 0 deletions
@@ -28,6 +28,7 @@ import net.minecraft.network.play.client.CPacketCloseWindow;
import net.minecraft.tileentity.TileEntity; import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.EnumFacing; import net.minecraft.util.EnumFacing;
import net.minecraft.util.ResourceLocation; import net.minecraft.util.ResourceLocation;
import net.minecraft.util.SoundCategory;
import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.MathHelper; import net.minecraft.util.math.MathHelper;
import net.minecraft.util.math.Vec3d; import net.minecraft.util.math.Vec3d;
@@ -275,7 +276,9 @@ public class GuiLectern extends GuiSpellInfo implements ISpellSortable {
Spell spell = Spell.byMetadata(stack.getMetadata()); Spell spell = Spell.byMetadata(stack.getMetadata());
if(spell == this.currentSpell){ if(spell == this.currentSpell){
BlockPos pos = (((TileEntity)bookshelf).getPos()); BlockPos pos = (((TileEntity)bookshelf).getPos());
for(EnumFacing side : EnumFacing.VALUES){ for(EnumFacing side : EnumFacing.VALUES){
ParticleBuilder.create(ParticleBuilder.Type.BLOCK_HIGHLIGHT).pos( ParticleBuilder.create(ParticleBuilder.Type.BLOCK_HIGHLIGHT).pos(
WizardryUtilities.getFaceCentre(pos, side) WizardryUtilities.getFaceCentre(pos, side)
@@ -283,6 +286,9 @@ public class GuiLectern extends GuiSpellInfo implements ISpellSortable {
.scale(WizardryUtilities.ANTI_Z_FIGHTING_OFFSET))) .scale(WizardryUtilities.ANTI_Z_FIGHTING_OFFSET)))
.face(side).clr(0.9f, 0.5f, 0.8f).fade(0.7f, 0, 1).spawn(mc.world); .face(side).clr(0.9f, 0.5f, 0.8f).fade(0.7f, 0, 1).spawn(mc.world);
} }
mc.world.playSound(pos, WizardrySounds.BLOCK_LECTERN_LOCATE_SPELL, SoundCategory.BLOCKS, 1, 0.7f, false);
break; // This bookshelf has the spell, skip to the next bookshelf break; // This bookshelf has the spell, skip to the next bookshelf
} }
} }
@@ -28,6 +28,7 @@ public final class WizardrySounds {
public static final SoundEvent BLOCK_ARCANE_WORKBENCH_SPELLBIND = createSound("block.arcane_workbench.bind_spell"); public static final SoundEvent BLOCK_ARCANE_WORKBENCH_SPELLBIND = createSound("block.arcane_workbench.bind_spell");
public static final SoundEvent BLOCK_PEDESTAL_ACTIVATE = createSound("block.pedestal.activate"); public static final SoundEvent BLOCK_PEDESTAL_ACTIVATE = createSound("block.pedestal.activate");
public static final SoundEvent BLOCK_PEDESTAL_CONQUER = createSound("block.pedestal.conquer"); public static final SoundEvent BLOCK_PEDESTAL_CONQUER = createSound("block.pedestal.conquer");
public static final SoundEvent BLOCK_LECTERN_LOCATE_SPELL = createSound("block.lectern.locate_spell");
public static final SoundEvent ITEM_WAND_SWITCH_SPELL = createSound("item.wand.switch_spell"); public static final SoundEvent ITEM_WAND_SWITCH_SPELL = createSound("item.wand.switch_spell");
public static final SoundEvent ITEM_WAND_LEVELUP = createSound("item.wand.levelup"); public static final SoundEvent ITEM_WAND_LEVELUP = createSound("item.wand.levelup");
@@ -154,6 +155,7 @@ public final class WizardrySounds {
event.getRegistry().register(BLOCK_ARCANE_WORKBENCH_SPELLBIND); event.getRegistry().register(BLOCK_ARCANE_WORKBENCH_SPELLBIND);
event.getRegistry().register(BLOCK_PEDESTAL_ACTIVATE); event.getRegistry().register(BLOCK_PEDESTAL_ACTIVATE);
event.getRegistry().register(BLOCK_PEDESTAL_CONQUER); event.getRegistry().register(BLOCK_PEDESTAL_CONQUER);
event.getRegistry().register(BLOCK_LECTERN_LOCATE_SPELL);
event.getRegistry().register(ITEM_WAND_SWITCH_SPELL); event.getRegistry().register(ITEM_WAND_SWITCH_SPELL);
event.getRegistry().register(ITEM_WAND_LEVELUP); event.getRegistry().register(ITEM_WAND_LEVELUP);
@@ -2,6 +2,7 @@
"block.arcane_workbench.bind_spell": {"category": "blocks", "sounds": ["ebwizardry:spellbind"]}, "block.arcane_workbench.bind_spell": {"category": "blocks", "sounds": ["ebwizardry:spellbind"]},
"block.pedestal.activate": {"category": "blocks", "sounds": ["mob/evocation_illager/prepare_summon"]}, "block.pedestal.activate": {"category": "blocks", "sounds": ["mob/evocation_illager/prepare_summon"]},
"block.pedestal.conquer": {"category": "blocks", "sounds": ["ui/toast/challenge_complete"]}, "block.pedestal.conquer": {"category": "blocks", "sounds": ["ui/toast/challenge_complete"]},
"block.lectern.locate_spell": {"category": "blocks", "sounds": ["ebwizardry:conjure"]},
"item.wand.switch_spell": {"category": "player", "sounds": ["ebwizardry:select"]}, "item.wand.switch_spell": {"category": "player", "sounds": ["ebwizardry:select"]},
"item.wand.levelup": {"category": "player", "sounds": ["random/levelup"]}, "item.wand.levelup": {"category": "player", "sounds": ["random/levelup"]},