5555import com .viaversion .viaversion .rewriter .RegistryDataRewriter ;
5656import com .viaversion .viaversion .rewriter .StatisticsRewriter ;
5757import com .viaversion .viaversion .rewriter .TagRewriter ;
58+ import com .viaversion .viaversion .util .Key ;
5859import com .viaversion .viaversion .util .TagUtil ;
5960import java .util .function .Function ;
6061import org .checkerframework .checker .nullness .qual .Nullable ;
6566public final class Protocol1_21_11To1_21_9 extends BackwardsProtocol <ClientboundPacket1_21_11 , ClientboundPacket1_21_9 , ServerboundPacket1_21_9 , ServerboundPacket1_21_9 > {
6667
6768 public static final BackwardsMappingData MAPPINGS = new BackwardsMappingData ("1.21.11" , "1.21.9" , Protocol1_21_9To1_21_11 .class );
69+ private static final int END_FOG_COLOR = 10518688 ;
70+ private static final int OVERWORLD_FOG_COLOR = 126384063 ;
6871 private final EntityPacketRewriter1_21_11 entityRewriter = new EntityPacketRewriter1_21_11 (this );
6972 private final BlockItemPacketRewriter1_21_11 itemRewriter = new BlockItemPacketRewriter1_21_11 (this );
7073 private final ParticleRewriter <ClientboundPacket1_21_11 > particleRewriter = new ParticleRewriter <>(this );
@@ -95,7 +98,16 @@ protected void registerPackets() {
9598
9699 // Add back mandatory fields from attributes, though most don't have any use in the client
97100 registryDataRewriter .addHandler ("dimension_type" , (key , tag ) -> {
98- tag .putBoolean ("natural" , true );
101+ if (Key .equals (key , "the_nether" )) {
102+ tag .putString ("effects" , "minecraft:the_nether" );
103+ tag .putBoolean ("natural" , false );
104+ } else if (Key .equals (key , "the_end" )) {
105+ tag .putString ("effects" , "minecraft:the_end" );
106+ tag .putBoolean ("natural" , false );
107+ } else {
108+ tag .putString ("effects" , "minecraft:overworld" );
109+ tag .putBoolean ("natural" , true );
110+ }
99111
100112 final ByteTag trueTag = new ByteTag ((byte ) 1 );
101113 final CompoundTag attributes = tag .getCompoundTag ("attributes" );
@@ -113,10 +125,11 @@ protected void registerPackets() {
113125 });
114126 registryDataRewriter .addHandler ("worldgen/biome" , (key , tag ) -> {
115127 final CompoundTag effects = tag .getCompoundTag ("effects" );
128+
116129 final CompoundTag attributes = tag .removeUnchecked ("attributes" );
117130 moveAttribute (effects , attributes , "visual/sky_color" , "sky_color" , this ::mapColor , new IntTag (0 ));
118131 moveAttribute (effects , attributes , "visual/water_fog_color" , "water_fog_color" , this ::mapColor , new IntTag (-16448205 ));
119- moveAttribute (effects , attributes , "visual/fog_color" , "fog_color" , this ::mapColor , new IntTag (0 ));
132+ moveAttribute (effects , attributes , "visual/fog_color" , "fog_color" , this ::mapColor , new IntTag (Key . equals ( key , "the_end" ) ? END_FOG_COLOR : OVERWORLD_FOG_COLOR )); // overworld fog color as default
120133
121134 moveAttribute (effects , effects , "water_color" , "water_color" , this ::mapColor , new IntTag (4159204 ));
122135 moveAttribute (effects , effects , "foliage_color" , "foliage_color" , this ::mapColor , null );
0 commit comments