Skip to content

Commit

Permalink
Most requested feature of all time? TileEntity init method called aft…
Browse files Browse the repository at this point in the history
…er it's ready to roll. remove all the if (firstTicks)
  • Loading branch information
cpw committed Dec 1, 2015
1 parent e6681ad commit 31faf63
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 10 deletions.
13 changes: 12 additions & 1 deletion patches/minecraft/net/minecraft/tileentity/TileEntity.java.patch
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@
public double func_145835_a(double p_145835_1_, double p_145835_3_, double p_145835_5_)
{
double d0 = (double)this.field_174879_c.func_177958_n() + 0.5D - p_145835_1_;
@@ -279,4 +291,135 @@
@@ -279,4 +291,146 @@
func_145826_a(TileEntityFlowerPot.class, "FlowerPot");
func_145826_a(TileEntityBanner.class, "Banner");
}
Expand Down Expand Up @@ -188,5 +188,16 @@
+ return this instanceof TileEntityCommandBlock ||
+ this instanceof TileEntityMobSpawner ||
+ this instanceof TileEntitySign;
+ }
+
+
+ /**
+ * Called from the Chunk when this is first added to the world. Override instead of adding
+ * if (firstTick) stuff in update. Happens after validate and after it has been placed into the Chunk tileEntity
+ * map.
+ */
+ public void onLoad()
+ {
+ // NOOP
+ }
}
34 changes: 25 additions & 9 deletions patches/minecraft/net/minecraft/world/chunk/Chunk.java.patch
Original file line number Diff line number Diff line change
@@ -1,6 +1,14 @@
--- ../src-base/minecraft/net/minecraft/world/chunk/Chunk.java
+++ ../src-work/minecraft/net/minecraft/world/chunk/Chunk.java
@@ -167,7 +167,7 @@
@@ -10,7 +10,6 @@
import java.util.concurrent.Callable;
import java.util.concurrent.ConcurrentLinkedQueue;
import net.minecraft.block.Block;
-import net.minecraft.block.ITileEntityProvider;

This comment has been minimized.

Copy link
@liach

liach Dec 1, 2015

Contributor

bad patch

This comment has been minimized.

Copy link
@cpw

cpw Dec 1, 2015

Author Contributor

Interesting. Will fix..

import net.minecraft.block.material.Material;
import net.minecraft.block.state.IBlockState;
import net.minecraft.crash.CrashReport;
@@ -167,7 +166,7 @@
{
Block block = this.func_150810_a(j, l - 1, k);

Expand All @@ -9,7 +17,7 @@
{
this.field_76634_f[k << 4 | j] = l;

@@ -440,12 +440,12 @@
@@ -440,12 +439,12 @@

public int func_177437_b(BlockPos p_177437_1_)
{
Expand All @@ -24,7 +32,7 @@
}

private Block func_150810_a(int p_150810_1_, int p_150810_2_, int p_150810_3_)
@@ -623,14 +623,19 @@
@@ -623,14 +622,19 @@

extendedblockstorage.func_177484_a(i, j & 15, k, p_177436_2_);

Expand All @@ -46,7 +54,7 @@
this.field_76637_e.func_175713_t(p_177436_1_);
}
}
@@ -647,8 +652,8 @@
@@ -647,8 +651,8 @@
}
else
{
Expand All @@ -57,7 +65,7 @@

if (j1 > 0)
{
@@ -668,28 +673,18 @@
@@ -668,28 +672,18 @@
}
}

Expand Down Expand Up @@ -88,15 +96,15 @@
this.field_76637_e.func_175690_a(p_177436_1_, tileentity1);
}

@@ -792,6 +787,7 @@
@@ -792,6 +786,7 @@
k = this.field_76645_j.length - 1;
}

+ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.entity.EntityEvent.EnteringChunk(p_76612_1_, this.field_76635_g, this.field_76647_h, p_76612_1_.field_70176_ah, p_76612_1_.field_70164_aj));
p_76612_1_.field_70175_ag = true;
p_76612_1_.field_70176_ah = this.field_76635_g;
p_76612_1_.field_70162_ai = k;
@@ -830,13 +826,20 @@
@@ -830,13 +825,20 @@
private TileEntity func_177422_i(BlockPos p_177422_1_)
{
Block block = this.func_177428_a(p_177422_1_);
Expand All @@ -118,7 +126,7 @@
if (tileentity == null)
{
if (p_177424_2_ == Chunk.EnumCreateEntityType.IMMEDIATE)
@@ -849,11 +852,6 @@
@@ -849,11 +851,6 @@
this.field_177447_w.add(p_177424_1_);
}
}
Expand All @@ -130,7 +138,7 @@

return tileentity;
}
@@ -873,7 +871,7 @@
@@ -873,7 +870,7 @@
p_177426_2_.func_145834_a(this.field_76637_e);
p_177426_2_.func_174878_a(p_177426_1_);

Expand All @@ -139,6 +147,14 @@
{
if (this.field_150816_i.containsKey(p_177426_1_))
{
@@ -882,6 +879,7 @@

p_177426_2_.func_145829_t();
this.field_150816_i.put(p_177426_1_, p_177426_2_);
+ p_177426_2_.onLoad();
}
}

@@ -910,8 +908,9 @@
entity.func_110123_P();
}
Expand Down

0 comments on commit 31faf63

Please sign in to comment.