Skip to content
This repository has been archived by the owner on Jan 26, 2019. It is now read-only.

Commit

Permalink
Modernize a bit and handling for #253
Browse files Browse the repository at this point in the history
  • Loading branch information
robotia committed Mar 22, 2016
1 parent 41d7705 commit a900715
Show file tree
Hide file tree
Showing 2 changed files with 45 additions and 13 deletions.
19 changes: 18 additions & 1 deletion patches/net/minecraft/inventory/InventoryCrafting.java.patch
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,24 @@
private static final String __OBFID = "CL_00001743";

public InventoryCrafting(Container p_i1807_1_, int p_i1807_2_, int p_i1807_3_)
@@ -105,7 +163,7 @@
@@ -30,15 +88,7 @@

public ItemStack getStackInRowAndColumn(int p_70463_1_, int p_70463_2_)
{
- if (p_70463_1_ >= 0 && p_70463_1_ < this.inventoryWidth)
- {
- int k = p_70463_1_ + p_70463_2_ * this.inventoryWidth;
- return this.getStackInSlot(k);
- }
- else
- {
- return null;
- }
+ return (p_70463_1_ >= 0 && p_70463_1_ < this.inventoryWidth) ? this.getStackInSlot(p_70463_1_ + p_70463_2_ * this.inventoryWidth) : null;
}

public String getInventoryName()
@@ -105,7 +155,7 @@

public int getInventoryStackLimit()
{
Expand Down
39 changes: 27 additions & 12 deletions patches/net/minecraft/world/gen/ChunkProviderServer.java.patch
Original file line number Diff line number Diff line change
Expand Up @@ -285,7 +285,7 @@
}

return chunk;
@@ -195,11 +317,30 @@
@@ -195,11 +317,45 @@

public Chunk provideChunk(int p_73154_1_, int p_73154_2_)
{
Expand All @@ -300,7 +300,22 @@
+ {
+ return chunk;
+ }
+
+
+ if (chunk == null)
+ {
+ logger.error("Provided chunk is null for (" +p_73154_1_ + ", " + p_73154_2_+") !");
+ return null;
+ }
+
+ try
+ {
+ worldObj.isProfilingWorld();
+ }
+ catch (Throwable t)
+ {
+ return chunk;
+ }
+
+ if ((p_73154_1_ != chunk.xPosition || p_73154_2_ != chunk.zPosition) && !worldObj.isProfilingWorld())
+ {
+ logger.error("Chunk (" + chunk.xPosition + ", " + chunk.zPosition + ") stored at (" + p_73154_1_ + ", " + p_73154_2_ + ") in world '" + worldObj.getWorld().getName() + "'");
Expand All @@ -319,15 +334,15 @@
{
if (this.currentChunkLoader == null)
{
@@ -209,6 +350,7 @@
@@ -209,6 +365,7 @@
{
try
{
+ CauldronHooks.logChunkLoad(this, "Safe Load", p_73239_1_, p_73239_2_, false); // Cauldron
Chunk chunk = this.currentChunkLoader.loadChunk(this.worldObj, p_73239_1_, p_73239_2_);

if (chunk != null)
@@ -217,8 +359,11 @@
@@ -217,8 +374,11 @@

if (this.currentChunkProvider != null)
{
Expand All @@ -339,7 +354,7 @@
}

return chunk;
@@ -231,7 +376,7 @@
@@ -231,7 +391,7 @@
}
}

Expand All @@ -348,7 +363,7 @@
{
if (this.currentChunkLoader != null)
{
@@ -246,7 +391,7 @@
@@ -246,7 +406,7 @@
}
}

Expand All @@ -357,7 +372,7 @@
{
if (this.currentChunkLoader != null)
{
@@ -254,15 +399,18 @@
@@ -254,15 +414,18 @@
{
p_73242_1_.lastSaveTime = this.worldObj.getTotalWorldTime();
this.currentChunkLoader.saveChunk(this.worldObj, p_73242_1_);
Expand All @@ -377,7 +392,7 @@
}
}

@@ -277,6 +425,35 @@
@@ -277,6 +440,35 @@
if (this.currentChunkProvider != null)
{
this.currentChunkProvider.populate(p_73153_1_, p_73153_2_, p_73153_3_);
Expand Down Expand Up @@ -413,7 +428,7 @@
GameRegistry.generateWorld(p_73153_2_, p_73153_3_, worldObj, currentChunkProvider, p_73153_1_);
chunk.setChunkModified();
}
@@ -286,11 +463,14 @@
@@ -286,11 +478,14 @@
public boolean saveChunks(boolean p_73151_1_, IProgressUpdate p_73151_2_)
{
int i = 0;
Expand All @@ -431,7 +446,7 @@

if (p_73151_1_)
{
@@ -325,36 +505,74 @@
@@ -325,36 +520,74 @@
{
if (!this.worldObj.levelSaving)
{
Expand Down Expand Up @@ -524,7 +539,7 @@
if (this.currentChunkLoader != null)
{
this.currentChunkLoader.chunkTick();
@@ -371,7 +589,7 @@
@@ -371,7 +604,7 @@

public String makeString()
{
Expand All @@ -533,7 +548,7 @@
}

public List getPossibleCreatures(EnumCreatureType p_73155_1_, int p_73155_2_, int p_73155_3_, int p_73155_4_)
@@ -386,8 +604,33 @@
@@ -386,8 +619,33 @@

public int getLoadedChunkCount()
{
Expand Down

0 comments on commit a900715

Please sign in to comment.