mega cancer render cached chunks

This commit is contained in:
Leijurv 2019-01-17 18:54:37 -08:00
parent a5b9885767
commit b005ce8e6b
No known key found for this signature in database
GPG Key ID: 44A3EA646EADAC6A
4 changed files with 54 additions and 4 deletions

View File

@ -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.block.state.IBlockState;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.ChunkCache;
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(ChunkCache.class)
public class MixinChunkCache {
@Inject(
method = "getBlockState",
at = @At("HEAD"),
cancellable = true
)
private void getBlockState(BlockPos pos, CallbackInfoReturnable<IBlockState> ci) {
Baritone baritone = (Baritone) BaritoneAPI.getProvider().getPrimaryBaritone();
IPlayerContext ctx = baritone.getPlayerContext();
if (ctx.player() != null && ctx.world() != null && baritone.bsi != null) {
ci.setReturnValue(baritone.bsi.get0(pos));
//ci.setReturnValue(Blocks.DIRT.getDefaultState());
}
}
}

View File

@ -10,6 +10,7 @@
"client": [
"MixinAnvilChunkLoader",
"MixinBlockPos",
"MixinChunkCache",
"MixinChunkProviderClient",
"MixinChunkProviderServer",
"MixinEntity",

View File

@ -29,10 +29,7 @@ import baritone.process.CustomGoalProcess;
import baritone.process.FollowProcess;
import baritone.process.GetToBlockProcess;
import baritone.process.MineProcess;
import baritone.utils.BaritoneAutoTest;
import baritone.utils.ExampleBaritoneControl;
import baritone.utils.InputOverrideHandler;
import baritone.utils.PathingControlManager;
import baritone.utils.*;
import baritone.utils.player.PrimaryPlayerContext;
import net.minecraft.client.Minecraft;
@ -89,6 +86,8 @@ public class Baritone implements IBaritone {
private IPlayerContext playerContext;
private WorldProvider worldProvider;
public BlockStateInterface bsi;
Baritone() {
this.gameEventHandler = new GameEventHandler(this);
}

View File

@ -23,6 +23,7 @@ import baritone.api.event.events.type.EventState;
import baritone.api.event.listener.IEventBus;
import baritone.api.event.listener.IGameEventListener;
import baritone.cache.WorldProvider;
import baritone.utils.BlockStateInterface;
import baritone.utils.Helper;
import net.minecraft.world.World;
import net.minecraft.world.chunk.Chunk;
@ -46,6 +47,9 @@ public final class GameEventHandler implements IEventBus, Helper {
@Override
public final void onTick(TickEvent event) {
try {
baritone.bsi = new BlockStateInterface(baritone.getPlayerContext(), true);
} catch (Exception ex) {}
listeners.forEach(l -> l.onTick(event));
}