This commit is contained in:
parent
6d51dee9c7
commit
5a2b7c0d33
@ -79,18 +79,9 @@ public abstract class StructurePart<T> {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
protected abstract int getHeight();
|
|
||||||
protected abstract int getWidth();
|
|
||||||
protected abstract int getDepth();
|
|
||||||
|
|
||||||
protected abstract void build(StructureContext context);
|
protected abstract void build(StructureContext context);
|
||||||
|
|
||||||
private Vec3d getOffset() {
|
|
||||||
return new Vec3d(getWidth() / 2f, getHeight() / 2f, getDepth() / 2f);
|
|
||||||
}
|
|
||||||
|
|
||||||
private Vec3d transform(Vec3d pos) {
|
private Vec3d transform(Vec3d pos) {
|
||||||
pos = pos.subtract(getOffset());
|
|
||||||
for (Transformation transformation : transformations) {
|
for (Transformation transformation : transformations) {
|
||||||
pos = transformation.transform(pos);
|
pos = transformation.transform(pos);
|
||||||
}
|
}
|
||||||
@ -132,12 +123,10 @@ public abstract class StructurePart<T> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void place(World world, BlockPos pos) {
|
public void place(World world, BlockPos pos) {
|
||||||
Vec3d offset = getOffset();
|
|
||||||
BlockPos offsetPos = new BlockPos(offset.getX(), offset.getY(), offset.getZ());
|
|
||||||
for (Map.Entry<Long, BlockState> entry : blocks.entrySet()) {
|
for (Map.Entry<Long, BlockState> entry : blocks.entrySet()) {
|
||||||
BlockState state = entry.getValue();
|
BlockState state = entry.getValue();
|
||||||
if (state.getBlock() != Blocks.VOID_AIR) {
|
if (state.getBlock() != Blocks.VOID_AIR) {
|
||||||
BlockPos newPos = pos.add(BlockPos.fromLong(entry.getKey()).add(offsetPos));
|
BlockPos newPos = pos.add(BlockPos.fromLong(entry.getKey()));
|
||||||
world.removeBlockEntity(newPos);
|
world.removeBlockEntity(newPos);
|
||||||
world.setBlockState(newPos, state);
|
world.setBlockState(newPos, state);
|
||||||
handleBlockPlace(world, newPos, state);
|
handleBlockPlace(world, newPos, state);
|
||||||
|
@ -11,18 +11,11 @@ public class ResearchComplexHallwayPart extends BaseResearchComplexPart {
|
|||||||
super(state, list);
|
super(state, list);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
private int getHeight() {
|
||||||
protected int getWidth() {
|
|
||||||
return 7;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected int getHeight() {
|
|
||||||
return 6;
|
return 6;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
private int getDepth() {
|
||||||
protected int getDepth() {
|
|
||||||
return 3;
|
return 3;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -38,8 +38,8 @@ public class ResearchComplexStartPart extends BaseResearchComplexPart {
|
|||||||
|
|
||||||
BlockState state = yOffset == 0 || yOffset == 5 ? bricks : air;
|
BlockState state = yOffset == 0 || yOffset == 5 ? bricks : air;
|
||||||
|
|
||||||
rect(4, yOffset, 0, 3, 1, getDepth(), state);
|
rect(0, yOffset, 0, 2, 1, 6, state);
|
||||||
rect(0, yOffset, 4, getWidth(), 1, 3, state);
|
rect(0, yOffset, 0, 6, 1, 2, state);
|
||||||
|
|
||||||
set(2, yOffset, 3, state);
|
set(2, yOffset, 3, state);
|
||||||
set(3, yOffset, 2, state);
|
set(3, yOffset, 2, state);
|
||||||
@ -79,14 +79,14 @@ public class ResearchComplexStartPart extends BaseResearchComplexPart {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void buildReactor() {
|
private void buildReactor() {
|
||||||
set(5, 1, 5, EnergonRelics.THERMAL_CASING_BLOCK.getDefaultState());
|
set(0, 1, 0, EnergonRelics.THERMAL_CASING_BLOCK.getDefaultState());
|
||||||
set(6, 2, 5, EnergonRelics.THERMAL_CASING_BLOCK.getDefaultState());
|
set(1, 2, 0, EnergonRelics.THERMAL_CASING_BLOCK.getDefaultState());
|
||||||
set(5, 2, 5, EnergonRelics.REACTOR_CORE_BLOCK.getDefaultState());
|
set(0, 2, 0, EnergonRelics.REACTOR_CORE_BLOCK.getDefaultState());
|
||||||
set(4, 2, 5, EnergonRelics.THERMAL_CASING_BLOCK.getDefaultState());
|
set(-1, 2, 0, EnergonRelics.THERMAL_CASING_BLOCK.getDefaultState());
|
||||||
set(5, 3, 5, EnergonRelics.REACTOR_INPUT_BLOCK.getDefaultState());
|
set(0, 3, 0, EnergonRelics.REACTOR_INPUT_BLOCK.getDefaultState());
|
||||||
set(5, 2, 4, EnergonRelics.REACTOR_CONTROLLER_BLOCK.getDefaultState());
|
set(0, 2, 1, EnergonRelics.REACTOR_CONTROLLER_BLOCK.getDefaultState());
|
||||||
set(5, 1, 4, Blocks.LEVER.getDefaultState().with(LeverBlock.FACE, WallMountLocation.FLOOR));
|
set(0, 1, 1, Blocks.LEVER.getDefaultState().with(LeverBlock.FACE, WallMountLocation.FLOOR));
|
||||||
set(5, 2, 6, EnergonRelics.THERMAL_GLASS_BLOCK.getDefaultState());
|
set(0, 2, -1, EnergonRelics.THERMAL_GLASS_BLOCK.getDefaultState());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -96,27 +96,12 @@ public class ResearchComplexStartPart extends BaseResearchComplexPart {
|
|||||||
for (int i = 0; i < 6; i++) {
|
for (int i = 0; i < 6; i++) {
|
||||||
buildBase(i);
|
buildBase(i);
|
||||||
}
|
}
|
||||||
part(context, 1, 0, getDepth(), new ResearchComplexHallwayPart(getState(), getTransformations()));
|
//part(context, 1, 0, getWidth() / 2, new ResearchComplexHallwayPart(getState(), getTransformations()));
|
||||||
});
|
});
|
||||||
buildReactor();
|
buildReactor();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
protected int getWidth() {
|
|
||||||
return 10;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected int getHeight() {
|
|
||||||
return 6;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected int getDepth() {
|
|
||||||
return 10;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void handleBlockPlace(World world, BlockPos pos, BlockState state) {
|
protected void handleBlockPlace(World world, BlockPos pos, BlockState state) {
|
||||||
super.handleBlockPlace(world, pos, state);
|
super.handleBlockPlace(world, pos, state);
|
||||||
|
Reference in New Issue
Block a user