remove broken furry cringe

This commit is contained in:
Leijurv 2020-08-17 17:41:13 -07:00
parent 0102ce8fad
commit 3b32c72d63
No known key found for this signature in database
GPG Key ID: 44A3EA646EADAC6A
6 changed files with 19 additions and 168 deletions

View File

@ -1,67 +0,0 @@
/*
* 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.utils.accessor.IBitArray;
import net.minecraft.util.BitArray;
import org.spongepowered.asm.mixin.Final;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Shadow;
import org.spongepowered.asm.mixin.Unique;
@Mixin(BitArray.class)
public abstract class MixinBitArray implements IBitArray {
@Shadow
@Final
private long[] longArray;
@Shadow
@Final
private int bitsPerEntry;
@Shadow
@Final
private long maxEntryValue;
@Shadow
@Final
private int arraySize;
@Override
@Unique
public int[] toArray() {
int[] out = new int[arraySize];
for (int idx = 0, kl = bitsPerEntry - 1; idx < arraySize; idx++, kl += bitsPerEntry) {
final int i = idx * bitsPerEntry;
final int j = i >> 6;
final int l = i & 63;
final int k = kl >> 6;
final long jl = longArray[j] >>> l;
if (j == k) {
out[idx] = (int) (jl & maxEntryValue);
} else {
out[idx] = (int) ((jl | longArray[k] << (64 - l)) & maxEntryValue);
}
}
return out;
}
}

View File

@ -1,47 +0,0 @@
/*
* 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.utils.accessor.IBitArray;
import baritone.utils.accessor.IPalettedContainer;
import net.minecraft.block.BlockState;
import net.minecraft.util.BitArray;
import net.minecraft.util.palette.IPalette;
import net.minecraft.util.palette.PalettedContainer;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Shadow;
@Mixin(PalettedContainer.class)
public abstract class MixinPalettedContainer implements IPalettedContainer {
@Shadow
protected BitArray storage;
@Shadow
protected IPalette<BlockState> palette;
@Override
public BlockState getAtPalette(int index) {
return palette.get(index);
}
@Override
public int[] storageArray() {
return ((IBitArray) storage).toArray();
}
}

View File

@ -8,7 +8,6 @@
"maxShiftBy": 2
},
"client": [
"MixinBitArray",
"MixinChunkArray",
"MixinClientChunkProvider",
"MixinClientPlayerEntity",
@ -21,7 +20,6 @@
"MixinLootContext",
"MixinMinecraft",
"MixinNetworkManager",
"MixinPalettedContainer",
"MixinPlayerController",
"MixinScreen",
"MixinWorldRenderer"

View File

@ -22,11 +22,11 @@ import baritone.api.cache.IWorldScanner;
import baritone.api.utils.BetterBlockPos;
import baritone.api.utils.BlockOptionalMetaLookup;
import baritone.api.utils.IPlayerContext;
import baritone.utils.accessor.IPalettedContainer;
import net.minecraft.block.BlockState;
import net.minecraft.client.multiplayer.ClientChunkProvider;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.ChunkPos;
import net.minecraft.util.palette.PalettedContainer;
import net.minecraft.world.chunk.AbstractChunkProvider;
import net.minecraft.world.chunk.Chunk;
import net.minecraft.world.chunk.ChunkSection;
@ -155,27 +155,27 @@ public enum WorldScanner implements IWorldScanner {
continue;
}
int yReal = y0 << 4;
IPalettedContainer bsc = (IPalettedContainer) section.getData();
// storageArray uses an optimized algorithm that's faster than getAt
// creating this array and then using getAtPalette is faster than even getFast(int index)
int[] storage = bsc.storageArray();
final int imax = 1 << 12;
for (int i = 0; i < imax; i++) {
BlockState state = bsc.getAtPalette(storage[i]);
if (state != null && filter.has(state)) {
int y = yReal | ((i >> 8) & 15);
if (result.size() >= max) {
if (Math.abs(y - playerY) < yLevelThreshold) {
foundWithinY = true;
} else {
if (foundWithinY) {
// have found within Y in this chunk, so don't need to consider outside Y
// TODO continue iteration to one more sorted Y coordinate block
return true;
PalettedContainer<BlockState> bsc = section.getData();
for (int yy = 0; yy < 16; yy++) {
for (int z = 0; z < 16; z++) {
for (int x = 0; x < 16; x++) {
BlockState state = bsc.get(x, yy, z);
if (filter.has(state)) {
int y = yReal | yy;
if (result.size() >= max) {
if (Math.abs(y - playerY) < yLevelThreshold) {
foundWithinY = true;
} else {
if (foundWithinY) {
// have found within Y in this chunk, so don't need to consider outside Y
// TODO continue iteration to one more sorted Y coordinate block
return true;
}
}
}
result.add(new BlockPos(chunkX | x, y, chunkZ | z));
}
}
result.add(new BlockPos(chunkX | (i & 15), y, chunkZ | ((i >> 4) & 15)));
}
}
}

View File

@ -1,6 +0,0 @@
package baritone.utils.accessor;
public interface IBitArray {
int[] toArray();
}

View File

@ -1,27 +0,0 @@
/*
* 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.block.BlockState;
public interface IPalettedContainer {
BlockState getAtPalette(int index);
int[] storageArray();
}