Merge branch '1.17' of https://github.com/gnembon/fabric-carpet into 1.17
This commit is contained in:
commit
2cc2101934
4 files changed
+68
No files matched your search
@@ -723,6 +723,12 @@ public class CarpetSettings
|
||||
)
|
||||
public static boolean renewableBlackstone = false;
|
||||
|
||||
@Rule(
|
||||
desc = "Lava and water generate deepslate and cobbled deepslate instead below y0",
|
||||
category = FEATURE
|
||||
)
|
||||
public static boolean renewableDeepslate = false;
|
||||
|
||||
@Rule(desc = "fixes block placement rotation issue when player rotates quickly while placing blocks", category = BUGFIX)
|
||||
public static boolean placementRotationFix = false;
|
||||
|
||||
|
||||
@@ -0,0 +1,30 @@
|
||||
package carpet.mixins;
|
||||
|
||||
import carpet.CarpetSettings;
|
||||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.block.Blocks;
|
||||
import net.minecraft.block.FluidBlock;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraft.world.WorldAccess;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.Shadow;
|
||||
import org.spongepowered.asm.mixin.injection.At;
|
||||
import org.spongepowered.asm.mixin.injection.Inject;
|
||||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
|
||||
|
||||
@Mixin(FluidBlock.class)
|
||||
public abstract class FluidBlock_renewableDeepslateMixin {
|
||||
|
||||
@Shadow protected abstract void playExtinguishSound(WorldAccess world, BlockPos pos);
|
||||
|
||||
@Inject(method = "receiveNeighborFluids", at = @At(value = "INVOKE",target = "Lnet/minecraft/fluid/FluidState;isStill()Z"), cancellable = true)
|
||||
private void receiveFluidToDeepslate(World world, BlockPos pos, BlockState state, CallbackInfoReturnable<Boolean> cir) {
|
||||
if(CarpetSettings.renewableDeepslate && !world.getFluidState(pos).isStill() && pos.getY() < 0 && world.getRegistryKey() == World.OVERWORLD ) {
|
||||
world.setBlockState(pos, Blocks.COBBLED_DEEPSLATE.getDefaultState());
|
||||
this.playExtinguishSound(world, pos);
|
||||
cir.setReturnValue(false);
|
||||
cir.cancel();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,30 @@
|
||||
package carpet.mixins;
|
||||
|
||||
import carpet.CarpetSettings;
|
||||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.block.Blocks;
|
||||
import net.minecraft.fluid.FluidState;
|
||||
import net.minecraft.fluid.LavaFluid;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.math.Direction;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraft.world.WorldAccess;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.Shadow;
|
||||
import org.spongepowered.asm.mixin.injection.At;
|
||||
import org.spongepowered.asm.mixin.injection.Inject;
|
||||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
|
||||
|
||||
@Mixin(LavaFluid.class)
|
||||
public abstract class LavaFluid_renewableDeepslateMixin {
|
||||
@Shadow protected abstract void playExtinguishEvent(WorldAccess world, BlockPos pos);
|
||||
|
||||
@Inject(method = "flow", at = @At(value = "INVOKE", target = "Lnet/minecraft/block/Block;getDefaultState()Lnet/minecraft/block/BlockState;"), cancellable = true)
|
||||
private void generateDeepslate(WorldAccess world, BlockPos pos, BlockState state, Direction direction, FluidState fluidState, CallbackInfo ci) {
|
||||
if(CarpetSettings.renewableDeepslate && pos.getY() < 0 && ((World)world).getRegistryKey() == World.OVERWORLD) {
|
||||
world.setBlockState(pos, Blocks.DEEPSLATE.getDefaultState(), 3);
|
||||
this.playExtinguishEvent(world, pos);
|
||||
ci.cancel();
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user