mirror of
https://github.com/GTMEGA/EndlessIDs.git
synced 2026-11-22 14:19:39 +00:00
cleanup code
This commit is contained in:
46 files changed
+415
-384
No files matched your search
@@ -8,6 +8,7 @@ import java.lang.reflect.Field;
|
||||
|
||||
public class GalaxySpaceHelper {
|
||||
private static final Field GSSpaceField;
|
||||
|
||||
static {
|
||||
Class<?> clazz;
|
||||
try {
|
||||
|
||||
+10
@@ -4,21 +4,31 @@ import net.minecraft.world.chunk.NibbleArray;
|
||||
|
||||
public interface IExtendedBlockStorageMixin {
|
||||
byte[] getB1();
|
||||
|
||||
void setB1(byte[] data);
|
||||
|
||||
NibbleArray getB2Low();
|
||||
|
||||
void setB2Low(NibbleArray data);
|
||||
|
||||
void clearB2Low();
|
||||
|
||||
NibbleArray createB2Low();
|
||||
|
||||
NibbleArray getB2High();
|
||||
|
||||
void setB2High(NibbleArray data);
|
||||
|
||||
void clearB2High();
|
||||
|
||||
NibbleArray createB2High();
|
||||
|
||||
byte[] getB3();
|
||||
|
||||
void setB3(byte[] data);
|
||||
|
||||
void clearB3();
|
||||
|
||||
byte[] createB3();
|
||||
|
||||
int getStorageFlag();
|
||||
|
||||
@@ -12,7 +12,7 @@ public final class ShortUtil {
|
||||
public static int[] unsignedShortToIntArray(short[] shorts) {
|
||||
int[] ints = new int[shorts.length];
|
||||
|
||||
for(int i = 0; i < shorts.length; ++i) {
|
||||
for (int i = 0; i < shorts.length; ++i) {
|
||||
ints[i] = unsignedShortToInt(shorts[i]);
|
||||
}
|
||||
|
||||
|
||||
+2
-1
@@ -35,7 +35,8 @@ public abstract class ChunkMixin {
|
||||
slice = @Slice(from = @At(value = "INVOKE",
|
||||
target = "Lnet/minecraft/world/chunk/storage/ExtendedBlockStorage;clearMSBArray()V")),
|
||||
require = 1)
|
||||
private void noCopyBiome(Object src, int srcPos, Object dest, int destPos, int length) {}
|
||||
private void noCopyBiome(Object src, int srcPos, Object dest, int destPos, int length) {
|
||||
}
|
||||
|
||||
@Redirect(method = "fillChunk",
|
||||
at = @At(value = "FIELD",
|
||||
|
||||
+7
-10
@@ -21,6 +21,9 @@ import java.util.Iterator;
|
||||
|
||||
@Mixin(Chunk.class)
|
||||
public abstract class ChunkMixin {
|
||||
//This is needed because the array is not a field, but a local, and local arraylength overriding does not exist
|
||||
private static byte[][] fakeArrays;
|
||||
private static NibbleArray fakeNarray;
|
||||
@Shadow
|
||||
private ExtendedBlockStorage[] storageArrays;
|
||||
|
||||
@@ -30,7 +33,7 @@ public abstract class ChunkMixin {
|
||||
args = "array=length",
|
||||
ordinal = 0),
|
||||
slice = @Slice(from = @At(value = "INVOKE",
|
||||
target = "Lnet/minecraft/world/chunk/storage/ExtendedBlockStorage;getSkylightArray()Lnet/minecraft/world/chunk/NibbleArray;")),
|
||||
target = "Lnet/minecraft/world/chunk/storage/ExtendedBlockStorage;getSkylightArray()Lnet/minecraft/world/chunk/NibbleArray;")),
|
||||
require = 1)
|
||||
private int noMSBLoop(ExtendedBlockStorage[] array) {
|
||||
return 0;
|
||||
@@ -47,9 +50,6 @@ public abstract class ChunkMixin {
|
||||
Hooks.setBlockData((IExtendedBlockStorageMixin) this.storageArrays[l], p_76607_1_, k, storageFlag);
|
||||
}
|
||||
|
||||
|
||||
//This is needed because the array is not a field, but a local, and local arraylength overriding does not exist
|
||||
private static byte[][] fakeArrays;
|
||||
@Redirect(method = "fillChunk",
|
||||
at = @At(value = "INVOKE",
|
||||
target = "Lnet/minecraft/world/chunk/storage/ExtendedBlockStorage;getBlockLSBArray()[B"),
|
||||
@@ -62,7 +62,7 @@ public abstract class ChunkMixin {
|
||||
fakeArrays[2] = new byte[16 * 16 * 16 * 4 / 2];
|
||||
fakeArrays[3] = new byte[16 * 16 * 16 * 6 / 2];
|
||||
}
|
||||
return fakeArrays[((IExtendedBlockStorageMixin)instance).getStorageFlag()];
|
||||
return fakeArrays[((IExtendedBlockStorageMixin) instance).getStorageFlag()];
|
||||
}
|
||||
|
||||
@Redirect(method = "fillChunk",
|
||||
@@ -72,9 +72,8 @@ public abstract class ChunkMixin {
|
||||
slice = @Slice(from = @At(value = "INVOKE",
|
||||
target = "Lnet/minecraft/world/chunk/storage/ExtendedBlockStorage;getBlockLSBArray()[B")),
|
||||
require = 1)
|
||||
private void noCopy(Object src, int srcPos, Object dest, int destPos, int length) {}
|
||||
|
||||
|
||||
private void noCopy(Object src, int srcPos, Object dest, int destPos, int length) {
|
||||
}
|
||||
|
||||
@Inject(method = "fillChunk",
|
||||
at = @At(value = "INVOKE",
|
||||
@@ -85,8 +84,6 @@ public abstract class ChunkMixin {
|
||||
Hooks.setBlockMeta((IExtendedBlockStorageMixin) this.storageArrays[l], p_76607_1_, k);
|
||||
}
|
||||
|
||||
private static NibbleArray fakeNarray;
|
||||
|
||||
@Redirect(method = "fillChunk",
|
||||
at = @At(value = "INVOKE",
|
||||
target = "Lnet/minecraft/world/chunk/storage/ExtendedBlockStorage;getMetadataArray()Lnet/minecraft/world/chunk/NibbleArray;"),
|
||||
|
||||
+2
-1
@@ -44,7 +44,8 @@ public abstract class NetHandlerPlayClientMixin {
|
||||
int y = pos & 255;
|
||||
this.clientWorldController.func_147492_c(x + chunkX, y, z + chunkZ, Block.getBlockById(id), meta);
|
||||
}
|
||||
} catch (IOException ignored) {}
|
||||
} catch (IOException ignored) {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
+1
-1
@@ -24,7 +24,7 @@ public abstract class NetHandlerPlayClientMixin {
|
||||
at = @At("HEAD"),
|
||||
require = 1)
|
||||
private void grabID(S1DPacketEntityEffect packetIn, CallbackInfo ci) {
|
||||
theID = ((IS1DPacketEntityEffectMixin)packetIn).getIDExtended();
|
||||
theID = ((IS1DPacketEntityEffectMixin) packetIn).getIDExtended();
|
||||
}
|
||||
|
||||
@Redirect(method = "handleEntityEffect",
|
||||
|
||||
+1
-2
@@ -56,8 +56,7 @@ public abstract class BiomesManagerMixin {
|
||||
}
|
||||
|
||||
@ModifyConstant(method = {"preinit", "setUpBiomesFolder"},
|
||||
constant = {@Constant(stringValue = "\\biomes"),
|
||||
@Constant(stringValue = "\\main.cfg")})
|
||||
constant = {@Constant(stringValue = "\\biomes"), @Constant(stringValue = "\\main.cfg")})
|
||||
private static String fixPaths(String original) {
|
||||
return AIDCStringFixer.fixString(original);
|
||||
}
|
||||
|
||||
+19
-19
@@ -44,25 +44,6 @@ public abstract class AbyssalCraftMixin {
|
||||
@Shadow
|
||||
public static int configBiomeId13;
|
||||
|
||||
@Inject(method = "checkBiomeIds",
|
||||
at = @At("HEAD"),
|
||||
require = 1)
|
||||
private void cleanupBiomeArrayForAssignment(CallbackInfo ci) {
|
||||
val bga = BiomeGenBase.getBiomeGenArray();
|
||||
|
||||
int[] biomes = new int[]{configBiomeId1, configBiomeId2, configBiomeId3, configBiomeId4, configBiomeId5,
|
||||
configBiomeId6, configBiomeId7, configBiomeId8, configBiomeId9, configBiomeId10,
|
||||
configBiomeId11, configBiomeId12, configBiomeId13};
|
||||
for (val biome : biomes) {
|
||||
if (biome < 0 || biome >= ExtendedConstants.biomeIDCount) {
|
||||
continue;
|
||||
}
|
||||
if (bga[biome] instanceof PlaceholderBiome) {
|
||||
bga[biome] = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ModifyConstant(method = "syncConfig",
|
||||
constant = {@Constant(intValue = 100, ordinal = 0),
|
||||
@Constant(intValue = 101, ordinal = 0),
|
||||
@@ -81,4 +62,23 @@ public abstract class AbyssalCraftMixin {
|
||||
private static int shiftBiomeIDsUp(int constant) {
|
||||
return constant + 8000;
|
||||
}
|
||||
|
||||
@Inject(method = "checkBiomeIds",
|
||||
at = @At("HEAD"),
|
||||
require = 1)
|
||||
private void cleanupBiomeArrayForAssignment(CallbackInfo ci) {
|
||||
val bga = BiomeGenBase.getBiomeGenArray();
|
||||
|
||||
int[] biomes = new int[]{configBiomeId1, configBiomeId2, configBiomeId3, configBiomeId4, configBiomeId5,
|
||||
configBiomeId6, configBiomeId7, configBiomeId8, configBiomeId9, configBiomeId10,
|
||||
configBiomeId11, configBiomeId12, configBiomeId13};
|
||||
for (val biome : biomes) {
|
||||
if (biome < 0 || biome >= ExtendedConstants.biomeIDCount) {
|
||||
continue;
|
||||
}
|
||||
if (bga[biome] instanceof PlaceholderBiome) {
|
||||
bga[biome] = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
+3
-3
@@ -16,6 +16,8 @@ import net.minecraft.world.chunk.Chunk;
|
||||
@Mixin(value = BiomeDetectorBase.class,
|
||||
remap = false)
|
||||
public abstract class BiomeDetectorBaseMixin {
|
||||
private Chunk chunk;
|
||||
|
||||
@ModifyConstant(method = "<clinit>",
|
||||
constant = @Constant(intValue = VanillaConstants.biomeIDCount),
|
||||
require = 2)
|
||||
@@ -23,8 +25,6 @@ public abstract class BiomeDetectorBaseMixin {
|
||||
return ExtendedConstants.biomeIDCount;
|
||||
}
|
||||
|
||||
private Chunk chunk;
|
||||
|
||||
@Redirect(method = "getBiomeID",
|
||||
at = @At(value = "INVOKE",
|
||||
target = "Lnet/minecraft/world/chunk/Chunk;getBiomeArray()[B",
|
||||
@@ -41,7 +41,7 @@ public abstract class BiomeDetectorBaseMixin {
|
||||
require = 1)
|
||||
private int[] biomeIDs(byte[] i) {
|
||||
try {
|
||||
return ShortUtil.unsignedShortToIntArray(((IChunkMixin)chunk).getBiomeShortArray());
|
||||
return ShortUtil.unsignedShortToIntArray(((IChunkMixin) chunk).getBiomeShortArray());
|
||||
} finally {
|
||||
chunk = null;
|
||||
}
|
||||
|
||||
+1
-1
@@ -30,7 +30,7 @@ public abstract class BiomeDetectorNetherMixin {
|
||||
require = 1)
|
||||
private int[] biomeIDs(byte[] i) {
|
||||
try {
|
||||
return ShortUtil.unsignedShortToIntArray(((IChunkMixin)chunk).getBiomeShortArray());
|
||||
return ShortUtil.unsignedShortToIntArray(((IChunkMixin) chunk).getBiomeShortArray());
|
||||
} finally {
|
||||
chunk = null;
|
||||
}
|
||||
|
||||
+8
-8
@@ -30,14 +30,6 @@ public abstract class BiomeEventHandlerMixin {
|
||||
return ExtendedConstants.biomeIDCount;
|
||||
}
|
||||
|
||||
@Inject(method = "<init>",
|
||||
at = @At("RETURN"),
|
||||
require = 1)
|
||||
private void extendIDs2(CallbackInfo ci) {
|
||||
colorCache = new int[ExtendedConstants.biomeIDCount * 3];
|
||||
Arrays.fill(colorCache, -2);
|
||||
}
|
||||
|
||||
@ModifyConstant(method = "onGetFoliageColor",
|
||||
constant = @Constant(intValue = VanillaConstants.biomeIDCount),
|
||||
require = 1)
|
||||
@@ -51,4 +43,12 @@ public abstract class BiomeEventHandlerMixin {
|
||||
private static int extendIDs4(int constant) {
|
||||
return ExtendedConstants.biomeIDCount * 2;
|
||||
}
|
||||
|
||||
@Inject(method = "<init>",
|
||||
at = @At("RETURN"),
|
||||
require = 1)
|
||||
private void extendIDs2(CallbackInfo ci) {
|
||||
colorCache = new int[ExtendedConstants.biomeIDCount * 3];
|
||||
Arrays.fill(colorCache, -2);
|
||||
}
|
||||
}
|
||||
+6
-6
@@ -42,17 +42,17 @@ public abstract class BiomeWandItemMixin {
|
||||
int relBlockX = blockX & 15;
|
||||
int relBlockZ = blockZ & 15;
|
||||
Chunk chunk = world.getChunkFromBlockCoords(blockX, blockZ);
|
||||
short biome = ((IChunkMixin)chunk).getBiomeShortArray()[relBlockZ * 16 + relBlockX];
|
||||
short biome = ((IChunkMixin) chunk).getBiomeShortArray()[relBlockZ * 16 + relBlockX];
|
||||
tag.setShort("sampledBiomeS", biome);
|
||||
} else {
|
||||
short biome = tag.getShort("sampledBiomeS");
|
||||
|
||||
for(int ix = blockX - 3; ix <= blockX + 3; ++ix) {
|
||||
for(int iz = blockZ - 3; iz <= blockZ + 3; ++iz) {
|
||||
for (int ix = blockX - 3; ix <= blockX + 3; ++ix) {
|
||||
for (int iz = blockZ - 3; iz <= blockZ + 3; ++iz) {
|
||||
int relBlockX = ix & 15;
|
||||
int relBlockZ = iz & 15;
|
||||
Chunk chunk = world.getChunkFromBlockCoords(blockX, blockZ);
|
||||
((IChunkMixin)chunk).getBiomeShortArray()[relBlockZ << 4 | relBlockX] = biome;
|
||||
((IChunkMixin) chunk).getBiomeShortArray()[relBlockZ << 4 | relBlockX] = biome;
|
||||
chunk.isModified = true;
|
||||
BiomeWandMod.proxy.updateRendererAt(ix, iz);
|
||||
}
|
||||
@@ -96,12 +96,12 @@ public abstract class BiomeWandItemMixin {
|
||||
*/
|
||||
@Overwrite
|
||||
public void getSubItems(Item item, CreativeTabs tabs, List list) {
|
||||
list.add(new ItemStack((BiomeWandItem)(Object)this, 1));
|
||||
list.add(new ItemStack((BiomeWandItem) (Object) this, 1));
|
||||
for (BiomeGenBase biome : BiomeGenBase.getBiomeGenArray()) {
|
||||
if (biome != null && !(biome instanceof PlaceholderBiome)) {
|
||||
NBTTagCompound compound = new NBTTagCompound();
|
||||
compound.setShort("sampledBiomeS", (short) biome.biomeID);
|
||||
ItemStack wand = new ItemStack((BiomeWandItem)(Object)this, 1);
|
||||
ItemStack wand = new ItemStack((BiomeWandItem) (Object) this, 1);
|
||||
wand.setTagCompound(compound);
|
||||
list.add(wand);
|
||||
}
|
||||
|
||||
+10
-8
@@ -27,10 +27,10 @@ public abstract class CubeToolsMixin {
|
||||
WorldServer machineWorld = MinecraftServer.getServer().worldServerForDimension(ConfigurationHandler.dimensionId);
|
||||
Chunk chunk = machineWorld.getChunkFromBlockCoords(coords * ConfigurationHandler.cubeDistance, 0);
|
||||
if (chunk != null && chunk.isChunkLoaded) {
|
||||
short[] biomeArray = ((IChunkMixin)chunk).getBiomeShortArray();
|
||||
for(int x = 0; x < 15; ++x) {
|
||||
for(int z = 0; z < 15; ++z) {
|
||||
biomeArray[z << 4 | x] = (short)biome.biomeID;
|
||||
short[] biomeArray = ((IChunkMixin) chunk).getBiomeShortArray();
|
||||
for (int x = 0; x < 15; ++x) {
|
||||
for (int z = 0; z < 15; ++z) {
|
||||
biomeArray[z << 4 | x] = (short) biome.biomeID;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -43,10 +43,12 @@ public abstract class CubeToolsMixin {
|
||||
*/
|
||||
@Overwrite
|
||||
public static BiomeGenBase getMachineBiome(TileEntityMachine machine) {
|
||||
short[] biomeArray = ((IChunkMixin)machine.getWorldObj().getChunkFromBlockCoords(machine.xCoord, machine.zCoord)).getBiomeShortArray();
|
||||
short[] biomeArray = ((IChunkMixin) machine.getWorldObj()
|
||||
.getChunkFromBlockCoords(machine.xCoord,
|
||||
machine.zCoord)).getBiomeShortArray();
|
||||
int biomeId = biomeArray[(machine.zCoord & 15) << 4 | machine.xCoord & 15];
|
||||
return biomeId > 0 && biomeId < BiomeGenBase.getBiomeGenArray().length && BiomeDictionary.isBiomeRegistered(biomeId)
|
||||
? BiomeGenBase.getBiome(biomeId)
|
||||
: WorldUtils.getBiomeByName(ConfigurationHandler.defaultBiome);
|
||||
return biomeId > 0 && biomeId < BiomeGenBase.getBiomeGenArray().length &&
|
||||
BiomeDictionary.isBiomeRegistered(biomeId) ? BiomeGenBase.getBiome(biomeId) : WorldUtils.getBiomeByName(
|
||||
ConfigurationHandler.defaultBiome);
|
||||
}
|
||||
}
|
||||
+3
-2
@@ -13,13 +13,14 @@ import net.minecraft.world.chunk.Chunk;
|
||||
remap = false)
|
||||
public abstract class ReikaChunkHelperMixin {
|
||||
private static short[] biomeArray;
|
||||
|
||||
@Redirect(method = "copyChunk",
|
||||
at = @At(value = "INVOKE",
|
||||
target = "Lnet/minecraft/world/chunk/Chunk;setBiomeArray([B)V",
|
||||
remap = true),
|
||||
require = 1)
|
||||
private static void customSet(Chunk chunk, byte[] p_76616_1_) {
|
||||
((IChunkMixin)chunk).setBiomeShortArray(biomeArray);
|
||||
((IChunkMixin) chunk).setBiomeShortArray(biomeArray);
|
||||
biomeArray = null;
|
||||
}
|
||||
|
||||
@@ -29,7 +30,7 @@ public abstract class ReikaChunkHelperMixin {
|
||||
remap = true),
|
||||
require = 1)
|
||||
private static byte[] customGet(Chunk chunk) {
|
||||
biomeArray = ((IChunkMixin)chunk).getBiomeShortArray();
|
||||
biomeArray = ((IChunkMixin) chunk).getBiomeShortArray();
|
||||
return EndlessIDs.ZERO_LENGTH_BIOME_ARRAY_PLACEHOLDER;
|
||||
}
|
||||
}
|
||||
+5
-5
@@ -18,6 +18,8 @@ import net.minecraft.world.chunk.Chunk;
|
||||
@Mixin(value = ReikaWorldHelper.class,
|
||||
remap = false)
|
||||
public abstract class ReikaWorldHelperMixin {
|
||||
private static int fromBiomeID;
|
||||
|
||||
@Redirect(method = {"setBiomeForXZ", "setBiomeAndBlocksForXZ"},
|
||||
at = @At(value = "INVOKE",
|
||||
target = "Lnet/minecraft/world/chunk/Chunk;getBiomeArray()[B",
|
||||
@@ -43,11 +45,9 @@ public abstract class ReikaWorldHelperMixin {
|
||||
locals = LocalCapture.CAPTURE_FAILHARD,
|
||||
require = 1)
|
||||
private static void customLogicSetBiome(World world, int x, int z, BiomeGenBase biome, CallbackInfo ci, Chunk ch, int ax, int az, byte[] biomes, int index) {
|
||||
((IChunkMixin)ch).getBiomeShortArray()[index] = (short) biome.biomeID;
|
||||
((IChunkMixin) ch).getBiomeShortArray()[index] = (short) biome.biomeID;
|
||||
}
|
||||
|
||||
private static int fromBiomeID;
|
||||
|
||||
@Inject(method = "setBiomeAndBlocksForXZ",
|
||||
at = @At(value = "FIELD",
|
||||
target = "Lnet/minecraft/world/biome/BiomeGenBase;biomeList:[Lnet/minecraft/world/biome/BiomeGenBase;",
|
||||
@@ -55,7 +55,7 @@ public abstract class ReikaWorldHelperMixin {
|
||||
locals = LocalCapture.CAPTURE_FAILEXCEPTION,
|
||||
require = 1)
|
||||
private static void captureIndexSetBiomeAndBlocks(World world, int x, int z, BiomeGenBase biome, CallbackInfo ci, Chunk ch, int ax, int az, byte[] biomes, int index) {
|
||||
fromBiomeID = ((IChunkMixin)ch).getBiomeShortArray()[index];
|
||||
fromBiomeID = ((IChunkMixin) ch).getBiomeShortArray()[index];
|
||||
}
|
||||
|
||||
@ModifyVariable(method = "setBiomeAndBlocksForXZ",
|
||||
@@ -72,6 +72,6 @@ public abstract class ReikaWorldHelperMixin {
|
||||
locals = LocalCapture.CAPTURE_FAILEXCEPTION,
|
||||
require = 1)
|
||||
private static void customLogicSetBiomeAndBlocks(World world, int x, int z, BiomeGenBase biome, CallbackInfo ci, Chunk ch, int ax, int az, byte[] biomes, int index, BiomeGenBase from) {
|
||||
((IChunkMixin)ch).getBiomeShortArray()[index] = (short) biome.biomeID;
|
||||
((IChunkMixin) ch).getBiomeShortArray()[index] = (short) biome.biomeID;
|
||||
}
|
||||
}
|
||||
+1
-2
@@ -9,8 +9,7 @@ import org.spongepowered.asm.mixin.injection.ModifyConstant;
|
||||
remap = false)
|
||||
public abstract class BiomeConfigurationMixin {
|
||||
@ModifyConstant(method = "init",
|
||||
constant = {@Constant(intValue = 200),
|
||||
@Constant(intValue = 210)},
|
||||
constant = {@Constant(intValue = 200), @Constant(intValue = 210)},
|
||||
require = 2)
|
||||
private static int shiftBiomeIDsUp(int id) {
|
||||
return id + 3000;
|
||||
|
||||
+2
-2
@@ -40,11 +40,11 @@ public abstract class EndChunkProviderMixin {
|
||||
require = 1)
|
||||
private byte[] setBiomesTweaked(Chunk chunk) {
|
||||
val chunkBiomes = ((IChunkMixin) chunk).getBiomeShortArray();
|
||||
for(int k = 0; k < chunkBiomes.length; ++k) {
|
||||
for (int k = 0; k < chunkBiomes.length; ++k) {
|
||||
if (Math.abs(xx) < 160 && Math.abs(zz) < 160) {
|
||||
chunkBiomes[k] = 9;
|
||||
} else {
|
||||
chunkBiomes[k] = (short)this.biomesForGeneration[k].biomeID;
|
||||
chunkBiomes[k] = (short) this.biomesForGeneration[k].biomeID;
|
||||
}
|
||||
}
|
||||
return ZERO_LENGTH_BIOME_ARRAY_PLACEHOLDER;
|
||||
|
||||
+3
-2
@@ -71,7 +71,8 @@ public abstract class ModBiomesMixin {
|
||||
constant = @Constant(stringValue = "Erebus biome IDs cannot be higher than 127 or smaller than 0!"),
|
||||
require = 1)
|
||||
private static String modifyWarning(String str) {
|
||||
return "Erebus biome IDs cannot be higher than " + (ExtendedConstants.biomeIDCount - 129) + " or smaller than 0!";
|
||||
return "Erebus biome IDs cannot be higher than " + (ExtendedConstants.biomeIDCount - 129) +
|
||||
" or smaller than 0!";
|
||||
}
|
||||
|
||||
@Inject(method = "init",
|
||||
@@ -84,7 +85,7 @@ public abstract class ModBiomesMixin {
|
||||
ulteriorOutbackID, fungalForestID, submergedSwampID, fieldsSubForestID,
|
||||
jungleSubLakeID, jungleSubAsperGroveID, desertSubCharredForestID,
|
||||
savannahSubRockyWastelandID, savannahSubAsperGroveID, savannahSubSteppeID};
|
||||
for (val biome: biomes) {
|
||||
for (val biome : biomes) {
|
||||
if (biome <= 0 || biome >= ExtendedConstants.biomeIDCount - 129) {
|
||||
continue;
|
||||
}
|
||||
|
||||
+1
@@ -16,6 +16,7 @@ public abstract class ConfigManagerCoreMixin {
|
||||
private static int shiftBiomeIDsUp(int id) {
|
||||
return id + 18000;
|
||||
}
|
||||
|
||||
@ModifyConstant(method = "syncConfig",
|
||||
constant = @Constant(stringValue = "Biome ID for Moon (Mars will be this + 1, Asteroids + 2 etc). Allowed range 40-250."),
|
||||
require = 1)
|
||||
|
||||
+1
-2
@@ -9,8 +9,7 @@ import org.spongepowered.asm.mixin.injection.ModifyConstant;
|
||||
remap = false)
|
||||
public abstract class BiomeConfigurationMixin {
|
||||
@ModifyConstant(method = "init",
|
||||
constant = {@Constant(intValue = 170),
|
||||
@Constant(intValue = 175)},
|
||||
constant = {@Constant(intValue = 170), @Constant(intValue = 175)},
|
||||
require = 2)
|
||||
private static int shiftBiomeIDsUp(int id) {
|
||||
return id + 3000;
|
||||
|
||||
+2
-2
@@ -22,7 +22,7 @@ public abstract class TentChunkProviderMixin {
|
||||
require = 1)
|
||||
private void setBiomesTweaked(Chunk chunk, byte[] p_76616_1_) {
|
||||
short[] biomeMap = new short[256];
|
||||
Arrays.fill(biomeMap, (short)BiomeGenBase.ocean.biomeID);
|
||||
((IChunkMixin)chunk).setBiomeShortArray(biomeMap);
|
||||
Arrays.fill(biomeMap, (short) BiomeGenBase.ocean.biomeID);
|
||||
((IChunkMixin) chunk).setBiomeShortArray(biomeMap);
|
||||
}
|
||||
}
|
||||
+7
-5
@@ -28,7 +28,7 @@ public abstract class ItemBiomePainterMixin {
|
||||
} else if (par3World.isRemote) {
|
||||
return true;
|
||||
} else {
|
||||
for(int i = 0; i < par2EntityPlayer.inventory.getSizeInventory(); ++i) {
|
||||
for (int i = 0; i < par2EntityPlayer.inventory.getSizeInventory(); ++i) {
|
||||
ItemStack is = par2EntityPlayer.inventory.getStackInSlot(i);
|
||||
if (is != null && is.getItem() instanceof ItemBiomeCapsule && is.getItemDamage() != 0) {
|
||||
NBTTagCompound nbt = is.stackTagCompound;
|
||||
@@ -40,16 +40,18 @@ public abstract class ItemBiomePainterMixin {
|
||||
if (charges > 0 || par2EntityPlayer.capabilities.isCreativeMode) {
|
||||
Chunk c = par3World.getChunkFromBlockCoords(par4, par6);
|
||||
int biomeID = is.getItemDamage() - 1;
|
||||
short[] biomeArray = ((IChunkMixin)c).getBiomeShortArray(); //changed
|
||||
short[] biomeArray = ((IChunkMixin) c).getBiomeShortArray(); //changed
|
||||
if ((biomeArray[(par6 & 15) << 4 | par4 & 15] & 255) != biomeID) {
|
||||
biomeArray[(par6 & 15) << 4 | par4 & 15] = (short)(biomeID & 0xFFFF); //changed
|
||||
((IChunkMixin)c).setBiomeShortArray(biomeArray); //changed
|
||||
biomeArray[(par6 & 15) << 4 | par4 & 15] = (short) (biomeID & 0xFFFF); //changed
|
||||
((IChunkMixin) c).setBiomeShortArray(biomeArray); //changed
|
||||
if (!par2EntityPlayer.capabilities.isCreativeMode) {
|
||||
nbt.setInteger("charges", charges - 1);
|
||||
par2EntityPlayer.inventoryContainer.detectAndSendChanges();
|
||||
}
|
||||
|
||||
PacketHandler.INSTANCE.sendToDimension(new MessagePaintBiome(par4, par5, par6, par3World.provider.dimensionId, biomeID), par3World.provider.dimensionId);
|
||||
PacketHandler.INSTANCE.sendToDimension(
|
||||
new MessagePaintBiome(par4, par5, par6, par3World.provider.dimensionId, biomeID),
|
||||
par3World.provider.dimensionId);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+24
-12
@@ -24,15 +24,20 @@ import java.util.Random;
|
||||
remap = false)
|
||||
public abstract class MessagePaintBiomeMixin {
|
||||
|
||||
@Shadow private int posZ;
|
||||
@Shadow
|
||||
private int posZ;
|
||||
|
||||
@Shadow private int posX;
|
||||
@Shadow
|
||||
private int posX;
|
||||
|
||||
@Shadow private int biomeID;
|
||||
@Shadow
|
||||
private int biomeID;
|
||||
|
||||
@Shadow private int dimensionID;
|
||||
@Shadow
|
||||
private int dimensionID;
|
||||
|
||||
@Shadow private int posY;
|
||||
@Shadow
|
||||
private int posY;
|
||||
|
||||
/**
|
||||
* @author FalsePattern
|
||||
@@ -44,18 +49,25 @@ public abstract class MessagePaintBiomeMixin {
|
||||
EntityPlayer player = Minecraft.getMinecraft().thePlayer;
|
||||
if (player != null && player.worldObj.provider.dimensionId == this.dimensionID) {
|
||||
Chunk c = player.worldObj.getChunkFromBlockCoords(this.posX, this.posZ);
|
||||
short[] biomeArray = ((IChunkMixin)c).getBiomeShortArray(); //changed
|
||||
biomeArray[(this.posZ & 15) << 4 | this.posX & 15] = (short)(this.biomeID & 0xFFFF); //changed
|
||||
((IChunkMixin)c).setBiomeShortArray(biomeArray); //changed
|
||||
Minecraft.getMinecraft().thePlayer.worldObj.markBlocksDirtyVertical(this.posX, this.posZ, 0, player.worldObj.getActualHeight());
|
||||
short[] biomeArray = ((IChunkMixin) c).getBiomeShortArray(); //changed
|
||||
biomeArray[(this.posZ & 15) << 4 | this.posX & 15] = (short) (this.biomeID & 0xFFFF); //changed
|
||||
((IChunkMixin) c).setBiomeShortArray(biomeArray); //changed
|
||||
Minecraft.getMinecraft().thePlayer.worldObj.markBlocksDirtyVertical(this.posX, this.posZ, 0,
|
||||
player.worldObj.getActualHeight());
|
||||
BiomeGenBase biome = BiomeGenBase.getBiome(this.biomeID);
|
||||
int colorInt = ItemBiomeCapsule.getColorForBiome(biome);
|
||||
Random rng = new Random();
|
||||
Color color = new Color(colorInt);
|
||||
|
||||
for(int i = 0; i < 64; ++i) {
|
||||
EntityFX smoke = new EntitySmokeFX(player.worldObj, (float)this.posX + rng.nextFloat(), (float)this.posY + rng.nextFloat(), (float)this.posZ + rng.nextFloat(), 0.0, 0.0, 0.0);
|
||||
smoke.setRBGColorF(0.003921569F * (float)color.getRed(), 0.003921569F * (float)color.getGreen(), 0.003921569F * (float)color.getBlue());
|
||||
for (int i = 0; i < 64; ++i) {
|
||||
EntityFX smoke = new EntitySmokeFX(player.worldObj,
|
||||
(float) this.posX + rng.nextFloat(),
|
||||
(float) this.posY + rng.nextFloat(),
|
||||
(float) this.posZ + rng.nextFloat(),
|
||||
0.0, 0.0, 0.0);
|
||||
smoke.setRBGColorF(0.003921569F * (float) color.getRed(),
|
||||
0.003921569F * (float) color.getGreen(),
|
||||
0.003921569F * (float) color.getBlue());
|
||||
Minecraft.getMinecraft().effectRenderer.addEffect(smoke);
|
||||
}
|
||||
}
|
||||
|
||||
+1
-1
@@ -132,7 +132,7 @@ public abstract class AnvilChunkLoaderMixin {
|
||||
target = "Lnet/minecraft/world/chunk/storage/ExtendedBlockStorage;setBlockMetadataArray(Lnet/minecraft/world/chunk/NibbleArray;)V"),
|
||||
require = 1)
|
||||
private void redirectBlockMetaRead(ExtendedBlockStorage instance, NibbleArray p_76668_1_) {
|
||||
Hooks.readBlockMetaFromNBT((IExtendedBlockStorageMixin)instance, nbt);
|
||||
Hooks.readBlockMetaFromNBT((IExtendedBlockStorageMixin) instance, nbt);
|
||||
nbt = null;
|
||||
}
|
||||
}
|
||||
+11
-8
@@ -27,10 +27,13 @@ public abstract class ExtendedBlockStorageMixin implements IExtendedBlockStorage
|
||||
private int blockRefCount;
|
||||
@Shadow
|
||||
private int tickRefCount;
|
||||
@Shadow private byte[] blockLSBArray;
|
||||
@Shadow private NibbleArray blockMetadataArray;
|
||||
@Shadow
|
||||
private byte[] blockLSBArray;
|
||||
@Shadow
|
||||
private NibbleArray blockMetadataArray;
|
||||
|
||||
@Shadow private NibbleArray blockMSBArray;
|
||||
@Shadow
|
||||
private NibbleArray blockMSBArray;
|
||||
private NibbleArray b2High;
|
||||
private byte[] b3;
|
||||
private short[] metaArray;
|
||||
@@ -141,7 +144,7 @@ public abstract class ExtendedBlockStorageMixin implements IExtendedBlockStorage
|
||||
@Overwrite
|
||||
public void setExtBlockMetadata(int x, int y, int z, int meta) {
|
||||
int index = y << 8 | z << 4 | x;
|
||||
metaArray[index] = (short)(meta & 0xFFFF);
|
||||
metaArray[index] = (short) (meta & 0xFFFF);
|
||||
}
|
||||
|
||||
@Redirect(method = "removeInvalidBlocks",
|
||||
@@ -181,13 +184,13 @@ public abstract class ExtendedBlockStorageMixin implements IExtendedBlockStorage
|
||||
}
|
||||
|
||||
@Override
|
||||
public void clearB2Low() {
|
||||
blockMSBArray = null;
|
||||
public void setB2Low(NibbleArray data) {
|
||||
blockMSBArray = data;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setB2Low(NibbleArray data) {
|
||||
blockMSBArray = data;
|
||||
public void clearB2Low() {
|
||||
blockMSBArray = null;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
+4
-4
@@ -19,6 +19,9 @@ import net.minecraft.world.chunk.storage.ExtendedBlockStorage;
|
||||
|
||||
@Mixin(S21PacketChunkData.class)
|
||||
public abstract class S21PacketChunkDataMixin {
|
||||
private static byte[][] fakeArrays;
|
||||
private static NibbleArray fakeNarray;
|
||||
|
||||
@Redirect(method = "func_149269_a",
|
||||
at = @At(value = "INVOKE",
|
||||
target = "Lnet/minecraft/world/chunk/storage/ExtendedBlockStorage;getBlockMSBArray()Lnet/minecraft/world/chunk/NibbleArray;",
|
||||
@@ -38,7 +41,6 @@ public abstract class S21PacketChunkDataMixin {
|
||||
extracted.field_150281_c |= Hooks.getBlockData(ebs, abyte, j) << l * 2;
|
||||
}
|
||||
|
||||
private static byte[][] fakeArrays;
|
||||
@Redirect(method = "func_149269_a",
|
||||
at = @At(value = "INVOKE",
|
||||
target = "Lnet/minecraft/world/chunk/storage/ExtendedBlockStorage;getBlockLSBArray()[B"),
|
||||
@@ -51,7 +53,7 @@ public abstract class S21PacketChunkDataMixin {
|
||||
fakeArrays[2] = new byte[16 * 16 * 16 * 4 / 2];
|
||||
fakeArrays[3] = new byte[16 * 16 * 16 * 6 / 2];
|
||||
}
|
||||
return fakeArrays[((IExtendedBlockStorageMixin)instance).getStorageFlag()];
|
||||
return fakeArrays[((IExtendedBlockStorageMixin) instance).getStorageFlag()];
|
||||
}
|
||||
|
||||
@Redirect(method = "func_149269_a",
|
||||
@@ -74,8 +76,6 @@ public abstract class S21PacketChunkDataMixin {
|
||||
Hooks.getBlockMeta((IExtendedBlockStorageMixin) aextendedblockstorage[l], abyte, j);
|
||||
}
|
||||
|
||||
private static NibbleArray fakeNarray;
|
||||
|
||||
@Redirect(method = "func_149269_a",
|
||||
at = @At(value = "INVOKE",
|
||||
target = "Lnet/minecraft/world/chunk/storage/ExtendedBlockStorage;getMetadataArray()Lnet/minecraft/world/chunk/NibbleArray;"),
|
||||
|
||||
+3
-2
@@ -9,7 +9,8 @@ import org.spongepowered.asm.mixin.Shadow;
|
||||
@Mixin(value = BaseBlock.class,
|
||||
remap = false)
|
||||
public abstract class BaseBlockMixin {
|
||||
@Shadow private short data;
|
||||
@Shadow
|
||||
private short data;
|
||||
private int idExtended;
|
||||
|
||||
/**
|
||||
@@ -58,7 +59,7 @@ public abstract class BaseBlockMixin {
|
||||
} else if (data < -1) {
|
||||
throw new IllegalArgumentException("Can't have a block data value below -1");
|
||||
} else {
|
||||
this.data = (short)data;
|
||||
this.data = (short) data;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+30
-26
@@ -13,32 +13,6 @@ import net.minecraft.potion.PotionEffect;
|
||||
|
||||
@Mixin(value = PotionEffect.class)
|
||||
public abstract class PotionEffectMixin {
|
||||
@Shadow public abstract int getPotionID();
|
||||
|
||||
@Shadow public abstract int getAmplifier();
|
||||
|
||||
@Shadow public abstract int getDuration();
|
||||
|
||||
@Shadow public abstract boolean getIsAmbient();
|
||||
|
||||
@Inject(method = "writeCustomPotionEffectToNBT",
|
||||
at = @At(value = "HEAD"),
|
||||
cancellable = true,
|
||||
require = 1)
|
||||
private void writeCustomPotionEffectToNBTExtended(NBTTagCompound nbt, CallbackInfoReturnable<NBTTagCompound> cir) {
|
||||
val potionID = getPotionID();
|
||||
if (potionID > 127) {
|
||||
nbt.setInteger("IdExtended", potionID);
|
||||
nbt.setByte("Id", (byte)-1);
|
||||
} else {
|
||||
nbt.setByte("Id", (byte)potionID);
|
||||
}
|
||||
nbt.setByte("Amplifier", (byte)this.getAmplifier());
|
||||
nbt.setInteger("Duration", this.getDuration());
|
||||
nbt.setBoolean("Ambient", this.getIsAmbient());
|
||||
cir.setReturnValue(nbt);
|
||||
}
|
||||
|
||||
@Inject(method = "readCustomPotionEffectFromNBT",
|
||||
at = @At(value = "HEAD"),
|
||||
cancellable = true,
|
||||
@@ -60,4 +34,34 @@ public abstract class PotionEffectMixin {
|
||||
cir.setReturnValue(null);
|
||||
}
|
||||
}
|
||||
|
||||
@Shadow
|
||||
public abstract int getPotionID();
|
||||
|
||||
@Shadow
|
||||
public abstract int getAmplifier();
|
||||
|
||||
@Shadow
|
||||
public abstract int getDuration();
|
||||
|
||||
@Shadow
|
||||
public abstract boolean getIsAmbient();
|
||||
|
||||
@Inject(method = "writeCustomPotionEffectToNBT",
|
||||
at = @At(value = "HEAD"),
|
||||
cancellable = true,
|
||||
require = 1)
|
||||
private void writeCustomPotionEffectToNBTExtended(NBTTagCompound nbt, CallbackInfoReturnable<NBTTagCompound> cir) {
|
||||
val potionID = getPotionID();
|
||||
if (potionID > 127) {
|
||||
nbt.setInteger("IdExtended", potionID);
|
||||
nbt.setByte("Id", (byte) -1);
|
||||
} else {
|
||||
nbt.setByte("Id", (byte) potionID);
|
||||
}
|
||||
nbt.setByte("Amplifier", (byte) this.getAmplifier());
|
||||
nbt.setInteger("Duration", this.getDuration());
|
||||
nbt.setBoolean("Ambient", this.getIsAmbient());
|
||||
cir.setReturnValue(nbt);
|
||||
}
|
||||
}
|
||||
+8
-8
@@ -18,7 +18,7 @@ public abstract class S1DPacketEntityEffectMixin implements IS1DPacketEntityEffe
|
||||
|
||||
@WrapOperation(method = "<init>(ILnet/minecraft/potion/PotionEffect;)V",
|
||||
at = @At(value = "INVOKE",
|
||||
target = "Lnet/minecraft/potion/PotionEffect;getPotionID()I"),
|
||||
target = "Lnet/minecraft/potion/PotionEffect;getPotionID()I"),
|
||||
require = 1)
|
||||
private int getPotionID(PotionEffect effect, Operation<Integer> original) {
|
||||
idExtended = original.call(effect);
|
||||
@@ -26,10 +26,10 @@ public abstract class S1DPacketEntityEffectMixin implements IS1DPacketEntityEffe
|
||||
}
|
||||
|
||||
@Redirect(method = "readPacketData",
|
||||
at = @At(value = "INVOKE",
|
||||
target = "Lnet/minecraft/network/PacketBuffer;readByte()B",
|
||||
ordinal = 0),
|
||||
require = 1)
|
||||
at = @At(value = "INVOKE",
|
||||
target = "Lnet/minecraft/network/PacketBuffer;readByte()B",
|
||||
ordinal = 0),
|
||||
require = 1)
|
||||
private byte networkReadPacketData(PacketBuffer instance) {
|
||||
idExtended = instance.readInt();
|
||||
return -1;
|
||||
@@ -44,9 +44,9 @@ public abstract class S1DPacketEntityEffectMixin implements IS1DPacketEntityEffe
|
||||
instance.writeInt(idExtended);
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getIDExtended() {
|
||||
|
||||
@Override
|
||||
public int getIDExtended() {
|
||||
return this.idExtended;
|
||||
}
|
||||
}
|
||||
+2
-1
@@ -13,7 +13,8 @@ import net.minecraft.network.play.server.S1EPacketRemoveEntityEffect;
|
||||
|
||||
@Mixin(S1EPacketRemoveEntityEffect.class)
|
||||
public abstract class S1EPacketRemoveEntityEffectMixin {
|
||||
@Shadow private int field_149078_b;
|
||||
@Shadow
|
||||
private int field_149078_b;
|
||||
|
||||
@Redirect(method = "readPacketData",
|
||||
at = @At(value = "INVOKE",
|
||||
|
||||
+18
-17
@@ -21,21 +21,22 @@ import java.util.zip.Inflater;
|
||||
|
||||
@Mixin(S21PacketChunkData.class)
|
||||
public abstract class S21PacketChunkDataMixin {
|
||||
@Shadow private int field_149280_d;
|
||||
|
||||
@Shadow private byte[] field_149278_f;
|
||||
|
||||
@Shadow private int field_149284_a;
|
||||
|
||||
@Shadow private int field_149282_b;
|
||||
|
||||
@Shadow private boolean field_149279_g;
|
||||
|
||||
@Shadow private int field_149283_c;
|
||||
|
||||
@Shadow private int field_149285_h;
|
||||
|
||||
@Shadow private static byte[] field_149286_i;
|
||||
@Shadow
|
||||
private static byte[] field_149286_i;
|
||||
@Shadow
|
||||
private int field_149280_d;
|
||||
@Shadow
|
||||
private byte[] field_149278_f;
|
||||
@Shadow
|
||||
private int field_149284_a;
|
||||
@Shadow
|
||||
private int field_149282_b;
|
||||
@Shadow
|
||||
private boolean field_149279_g;
|
||||
@Shadow
|
||||
private int field_149283_c;
|
||||
@Shadow
|
||||
private int field_149285_h;
|
||||
|
||||
@ModifyConstant(method = {"<clinit>", "func_149275_c"},
|
||||
constant = @Constant(intValue = VanillaConstants.bytesPerChunk),
|
||||
@@ -47,8 +48,8 @@ public abstract class S21PacketChunkDataMixin {
|
||||
|
||||
@Inject(method = "writePacketData",
|
||||
at = @At(value = "INVOKE",
|
||||
target = "Lnet/minecraft/network/PacketBuffer;writeShort(I)Lio/netty/buffer/ByteBuf;",
|
||||
ordinal = 1),
|
||||
target = "Lnet/minecraft/network/PacketBuffer;writeShort(I)Lio/netty/buffer/ByteBuf;",
|
||||
ordinal = 1),
|
||||
require = 1)
|
||||
private void extendWrite(PacketBuffer p_148840_1_, CallbackInfo ci) {
|
||||
p_148840_1_.writeInt(this.field_149280_d);
|
||||
|
||||
+10
-5
@@ -16,15 +16,20 @@ import java.util.zip.Inflater;
|
||||
|
||||
@Mixin(S26PacketMapChunkBulk.class)
|
||||
public abstract class S26PacketMapChunkBulkMixin {
|
||||
@Shadow private int[] field_149262_d;
|
||||
@Shadow
|
||||
private int[] field_149262_d;
|
||||
|
||||
@Shadow private byte[][] field_149260_f;
|
||||
@Shadow
|
||||
private byte[][] field_149260_f;
|
||||
|
||||
@Shadow private int[] field_149266_a;
|
||||
@Shadow
|
||||
private int[] field_149266_a;
|
||||
|
||||
@Shadow private int[] field_149264_b;
|
||||
@Shadow
|
||||
private int[] field_149264_b;
|
||||
|
||||
@Shadow private int[] field_149265_c;
|
||||
@Shadow
|
||||
private int[] field_149265_c;
|
||||
|
||||
@Inject(method = "writePacketData",
|
||||
at = @At(value = "INVOKE",
|
||||
|
||||
+4
-4
@@ -3,10 +3,10 @@ package com.falsepattern.endlessids.mixin.stubpackage.org.dave.CompactMachines.t
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public class TileEntityMachine {
|
||||
public World getWorldObj()
|
||||
{
|
||||
return null;
|
||||
}
|
||||
public int xCoord;
|
||||
public int zCoord;
|
||||
|
||||
public World getWorldObj() {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user