Command blocks now execute commands at the player

This commit is contained in:
Marcel Konrad
2020-07-29 01:09:20 +02:00
parent ce31d6e7b2
commit 227d1edc5d
2 changed files with 109 additions and 1 deletions

View File

@@ -9,6 +9,8 @@ import javax.annotation.Nonnull;
import org.apache.commons.lang3.ArrayUtils;
import exopandora.worldhandler.builder.impl.BuilderExecute;
import exopandora.worldhandler.builder.impl.BuilderExecute.EnumMode;
import exopandora.worldhandler.builder.impl.BuilderFill;
import exopandora.worldhandler.builder.impl.BuilderSetBlock;
import exopandora.worldhandler.builder.types.BlockResourceLocation;
@@ -165,7 +167,14 @@ public class BlockHelper
removeFill.setBlock1(new BlockResourceLocation(Blocks.AIR.getRegistryName()));
Minecraft.getInstance().player.sendChatMessage(placeFill.toActualCommand());
Minecraft.getInstance().getConnection().sendPacket(new CUpdateCommandBlockPacket(pos, command, CommandBlockTileEntity.Mode.REDSTONE, true, false, true));
BuilderExecute wrapped = new BuilderExecute();
wrapped.setMode1(EnumMode.AT);
wrapped.setTarget(Minecraft.getInstance().player.getGameProfile().getName());
wrapped.setMode2(EnumMode.RUN);
wrapped.setCommand(command);
Minecraft.getInstance().getConnection().sendPacket(new CUpdateCommandBlockPacket(pos, wrapped.toActualCommand(), CommandBlockTileEntity.Mode.REDSTONE, true, false, true));
Minecraft.getInstance().getConnection().sendPacket(new CUpdateCommandBlockPacket(pos.up(), removeFill.toActualCommand(), CommandBlockTileEntity.Mode.REDSTONE, true, false, true));
return true;