Properly propagate the DimensionType information from server to client

at client connection time. This means the client now knows about the
dimensiontype properly and can access the ModDimension information on
the client.

Signed-off-by: cpw <cpw+github@weeksfamily.ca>
This commit is contained in:
cpw 2019-10-02 21:54:02 -04:00
parent c985225d0c
commit 48735c3946
No known key found for this signature in database
GPG key ID: 8EB3DF749553B1B7
16 changed files with 220 additions and 409 deletions

View file

@ -102,7 +102,7 @@
GlStateManager.enableBlend(); GlStateManager.enableBlend();
GlStateManager.blendFuncSeparate(GlStateManager.SourceFactor.SRC_ALPHA, GlStateManager.DestFactor.ONE_MINUS_SRC_ALPHA, GlStateManager.SourceFactor.ONE, GlStateManager.DestFactor.ZERO); GlStateManager.blendFuncSeparate(GlStateManager.SourceFactor.SRC_ALPHA, GlStateManager.DestFactor.ONE_MINUS_SRC_ALPHA, GlStateManager.SourceFactor.ONE, GlStateManager.DestFactor.ZERO);
GlStateManager.lineWidth(Math.max(2.5F, (float)this.field_72777_q.field_195558_d.func_198109_k() / 1920.0F * 2.5F)); GlStateManager.lineWidth(Math.max(2.5F, (float)this.field_72777_q.field_195558_d.func_198109_k() / 1920.0F * 2.5F));
@@ -1994,7 +2008,7 @@ @@ -1994,8 +2008,8 @@
break; break;
case 2001: case 2001:
BlockState blockstate = Block.func_196257_b(p_180439_4_); BlockState blockstate = Block.func_196257_b(p_180439_4_);
@ -112,6 +112,7 @@
+ SoundType soundtype = blockstate.getSoundType(field_72769_h, p_180439_3_, null); + SoundType soundtype = blockstate.getSoundType(field_72769_h, p_180439_3_, null);
this.field_72769_h.func_184156_a(p_180439_3_, soundtype.func_185845_c(), SoundCategory.BLOCKS, (soundtype.func_185843_a() + 1.0F) / 2.0F, soundtype.func_185847_b() * 0.8F, false); this.field_72769_h.func_184156_a(p_180439_3_, soundtype.func_185845_c(), SoundCategory.BLOCKS, (soundtype.func_185843_a() + 1.0F) / 2.0F, soundtype.func_185847_b() * 0.8F, false);
} }
@@ -2118,6 +2132,11 @@ @@ -2118,6 +2132,11 @@
} }
} }

View file

