forked from RepoMirrors/baritone
Don't dispatch RenderEvent if bot isn't in same dimension
This commit is contained in:
parent
5b1340e362
commit
9e225949ea
|
@ -21,6 +21,7 @@ import baritone.api.BaritoneAPI;
|
|||
import baritone.api.IBaritone;
|
||||
import baritone.api.event.events.RenderEvent;
|
||||
import net.minecraft.client.renderer.EntityRenderer;
|
||||
import net.minecraft.world.World;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.injection.At;
|
||||
import org.spongepowered.asm.mixin.injection.Inject;
|
||||
|
@ -38,7 +39,13 @@ public class MixinEntityRenderer {
|
|||
)
|
||||
)
|
||||
private void renderWorldPass(int pass, float partialTicks, long finishTimeNano, CallbackInfo ci) {
|
||||
int renderViewDimension = BaritoneAPI.getProvider().getPrimaryBaritone().getPlayerContext().world().provider.getDimensionType().getId();
|
||||
|
||||
for (IBaritone ibaritone : BaritoneAPI.getProvider().getAllBaritones()) {
|
||||
World world = ibaritone.getPlayerContext().world();
|
||||
if (world == null || world.provider.getDimensionType().getId() != renderViewDimension) {
|
||||
continue;
|
||||
}
|
||||
ibaritone.getGameEventHandler().onRenderPass(new RenderEvent(partialTicks));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -58,18 +58,10 @@ public final class PathRenderer implements IRenderer {
|
|||
return;
|
||||
}
|
||||
|
||||
if (Helper.mc.currentScreen instanceof GuiClick) {
|
||||
if (Helper.mc.currentScreen instanceof GuiClick && behavior.baritone == BaritoneAPI.getProvider().getPrimaryBaritone()) {
|
||||
((GuiClick) Helper.mc.currentScreen).onRender();
|
||||
}
|
||||
|
||||
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 = Helper.mc.getRenderViewEntity();
|
||||
|
||||
if (renderView.world != BaritoneAPI.getProvider().getPrimaryBaritone().getPlayerContext().world()) {
|
||||
|
|
Loading…
Reference in New Issue