use block change and multi block change packets
and also change the core refill delay !!!
This commit is contained in:
parent
ccabeecf4b
commit
54a31bceb0
4 changed files with 54 additions and 14 deletions
|
@ -4,7 +4,9 @@
|
|||
<option name="autoReloadType" value="SELECTIVE" />
|
||||
</component>
|
||||
<component name="ChangeListManager">
|
||||
<list default="true" id="50f184fa-7bed-4956-baf5-7586ff26ea08" name="Changes" comment="add command suggestions i guess" />
|
||||
<list default="true" id="50f184fa-7bed-4956-baf5-7586ff26ea08" name="Changes" comment="aaa i forgor debug line">
|
||||
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
|
||||
</list>
|
||||
<option name="SHOW_DIALOG" value="false" />
|
||||
<option name="HIGHLIGHT_CONFLICTS" value="true" />
|
||||
<option name="HIGHLIGHT_NON_ACTIVE_CHANGELIST" value="false" />
|
||||
|
@ -95,13 +97,6 @@
|
|||
<option name="presentableId" value="Default" />
|
||||
<updated>1680245437032</updated>
|
||||
</task>
|
||||
<task id="LOCAL-00083" summary="fard">
|
||||
<created>1681882806578</created>
|
||||
<option name="number" value="00083" />
|
||||
<option name="presentableId" value="LOCAL-00083" />
|
||||
<option name="project" value="LOCAL" />
|
||||
<updated>1681882806578</updated>
|
||||
</task>
|
||||
<task id="LOCAL-00084" summary="add a working (or not?) stereo to music">
|
||||
<created>1681885244617</created>
|
||||
<option name="number" value="00084" />
|
||||
|
@ -438,7 +433,14 @@
|
|||
<option name="project" value="LOCAL" />
|
||||
<updated>1682658849117</updated>
|
||||
</task>
|
||||
<option name="localTasksCounter" value="132" />
|
||||
<task id="LOCAL-00132" summary="aaa i forgor debug line">
|
||||
<created>1682661022747</created>
|
||||
<option name="number" value="00132" />
|
||||
<option name="presentableId" value="LOCAL-00132" />
|
||||
<option name="project" value="LOCAL" />
|
||||
<updated>1682661022747</updated>
|
||||
</task>
|
||||
<option name="localTasksCounter" value="133" />
|
||||
<servers />
|
||||
</component>
|
||||
<component name="Vcs.Log.Tabs.Properties">
|
||||
|
@ -453,7 +455,6 @@
|
|||
</option>
|
||||
</component>
|
||||
<component name="VcsManagerConfiguration">
|
||||
<MESSAGE value="use serverName instead of host:port for console i guess" />
|
||||
<MESSAGE value="actually revert greplog update because it breaks stuff" />
|
||||
<MESSAGE value="add filter (ignore messy code plz)" />
|
||||
<MESSAGE value="fix chat (/say and /me) i guess" />
|
||||
|
@ -478,7 +479,8 @@
|
|||
<MESSAGE value="amogus" />
|
||||
<MESSAGE value="patch sus?" />
|
||||
<MESSAGE value="add command suggestions i guess" />
|
||||
<option name="LAST_COMMIT_MESSAGE" value="add command suggestions i guess" />
|
||||
<MESSAGE value="aaa i forgor debug line" />
|
||||
<option name="LAST_COMMIT_MESSAGE" value="aaa i forgor debug line" />
|
||||
</component>
|
||||
<component name="XSLT-Support.FileAssociations.UIState">
|
||||
<expand />
|
||||
|
|
|
@ -33,7 +33,7 @@ public class Configuration {
|
|||
|
||||
public static class Core {
|
||||
@Getter public int layers = 3;
|
||||
@Getter public int refillInterval = 60 * 1000;
|
||||
@Getter public int refillInterval = (60 * 5) * 1000; // 5 minutes
|
||||
@Getter public String customName = "[{\"text\":\"ChomeNS \",\"color\":\"yellow\"},{\"text\":\"Core\",\"color\":\"green\"},{\"text\":\"™\",\"color\":\"gold\"}]";
|
||||
}
|
||||
|
||||
|
|
|
@ -4,7 +4,10 @@ import com.github.steveice10.mc.protocol.data.game.entity.metadata.ItemStack;
|
|||
import com.github.steveice10.mc.protocol.data.game.entity.object.Direction;
|
||||
import com.github.steveice10.mc.protocol.data.game.entity.player.Hand;
|
||||
import com.github.steveice10.mc.protocol.data.game.entity.player.PlayerAction;
|
||||
import com.github.steveice10.mc.protocol.data.game.level.block.BlockChangeEntry;
|
||||
import com.github.steveice10.mc.protocol.data.game.level.block.CommandBlockMode;
|
||||
import com.github.steveice10.mc.protocol.packet.ingame.clientbound.level.ClientboundBlockUpdatePacket;
|
||||
import com.github.steveice10.mc.protocol.packet.ingame.clientbound.level.ClientboundSectionBlocksUpdatePacket;
|
||||
import com.github.steveice10.mc.protocol.packet.ingame.clientbound.level.ClientboundTagQueryPacket;
|
||||
import com.github.steveice10.mc.protocol.packet.ingame.serverbound.inventory.ServerboundSetCommandBlockPacket;
|
||||
import com.github.steveice10.mc.protocol.packet.ingame.serverbound.inventory.ServerboundSetCreativeModeSlotPacket;
|
||||
|
@ -18,9 +21,9 @@ import com.github.steveice10.opennbt.tag.builtin.Tag;
|
|||
import com.github.steveice10.packetlib.Session;
|
||||
import com.github.steveice10.packetlib.event.session.DisconnectedEvent;
|
||||
import com.github.steveice10.packetlib.packet.Packet;
|
||||
import org.cloudburstmc.math.vector.Vector3i;
|
||||
import land.chipmunk.chayapak.chomens_bot.Bot;
|
||||
import lombok.Getter;
|
||||
import org.cloudburstmc.math.vector.Vector3i;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
|
@ -43,6 +46,7 @@ public class CorePlugin extends PositionPlugin.PositionListener {
|
|||
public Vector3i coreEnd;
|
||||
|
||||
public Vector3i origin;
|
||||
public Vector3i originEnd;
|
||||
|
||||
public Vector3i relativeCorePosition = Vector3i.from(coreStart);
|
||||
|
||||
|
@ -70,6 +74,8 @@ public class CorePlugin extends PositionPlugin.PositionListener {
|
|||
@Override
|
||||
public void packetReceived(Session session, Packet packet) {
|
||||
if (packet instanceof ClientboundTagQueryPacket) CorePlugin.this.packetReceived((ClientboundTagQueryPacket) packet);
|
||||
else if (packet instanceof ClientboundBlockUpdatePacket) CorePlugin.this.packetReceived((ClientboundBlockUpdatePacket) packet);
|
||||
else if (packet instanceof ClientboundSectionBlocksUpdatePacket) CorePlugin.this.packetReceived((ClientboundSectionBlocksUpdatePacket) packet);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
@ -137,10 +143,40 @@ public class CorePlugin extends PositionPlugin.PositionListener {
|
|||
transactions.get(packet.getTransactionId()).complete(packet.getNbt());
|
||||
}
|
||||
|
||||
public void packetReceived (ClientboundBlockUpdatePacket packet) {
|
||||
final BlockChangeEntry entry = packet.getEntry();
|
||||
|
||||
final Vector3i position = entry.getPosition();
|
||||
|
||||
if (isCore(position)) refill();
|
||||
}
|
||||
|
||||
public void packetReceived (ClientboundSectionBlocksUpdatePacket packet) {
|
||||
final BlockChangeEntry[] entries = packet.getEntries();
|
||||
|
||||
boolean willRefill = false;
|
||||
|
||||
for (BlockChangeEntry entry : entries) {
|
||||
final Vector3i position = entry.getPosition();
|
||||
|
||||
if (isCore(position)) willRefill = true;
|
||||
}
|
||||
|
||||
if (willRefill) refill();
|
||||
}
|
||||
|
||||
public Vector3i absoluteCorePosition () {
|
||||
return relativeCorePosition.add(origin);
|
||||
}
|
||||
|
||||
// ported from chomens bot js
|
||||
private boolean isCore (Vector3i position) {
|
||||
return
|
||||
position.getX() >= origin.getX() && position.getX() <= originEnd.getX() &&
|
||||
position.getY() >= origin.getY() && position.getY() <= originEnd.getY() &&
|
||||
position.getZ() >= origin.getZ() && position.getZ() <= originEnd.getZ();
|
||||
}
|
||||
|
||||
private void incrementBlock () {
|
||||
int x = relativeCorePosition.getX();
|
||||
int y = relativeCorePosition.getY();
|
||||
|
@ -175,6 +211,8 @@ public class CorePlugin extends PositionPlugin.PositionListener {
|
|||
0,
|
||||
bot.position().position().getZ()
|
||||
);
|
||||
originEnd = origin.add(coreEnd);
|
||||
|
||||
refill();
|
||||
|
||||
if (!ready) {
|
||||
|
|
|
@ -34,7 +34,7 @@ weatherApiKey: 'key here' # weatherapi.com key
|
|||
|
||||
core:
|
||||
layers: 3
|
||||
refillInterval: 60000
|
||||
refillInterval: 300000 # (60 * 5) * 1000 (5 minutes)
|
||||
# PLEASE give valid JSON component here else the core don't refill at all
|
||||
customName: '[{"text":"ChomeNS ","color":"yellow"},{"text":"Core","color":"green"},{"text":"™","color":"gold"}]'
|
||||
selfCare:
|
||||
|
|
Loading…
Reference in a new issue