@ -28,7 +28,12 @@
this.field_184851_cj = true; this.field_184851_cj = true;
DimensionType dimensiontype = this.field_71093_bK; DimensionType dimensiontype = this.field_71093_bK;
if (dimensiontype == DimensionType.field_223229_c_ && p_212321_1_ == DimensionType.field_223227_a_) { if (dimensiontype == DimensionType.field_223229_c_ && p_212321_1_ == DimensionType.field_223227_a_) {
@@ -591,8 +594,8 @@ @@ -587,12 +590,13 @@
this.field_71093_bK = p_212321_1_;
ServerWorld serverworld1 = this.field_71133_b.func_71218_a(p_212321_1_);
WorldInfo worldinfo = this.field_70170_p.func_72912_H();
+ net.minecraftforge.fml.network.NetworkHooks.sendDimensionDataPacket(this.field_71135_a.field_147371_a, this);
this.field_71135_a.func_147359_a(new SRespawnPacket(p_212321_1_, worldinfo.func_76067_t(), this.field_71134_c.func_73081_b()));
this.field_71135_a.func_147359_a(new SServerDifficultyPacket(worldinfo.func_176130_y(), worldinfo.func_176123_z())); this.field_71135_a.func_147359_a(new SServerDifficultyPacket(worldinfo.func_176130_y(), worldinfo.func_176123_z()));
PlayerList playerlist = this.field_71133_b.func_184103_al(); PlayerList playerlist = this.field_71133_b.func_184103_al();
playerlist.func_187243_f(this); playerlist.func_187243_f(this);
@ -39,7 +44,7 @@
double d0 = this.field_70165_t; double d0 = this.field_70165_t;
double d1 = this.field_70163_u; double d1 = this.field_70163_u;
double d2 = this.field_70161_v; double d2 = this.field_70161_v;
@@ -601,13 +604,11 @@ @@ -601,13 +605,11 @@
double d3 = 8.0D; double d3 = 8.0D;
float f2 = f1; float f2 = f1;
serverworld.func_217381_Z().func_76320_a("moving"); serverworld.func_217381_Z().func_76320_a("moving");
@ -56,7 +61,7 @@
} else if (dimensiontype == DimensionType.field_223227_a_ && p_212321_1_ == DimensionType.field_223229_c_) { } else if (dimensiontype == DimensionType.field_223227_a_ && p_212321_1_ == DimensionType.field_223229_c_) {
BlockPos blockpos = serverworld1.func_180504_m(); BlockPos blockpos = serverworld1.func_180504_m();
d0 = (double)blockpos.func_177958_n(); d0 = (double)blockpos.func_177958_n();
@@ -671,6 +672,7 @@ @@ -671,6 +673,7 @@
this.field_71144_ck = -1; this.field_71144_ck = -1;
this.field_71149_ch = -1.0F; this.field_71149_ch = -1.0F;
this.field_71146_ci = -1; this.field_71146_ci = -1;
@ -64,7 +69,7 @@
return this; return this;
} }
} }
@@ -776,11 +778,11 @@ @@ -776,11 +779,11 @@
BlockPos blockpos = new BlockPos(i, j, k); BlockPos blockpos = new BlockPos(i, j, k);
if (this.field_70170_p.func_175667_e(blockpos)) { if (this.field_70170_p.func_175667_e(blockpos)) {
BlockState blockstate = this.field_70170_p.func_180495_p(blockpos); BlockState blockstate = this.field_70170_p.func_180495_p(blockpos);
@ -78,7 +83,7 @@
blockpos = blockpos1; blockpos = blockpos1;
blockstate = blockstate1; blockstate = blockstate1;
} }
@@ -819,6 +821,7 @@ @@ -819,6 +822,7 @@
this.field_71135_a.func_147359_a(new SOpenWindowPacket(container.field_75152_c, container.func_216957_a(), p_213829_1_.func_145748_c_())); this.field_71135_a.func_147359_a(new SOpenWindowPacket(container.field_75152_c, container.func_216957_a(), p_213829_1_.func_145748_c_()));
container.func_75132_a(this); container.func_75132_a(this);
this.field_71070_bA = container; this.field_71070_bA = container;
@ -86,7 +91,7 @@
return OptionalInt.of(this.field_71139_cq); return OptionalInt.of(this.field_71139_cq);
} }
} }
@@ -837,6 +840,7 @@ @@ -837,6 +841,7 @@
this.field_71135_a.func_147359_a(new SOpenHorseWindowPacket(this.field_71139_cq, p_184826_2_.func_70302_i_(), p_184826_1_.func_145782_y())); this.field_71135_a.func_147359_a(new SOpenHorseWindowPacket(this.field_71139_cq, p_184826_2_.func_70302_i_(), p_184826_1_.func_145782_y()));
this.field_71070_bA = new HorseInventoryContainer(this.field_71139_cq, this.field_71071_by, p_184826_2_, p_184826_1_); this.field_71070_bA = new HorseInventoryContainer(this.field_71139_cq, this.field_71071_by, p_184826_2_, p_184826_1_);
this.field_71070_bA.func_75132_a(this); this.field_71070_bA.func_75132_a(this);
@ -94,7 +99,7 @@
} }
public void func_184814_a(ItemStack p_184814_1_, Hand p_184814_2_) { public void func_184814_a(ItemStack p_184814_1_, Hand p_184814_2_) {
@@ -894,6 +898,7 @@ @@ -894,6 +899,7 @@
public void func_71128_l() { public void func_71128_l() {
this.field_71070_bA.func_75134_a(this); this.field_71070_bA.func_75134_a(this);
@ -102,7 +107,7 @@
this.field_71070_bA = this.field_71069_bz; this.field_71070_bA = this.field_71069_bz;
} }
@@ -1020,6 +1025,20 @@ @@ -1020,6 +1026,20 @@
this.field_193110_cw = p_193104_1_.field_193110_cw; this.field_193110_cw = p_193104_1_.field_193110_cw;
this.func_192029_h(p_193104_1_.func_192023_dk()); this.func_192029_h(p_193104_1_.func_192023_dk());
this.func_192031_i(p_193104_1_.func_192025_dl()); this.func_192031_i(p_193104_1_.func_192025_dl());
@ -123,7 +128,7 @@
} }
protected void func_70670_a(EffectInstance p_70670_1_) { protected void func_70670_a(EffectInstance p_70670_1_) {
@@ -1242,15 +1261,15 @@ @@ -1242,15 +1262,16 @@
this.func_184210_p(); this.func_184210_p();
if (p_200619_1_ == this.field_70170_p) { if (p_200619_1_ == this.field_70170_p) {
this.field_71135_a.func_147364_a(p_200619_2_, p_200619_4_, p_200619_6_, p_200619_8_, p_200619_9_); this.field_71135_a.func_147364_a(p_200619_2_, p_200619_4_, p_200619_6_, p_200619_8_, p_200619_9_);
@ -132,6 +137,7 @@
ServerWorld serverworld = this.func_71121_q(); ServerWorld serverworld = this.func_71121_q();
this.field_71093_bK = p_200619_1_.field_73011_w.func_186058_p(); this.field_71093_bK = p_200619_1_.field_73011_w.func_186058_p();
WorldInfo worldinfo = p_200619_1_.func_72912_H(); WorldInfo worldinfo = p_200619_1_.func_72912_H();
+ net.minecraftforge.fml.network.NetworkHooks.sendDimensionDataPacket(this.field_71135_a.field_147371_a, this);
this.field_71135_a.func_147359_a(new SRespawnPacket(this.field_71093_bK, worldinfo.func_76067_t(), this.field_71134_c.func_73081_b())); this.field_71135_a.func_147359_a(new SRespawnPacket(this.field_71093_bK, worldinfo.func_76067_t(), this.field_71134_c.func_73081_b()));
this.field_71135_a.func_147359_a(new SServerDifficultyPacket(worldinfo.func_176130_y(), worldinfo.func_176123_z())); this.field_71135_a.func_147359_a(new SServerDifficultyPacket(worldinfo.func_176130_y(), worldinfo.func_176123_z()));
this.field_71133_b.func_184103_al().func_187243_f(this); this.field_71133_b.func_184103_al().func_187243_f(this);
@ -142,7 +148,7 @@
this.func_70012_b(p_200619_2_, p_200619_4_, p_200619_6_, p_200619_8_, p_200619_9_); this.func_70012_b(p_200619_2_, p_200619_4_, p_200619_6_, p_200619_8_, p_200619_9_);
this.func_70029_a(p_200619_1_); this.func_70029_a(p_200619_1_);
p_200619_1_.func_217446_a(this); p_200619_1_.func_217446_a(this);
@@ -1259,6 +1278,7 @@ @@ -1259,6 +1280,7 @@
this.field_71134_c.func_73080_a(p_200619_1_); this.field_71134_c.func_73080_a(p_200619_1_);
this.field_71133_b.func_184103_al().func_72354_b(this, p_200619_1_); this.field_71133_b.func_184103_al().func_72354_b(this, p_200619_1_);
this.field_71133_b.func_184103_al().func_72385_f(this); this.field_71133_b.func_184103_al().func_72385_f(this);
@ -150,7 +156,7 @@
} }
} }
@@ -1293,6 +1313,8 @@ @@ -1293,6 +1315,8 @@
if (itementity == null) { if (itementity == null) {
return null; return null;
} else { } else {

View file

@ -0,0 +1,28 @@
--- a/net/minecraft/network/play/server/SJoinGamePacket.java
+++ b/net/minecraft/network/play/server/SJoinGamePacket.java
@@ -19,6 +19,7 @@
private WorldType field_149201_g;
private int field_218729_g;
private boolean field_179745_h;
+ private int dimensionInt;
public SJoinGamePacket() {
}
@@ -40,7 +41,7 @@
this.field_149204_b = (i & 8) == 8;
i = i & -9;
this.field_149205_c = GameType.func_77146_a(i);
- this.field_149202_d = DimensionType.func_186069_a(p_148837_1_.readInt());
+ this.dimensionInt = p_148837_1_.readInt();
this.field_149200_f = p_148837_1_.readUnsignedByte();
this.field_149201_g = WorldType.func_77130_a(p_148837_1_.func_150789_c(16));
if (this.field_149201_g == null) {
@@ -87,7 +88,7 @@
@OnlyIn(Dist.CLIENT)
public DimensionType func_212642_e() {
- return this.field_149202_d;
+ return this.field_149202_d == null ? this.field_149202_d = net.minecraftforge.fml.network.NetworkHooks.getDummyDimType(this.dimensionInt) : this.field_149202_d;
}
@OnlyIn(Dist.CLIENT)

View file

@ -0,0 +1,28 @@
--- a/net/minecraft/network/play/server/SRespawnPacket.java
+++ b/net/minecraft/network/play/server/SRespawnPacket.java
@@ -14,6 +14,7 @@
private DimensionType field_149088_a;
private GameType field_149087_c;
private WorldType field_149085_d;
+ private int dimensionInt;
public SRespawnPacket() {
}
@@ -29,7 +30,7 @@
}
public void func_148837_a(PacketBuffer p_148837_1_) throws IOException {
- this.field_149088_a = DimensionType.func_186069_a(p_148837_1_.readInt());
+ this.dimensionInt = p_148837_1_.readInt();
this.field_149087_c = GameType.func_77146_a(p_148837_1_.readUnsignedByte());
this.field_149085_d = WorldType.func_77130_a(p_148837_1_.func_150789_c(16));
if (this.field_149085_d == null) {
@@ -46,7 +47,7 @@
@OnlyIn(Dist.CLIENT)
public DimensionType func_212643_b() {
- return this.field_149088_a;
+ return this.field_149088_a == null ? this.field_149088_a = net.minecraftforge.fml.network.NetworkHooks.getDummyDimType(this.dimensionInt) : this.field_149088_a;
}
@OnlyIn(Dist.CLIENT)

View file

@ -23,15 +23,16 @@
p_72355_2_.func_70029_a(serverworld); p_72355_2_.func_70029_a(serverworld);
p_72355_2_.field_71134_c.func_73080_a((ServerWorld)p_72355_2_.field_70170_p); p_72355_2_.field_71134_c.func_73080_a((ServerWorld)p_72355_2_.field_70170_p);
String s1 = "local"; String s1 = "local";
@@ -121,6 +130,7 @@ @@ -121,6 +130,8 @@
WorldInfo worldinfo = serverworld.func_72912_H(); WorldInfo worldinfo = serverworld.func_72912_H();
this.func_72381_a(p_72355_2_, (ServerPlayerEntity)null, serverworld); this.func_72381_a(p_72355_2_, (ServerPlayerEntity)null, serverworld);
ServerPlayNetHandler serverplaynethandler = new ServerPlayNetHandler(this.field_72400_f, p_72355_1_, p_72355_2_); ServerPlayNetHandler serverplaynethandler = new ServerPlayNetHandler(this.field_72400_f, p_72355_1_, p_72355_2_);
+ net.minecraftforge.fml.network.NetworkHooks.sendMCRegistryPackets(p_72355_1_, "PLAY_TO_CLIENT"); + net.minecraftforge.fml.network.NetworkHooks.sendMCRegistryPackets(p_72355_1_, "PLAY_TO_CLIENT");
+ net.minecraftforge.fml.network.NetworkHooks.sendDimensionDataPacket(p_72355_1_, p_72355_2_);
serverplaynethandler.func_147359_a(new SJoinGamePacket(p_72355_2_.func_145782_y(), p_72355_2_.field_71134_c.func_73081_b(), worldinfo.func_76093_s(), serverworld.field_73011_w.func_186058_p(), this.func_72352_l(), worldinfo.func_76067_t(), this.field_72402_d, serverworld.func_82736_K().func_223586_b(GameRules.field_223612_o))); serverplaynethandler.func_147359_a(new SJoinGamePacket(p_72355_2_.func_145782_y(), p_72355_2_.field_71134_c.func_73081_b(), worldinfo.func_76093_s(), serverworld.field_73011_w.func_186058_p(), this.func_72352_l(), worldinfo.func_76067_t(), this.field_72402_d, serverworld.func_82736_K().func_223586_b(GameRules.field_223612_o)));
serverplaynethandler.func_147359_a(new SCustomPayloadPlayPacket(SCustomPayloadPlayPacket.field_209911_b, (new PacketBuffer(Unpooled.buffer())).func_180714_a(this.func_72365_p().getServerModName()))); serverplaynethandler.func_147359_a(new SCustomPayloadPlayPacket(SCustomPayloadPlayPacket.field_209911_b, (new PacketBuffer(Unpooled.buffer())).func_180714_a(this.func_72365_p().getServerModName())));
serverplaynethandler.func_147359_a(new SServerDifficultyPacket(worldinfo.func_176130_y(), worldinfo.func_176123_z())); serverplaynethandler.func_147359_a(new SServerDifficultyPacket(worldinfo.func_176130_y(), worldinfo.func_176123_z()));
@@ -142,7 +152,7 @@ @@ -142,7 +153,7 @@
this.func_148539_a(itextcomponent.func_211708_a(TextFormatting.YELLOW)); this.func_148539_a(itextcomponent.func_211708_a(TextFormatting.YELLOW));
serverplaynethandler.func_147364_a(p_72355_2_.field_70165_t, p_72355_2_.field_70163_u, p_72355_2_.field_70161_v, p_72355_2_.field_70177_z, p_72355_2_.field_70125_A); serverplaynethandler.func_147364_a(p_72355_2_.field_70165_t, p_72355_2_.field_70163_u, p_72355_2_.field_70161_v, p_72355_2_.field_70177_z, p_72355_2_.field_70125_A);
@ -40,7 +41,7 @@
this.field_177454_f.put(p_72355_2_.func_110124_au(), p_72355_2_); this.field_177454_f.put(p_72355_2_.func_110124_au(), p_72355_2_);
this.func_148540_a(new SPlayerListItemPacket(SPlayerListItemPacket.Action.ADD_PLAYER, p_72355_2_)); this.func_148540_a(new SPlayerListItemPacket(SPlayerListItemPacket.Action.ADD_PLAYER, p_72355_2_));
@@ -163,8 +173,9 @@ @@ -163,8 +174,9 @@
if (compoundnbt != null && compoundnbt.func_150297_b("RootVehicle", 10)) { if (compoundnbt != null && compoundnbt.func_150297_b("RootVehicle", 10)) {
CompoundNBT compoundnbt1 = compoundnbt.func_74775_l("RootVehicle"); CompoundNBT compoundnbt1 = compoundnbt.func_74775_l("RootVehicle");
@ -51,7 +52,7 @@
}); });
if (entity1 != null) { if (entity1 != null) {
UUID uuid = compoundnbt1.func_186857_a("Attach"); UUID uuid = compoundnbt1.func_186857_a("Attach");
@@ -191,6 +202,7 @@ @@ -191,6 +203,7 @@
} }
p_72355_2_.func_71116_b(); p_72355_2_.func_71116_b();
@ -59,7 +60,7 @@
} }
protected void func_96456_a(ServerScoreboard p_96456_1_, ServerPlayerEntity p_96456_2_) { protected void func_96456_a(ServerScoreboard p_96456_1_, ServerPlayerEntity p_96456_2_) {
@@ -252,6 +264,7 @@ @@ -252,6 +265,7 @@
compoundnbt1 = compoundnbt; compoundnbt1 = compoundnbt;
p_72380_1_.func_70020_e(compoundnbt); p_72380_1_.func_70020_e(compoundnbt);
field_148546_d.debug("loading single player"); field_148546_d.debug("loading single player");
@ -67,7 +68,7 @@
} else { } else {
compoundnbt1 = this.field_72412_k.func_75752_b(p_72380_1_); compoundnbt1 = this.field_72412_k.func_75752_b(p_72380_1_);
} }
@@ -260,6 +273,7 @@ @@ -260,6 +274,7 @@
} }
protected void func_72391_b(ServerPlayerEntity p_72391_1_) { protected void func_72391_b(ServerPlayerEntity p_72391_1_) {
@ -75,7 +76,7 @@
this.field_72412_k.func_75753_a(p_72391_1_); this.field_72412_k.func_75753_a(p_72391_1_);
ServerStatisticsManager serverstatisticsmanager = this.field_148547_k.get(p_72391_1_.func_110124_au()); ServerStatisticsManager serverstatisticsmanager = this.field_148547_k.get(p_72391_1_.func_110124_au());
if (serverstatisticsmanager != null) { if (serverstatisticsmanager != null) {
@@ -274,6 +288,7 @@ @@ -274,6 +289,7 @@
} }
public void func_72367_e(ServerPlayerEntity p_72367_1_) { public void func_72367_e(ServerPlayerEntity p_72367_1_) {
@ -83,7 +84,7 @@
ServerWorld serverworld = p_72367_1_.func_71121_q(); ServerWorld serverworld = p_72367_1_.func_71121_q();
p_72367_1_.func_195066_a(Stats.field_75947_j); p_72367_1_.func_195066_a(Stats.field_75947_j);
this.func_72391_b(p_72367_1_); this.func_72391_b(p_72367_1_);
@@ -295,7 +310,7 @@ @@ -295,7 +311,7 @@
p_72367_1_.func_213319_R(); p_72367_1_.func_213319_R();
serverworld.func_217434_e(p_72367_1_); serverworld.func_217434_e(p_72367_1_);
p_72367_1_.func_192039_O().func_192745_a(); p_72367_1_.func_192039_O().func_192745_a();
@ -92,7 +93,7 @@
this.field_72400_f.func_201300_aS().func_201382_b(p_72367_1_); this.field_72400_f.func_201300_aS().func_201382_b(p_72367_1_);
UUID uuid = p_72367_1_.func_110124_au(); UUID uuid = p_72367_1_.func_110124_au();
ServerPlayerEntity serverplayerentity = this.field_177454_f.get(uuid); ServerPlayerEntity serverplayerentity = this.field_177454_f.get(uuid);
@@ -364,10 +379,18 @@ @@ -364,10 +380,18 @@
} }
public ServerPlayerEntity func_72368_a(ServerPlayerEntity p_72368_1_, DimensionType p_72368_2_, boolean p_72368_3_) { public ServerPlayerEntity func_72368_a(ServerPlayerEntity p_72368_1_, DimensionType p_72368_2_, boolean p_72368_3_) {
@ -115,7 +116,7 @@
p_72368_1_.field_71093_bK = p_72368_2_; p_72368_1_.field_71093_bK = p_72368_2_;
PlayerInteractionManager playerinteractionmanager; PlayerInteractionManager playerinteractionmanager;
if (this.field_72400_f.func_71242_L()) { if (this.field_72400_f.func_71242_L()) {
@@ -379,6 +402,8 @@ @@ -379,6 +403,8 @@
ServerPlayerEntity serverplayerentity = new ServerPlayerEntity(this.field_72400_f, this.field_72400_f.func_71218_a(p_72368_1_.field_71093_bK), p_72368_1_.func_146103_bH(), playerinteractionmanager); ServerPlayerEntity serverplayerentity = new ServerPlayerEntity(this.field_72400_f, this.field_72400_f.func_71218_a(p_72368_1_.field_71093_bK), p_72368_1_.func_146103_bH(), playerinteractionmanager);
serverplayerentity.field_71135_a = p_72368_1_.field_71135_a; serverplayerentity.field_71135_a = p_72368_1_.field_71135_a;
serverplayerentity.func_193104_a(p_72368_1_, p_72368_3_); serverplayerentity.func_193104_a(p_72368_1_, p_72368_3_);
@ -124,7 +125,7 @@
serverplayerentity.func_145769_d(p_72368_1_.func_145782_y()); serverplayerentity.func_145769_d(p_72368_1_.func_145782_y());
serverplayerentity.func_184819_a(p_72368_1_.func_184591_cq()); serverplayerentity.func_184819_a(p_72368_1_.func_184591_cq());
@@ -393,7 +418,7 @@ @@ -393,7 +419,7 @@
if (optional.isPresent()) { if (optional.isPresent()) {
Vec3d vec3d = optional.get(); Vec3d vec3d = optional.get();
serverplayerentity.func_70012_b(vec3d.field_72450_a, vec3d.field_72448_b, vec3d.field_72449_c, 0.0F, 0.0F); serverplayerentity.func_70012_b(vec3d.field_72450_a, vec3d.field_72448_b, vec3d.field_72449_c, 0.0F, 0.0F);
@ -133,7 +134,15 @@
} else { } else {
serverplayerentity.field_71135_a.func_147359_a(new SChangeGameStatePacket(0, 0.0F)); serverplayerentity.field_71135_a.func_147359_a(new SChangeGameStatePacket(0, 0.0F));
} }
@@ -413,10 +438,11 @@ @@ -404,6 +430,7 @@
}
WorldInfo worldinfo = serverplayerentity.field_70170_p.func_72912_H();
+ net.minecraftforge.fml.network.NetworkHooks.sendDimensionDataPacket(serverplayerentity.field_71135_a.field_147371_a, serverplayerentity);
serverplayerentity.field_71135_a.func_147359_a(new SRespawnPacket(serverplayerentity.field_71093_bK, worldinfo.func_76067_t(), serverplayerentity.field_71134_c.func_73081_b()));
BlockPos blockpos1 = serverworld.func_175694_M();
serverplayerentity.field_71135_a.func_147364_a(serverplayerentity.field_70165_t, serverplayerentity.field_70163_u, serverplayerentity.field_70161_v, serverplayerentity.field_70177_z, serverplayerentity.field_70125_A);
@@ -413,10 +440,11 @@
this.func_72354_b(serverplayerentity, serverworld); this.func_72354_b(serverplayerentity, serverworld);
this.func_187243_f(serverplayerentity); this.func_187243_f(serverplayerentity);
serverworld.func_217433_d(serverplayerentity); serverworld.func_217433_d(serverplayerentity);
@ -146,7 +155,7 @@
return serverplayerentity; return serverplayerentity;
} }
@@ -736,7 +762,7 @@ @@ -736,7 +764,7 @@
} }
public List<ServerPlayerEntity> func_181057_v() { public List<ServerPlayerEntity> func_181057_v() {
@ -155,7 +164,7 @@
} }
@Nullable @Nullable
@@ -766,4 +792,12 @@ @@ -766,4 +794,12 @@
public boolean func_206257_x() { public boolean func_206257_x() {
return this.field_72407_n; return this.field_72407_n;
} }

View file

@ -86,6 +86,21 @@ public class DimensionManager
private static final Map<ResourceLocation, SavedEntry> savedEntries = new HashMap<>(); private static final Map<ResourceLocation, SavedEntry> savedEntries = new HashMap<>();
private static volatile Set<World> playerWorlds = new HashSet<>(); private static volatile Set<World> playerWorlds = new HashSet<>();
/**
* Register or get the existing dimension type for the given dimtype name.
*
* Dimensions already known to the save are loaded into the DimensionType map before the {@link RegisterDimensionsEvent} is fired.
* You can use this helper to get your existing dimension, or create it if it is not found.
*
* @param name Registry name
* @param type ModDimension type data
* @param data Extra data for the ModDimension
* @param hasSkyLight does this dimension have a skylight?
* @return the DimensionType for the dimension.
*/
public static DimensionType registerOrGetDimension(ResourceLocation name, ModDimension type, PacketBuffer data, boolean hasSkyLight) {
return REGISTRY.getValue(name).orElseGet(()->registerDimension(name, type, data, hasSkyLight));
}
/** /**
* Registers a real unique dimension, Should be called on server init, or when the dimension is created. * Registers a real unique dimension, Should be called on server init, or when the dimension is created.
* On the client, the list will be reset/reloaded every time a InternalServer is refreshed. * On the client, the list will be reset/reloaded every time a InternalServer is refreshed.
@ -95,6 +110,8 @@ public class DimensionManager
* @param name Registry name for this new dimension. * @param name Registry name for this new dimension.
* @param type Dimension Type. * @param type Dimension Type.
* @param data Configuration data for this dimension, passed into * @param data Configuration data for this dimension, passed into
* @param hasSkyLight skylight for this dimension
* @return the DimensionType for the dimension.
*/ */
public static DimensionType registerDimension(ResourceLocation name, ModDimension type, PacketBuffer data, boolean hasSkyLight) public static DimensionType registerDimension(ResourceLocation name, ModDimension type, PacketBuffer data, boolean hasSkyLight)
{ {

View file

@ -54,4 +54,20 @@ public abstract class ModDimension extends ForgeRegistryEntry<ModDimension>
* @param network true when sent over the network, so you can only data needed by the client. * @param network true when sent over the network, so you can only data needed by the client.
*/ */
public void read(PacketBuffer buffer, boolean network){} public void read(PacketBuffer buffer, boolean network){}
/**
* Convenience method for generating a ModDimension with a specific factory but no extra
* data handling behaviour. Extend ModDimension to override other methods.
*
* @param factory Factory for creating {@link Dimension} instances from DimType and World.
* @return A custom ModDimension with that factory.
*/
public static ModDimension withFactory(BiFunction<World, DimensionType, ? extends Dimension> factory) {
return new ModDimension() {
@Override
public BiFunction<World, DimensionType, ? extends Dimension> getFactory() {
return factory;
}
};
}
} }

View file

@ -1,49 +0,0 @@
/*
* Minecraft Forge
* Copyright (c) 2016-2019.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation version 2.1
* of the License.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
package net.minecraftforge.common.network;
import io.netty.channel.ChannelHandlerContext;
import io.netty.channel.SimpleChannelInboundHandler;
import net.minecraftforge.common.DimensionManager;
import net.minecraftforge.common.network.ForgeMessage.DimensionRegisterMessage;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
public class DimensionMessageHandler extends SimpleChannelInboundHandler<ForgeMessage.DimensionRegisterMessage>{
private static final Logger LOGGER = LogManager.getLogger();
@Override
protected void channelRead0(ChannelHandlerContext ctx, DimensionRegisterMessage msg) throws Exception
{
if (DimensionManager.getRegistry().getByValue(msg.id) == null)
{
DimensionManager.registerDimensionInternal(msg.id + 1, msg.name, msg.dim, msg.data, msg.skyLight);
}
}
@Override
public void exceptionCaught(ChannelHandlerContext ctx, Throwable cause) throws Exception
{
LOGGER.error("DimensionMessageHandler exception", cause);
super.exceptionCaught(ctx, cause);
}
}

View file

@ -1,45 +0,0 @@
/*
* Minecraft Forge
* Copyright (c) 2016-2019.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation version 2.1
* of the License.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
package net.minecraftforge.common.network;
import org.apache.logging.log4j.Level;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import io.netty.channel.ChannelHandlerContext;
import io.netty.channel.SimpleChannelInboundHandler;
/* TODO fluids
public class FluidIdRegistryMessageHandler extends SimpleChannelInboundHandler<ForgeMessage.FluidIdMapMessage> {
private static final Logger LOGGER = LogManager.getLogger();
@Override
protected void channelRead0(ChannelHandlerContext ctx, ForgeMessage.FluidIdMapMessage msg) throws Exception
{
FluidRegistry.initFluidIDs(msg.fluidIds, msg.defaultFluids);
}
@Override
public void exceptionCaught(ChannelHandlerContext ctx, Throwable cause) throws Exception
{
LOGGER.error("FluidIdRegistryMessageHandler exception", cause);
super.exceptionCaught(ctx, cause);
}
}
*/

View file

@ -1,144 +0,0 @@
/*
* Minecraft Forge
* Copyright (c) 2016-2019.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation version 2.1
* of the License.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
package net.minecraftforge.common.network;
import java.nio.charset.StandardCharsets;
import javax.annotation.Nullable;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import net.minecraft.network.PacketBuffer;
import net.minecraft.util.ResourceLocation;
import net.minecraftforge.common.ModDimension;
import net.minecraftforge.registries.ForgeRegistries;
import io.netty.buffer.ByteBuf;
import io.netty.buffer.Unpooled;
public abstract class ForgeMessage {
private static final Logger LOGGER = LogManager.getLogger();
public static class DimensionRegisterMessage extends ForgeMessage {
int id;
ResourceLocation name;
ModDimension dim;
boolean skyLight;
@Nullable
PacketBuffer data;
public DimensionRegisterMessage(){}
public DimensionRegisterMessage(int id, ResourceLocation name, ModDimension dim, boolean skyLight, @Nullable PacketBuffer data)
{
this.id = id;
this.dim = dim;
this.data = data;
this.skyLight = skyLight;
}
@Override
void toBytes(ByteBuf buff)
{
PacketBuffer output = new PacketBuffer(buff);
output.writeInt(id);
output.writeResourceLocation(name);
output.writeResourceLocation(dim.getRegistryName());
output.writeBoolean(skyLight);
if (data == null)
{
output.writeShort(0);
}
else
{
ByteBuf dup = data.duplicate();
output.writeShort(dup.readableBytes());
output.writeBytes(dup);
}
}
@Override
void fromBytes(ByteBuf buff)
{
PacketBuffer input = new PacketBuffer(buff);
id = input.readInt();
name = input.readResourceLocation();
dim = ForgeRegistries.MOD_DIMENSIONS.getValue(input.readResourceLocation());
skyLight = input.readBoolean();
int len = input.readShort();
if (len != 0)
{
data = new PacketBuffer(Unpooled.buffer());
input.readBytes(data, len);
}
}
}
/* TODO fluids
public static class FluidIdMapMessage extends ForgeMessage {
BiMap<Fluid, Integer> fluidIds = HashBiMap.create();
Set<String> defaultFluids = Sets.newHashSet();
@SuppressWarnings("deprecation")
@Override
void toBytes(ByteBuf bytes)
{
Map<Fluid, Integer> ids = FluidRegistry.getRegisteredFluidIDs();
bytes.writeInt(ids.size());
for (Map.Entry<Fluid, Integer> entry : ids.entrySet())
{
ByteBufUtils.writeUTF8String(bytes,entry.getKey().getName());
bytes.writeInt(entry.getValue());
}
for (Map.Entry<Fluid, Integer> entry : ids.entrySet())
{
String defaultName = FluidRegistry.getDefaultFluidName(entry.getKey());
ByteBufUtils.writeUTF8String(bytes, defaultName);
}
}
@Override
void fromBytes(ByteBuf bytes)
{
int listSize = bytes.readInt();
for (int i = 0; i < listSize; i++) {
String fluidName = ByteBufUtils.readUTF8String(bytes);
int fluidId = bytes.readInt();
fluidIds.put(FluidRegistry.getFluid(fluidName), fluidId);
}
// do we have a defaults list?
if (bytes.isReadable())
{
for (int i = 0; i < listSize; i++)
{
defaultFluids.add(ByteBufUtils.readUTF8String(bytes));
}
}
else
{
LOGGER.info("Legacy server message contains no default fluid list - there may be problems with fluids");
defaultFluids.clear();
}
}
}
*/
abstract void toBytes(ByteBuf bytes);
abstract void fromBytes(ByteBuf bytes);
}

