Fix DoublePlantBlock dupe using deployers

This commit is contained in:
reidbhuntley 2021-05-23 00:16:01 -04:00
parent 73895604c8
commit 5ec8312322
4 changed files with 25 additions and 6 deletions

View file

@ -1652,7 +1652,7 @@ d080b1b25e5bc8baf5aee68691b08c7f12ece3b0 assets/create/models/item/windmill_bear
a80fb25a0b655e76be986b5b49fcb0f03461a1ab assets/create/models/item/zinc_nugget.json
b1689617190c05ef34bd18456b0c7ae09bb3210f assets/create/models/item/zinc_ore.json
096382a4c025b5ffdde9c496ee9da0d5345fbe17 assets/create/sounds.json
5d0cc4c0255dc241e61c173b31ddca70c88d08e4 data/create/advancements/aesthetics.json
0f1b4b980afba9bf2caf583b88e261bba8b10313 data/create/advancements/aesthetics.json
187921fa131b06721bfaf63f2623a28c141aae9a data/create/advancements/andesite_alloy.json
0ea2db7173b5be28b289ea7c9a6a0cf5805c60c7 data/create/advancements/andesite_casing.json
83c046bd200623933545c9e4326f782fb02c87fa data/create/advancements/arm_blaze_burner.json
@ -3645,7 +3645,7 @@ d3fdb8ece6cb072a93ddb64a0baad5ac952117a4 data/create/recipes/weathered_limestone
0f3c993eb6dd3f37953f304b8fad15bf60469ef4 data/create/recipes/weathered_limestone_cobblestone_wall_from_weathered_limestone_cobblestone_stonecutting.json
6eceb25fabbb6b389ca35de3b829ad061c9c456a data/create/recipes/weathered_limestone_pillar.json
11667414f73bc2d00bda7c5c1a7d2934bf6e9165 data/create/recipes/weathered_limestone_pillar_from_weathered_limestone_stonecutting.json
20c20a12b0baff2ba493b1405db7d2d8a15b81af data/create/tags/blocks/brittle.json
d7fe46e7d00e47294f9e0e7c2c0070e86c88a606 data/create/tags/blocks/brittle.json
330bfb3850ba3964b10b1bccbc3cbb9b012cae54 data/create/tags/blocks/fan_heaters.json
3bc64e3a1e7980237435b1770a9ba2102d57fcd4 data/create/tags/blocks/fan_transparent.json
74700d556ca80c7a1db5fd4efb09c3ddb26cad66 data/create/tags/blocks/non_movable.json

View file

@ -28,8 +28,8 @@
"trigger": "create:bracket_apply",
"conditions": {
"accepted_entries": [
"create:large_cogwheel",
"create:cogwheel"
"create:cogwheel",
"create:large_cogwheel"
]
}
},

View file

@ -20,6 +20,7 @@
"create:green_valve_handle",
"create:red_valve_handle",
"create:black_valve_handle",
"create:gantry_carriage",
"create:rope",
"create:pulley_magnet",
"create:furnace_engine",

View file

@ -8,6 +8,10 @@ import java.util.List;
import javax.annotation.Nullable;
import net.minecraft.block.DoublePlantBlock;
import net.minecraft.state.properties.DoubleBlockHalf;
import org.apache.commons.lang3.tuple.Pair;
import com.google.common.collect.Multimap;
@ -349,8 +353,22 @@ public class DeployerHandler {
prevHeldItem.onBlockDestroyed(world, blockstate, pos, player);
if (prevHeldItem.isEmpty() && !heldItem.isEmpty())
net.minecraftforge.event.ForgeEventFactory.onPlayerDestroyItem(player, heldItem, Hand.MAIN_HAND);
if (!blockstate.removedByPlayer(world, pos, player, canHarvest, world.getFluidState(pos)))
return true;
BlockPos posUp = pos.up();
BlockState stateUp = world.getBlockState(posUp);
if (blockstate.getBlock() instanceof DoublePlantBlock
&& blockstate.get(DoublePlantBlock.HALF) == DoubleBlockHalf.LOWER
&& stateUp.getBlock() == blockstate.getBlock()
&& stateUp.get(DoublePlantBlock.HALF) == DoubleBlockHalf.UPPER
) {
// hack to prevent DoublePlantBlock from dropping a duplicate item
world.setBlockState(pos, Blocks.AIR.getDefaultState(), 35);
world.setBlockState(posUp, Blocks.AIR.getDefaultState(), 35);
} else {
if (!blockstate.removedByPlayer(world, pos, player, canHarvest, world.getFluidState(pos)))
return true;
}
blockstate.getBlock()
.onPlayerDestroy(world, pos, blockstate);