forked from gnembon/carpetmod
-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
TISCM cache TileEntity Serialization
- Loading branch information
1 parent
ae8c29c
commit d49c88b
Showing
7 changed files
with
93 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
--- a/net/minecraft/tileentity/TileEntity.java | ||
+++ b/net/minecraft/tileentity/TileEntity.java | ||
@@ -1,6 +1,8 @@ | ||
package net.minecraft.tileentity; | ||
|
||
import javax.annotation.Nullable; | ||
+ | ||
+import carpet.utils.TISCMOptimizationConfig; | ||
import net.minecraft.block.state.IBlockState; | ||
import net.minecraft.crash.CrashReportCategory; | ||
import net.minecraft.nbt.NBTTagCompound; | ||
@@ -26,6 +28,9 @@ | ||
@Nullable | ||
private IBlockState cachedBlockState; | ||
|
||
+ // TISCM cache TileEntity Serialization | ||
+ private ResourceLocation tileEntityIdCache; | ||
+ | ||
public TileEntity(TileEntityType<?> tileEntityTypeIn) | ||
{ | ||
this.type = tileEntityTypeIn; | ||
@@ -59,7 +64,19 @@ | ||
|
||
private NBTTagCompound writeInternal(NBTTagCompound compound) | ||
{ | ||
- ResourceLocation resourcelocation = TileEntityType.getId(this.getType()); | ||
+ // TISCM cache TileEntity Serialization | ||
+// ResourceLocation resourcelocation = TileEntityType.getId(this.getType()); | ||
+ ResourceLocation resourcelocation; | ||
+ if (TISCMOptimizationConfig.CACHE_TILE_ENTITY_SERIALIZATION && this.tileEntityIdCache != null) | ||
+ { | ||
+ resourcelocation = this.tileEntityIdCache; | ||
+ } | ||
+ else | ||
+ { | ||
+ // vanilla | ||
+ resourcelocation = TileEntityType.getId(this.getType()); | ||
+ this.tileEntityIdCache = resourcelocation; | ||
+ } | ||
|
||
if (resourcelocation == null) | ||
{ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters