remove remaining metadata from enums

This commit is contained in:
Sen 2025-07-07 16:11:16 +02:00
parent c376d92790
commit 454e38d1ab
Signed by: sen
GPG key ID: 3AC50A6F47D1B722
15 changed files with 87 additions and 259 deletions

View file

@ -1008,7 +1008,7 @@ public final class Server implements IThreadListener, Executor {
private void updateTimeAndWeatherForPlayer(Player conn, WorldServer world) {
conn.sendPacket(new SPacketTimeUpdate(world.getDayTime(), this.getInfo()));
conn.sendPacket(new SPacketChangeGameState(SPacketChangeGameState.Action.SET_WEATHER, world.getWeather().getID()));
conn.sendPacket(new SPacketChangeGameState(SPacketChangeGameState.Action.SET_WEATHER, world.getWeather().ordinal()));
conn.sendPacket(new SPacketChangeGameState(SPacketChangeGameState.Action.RAIN_STRENGTH, world.getRainStrength()));
conn.sendPacket(new SPacketChangeGameState(SPacketChangeGameState.Action.DARKNESS, world.getDarkness()));
conn.sendPacket(new SPacketChangeGameState(SPacketChangeGameState.Action.FOG_STRENGTH, world.getFogStrength()));

View file

@ -1184,7 +1184,7 @@ public final class WorldServer extends AWorldServer {
this.weather = weather;
// this.dataModified = true;
this.sendPacket(new SPacketChangeGameState(SPacketChangeGameState.Action.SET_WEATHER,
weather.getID()));
weather.ordinal()));
}
protected void updateWeather(boolean force) {

View file

@ -3,6 +3,7 @@ package server.worldgen.foliage;
import common.block.Block;
import common.block.Material;
import common.block.foliage.BlockHugeMushroom;
import common.block.foliage.BlockHugeMushroom.EnumType;
import common.init.Blocks;
import common.rng.Random;
import common.util.BlockPos;
@ -113,28 +114,26 @@ public class WorldGenBigMushroom extends FeatureGenerator
{
for (int i2 = j1; i2 <= k1; ++i2)
{
int j2 = 5;
EnumType dir = EnumType.CENTER;
if (l1 == k3)
{
--j2;
dir = EnumType.WEST;
}
else if (l1 == l3)
{
++j2;
dir = EnumType.EAST;
}
if (i2 == j1)
{
j2 -= 3;
dir = dir == EnumType.WEST ? EnumType.NORTH_WEST : (dir == EnumType.EAST ? EnumType.NORTH_EAST : EnumType.NORTH);
}
else if (i2 == k1)
{
j2 += 3;
dir = dir == EnumType.WEST ? EnumType.SOUTH_WEST : (dir == EnumType.EAST ? EnumType.SOUTH_EAST : EnumType.SOUTH);
}
BlockHugeMushroom.EnumType blockhugemushroom$enumtype = BlockHugeMushroom.EnumType.byMetadata(j2);
if (this.mushroomType == Blocks.brown_mushroom_block || l2 < position.getY() + i)
{
if ((l1 == k3 || l1 == l3) && (i2 == j1 || i2 == k1))
@ -144,57 +143,57 @@ public class WorldGenBigMushroom extends FeatureGenerator
if (l1 == position.getX() - (j3 - 1) && i2 == j1)
{
blockhugemushroom$enumtype = BlockHugeMushroom.EnumType.NORTH_WEST;
dir = BlockHugeMushroom.EnumType.NORTH_WEST;
}
if (l1 == k3 && i2 == position.getZ() - (j3 - 1))
{
blockhugemushroom$enumtype = BlockHugeMushroom.EnumType.NORTH_WEST;
dir = BlockHugeMushroom.EnumType.NORTH_WEST;
}
if (l1 == position.getX() + (j3 - 1) && i2 == j1)
{
blockhugemushroom$enumtype = BlockHugeMushroom.EnumType.NORTH_EAST;
dir = BlockHugeMushroom.EnumType.NORTH_EAST;
}
if (l1 == l3 && i2 == position.getZ() - (j3 - 1))
{
blockhugemushroom$enumtype = BlockHugeMushroom.EnumType.NORTH_EAST;
dir = BlockHugeMushroom.EnumType.NORTH_EAST;
}
if (l1 == position.getX() - (j3 - 1) && i2 == k1)
{
blockhugemushroom$enumtype = BlockHugeMushroom.EnumType.SOUTH_WEST;
dir = BlockHugeMushroom.EnumType.SOUTH_WEST;
}
if (l1 == k3 && i2 == position.getZ() + (j3 - 1))
{
blockhugemushroom$enumtype = BlockHugeMushroom.EnumType.SOUTH_WEST;
dir = BlockHugeMushroom.EnumType.SOUTH_WEST;
}
if (l1 == position.getX() + (j3 - 1) && i2 == k1)
{
blockhugemushroom$enumtype = BlockHugeMushroom.EnumType.SOUTH_EAST;
dir = BlockHugeMushroom.EnumType.SOUTH_EAST;
}
if (l1 == l3 && i2 == position.getZ() + (j3 - 1))
{
blockhugemushroom$enumtype = BlockHugeMushroom.EnumType.SOUTH_EAST;
dir = BlockHugeMushroom.EnumType.SOUTH_EAST;
}
}
if (blockhugemushroom$enumtype == BlockHugeMushroom.EnumType.CENTER && l2 < position.getY() + i)
if (dir == BlockHugeMushroom.EnumType.CENTER && l2 < position.getY() + i)
{
blockhugemushroom$enumtype = BlockHugeMushroom.EnumType.ALL_INSIDE;
dir = BlockHugeMushroom.EnumType.ALL_INSIDE;
}
if (position.getY() >= position.getY() + i - 1 || blockhugemushroom$enumtype != BlockHugeMushroom.EnumType.ALL_INSIDE)
if (position.getY() >= position.getY() + i - 1 || dir != BlockHugeMushroom.EnumType.ALL_INSIDE)
{
BlockPos blockpos = new BlockPos(l1, l2, i2);
if (!worldIn.getState(blockpos).getBlock().isFullBlock())
{
this.setBlockAndNotifyAdequately(worldIn, blockpos, this.mushroomType.getState().withProperty(BlockHugeMushroom.VARIANT, blockhugemushroom$enumtype));
this.setBlockAndNotifyAdequately(worldIn, blockpos, this.mushroomType.getState().withProperty(BlockHugeMushroom.VARIANT, dir));
}
}
}