miscellanious fixes

This commit is contained in:
Sen 2025-05-19 22:15:06 +02:00
parent 7c80936c05
commit e145675525
7 changed files with 16 additions and 5 deletions

View file

@ -341,7 +341,7 @@ public class Client implements IThreadListener {
public EntityNPC player; public EntityNPC player;
public HitPosition pointed; public HitPosition pointed;
@Variable(name = "chunk_view_distance", category = CVarCategory.RENDER, min = 2, max = 16 /* 128 */, callback = DistanceFunction.class, display = "Sichtweite", unit = "Chunks") @Variable(name = "chunk_view_distance", category = CVarCategory.RENDER, min = 2, max = 16, callback = DistanceFunction.class, display = "Sichtweite", unit = "Chunks")
public int renderDistance = 8; public int renderDistance = 8;
@Variable(name = "chunk_build_time", category = CVarCategory.RENDER, min = 1, max = 100, display = "Max. Zeit für Chunk-Bau pro Frame", unit = "ms") @Variable(name = "chunk_build_time", category = CVarCategory.RENDER, min = 1, max = 100, display = "Max. Zeit für Chunk-Bau pro Frame", unit = "ms")
public int maxBuildTime = 8; public int maxBuildTime = 8;

View file

@ -28,7 +28,7 @@ public enum Biome {
ICEPLAINS(12, "icePlains", "Eisebene", 0xffffff, -20.0f), ICEPLAINS(12, "icePlains", "Eisebene", 0xffffff, -20.0f),
ICEMOUNTAINS(13, "iceMountains", "Vereistes Bergland", 0xa0a0a0, -20.0f), ICEMOUNTAINS(13, "iceMountains", "Vereistes Bergland", 0xa0a0a0, -20.0f),
MUSHROOMPLAINS(14, "mushroomPlains", "Pilzland", 0xff00ff, 16.0f, 100.0f), MUSHROOMPLAINS(14, "mushroomPlains", "Pilzland", 0xff00ff, 16.0f, 100.0f),
BLACKENED(15, "blackened", "Schwarz", 0x000000, 0.0f, 0.0f, 0x000000, 0x303030, 0x303030), BLACKENED(15, "blackened", "Schwarz", 0x000000, 0.0f, 0.0f, 0x000000, 0x303030, 0x303030, 0x000000, 0x000000, 0x000000),
BEACH(16, "beach", "Strand", 0xfade55, 12.0f, 40.0f), BEACH(16, "beach", "Strand", 0xfade55, 12.0f, 40.0f),
DESERTHILLS(17, "desertHills", "Wüsten-Bergland", 0xd25f12, 60.0f, 0.0f), DESERTHILLS(17, "desertHills", "Wüsten-Bergland", 0xd25f12, 60.0f, 0.0f),
FORESTHILLS(18, "forestHills", "Wald-Bergland", 0x22551c, 8.0f, 80.0f), FORESTHILLS(18, "forestHills", "Wald-Bergland", 0x22551c, 8.0f, 80.0f),

View file

@ -1,5 +1,6 @@
package common.block; package common.block;
import common.biome.Biome;
import common.init.Blocks; import common.init.Blocks;
import common.init.Config; import common.init.Config;
import common.item.CheatTab; import common.item.CheatTab;
@ -35,6 +36,7 @@ public class BlockBlackenedDirt extends Block
else if (iblockstate.getBlock() == Blocks.grass && worldIn.getLightFromNeighbors(blockpos.up()) >= 2 && block.getLightOpacity() <= 6) else if (iblockstate.getBlock() == Blocks.grass && worldIn.getLightFromNeighbors(blockpos.up()) >= 2 && block.getLightOpacity() <= 6)
{ {
worldIn.setState(blockpos, Blocks.blackened_soil.getState()); worldIn.setState(blockpos, Blocks.blackened_soil.getState());
worldIn.setBiome(blockpos, Biome.BLACKENED);
} }
else if (iblockstate.getBlock() == Blocks.stone && rand.chance(25)) else if (iblockstate.getBlock() == Blocks.stone && rand.chance(25))
{ {

View file

@ -1,5 +1,6 @@
package common.block; package common.block;
import common.biome.Biome;
import common.init.Blocks; import common.init.Blocks;
import common.init.Config; import common.init.Config;
import common.item.CheatTab; import common.item.CheatTab;
@ -39,6 +40,7 @@ public class BlockBlackenedSoil extends Block
if ((iblockstate.getBlock() == Blocks.dirt || iblockstate.getBlock() == Blocks.grass || iblockstate.getBlock() == Blocks.blackened_dirt) && worldIn.getLightFromNeighbors(blockpos.up()) >= 2 && block.getLightOpacity() <= 6) if ((iblockstate.getBlock() == Blocks.dirt || iblockstate.getBlock() == Blocks.grass || iblockstate.getBlock() == Blocks.blackened_dirt) && worldIn.getLightFromNeighbors(blockpos.up()) >= 2 && block.getLightOpacity() <= 6)
{ {
worldIn.setState(blockpos, Blocks.blackened_soil.getState()); worldIn.setState(blockpos, Blocks.blackened_soil.getState());
worldIn.setBiome(blockpos, Biome.BLACKENED);
} }
} }
} }