View file

@ -1,59 +0,0 @@
/*
* Minecraft Forge
* Copyright (c) 2016-2019.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation version 2.1
* of the License.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
package net.minecraftforge.common.network;
/* TODO handshake
import java.util.EnumMap;
import net.minecraftforge.api.distmarker.OnlyIn;
import net.minecraftforge.common.ForgeMod;
import net.minecraftforge.fml.common.network.FMLEmbeddedChannel;
import net.minecraftforge.fml.common.network.FMLOutboundHandler;
import net.minecraftforge.fml.common.network.FMLOutboundHandler.OutboundTarget;
import net.minecraftforge.fml.common.network.NetworkRegistry;
import net.minecraftforge.api.distmarker.Dist;
public class ForgeNetworkHandler
{
private static EnumMap<Side, FMLEmbeddedChannel> channelPair;
public static void registerChannel(ForgeMod forgeMod, Side side)
{
channelPair = NetworkRegistry.INSTANCE.newChannel(forgeMod, "FORGE", new ForgeRuntimeCodec());
if (side == Side.CLIENT)
{
addClientHandlers();
}
FMLEmbeddedChannel serverChannel = channelPair.get(Side.SERVER);
serverChannel.attr(FMLOutboundHandler.FML_MESSAGETARGET).set(OutboundTarget.NOWHERE);
String handlerName = serverChannel.findChannelHandlerNameForType(ForgeRuntimeCodec.class);
serverChannel.pipeline().addAfter(handlerName, "ServerToClientConnection", new ServerToClientConnectionEstablishedHandler());
}
@OnlyIn(Dist.CLIENT)
private static void addClientHandlers()
{
FMLEmbeddedChannel clientChannel = channelPair.get(Side.CLIENT);
String handlerName = clientChannel.findChannelHandlerNameForType(ForgeRuntimeCodec.class);
clientChannel.pipeline().addAfter(handlerName, "DimensionHandler", new DimensionMessageHandler());
clientChannel.pipeline().addAfter(handlerName, "FluidIdRegistryHandler", new FluidIdRegistryMessageHandler());
}
}
*/

