merge constants classes

This commit is contained in:
FalsePattern committed 2022-06-17 14:37:03 +02:00
1 parent 2a72daa6cf
commit ed3adba5e3
5 files changed
+26 -24

No files matched your search

@@ -9,8 +9,9 @@ public class ExtendedConstants {
public static final int countCorrectionBits = IEConfig.countCorrectionBits;
public static final int watchableBits = 7;
public static final int bitsPerBiome = 16;
//IDs
//BlockItemIDs
public static final int nibblesPerID = bitsPerID / 4;
public static final int nibblesPerMetadata = bitsPerMetadata / 4;
@@ -24,11 +25,18 @@ public class ExtendedConstants {
public static final int bitsPerBlock = 8 + bitsPerID + bitsPerMetadata;
public static final int nibblesPerBlock = bitsPerBlock / 4;
public static final int nibblesPerEBS = nibblesPerBlock * 16 * 16 * 16;
public static final int bytesPerEBS = nibblesPerEBS / 2;
public static final int bytesPerChunk = 256 + bytesPerEBS * 16;
public static final int bytesPerEBS = (nibblesPerEBS + 1) / 2;
//BiomeIDs
public static final int biomeIDCount = 1 << bitsPerBiome;
public static final int maxBiomeID = biomeIDCount - 1;
public static final int bytesPerBiome = (bitsPerBiome + 7) / 8;
//DataWatcher
public static final int watchableCount = 1 << watchableBits;
public static final int maxWatchableID = watchableCount - 1;
public static final int watchableMask = (0x7 << watchableBits) | maxWatchableID;
//Chunk
public static final int bytesPerChunk = bytesPerBiome * 256 + bytesPerEBS * 16;
}
@@ -7,8 +7,9 @@ public class VanillaConstants {
public static final int countCorrectionBits = 0;
public static final int watchableBits = 5;
public static final int bitsPerBiome = 8;
//IDs
//BlockItemIDs
public static final int nibblesPerID = bitsPerID / 4;
public static final int nibblesPerMetadata = bitsPerMetadata / 4;
@@ -22,11 +23,18 @@ public class VanillaConstants {
public static final int bitsPerBlock = 8 + bitsPerID + bitsPerMetadata;
public static final int nibblesPerBlock = bitsPerBlock / 4;
public static final int nibblesPerEBS = nibblesPerBlock * 16 * 16 * 16;
public static final int bytesPerEBS = nibblesPerEBS / 2;
public static final int bytesPerChunk = 256 + bytesPerEBS * 16;
public static final int bytesPerEBS = (nibblesPerEBS + 1) / 2;
//BiomeIDs
public static final int biomeIDCount = 1 << bitsPerBiome;
public static final int maxBiomeID = biomeIDCount - 1;
public static final int bytesPerBiome = (bitsPerBiome + 7) / 8;
//DataWatcher
public static final int watchableCount = 1 << watchableBits;
public static final int maxWatchableID = watchableCount - 1;
public static final int watchableMask = (0x7 << watchableBits) | maxWatchableID;
//Chunk
public static final int bytesPerChunk = bytesPerBiome * 256 + bytesPerEBS * 16;
}
@@ -1,7 +0,0 @@
package com.falsepattern.endlessids.constants.biome;
public class ExtendedConstants {
public static final int BIOME_ID_BITS = 16;
public static final int BIOME_ID_COUNT = 1 << BIOME_ID_BITS;
public static final int MAX_BIOME_ID = BIOME_ID_COUNT - 1;
}
@@ -1,7 +0,0 @@
package com.falsepattern.endlessids.constants.biome;
public class VanillaConstants {
public static final int BIOME_ID_BITS = 8;
public static final int BIOME_ID_COUNT = 1 << BIOME_ID_BITS;
public static final int MAX_BIOME_ID = BIOME_ID_COUNT - 1;
}
@@ -1,7 +1,7 @@
package com.falsepattern.endlessids.mixin.mixins.common.vanilla.misc;
import com.falsepattern.endlessids.constants.biome.ExtendedConstants;
import com.falsepattern.endlessids.constants.biome.VanillaConstants;
import com.falsepattern.endlessids.constants.ExtendedConstants;
import com.falsepattern.endlessids.constants.VanillaConstants;
import net.minecraft.world.biome.BiomeGenBase;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.Constant;
@@ -10,8 +10,8 @@ import org.spongepowered.asm.mixin.injection.ModifyConstant;
@Mixin(BiomeGenBase.class)
public abstract class BiomeGenBaseMixin {
@ModifyConstant(method = "<clinit>",
constant = @Constant(intValue = VanillaConstants.BIOME_ID_COUNT))
constant = @Constant(intValue = VanillaConstants.biomeIDCount))
private static int extendBiomeList(int constant) {
return ExtendedConstants.BIOME_ID_COUNT;
return ExtendedConstants.biomeIDCount;
}
}