Skip to content

Commit

Permalink
Fix #229: shulker boxes destruction sound.
Browse files Browse the repository at this point in the history
Overriding playerWillDestroy and not calling the super prevented the
correct level event from being fired; this should fix it.
  • Loading branch information
noobanidus committed Jan 25, 2024
1 parent e274129 commit 81251ce
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -97,15 +97,7 @@ public InteractionResult use(BlockState pState, Level pLevel, BlockPos pPos, Pla

@Override
public void playerWillDestroy(Level pLevel, BlockPos pPos, BlockState pState, Player pPlayer) {
BlockEntity blockentity = pLevel.getBlockEntity(pPos);
/* if (blockentity instanceof LootrShulkerBlockEntity) {
if (!pLevel.isClientSide) {
ItemEntity itementity = new ItemEntity(pLevel, pPos.getX() + 0.5, pPos.getY() + 0.5, pPos.getZ() + 0.5, new ItemStack(Items.SHULKER_BOX));
itementity.setDefaultPickUpDelay();
pLevel.addFreshEntity(itementity);
}
}*/

this.spawnDestroyParticles(pLevel, pPlayer, pPos, pState);
if (pState.is(BlockTags.GUARDED_BY_PIGLINS)) {
PiglinAi.angerNearbyPiglins(pPlayer, false);
}
Expand Down
3 changes: 2 additions & 1 deletion src/main/java/noobanidus/mods/lootr/init/ModBlocks.java
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import net.minecraft.world.level.block.SoundType;
import net.minecraft.world.level.block.entity.BlockEntity;
import net.minecraft.world.level.block.state.BlockBehaviour;
import net.minecraft.world.level.material.PushReaction;
import net.minecraftforge.eventbus.api.IEventBus;
import net.minecraftforge.registries.DeferredRegister;
import net.minecraftforge.registries.ForgeRegistries;
Expand All @@ -30,7 +31,7 @@ public class ModBlocks {
public static final RegistryObject<LootrChestBlock> CHEST = REGISTER.register("lootr_chest", () -> new LootrChestBlock(BlockBehaviour.Properties.copy(Blocks.BARREL).strength(2.5f)));
public static final RegistryObject<LootrTrappedChestBlock> TRAPPED_CHEST = REGISTER.register("lootr_trapped_chest", () -> new LootrTrappedChestBlock(BlockBehaviour.Properties.copy(Blocks.TRAPPED_CHEST).strength(2.5f)));
public static final RegistryObject<LootrInventoryBlock> INVENTORY = REGISTER.register("lootr_inventory", () -> new LootrInventoryBlock(Block.Properties.of().strength(2.5f).sound(SoundType.WOOD)));
public static final RegistryObject<LootrShulkerBlock> SHULKER = REGISTER.register("lootr_shulker", () -> new LootrShulkerBlock(Block.Properties.of().strength(2.5f).dynamicShape().noOcclusion().isSuffocating(posPredicate).isViewBlocking(posPredicate)));
public static final RegistryObject<LootrShulkerBlock> SHULKER = REGISTER.register("lootr_shulker", () -> new LootrShulkerBlock(BlockBehaviour.Properties.of().strength(2.5f).dynamicShape().noOcclusion().forceSolidOn().pushReaction(PushReaction.DESTROY).isSuffocating(posPredicate).isViewBlocking(posPredicate)));
public static final RegistryObject<Block> TROPHY = REGISTER.register("trophy", () -> new TrophyBlock(Block.Properties.of().strength(15f).sound(SoundType.METAL).noOcclusion().lightLevel((o) -> 15)));

public static void register (IEventBus bus) {
Expand Down

0 comments on commit 81251ce

Please sign in to comment.