Fixed Tile Entities not saving

This commit is contained in:
PeytonPlayz595 2024-02-10 08:02:28 -05:00
parent 4a63f52b9e
commit a4abf352e3
3 changed files with 51 additions and 18 deletions

View File

@ -1628,9 +1628,9 @@ function otp_Platform_prepareNewInstance() {
nms_WorldGenFire[c] = nms_WorldGenFire__init_; nms_WorldGenFire[c] = nms_WorldGenFire__init_;
nms_WorldGenLightStone1[c] = nms_WorldGenLightStone1__init_; nms_WorldGenLightStone1[c] = nms_WorldGenLightStone1__init_;
nms_WorldGenLightStone2[c] = nms_WorldGenLightStone2__init_; nms_WorldGenLightStone2[c] = nms_WorldGenLightStone2__init_;
jl_StrictMath[c] = jl_StrictMath__init_;
jl_InstantiationException[c] = jl_InstantiationException__init_; jl_InstantiationException[c] = jl_InstantiationException__init_;
jl_ReflectiveOperationException[c] = jl_ReflectiveOperationException__init_; jl_ReflectiveOperationException[c] = jl_ReflectiveOperationException__init_;
jl_StrictMath[c] = jl_StrictMath__init_;
nms_Path[c] = nms_Path__init_; nms_Path[c] = nms_Path__init_;
nms_MCHashTable[c] = nms_MCHashTable__init_; nms_MCHashTable[c] = nms_MCHashTable__init_;
} }
@ -32075,6 +32075,17 @@ function nms_TileEntity_getBlockType($this) {
}} }}
$rt_nativeThread().push($this, var$1, var$2, var$3, var$4, var$5, $ptr); $rt_nativeThread().push($this, var$1, var$2, var$3, var$4, var$5, $ptr);
} }
function nms_TileEntity_getTileEntity($c) {
if ($c === $rt_cls(nms_TileEntityFurnace))
return nms_TileEntityFurnace__init_0();
if ($c === $rt_cls(nms_TileEntityChest))
return nms_TileEntityChest__init_0();
if ($c === $rt_cls(nms_TileEntitySign))
return nms_TileEntitySign__init_0();
if ($c !== $rt_cls(nms_TileEntityMobSpawner))
return null;
return nms_TileEntityMobSpawner__init_0();
}
function nms_TileEntity__clinit_() { function nms_TileEntity__clinit_() {
nms_TileEntity_nameToClassMap = ju_HashMap__init_0(); nms_TileEntity_nameToClassMap = ju_HashMap__init_0();
nms_TileEntity_classToNameMap = ju_HashMap__init_0(); nms_TileEntity_classToNameMap = ju_HashMap__init_0();
@ -98364,7 +98375,7 @@ function nms_ChunkLoader_loadChunkIntoWorldFromCompound($var0, $var1) {
$var0 = ju_HashMap_get(nms_TileEntity_nameToClassMap, nms_NBTTagCompound_getString($var12, $rt_s(301))); $var0 = ju_HashMap_get(nms_TileEntity_nameToClassMap, nms_NBTTagCompound_getString($var12, $rt_s(301)));
if ($var0 !== null) { if ($var0 !== null) {
$var9_0 = $var9; $var9_0 = $var9;
$var9 = jl_Class_newInstance($var0); $var9 = nms_TileEntity_getTileEntity($var0);
$var9_0 = $var9; $var9_0 = $var9;
} }
break d; break d;
@ -98482,7 +98493,7 @@ function nms_ChunkLoader_loadChunkIntoWorldFromCompound($var0, $var1) {
$var0 = ju_HashMap_get(nms_TileEntity_nameToClassMap, nms_NBTTagCompound_getString($var12, $rt_s(301))); $var0 = ju_HashMap_get(nms_TileEntity_nameToClassMap, nms_NBTTagCompound_getString($var12, $rt_s(301)));
if ($var0 !== null) { if ($var0 !== null) {
$var9_0 = $var9; $var9_0 = $var9;
$var9 = jl_Class_newInstance($var0); $var9 = nms_TileEntity_getTileEntity($var0);
$var9_0 = $var9; $var9_0 = $var9;
} }
break c; break c;
@ -111634,6 +111645,17 @@ function nms_WorldGenLightStone2_generate($this, $var1, $var2, $var3, $var4, $va
}} }}
$rt_nativeThread().push($this, $var1, $var2, $var3, $var4, $var5, $var6, $var7, $var8, $var9, var$10, $var10, $var11, var$13, var$14, var$15, var$16, var$17, var$18, $var12, $ptr); $rt_nativeThread().push($this, $var1, $var2, $var3, $var4, $var5, $var6, $var7, $var8, $var9, var$10, $var10, $var11, var$13, var$14, var$15, var$16, var$17, var$18, $var12, $ptr);
} }
function jl_StrictMath() {
jl_Object.call(this);
}
function jl_StrictMath__init_0() {
var var_0 = new jl_StrictMath();
jl_StrictMath__init_(var_0);
return var_0;
}
function jl_StrictMath__init_($this) {
return;
}
function jl_ReflectiveOperationException() { function jl_ReflectiveOperationException() {
jl_Exception.call(this); jl_Exception.call(this);
} }
@ -111656,17 +111678,6 @@ function jl_InstantiationException__init_0() {
function jl_InstantiationException__init_($this) { function jl_InstantiationException__init_($this) {
jl_Throwable__init_0($this); jl_Throwable__init_0($this);
} }
function jl_StrictMath() {
jl_Object.call(this);
}
function jl_StrictMath__init_0() {
var var_0 = new jl_StrictMath();
jl_StrictMath__init_(var_0);
return var_0;
}
function jl_StrictMath__init_($this) {
return;
}
function nms_Explosion() { function nms_Explosion() {
var a = this; jl_Object.call(a); var a = this; jl_Object.call(a);
a.$field_12257_a = 0; a.$field_12257_a = 0;
@ -112922,7 +112933,7 @@ var_5); }],
nms_BlockSign, "BlockSign", 18, nms_BlockContainer, [], 0, 3, 0, ["$getCollisionBoundingBoxFromPool", function(var_1, var_2, var_3, var_4) { return nms_BlockSign_getCollisionBoundingBoxFromPool(this, var_1, var_2, var_3, var_4); }, "$getSelectedBoundingBoxFromPool", function(var_1, var_2, var_3, var_4) { return nms_BlockSign_getSelectedBoundingBoxFromPool(this, var_1, var_2, var_3, var_4); }, "$setBlockBoundsBasedOnState", function(var_1, var_2, var_3, var_4) { nms_BlockSign_setBlockBoundsBasedOnState(this, nms_BlockSign, "BlockSign", 18, nms_BlockContainer, [], 0, 3, 0, ["$getCollisionBoundingBoxFromPool", function(var_1, var_2, var_3, var_4) { return nms_BlockSign_getCollisionBoundingBoxFromPool(this, var_1, var_2, var_3, var_4); }, "$getSelectedBoundingBoxFromPool", function(var_1, var_2, var_3, var_4) { return nms_BlockSign_getSelectedBoundingBoxFromPool(this, var_1, var_2, var_3, var_4); }, "$setBlockBoundsBasedOnState", function(var_1, var_2, var_3, var_4) { nms_BlockSign_setBlockBoundsBasedOnState(this,
var_1, var_2, var_3, var_4); }, "$getRenderType", function() { return nms_BlockSign_getRenderType(this); }, "$renderAsNormalBlock", function() { return nms_BlockSign_renderAsNormalBlock(this); }, "$isOpaqueCube", function() { return nms_BlockSign_isOpaqueCube(this); }, "$SetBlockEntity", function() { return nms_BlockSign_SetBlockEntity(this); }, "$idDropped", function(var_1, var_2) { return nms_BlockSign_idDropped(this, var_1, var_2); }, "$onNeighborBlockChange", function(var_1, var_2, var_3, var_4, var_5) { var_1, var_2, var_3, var_4); }, "$getRenderType", function() { return nms_BlockSign_getRenderType(this); }, "$renderAsNormalBlock", function() { return nms_BlockSign_renderAsNormalBlock(this); }, "$isOpaqueCube", function() { return nms_BlockSign_isOpaqueCube(this); }, "$SetBlockEntity", function() { return nms_BlockSign_SetBlockEntity(this); }, "$idDropped", function(var_1, var_2) { return nms_BlockSign_idDropped(this, var_1, var_2); }, "$onNeighborBlockChange", function(var_1, var_2, var_3, var_4, var_5) {
nms_BlockSign_onNeighborBlockChange(this, var_1, var_2, var_3, var_4, var_5); }], nms_BlockSign_onNeighborBlockChange(this, var_1, var_2, var_3, var_4, var_5); }],
nms_TileEntity, "TileEntity", 18, jl_Object, [], 0, 3, 0, ["$readFromNBT", function(var_1) { nms_TileEntity_readFromNBT(this, var_1); }, "$writeToNBT", function(var_1) { nms_TileEntity_writeToNBT(this, var_1); }, "$updateEntity", function() { nms_TileEntity_updateEntity(this); }, "$onInventoryChanged", function() { nms_TileEntity_onInventoryChanged(this); }], nms_TileEntity, "TileEntity", 18, jl_Object, [], 0, 3, 0, ["$writeToNBT", function(var_1) { nms_TileEntity_writeToNBT(this, var_1); }, "$updateEntity", function() { nms_TileEntity_updateEntity(this); }, "$onInventoryChanged", function() { nms_TileEntity_onInventoryChanged(this); }],
nms_TileEntitySign, 0, nms_TileEntity, [], 0, 3, 0, ["$writeToNBT", function(var_1) { nms_TileEntitySign_writeToNBT(this, var_1); }, "$readFromNBT", function(var_1) { nms_TileEntitySign_readFromNBT(this, var_1); }], nms_TileEntitySign, 0, nms_TileEntity, [], 0, 3, 0, ["$writeToNBT", function(var_1) { nms_TileEntitySign_writeToNBT(this, var_1); }, "$readFromNBT", function(var_1) { nms_TileEntitySign_readFromNBT(this, var_1); }],
nms_BlockDoor, "BlockDoor", 18, nms_Block, [], 0, 3, 0, ["$getBlockTextureFromSideAndMetadata", function(var_1, var_2) { return nms_BlockDoor_getBlockTextureFromSideAndMetadata(this, var_1, var_2); }, "$isOpaqueCube", function() { return nms_BlockDoor_isOpaqueCube(this); }, "$renderAsNormalBlock", function() { return nms_BlockDoor_renderAsNormalBlock(this); }, "$getRenderType", function() { return nms_BlockDoor_getRenderType(this); }, "$getSelectedBoundingBoxFromPool", function(var_1, var_2, var_3, var_4) { nms_BlockDoor, "BlockDoor", 18, nms_Block, [], 0, 3, 0, ["$getBlockTextureFromSideAndMetadata", function(var_1, var_2) { return nms_BlockDoor_getBlockTextureFromSideAndMetadata(this, var_1, var_2); }, "$isOpaqueCube", function() { return nms_BlockDoor_isOpaqueCube(this); }, "$renderAsNormalBlock", function() { return nms_BlockDoor_renderAsNormalBlock(this); }, "$getRenderType", function() { return nms_BlockDoor_getRenderType(this); }, "$getSelectedBoundingBoxFromPool", function(var_1, var_2, var_3, var_4) {
return nms_BlockDoor_getSelectedBoundingBoxFromPool(this, var_1, var_2, var_3, var_4); }, "$getCollisionBoundingBoxFromPool", function(var_1, var_2, var_3, var_4) { return nms_BlockDoor_getCollisionBoundingBoxFromPool(this, var_1, var_2, var_3, var_4); }, "$setBlockBoundsBasedOnState", function(var_1, var_2, var_3, var_4) { nms_BlockDoor_setBlockBoundsBasedOnState(this, var_1, var_2, var_3, var_4); }, "$onBlockClicked", function(var_1, var_2, var_3, var_4, var_5) { nms_BlockDoor_onBlockClicked(this, var_1, var_2, return nms_BlockDoor_getSelectedBoundingBoxFromPool(this, var_1, var_2, var_3, var_4); }, "$getCollisionBoundingBoxFromPool", function(var_1, var_2, var_3, var_4) { return nms_BlockDoor_getCollisionBoundingBoxFromPool(this, var_1, var_2, var_3, var_4); }, "$setBlockBoundsBasedOnState", function(var_1, var_2, var_3, var_4) { nms_BlockDoor_setBlockBoundsBasedOnState(this, var_1, var_2, var_3, var_4); }, "$onBlockClicked", function(var_1, var_2, var_3, var_4, var_5) { nms_BlockDoor_onBlockClicked(this, var_1, var_2,
@ -113695,9 +113706,9 @@ nms_WorldGenHellLava, 0, nms_WorldGenerator, [], 0, 3, 0, 0,
nms_WorldGenFire, 0, nms_WorldGenerator, [], 0, 3, 0, 0, nms_WorldGenFire, 0, nms_WorldGenerator, [], 0, 3, 0, 0,
nms_WorldGenLightStone1, 0, nms_WorldGenerator, [], 0, 3, 0, 0, nms_WorldGenLightStone1, 0, nms_WorldGenerator, [], 0, 3, 0, 0,
nms_WorldGenLightStone2, 0, nms_WorldGenerator, [], 0, 3, 0, 0, nms_WorldGenLightStone2, 0, nms_WorldGenerator, [], 0, 3, 0, 0,
jl_StrictMath, 0, jl_Object, [], 4, 3, 0, 0,
jl_ReflectiveOperationException, 0, jl_Exception, [], 0, 3, 0, 0, jl_ReflectiveOperationException, 0, jl_Exception, [], 0, 3, 0, 0,
jl_InstantiationException, "InstantiationException", 10, jl_ReflectiveOperationException, [], 0, 3, 0, 0, jl_InstantiationException, "InstantiationException", 10, jl_ReflectiveOperationException, [], 0, 3, 0, 0,
jl_StrictMath, 0, jl_Object, [], 4, 3, 0, 0,
nms_Explosion, 0, jl_Object, [], 0, 3, 0, 0, nms_Explosion, 0, jl_Object, [], 0, 3, 0, 0,
nms_PathEntity, 0, jl_Object, [], 0, 3, 0, 0, nms_PathEntity, 0, jl_Object, [], 0, 3, 0, 0,
nms_Pathfinder, 0, jl_Object, [], 0, 3, 0, 0, nms_Pathfinder, 0, jl_Object, [], 0, 3, 0, 0,

File diff suppressed because one or more lines are too long

View File

@ -3,6 +3,8 @@ package net.minecraft.src;
import java.util.HashMap; import java.util.HashMap;
import java.util.Map; import java.util.Map;
import net.minecraft.client.Minecraft;
public class TileEntity { public class TileEntity {
private static Map nameToClassMap = new HashMap(); private static Map nameToClassMap = new HashMap();
private static Map classToNameMap = new HashMap(); private static Map classToNameMap = new HashMap();
@ -48,7 +50,7 @@ public class TileEntity {
try { try {
Class var2 = (Class)nameToClassMap.get(var0.getString("id")); Class var2 = (Class)nameToClassMap.get(var0.getString("id"));
if(var2 != null) { if(var2 != null) {
var1 = (TileEntity)var2.newInstance(); var1 = getTileEntity(var2);
} }
} catch (Exception var3) { } catch (Exception var3) {
var3.printStackTrace(); var3.printStackTrace();
@ -82,6 +84,26 @@ public class TileEntity {
return Block.blocksList[this.worldObj.getBlockId(this.xCoord, this.yCoord, this.zCoord)]; return Block.blocksList[this.worldObj.getBlockId(this.xCoord, this.yCoord, this.zCoord)];
} }
public static TileEntity getTileEntity(Class c) {
if(c == TileEntityFurnace.class) {
return new TileEntityFurnace();
}
if(c == TileEntityChest.class) {
return new TileEntityChest();
}
if(c == TileEntitySign.class) {
return new TileEntitySign();
}
if(c == TileEntityMobSpawner.class) {
return new TileEntityMobSpawner();
}
return null;
}
static { static {
addMapping(TileEntityFurnace.class, "Furnace"); addMapping(TileEntityFurnace.class, "Furnace");
addMapping(TileEntityChest.class, "Chest"); addMapping(TileEntityChest.class, "Chest");