could this be the worst possible way to copy a chunk array
This commit is contained in:
@@ -51,6 +51,7 @@ public final class GameEventHandler implements IEventBus, Helper {
|
||||
try {
|
||||
baritone.bsi = new BlockStateInterface(baritone.getPlayerContext(), true);
|
||||
} catch (Exception ex) {
|
||||
ex.printStackTrace();
|
||||
baritone.bsi = null;
|
||||
}
|
||||
} else {
|
||||
|
||||
@@ -21,6 +21,7 @@ import baritone.Baritone;
|
||||
import baritone.api.utils.IPlayerContext;
|
||||
import baritone.cache.CachedRegion;
|
||||
import baritone.cache.WorldData;
|
||||
import baritone.utils.accessor.IClientChunkProvider;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.block.Blocks;
|
||||
@@ -59,9 +60,10 @@ public class BlockStateInterface {
|
||||
|
||||
public BlockStateInterface(World world, WorldData worldData, boolean copyLoadedChunks) {
|
||||
this.worldData = worldData;
|
||||
this.provider = (ClientChunkProvider) world.getChunkProvider();
|
||||
if (copyLoadedChunks) { // todo
|
||||
System.out.println("Really gotta do this");
|
||||
if (copyLoadedChunks) {
|
||||
this.provider = ((IClientChunkProvider) world.getChunkProvider()).createThreadSafeCopy();
|
||||
} else {
|
||||
this.provider = (ClientChunkProvider) world.getChunkProvider();
|
||||
}
|
||||
this.useTheRealWorld = !Baritone.settings().pathThroughCachedOnly.value;
|
||||
if (!Minecraft.getInstance().isOnExecutionThread()) {
|
||||
|
||||
34
src/main/java/baritone/utils/accessor/IChunkArray.java
Normal file
34
src/main/java/baritone/utils/accessor/IChunkArray.java
Normal file
@@ -0,0 +1,34 @@
|
||||
/*
|
||||
* 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.utils.accessor;
|
||||
|
||||
import net.minecraft.world.chunk.Chunk;
|
||||
|
||||
import java.util.concurrent.atomic.AtomicReferenceArray;
|
||||
|
||||
public interface IChunkArray {
|
||||
void copyFrom(IChunkArray other);
|
||||
|
||||
AtomicReferenceArray<Chunk> getChunks();
|
||||
|
||||
int centerX();
|
||||
|
||||
int centerZ();
|
||||
|
||||
int viewDistance();
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
/*
|
||||
* 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.utils.accessor;
|
||||
|
||||
import net.minecraft.client.multiplayer.ClientChunkProvider;
|
||||
|
||||
public interface IClientChunkProvider {
|
||||
ClientChunkProvider createThreadSafeCopy();
|
||||
|
||||
IChunkArray extractReferenceArray();
|
||||
}
|
||||
Reference in New Issue
Block a user