Allow setting qc range with quasiConnectivity setting (#1617)
* add quasiConnectivityRange setting * make sure qc range respects different world heights * check if source == null in qc range validator * merge the two qc settings * Set minimum range down to zero (no qc)
This commit is contained in:
1 parent
f2c658bf03
commit
0e2f6df4d3
4 files changed
+86
-34
No files matched your search
@@ -1,29 +1,29 @@
|
||||
package carpet.mixins;
|
||||
|
||||
import carpet.CarpetSettings;
|
||||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.core.Direction;
|
||||
import net.minecraft.world.level.Level;
|
||||
import net.minecraft.world.level.block.piston.PistonBaseBlock;
|
||||
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;
|
||||
|
||||
import carpet.helpers.QuasiConnectivity;
|
||||
|
||||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.core.Direction;
|
||||
import net.minecraft.world.level.Level;
|
||||
import net.minecraft.world.level.block.piston.PistonBaseBlock;
|
||||
|
||||
@Mixin(PistonBaseBlock.class)
|
||||
public class PistonBaseBlock_qcMixin
|
||||
{
|
||||
@Inject(method = "getNeighborSignal", cancellable = true, at = @At(
|
||||
public class PistonBaseBlock_qcMixin {
|
||||
|
||||
@Inject(
|
||||
method = "getNeighborSignal",
|
||||
cancellable = true,
|
||||
at = @At(
|
||||
value = "INVOKE",
|
||||
target = "Lnet/minecraft/core/BlockPos;above()Lnet/minecraft/core/BlockPos;"
|
||||
))
|
||||
private void cancelUpCheck(Level world_1, BlockPos blockPos_1, Direction direction_1, CallbackInfoReturnable<Boolean> cir)
|
||||
{
|
||||
if (!CarpetSettings.quasiConnectivity)
|
||||
{
|
||||
cir.setReturnValue(false);
|
||||
cir.cancel();
|
||||
}
|
||||
)
|
||||
)
|
||||
private void carpet_checkQuasiSignal(Level level, BlockPos pos, Direction facing, CallbackInfoReturnable<Boolean> cir) {
|
||||
cir.setReturnValue(QuasiConnectivity.hasQuasiSignal(level, pos));
|
||||
}
|
||||
|
||||
}
|
||||
Reference in new issue
Block a user