Skip to content

Commit

Permalink
Added Rule: movingBlocksDestroyPathFix
Browse files Browse the repository at this point in the history
  • Loading branch information
FxMorin committed Jul 6, 2021
1 parent c20004d commit 87186be
Show file tree
Hide file tree
Showing 4 changed files with 44 additions and 2 deletions.
10 changes: 9 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -273,11 +273,19 @@ Fixes Explosions being able to destroy item frames in water
* Type: `boolean`
* Default value: `false`
* Required options: `false`,`true`
* Categories: `CARPETFIXES`,`BUGFIX`,`EXPERIMENTAL`
* Categories: `CARPETFIXES`,`BUGFIX`
* Fixes: [MC-3697](https://bugs.mojang.com/browse/MC-3697)
* Additional notes:
* Only doing so for Item Frames

## movingBlocksDestroyPathFix
Fixes Moving Blocks from destroying path blocks
* Type: `boolean`
* Default value: `false`
* Required options: `false`,`true`
* Categories: `CARPETFIXES`,`BUGFIX`
* Fixes: [MC-161026](https://bugs.mojang.com/browse/MC-161026)

## drownedEnchantedTridentsFix
Makes enchantments work on tridents thrown by drowned
* Type: `boolean`
Expand Down
10 changes: 9 additions & 1 deletion src/main/java/carpetfixes/CarpetFixesSettings.java
Original file line number Diff line number Diff line change
Expand Up @@ -331,10 +331,18 @@ public enum PresetSettings {
@Rule(
desc = "Fixes Explosions being able to destroy item frames in water",
extra = "Fixes [MC-3697](https://bugs.mojang.com/browse/MC-3697)",
category = {CARPETFIXES,BUGFIX,EXPERIMENTAL}
category = {CARPETFIXES,BUGFIX}
)
public static boolean explosionBreaksItemFrameInWaterFix = false;

//by FX - PR0CESS
@Rule(
desc = "Fixes Moving Blocks from destroying path blocks",
extra = "Fixes [MC-161026](https://bugs.mojang.com/browse/MC-161026)",
category = {CARPETFIXES,BUGFIX}
)
public static boolean movingBlocksDestroyPathFix = false;

/*
BACKPORTS
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
package carpetfixes.mixins.blockFixes;

import carpetfixes.CarpetFixesSettings;
import net.minecraft.block.BlockState;
import net.minecraft.block.DirtPathBlock;
import net.minecraft.block.FenceGateBlock;
import net.minecraft.block.PistonExtensionBlock;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.WorldView;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;

@Mixin(DirtPathBlock.class)
public class DirtPathBlock_movingBlockMixin {

@Inject(method= "canPlaceAt(Lnet/minecraft/block/BlockState;Lnet/minecraft/world/WorldView;Lnet/minecraft/util/math/BlockPos;)Z",at=@At("HEAD"),cancellable = true)
public void canPlaceAt(BlockState state, WorldView world, BlockPos pos, CallbackInfoReturnable<Boolean> cir) {
if (CarpetFixesSettings.movingBlocksDestroyPathFix) {
BlockState blockState = world.getBlockState(pos.up());
cir.setReturnValue(!blockState.getMaterial().isSolid() || blockState.getBlock() instanceof FenceGateBlock || blockState.getBlock() instanceof PistonExtensionBlock);
}
}
}
1 change: 1 addition & 0 deletions src/main/resources/carpetfixes.mixins.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
"mixins": [
"backports.AbstractFireBlock_flintAndSteelMixin",
"backports.PlayerManager_LlamaRidingDupeMixin",
"blockFixes.DirtPathBlock_movingBlockMixin",
"blockFixes.LightningRodBlock_PermanentlyPoweredMixin",
"blockFixes.PowderSnowBlock_centerCollisionMixin",
"blockFixes.SlimeBlock_incorrectLogicMixin",
Expand Down

0 comments on commit 87186be

Please sign in to comment.