removed all references to Baritone.INSTANCE
This commit is contained in:
parent
2675852dbe
commit
f6891feb64
@ -18,6 +18,7 @@
|
|||||||
package baritone.launch.mixins;
|
package baritone.launch.mixins;
|
||||||
|
|
||||||
import baritone.Baritone;
|
import baritone.Baritone;
|
||||||
|
import baritone.api.BaritoneAPI;
|
||||||
import baritone.api.event.events.RotationMoveEvent;
|
import baritone.api.event.events.RotationMoveEvent;
|
||||||
import net.minecraft.client.entity.EntityPlayerSP;
|
import net.minecraft.client.entity.EntityPlayerSP;
|
||||||
import net.minecraft.entity.Entity;
|
import net.minecraft.entity.Entity;
|
||||||
@ -53,7 +54,7 @@ public class MixinEntity {
|
|||||||
// noinspection ConstantConditions
|
// noinspection ConstantConditions
|
||||||
if (EntityPlayerSP.class.isInstance(this)) {
|
if (EntityPlayerSP.class.isInstance(this)) {
|
||||||
this.motionUpdateRotationEvent = new RotationMoveEvent((EntityPlayerSP) (Object) this, RotationMoveEvent.Type.MOTION_UPDATE, this.rotationYaw);
|
this.motionUpdateRotationEvent = new RotationMoveEvent((EntityPlayerSP) (Object) this, RotationMoveEvent.Type.MOTION_UPDATE, this.rotationYaw);
|
||||||
Baritone.INSTANCE.getGameEventHandler().onPlayerRotationMove(this.motionUpdateRotationEvent);
|
((Baritone) BaritoneAPI.getProvider().getBaritoneForPlayer((EntityPlayerSP) (Object) this)).getGameEventHandler().onPlayerRotationMove(this.motionUpdateRotationEvent);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -18,6 +18,7 @@
|
|||||||
package baritone.launch.mixins;
|
package baritone.launch.mixins;
|
||||||
|
|
||||||
import baritone.Baritone;
|
import baritone.Baritone;
|
||||||
|
import baritone.api.BaritoneAPI;
|
||||||
import baritone.api.event.events.RotationMoveEvent;
|
import baritone.api.event.events.RotationMoveEvent;
|
||||||
import net.minecraft.client.entity.EntityPlayerSP;
|
import net.minecraft.client.entity.EntityPlayerSP;
|
||||||
import net.minecraft.entity.Entity;
|
import net.minecraft.entity.Entity;
|
||||||
@ -56,7 +57,7 @@ public abstract class MixinEntityLivingBase extends Entity {
|
|||||||
// noinspection ConstantConditions
|
// noinspection ConstantConditions
|
||||||
if (EntityPlayerSP.class.isInstance(this)) {
|
if (EntityPlayerSP.class.isInstance(this)) {
|
||||||
this.jumpRotationEvent = new RotationMoveEvent((EntityPlayerSP) (Object) this, RotationMoveEvent.Type.JUMP, this.rotationYaw);
|
this.jumpRotationEvent = new RotationMoveEvent((EntityPlayerSP) (Object) this, RotationMoveEvent.Type.JUMP, this.rotationYaw);
|
||||||
Baritone.INSTANCE.getGameEventHandler().onPlayerRotationMove(this.jumpRotationEvent);
|
((Baritone) BaritoneAPI.getProvider().getBaritoneForPlayer((EntityPlayerSP) (Object) this)).getGameEventHandler().onPlayerRotationMove(this.jumpRotationEvent);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -18,10 +18,11 @@
|
|||||||
package baritone.launch.mixins;
|
package baritone.launch.mixins;
|
||||||
|
|
||||||
import baritone.Baritone;
|
import baritone.Baritone;
|
||||||
|
import baritone.api.BaritoneAPI;
|
||||||
|
import baritone.api.behavior.IPathingBehavior;
|
||||||
import baritone.api.event.events.ChatEvent;
|
import baritone.api.event.events.ChatEvent;
|
||||||
import baritone.api.event.events.PlayerUpdateEvent;
|
import baritone.api.event.events.PlayerUpdateEvent;
|
||||||
import baritone.api.event.events.type.EventState;
|
import baritone.api.event.events.type.EventState;
|
||||||
import baritone.behavior.PathingBehavior;
|
|
||||||
import net.minecraft.client.entity.EntityPlayerSP;
|
import net.minecraft.client.entity.EntityPlayerSP;
|
||||||
import net.minecraft.entity.player.PlayerCapabilities;
|
import net.minecraft.entity.player.PlayerCapabilities;
|
||||||
import org.spongepowered.asm.mixin.Mixin;
|
import org.spongepowered.asm.mixin.Mixin;
|
||||||
@ -44,7 +45,7 @@ public class MixinEntityPlayerSP {
|
|||||||
)
|
)
|
||||||
private void sendChatMessage(String msg, CallbackInfo ci) {
|
private void sendChatMessage(String msg, CallbackInfo ci) {
|
||||||
ChatEvent event = new ChatEvent((EntityPlayerSP) (Object) this, msg);
|
ChatEvent event = new ChatEvent((EntityPlayerSP) (Object) this, msg);
|
||||||
Baritone.INSTANCE.getGameEventHandler().onSendChatMessage(event);
|
((Baritone) BaritoneAPI.getProvider().getBaritoneForPlayer((EntityPlayerSP) (Object) this)).getGameEventHandler().onSendChatMessage(event);
|
||||||
if (event.isCancelled()) {
|
if (event.isCancelled()) {
|
||||||
ci.cancel();
|
ci.cancel();
|
||||||
}
|
}
|
||||||
@ -60,7 +61,7 @@ public class MixinEntityPlayerSP {
|
|||||||
)
|
)
|
||||||
)
|
)
|
||||||
private void onPreUpdate(CallbackInfo ci) {
|
private void onPreUpdate(CallbackInfo ci) {
|
||||||
Baritone.INSTANCE.getGameEventHandler().onPlayerUpdate(new PlayerUpdateEvent((EntityPlayerSP) (Object) this, EventState.PRE));
|
((Baritone) BaritoneAPI.getProvider().getBaritoneForPlayer((EntityPlayerSP) (Object) this)).getGameEventHandler().onPlayerUpdate(new PlayerUpdateEvent((EntityPlayerSP) (Object) this, EventState.PRE));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Inject(
|
@Inject(
|
||||||
@ -73,7 +74,7 @@ public class MixinEntityPlayerSP {
|
|||||||
)
|
)
|
||||||
)
|
)
|
||||||
private void onPostUpdate(CallbackInfo ci) {
|
private void onPostUpdate(CallbackInfo ci) {
|
||||||
Baritone.INSTANCE.getGameEventHandler().onPlayerUpdate(new PlayerUpdateEvent((EntityPlayerSP) (Object) this, EventState.POST));
|
((Baritone) BaritoneAPI.getProvider().getBaritoneForPlayer((EntityPlayerSP) (Object) this)).getGameEventHandler().onPlayerUpdate(new PlayerUpdateEvent((EntityPlayerSP) (Object) this, EventState.POST));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Redirect(
|
@Redirect(
|
||||||
@ -84,7 +85,7 @@ public class MixinEntityPlayerSP {
|
|||||||
)
|
)
|
||||||
)
|
)
|
||||||
private boolean isAllowFlying(PlayerCapabilities capabilities) {
|
private boolean isAllowFlying(PlayerCapabilities capabilities) {
|
||||||
PathingBehavior pathingBehavior = Baritone.INSTANCE.getPathingBehavior();
|
IPathingBehavior pathingBehavior = BaritoneAPI.getProvider().getBaritoneForPlayer((EntityPlayerSP) (Object) this).getPathingBehavior();
|
||||||
return !pathingBehavior.isPathing() && capabilities.allowFlying;
|
return !pathingBehavior.isPathing() && capabilities.allowFlying;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -18,6 +18,8 @@
|
|||||||
package baritone.launch.mixins;
|
package baritone.launch.mixins;
|
||||||
|
|
||||||
import baritone.Baritone;
|
import baritone.Baritone;
|
||||||
|
import baritone.api.BaritoneAPI;
|
||||||
|
import baritone.api.IBaritone;
|
||||||
import baritone.api.event.events.RenderEvent;
|
import baritone.api.event.events.RenderEvent;
|
||||||
import net.minecraft.client.renderer.EntityRenderer;
|
import net.minecraft.client.renderer.EntityRenderer;
|
||||||
import org.spongepowered.asm.mixin.Mixin;
|
import org.spongepowered.asm.mixin.Mixin;
|
||||||
@ -37,6 +39,8 @@ public class MixinEntityRenderer {
|
|||||||
)
|
)
|
||||||
)
|
)
|
||||||
private void renderWorldPass(int pass, float partialTicks, long finishTimeNano, CallbackInfo ci) {
|
private void renderWorldPass(int pass, float partialTicks, long finishTimeNano, CallbackInfo ci) {
|
||||||
Baritone.INSTANCE.getGameEventHandler().onRenderPass(new RenderEvent(partialTicks));
|
for (IBaritone ibaritone : BaritoneAPI.getProvider().getAllBaritones()) {
|
||||||
|
((Baritone) ibaritone).getGameEventHandler().onRenderPass(new RenderEvent(partialTicks));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -17,7 +17,7 @@
|
|||||||
|
|
||||||
package baritone.launch.mixins;
|
package baritone.launch.mixins;
|
||||||
|
|
||||||
import baritone.Baritone;
|
import baritone.api.BaritoneAPI;
|
||||||
import net.minecraft.client.settings.KeyBinding;
|
import net.minecraft.client.settings.KeyBinding;
|
||||||
import org.spongepowered.asm.mixin.Mixin;
|
import org.spongepowered.asm.mixin.Mixin;
|
||||||
import org.spongepowered.asm.mixin.injection.At;
|
import org.spongepowered.asm.mixin.injection.At;
|
||||||
@ -37,7 +37,8 @@ public class MixinKeyBinding {
|
|||||||
cancellable = true
|
cancellable = true
|
||||||
)
|
)
|
||||||
private void isKeyDown(CallbackInfoReturnable<Boolean> cir) {
|
private void isKeyDown(CallbackInfoReturnable<Boolean> cir) {
|
||||||
if (Baritone.INSTANCE.getInputOverrideHandler().isInputForcedDown((KeyBinding) (Object) this)) {
|
// only the primary baritone forces keys
|
||||||
|
if (BaritoneAPI.getProvider().getPrimaryBaritone().getInputOverrideHandler().isInputForcedDown((KeyBinding) (Object) this)) {
|
||||||
cir.setReturnValue(true);
|
cir.setReturnValue(true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -18,6 +18,8 @@
|
|||||||
package baritone.launch.mixins;
|
package baritone.launch.mixins;
|
||||||
|
|
||||||
import baritone.Baritone;
|
import baritone.Baritone;
|
||||||
|
import baritone.api.BaritoneAPI;
|
||||||
|
import baritone.api.IBaritone;
|
||||||
import baritone.api.event.events.BlockInteractEvent;
|
import baritone.api.event.events.BlockInteractEvent;
|
||||||
import baritone.api.event.events.TickEvent;
|
import baritone.api.event.events.TickEvent;
|
||||||
import baritone.api.event.events.WorldEvent;
|
import baritone.api.event.events.WorldEvent;
|
||||||
@ -57,7 +59,7 @@ public class MixinMinecraft {
|
|||||||
at = @At("RETURN")
|
at = @At("RETURN")
|
||||||
)
|
)
|
||||||
private void postInit(CallbackInfo ci) {
|
private void postInit(CallbackInfo ci) {
|
||||||
Baritone.INSTANCE.init();
|
((Baritone) BaritoneAPI.getProvider().getPrimaryBaritone()).init();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Inject(
|
@Inject(
|
||||||
@ -83,12 +85,15 @@ public class MixinMinecraft {
|
|||||||
)
|
)
|
||||||
)
|
)
|
||||||
private void runTick(CallbackInfo ci) {
|
private void runTick(CallbackInfo ci) {
|
||||||
Baritone.INSTANCE.getGameEventHandler().onTick(new TickEvent(
|
for (IBaritone ibaritone : BaritoneAPI.getProvider().getAllBaritones()) {
|
||||||
EventState.PRE,
|
((Baritone) ibaritone).getGameEventHandler().onTick(new TickEvent(
|
||||||
(player != null && world != null)
|
EventState.PRE,
|
||||||
? TickEvent.Type.IN
|
(player != null && world != null)
|
||||||
: TickEvent.Type.OUT
|
? TickEvent.Type.IN
|
||||||
));
|
: TickEvent.Type.OUT
|
||||||
|
));
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Inject(
|
@Inject(
|
||||||
@ -96,7 +101,8 @@ public class MixinMinecraft {
|
|||||||
at = @At("HEAD")
|
at = @At("HEAD")
|
||||||
)
|
)
|
||||||
private void runTickKeyboard(CallbackInfo ci) {
|
private void runTickKeyboard(CallbackInfo ci) {
|
||||||
Baritone.INSTANCE.getGameEventHandler().onProcessKeyBinds();
|
// keyboard input is only the primary baritone
|
||||||
|
((Baritone) BaritoneAPI.getProvider().getPrimaryBaritone()).getGameEventHandler().onProcessKeyBinds();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Inject(
|
@Inject(
|
||||||
@ -109,7 +115,9 @@ public class MixinMinecraft {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
Baritone.INSTANCE.getGameEventHandler().onWorldEvent(
|
// mc.world changing is only the primary baritone
|
||||||
|
|
||||||
|
((Baritone) BaritoneAPI.getProvider().getPrimaryBaritone()).getGameEventHandler().onWorldEvent(
|
||||||
new WorldEvent(
|
new WorldEvent(
|
||||||
world,
|
world,
|
||||||
EventState.PRE
|
EventState.PRE
|
||||||
@ -124,7 +132,9 @@ public class MixinMinecraft {
|
|||||||
private void postLoadWorld(WorldClient world, String loadingMessage, CallbackInfo ci) {
|
private void postLoadWorld(WorldClient world, String loadingMessage, CallbackInfo ci) {
|
||||||
// still fire event for both null, as that means we've just finished exiting a world
|
// still fire event for both null, as that means we've just finished exiting a world
|
||||||
|
|
||||||
Baritone.INSTANCE.getGameEventHandler().onWorldEvent(
|
// mc.world changing is only the primary baritone
|
||||||
|
|
||||||
|
((Baritone) BaritoneAPI.getProvider().getPrimaryBaritone()).getGameEventHandler().onWorldEvent(
|
||||||
new WorldEvent(
|
new WorldEvent(
|
||||||
world,
|
world,
|
||||||
EventState.POST
|
EventState.POST
|
||||||
@ -141,7 +151,8 @@ public class MixinMinecraft {
|
|||||||
)
|
)
|
||||||
)
|
)
|
||||||
private boolean isAllowUserInput(GuiScreen screen) {
|
private boolean isAllowUserInput(GuiScreen screen) {
|
||||||
return (Baritone.INSTANCE.getPathingBehavior().getCurrent() != null && player != null) || screen.allowUserInput;
|
// allow user input is only the primary baritone
|
||||||
|
return (BaritoneAPI.getProvider().getPrimaryBaritone().getPathingBehavior().getCurrent() != null && player != null) || screen.allowUserInput;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Inject(
|
@Inject(
|
||||||
@ -153,7 +164,8 @@ public class MixinMinecraft {
|
|||||||
locals = LocalCapture.CAPTURE_FAILHARD
|
locals = LocalCapture.CAPTURE_FAILHARD
|
||||||
)
|
)
|
||||||
private void onBlockBreak(CallbackInfo ci, BlockPos pos) {
|
private void onBlockBreak(CallbackInfo ci, BlockPos pos) {
|
||||||
Baritone.INSTANCE.getGameEventHandler().onBlockInteract(new BlockInteractEvent(pos, BlockInteractEvent.Type.BREAK));
|
// clickMouse is only for the main player
|
||||||
|
((Baritone) BaritoneAPI.getProvider().getPrimaryBaritone()).getGameEventHandler().onBlockInteract(new BlockInteractEvent(pos, BlockInteractEvent.Type.BREAK));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Inject(
|
@Inject(
|
||||||
@ -165,6 +177,7 @@ public class MixinMinecraft {
|
|||||||
locals = LocalCapture.CAPTURE_FAILHARD
|
locals = LocalCapture.CAPTURE_FAILHARD
|
||||||
)
|
)
|
||||||
private void onBlockUse(CallbackInfo ci, EnumHand var1[], int var2, int var3, EnumHand enumhand, ItemStack itemstack, BlockPos blockpos, int i, EnumActionResult enumactionresult) {
|
private void onBlockUse(CallbackInfo ci, EnumHand var1[], int var2, int var3, EnumHand enumhand, ItemStack itemstack, BlockPos blockpos, int i, EnumActionResult enumactionresult) {
|
||||||
Baritone.INSTANCE.getGameEventHandler().onBlockInteract(new BlockInteractEvent(blockpos, BlockInteractEvent.Type.USE));
|
// rightClickMouse is only for the main player
|
||||||
|
((Baritone) BaritoneAPI.getProvider().getPrimaryBaritone()).getGameEventHandler().onBlockInteract(new BlockInteractEvent(blockpos, BlockInteractEvent.Type.USE));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -18,6 +18,8 @@
|
|||||||
package baritone.launch.mixins;
|
package baritone.launch.mixins;
|
||||||
|
|
||||||
import baritone.Baritone;
|
import baritone.Baritone;
|
||||||
|
import baritone.api.BaritoneAPI;
|
||||||
|
import baritone.api.IBaritone;
|
||||||
import baritone.api.event.events.ChunkEvent;
|
import baritone.api.event.events.ChunkEvent;
|
||||||
import baritone.api.event.events.type.EventState;
|
import baritone.api.event.events.type.EventState;
|
||||||
import net.minecraft.client.network.NetHandlerPlayClient;
|
import net.minecraft.client.network.NetHandlerPlayClient;
|
||||||
@ -43,14 +45,18 @@ public class MixinNetHandlerPlayClient {
|
|||||||
)
|
)
|
||||||
)
|
)
|
||||||
private void preRead(SPacketChunkData packetIn, CallbackInfo ci) {
|
private void preRead(SPacketChunkData packetIn, CallbackInfo ci) {
|
||||||
Baritone.INSTANCE.getGameEventHandler().onChunkEvent(
|
for (IBaritone ibaritone : BaritoneAPI.getProvider().getAllBaritones()) {
|
||||||
new ChunkEvent(
|
if (ibaritone.getPlayerContext().player().connection == (NetHandlerPlayClient) (Object) this) {
|
||||||
EventState.PRE,
|
((Baritone) ibaritone).getGameEventHandler().onChunkEvent(
|
||||||
ChunkEvent.Type.POPULATE,
|
new ChunkEvent(
|
||||||
packetIn.getChunkX(),
|
EventState.PRE,
|
||||||
packetIn.getChunkZ()
|
ChunkEvent.Type.POPULATE,
|
||||||
)
|
packetIn.getChunkX(),
|
||||||
);
|
packetIn.getChunkZ()
|
||||||
|
)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Inject(
|
@Inject(
|
||||||
@ -58,14 +64,18 @@ public class MixinNetHandlerPlayClient {
|
|||||||
at = @At("RETURN")
|
at = @At("RETURN")
|
||||||
)
|
)
|
||||||
private void postHandleChunkData(SPacketChunkData packetIn, CallbackInfo ci) {
|
private void postHandleChunkData(SPacketChunkData packetIn, CallbackInfo ci) {
|
||||||
Baritone.INSTANCE.getGameEventHandler().onChunkEvent(
|
for (IBaritone ibaritone : BaritoneAPI.getProvider().getAllBaritones()) {
|
||||||
new ChunkEvent(
|
if (ibaritone.getPlayerContext().player().connection == (NetHandlerPlayClient) (Object) this) {
|
||||||
EventState.POST,
|
((Baritone) ibaritone).getGameEventHandler().onChunkEvent(
|
||||||
ChunkEvent.Type.POPULATE,
|
new ChunkEvent(
|
||||||
packetIn.getChunkX(),
|
EventState.POST,
|
||||||
packetIn.getChunkZ()
|
ChunkEvent.Type.POPULATE,
|
||||||
)
|
packetIn.getChunkX(),
|
||||||
);
|
packetIn.getChunkZ()
|
||||||
|
)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Inject(
|
@Inject(
|
||||||
@ -76,6 +86,10 @@ public class MixinNetHandlerPlayClient {
|
|||||||
)
|
)
|
||||||
)
|
)
|
||||||
private void onPlayerDeath(SPacketCombatEvent packetIn, CallbackInfo ci) {
|
private void onPlayerDeath(SPacketCombatEvent packetIn, CallbackInfo ci) {
|
||||||
Baritone.INSTANCE.getGameEventHandler().onPlayerDeath();
|
for (IBaritone ibaritone : BaritoneAPI.getProvider().getAllBaritones()) {
|
||||||
|
if (ibaritone.getPlayerContext().player().connection == (NetHandlerPlayClient) (Object) this) {
|
||||||
|
((Baritone) ibaritone).getGameEventHandler().onPlayerDeath();
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -18,6 +18,8 @@
|
|||||||
package baritone.launch.mixins;
|
package baritone.launch.mixins;
|
||||||
|
|
||||||
import baritone.Baritone;
|
import baritone.Baritone;
|
||||||
|
import baritone.api.BaritoneAPI;
|
||||||
|
import baritone.api.IBaritone;
|
||||||
import baritone.api.event.events.PacketEvent;
|
import baritone.api.event.events.PacketEvent;
|
||||||
import baritone.api.event.events.type.EventState;
|
import baritone.api.event.events.type.EventState;
|
||||||
import io.netty.channel.Channel;
|
import io.netty.channel.Channel;
|
||||||
@ -53,8 +55,14 @@ public class MixinNetworkManager {
|
|||||||
at = @At("HEAD")
|
at = @At("HEAD")
|
||||||
)
|
)
|
||||||
private void preDispatchPacket(Packet<?> inPacket, final GenericFutureListener<? extends Future<? super Void>>[] futureListeners, CallbackInfo ci) {
|
private void preDispatchPacket(Packet<?> inPacket, final GenericFutureListener<? extends Future<? super Void>>[] futureListeners, CallbackInfo ci) {
|
||||||
if (this.direction == EnumPacketDirection.CLIENTBOUND) {
|
if (this.direction != EnumPacketDirection.CLIENTBOUND) {
|
||||||
Baritone.INSTANCE.getGameEventHandler().onSendPacket(new PacketEvent((NetworkManager) (Object) this, EventState.PRE, inPacket));
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
for (IBaritone ibaritone : BaritoneAPI.getProvider().getAllBaritones()) {
|
||||||
|
if (ibaritone.getPlayerContext().player() != null && ibaritone.getPlayerContext().player().connection.getNetworkManager() == (NetworkManager) (Object) this) {
|
||||||
|
((Baritone) ibaritone).getGameEventHandler().onSendPacket(new PacketEvent((NetworkManager) (Object) this, EventState.PRE, inPacket));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -63,8 +71,14 @@ public class MixinNetworkManager {
|
|||||||
at = @At("RETURN")
|
at = @At("RETURN")
|
||||||
)
|
)
|
||||||
private void postDispatchPacket(Packet<?> inPacket, final GenericFutureListener<? extends Future<? super Void>>[] futureListeners, CallbackInfo ci) {
|
private void postDispatchPacket(Packet<?> inPacket, final GenericFutureListener<? extends Future<? super Void>>[] futureListeners, CallbackInfo ci) {
|
||||||
if (this.direction == EnumPacketDirection.CLIENTBOUND) {
|
if (this.direction != EnumPacketDirection.CLIENTBOUND) {
|
||||||
Baritone.INSTANCE.getGameEventHandler().onSendPacket(new PacketEvent((NetworkManager) (Object) this, EventState.POST, inPacket));
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
for (IBaritone ibaritone : BaritoneAPI.getProvider().getAllBaritones()) {
|
||||||
|
if (ibaritone.getPlayerContext().player() != null && ibaritone.getPlayerContext().player().connection.getNetworkManager() == (NetworkManager) (Object) this) {
|
||||||
|
((Baritone) ibaritone).getGameEventHandler().onSendPacket(new PacketEvent((NetworkManager) (Object) this, EventState.POST, inPacket));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -76,8 +90,13 @@ public class MixinNetworkManager {
|
|||||||
)
|
)
|
||||||
)
|
)
|
||||||
private void preProcessPacket(ChannelHandlerContext context, Packet<?> packet, CallbackInfo ci) {
|
private void preProcessPacket(ChannelHandlerContext context, Packet<?> packet, CallbackInfo ci) {
|
||||||
if (this.direction == EnumPacketDirection.CLIENTBOUND) {
|
if (this.direction != EnumPacketDirection.CLIENTBOUND) {
|
||||||
Baritone.INSTANCE.getGameEventHandler().onReceivePacket(new PacketEvent((NetworkManager) (Object) this, EventState.PRE, packet));
|
return;
|
||||||
|
}
|
||||||
|
for (IBaritone ibaritone : BaritoneAPI.getProvider().getAllBaritones()) {
|
||||||
|
if (ibaritone.getPlayerContext().player() != null && ibaritone.getPlayerContext().player().connection.getNetworkManager() == (NetworkManager) (Object) this) {
|
||||||
|
((Baritone) ibaritone).getGameEventHandler().onReceivePacket(new PacketEvent((NetworkManager) (Object) this, EventState.PRE, packet));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -86,8 +105,13 @@ public class MixinNetworkManager {
|
|||||||
at = @At("RETURN")
|
at = @At("RETURN")
|
||||||
)
|
)
|
||||||
private void postProcessPacket(ChannelHandlerContext context, Packet<?> packet, CallbackInfo ci) {
|
private void postProcessPacket(ChannelHandlerContext context, Packet<?> packet, CallbackInfo ci) {
|
||||||
if (this.channel.isOpen() && this.direction == EnumPacketDirection.CLIENTBOUND) {
|
if (!this.channel.isOpen() || this.direction != EnumPacketDirection.CLIENTBOUND) {
|
||||||
Baritone.INSTANCE.getGameEventHandler().onReceivePacket(new PacketEvent((NetworkManager) (Object) this, EventState.POST, packet));
|
return;
|
||||||
|
}
|
||||||
|
for (IBaritone ibaritone : BaritoneAPI.getProvider().getAllBaritones()) {
|
||||||
|
if (ibaritone.getPlayerContext().player() != null && ibaritone.getPlayerContext().player().connection.getNetworkManager() == (NetworkManager) (Object) this) {
|
||||||
|
((Baritone) ibaritone).getGameEventHandler().onReceivePacket(new PacketEvent((NetworkManager) (Object) this, EventState.POST, packet));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -18,6 +18,8 @@
|
|||||||
package baritone.launch.mixins;
|
package baritone.launch.mixins;
|
||||||
|
|
||||||
import baritone.Baritone;
|
import baritone.Baritone;
|
||||||
|
import baritone.api.BaritoneAPI;
|
||||||
|
import baritone.api.IBaritone;
|
||||||
import baritone.api.event.events.ChunkEvent;
|
import baritone.api.event.events.ChunkEvent;
|
||||||
import baritone.api.event.events.type.EventState;
|
import baritone.api.event.events.type.EventState;
|
||||||
import net.minecraft.client.multiplayer.WorldClient;
|
import net.minecraft.client.multiplayer.WorldClient;
|
||||||
@ -38,14 +40,19 @@ public class MixinWorldClient {
|
|||||||
at = @At("HEAD")
|
at = @At("HEAD")
|
||||||
)
|
)
|
||||||
private void preDoPreChunk(int chunkX, int chunkZ, boolean loadChunk, CallbackInfo ci) {
|
private void preDoPreChunk(int chunkX, int chunkZ, boolean loadChunk, CallbackInfo ci) {
|
||||||
Baritone.INSTANCE.getGameEventHandler().onChunkEvent(
|
for (IBaritone ibaritone : BaritoneAPI.getProvider().getAllBaritones()) {
|
||||||
new ChunkEvent(
|
if (ibaritone.getPlayerContext().world() == (WorldClient) (Object) this) {
|
||||||
EventState.PRE,
|
((Baritone) ibaritone).getGameEventHandler().onChunkEvent(
|
||||||
loadChunk ? ChunkEvent.Type.LOAD : ChunkEvent.Type.UNLOAD,
|
new ChunkEvent(
|
||||||
chunkX,
|
EventState.PRE,
|
||||||
chunkZ
|
loadChunk ? ChunkEvent.Type.LOAD : ChunkEvent.Type.UNLOAD,
|
||||||
)
|
chunkX,
|
||||||
);
|
chunkZ
|
||||||
|
)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Inject(
|
@Inject(
|
||||||
@ -53,13 +60,17 @@ public class MixinWorldClient {
|
|||||||
at = @At("RETURN")
|
at = @At("RETURN")
|
||||||
)
|
)
|
||||||
private void postDoPreChunk(int chunkX, int chunkZ, boolean loadChunk, CallbackInfo ci) {
|
private void postDoPreChunk(int chunkX, int chunkZ, boolean loadChunk, CallbackInfo ci) {
|
||||||
Baritone.INSTANCE.getGameEventHandler().onChunkEvent(
|
for (IBaritone ibaritone : BaritoneAPI.getProvider().getAllBaritones()) {
|
||||||
new ChunkEvent(
|
if (ibaritone.getPlayerContext().world() == (WorldClient) (Object) this) {
|
||||||
EventState.POST,
|
((Baritone) ibaritone).getGameEventHandler().onChunkEvent(
|
||||||
loadChunk ? ChunkEvent.Type.LOAD : ChunkEvent.Type.UNLOAD,
|
new ChunkEvent(
|
||||||
chunkX,
|
EventState.POST,
|
||||||
chunkZ
|
loadChunk ? ChunkEvent.Type.LOAD : ChunkEvent.Type.UNLOAD,
|
||||||
)
|
chunkX,
|
||||||
);
|
chunkZ
|
||||||
|
)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
12
src/main/java/baritone/cache/CachedWorld.java
vendored
12
src/main/java/baritone/cache/CachedWorld.java
vendored
@ -18,7 +18,10 @@
|
|||||||
package baritone.cache;
|
package baritone.cache;
|
||||||
|
|
||||||
import baritone.Baritone;
|
import baritone.Baritone;
|
||||||
|
import baritone.api.BaritoneAPI;
|
||||||
|
import baritone.api.IBaritone;
|
||||||
import baritone.api.cache.ICachedWorld;
|
import baritone.api.cache.ICachedWorld;
|
||||||
|
import baritone.api.cache.IWorldData;
|
||||||
import baritone.utils.Helper;
|
import baritone.utils.Helper;
|
||||||
import it.unimi.dsi.fastutil.longs.Long2ObjectMap;
|
import it.unimi.dsi.fastutil.longs.Long2ObjectMap;
|
||||||
import it.unimi.dsi.fastutil.longs.Long2ObjectOpenHashMap;
|
import it.unimi.dsi.fastutil.longs.Long2ObjectOpenHashMap;
|
||||||
@ -190,10 +193,11 @@ public final class CachedWorld implements ICachedWorld, Helper {
|
|||||||
* If we are still in this world and dimension, return player feet, otherwise return most recently modified chunk
|
* If we are still in this world and dimension, return player feet, otherwise return most recently modified chunk
|
||||||
*/
|
*/
|
||||||
private BlockPos guessPosition() {
|
private BlockPos guessPosition() {
|
||||||
WorldData data = Baritone.INSTANCE.getWorldProvider().getCurrentWorld();
|
for (IBaritone ibaritone : BaritoneAPI.getProvider().getAllBaritones()) {
|
||||||
if (data != null && data.getCachedWorld() == this) {
|
IWorldData data = ibaritone.getWorldProvider().getCurrentWorld();
|
||||||
// TODO-yeet fix
|
if (data != null && data.getCachedWorld() == this) {
|
||||||
return Baritone.INSTANCE.getPlayerContext().playerFeet();
|
return ibaritone.getPlayerContext().playerFeet();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
CachedChunk mostRecentlyModified = null;
|
CachedChunk mostRecentlyModified = null;
|
||||||
for (CachedRegion region : allRegions()) {
|
for (CachedRegion region : allRegions()) {
|
||||||
|
@ -23,6 +23,7 @@ import baritone.api.event.events.type.EventState;
|
|||||||
import baritone.api.event.listener.IGameEventListener;
|
import baritone.api.event.listener.IGameEventListener;
|
||||||
import baritone.cache.WorldProvider;
|
import baritone.cache.WorldProvider;
|
||||||
import baritone.utils.Helper;
|
import baritone.utils.Helper;
|
||||||
|
import net.minecraft.world.World;
|
||||||
import net.minecraft.world.chunk.Chunk;
|
import net.minecraft.world.chunk.Chunk;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
@ -70,17 +71,19 @@ public final class GameEventHandler implements IGameEventListener, Helper {
|
|||||||
boolean isPostPopulate = state == EventState.POST
|
boolean isPostPopulate = state == EventState.POST
|
||||||
&& type == ChunkEvent.Type.POPULATE;
|
&& type == ChunkEvent.Type.POPULATE;
|
||||||
|
|
||||||
|
World world = baritone.getPlayerContext().world();
|
||||||
|
|
||||||
// Whenever the server sends us to another dimension, chunks are unloaded
|
// Whenever the server sends us to another dimension, chunks are unloaded
|
||||||
// technically after the new world has been loaded, so we perform a check
|
// technically after the new world has been loaded, so we perform a check
|
||||||
// to make sure the chunk being unloaded is already loaded.
|
// to make sure the chunk being unloaded is already loaded.
|
||||||
boolean isPreUnload = state == EventState.PRE
|
boolean isPreUnload = state == EventState.PRE
|
||||||
&& type == ChunkEvent.Type.UNLOAD
|
&& type == ChunkEvent.Type.UNLOAD
|
||||||
&& mc.world.getChunkProvider().isChunkGeneratedAt(event.getX(), event.getZ());
|
&& world.getChunkProvider().isChunkGeneratedAt(event.getX(), event.getZ());
|
||||||
|
|
||||||
if (isPostPopulate || isPreUnload) {
|
if (isPostPopulate || isPreUnload) {
|
||||||
baritone.getWorldProvider().ifWorldLoaded(world -> {
|
baritone.getWorldProvider().ifWorldLoaded(worldData -> {
|
||||||
Chunk chunk = mc.world.getChunk(event.getX(), event.getZ());
|
Chunk chunk = world.getChunk(event.getX(), event.getZ());
|
||||||
world.getCachedWorld().queueForPacking(chunk);
|
worldData.getCachedWorld().queueForPacking(chunk);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -17,7 +17,7 @@
|
|||||||
|
|
||||||
package baritone.utils;
|
package baritone.utils;
|
||||||
|
|
||||||
import baritone.Baritone;
|
import baritone.api.BaritoneAPI;
|
||||||
import baritone.api.event.events.TickEvent;
|
import baritone.api.event.events.TickEvent;
|
||||||
import baritone.api.event.listener.AbstractGameEventListener;
|
import baritone.api.event.listener.AbstractGameEventListener;
|
||||||
import baritone.api.pathing.goals.Goal;
|
import baritone.api.pathing.goals.Goal;
|
||||||
@ -41,7 +41,6 @@ public class BaritoneAutoTest implements AbstractGameEventListener, Helper {
|
|||||||
private static final BlockPos STARTING_POSITION = new BlockPos(0, 65, 0);
|
private static final BlockPos STARTING_POSITION = new BlockPos(0, 65, 0);
|
||||||
private static final Goal GOAL = new GoalBlock(69, 121, 420);
|
private static final Goal GOAL = new GoalBlock(69, 121, 420);
|
||||||
private static final int MAX_TICKS = 3500;
|
private static final int MAX_TICKS = 3500;
|
||||||
private static final Baritone baritone = Baritone.INSTANCE;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Called right after the {@link GameSettings} object is created in the {@link Minecraft} instance.
|
* Called right after the {@link GameSettings} object is created in the {@link Minecraft} instance.
|
||||||
@ -71,7 +70,7 @@ public class BaritoneAutoTest implements AbstractGameEventListener, Helper {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onTick(TickEvent event) {
|
public void onTick(TickEvent event) {
|
||||||
IPlayerContext ctx = baritone.getPlayerContext();
|
IPlayerContext ctx = BaritoneAPI.getProvider().getPrimaryBaritone().getPlayerContext();
|
||||||
// If we're on the main menu then create the test world and launch the integrated server
|
// If we're on the main menu then create the test world and launch the integrated server
|
||||||
if (mc.currentScreen instanceof GuiMainMenu) {
|
if (mc.currentScreen instanceof GuiMainMenu) {
|
||||||
System.out.println("Beginning Baritone automatic test routine");
|
System.out.println("Beginning Baritone automatic test routine");
|
||||||
@ -107,7 +106,7 @@ public class BaritoneAutoTest implements AbstractGameEventListener, Helper {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Setup Baritone's pathing goal and (if needed) begin pathing
|
// Setup Baritone's pathing goal and (if needed) begin pathing
|
||||||
baritone.getCustomGoalProcess().setGoalAndPath(GOAL);
|
BaritoneAPI.getProvider().getPrimaryBaritone().getCustomGoalProcess().setGoalAndPath(GOAL);
|
||||||
|
|
||||||
// If we have reached our goal, print a message and safely close the game
|
// If we have reached our goal, print a message and safely close the game
|
||||||
if (GOAL.isInGoal(ctx.playerFeet())) {
|
if (GOAL.isInGoal(ctx.playerFeet())) {
|
||||||
|
@ -18,6 +18,7 @@
|
|||||||
package baritone.utils;
|
package baritone.utils;
|
||||||
|
|
||||||
import baritone.Baritone;
|
import baritone.Baritone;
|
||||||
|
import baritone.api.BaritoneAPI;
|
||||||
import baritone.api.event.events.RenderEvent;
|
import baritone.api.event.events.RenderEvent;
|
||||||
import baritone.api.pathing.calc.IPath;
|
import baritone.api.pathing.calc.IPath;
|
||||||
import baritone.api.pathing.goals.Goal;
|
import baritone.api.pathing.goals.Goal;
|
||||||
@ -31,12 +32,11 @@ import baritone.pathing.calc.AbstractNodeCostSearch;
|
|||||||
import baritone.pathing.path.PathExecutor;
|
import baritone.pathing.path.PathExecutor;
|
||||||
import net.minecraft.block.state.IBlockState;
|
import net.minecraft.block.state.IBlockState;
|
||||||
import net.minecraft.client.Minecraft;
|
import net.minecraft.client.Minecraft;
|
||||||
import net.minecraft.client.entity.EntityPlayerSP;
|
|
||||||
import net.minecraft.client.renderer.BufferBuilder;
|
import net.minecraft.client.renderer.BufferBuilder;
|
||||||
import net.minecraft.client.renderer.GlStateManager;
|
import net.minecraft.client.renderer.GlStateManager;
|
||||||
import net.minecraft.client.renderer.Tessellator;
|
import net.minecraft.client.renderer.Tessellator;
|
||||||
import net.minecraft.client.renderer.vertex.DefaultVertexFormats;
|
import net.minecraft.client.renderer.vertex.DefaultVertexFormats;
|
||||||
import net.minecraft.entity.player.EntityPlayer;
|
import net.minecraft.entity.Entity;
|
||||||
import net.minecraft.init.Blocks;
|
import net.minecraft.init.Blocks;
|
||||||
import net.minecraft.util.math.AxisAlignedBB;
|
import net.minecraft.util.math.AxisAlignedBB;
|
||||||
import net.minecraft.util.math.BlockPos;
|
import net.minecraft.util.math.BlockPos;
|
||||||
@ -65,9 +65,26 @@ public final class PathRenderer implements Helper {
|
|||||||
// System.out.println(event.getPartialTicks());
|
// System.out.println(event.getPartialTicks());
|
||||||
float partialTicks = event.getPartialTicks();
|
float partialTicks = event.getPartialTicks();
|
||||||
Goal goal = behavior.getGoal();
|
Goal goal = behavior.getGoal();
|
||||||
EntityPlayerSP player = mc.player;
|
|
||||||
|
int thisPlayerDimension = behavior.baritone.getPlayerContext().world().provider.getDimensionType().getId();
|
||||||
|
int currentRenderViewDimension = BaritoneAPI.getProvider().getPrimaryBaritone().getPlayerContext().world().provider.getDimensionType().getId();
|
||||||
|
|
||||||
|
if (thisPlayerDimension != currentRenderViewDimension) {
|
||||||
|
// this is a path for a bot in a different dimension, don't render it
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
Entity renderView = mc.getRenderViewEntity();
|
||||||
|
|
||||||
|
if (renderView.world != BaritoneAPI.getProvider().getPrimaryBaritone().getPlayerContext().world()) {
|
||||||
|
System.out.println("I have no idea what's going on");
|
||||||
|
System.out.println("The primary baritone is in a different world than the render view entity");
|
||||||
|
System.out.println("Not rendering the path");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (goal != null && Baritone.settings().renderGoal.value) {
|
if (goal != null && Baritone.settings().renderGoal.value) {
|
||||||
drawLitDankGoalBox(player, goal, partialTicks, Baritone.settings().colorGoalBox.get());
|
drawLitDankGoalBox(renderView, goal, partialTicks, Baritone.settings().colorGoalBox.get());
|
||||||
}
|
}
|
||||||
if (!Baritone.settings().renderPath.get()) {
|
if (!Baritone.settings().renderPath.get()) {
|
||||||
return;
|
return;
|
||||||
@ -79,34 +96,32 @@ public final class PathRenderer implements Helper {
|
|||||||
|
|
||||||
PathExecutor current = behavior.getCurrent(); // this should prevent most race conditions?
|
PathExecutor current = behavior.getCurrent(); // this should prevent most race conditions?
|
||||||
PathExecutor next = behavior.getNext(); // like, now it's not possible for current!=null to be true, then suddenly false because of another thread
|
PathExecutor next = behavior.getNext(); // like, now it's not possible for current!=null to be true, then suddenly false because of another thread
|
||||||
// TODO is this enough, or do we need to acquire a lock here?
|
|
||||||
// TODO benchmark synchronized in render loop
|
|
||||||
|
|
||||||
// Render the current path, if there is one
|
// Render the current path, if there is one
|
||||||
if (current != null && current.getPath() != null) {
|
if (current != null && current.getPath() != null) {
|
||||||
int renderBegin = Math.max(current.getPosition() - 3, 0);
|
int renderBegin = Math.max(current.getPosition() - 3, 0);
|
||||||
drawPath(current.getPath(), renderBegin, player, partialTicks, Baritone.settings().colorCurrentPath.get(), Baritone.settings().fadePath.get(), 10, 20);
|
drawPath(current.getPath(), renderBegin, renderView, partialTicks, Baritone.settings().colorCurrentPath.get(), Baritone.settings().fadePath.get(), 10, 20);
|
||||||
}
|
}
|
||||||
if (next != null && next.getPath() != null) {
|
if (next != null && next.getPath() != null) {
|
||||||
drawPath(next.getPath(), 0, player, partialTicks, Baritone.settings().colorNextPath.get(), Baritone.settings().fadePath.get(), 10, 20);
|
drawPath(next.getPath(), 0, renderView, partialTicks, Baritone.settings().colorNextPath.get(), Baritone.settings().fadePath.get(), 10, 20);
|
||||||
}
|
}
|
||||||
|
|
||||||
//long split = System.nanoTime();
|
//long split = System.nanoTime();
|
||||||
if (current != null) {
|
if (current != null) {
|
||||||
drawManySelectionBoxes(player, current.toBreak(), partialTicks, Baritone.settings().colorBlocksToBreak.get());
|
drawManySelectionBoxes(renderView, current.toBreak(), partialTicks, Baritone.settings().colorBlocksToBreak.get());
|
||||||
drawManySelectionBoxes(player, current.toPlace(), partialTicks, Baritone.settings().colorBlocksToPlace.get());
|
drawManySelectionBoxes(renderView, current.toPlace(), partialTicks, Baritone.settings().colorBlocksToPlace.get());
|
||||||
drawManySelectionBoxes(player, current.toWalkInto(), partialTicks, Baritone.settings().colorBlocksToWalkInto.get());
|
drawManySelectionBoxes(renderView, current.toWalkInto(), partialTicks, Baritone.settings().colorBlocksToWalkInto.get());
|
||||||
}
|
}
|
||||||
|
|
||||||
// If there is a path calculation currently running, render the path calculation process
|
// If there is a path calculation currently running, render the path calculation process
|
||||||
AbstractNodeCostSearch.getCurrentlyRunning().ifPresent(currentlyRunning -> {
|
AbstractNodeCostSearch.getCurrentlyRunning().ifPresent(currentlyRunning -> {
|
||||||
currentlyRunning.bestPathSoFar().ifPresent(p -> {
|
currentlyRunning.bestPathSoFar().ifPresent(p -> {
|
||||||
drawPath(p, 0, player, partialTicks, Baritone.settings().colorBestPathSoFar.get(), Baritone.settings().fadePath.get(), 10, 20);
|
drawPath(p, 0, renderView, partialTicks, Baritone.settings().colorBestPathSoFar.get(), Baritone.settings().fadePath.get(), 10, 20);
|
||||||
});
|
});
|
||||||
currentlyRunning.pathToMostRecentNodeConsidered().ifPresent(mr -> {
|
currentlyRunning.pathToMostRecentNodeConsidered().ifPresent(mr -> {
|
||||||
|
|
||||||
drawPath(mr, 0, player, partialTicks, Baritone.settings().colorMostRecentConsidered.get(), Baritone.settings().fadePath.get(), 10, 20);
|
drawPath(mr, 0, renderView, partialTicks, Baritone.settings().colorMostRecentConsidered.get(), Baritone.settings().fadePath.get(), 10, 20);
|
||||||
drawManySelectionBoxes(player, Collections.singletonList(mr.getDest()), partialTicks, Baritone.settings().colorMostRecentConsidered.get());
|
drawManySelectionBoxes(renderView, Collections.singletonList(mr.getDest()), partialTicks, Baritone.settings().colorMostRecentConsidered.get());
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
//long end = System.nanoTime();
|
//long end = System.nanoTime();
|
||||||
@ -116,7 +131,7 @@ public final class PathRenderer implements Helper {
|
|||||||
//}
|
//}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void drawPath(IPath path, int startIndex, EntityPlayerSP player, float partialTicks, Color color, boolean fadeOut, int fadeStart0, int fadeEnd0) {
|
public static void drawPath(IPath path, int startIndex, Entity player, float partialTicks, Color color, boolean fadeOut, int fadeStart0, int fadeEnd0) {
|
||||||
GlStateManager.enableBlend();
|
GlStateManager.enableBlend();
|
||||||
GlStateManager.tryBlendFuncSeparate(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA, GL_ONE, GL_ZERO);
|
GlStateManager.tryBlendFuncSeparate(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA, GL_ONE, GL_ZERO);
|
||||||
GlStateManager.color(color.getColorComponents(null)[0], color.getColorComponents(null)[1], color.getColorComponents(null)[2], 0.4F);
|
GlStateManager.color(color.getColorComponents(null)[0], color.getColorComponents(null)[1], color.getColorComponents(null)[2], 0.4F);
|
||||||
@ -175,7 +190,7 @@ public final class PathRenderer implements Helper {
|
|||||||
GlStateManager.disableBlend();
|
GlStateManager.disableBlend();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void drawLine(EntityPlayer player, double bp1x, double bp1y, double bp1z, double bp2x, double bp2y, double bp2z, float partialTicks) {
|
public static void drawLine(Entity player, double bp1x, double bp1y, double bp1z, double bp2x, double bp2y, double bp2z, float partialTicks) {
|
||||||
double d0 = player.lastTickPosX + (player.posX - player.lastTickPosX) * (double) partialTicks;
|
double d0 = player.lastTickPosX + (player.posX - player.lastTickPosX) * (double) partialTicks;
|
||||||
double d1 = player.lastTickPosY + (player.posY - player.lastTickPosY) * (double) partialTicks;
|
double d1 = player.lastTickPosY + (player.posY - player.lastTickPosY) * (double) partialTicks;
|
||||||
double d2 = player.lastTickPosZ + (player.posZ - player.lastTickPosZ) * (double) partialTicks;
|
double d2 = player.lastTickPosZ + (player.posZ - player.lastTickPosZ) * (double) partialTicks;
|
||||||
@ -187,7 +202,7 @@ public final class PathRenderer implements Helper {
|
|||||||
BUFFER.pos(bp1x + 0.5D - d0, bp1y + 0.5D - d1, bp1z + 0.5D - d2).endVertex();
|
BUFFER.pos(bp1x + 0.5D - d0, bp1y + 0.5D - d1, bp1z + 0.5D - d2).endVertex();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void drawManySelectionBoxes(EntityPlayer player, Collection<BlockPos> positions, float partialTicks, Color color) {
|
public static void drawManySelectionBoxes(Entity player, Collection<BlockPos> positions, float partialTicks, Color color) {
|
||||||
GlStateManager.enableBlend();
|
GlStateManager.enableBlend();
|
||||||
GlStateManager.tryBlendFuncSeparate(770, 771, 1, 0);
|
GlStateManager.tryBlendFuncSeparate(770, 771, 1, 0);
|
||||||
GlStateManager.color(color.getColorComponents(null)[0], color.getColorComponents(null)[1], color.getColorComponents(null)[2], 0.4F);
|
GlStateManager.color(color.getColorComponents(null)[0], color.getColorComponents(null)[1], color.getColorComponents(null)[2], 0.4F);
|
||||||
@ -206,7 +221,7 @@ public final class PathRenderer implements Helper {
|
|||||||
double renderPosY = player.lastTickPosY + (player.posY - player.lastTickPosY) * (double) partialTicks;
|
double renderPosY = player.lastTickPosY + (player.posY - player.lastTickPosY) * (double) partialTicks;
|
||||||
double renderPosZ = player.lastTickPosZ + (player.posZ - player.lastTickPosZ) * (double) partialTicks;
|
double renderPosZ = player.lastTickPosZ + (player.posZ - player.lastTickPosZ) * (double) partialTicks;
|
||||||
positions.forEach(pos -> {
|
positions.forEach(pos -> {
|
||||||
IBlockState state = BlockStateInterface.get(Baritone.INSTANCE.getPlayerContext(), pos);
|
IBlockState state = BlockStateInterface.get(BaritoneAPI.getProvider().getPrimaryBaritone().getPlayerContext(), pos);
|
||||||
AxisAlignedBB toDraw;
|
AxisAlignedBB toDraw;
|
||||||
if (state.getBlock().equals(Blocks.AIR)) {
|
if (state.getBlock().equals(Blocks.AIR)) {
|
||||||
toDraw = Blocks.DIRT.getDefaultState().getSelectedBoundingBox(Minecraft.getMinecraft().world, pos);
|
toDraw = Blocks.DIRT.getDefaultState().getSelectedBoundingBox(Minecraft.getMinecraft().world, pos);
|
||||||
@ -249,7 +264,7 @@ public final class PathRenderer implements Helper {
|
|||||||
GlStateManager.disableBlend();
|
GlStateManager.disableBlend();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void drawLitDankGoalBox(EntityPlayer player, Goal goal, float partialTicks, Color color) {
|
public static void drawLitDankGoalBox(Entity player, Goal goal, float partialTicks, Color color) {
|
||||||
double renderPosX = player.lastTickPosX + (player.posX - player.lastTickPosX) * (double) partialTicks;
|
double renderPosX = player.lastTickPosX + (player.posX - player.lastTickPosX) * (double) partialTicks;
|
||||||
double renderPosY = player.lastTickPosY + (player.posY - player.lastTickPosY) * (double) partialTicks;
|
double renderPosY = player.lastTickPosY + (player.posY - player.lastTickPosY) * (double) partialTicks;
|
||||||
double renderPosZ = player.lastTickPosZ + (player.posZ - player.lastTickPosZ) * (double) partialTicks;
|
double renderPosZ = player.lastTickPosZ + (player.posZ - player.lastTickPosZ) * (double) partialTicks;
|
||||||
|
@ -17,7 +17,7 @@
|
|||||||
|
|
||||||
package baritone.utils.player;
|
package baritone.utils.player;
|
||||||
|
|
||||||
import baritone.Baritone;
|
import baritone.api.BaritoneAPI;
|
||||||
import baritone.api.cache.IWorldData;
|
import baritone.api.cache.IWorldData;
|
||||||
import baritone.api.utils.IPlayerContext;
|
import baritone.api.utils.IPlayerContext;
|
||||||
import net.minecraft.client.Minecraft;
|
import net.minecraft.client.Minecraft;
|
||||||
@ -56,6 +56,6 @@ public final class LocalPlayerContext implements IPlayerContext {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public IWorldData worldData() {
|
public IWorldData worldData() {
|
||||||
return Baritone.INSTANCE.getWorldProvider().getCurrentWorld();
|
return BaritoneAPI.getProvider().getPrimaryBaritone().getWorldProvider().getCurrentWorld();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user