This commit is contained in:
Chayapak 2023-08-12 09:08:37 +07:00
parent 701ad44325
commit 2feee9503d
2 changed files with 21 additions and 10 deletions

View file

@ -2,8 +2,6 @@ package land.chipmunk.chipmunkmod.modules;
import land.chipmunk.chipmunkmod.ChipmunkMod; import land.chipmunk.chipmunkmod.ChipmunkMod;
import land.chipmunk.chipmunkmod.data.BlockArea; import land.chipmunk.chipmunkmod.data.BlockArea;
import land.chipmunk.chipmunkmod.listeners.Listener; import land.chipmunk.chipmunkmod.listeners.Listener;
import land.chipmunk.chipmunkmod.listeners.ListenerManager; import land.chipmunk.chipmunkmod.listeners.ListenerManager;
import net.minecraft.block.entity.CommandBlockBlockEntity; import net.minecraft.block.entity.CommandBlockBlockEntity;
@ -15,7 +13,6 @@ import net.minecraft.network.packet.c2s.play.UpdateCommandBlockC2SPacket;
import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.Vec3d; import net.minecraft.util.math.Vec3d;
import java.util.List;
import java.util.Timer; import java.util.Timer;
import java.util.TimerTask; import java.util.TimerTask;
import java.util.concurrent.CompletableFuture; import java.util.concurrent.CompletableFuture;
@ -139,9 +136,16 @@ public class CommandCore {
final ClientConnection connection = client.getNetworkHandler().getConnection(); final ClientConnection connection = client.getNetworkHandler().getConnection();
final BlockPos currentBlock = currentBlockAbsolute(); final BlockPos currentBlock = currentBlockAbsolute();
// TODO: Support using repeating command blocks (on kaboom-like servers) (because less packets) connection.send(
connection.send(new UpdateCommandBlockC2SPacket(currentBlock, "", CommandBlockBlockEntity.Type.REDSTONE, false, false, false)); new UpdateCommandBlockC2SPacket(
connection.send(new UpdateCommandBlockC2SPacket(currentBlock, command, CommandBlockBlockEntity.Type.REDSTONE, false, false, true)); currentBlock,
command,
KaboomCheck.INSTANCE.isKaboom ? CommandBlockBlockEntity.Type.AUTO : CommandBlockBlockEntity.Type.REDSTONE,
false,
false,
true
)
);
incrementCurrentBlock(); incrementCurrentBlock();
} }
@ -150,9 +154,16 @@ public class CommandCore {
final ClientConnection connection = client.getNetworkHandler().getConnection(); final ClientConnection connection = client.getNetworkHandler().getConnection();
final BlockPos currentBlock = currentBlockAbsolute(); final BlockPos currentBlock = currentBlockAbsolute();
// TODO: Support using repeating command blocks (on kaboom-like servers) (because less packets) connection.send(
connection.send(new UpdateCommandBlockC2SPacket(currentBlock, "", CommandBlockBlockEntity.Type.SEQUENCE, false, false, false)); new UpdateCommandBlockC2SPacket(
connection.send(new UpdateCommandBlockC2SPacket(currentBlock, command, CommandBlockBlockEntity.Type.REDSTONE, true, false, true)); currentBlock,
command,
KaboomCheck.INSTANCE.isKaboom ? CommandBlockBlockEntity.Type.AUTO : CommandBlockBlockEntity.Type.REDSTONE,
true,
false,
true
)
);
incrementCurrentBlock(); incrementCurrentBlock();

View file

@ -73,7 +73,7 @@ public class CustomChat {
.replace("MESSAGE", sanitizedMessage.replaceAll("&.", "")) // TODO: make this not use regex .replace("MESSAGE", sanitizedMessage.replaceAll("&.", "")) // TODO: make this not use regex
.replace(randomized, "MESSAGE"); // ohio ohio .replace(randomized, "MESSAGE"); // ohio ohio
CommandCore.INSTANCE.run("minecraft:tellraw @a " + sanitizedFormat); CommandCore.INSTANCE.run((KaboomCheck.INSTANCE.isKaboom ? "minecraft:tellraw @a " : "tellraw @a ") + sanitizedFormat);
} catch (Exception e) { } catch (Exception e) {
if (client.player == null) return; if (client.player == null) return;
client.player.sendMessage(Component.text(e.toString()).color(NamedTextColor.RED)); client.player.sendMessage(Component.text(e.toString()).color(NamedTextColor.RED));