Clean up performance Mixins

This commit is contained in:
Brady 2019-10-07 17:25:09 -05:00
parent eb619adf4a
commit 0b2bab6549
No known key found for this signature in database
GPG Key ID: 73A788379A197567
4 changed files with 0 additions and 50 deletions

View File

@ -43,30 +43,6 @@ public abstract class MixinBitArray implements IBitArray {
@Final
private int arraySize;
/**
* why did mojang divide by 64 instead of shifting right by 6 (2^6=64)?
* why did mojang modulo by 64 instead of ANDing with 63?
* also removed validation check
*
* @author LoganDark
*/
@Override
@Unique
public int getAtFast(int index) {
final int b = bitsPerEntry;
final long mev = maxEntryValue;
final int i = index * b;
final int j = i >> 6;
final int l = i & 63;
final int k = ((index + 1) * b - 1) >> 6;
if (j == k) {
return (int) (this.longArray[j] >>> l & mev);
} else {
return (int) ((this.longArray[j] >>> l | longArray[k] << (64 - l)) & mev);
}
}
@Override
@Unique
public int[] toArray() {

View File

@ -25,8 +25,6 @@ import net.minecraft.world.chunk.BlockStateContainer;
import net.minecraft.world.chunk.IBlockStatePalette;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Shadow;
import org.spongepowered.asm.mixin.Unique;
import org.spongepowered.asm.mixin.gen.Accessor;
@Mixin(BlockStateContainer.class)
public abstract class MixinBlockStateContainer implements IBlockStateContainer {
@ -37,20 +35,6 @@ public abstract class MixinBlockStateContainer implements IBlockStateContainer {
@Shadow
protected IBlockStatePalette palette;
@Override
@Accessor
public abstract BitArray getStorage();
@Override
@Accessor
public abstract IBlockStatePalette getPalette();
@Override
@Unique
public IBlockState getFast(int index) {
return palette.getBlockState(((IBitArray) storage).getAtFast(index));
}
@Override
public IBlockState getAtPalette(int index) {
return palette.getBlockState(index);

View File

@ -2,7 +2,5 @@ package baritone.utils.accessor;
public interface IBitArray {
int getAtFast(int index);
int[] toArray();
}

View File

@ -1,17 +1,9 @@
package baritone.utils.accessor;
import net.minecraft.block.state.IBlockState;
import net.minecraft.util.BitArray;
import net.minecraft.world.chunk.IBlockStatePalette;
public interface IBlockStateContainer {
IBlockStatePalette getPalette();
BitArray getStorage();
IBlockState getFast(int index);
IBlockState getAtPalette(int index);
int[] storageArray();