11 files changed
+223
-1
No files matched your search
@@ -46,6 +46,8 @@ public class CarpetServer // static for now - easier to handle all around the co
|
|||||||
{
|
{
|
||||||
TickSpeed.tick(server);
|
TickSpeed.tick(server);
|
||||||
HUDController.update_hud(server);
|
HUDController.update_hud(server);
|
||||||
|
//in case something happens
|
||||||
|
CarpetSettings.impendingFillSkipUpdates = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void registerCarpetCommands(CommandDispatcher<ServerCommandSource> dispatcher)
|
public static void registerCarpetCommands(CommandDispatcher<ServerCommandSource> dispatcher)
|
||||||
|
|||||||
@@ -45,6 +45,7 @@ public class CarpetSettings
|
|||||||
|
|
||||||
public static final String[] default_tags = {"tnt","fix","survival","creative", "experimental","optimizations","feature","commands"}; //tab completion only
|
public static final String[] default_tags = {"tnt","fix","survival","creative", "experimental","optimizations","feature","commands"}; //tab completion only
|
||||||
public static boolean skipGenerationChecks = false;
|
public static boolean skipGenerationChecks = false;
|
||||||
|
public static boolean impendingFillSkipUpdates = false;
|
||||||
|
|
||||||
static {
|
static {
|
||||||
settings_store = new HashMap<>();
|
settings_store = new HashMap<>();
|
||||||
@@ -62,6 +63,7 @@ public class CarpetSettings
|
|||||||
public static boolean b_movableTileEntities = false;
|
public static boolean b_movableTileEntities = false;
|
||||||
public static boolean b_huskSpawningInTemples = false;
|
public static boolean b_huskSpawningInTemples = false;
|
||||||
public static boolean b_stackableShulkerBoxes = false;
|
public static boolean b_stackableShulkerBoxes = false;
|
||||||
|
public static boolean b_fillUpdates = true;
|
||||||
|
|
||||||
private static CarpetSettingEntry rule(String s1, String s2, String s3) { return CarpetSettingEntry.create(s1,s2,s3);}
|
private static CarpetSettingEntry rule(String s1, String s2, String s3) { return CarpetSettingEntry.create(s1,s2,s3);}
|
||||||
|
|
||||||
@@ -132,7 +134,7 @@ public class CarpetSettings
|
|||||||
rule("missingTools", "survival", "Pistons, Glass and Sponge can be broken faster with their appropriate tools"),
|
rule("missingTools", "survival", "Pistons, Glass and Sponge can be broken faster with their appropriate tools"),
|
||||||
rule("portalCaching", "survival experimental", "Alternative, persistent caching strategy for nether portals"),
|
rule("portalCaching", "survival experimental", "Alternative, persistent caching strategy for nether portals"),
|
||||||
rule("calmNetherFires", "experimental", "Permanent fires don't schedule random updates"),
|
rule("calmNetherFires", "experimental", "Permanent fires don't schedule random updates"),
|
||||||
rule("fillUpdates", "creative", "fill/clone/setblock and structure blocks cause block updates").defaultTrue(),
|
rule("fillUpdates", "creative", "fill/clone/setblock and structure blocks cause block updates").defaultTrue().boolAccelerate(),
|
||||||
rule("pushLimit", "creative","Customizable piston push limit")
|
rule("pushLimit", "creative","Customizable piston push limit")
|
||||||
.choices("12","10 12 14 100").setNotStrict().numAccelerate(),
|
.choices("12","10 12 14 100").setNotStrict().numAccelerate(),
|
||||||
rule("railPowerLimit", "creative", "Customizable powered rail power range")
|
rule("railPowerLimit", "creative", "Customizable powered rail power range")
|
||||||
|
|||||||
@@ -0,0 +1,31 @@
|
|||||||
|
package carpet.mixins;
|
||||||
|
|
||||||
|
import carpet.CarpetSettings;
|
||||||
|
import net.minecraft.block.Block;
|
||||||
|
import net.minecraft.server.command.CloneCommand;
|
||||||
|
import net.minecraft.server.world.ServerWorld;
|
||||||
|
import net.minecraft.util.math.BlockPos;
|
||||||
|
import org.spongepowered.asm.mixin.Mixin;
|
||||||
|
import org.spongepowered.asm.mixin.injection.At;
|
||||||
|
import org.spongepowered.asm.mixin.injection.Constant;
|
||||||
|
import org.spongepowered.asm.mixin.injection.ModifyConstant;
|
||||||
|
import org.spongepowered.asm.mixin.injection.Redirect;
|
||||||
|
|
||||||
|
|
||||||
|
@Mixin(CloneCommand.class)
|
||||||
|
public abstract class CloneCommandMixin
|
||||||
|
{
|
||||||
|
@ModifyConstant(method = "execute", constant = @Constant(intValue = 32768))
|
||||||
|
private static int fillLimit(int original) {
|
||||||
|
return CarpetSettings.getInt("fillLimit");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Redirect(method = "execute", at = @At(
|
||||||
|
value = "INVOKE",
|
||||||
|
target = "Lnet/minecraft/server/world/ServerWorld;updateNeighbors(Lnet/minecraft/util/math/BlockPos;Lnet/minecraft/block/Block;)V"
|
||||||
|
))
|
||||||
|
private static void conditionalUpdating(ServerWorld serverWorld, BlockPos blockPos_1, Block block_1)
|
||||||
|
{
|
||||||
|
if (CarpetSettings.b_fillUpdates) serverWorld.updateNeighbors(blockPos_1, block_1);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,6 +1,7 @@
|
|||||||
package carpet.mixins;
|
package carpet.mixins;
|
||||||
|
|
||||||
import carpet.CarpetServer;
|
import carpet.CarpetServer;
|
||||||
|
import carpet.CarpetSettings;
|
||||||
import com.mojang.brigadier.CommandDispatcher;
|
import com.mojang.brigadier.CommandDispatcher;
|
||||||
import net.minecraft.server.command.CommandManager;
|
import net.minecraft.server.command.CommandManager;
|
||||||
import net.minecraft.server.command.ServerCommandSource;
|
import net.minecraft.server.command.ServerCommandSource;
|
||||||
@@ -10,6 +11,7 @@ import org.spongepowered.asm.mixin.Shadow;
|
|||||||
import org.spongepowered.asm.mixin.injection.At;
|
import org.spongepowered.asm.mixin.injection.At;
|
||||||
import org.spongepowered.asm.mixin.injection.Inject;
|
import org.spongepowered.asm.mixin.injection.Inject;
|
||||||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
|
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
|
||||||
|
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
|
||||||
|
|
||||||
|
|
||||||
@Mixin(CommandManager.class)
|
@Mixin(CommandManager.class)
|
||||||
@@ -24,4 +26,17 @@ public abstract class CommandManagerMixin
|
|||||||
private void onRegister(boolean boolean_1, CallbackInfo ci) {
|
private void onRegister(boolean boolean_1, CallbackInfo ci) {
|
||||||
CarpetServer.registerCarpetCommands(this.dispatcher);
|
CarpetServer.registerCarpetCommands(this.dispatcher);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Inject(method = "execute", at = @At("HEAD"))
|
||||||
|
private void onExecuteBegin(ServerCommandSource serverCommandSource_1, String string_1, CallbackInfoReturnable<Integer> cir)
|
||||||
|
{
|
||||||
|
if (!CarpetSettings.b_fillUpdates)
|
||||||
|
CarpetSettings.impendingFillSkipUpdates = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Inject(method = "execute", at = @At("RETURN"))
|
||||||
|
private void onExecuteEnd(ServerCommandSource serverCommandSource_1, String string_1, CallbackInfoReturnable<Integer> cir)
|
||||||
|
{
|
||||||
|
CarpetSettings.impendingFillSkipUpdates = false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -0,0 +1,30 @@
|
|||||||
|
package carpet.mixins;
|
||||||
|
|
||||||
|
import carpet.CarpetSettings;
|
||||||
|
import net.minecraft.block.Block;
|
||||||
|
import net.minecraft.server.command.FillCommand;
|
||||||
|
import net.minecraft.server.world.ServerWorld;
|
||||||
|
import net.minecraft.util.math.BlockPos;
|
||||||
|
import org.spongepowered.asm.mixin.Mixin;
|
||||||
|
import org.spongepowered.asm.mixin.injection.At;
|
||||||
|
import org.spongepowered.asm.mixin.injection.Constant;
|
||||||
|
import org.spongepowered.asm.mixin.injection.ModifyConstant;
|
||||||
|
import org.spongepowered.asm.mixin.injection.Redirect;
|
||||||
|
|
||||||
|
@Mixin(FillCommand.class)
|
||||||
|
public abstract class FillCommandMixin
|
||||||
|
{
|
||||||
|
@ModifyConstant(method = "execute", constant = @Constant(intValue = 32768))
|
||||||
|
private static int fillLimit(int original) {
|
||||||
|
return CarpetSettings.getInt("fillLimit");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Redirect(method = "execute", at = @At(
|
||||||
|
value = "INVOKE",
|
||||||
|
target = "Lnet/minecraft/server/world/ServerWorld;updateNeighbors(Lnet/minecraft/util/math/BlockPos;Lnet/minecraft/block/Block;)V"
|
||||||
|
))
|
||||||
|
private static void conditionalUpdating(ServerWorld serverWorld, BlockPos blockPos_1, Block block_1)
|
||||||
|
{
|
||||||
|
if (CarpetSettings.b_fillUpdates) serverWorld.updateNeighbors(blockPos_1, block_1);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,23 @@
|
|||||||
|
package carpet.mixins;
|
||||||
|
|
||||||
|
import carpet.CarpetSettings;
|
||||||
|
import net.minecraft.block.Block;
|
||||||
|
import net.minecraft.server.command.SetBlockCommand;
|
||||||
|
import net.minecraft.server.world.ServerWorld;
|
||||||
|
import net.minecraft.util.math.BlockPos;
|
||||||
|
import org.spongepowered.asm.mixin.Mixin;
|
||||||
|
import org.spongepowered.asm.mixin.injection.At;
|
||||||
|
import org.spongepowered.asm.mixin.injection.Redirect;
|
||||||
|
|
||||||
|
@Mixin(SetBlockCommand.class)
|
||||||
|
public class SetBlockCommandMixin
|
||||||
|
{
|
||||||
|
@Redirect(method = "execute", at = @At(
|
||||||
|
value = "INVOKE",
|
||||||
|
target = "Lnet/minecraft/server/world/ServerWorld;updateNeighbors(Lnet/minecraft/util/math/BlockPos;Lnet/minecraft/block/Block;)V"
|
||||||
|
))
|
||||||
|
private static void conditionalUpdating(ServerWorld serverWorld, BlockPos blockPos_1, Block block_1)
|
||||||
|
{
|
||||||
|
if (CarpetSettings.b_fillUpdates) serverWorld.updateNeighbors(blockPos_1, block_1);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,33 @@
|
|||||||
|
package carpet.mixins;
|
||||||
|
|
||||||
|
import carpet.CarpetSettings;
|
||||||
|
import net.minecraft.block.entity.StructureBlockBlockEntity;
|
||||||
|
import net.minecraft.structure.Structure;
|
||||||
|
import net.minecraft.structure.StructurePlacementData;
|
||||||
|
import net.minecraft.util.math.BlockPos;
|
||||||
|
import net.minecraft.world.IWorld;
|
||||||
|
import org.spongepowered.asm.mixin.Mixin;
|
||||||
|
import org.spongepowered.asm.mixin.injection.At;
|
||||||
|
import org.spongepowered.asm.mixin.injection.Redirect;
|
||||||
|
|
||||||
|
@Mixin(StructureBlockBlockEntity.class)
|
||||||
|
public abstract class StructureBlockBlockEntity_fillUpdatesMixin
|
||||||
|
{
|
||||||
|
@Redirect(method = "loadStructure(Z)Z", at = @At(
|
||||||
|
value = "INVOKE",
|
||||||
|
target = "Lnet/minecraft/structure/Structure;place(Lnet/minecraft/world/IWorld;Lnet/minecraft/util/math/BlockPos;Lnet/minecraft/structure/StructurePlacementData;)V"
|
||||||
|
))
|
||||||
|
private void onStructurePlacen(Structure structure, IWorld iWorld_1, BlockPos blockPos_1, StructurePlacementData structurePlacementData_1)
|
||||||
|
{
|
||||||
|
if(!CarpetSettings.b_fillUpdates)
|
||||||
|
CarpetSettings.impendingFillSkipUpdates = true;
|
||||||
|
try
|
||||||
|
{
|
||||||
|
structure.place(iWorld_1, blockPos_1, structurePlacementData_1);
|
||||||
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
CarpetSettings.impendingFillSkipUpdates = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,24 @@
|
|||||||
|
package carpet.mixins;
|
||||||
|
|
||||||
|
import carpet.CarpetSettings;
|
||||||
|
import net.minecraft.block.Block;
|
||||||
|
import net.minecraft.structure.Structure;
|
||||||
|
import net.minecraft.util.math.BlockPos;
|
||||||
|
import net.minecraft.world.IWorld;
|
||||||
|
import org.spongepowered.asm.mixin.Mixin;
|
||||||
|
import org.spongepowered.asm.mixin.injection.At;
|
||||||
|
import org.spongepowered.asm.mixin.injection.Redirect;
|
||||||
|
|
||||||
|
@Mixin(Structure.class)
|
||||||
|
public class Structure_fillUpdatesMixin
|
||||||
|
{
|
||||||
|
@Redirect( method = "method_15172", at = @At(
|
||||||
|
value = "INVOKE",
|
||||||
|
target = "Lnet/minecraft/world/IWorld;updateNeighbors(Lnet/minecraft/util/math/BlockPos;Lnet/minecraft/block/Block;)V"
|
||||||
|
))
|
||||||
|
private void skipUpdateNeighbours(IWorld iWorld, BlockPos var1, Block var2)
|
||||||
|
{
|
||||||
|
if (!CarpetSettings.impendingFillSkipUpdates)
|
||||||
|
iWorld.updateNeighbors(var1, var2);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,34 @@
|
|||||||
|
package carpet.mixins;
|
||||||
|
|
||||||
|
import carpet.CarpetSettings;
|
||||||
|
import net.minecraft.block.BlockState;
|
||||||
|
import net.minecraft.util.math.BlockPos;
|
||||||
|
import net.minecraft.world.World;
|
||||||
|
import net.minecraft.world.chunk.WorldChunk;
|
||||||
|
import org.spongepowered.asm.mixin.Mixin;
|
||||||
|
import org.spongepowered.asm.mixin.injection.At;
|
||||||
|
import org.spongepowered.asm.mixin.injection.Redirect;
|
||||||
|
|
||||||
|
@Mixin(WorldChunk.class)
|
||||||
|
public class WorldChunk_fillUpdatesMixin
|
||||||
|
{
|
||||||
|
@Redirect(method = "setBlockState", at = @At(
|
||||||
|
value = "INVOKE",
|
||||||
|
target = "Lnet/minecraft/block/BlockState;onBlockAdded(Lnet/minecraft/world/World;Lnet/minecraft/util/math/BlockPos;Lnet/minecraft/block/BlockState;Z)V"
|
||||||
|
))
|
||||||
|
private void onAdded(BlockState blockState, World world_1, BlockPos blockPos_1, BlockState blockState_1, boolean boolean_1)
|
||||||
|
{
|
||||||
|
if (!CarpetSettings.impendingFillSkipUpdates)
|
||||||
|
blockState.onBlockAdded(world_1, blockPos_1, blockState_1, boolean_1);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Redirect(method = "setBlockState", at = @At(
|
||||||
|
value = "INVOKE",
|
||||||
|
target = "Lnet/minecraft/block/BlockState;onBlockRemoved(Lnet/minecraft/world/World;Lnet/minecraft/util/math/BlockPos;Lnet/minecraft/block/BlockState;Z)V"
|
||||||
|
))
|
||||||
|
private void onRemoved(BlockState blockState, World world_1, BlockPos blockPos_1, BlockState blockState_1, boolean boolean_1)
|
||||||
|
{
|
||||||
|
if (!CarpetSettings.impendingFillSkipUpdates)
|
||||||
|
blockState.onBlockRemoved(world_1, blockPos_1, blockState_1, boolean_1);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,19 @@
|
|||||||
|
package carpet.mixins;
|
||||||
|
|
||||||
|
import carpet.CarpetSettings;
|
||||||
|
import net.minecraft.world.World;
|
||||||
|
import org.spongepowered.asm.mixin.Mixin;
|
||||||
|
import org.spongepowered.asm.mixin.injection.Constant;
|
||||||
|
import org.spongepowered.asm.mixin.injection.ModifyConstant;
|
||||||
|
|
||||||
|
@Mixin(World.class)
|
||||||
|
public abstract class World_fillUpdatesMixin
|
||||||
|
{
|
||||||
|
@ModifyConstant(method = "setBlockState(Lnet/minecraft/util/math/BlockPos;Lnet/minecraft/block/BlockState;I)Z",
|
||||||
|
constant = @Constant(intValue = 16))
|
||||||
|
private int addFillUpdatesInt(int original) {
|
||||||
|
if (CarpetSettings.impendingFillSkipUpdates)
|
||||||
|
return -1;
|
||||||
|
return original;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -4,6 +4,15 @@
|
|||||||
"compatibilityLevel": "JAVA_8",
|
"compatibilityLevel": "JAVA_8",
|
||||||
"mixins": [
|
"mixins": [
|
||||||
"CommandManagerMixin",
|
"CommandManagerMixin",
|
||||||
|
|
||||||
|
"FillCommandMixin",
|
||||||
|
"CloneCommandMixin",
|
||||||
|
"SetBlockCommandMixin",
|
||||||
|
"World_fillUpdatesMixin",
|
||||||
|
"WorldChunk_fillUpdatesMixin",
|
||||||
|
"StructureBlockBlockEntity_fillUpdatesMixin",
|
||||||
|
"Structure_fillUpdatesMixin",
|
||||||
|
|
||||||
"MinecraftServer_coreMixin",
|
"MinecraftServer_coreMixin",
|
||||||
|
|
||||||
"MinecraftServer_tickspeedMixin",
|
"MinecraftServer_tickspeedMixin",
|
||||||
|
|||||||
Reference in new issue
Block a user