View file

@ -1,44 +0,0 @@
/*
* Minecraft Forge
* Copyright (c) 2016-2019.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation version 2.1
* of the License.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
package net.minecraftforge.common.network;
/* TODO handshake
import io.netty.buffer.ByteBuf;
import io.netty.channel.ChannelHandlerContext;
import net.minecraftforge.fml.common.network.FMLIndexedMessageToMessageCodec;
public class ForgeRuntimeCodec extends FMLIndexedMessageToMessageCodec<ForgeMessage> {
public ForgeRuntimeCodec()
{
addDiscriminator(1, ForgeMessage.DimensionRegisterMessage.class);
addDiscriminator(2, ForgeMessage.FluidIdMapMessage.class);
}
@Override
public void encodeInto(ChannelHandlerContext ctx, ForgeMessage msg, ByteBuf target) throws Exception
{
msg.toBytes(target);
}
@Override
public void decodeInto(ChannelHandlerContext ctx, ByteBuf source, ForgeMessage msg)
{
msg.fromBytes(source);
}
}
*/

View file

@ -1,39 +0,0 @@
/*
* Minecraft Forge
* Copyright (c) 2016-2019.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation version 2.1
* of the License.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
package net.minecraftforge.common.network;
/* TODO handshake
import net.minecraftforge.fml.common.network.NetworkHandshakeEstablished;
import io.netty.channel.ChannelHandlerContext;
import io.netty.channel.ChannelInboundHandlerAdapter;
public class ServerToClientConnectionEstablishedHandler extends ChannelInboundHandlerAdapter {
@Override
public void userEventTriggered(ChannelHandlerContext ctx, Object evt) throws Exception
{
if (evt instanceof NetworkHandshakeEstablished)
{
ctx.writeAndFlush(new ForgeMessage.FluidIdMapMessage());
return;
}
// pass it forward
ctx.fireUserEventTriggered(evt);
}
}
*/

