mirror of
https://github.com/PolyhedralDev/Terra.git
synced 2026-02-16 02:20:57 +00:00
fix: improve particle handling and block state retrieval
This commit is contained in:
@@ -13,6 +13,7 @@ import com.dfsek.terra.api.block.state.properties.Property;
|
||||
|
||||
public class MinestomBlockState implements BlockState {
|
||||
private final Block block;
|
||||
public static final MinestomBlockState AIR = new MinestomBlockState(Block.AIR);
|
||||
|
||||
public MinestomBlockState(Block block) {
|
||||
if(block == null) {
|
||||
|
||||
@@ -32,7 +32,9 @@ public class CachedChunk implements ProtoChunk {
|
||||
public void setBlock(int x, int y, int z, @NotNull BlockState blockState) {
|
||||
Block block = (Block) blockState.getHandle();
|
||||
if(block == null) return;
|
||||
blocks[getIndex(x, y, z)] = block;
|
||||
int index = getIndex(x, y, z);
|
||||
if (index > blocks.length || index < 0) return;
|
||||
blocks[index] = block;
|
||||
}
|
||||
|
||||
private int getIndex(int x, int y, int z) {
|
||||
@@ -42,7 +44,9 @@ public class CachedChunk implements ProtoChunk {
|
||||
|
||||
@Override
|
||||
public @NotNull BlockState getBlock(int x, int y, int z) {
|
||||
return new MinestomBlockState(blocks[getIndex(x, y, z)]);
|
||||
int index = getIndex(x, y, z);
|
||||
if (index > blocks.length || index < 0) return MinestomBlockState.AIR;
|
||||
return new MinestomBlockState(blocks[index]);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -35,7 +35,8 @@ public class BiomeParticleConfigTemplate implements ObjectTemplate<BiomeEffects.
|
||||
String[] parts = particle.split("\\{");
|
||||
Particle parsedParticle = Particle.fromKey(parts[0]);
|
||||
if (parts.length > 1) {
|
||||
LoggerFactory.getLogger(BiomeParticleConfigTemplate.class).warn("Particle {} has additional data, which will be ignored.", particle);
|
||||
LoggerFactory.getLogger(BiomeParticleConfigTemplate.class).warn("Particle {} has additional data, particle will be ignored.", particle);
|
||||
return null;
|
||||
}
|
||||
|
||||
return new BiomeEffects.Particle(
|
||||
|
||||
Reference in New Issue
Block a user