This commit is contained in:
parent
e5135deef1
commit
643e287e23
@ -1,5 +1,8 @@
|
|||||||
# Changelog
|
# Changelog
|
||||||
|
|
||||||
|
**1.0.2**
|
||||||
|
* Attempt To Fix Structure Generation Crash
|
||||||
|
|
||||||
**1.0.1**
|
**1.0.1**
|
||||||
* Add Advancements
|
* Add Advancements
|
||||||
* Industrial Laser Can Smelt Nether Gold Ore
|
* Industrial Laser Can Smelt Nether Gold Ore
|
||||||
|
@ -10,7 +10,7 @@ org.gradle.jvmargs = -Xmx1G
|
|||||||
fabric_loader_version = 0.9.2+build.206
|
fabric_loader_version = 0.9.2+build.206
|
||||||
|
|
||||||
# Mod Properties
|
# Mod Properties
|
||||||
mod_version = 1.0.1
|
mod_version = 1.0.2
|
||||||
maven_group = com.thebrokenrail
|
maven_group = com.thebrokenrail
|
||||||
|
|
||||||
# Dependencies
|
# Dependencies
|
||||||
|
@ -19,17 +19,23 @@ class StructureGeneratorPiece extends StructurePiece {
|
|||||||
private final StructureGeneratorBlock block;
|
private final StructureGeneratorBlock block;
|
||||||
private final BlockRotation rotation;
|
private final BlockRotation rotation;
|
||||||
private final BlockPos pos;
|
private final BlockPos pos;
|
||||||
|
private boolean placed;
|
||||||
|
|
||||||
StructureGeneratorPiece(StructureGeneratorBlock block, BlockRotation rotation, BlockPos pos) {
|
private StructureGeneratorPiece(StructureGeneratorBlock block, BlockRotation rotation, BlockPos pos, boolean placed) {
|
||||||
super(block.piece, 0);
|
super(block.piece, 0);
|
||||||
this.block = block;
|
this.block = block;
|
||||||
this.rotation = rotation;
|
this.rotation = rotation;
|
||||||
this.pos = pos;
|
this.pos = pos;
|
||||||
|
this.placed = placed;
|
||||||
boundingBox = BlockBox.create(pos.getX(), pos.getY(), pos.getZ(), pos.getX() + 1, pos.getY() + 1, pos.getZ() + 1);
|
boundingBox = BlockBox.create(pos.getX(), pos.getY(), pos.getZ(), pos.getX() + 1, pos.getY() + 1, pos.getZ() + 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
StructureGeneratorPiece(StructureGeneratorBlock block, BlockRotation rotation, BlockPos pos) {
|
||||||
|
this(block, rotation, pos, false);
|
||||||
|
}
|
||||||
|
|
||||||
StructureGeneratorPiece(StructureGeneratorBlock block, CompoundTag tag) {
|
StructureGeneratorPiece(StructureGeneratorBlock block, CompoundTag tag) {
|
||||||
this(block, BlockRotation.valueOf(tag.getString("Rot")), new BlockPos(tag.getInt("X"), tag.getInt("Y"), tag.getInt("Z")));
|
this(block, BlockRotation.valueOf(tag.getString("Rot")), new BlockPos(tag.getInt("X"), tag.getInt("Y"), tag.getInt("Z")), tag.getBoolean("Placed"));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -38,19 +44,24 @@ class StructureGeneratorPiece extends StructurePiece {
|
|||||||
tag.putInt("X", pos.getX());
|
tag.putInt("X", pos.getX());
|
||||||
tag.putInt("Y", pos.getY());
|
tag.putInt("Y", pos.getY());
|
||||||
tag.putInt("Z", pos.getZ());
|
tag.putInt("Z", pos.getZ());
|
||||||
|
tag.putBoolean("Placed", placed);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean generate(StructureWorldAccess world, StructureAccessor structureAccessor, ChunkGenerator chunkGenerator, Random random, BlockBox boundingBox, ChunkPos chunkPos, BlockPos blockPos) {
|
public boolean generate(StructureWorldAccess world, StructureAccessor structureAccessor, ChunkGenerator chunkGenerator, Random random, BlockBox boundingBox, ChunkPos chunkPos, BlockPos blockPos) {
|
||||||
BlockState state = block.getDefaultState().rotate(rotation);
|
if (!placed) {
|
||||||
|
BlockState state = block.getDefaultState().rotate(rotation);
|
||||||
|
|
||||||
world.setBlockState(pos, state, 3);
|
world.setBlockState(pos, state, 3);
|
||||||
BlockEntity entity = world.getBlockEntity(pos);
|
BlockEntity entity = world.getBlockEntity(pos);
|
||||||
if (entity instanceof StructureGeneratorBlockEntity) {
|
if (entity instanceof StructureGeneratorBlockEntity) {
|
||||||
((StructureGeneratorBlockEntity) entity).setSeed(random.nextLong());
|
((StructureGeneratorBlockEntity) entity).setSeed(random.nextLong());
|
||||||
|
}
|
||||||
|
|
||||||
|
block.schedule(world, pos);
|
||||||
|
|
||||||
|
placed = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
block.schedule(world, pos);
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user