View file

@ -34,12 +34,13 @@ import net.minecraft.util.ResourceLocation;
import net.minecraft.util.math.MathHelper; import net.minecraft.util.math.MathHelper;
import net.minecraft.util.math.Vec3d; import net.minecraft.util.math.Vec3d;
import net.minecraft.world.World; import net.minecraft.world.World;
import net.minecraftforge.fml.ExtensionPoint; import net.minecraft.world.dimension.DimensionType;
import net.minecraftforge.common.ModDimension;
import net.minecraftforge.fml.LogicalSidedProvider; import net.minecraftforge.fml.LogicalSidedProvider;
import net.minecraftforge.fml.ModList;
import net.minecraft.util.registry.Registry; import net.minecraft.util.registry.Registry;
import net.minecraft.util.text.ITextComponent; import net.minecraft.util.text.ITextComponent;
import net.minecraftforge.fml.common.registry.IEntityAdditionalSpawnData; import net.minecraftforge.fml.common.registry.IEntityAdditionalSpawnData;
import net.minecraftforge.registries.ForgeRegistries;
import java.util.Optional; import java.util.Optional;
import java.util.UUID; import java.util.UUID;
@ -256,7 +257,7 @@ public class FMLPlayMessages
this(Registry.MENU.getId(id), windowId, name, additionalData); this(Registry.MENU.getId(id), windowId, name, additionalData);
} }
private OpenContainer(int id, int windowId, ITextComponent name, PacketBuffer additionalData) private OpenContainer(int id, int windowId, ITextComponent name, PacketBuffer additionalData)
{ {
this.id = id; this.id = id;
this.windowId = windowId; this.windowId = windowId;
@ -308,4 +309,60 @@ public class FMLPlayMessages
return additionalData; return additionalData;
} }
} }
public static class DimensionInfoMessage
{
private ResourceLocation dimName;
private boolean skylight;
private int id;
private ResourceLocation modDimensionName;
private PacketBuffer extraData;
DimensionInfoMessage(DimensionType type) {
id = type.getId() + 1;
dimName = type.getRegistryName();
modDimensionName = type.getModType().getRegistryName();
skylight = type.func_218272_d();
extraData = new PacketBuffer(Unpooled.buffer());
type.getModType().write(extraData, true);
}
DimensionInfoMessage(final int dimId, final ResourceLocation dimname, final ResourceLocation modDimensionName, final boolean skylight, final PacketBuffer extraData) {
id = dimId;
this.dimName = dimname;
this.modDimensionName = modDimensionName;
this.skylight = skylight;
this.extraData = extraData;
}
public static DimensionInfoMessage decode(PacketBuffer buffer) {
int dimId = buffer.readInt();
ResourceLocation dimname = buffer.readResourceLocation();
ResourceLocation moddimname = buffer.readResourceLocation();
boolean skylight = buffer.readBoolean();
PacketBuffer pb = new PacketBuffer(Unpooled.wrappedBuffer(buffer.readByteArray()));
return new DimensionInfoMessage(dimId, dimname, moddimname, skylight, pb);
}
public static void encode(DimensionInfoMessage message, PacketBuffer buffer) {
buffer.writeInt(message.id);
buffer.writeResourceLocation(message.dimName);
buffer.writeResourceLocation(message.modDimensionName);
buffer.writeBoolean(message.skylight);
buffer.writeByteArray(message.extraData.array());
}
private DimensionType makeDummyDimensionType() {
final ModDimension modDim = ForgeRegistries.MOD_DIMENSIONS.getValue(modDimensionName);
// default to overworld if no moddim found
if (modDim == null) return DimensionType.OVERWORLD;
modDim.read(extraData, true);
return new DimensionType(id, "dummy", "dummy", modDim.getFactory(), skylight, modDim, extraData);
}
public static boolean handle(final DimensionInfoMessage message, final Supplier<NetworkEvent.Context> contextSupplier) {
contextSupplier.get().enqueueWork(()-> NetworkHooks.addCachedDimensionType(message.makeDummyDimensionType(), message.dimName));
return true;
}
}
} }

