This commit is contained in:
gnembon committed 2019-06-22 14:50:55 -03:00
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;
@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;
@Rule(
@@ -315,6 +315,10 @@ public class CarpetSettings
{
@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)
{
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> {
@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
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);
if (overworld != null) {
ChunkPos centerChunk = new ChunkPos(overworld.getSpawnPos());
@@ -78,10 +78,7 @@ public class SettingsManager
public static Collection<ParsedRule<?>> getRules()
{
CarpetSettings.LOG.error("grabbing rules");
List<ParsedRule<?>> r = rules.values().stream().sorted().collect(Collectors.toList());
CarpetSettings.LOG.error("Got: "+r.size()+" rules");
return r;
return rules.values().stream().sorted().collect(Collectors.toList());
}
public Collection<ParsedRule<?>> findStartupOverrides()