Merge branch 'pr/6467' into mc1.18/dev

This commit is contained in:
simibubi 2024-07-16 19:03:15 +02:00
commit f67341df7e
2 changed files with 26 additions and 15 deletions

View file

@ -205,14 +205,18 @@ dependencies {
// runtimeOnly fg.deobf("maven.modrinth:rubidium:0.5.3")
// implementation fg.deobf("com.railwayteam.railways:railways-1.18.2-1.1.1:all") { transitive = false }
// runtimeOnly fg.deobf("maven.modrinth:spark:1.10.38-forge")
//runtimeOnly fg.deobf("curse.maven:forbidden-arcanus-309858:4729924")
//runtimeOnly fg.deobf("curse.maven:valhelsia-core-416935:3886212")
// runtimeOnly fg.deobf("curse.maven:forbidden-arcanus-309858:4729924")
// runtimeOnly fg.deobf("curse.maven:valhelsia-core-416935:3886212")
// implementation fg.deobf("curse.maven:modern-ui-352491:5229350")
// runtimeOnly fg.deobf("curse.maven:sophisticated-storage-619320:5194748")
// runtimeOnly fg.deobf("curse.maven:sophisticated-core-618298:5296312")
// runtimeOnly fg.deobf("curse.maven:functional-storage-556861:5271589")
// runtimeOnly fg.deobf("curse.maven:titanium-287342:5151207")
// runtimeOnly fg.deobf("curse.maven:storage-drawers-223852:3807626")
// runtimeOnly fg.deobf("curse.maven:sophisticated-storage-619320:5194748")
// runtimeOnly fg.deobf("curse.maven:sophisticated-core-618298:5296312")
// runtimeOnly fg.deobf("curse.maven:functional-storage-556861:5271589")
// runtimeOnly fg.deobf("curse.maven:titanium-287342:5151207")
// runtimeOnly fg.deobf("curse.maven:storage-drawers-223852:3807626")
// implementation fg.deobf("curse.maven:ftb-chunks-forge-314906:4494633")
// implementation fg.deobf("curse.maven:architectury-api-419699:4521465")
// implementation fg.deobf("curse.maven:ftb-library-forge-404465:4396792")
// implementation fg.deobf("curse.maven:ftb-teams-forge-404468:4579981")
// https://discord.com/channels/313125603924639766/725850371834118214/910619168821354497
// Prevent Mixin annotation processor from getting into IntelliJ's annotation processor settings

View file

@ -22,6 +22,8 @@ import net.minecraft.world.level.Level;
import net.minecraft.world.level.block.Block;
import net.minecraft.world.level.block.entity.BlockEntity;
import net.minecraft.world.level.block.state.BlockState;
import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.event.world.BlockEvent;
public interface IWrenchable {
@ -55,14 +57,19 @@ public interface IWrenchable {
BlockPos pos = context.getClickedPos();
Player player = context.getPlayer();
if (world instanceof ServerLevel) {
if (player != null && !player.isCreative())
Block.getDrops(state, (ServerLevel) world, pos, world.getBlockEntity(pos), player, context.getItemInHand())
.forEach(itemStack -> {
player.getInventory().placeItemBackInInventory(itemStack);
});
state.spawnAfterBreak((ServerLevel) world, pos, ItemStack.EMPTY);
world.destroyBlock(pos, false);
playRemoveSound(world, pos);
BlockEvent.BreakEvent event = new BlockEvent.BreakEvent(world, pos, world.getBlockState(pos), player);
MinecraftForge.EVENT_BUS.post(event);
if (!event.isCanceled()) {
if (player != null && !player.isCreative()) {
Block.getDrops(state, (ServerLevel) world, pos, world.getBlockEntity(pos), player, context.getItemInHand())
.forEach(itemStack -> {
player.getInventory().placeItemBackInInventory(itemStack);
});
}
state.spawnAfterBreak((ServerLevel) world, pos, ItemStack.EMPTY);
world.destroyBlock(pos, false);
playRemoveSound(world, pos);
}
}
return InteractionResult.SUCCESS;
}