mirror of
https://github.com/MinecraftForge/MinecraftForge.git
synced 2026-11-20 12:20:11 +00:00
* ForgeGradle 6, Gradle 8.4, ASM 9.6 * Apply official mappings to patches (still using MCP classnames) * Remove reference to SpecialSource in reobfJar-like tasks * Backport modern MDK * Rename TransformationMatrix methods to prevent reobf, add back vanilla name via coremod
33 lines
1.8 KiB
Diff
33 lines
1.8 KiB
Diff
--- a/net/minecraft/block/NoteBlock.java
|
|
+++ b/net/minecraft/block/NoteBlock.java
|
|
@@ -50,7 +_,7 @@
|
|
}
|
|
|
|
private void playNote(World p_196482_1_, BlockPos p_196482_2_) {
|
|
- if (p_196482_1_.getBlockState(p_196482_2_.above()).isAir()) {
|
|
+ if (p_196482_1_.isEmptyBlock(p_196482_2_.above())) {
|
|
p_196482_1_.blockEvent(p_196482_2_, this, 0, 0);
|
|
}
|
|
|
|
@@ -60,7 +_,9 @@
|
|
if (p_225533_2_.isClientSide) {
|
|
return ActionResultType.SUCCESS;
|
|
} else {
|
|
- p_225533_1_ = p_225533_1_.cycle(NOTE);
|
|
+ int _new = net.minecraftforge.common.ForgeHooks.onNoteChange(p_225533_2_, p_225533_3_, p_225533_1_, p_225533_1_.getValue(NOTE), p_225533_1_.cycle(NOTE).getValue(NOTE));
|
|
+ if (_new == -1) return ActionResultType.FAIL;
|
|
+ p_225533_1_ = p_225533_1_.setValue(NOTE, _new);
|
|
p_225533_2_.setBlock(p_225533_3_, p_225533_1_, 3);
|
|
this.playNote(p_225533_2_, p_225533_3_);
|
|
p_225533_4_.awardStat(Stats.TUNE_NOTEBLOCK);
|
|
@@ -76,6 +_,9 @@
|
|
}
|
|
|
|
public boolean triggerEvent(BlockState p_189539_1_, World p_189539_2_, BlockPos p_189539_3_, int p_189539_4_, int p_189539_5_) {
|
|
+ net.minecraftforge.event.world.NoteBlockEvent.Play e = new net.minecraftforge.event.world.NoteBlockEvent.Play(p_189539_2_, p_189539_3_, p_189539_1_, p_189539_1_.getValue(NOTE), p_189539_1_.getValue(INSTRUMENT));
|
|
+ if (net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(e)) return false;
|
|
+ p_189539_1_ = p_189539_1_.setValue(NOTE, e.getVanillaNoteId()).setValue(INSTRUMENT, e.getInstrument());
|
|
int i = p_189539_1_.getValue(NOTE);
|
|
float f = (float)Math.pow(2.0D, (double)(i - 12) / 12.0D);
|
|
p_189539_2_.playSound((PlayerEntity)null, p_189539_3_, p_189539_1_.getValue(INSTRUMENT).getSoundEvent(), SoundCategory.RECORDS, 3.0F, f);
|