Fire ChunkWatchEvent.Watch event, closes #2767. Based on @sfPlayer1 patch suggestion. It looks like this logic has shifted relative to 1.8, so there may be differences in event behaviour now.
This commit is contained in:
parent
279380b4f1
commit
18e60a1235
|
@ -23,7 +23,16 @@
|
|||
}
|
||||
|
||||
public ChunkPos func_187264_a()
|
||||
@@ -71,6 +80,20 @@
|
||||
@@ -63,6 +72,8 @@
|
||||
if (this.field_187290_j)
|
||||
{
|
||||
this.func_187278_c(p_187276_1_);
|
||||
+ // chunk watch event - the chunk is ready
|
||||
+ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.world.ChunkWatchEvent.Watch(this.field_187284_d, p_187276_1_));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -71,6 +82,20 @@
|
||||
{
|
||||
if (this.field_187283_c.contains(p_187277_1_))
|
||||
{
|
||||
|
@ -44,7 +53,7 @@
|
|||
if (this.field_187290_j)
|
||||
{
|
||||
p_187277_1_.field_71135_a.func_147359_a(new SPacketUnloadChunk(this.field_187284_d.field_77276_a, this.field_187284_d.field_77275_b));
|
||||
@@ -78,6 +101,8 @@
|
||||
@@ -78,6 +103,8 @@
|
||||
|
||||
this.field_187283_c.remove(p_187277_1_);
|
||||
|
||||
|
@ -53,7 +62,7 @@
|
|||
if (this.field_187283_c.isEmpty())
|
||||
{
|
||||
this.field_187282_b.func_187305_b(this);
|
||||
@@ -87,6 +112,7 @@
|
||||
@@ -87,6 +114,7 @@
|
||||
|
||||
public boolean func_187268_a(boolean p_187268_1_)
|
||||
{
|
||||
|
@ -61,7 +70,16 @@
|
|||
if (this.field_187286_f != null)
|
||||
{
|
||||
return true;
|
||||
@@ -167,7 +193,7 @@
|
||||
@@ -131,6 +159,8 @@
|
||||
{
|
||||
entityplayermp.field_71135_a.func_147359_a(spacketchunkdata);
|
||||
this.field_187282_b.func_72688_a().func_73039_n().func_85172_a(entityplayermp, this.field_187286_f);
|
||||
+ // chunk watch event - delayed to here as the chunk wasn't ready in addPlayer
|
||||
+ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.world.ChunkWatchEvent.Watch(this.field_187284_d, entityplayermp));
|
||||
}
|
||||
|
||||
return true;
|
||||
@@ -167,7 +197,7 @@
|
||||
|
||||
this.field_187288_h |= 1 << (p_187265_2_ >> 4);
|
||||
|
||||
|
@ -70,7 +88,7 @@
|
|||
{
|
||||
short short1 = (short)(p_187265_1_ << 12 | p_187265_3_ << 8 | p_187265_2_);
|
||||
|
||||
@@ -178,7 +204,8 @@
|
||||
@@ -178,7 +208,8 @@
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
@ -80,7 +98,7 @@
|
|||
this.field_187285_e[this.field_187287_g++] = short1;
|
||||
}
|
||||
}
|
||||
@@ -195,6 +222,7 @@
|
||||
@@ -195,6 +226,7 @@
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -88,7 +106,7 @@
|
|||
public void func_187280_d()
|
||||
{
|
||||
if (this.field_187290_j && this.field_187286_f != null)
|
||||
@@ -208,28 +236,32 @@
|
||||
@@ -208,28 +240,32 @@
|
||||
int k = (this.field_187285_e[0] >> 8 & 15) + this.field_187284_d.field_77275_b * 16;
|
||||
BlockPos blockpos = new BlockPos(i, j, k);
|
||||
this.func_187267_a(new SPacketBlockChange(this.field_187282_b.func_72688_a(), blockpos));
|
||||
|
|
|
@ -41,7 +41,7 @@ public class ChunkWatchEvent extends Event
|
|||
/**
|
||||
* ChunkWatchEvent.Watch is fired when an EntityPlayer begins watching a chunk.<br>
|
||||
* This event is fired when a chunk is added to the watched chunks of an EntityPlayer in
|
||||
* {@link EntityPlayerMP#onUpdate()}. <br>
|
||||
* {@link PlayerChunkMapEntry#addPlayer(EntityPlayerMP)} and {@link PlayerChunkMapEntry#sentToPlayers()}. <br>
|
||||
* <br>
|
||||
* This event is not {@link Cancelable}.<br>
|
||||
* <br>
|
||||
|
|
Loading…
Reference in New Issue