mirror of
https://github.com/GTMEGA/EndlessIDs.git
synced 2026-11-18 14:59:09 +00:00
16 million item IDs
This commit is contained in:
13 files changed
+260
-139
No files matched your search
@@ -2,122 +2,111 @@ package com.falsepattern.endlessids;
|
||||
|
||||
import com.falsepattern.endlessids.constants.ExtendedConstants;
|
||||
import com.falsepattern.endlessids.mixin.helpers.IExtendedBlockStorageMixin;
|
||||
import lombok.val;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import java.nio.ShortBuffer;
|
||||
import java.nio.ByteBuffer;
|
||||
import net.minecraft.world.chunk.storage.ExtendedBlockStorage;
|
||||
|
||||
public class Hooks
|
||||
{
|
||||
public Hooks() {
|
||||
super();
|
||||
}
|
||||
|
||||
public class Hooks {
|
||||
|
||||
public static byte[] getBlockData(final IExtendedBlockStorageMixin ebs) {
|
||||
final short[] data = ebs.get16B();
|
||||
final byte[] ret = new byte[data.length * 2];
|
||||
ByteBuffer.wrap(ret).asShortBuffer().put(data);
|
||||
val lsb = ebs.getLSB();
|
||||
val msb = ebs.getMSB();
|
||||
final byte[] ret = new byte[lsb.length * 3];
|
||||
ByteBuffer.wrap(ret).asShortBuffer().put(lsb);
|
||||
System.arraycopy(msb, 0, ret, lsb.length * 2, lsb.length);
|
||||
return ret;
|
||||
}
|
||||
|
||||
public static void setBlockData(final IExtendedBlockStorageMixin ebs, final byte[] data, final int offset) {
|
||||
ShortBuffer.wrap(ebs.get16B()).put(ByteBuffer.wrap(data, offset, 8192).asShortBuffer());
|
||||
}
|
||||
|
||||
public static void writeChunkToNbt(final NBTTagCompound nbt, final IExtendedBlockStorageMixin ebs) {
|
||||
nbt.setByteArray("Blocks16", getBlockData(ebs));
|
||||
if (IEConfig.postNeidWorldsSupport) {
|
||||
final short[] data = ebs.getLSB();
|
||||
final byte[] lsbData = new byte[data.length];
|
||||
byte[] msbData = null;
|
||||
for (int i = 0; i < data.length; ++i) {
|
||||
final int id = data[i] & ExtendedConstants.blockIDMask;
|
||||
if (id <= 255) {
|
||||
lsbData[i] = (byte)id;
|
||||
}
|
||||
else if (id <= 4095) {
|
||||
if (msbData == null) {
|
||||
msbData = new byte[data.length / 2];
|
||||
}
|
||||
lsbData[i] = (byte)id;
|
||||
if (i % 2 == 0) {
|
||||
final byte[] array = msbData;
|
||||
final int n = i / 2;
|
||||
array[n] |= (byte)(id >>> 8 & 0xF);
|
||||
}
|
||||
else {
|
||||
final byte[] array2 = msbData;
|
||||
final int n2 = i / 2;
|
||||
array2[n2] |= (byte)(id >>> 4 & 0xF0);
|
||||
}
|
||||
}
|
||||
}
|
||||
nbt.setByteArray("Blocks", lsbData);
|
||||
if (msbData != null) {
|
||||
nbt.setByteArray("Add", msbData);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static void readChunkFromNbt(final IExtendedBlockStorageMixin ebs, final NBTTagCompound nbt) {
|
||||
if (nbt.hasKey("Blocks16")) {
|
||||
setBlockData(ebs, nbt.getByteArray("Blocks16"), 0);
|
||||
}
|
||||
else if (nbt.hasKey("Blocks")) {
|
||||
final short[] out = ebs.get16B();
|
||||
final byte[] lsbData = nbt.getByteArray("Blocks");
|
||||
if (nbt.hasKey("Add")) {
|
||||
final byte[] msbData = nbt.getByteArray("Add");
|
||||
for (int i = 0; i < out.length; i += 2) {
|
||||
final byte msPart = msbData[i / 2];
|
||||
out[i] = (short)((lsbData[i] & 0xFF) | (msPart & 0xF) << 8);
|
||||
out[i + 1] = (short)((lsbData[i + 1] & 0xFF) | (msPart & 0xF0) << 4);
|
||||
}
|
||||
}
|
||||
else {
|
||||
for (int j = 0; j < out.length; ++j) {
|
||||
out[j] = (short)(lsbData[j] & 0xFF);
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
assert false;
|
||||
}
|
||||
}
|
||||
|
||||
public static int getBlockId(final IExtendedBlockStorageMixin ebs, final int x, final int y, final int z) {
|
||||
return ebs.get16B()[y << 8 | z << 4 | x] & 0xFFFF;
|
||||
}
|
||||
|
||||
public static Block getBlock(final IExtendedBlockStorageMixin ebs, final int x, final int y, final int z) {
|
||||
return Block.getBlockById(getBlockId(ebs, x, y, z));
|
||||
}
|
||||
|
||||
public static void setBlockId(final IExtendedBlockStorageMixin ebs, final int x, final int y, final int z, final int id) {
|
||||
ebs.get16B()[y << 8 | z << 4 | x] = (short)id;
|
||||
}
|
||||
|
||||
public static short[] create16BArray() {
|
||||
return new short[4096];
|
||||
val lsb = ebs.getLSB();
|
||||
val msb = ebs.getMSB();
|
||||
val lsbBytes = lsb.length * 2;
|
||||
ShortBuffer.wrap(ebs.getLSB()).put(ByteBuffer.wrap(data, offset, lsbBytes).asShortBuffer());
|
||||
System.arraycopy(data, offset + lsbBytes, msb, 0, msb.length);
|
||||
}
|
||||
|
||||
public static byte[] create8BArray() {
|
||||
return new byte[4096];
|
||||
public static void writeChunkToNbt(final NBTTagCompound nbt, final IExtendedBlockStorageMixin ebs) {
|
||||
val ebsLSB = ebs.getLSB();
|
||||
val ebsMSB = ebs.getMSB();
|
||||
|
||||
val byte1Data = new byte[ebsLSB.length];
|
||||
byte[] byte2BottomNibbleData = null;
|
||||
byte[] byte2TopNibbleData = null;
|
||||
byte[] byte3Data = null;
|
||||
for (int i = 0; i < ebsLSB.length; ++i) {
|
||||
if (ebsMSB[i] != 0) {
|
||||
if (byte3Data == null) {
|
||||
byte3Data = new byte[ebsLSB.length];
|
||||
}
|
||||
byte3Data[i] = ebsMSB[i];
|
||||
}
|
||||
val idLSB = (ebsLSB[i] & 0xFFFF);
|
||||
byte1Data[i] = (byte)(idLSB & 0xFF);
|
||||
|
||||
if (idLSB <= 0xFF) continue;
|
||||
val nibbleIndex = i >> 1;
|
||||
val nibbleShift = (i & 1) * 4;
|
||||
if (byte2BottomNibbleData == null) {
|
||||
byte2BottomNibbleData = new byte[ebsLSB.length / 2];
|
||||
}
|
||||
byte2BottomNibbleData[nibbleIndex] |= ((idLSB >>> 8) & 0xF) << nibbleShift;
|
||||
|
||||
if (idLSB <= 0xFFF) continue;
|
||||
if (byte2TopNibbleData == null) {
|
||||
byte2TopNibbleData = new byte[ebsLSB.length / 2];
|
||||
}
|
||||
byte2TopNibbleData[nibbleIndex] |= ((idLSB >>> 12) & 0xF) << nibbleShift;
|
||||
|
||||
}
|
||||
nbt.setByteArray("Blocks", byte1Data);
|
||||
if (byte2BottomNibbleData != null)
|
||||
nbt.setByteArray("Add", byte2BottomNibbleData);
|
||||
if (byte2TopNibbleData != null)
|
||||
nbt.setByteArray("BlocksB2Hi", byte2TopNibbleData);
|
||||
if (byte3Data != null)
|
||||
nbt.setByteArray("BlocksB3", byte3Data);
|
||||
}
|
||||
|
||||
public static void readChunkFromNbt(final IExtendedBlockStorageMixin ebs, final NBTTagCompound nbt) {
|
||||
assert nbt.hasKey("Blocks");
|
||||
val byte1Data = nbt.getByteArray("Blocks");
|
||||
val byte2BottomNibbleData = nbt.hasKey("Add") ? nbt.getByteArray("Add") : null;
|
||||
val byte2TopNibbleData = nbt.hasKey("BlocksB2Hi") ? nbt.getByteArray("BlocksB2Hi") : null;
|
||||
val byte3Data = nbt.hasKey("BlocksB3") ? nbt.getByteArray("BlocksB3") : null;
|
||||
|
||||
val lsb = ebs.getLSB();
|
||||
val msb = ebs.getMSB();
|
||||
for (int i = 0; i < lsb.length; i++) {
|
||||
if (byte3Data != null) {
|
||||
msb[i] = byte3Data[i];
|
||||
}
|
||||
int nibbleShift = (i & 1) * 4;
|
||||
int id = byte1Data[i] & 0xFF;
|
||||
if (byte2BottomNibbleData != null) {
|
||||
id |= ((byte2BottomNibbleData[i >> 1] >> nibbleShift) & 0xF) << 8;
|
||||
}
|
||||
if (byte2TopNibbleData != null) {
|
||||
id |= ((byte2TopNibbleData[i >> 1] >> nibbleShift) & 0xF) << 12;
|
||||
}
|
||||
lsb[i] = (short)id;
|
||||
}
|
||||
}
|
||||
|
||||
public static void removeInvalidBlocksHook(final IExtendedBlockStorageMixin ebs) {
|
||||
final short[] blkIds = ebs.get16B();
|
||||
val blkIdsLSB = ebs.getLSB();
|
||||
val blkIdsMSB = ebs.getMSB();
|
||||
int cntNonEmpty = 0;
|
||||
int cntTicking = 0;
|
||||
for (int off = 0; off < blkIds.length; ++off) {
|
||||
final int id = blkIds[off] & 0xFFFF;
|
||||
for (int off = 0; off < blkIdsLSB.length; ++off) {
|
||||
final int id = ((blkIdsLSB[off] & 0xFFFF) | ((blkIdsMSB[off] & 0xFF) << 16)) & ExtendedConstants.blockIDMask;
|
||||
if (id > 0) {
|
||||
final Block block = (Block)Block.blockRegistry.getObjectById(id);
|
||||
if (block == null) {
|
||||
if (IEConfig.removeInvalidBlocks) {
|
||||
blkIds[off] = 0;
|
||||
blkIdsLSB[off] = 0;
|
||||
}
|
||||
}
|
||||
else if (block != Blocks.air) {
|
||||
|
||||
@@ -16,7 +16,7 @@ public class IDExtender
|
||||
|
||||
@Mod.EventHandler
|
||||
public void test(final FMLPreInitializationEvent event) {
|
||||
// for(int i = 0; i < 31658; i++){
|
||||
// for(int i = 0; i < 65536; i++){
|
||||
// Block shield = new BlockIce().setBlockName(".shield" + i);
|
||||
// GameRegistry.registerBlock(shield, i + "ShieldBlock");
|
||||
// shield.setCreativeTab(CreativeTabs.tabFood);
|
||||
|
||||
@@ -2,6 +2,7 @@ package com.falsepattern.endlessids.asm.transformer;
|
||||
|
||||
import com.falsepattern.endlessids.constants.ExtendedConstants;
|
||||
import com.falsepattern.endlessids.constants.VanillaConstants;
|
||||
import lombok.var;
|
||||
import org.objectweb.asm.tree.FieldNode;
|
||||
import com.falsepattern.endlessids.asm.AsmTransformException;
|
||||
import org.objectweb.asm.tree.MethodNode;
|
||||
@@ -17,7 +18,11 @@ public class FmlRegistry implements IClassNodeTransformer
|
||||
|
||||
@Override
|
||||
public void transform(final ClassNode cn, final boolean obfuscated) {
|
||||
final FieldNode field = AsmUtil.findField(cn, "MAX_BLOCK_ID", true);
|
||||
var field = AsmUtil.findField(cn, "MAX_BLOCK_ID", true);
|
||||
if (field != null) {
|
||||
field.value = ExtendedConstants.maxBlockID;
|
||||
}
|
||||
field = AsmUtil.findField(cn, "MAX_ITEM_ID", true);
|
||||
if (field != null) {
|
||||
field.value = ExtendedConstants.maxBlockID;
|
||||
}
|
||||
@@ -26,6 +31,7 @@ public class FmlRegistry implements IClassNodeTransformer
|
||||
if (AsmUtil.transformInlinedSizeMethod(cn, method, VanillaConstants.maxBlockID, ExtendedConstants.maxBlockID, true)) {
|
||||
found = true;
|
||||
}
|
||||
AsmUtil.transformInlinedSizeMethod(cn, method, 31999, ExtendedConstants.maxBlockID, true);
|
||||
}
|
||||
if (!found) {
|
||||
throw new AsmTransformException("can't find 4095 constant in any method");
|
||||
|
||||
@@ -2,9 +2,9 @@ package com.falsepattern.endlessids.constants;
|
||||
|
||||
public class ExtendedConstants {
|
||||
//Tunables
|
||||
public static final int bitsPerID = 16;
|
||||
public static final int bitsPerID = 24;
|
||||
public static final int bitsPerMetadata = 4;
|
||||
public static final int countCorrectionBits = 1;
|
||||
public static final int countCorrectionBits = 0;
|
||||
|
||||
public static final int watchableBits = 7;
|
||||
|
||||
|
||||
+12
-11
@@ -21,26 +21,27 @@ public abstract class NetHandlerPlayClientMixin {
|
||||
@Shadow private WorldClient clientWorldController;
|
||||
|
||||
|
||||
//TODO magic logic
|
||||
/**
|
||||
* @author FalsePattern
|
||||
* @reason Direct port from dumped code
|
||||
*/
|
||||
@Overwrite
|
||||
public void handleMultiBlockChange(S22PacketMultiBlockChange p_147287_1_) throws IOException {
|
||||
int var2 = p_147287_1_.func_148920_c().chunkXPos * 16;
|
||||
int var3 = p_147287_1_.func_148920_c().chunkZPos * 16;
|
||||
if (p_147287_1_.func_148921_d() != null) {
|
||||
DataInputStream var4 = new DataInputStream(new ByteArrayInputStream(p_147287_1_.func_148921_d()));
|
||||
public void handleMultiBlockChange(S22PacketMultiBlockChange packetIn) throws IOException {
|
||||
int var2 = packetIn.func_148920_c().chunkXPos * 16;
|
||||
int var3 = packetIn.func_148920_c().chunkZPos * 16;
|
||||
if (packetIn.func_148921_d() != null) {
|
||||
DataInputStream dataInput = new DataInputStream(new ByteArrayInputStream(packetIn.func_148921_d()));
|
||||
|
||||
for(int var5 = 0; var5 < p_147287_1_.func_148922_e(); ++var5) {
|
||||
short var6 = var4.readShort();
|
||||
short var8 = var4.readShort();
|
||||
int var9 = var4.readByte() & 15;
|
||||
for(int var5 = 0; var5 < packetIn.func_148922_e(); ++var5) {
|
||||
short var6 = dataInput.readShort();
|
||||
short idLSB = dataInput.readShort();
|
||||
byte idMSB = dataInput.readByte();
|
||||
int id = (idLSB & 0xFFFF) | ((idMSB & 0xFF) << 16);
|
||||
int var9 = dataInput.readByte() & 15;
|
||||
int var10 = var6 >> 12 & 15;
|
||||
int var11 = var6 >> 8 & 15;
|
||||
int var12 = var6 & 255;
|
||||
this.clientWorldController.func_147492_c(var10 + var2, var12, var11 + var3, Block.getBlockById(var8), var9);
|
||||
this.clientWorldController.func_147492_c(var10 + var2, var12, var11 + var3, Block.getBlockById(id), var9);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
-3
@@ -49,9 +49,6 @@ public abstract class AnvilChunkLoaderMixin {
|
||||
var11 = new NBTTagCompound();
|
||||
var11.setByte("Y", (byte)(var10.getYLocation() >> 4 & 255));
|
||||
Hooks.writeChunkToNbt(var11, (IExtendedBlockStorageMixin) var10);
|
||||
if (var10.getBlockMSBArray() != null) {
|
||||
var11.setByteArray("Add", var10.getBlockMSBArray().data);
|
||||
}
|
||||
|
||||
var11.setByteArray("Data", var10.getMetadataArray().data);
|
||||
var11.setByteArray("BlockLight", var10.getBlocklightArray().data);
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package com.falsepattern.endlessids.mixin.mixins.common;
|
||||
|
||||
import com.falsepattern.endlessids.Hooks;
|
||||
import com.falsepattern.endlessids.constants.ExtendedConstants;
|
||||
import com.falsepattern.endlessids.mixin.helpers.IExtendedBlockStorageMixin;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
@@ -62,7 +63,7 @@ public abstract class ChunkMixin {
|
||||
}
|
||||
|
||||
Hooks.setBlockData((IExtendedBlockStorageMixin) this.storageArrays[var8], var1, var16);
|
||||
var16 += 8192;
|
||||
var16 += 16 * 16 * 16 * ExtendedConstants.bytesPerID;
|
||||
} else if (var4 && this.storageArrays[var8] != null) {
|
||||
this.storageArrays[var8] = null;
|
||||
}
|
||||
@@ -95,27 +96,8 @@ public abstract class ChunkMixin {
|
||||
}
|
||||
}
|
||||
|
||||
for(var8 = 0; var8 >= this.storageArrays.length; ++var8) {
|
||||
if ((var3 & 1 << var8) != 0) {
|
||||
if (this.storageArrays[var8] == null) {
|
||||
var16 += 2048;
|
||||
} else {
|
||||
var9 = this.storageArrays[var8].getBlockMSBArray();
|
||||
if (var9 == null) {
|
||||
var9 = this.storageArrays[var8].createBlockMSBArray();
|
||||
}
|
||||
|
||||
System.arraycopy(var1, var16, var9.data, 0, var9.data.length);
|
||||
var16 += var9.data.length;
|
||||
}
|
||||
} else if (var4 && this.storageArrays[var8] != null && this.storageArrays[var8].getBlockMSBArray() != null) {
|
||||
this.storageArrays[var8].clearMSBArray();
|
||||
}
|
||||
}
|
||||
|
||||
if (var4) {
|
||||
System.arraycopy(var1, var16, this.blockBiomeArray, 0, this.blockBiomeArray.length);
|
||||
int var10000 = var16 + this.blockBiomeArray.length;
|
||||
}
|
||||
|
||||
for(var8 = 0; var8 < this.storageArrays.length; ++var8) {
|
||||
|
||||
+2
-3
@@ -31,12 +31,12 @@ public abstract class ExtendedBlockStorageMixin implements IExtendedBlockStorage
|
||||
|
||||
@Override
|
||||
public short[] getLSB() {
|
||||
return new short[0];
|
||||
return lsbArray;
|
||||
}
|
||||
|
||||
@Override
|
||||
public byte[] getMSB() {
|
||||
return new byte[0];
|
||||
return msbArray;
|
||||
}
|
||||
|
||||
@Inject(method = "<init>",
|
||||
@@ -94,7 +94,6 @@ public abstract class ExtendedBlockStorageMixin implements IExtendedBlockStorage
|
||||
|
||||
int blockID = Hooks.getIdFromBlockWithCheck(newBlock, oldBlock);
|
||||
setID(x, y, z, blockID);
|
||||
Hooks.setBlockId(this, x, y, z, blockID);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -0,0 +1,63 @@
|
||||
package com.falsepattern.endlessids.mixin.mixins.common;
|
||||
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.Overwrite;
|
||||
import org.spongepowered.asm.mixin.Shadow;
|
||||
|
||||
@Mixin(ItemStack.class)
|
||||
public abstract class ItemStackMixin {
|
||||
|
||||
@Shadow private Item field_151002_e;
|
||||
|
||||
@Shadow public int stackSize;
|
||||
|
||||
@Shadow int itemDamage;
|
||||
|
||||
@Shadow public NBTTagCompound stackTagCompound;
|
||||
|
||||
@Shadow public abstract void func_150996_a(Item p_150996_1_);
|
||||
|
||||
/**
|
||||
* @author FalsePattern
|
||||
* @reason ID extension
|
||||
*/
|
||||
@Overwrite
|
||||
public NBTTagCompound writeToNBT(NBTTagCompound nbt)
|
||||
{
|
||||
nbt.setInteger("id", Item.getIdFromItem(this.field_151002_e));
|
||||
nbt.setByte("Count", (byte)this.stackSize);
|
||||
nbt.setShort("Damage", (short)this.itemDamage);
|
||||
|
||||
if (this.stackTagCompound != null)
|
||||
{
|
||||
nbt.setTag("tag", this.stackTagCompound);
|
||||
}
|
||||
|
||||
return nbt;
|
||||
}
|
||||
|
||||
/**
|
||||
* @author FalsePattern
|
||||
* @reason ID extension
|
||||
*/
|
||||
@Overwrite
|
||||
public void readFromNBT(NBTTagCompound nbt)
|
||||
{
|
||||
func_150996_a(Item.getItemById(nbt.getInteger("id")));
|
||||
this.stackSize = nbt.getByte("Count");
|
||||
this.itemDamage = nbt.getShort("Damage");
|
||||
|
||||
if (this.itemDamage < 0)
|
||||
{
|
||||
this.itemDamage = 0;
|
||||
}
|
||||
|
||||
if (nbt.hasKey("tag", 10))
|
||||
{
|
||||
this.stackTagCompound = nbt.getCompoundTag("tag");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,80 @@
|
||||
package com.falsepattern.endlessids.mixin.mixins.common;
|
||||
|
||||
import io.netty.buffer.ByteBuf;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.network.PacketBuffer;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.Overwrite;
|
||||
import org.spongepowered.asm.mixin.Shadow;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
@Mixin(PacketBuffer.class)
|
||||
public abstract class PacketBufferMixin {
|
||||
|
||||
@Shadow public abstract int readInt();
|
||||
|
||||
@Shadow public abstract short readShort();
|
||||
|
||||
@Shadow public abstract byte readByte();
|
||||
|
||||
@Shadow public abstract NBTTagCompound readNBTTagCompoundFromBuffer() throws IOException;
|
||||
|
||||
@Shadow public abstract ByteBuf writeInt(int p_writeInt_1_);
|
||||
|
||||
@Shadow public abstract ByteBuf writeByte(int p_writeByte_1_);
|
||||
|
||||
@Shadow public abstract ByteBuf writeShort(int p_writeShort_1_);
|
||||
|
||||
@Shadow public abstract void writeNBTTagCompoundToBuffer(NBTTagCompound p_150786_1_) throws IOException;
|
||||
|
||||
/**
|
||||
* @author FalsePattern
|
||||
* @reason ID extension
|
||||
*/
|
||||
@Overwrite
|
||||
public void writeItemStackToBuffer(ItemStack p_150788_1_) throws IOException
|
||||
{
|
||||
if (p_150788_1_ == null)
|
||||
{
|
||||
this.writeInt(-1);
|
||||
}
|
||||
else
|
||||
{
|
||||
this.writeInt(Item.getIdFromItem(p_150788_1_.getItem()));
|
||||
this.writeByte(p_150788_1_.stackSize);
|
||||
this.writeShort(p_150788_1_.getItemDamage());
|
||||
NBTTagCompound nbttagcompound = null;
|
||||
|
||||
if (p_150788_1_.getItem().isDamageable() || p_150788_1_.getItem().getShareTag())
|
||||
{
|
||||
nbttagcompound = p_150788_1_.stackTagCompound;
|
||||
}
|
||||
|
||||
this.writeNBTTagCompoundToBuffer(nbttagcompound);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @author FalsePattern
|
||||
* @reason ID extension
|
||||
*/
|
||||
@Overwrite
|
||||
public ItemStack readItemStackFromBuffer() throws IOException
|
||||
{
|
||||
ItemStack itemstack = null;
|
||||
int id = this.readInt();
|
||||
|
||||
if (id >= 0)
|
||||
{
|
||||
byte b0 = this.readByte();
|
||||
short damage = this.readShort();
|
||||
itemstack = new ItemStack(Item.getItemById(id), b0, damage);
|
||||
itemstack.stackTagCompound = this.readNBTTagCompoundFromBuffer();
|
||||
}
|
||||
|
||||
return itemstack;
|
||||
}
|
||||
}
|
||||
+3
-2
@@ -19,7 +19,7 @@ public abstract class S22PacketMultiBlockChangeMixin {
|
||||
constant = @Constant(intValue = 4, ordinal = 0),
|
||||
require = 1)
|
||||
private int extend1(int constant) {
|
||||
return 5;
|
||||
return 6;
|
||||
}
|
||||
|
||||
private int id;
|
||||
@@ -41,7 +41,8 @@ public abstract class S22PacketMultiBlockChangeMixin {
|
||||
ordinal = 1),
|
||||
require = 1)
|
||||
private void hackWrite(DataOutputStream instance, int value) throws IOException {
|
||||
instance.writeShort(id);
|
||||
instance.writeShort(id & 0xFFFF);
|
||||
instance.writeByte((id >>> 16) & 0xFF);
|
||||
instance.writeByte(meta);
|
||||
}
|
||||
}
|
||||
@@ -10,9 +10,10 @@ import org.spongepowered.asm.mixin.injection.ModifyConstant;
|
||||
@Mixin(StatList.class)
|
||||
public abstract class StatListMixin {
|
||||
@ModifyConstant(method = "<clinit>",
|
||||
constant = @Constant(intValue = VanillaConstants.blockIDCount),
|
||||
require = 1)
|
||||
constant = {@Constant(intValue = VanillaConstants.blockIDCount), @Constant(intValue = 32000)},
|
||||
require = 4)
|
||||
private static int modifyMineBlockStatArraySize(int constant) {
|
||||
return ExtendedConstants.blockIDCount;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -20,6 +20,8 @@ public enum Mixin {
|
||||
S22PacketMultiBlockChangeMixin(builder(Side.COMMON).mixin("S22PacketMultiBlockChangeMixin")),
|
||||
S24PacketBlockActionMixin(builder(Side.COMMON).mixin("S24PacketBlockActionMixin")),
|
||||
S26PacketMapChunkBulkMixin(builder(Side.COMMON).mixin("S26PacketMapChunkBulkMixin")),
|
||||
PacketBufferMixin(builder(Side.COMMON).mixin("PacketBufferMixin")),
|
||||
ItemStackMixin(builder(Side.COMMON).mixin("ItemStackMixin")),
|
||||
PlayerControllerMPMixin(builder(Side.COMMON).mixin("PlayerControllerMPMixin")),
|
||||
ItemInWorldManagerMixin(builder(Side.COMMON).mixin("ItemInWorldManagerMixin")),
|
||||
NetHandlerPlayClientMixin(builder(Side.CLIENT).mixin("NetHandlerPlayClientMixin")),
|
||||
|
||||
Reference in new issue
Block a user