View file

@ -421,7 +421,7 @@ public abstract class Config {
public static int orbDamageOther = 0; public static int orbDamageOther = 0;
@Var(name = "weatherChance") @Var(name = "weatherChance")
public static int weatherChance = 48000; public static int weatherChance = 48000;
@Var(name = "viewDistance", min = 2, max = 128) @Var(name = "viewDistance", min = 2, max = 16)
public static int distance = 10; public static int distance = 10;
@Var(name = "healChance") @Var(name = "healChance")
public static int healChance = 5; public static int healChance = 5;

View file

@ -2,6 +2,7 @@ package common.world;
import java.util.List; import java.util.List;
import common.biome.Biome;
import common.block.Block; import common.block.Block;
import common.dimension.Dimension; import common.dimension.Dimension;
import common.entity.Entity; import common.entity.Entity;
@ -44,4 +45,5 @@ public abstract class AWorldServer extends World {
public abstract boolean isBlockinHighHumidity(BlockPos pos); public abstract boolean isBlockinHighHumidity(BlockPos pos);
public abstract <T extends Entity> T findNearestEntityWithinAABB(Class<? extends T> entityType, BoundingBox aabb, T closestTo); public abstract <T extends Entity> T findNearestEntityWithinAABB(Class<? extends T> entityType, BoundingBox aabb, T closestTo);
public abstract long getTime(); public abstract long getTime();
public abstract void setBiome(BlockPos pos, Biome biome);
} }

View file

@ -2245,7 +2245,7 @@ public final class WorldServer extends AWorldServer {
// return new LazyBlock(state, this, position); // return new LazyBlock(state, this, position);
// } // }
public final boolean setBiome(BlockPos position, Biome biome) { private final boolean setChunkBiome(BlockPos position, Biome biome) {
Chunk chunk = this.getChunk(position); Chunk chunk = this.getChunk(position);
if((chunk != null) && (chunk.isLoaded())) { if((chunk != null) && (chunk.isLoaded())) {
chunk.getBiomes()[((position.getZ() & 0xF) << 4 | position.getX() & 0xF)] = (byte)biome.id; chunk.getBiomes()[((position.getZ() & 0xF) << 4 | position.getX() & 0xF)] = (byte)biome.id;
@ -2258,7 +2258,7 @@ public final class WorldServer extends AWorldServer {
Set<ChunkPos> chunks = Sets.newHashSet(); Set<ChunkPos> chunks = Sets.newHashSet();
for(int x = start.getX(); x <= end.getX(); x++) { for(int x = start.getX(); x <= end.getX(); x++) {
for(int z = start.getZ(); z <= end.getZ(); z++) { for(int z = start.getZ(); z <= end.getZ(); z++) {
if(this.setBiome(new BlockPos(x, 0, z), biome)) if(this.setChunkBiome(new BlockPos(x, 0, z), biome))
chunks.add(new ChunkPos(x >> 4, z >> 4)); chunks.add(new ChunkPos(x >> 4, z >> 4));
} }
} }
@ -2267,6 +2267,11 @@ public final class WorldServer extends AWorldServer {
} }
chunks.clear(); chunks.clear();
} }
public final void setBiome(BlockPos pos, Biome biome) {
if(this.setChunkBiome(pos, biome))
this.updateBiomes(pos.getX() >> 4, pos.getZ() >> 4);
}
// public final List<? extends Entity> getEntities(EditRegion region) { // public final List<? extends Entity> getEntities(EditRegion region) {
// List<Entity> entities = Lists.newArrayList(); // List<Entity> entities = Lists.newArrayList();