Skip to content

Commit

Permalink
Fix Mattock not saving contents of Shulker Boxes when mined #2411.
Browse files Browse the repository at this point in the history
  • Loading branch information
Lothrazar committed Oct 18, 2024
1 parent e224acc commit db65e00
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 12 deletions.
15 changes: 4 additions & 11 deletions src/main/java/com/lothrazar/cyclic/item/equipment/MattockItem.java
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
import net.minecraft.item.Items;
import net.minecraft.item.ToolItem;
import net.minecraft.network.play.server.SChangeBlockPacket;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.Direction;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.BlockRayTraceResult;
Expand Down Expand Up @@ -70,20 +69,14 @@ else if (sideHit == Direction.EAST || sideHit == Direction.WEST) {
Block blockCurrent = bsCurrent.getBlock();
if (world.isRemote) {
world.playEvent(2001, posCurrent, Block.getStateId(bsCurrent));
if (blockCurrent.removedByPlayer(bsCurrent, world, posCurrent, player, true, bsCurrent.getFluidState())) {
blockCurrent.onPlayerDestroy(world, posCurrent, bsCurrent);
}
// stack.onBlockDestroyed(world, bsCurrent, posCurrent, player);//update tool damage
}
else if (player instanceof ServerPlayerEntity) { //Server side, so this works
ServerPlayerEntity mp = (ServerPlayerEntity) player;
int xpGivenOnDrop = ForgeHooks.onBlockBreakEvent(world, ((ServerPlayerEntity) player).interactionManager.getGameType(), (ServerPlayerEntity) player, posCurrent);
int xpGivenOnDrop = ForgeHooks.onBlockBreakEvent(world, ((ServerPlayerEntity) player).interactionManager.getGameType(), mp, posCurrent);
if (xpGivenOnDrop >= 0) {
if (blockCurrent.removedByPlayer(bsCurrent, world, posCurrent, player, true, bsCurrent.getFluidState())
&& world instanceof ServerWorld) {
TileEntity tile = world.getTileEntity(posCurrent);
blockCurrent.onPlayerDestroy(world, posCurrent, bsCurrent);
blockCurrent.harvestBlock(world, player, posCurrent, bsCurrent, tile, stack);
// blockCurrent.onPlayerDestroy(world, posCurrent, bsCurrent);
blockCurrent.harvestBlock(world, player, posCurrent, bsCurrent, world.getTileEntity(posCurrent), stack);
if (blockCurrent.removedByPlayer(bsCurrent, world, posCurrent, player, true, bsCurrent.getFluidState()) && world instanceof ServerWorld) {
blockCurrent.dropXpOnBlockBreak((ServerWorld) world, posCurrent, xpGivenOnDrop);
}
mp.connection.sendPacket(new SChangeBlockPacket(world, posCurrent));
Expand Down
2 changes: 1 addition & 1 deletion update.json
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,6 @@
,"1.5.21":"#1933 Sack of Holding chest placement override added, with new config to revert back to legacy behavior if desired (overrideChestSingle). #2168 fix bug where ender shelf sometimes would not save contents when mined after exiting reloading world when client data desyncs. Added a percentage config and ignorelist config for cyclic:disarm enchantment (disarmPercentPerLevel, disarmIngoredMobs), resolves it dropping your copied weapon from alexsmobs:mimicube #2249. Fix #1878 layered and/or logic for multiple wireless transmitters on the same node "
,"1.5.22":"Fix #2351 advanced crafting stick not opening. "
,"1.5.23":"Growth enchantment now uses the same logic as Sprinkler & Terra Soil (only minecraft:crops or minecraft::saplings can grow, respect IGrowable::canUseBonemeal). New gloomIgnored config Gloom enchant (cyclic:curse) to ignore and not use these effects #2217 #2325. Fix Soundproofing block not muting Mekanism sounds #2389 (for example Precision Sawmill and others - you may need four or more soundproofing blocks for the desired effect). Patch an edge-case where User might drop items on the ground. New config [cyclic.blocks.soundproofing] radius = 6 to control the area. Fix item cable routing #2245 #2230. New config under [cyclic.blocks] wireless_transfer_dimensional = true allowing transfer nodes to connect across dimensions #1913. Balance recipe changes for #2372. Balance changes made for Excavate enchant it will no longer trigger if the tool is not 'mineable' effective for example axe on dirt. New feature for Excavate enchant #2116 it will not trigger on anything matching the block data-tag 'cyclic:ignored/excavate'. [Backported changes from mc1.20.1] #2182 candle model assets; Block Breaker no longer tries (and fails) to mine liquid source blocks; Block Randomizer use wireframe rendering only of non-air instead of solid shading; Glistering & Corrupted chorus only restores 1 food-unit down from 3; a few recipes tweaked/backported to match mc1.20.1+, ported crafttweaker zenscript support for generator_fluid and generator_item; backported item data tags for use in recipes for example forge:vines, forge:sandstone, forge:mushrooms "
,"1.5.24":"Fixed bug in the item cyclic:offset_scepter #2427. Tweaked block model visuals of the Transfer Nodes"
,"1.5.24":"Fixed bug in the item cyclic:offset_scepter #2427. Tweaked block model visuals of the Transfer Nodes. Fix Mattock not saving contents of Shulker Boxes when mined #2411. "
}
}

0 comments on commit db65e00

Please sign in to comment.