use of com.eriksonn.createaeronautics.contraptions.AirshipContraption in project Create_Aeronautics by Eriksonnaren.
the class AirshipAssemblerTileEntity method assemble.
public void assemble() {
if (this.level.getBlockState(this.worldPosition).getBlock() instanceof AirshipAssemblerBlock) {
AirshipContraption contraption = new AirshipContraption();
try {
if (!contraption.assemble(this.level, this.worldPosition)) {
return;
}
this.lastException = null;
} catch (AssemblyException var4) {
this.lastException = var4;
this.sendData();
return;
}
AirshipDimensionManager manager = AirshipDimensionManager.INSTANCE;
BlockPos targetSize = new BlockPos(contraption.bounds.maxX, contraption.bounds.maxY, contraption.bounds.maxZ);
// manager.getWorldData();
// AirshipDimensionPlot plot = manager.allocatePlot(targetSize);
ServerWorld airshipWorld = manager.getWorld();
contraption.removeBlocksFromWorld(this.level, BlockPos.ZERO);
this.movedContraption = AirshipContraptionEntity.create(this.level, contraption);
BlockPos anchor = this.worldPosition;
this.movedContraption.simulatedRigidbody.tryInit();
this.movedContraption.setPos((double) anchor.getX() + this.movedContraption.centerOfMassOffset.x, (double) anchor.getY() + this.movedContraption.centerOfMassOffset.y, (double) anchor.getZ() + this.movedContraption.centerOfMassOffset.z);
this.level.addFreshEntity(this.movedContraption);
AllSoundEvents.CONTRAPTION_ASSEMBLE.playOnServer(this.level, this.worldPosition);
this.running = true;
contraption.addBlocksToWorld(airshipWorld, new StructureTransform(this.movedContraption.getPlotPos(), 0.0F, 0, 0.0F));
this.sendData();
}
}
use of com.eriksonn.createaeronautics.contraptions.AirshipContraption in project Create_Aeronautics by Eriksonnaren.
the class ContraptionRenderMixin method renderTileEntities.
/**
* @author Eriksonn
*/
@Overwrite(remap = false)
public static void renderTileEntities(World world, PlacementSimulationWorld renderWorld, Contraption c, ContraptionMatrices matrices, IRenderTypeBuffer buffer) {
MatrixStack ms = matrices.getModelViewProjection();
if (c instanceof AirshipContraption) {
int plotId = ((AirshipContraptionEntity) c.entity).plotId;
BlockPos anchorPos = AirshipManager.getPlotPosFromId(plotId);
ms.translate(0, -anchorPos.getY(), 0);
}
// if(world.dimension() == AirshipDimensionManager.WORLD_ID)
// {
// int plotId = AirshipManager.getIdFromPlotPos(c.anchor);
// AirshipContraptionEntity entity = AirshipManager.INSTANCE.AllAirships.get(plotId);
// }
TileEntityRenderHelper.renderTileEntities(world, renderWorld, c.specialRenderedTileEntities, ms, matrices.getLight(), buffer);
}
Aggregations