qc
This commit is contained in:
1 parent
34dbe99940
commit
a514a5410b
5 files changed
+64
-8
No files matched your search
@@ -0,0 +1,25 @@
|
|||||||
|
package carpet.mixins;
|
||||||
|
|
||||||
|
import carpet.settings.CarpetSettings;
|
||||||
|
import net.minecraft.block.DispenserBlock;
|
||||||
|
import net.minecraft.util.math.BlockPos;
|
||||||
|
import net.minecraft.world.World;
|
||||||
|
import org.spongepowered.asm.mixin.Mixin;
|
||||||
|
import org.spongepowered.asm.mixin.injection.At;
|
||||||
|
import org.spongepowered.asm.mixin.injection.Redirect;
|
||||||
|
|
||||||
|
@Mixin(DispenserBlock.class)
|
||||||
|
public class DispenserBlock_qcMixin
|
||||||
|
{
|
||||||
|
@Redirect(method = "neighborUpdate", at = @At(
|
||||||
|
value = "INVOKE",
|
||||||
|
target = "Lnet/minecraft/world/World;isReceivingRedstonePower(Lnet/minecraft/util/math/BlockPos;)Z",
|
||||||
|
ordinal = 1
|
||||||
|
))
|
||||||
|
private boolean checkUpPower(World world, BlockPos blockPos_1)
|
||||||
|
{
|
||||||
|
if (!CarpetSettings.quasiConnectivity)
|
||||||
|
return false;
|
||||||
|
return world.isReceivingRedstonePower(blockPos_1);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,29 @@
|
|||||||
|
package carpet.mixins;
|
||||||
|
|
||||||
|
import carpet.settings.CarpetSettings;
|
||||||
|
import net.minecraft.block.PistonBlock;
|
||||||
|
import net.minecraft.util.math.BlockPos;
|
||||||
|
import net.minecraft.util.math.Direction;
|
||||||
|
import net.minecraft.world.World;
|
||||||
|
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(PistonBlock.class)
|
||||||
|
public class PistonBlock_qcMixin
|
||||||
|
{
|
||||||
|
@Inject(method = "shouldExtend", cancellable = true, at = @At(
|
||||||
|
value = "INVOKE",
|
||||||
|
target = "Lnet/minecraft/util/math/BlockPos;up()Lnet/minecraft/util/math/BlockPos;"
|
||||||
|
))
|
||||||
|
private void cancelUpCheck(World world_1, BlockPos blockPos_1, Direction direction_1, CallbackInfoReturnable<Boolean> cir)
|
||||||
|
{
|
||||||
|
if (!CarpetSettings.quasiConnectivity)
|
||||||
|
{
|
||||||
|
cir.setReturnValue(false);
|
||||||
|
cir.cancel();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -121,7 +121,7 @@ public class CarpetSettings
|
|||||||
)
|
)
|
||||||
public static boolean antiCheatSpeed = false;
|
public static boolean antiCheatSpeed = false;
|
||||||
|
|
||||||
@Rule(desc = "Pistons, droppers and dispensers react if block above them is powered", category = CREATIVE, validate = Validator.WIP.class)
|
@Rule(desc = "Pistons, droppers and dispensers react if block above them is powered", category = CREATIVE)
|
||||||
public static boolean quasiConnectivity = true;
|
public static boolean quasiConnectivity = true;
|
||||||
|
|
||||||
@Rule(
|
@Rule(
|
||||||
@@ -315,6 +315,10 @@ public class CarpetSettings
|
|||||||
{
|
{
|
||||||
@Override public Integer validate(ServerCommandSource source, ParsedRule<Integer> currentRule, Integer newValue, String string)
|
@Override public Integer validate(ServerCommandSource source, ParsedRule<Integer> currentRule, Integer newValue, String string)
|
||||||
{
|
{
|
||||||
|
if (currentRule.get().equals(newValue))
|
||||||
|
{
|
||||||
|
return newValue;
|
||||||
|
}
|
||||||
if (newValue < 0 || newValue > 32)
|
if (newValue < 0 || newValue > 32)
|
||||||
{
|
{
|
||||||
Messenger.m(source, "r view distance has to be between 0 and 32");
|
Messenger.m(source, "r view distance has to be between 0 and 32");
|
||||||
@@ -349,13 +353,11 @@ public class CarpetSettings
|
|||||||
|
|
||||||
private static class DisableSpawnChunksValidator extends Validator<Boolean> {
|
private static class DisableSpawnChunksValidator extends Validator<Boolean> {
|
||||||
@Override public Boolean validate(ServerCommandSource source, ParsedRule<Boolean> currentRule, Boolean newValue, String string) {
|
@Override public Boolean validate(ServerCommandSource source, ParsedRule<Boolean> currentRule, Boolean newValue, String string) {
|
||||||
if (currentRule.get() == newValue)
|
if (currentRule.get().booleanValue() == newValue.booleanValue())
|
||||||
{
|
{
|
||||||
//must been some startup thing
|
//must been some startup thing
|
||||||
return newValue;
|
return newValue;
|
||||||
}
|
}
|
||||||
if (!newValue)
|
|
||||||
Messenger.m(source, "w Spawn chunks re-enabled. Visit spawn to load them?");
|
|
||||||
ServerWorld overworld = CarpetServer.minecraft_server.getWorld(DimensionType.OVERWORLD);
|
ServerWorld overworld = CarpetServer.minecraft_server.getWorld(DimensionType.OVERWORLD);
|
||||||
if (overworld != null) {
|
if (overworld != null) {
|
||||||
ChunkPos centerChunk = new ChunkPos(overworld.getSpawnPos());
|
ChunkPos centerChunk = new ChunkPos(overworld.getSpawnPos());
|
||||||
|
|||||||
@@ -78,10 +78,7 @@ public class SettingsManager
|
|||||||
|
|
||||||
public static Collection<ParsedRule<?>> getRules()
|
public static Collection<ParsedRule<?>> getRules()
|
||||||
{
|
{
|
||||||
CarpetSettings.LOG.error("grabbing rules");
|
return rules.values().stream().sorted().collect(Collectors.toList());
|
||||||
List<ParsedRule<?>> r = rules.values().stream().sorted().collect(Collectors.toList());
|
|
||||||
CarpetSettings.LOG.error("Got: "+r.size()+" rules");
|
|
||||||
return r;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public Collection<ParsedRule<?>> findStartupOverrides()
|
public Collection<ParsedRule<?>> findStartupOverrides()
|
||||||
|
|||||||
@@ -88,6 +88,9 @@
|
|||||||
"InfestedBlockMixin",
|
"InfestedBlockMixin",
|
||||||
"PlayerEntityMixin",
|
"PlayerEntityMixin",
|
||||||
|
|
||||||
|
"PistonBlock_qcMixin",
|
||||||
|
"DispenserBlock_qcMixin",
|
||||||
|
|
||||||
"PistonBlock_movableTEMixin",
|
"PistonBlock_movableTEMixin",
|
||||||
"PistonBlockEntity_movableTEMixin",
|
"PistonBlockEntity_movableTEMixin",
|
||||||
"World_movableTEMixin",
|
"World_movableTEMixin",
|
||||||
|
|||||||
Reference in new issue
Block a user