View file

@ -25,6 +25,11 @@ import java.util.function.Consumer;
import java.util.function.Supplier; import java.util.function.Supplier;
import java.util.stream.Collectors; import java.util.stream.Collectors;
import it.unimi.dsi.fastutil.ints.Int2ObjectMap;
import it.unimi.dsi.fastutil.ints.Int2ObjectOpenHashMap;
import net.minecraft.util.registry.Registry;
import net.minecraft.world.dimension.DimensionType;
import net.minecraftforge.registries.ClearableRegistry;
import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger; import org.apache.logging.log4j.Logger;
@ -89,6 +94,12 @@ public class NetworkHooks
FMLMCRegisterPacketHandler.INSTANCE.sendRegistry(manager, NetworkDirection.valueOf(direction)); FMLMCRegisterPacketHandler.INSTANCE.sendRegistry(manager, NetworkDirection.valueOf(direction));
} }
public synchronized static void sendDimensionDataPacket(NetworkManager manager, ServerPlayerEntity player) {
// don't send vanilla dims
if (player.dimension.isVanilla()) return;
FMLNetworkConstants.playChannel.sendTo(new FMLPlayMessages.DimensionInfoMessage(player.dimension), manager, NetworkDirection.PLAY_TO_CLIENT);
}
public static void handleClientLoginSuccess(NetworkManager manager) { public static void handleClientLoginSuccess(NetworkManager manager) {
if (manager == null || manager.channel() == null) throw new NullPointerException("ARGH! Network Manager is null (" + manager != null ? "CHANNEL" : "MANAGER"+")" ); if (manager == null || manager.channel() == null) throw new NullPointerException("ARGH! Network Manager is null (" + manager != null ? "CHANNEL" : "MANAGER"+")" );
if (getConnectionType(()->manager) == ConnectionType.VANILLA) { if (getConnectionType(()->manager) == ConnectionType.VANILLA) {
@ -181,4 +192,16 @@ public class NetworkHooks
player.openContainer.addListener(player); player.openContainer.addListener(player);
MinecraftForge.EVENT_BUS.post(new PlayerContainerEvent.Open(player, c)); MinecraftForge.EVENT_BUS.post(new PlayerContainerEvent.Open(player, c));
} }
// internal tracking map for custom dimensions received from servers for use on client.
private static Int2ObjectMap<DimensionType> trackingMap = new Int2ObjectOpenHashMap<>();
public static DimensionType getDummyDimType(final int dimension) {
return trackingMap.getOrDefault(dimension, DimensionType.OVERWORLD);
}
static void addCachedDimensionType(final DimensionType dimensionType, final ResourceLocation dimName) {
trackingMap.put(dimensionType.getId(), dimensionType);
final ClearableRegistry<DimensionType> dimtypereg = (ClearableRegistry<DimensionType>) Registry.DIMENSION_TYPE;
dimtypereg.register(dimensionType.getId(), dimName, dimensionType);
}
} }

View file

@ -98,6 +98,12 @@ class NetworkInitialization {
consumer(FMLPlayMessages.OpenContainer::handle). consumer(FMLPlayMessages.OpenContainer::handle).
add(); add();
playChannel.messageBuilder(FMLPlayMessages.DimensionInfoMessage.class, 2)
.decoder(FMLPlayMessages.DimensionInfoMessage::decode)
.encoder(FMLPlayMessages.DimensionInfoMessage::encode)
.consumer(FMLPlayMessages.DimensionInfoMessage::handle)
.add();
return playChannel; return playChannel;
} }