Compare commits
12 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
6d5617ff62 | ||
|
|
6e07cb78d8 | ||
|
|
72dcabd84c | ||
|
|
78352721ca | ||
|
|
69c745226a | ||
|
|
612a8a6dc3 | ||
|
|
9ca631e1b1 | ||
|
|
e360cdae53 | ||
|
|
48a45ecb4c | ||
|
|
c079a92c09 | ||
|
|
224bc79834 | ||
|
|
e6fd85cd42 |
@@ -25,7 +25,7 @@
|
||||
],
|
||||
"depends": {
|
||||
"fabricloader": ">=0.14.22",
|
||||
"minecraft": ["1.21.5"]
|
||||
"minecraft": ["1.21.9", "1.21.10"]
|
||||
},
|
||||
"custom": {
|
||||
"modmenu": {
|
||||
|
||||
@@ -35,6 +35,6 @@ A Minecraft pathfinder bot.
|
||||
modId="minecraft"
|
||||
mandatory=true
|
||||
# This version range declares a minimum of the current minecraft version up to but not including the next major version
|
||||
versionRange="[1.21.5]"
|
||||
versionRange="[1.21.9, 1.21.10]"
|
||||
ordering="NONE"
|
||||
side="BOTH"
|
||||
|
||||
@@ -2,19 +2,19 @@ org.gradle.jvmargs=-Xmx4G
|
||||
|
||||
available_loaders=fabric,neoforge,forge,tweaker
|
||||
|
||||
mod_version=1.14.0
|
||||
mod_version=1.16.0
|
||||
maven_group=baritone
|
||||
archives_base_name=baritone
|
||||
|
||||
java_version=21
|
||||
|
||||
minecraft_version=1.21.5
|
||||
minecraft_version=1.21.10
|
||||
|
||||
forge_version=55.0.9
|
||||
forge_version=60.0.0
|
||||
|
||||
neoforge_version=63-beta
|
||||
neoforge_version=1-beta
|
||||
|
||||
fabric_version=0.16.10
|
||||
fabric_version=0.17.2
|
||||
|
||||
nether_pathfinder_version=1.4.1
|
||||
|
||||
|
||||
@@ -35,6 +35,9 @@ A Minecraft pathfinder bot.
|
||||
modId="minecraft"
|
||||
type="required"
|
||||
# This version range declares a minimum of the current minecraft version up to but not including the next major version
|
||||
versionRange="[1.21.5]"
|
||||
versionRange="[1.21.9, 1.21.10]"
|
||||
ordering="NONE"
|
||||
side="BOTH"
|
||||
|
||||
[[mixins]]
|
||||
config = "mixins.baritone.json"
|
||||
|
||||
@@ -32,7 +32,6 @@ import net.minecraft.server.MinecraftServer;
|
||||
import net.minecraft.server.RegistryLayer;
|
||||
import net.minecraft.server.ReloadableServerRegistries;
|
||||
import net.minecraft.server.level.ServerLevel;
|
||||
import net.minecraft.server.level.progress.ChunkProgressListener;
|
||||
import net.minecraft.server.packs.PackType;
|
||||
import net.minecraft.server.packs.VanillaPackResources;
|
||||
import net.minecraft.server.packs.repository.ServerPacksSource;
|
||||
@@ -262,8 +261,8 @@ public final class BlockOptionalMeta {
|
||||
private static Unsafe unsafe = getUnsafe();
|
||||
private static CompletableFuture<RegistryAccess> registryAccess = load();
|
||||
|
||||
public ServerLevelStub(MinecraftServer $$0, Executor $$1, LevelStorageSource.LevelStorageAccess $$2, ServerLevelData $$3, ResourceKey<Level> $$4, LevelStem $$5, ChunkProgressListener $$6, boolean $$7, long $$8, List<CustomSpawner> $$9, boolean $$10, @Nullable RandomSequences $$11) {
|
||||
super($$0, $$1, $$2, $$3, $$4, $$5, $$6, $$7, $$8, $$9, $$10, $$11);
|
||||
public ServerLevelStub(MinecraftServer $$0, Executor $$1, LevelStorageSource.LevelStorageAccess $$2, ServerLevelData $$3, ResourceKey<Level> $$4, LevelStem $$5, boolean $$6, long $$7, List<CustomSpawner> $$8, boolean $$9, @Nullable RandomSequences $$10) {
|
||||
super($$0, $$1, $$2, $$3, $$4, $$5, $$6, $$7, $$8, $$9, $$10);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -101,7 +101,7 @@ public abstract class MixinLivingEntity extends Entity {
|
||||
method = "travelFallFlying",
|
||||
at = @At(
|
||||
value = "INVOKE",
|
||||
target = "net/minecraft/world/entity/LivingEntity.move(Lnet/minecraft/world/entity/MoverType;Lnet/minecraft/world/phys/Vec3;)V",
|
||||
target = "Lnet/minecraft/world/entity/LivingEntity;move(Lnet/minecraft/world/entity/MoverType;Lnet/minecraft/world/phys/Vec3;)V",
|
||||
shift = At.Shift.AFTER
|
||||
)
|
||||
)
|
||||
|
||||
@@ -24,7 +24,6 @@ import baritone.api.event.events.TickEvent;
|
||||
import baritone.api.event.events.WorldEvent;
|
||||
import baritone.api.event.events.type.EventState;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.gui.screens.ReceivingLevelScreen;
|
||||
import net.minecraft.client.gui.screens.Screen;
|
||||
import net.minecraft.client.multiplayer.ClientLevel;
|
||||
import net.minecraft.client.player.LocalPlayer;
|
||||
@@ -131,7 +130,7 @@ public class MixinMinecraft {
|
||||
method = "setLevel",
|
||||
at = @At("HEAD")
|
||||
)
|
||||
private void preLoadWorld(ClientLevel world, ReceivingLevelScreen.Reason arg2, CallbackInfo ci) {
|
||||
private void preLoadWorld(final ClientLevel world, final CallbackInfo ci) {
|
||||
// If we're unloading the world but one doesn't exist, ignore it
|
||||
if (this.level == null && world == null) {
|
||||
return;
|
||||
@@ -151,7 +150,7 @@ public class MixinMinecraft {
|
||||
method = "setLevel",
|
||||
at = @At("RETURN")
|
||||
)
|
||||
private void postLoadWorld(ClientLevel world, ReceivingLevelScreen.Reason arg2, CallbackInfo ci) {
|
||||
private void postLoadWorld(final ClientLevel world, final CallbackInfo ci) {
|
||||
// still fire event for both null, as that means we've just finished exiting a world
|
||||
|
||||
// mc.world changing is only the primary baritone
|
||||
|
||||
@@ -22,9 +22,9 @@ import baritone.api.IBaritone;
|
||||
import baritone.api.event.events.PacketEvent;
|
||||
import baritone.api.event.events.type.EventState;
|
||||
import io.netty.channel.Channel;
|
||||
import io.netty.channel.ChannelFutureListener;
|
||||
import io.netty.channel.ChannelHandlerContext;
|
||||
import net.minecraft.network.Connection;
|
||||
import net.minecraft.network.PacketSendListener;
|
||||
import net.minecraft.network.protocol.Packet;
|
||||
import net.minecraft.network.protocol.PacketFlow;
|
||||
import org.spongepowered.asm.mixin.Final;
|
||||
@@ -52,7 +52,7 @@ public class MixinNetworkManager {
|
||||
method = "sendPacket",
|
||||
at = @At("HEAD")
|
||||
)
|
||||
private void preDispatchPacket(Packet<?> packet, PacketSendListener packetSendListener, boolean flush, CallbackInfo ci) {
|
||||
private void preDispatchPacket(final Packet<?> packet, final ChannelFutureListener channelFutureListener, final boolean flush, final CallbackInfo ci) {
|
||||
if (this.receiving != PacketFlow.CLIENTBOUND) {
|
||||
return;
|
||||
}
|
||||
@@ -68,7 +68,7 @@ public class MixinNetworkManager {
|
||||
method = "sendPacket",
|
||||
at = @At("RETURN")
|
||||
)
|
||||
private void postDispatchPacket(Packet<?> packet, PacketSendListener packetSendListener, boolean flush, CallbackInfo ci) {
|
||||
private void postDispatchPacket(Packet<?> packet, ChannelFutureListener packetSendListener, boolean flush, CallbackInfo ci) {
|
||||
if (this.receiving != PacketFlow.CLIENTBOUND) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -21,13 +21,13 @@ import baritone.api.BaritoneAPI;
|
||||
import baritone.api.IBaritone;
|
||||
import baritone.api.event.events.ChatEvent;
|
||||
import baritone.utils.accessor.IGuiScreen;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.gui.screens.Screen;
|
||||
import net.minecraft.network.chat.ClickEvent;
|
||||
import net.minecraft.network.chat.Style;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.injection.At;
|
||||
import org.spongepowered.asm.mixin.injection.Inject;
|
||||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
|
||||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
|
||||
|
||||
import static baritone.api.command.IBaritoneChatControl.FORCE_COMMAND_PREFIX;
|
||||
|
||||
@@ -35,12 +35,8 @@ import static baritone.api.command.IBaritoneChatControl.FORCE_COMMAND_PREFIX;
|
||||
public abstract class MixinScreen implements IGuiScreen {
|
||||
|
||||
//TODO: switch to enum extention with mixin 9.0 or whenever Mumfrey gets around to it
|
||||
@Inject(method = "handleComponentClicked", at = @At(
|
||||
value = "INVOKE",
|
||||
target = "Lnet/minecraft/client/multiplayer/ClientPacketListener;sendUnsignedCommand(Ljava/lang/String;)Z"
|
||||
), cancellable = true)
|
||||
public void handleCustomClickEvent(final Style style, final CallbackInfoReturnable<Boolean> cir) {
|
||||
ClickEvent clickEvent = style.getClickEvent();
|
||||
@Inject(method = "handleClickEvent", at = @At(value = "HEAD"), cancellable = true)
|
||||
public void handleCustomClickEvent(final Minecraft minecraft, final ClickEvent clickEvent, final CallbackInfo ci) {
|
||||
if (clickEvent == null) {
|
||||
return;
|
||||
}
|
||||
@@ -52,7 +48,6 @@ public abstract class MixinScreen implements IGuiScreen {
|
||||
if (baritone != null) {
|
||||
baritone.getGameEventHandler().onSendChatMessage(new ChatEvent(command));
|
||||
}
|
||||
cir.setReturnValue(true);
|
||||
cir.cancel();
|
||||
ci.cancel();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -20,13 +20,14 @@ package baritone.launch.mixins;
|
||||
import baritone.api.BaritoneAPI;
|
||||
import baritone.api.IBaritone;
|
||||
import baritone.api.event.events.RenderEvent;
|
||||
import com.mojang.blaze3d.buffers.GpuBufferSlice;
|
||||
import com.mojang.blaze3d.resource.GraphicsResourceAllocator;
|
||||
import com.mojang.blaze3d.vertex.PoseStack;
|
||||
import net.minecraft.client.Camera;
|
||||
import net.minecraft.client.DeltaTracker;
|
||||
import net.minecraft.client.renderer.GameRenderer;
|
||||
import net.minecraft.client.renderer.LevelRenderer;
|
||||
import org.joml.Matrix4f;
|
||||
import org.joml.Vector4f;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.injection.At;
|
||||
import org.spongepowered.asm.mixin.injection.Inject;
|
||||
@@ -43,7 +44,7 @@ public class MixinWorldRenderer {
|
||||
method = "renderLevel",
|
||||
at = @At("RETURN")
|
||||
)
|
||||
private void onStartHand(final GraphicsResourceAllocator graphicsResourceAllocator, final DeltaTracker deltaTracker, final boolean bl, final Camera camera, final GameRenderer gameRenderer, final Matrix4f matrix4f, final Matrix4f matrix4f2, final CallbackInfo ci) {
|
||||
private void onStartHand(final GraphicsResourceAllocator graphicsResourceAllocator, final DeltaTracker deltaTracker, final boolean bl, final Camera camera, final Matrix4f matrix4f, final Matrix4f matrix4f2, final Matrix4f matrix4f3, final GpuBufferSlice gpuBufferSlice, final Vector4f vector4f, final boolean bl2, final CallbackInfo ci) {
|
||||
for (IBaritone ibaritone : BaritoneAPI.getProvider().getAllBaritones()) {
|
||||
PoseStack poseStack = new PoseStack();
|
||||
poseStack.mulPose(matrix4f);
|
||||
|
||||
@@ -33,16 +33,18 @@ import baritone.pathing.calc.AbstractNodeCostSearch;
|
||||
import baritone.pathing.movement.CalculationContext;
|
||||
import baritone.pathing.movement.MovementHelper;
|
||||
import baritone.pathing.path.PathExecutor;
|
||||
import baritone.process.ElytraProcess;
|
||||
import baritone.utils.PathRenderer;
|
||||
import baritone.utils.PathingCommandContext;
|
||||
import baritone.utils.pathing.Favoring;
|
||||
import net.minecraft.client.multiplayer.ClientLevel;
|
||||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.network.chat.Component;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Comparator;
|
||||
import java.util.Objects;
|
||||
import java.util.Optional;
|
||||
import java.util.concurrent.LinkedBlockingQueue;
|
||||
import net.minecraft.core.BlockPos;
|
||||
|
||||
public final class PathingBehavior extends Behavior implements IPathingBehavior, Helper {
|
||||
|
||||
@@ -158,7 +160,9 @@ public final class PathingBehavior extends Behavior implements IPathingBehavior,
|
||||
queuePathEvent(PathEvent.AT_GOAL);
|
||||
next = null;
|
||||
if (Baritone.settings().disconnectOnArrival.value) {
|
||||
ctx.world().disconnect();
|
||||
if (ctx.world() instanceof ClientLevel clientLevel) {
|
||||
clientLevel.disconnect(Component.literal("[Baritone] Arrived at goal!"));
|
||||
}
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -26,19 +26,12 @@ import baritone.api.utils.IPlayerContext;
|
||||
import baritone.utils.accessor.IPalettedContainer;
|
||||
import io.netty.buffer.Unpooled;
|
||||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.core.IdMapper;
|
||||
import net.minecraft.network.FriendlyByteBuf;
|
||||
import net.minecraft.util.BitStorage;
|
||||
import net.minecraft.world.level.ChunkPos;
|
||||
import net.minecraft.world.level.block.Block;
|
||||
import net.minecraft.world.level.block.state.BlockState;
|
||||
import net.minecraft.world.level.chunk.GlobalPalette;
|
||||
import net.minecraft.world.level.chunk.ChunkSource;
|
||||
import net.minecraft.world.level.chunk.LevelChunk;
|
||||
import net.minecraft.world.level.chunk.LevelChunkSection;
|
||||
import net.minecraft.world.level.chunk.Palette;
|
||||
import net.minecraft.world.level.chunk.PalettedContainer;
|
||||
import net.minecraft.world.level.chunk.SingleValuePalette;
|
||||
import net.minecraft.world.level.chunk.*;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
@@ -289,7 +282,7 @@ public enum FasterWorldScanner implements IWorldScanner {
|
||||
return PALETTE_REGISTRY_SENTINEL;
|
||||
} else {
|
||||
FriendlyByteBuf buf = new FriendlyByteBuf(Unpooled.buffer());
|
||||
palette.write(buf);
|
||||
palette.write(buf, Block.BLOCK_STATE_REGISTRY);
|
||||
int size = buf.readVarInt();
|
||||
BlockState[] states = new BlockState[size];
|
||||
for (int i = 0; i < size; i++) {
|
||||
|
||||
@@ -23,6 +23,8 @@ import baritone.api.process.ICustomGoalProcess;
|
||||
import baritone.api.process.PathingCommand;
|
||||
import baritone.api.process.PathingCommandType;
|
||||
import baritone.utils.BaritoneProcessHelper;
|
||||
import net.minecraft.client.multiplayer.ClientLevel;
|
||||
import net.minecraft.network.chat.Component;
|
||||
|
||||
/**
|
||||
* As set by ExampleBaritoneControl or something idk
|
||||
@@ -105,7 +107,9 @@ public final class CustomGoalProcess extends BaritoneProcessHelper implements IC
|
||||
if (this.goal == null || (this.goal.isInGoal(ctx.playerFeet()) && this.goal.isInGoal(baritone.getPathingBehavior().pathStart()))) {
|
||||
onLostControl(); // we're there xd
|
||||
if (Baritone.settings().disconnectOnArrival.value) {
|
||||
ctx.world().disconnect();
|
||||
if (ctx.world() instanceof ClientLevel clientLevel) {
|
||||
clientLevel.disconnect(Component.literal("[Baritone] Arrived at goal!"));
|
||||
}
|
||||
}
|
||||
if (Baritone.settings().notificationOnPathComplete.value) {
|
||||
logNotification("Pathing complete", false);
|
||||
|
||||
@@ -44,8 +44,10 @@ import baritone.process.elytra.NullElytraProcess;
|
||||
import baritone.utils.BaritoneProcessHelper;
|
||||
import baritone.utils.PathingCommandContext;
|
||||
import it.unimi.dsi.fastutil.longs.LongOpenHashSet;
|
||||
import net.minecraft.client.multiplayer.ClientLevel;
|
||||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.core.NonNullList;
|
||||
import net.minecraft.network.chat.Component;
|
||||
import net.minecraft.world.entity.EquipmentSlot;
|
||||
import net.minecraft.world.item.ItemStack;
|
||||
import net.minecraft.world.item.Items;
|
||||
@@ -157,7 +159,9 @@ public class ElytraProcess extends BaritoneProcessHelper implements IBaritonePro
|
||||
if (Baritone.settings().disconnectOnArrival.value && !reachedGoal) {
|
||||
// don't be active when the user logs back in
|
||||
this.onLostControl();
|
||||
ctx.world().disconnect();
|
||||
if (ctx.world() instanceof ClientLevel clientLevel) {
|
||||
clientLevel.disconnect(Component.literal("[Baritone] Arrived at goal!"));
|
||||
}
|
||||
return new PathingCommand(null, PathingCommandType.CANCEL_AND_SET_GOAL);
|
||||
}
|
||||
reachedGoal = true;
|
||||
|
||||
@@ -30,6 +30,7 @@ import net.minecraft.world.level.block.Blocks;
|
||||
import net.minecraft.world.level.block.state.BlockState;
|
||||
import net.minecraft.world.level.chunk.LevelChunk;
|
||||
import net.minecraft.world.level.chunk.LevelChunkSection;
|
||||
import net.minecraft.world.level.chunk.PaletteResize;
|
||||
import net.minecraft.world.level.chunk.PalettedContainer;
|
||||
import net.minecraft.world.phys.Vec3;
|
||||
|
||||
@@ -195,7 +196,7 @@ public final class NetherPathfinderContext {
|
||||
continue;
|
||||
}
|
||||
final PalettedContainer<BlockState> bsc = extendedblockstorage.getStates();
|
||||
final int airId = ((IPalettedContainer<BlockState>) bsc).getPalette().idFor(AIR_BLOCK_STATE);
|
||||
final int airId = ((IPalettedContainer<BlockState>) bsc).getPalette().idFor(AIR_BLOCK_STATE, PaletteResize.noResizeExpected());
|
||||
// pasted from FasterWorldScanner
|
||||
final BitStorage array = ((IPalettedContainer<BlockState>) bsc).getStorage();
|
||||
if (array == null) continue;
|
||||
|
||||
@@ -18,15 +18,19 @@
|
||||
package baritone.utils;
|
||||
|
||||
import com.mojang.blaze3d.buffers.GpuBuffer;
|
||||
import com.mojang.blaze3d.buffers.GpuBufferSlice;
|
||||
import com.mojang.blaze3d.pipeline.RenderPipeline;
|
||||
import com.mojang.blaze3d.pipeline.RenderTarget;
|
||||
import com.mojang.blaze3d.systems.RenderPass;
|
||||
import com.mojang.blaze3d.systems.RenderSystem;
|
||||
import com.mojang.blaze3d.textures.GpuTexture;
|
||||
import com.mojang.blaze3d.systems.ScissorState;
|
||||
import com.mojang.blaze3d.textures.GpuTextureView;
|
||||
import com.mojang.blaze3d.vertex.MeshData;
|
||||
import com.mojang.blaze3d.vertex.VertexFormat;
|
||||
import net.minecraft.client.renderer.RenderStateShard;
|
||||
import net.minecraft.client.renderer.RenderType;
|
||||
import org.joml.Vector3f;
|
||||
import org.joml.Vector4f;
|
||||
|
||||
import java.util.OptionalDouble;
|
||||
import java.util.OptionalInt;
|
||||
@@ -43,11 +47,6 @@ public class BaritoneRenderType extends RenderType {
|
||||
return new BaritoneRenderType(name, bufferSize, false, false, renderPipeline);
|
||||
}
|
||||
|
||||
@Override
|
||||
public RenderPipeline getRenderPipeline() {
|
||||
return this.renderPipeline;
|
||||
}
|
||||
|
||||
@Override
|
||||
public VertexFormat format() {
|
||||
return this.renderPipeline.getVertexFormat();
|
||||
@@ -59,46 +58,65 @@ public class BaritoneRenderType extends RenderType {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void draw(final MeshData meshData) {
|
||||
RenderPipeline renderPipeline = this.getRenderPipeline();
|
||||
this.setupRenderState();
|
||||
public RenderPipeline pipeline() {
|
||||
return this.renderPipeline;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void draw(final MeshData meshData) {
|
||||
this.setupRenderState();
|
||||
try {
|
||||
GpuBuffer gpuBuffer = renderPipeline.getVertexFormat().uploadImmediateVertexBuffer(meshData.vertexBuffer());
|
||||
GpuBuffer gpuBuffer2;
|
||||
GpuBuffer vertexBuffer = this.renderPipeline.getVertexFormat().uploadImmediateVertexBuffer(meshData.vertexBuffer());
|
||||
GpuBuffer indexBuffer;
|
||||
VertexFormat.IndexType indexType;
|
||||
if (meshData.indexBuffer() == null) {
|
||||
RenderSystem.AutoStorageIndexBuffer autoStorageIndexBuffer = RenderSystem.getSequentialBuffer(meshData.drawState().mode());
|
||||
gpuBuffer2 = autoStorageIndexBuffer.getBuffer(meshData.drawState().indexCount());
|
||||
indexBuffer = autoStorageIndexBuffer.getBuffer(meshData.drawState().indexCount());
|
||||
indexType = autoStorageIndexBuffer.type();
|
||||
} else {
|
||||
gpuBuffer2 = renderPipeline.getVertexFormat().uploadImmediateIndexBuffer(meshData.indexBuffer());
|
||||
indexBuffer = this.renderPipeline.getVertexFormat().uploadImmediateIndexBuffer(meshData.indexBuffer());
|
||||
indexType = meshData.drawState().indexType();
|
||||
}
|
||||
|
||||
RenderTarget renderTarget = getRenderTarget();
|
||||
RenderTarget renderTarget = RenderStateShard.MAIN_TARGET.getRenderTarget();
|
||||
GpuTextureView colorTextureTarget = RenderSystem.outputColorTextureOverride != null
|
||||
? RenderSystem.outputColorTextureOverride
|
||||
: renderTarget.getColorTextureView();
|
||||
GpuTextureView depthTextureTarget = renderTarget.useDepth
|
||||
? (RenderSystem.outputDepthTextureOverride != null ? RenderSystem.outputDepthTextureOverride : renderTarget.getDepthTextureView())
|
||||
: null;
|
||||
|
||||
try (RenderPass renderPass = RenderSystem.getDevice().createCommandEncoder().createRenderPass(
|
||||
renderTarget.getColorTexture(),
|
||||
OptionalInt.empty(),
|
||||
renderTarget.useDepth ? renderTarget.getDepthTexture() : null,
|
||||
OptionalDouble.empty())
|
||||
) {
|
||||
renderPass.setPipeline(renderPipeline);
|
||||
renderPass.setVertexBuffer(0, gpuBuffer);
|
||||
if (RenderSystem.SCISSOR_STATE.isEnabled()) {
|
||||
renderPass.enableScissor(RenderSystem.SCISSOR_STATE);
|
||||
GpuBufferSlice dynamicTransformsUbo = RenderSystem.getDynamicUniforms()
|
||||
.writeTransform(
|
||||
RenderSystem.getModelViewMatrix(),
|
||||
new Vector4f(1.0F, 1.0F, 1.0F, 1.0F),
|
||||
new Vector3f(),
|
||||
RenderSystem.getTextureMatrix(),
|
||||
RenderSystem.getShaderLineWidth()
|
||||
);
|
||||
|
||||
try (RenderPass renderPass = RenderSystem.getDevice()
|
||||
.createCommandEncoder()
|
||||
.createRenderPass(() -> "Immediate draw for " + this.getName(), colorTextureTarget, OptionalInt.empty(), depthTextureTarget, OptionalDouble.empty())) {
|
||||
renderPass.setPipeline(this.renderPipeline);
|
||||
ScissorState scissorState = RenderSystem.getScissorStateForRenderTypeDraws();
|
||||
if (scissorState.enabled()) {
|
||||
renderPass.enableScissor(scissorState.x(), scissorState.y(), scissorState.width(), scissorState.height());
|
||||
}
|
||||
|
||||
for(int i = 0; i < 12; ++i) {
|
||||
GpuTexture gpuTexture = RenderSystem.getShaderTexture(i);
|
||||
if (gpuTexture != null) {
|
||||
renderPass.bindSampler("Sampler" + i, gpuTexture);
|
||||
RenderSystem.bindDefaultUniforms(renderPass);
|
||||
renderPass.setUniform("DynamicTransforms", dynamicTransformsUbo);
|
||||
renderPass.setVertexBuffer(0, vertexBuffer);
|
||||
|
||||
for (int i = 0; i < 12; i++) {
|
||||
GpuTextureView texture = RenderSystem.getShaderTexture(i);
|
||||
if (texture != null) {
|
||||
renderPass.bindSampler("Sampler" + i, texture);
|
||||
}
|
||||
}
|
||||
|
||||
renderPass.setIndexBuffer(gpuBuffer2, indexType);
|
||||
renderPass.drawIndexed(0, meshData.drawState().indexCount());
|
||||
renderPass.setIndexBuffer(indexBuffer, indexType);
|
||||
renderPass.drawIndexed(0, 0, meshData.drawState().indexCount(), 1);
|
||||
}
|
||||
} catch (Throwable e) {
|
||||
try {
|
||||
@@ -113,9 +131,4 @@ public class BaritoneRenderType extends RenderType {
|
||||
|
||||
this.clearRenderState();
|
||||
}
|
||||
|
||||
@Override
|
||||
public RenderTarget getRenderTarget() {
|
||||
return RenderStateShard.MAIN_TARGET.getRenderTarget();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -27,6 +27,7 @@ import com.mojang.blaze3d.vertex.PoseStack;
|
||||
import net.minecraft.ChatFormatting;
|
||||
import net.minecraft.client.gui.GuiGraphics;
|
||||
import net.minecraft.client.gui.screens.Screen;
|
||||
import net.minecraft.client.input.MouseButtonEvent;
|
||||
import net.minecraft.client.player.LocalPlayer;
|
||||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.network.chat.ClickEvent;
|
||||
@@ -84,9 +85,9 @@ public class GuiClick extends Screen implements Helper {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean mouseReleased(double mouseX, double mouseY, int mouseButton) {
|
||||
public boolean mouseReleased(MouseButtonEvent event) {
|
||||
if (currentMouseOver != null) { //Catch this, or else a click into void will result in a crash
|
||||
if (mouseButton == 0) {
|
||||
if (event.button() == 0) {
|
||||
if (clickStart != null && !clickStart.equals(currentMouseOver)) {
|
||||
BaritoneAPI.getProvider().getPrimaryBaritone().getSelectionManager().removeAllSelections();
|
||||
BaritoneAPI.getProvider().getPrimaryBaritone().getSelectionManager().addSelection(BetterBlockPos.from(clickStart), BetterBlockPos.from(currentMouseOver));
|
||||
@@ -101,18 +102,18 @@ public class GuiClick extends Screen implements Helper {
|
||||
} else {
|
||||
BaritoneAPI.getProvider().getPrimaryBaritone().getCustomGoalProcess().setGoalAndPath(new GoalBlock(currentMouseOver));
|
||||
}
|
||||
} else if (mouseButton == 1) {
|
||||
} else if (event.button() == 1) {
|
||||
BaritoneAPI.getProvider().getPrimaryBaritone().getCustomGoalProcess().setGoalAndPath(new GoalBlock(currentMouseOver.above()));
|
||||
}
|
||||
}
|
||||
clickStart = null;
|
||||
return super.mouseReleased(mouseX, mouseY, mouseButton);
|
||||
return super.mouseReleased(event);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean mouseClicked(double mouseX, double mouseY, int mouseButton) {
|
||||
public boolean mouseClicked(MouseButtonEvent event, boolean doubleClick) {
|
||||
clickStart = currentMouseOver;
|
||||
return super.mouseClicked(mouseX, mouseY, mouseButton);
|
||||
return super.mouseClicked(event, doubleClick);
|
||||
}
|
||||
|
||||
public void onRender(PoseStack modelViewStack, Matrix4f projectionMatrix) {
|
||||
|
||||
@@ -27,7 +27,6 @@ import baritone.behavior.PathingBehavior;
|
||||
import baritone.pathing.path.PathExecutor;
|
||||
import com.mojang.blaze3d.vertex.BufferBuilder;
|
||||
import com.mojang.blaze3d.vertex.PoseStack;
|
||||
import net.minecraft.client.renderer.blockentity.BeaconRenderer;
|
||||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.util.Mth;
|
||||
import net.minecraft.world.entity.Entity;
|
||||
@@ -267,28 +266,7 @@ public final class PathRenderer implements IRenderer {
|
||||
// inject hook into LevelRenderer#renderBlockEntities where the matrices have already been set up correctly
|
||||
// copy out and modify the vanilla beacon render code
|
||||
// also another issue on 1.21.5 is we don't have a simple method call for editing the beacon's depth test
|
||||
|
||||
stack.pushPose(); // push
|
||||
stack.translate(goalPos.getX() - renderPosX, -renderPosY, goalPos.getZ() - renderPosZ); // translate
|
||||
|
||||
BeaconRenderer.renderBeaconBeam(
|
||||
stack,
|
||||
ctx.minecraft().renderBuffers().bufferSource(),
|
||||
BeaconRenderer.BEAM_LOCATION,
|
||||
settings.renderGoalAnimated.value ? partialTicks : 0,
|
||||
1.0F,
|
||||
settings.renderGoalAnimated.value ? ctx.world().getGameTime() : 0,
|
||||
(int) minY,
|
||||
(int) maxY,
|
||||
color.getRGB(),
|
||||
|
||||
// Arguments filled by the private method lol
|
||||
0.2F,
|
||||
0.25F
|
||||
);
|
||||
|
||||
stack.popPose(); // pop
|
||||
return;
|
||||
// return;
|
||||
}
|
||||
|
||||
minX = goalPos.getX() + 0.002 - renderPosX;
|
||||
|
||||
Reference in New Issue
Block a user