actually works
This commit is contained in:
parent
b005ce8e6b
commit
735cf47c35
@ -445,6 +445,11 @@ public class Settings {
|
|||||||
*/
|
*/
|
||||||
public Setting<Boolean> pathThroughCachedOnly = new Setting<>(false);
|
public Setting<Boolean> pathThroughCachedOnly = new Setting<>(false);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 😎
|
||||||
|
*/
|
||||||
|
public Setting<Boolean> renderCachedChunks = new Setting<>(false);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Whether or not to use the "#" command prefix
|
* Whether or not to use the "#" command prefix
|
||||||
*/
|
*/
|
||||||
|
@ -38,9 +38,21 @@ public class MixinChunkCache {
|
|||||||
private void getBlockState(BlockPos pos, CallbackInfoReturnable<IBlockState> ci) {
|
private void getBlockState(BlockPos pos, CallbackInfoReturnable<IBlockState> ci) {
|
||||||
Baritone baritone = (Baritone) BaritoneAPI.getProvider().getPrimaryBaritone();
|
Baritone baritone = (Baritone) BaritoneAPI.getProvider().getPrimaryBaritone();
|
||||||
IPlayerContext ctx = baritone.getPlayerContext();
|
IPlayerContext ctx = baritone.getPlayerContext();
|
||||||
if (ctx.player() != null && ctx.world() != null && baritone.bsi != null) {
|
if (ctx.player() != null && ctx.world() != null && baritone.bsi != null && Baritone.settings().renderCachedChunks.get()) {
|
||||||
ci.setReturnValue(baritone.bsi.get0(pos));
|
ci.setReturnValue(baritone.bsi.get0(pos));
|
||||||
//ci.setReturnValue(Blocks.DIRT.getDefaultState());
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Inject(
|
||||||
|
method = "isEmpty",
|
||||||
|
at = @At("HEAD"),
|
||||||
|
cancellable = true
|
||||||
|
)
|
||||||
|
private void isEmpty(CallbackInfoReturnable<Boolean> ci) {
|
||||||
|
Baritone baritone = (Baritone) BaritoneAPI.getProvider().getPrimaryBaritone();
|
||||||
|
IPlayerContext ctx = baritone.getPlayerContext();
|
||||||
|
if (ctx.player() != null && ctx.world() != null && baritone.bsi != null && Baritone.settings().renderCachedChunks.get()) {
|
||||||
|
ci.setReturnValue(false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -0,0 +1,46 @@
|
|||||||
|
/*
|
||||||
|
* This file is part of Baritone.
|
||||||
|
*
|
||||||
|
* Baritone is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU Lesser General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* Baritone is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU Lesser General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Lesser General Public License
|
||||||
|
* along with Baritone. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package baritone.launch.mixins;
|
||||||
|
|
||||||
|
import baritone.Baritone;
|
||||||
|
import baritone.api.BaritoneAPI;
|
||||||
|
import baritone.api.utils.IPlayerContext;
|
||||||
|
import net.minecraft.client.renderer.chunk.ChunkRenderWorker;
|
||||||
|
import net.minecraft.util.math.BlockPos;
|
||||||
|
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;
|
||||||
|
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
|
||||||
|
|
||||||
|
@Mixin(ChunkRenderWorker.class)
|
||||||
|
public class MixinChunkRenderWorker {
|
||||||
|
@Inject(
|
||||||
|
method = "isChunkExisting",
|
||||||
|
at = @At("HEAD"),
|
||||||
|
cancellable = true
|
||||||
|
)
|
||||||
|
private void isChunkExisting(BlockPos pos, World world, CallbackInfoReturnable<Boolean> ci) {
|
||||||
|
Baritone baritone = (Baritone) BaritoneAPI.getProvider().getPrimaryBaritone();
|
||||||
|
IPlayerContext ctx = baritone.getPlayerContext();
|
||||||
|
if (ctx.player() != null && ctx.world() != null && baritone.bsi != null && Baritone.settings().renderCachedChunks.get()) {
|
||||||
|
ci.setReturnValue(baritone.bsi.isLoaded(pos.getX(), pos.getZ()));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -13,6 +13,7 @@
|
|||||||
"MixinChunkCache",
|
"MixinChunkCache",
|
||||||
"MixinChunkProviderClient",
|
"MixinChunkProviderClient",
|
||||||
"MixinChunkProviderServer",
|
"MixinChunkProviderServer",
|
||||||
|
"MixinChunkRenderWorker",
|
||||||
"MixinEntity",
|
"MixinEntity",
|
||||||
"MixinEntityLivingBase",
|
"MixinEntityLivingBase",
|
||||||
"MixinEntityPlayerSP",
|
"MixinEntityPlayerSP",
|
||||||
|
@ -24,6 +24,7 @@ import baritone.api.cache.IWaypoint;
|
|||||||
import baritone.api.event.events.ChatEvent;
|
import baritone.api.event.events.ChatEvent;
|
||||||
import baritone.api.pathing.goals.*;
|
import baritone.api.pathing.goals.*;
|
||||||
import baritone.api.pathing.movement.ActionCosts;
|
import baritone.api.pathing.movement.ActionCosts;
|
||||||
|
import baritone.api.utils.BetterBlockPos;
|
||||||
import baritone.api.utils.SettingsUtil;
|
import baritone.api.utils.SettingsUtil;
|
||||||
import baritone.behavior.Behavior;
|
import baritone.behavior.Behavior;
|
||||||
import baritone.behavior.PathingBehavior;
|
import baritone.behavior.PathingBehavior;
|
||||||
@ -35,6 +36,7 @@ import baritone.pathing.movement.Moves;
|
|||||||
import baritone.process.CustomGoalProcess;
|
import baritone.process.CustomGoalProcess;
|
||||||
import baritone.utils.pathing.SegmentedCalculator;
|
import baritone.utils.pathing.SegmentedCalculator;
|
||||||
import net.minecraft.block.Block;
|
import net.minecraft.block.Block;
|
||||||
|
import net.minecraft.client.Minecraft;
|
||||||
import net.minecraft.client.multiplayer.ChunkProviderClient;
|
import net.minecraft.client.multiplayer.ChunkProviderClient;
|
||||||
import net.minecraft.entity.Entity;
|
import net.minecraft.entity.Entity;
|
||||||
import net.minecraft.entity.player.EntityPlayer;
|
import net.minecraft.entity.player.EntityPlayer;
|
||||||
@ -284,6 +286,12 @@ public class ExampleBaritoneControl extends Behavior implements Helper {
|
|||||||
logDirect("Baritone settings reset");
|
logDirect("Baritone settings reset");
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
if (msg.equals("render")) {
|
||||||
|
BetterBlockPos pf = ctx.playerFeet();
|
||||||
|
Minecraft.getMinecraft().renderGlobal.markBlockRangeForRenderUpdate(pf.x - 500, pf.y - 500, pf.z - 500, pf.x + 500, pf.y + 500, pf.z + 500);
|
||||||
|
logDirect("okay");
|
||||||
|
return true;
|
||||||
|
}
|
||||||
if (msg.equals("echest")) {
|
if (msg.equals("echest")) {
|
||||||
Optional<List<ItemStack>> contents = baritone.getMemoryBehavior().echest();
|
Optional<List<ItemStack>> contents = baritone.getMemoryBehavior().echest();
|
||||||
if (contents.isPresent()) {
|
if (contents.isPresent()) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user