use of com.eriksonn.createaeronautics.blocks.airship_assembler.AirshipAssemblerTileEntity in project Create_Aeronautics by Eriksonnaren.
the class AirshipContraptionEntity method tickContraption.
@Override
public void tickContraption() {
AirshipAssemblerTileEntity controller = getController();
airshipContraption = (AirshipContraption) contraption;
if (controller != null)
controller.attach(this);
simulatedRigidbody.tick();
if (!airshipInitialized) {
initFakeClientWorld();
}
if (level.isClientSide) {
profiler.startTick();
fakeClientWorld.tick(() -> true);
fakeClientWorld.tickEntities();
for (ControlledContraptionEntity contraptionEntity : subContraptions.values()) {
contraptionEntity.tick();
}
profiler.endTick();
if (invalid) {
ContraptionRenderDispatcher.invalidate(airshipContraption);
invalid = false;
}
}
if (!airshipInitialized) {
airshipInitialized = true;
syncNextTick = true;
}
if (syncNextTick) {
syncPacket();
syncPacket();
syncNextTick = false;
}
contraption.getContraptionWorld().tickBlockEntities();
if (!level.isClientSide) {
serverUpdate();
}
if (level.isClientSide && false) {
CompoundNBT tag = this.entityData.get(physicsDataAccessor);
if (tag.contains("velocity")) {
simulatedRigidbody.globalVelocity = simulatedRigidbody.arrayToVec(readDoubleArray(tag, "velocity"));
// simulatedRigidbody.angularVelocity = simulatedRigidbody.arrayToVec(readDoubleArray(tag, "angularVelocity"));
simulatedRigidbody.angularMomentum = simulatedRigidbody.arrayToVec(readDoubleArray(tag, "angularMomentum"));
// simulatedRigidbody.momentum = simulatedRigidbody.arrayToVec(readDoubleArray(tag, "momentum"));
simulatedRigidbody.orientation = simulatedRigidbody.arrayToQuat(readDoubleArray(tag, "orientation"));
}
}
// if(level.isClientSide)
// Vector3d particlePos = toGlobalVector(new Vector3d(0,0,0),0);
// level.addParticle(new RedstoneParticleData(1,1,1,1),particlePos.x,particlePos.y,particlePos.z,0,0,0);
// this.getContraption().getContraptionWorld().tickBlockEntities();
}
use of com.eriksonn.createaeronautics.blocks.airship_assembler.AirshipAssemblerTileEntity in project Create_Aeronautics by Eriksonnaren.
the class AirshipContraptionEntity method getController.
public AirshipAssemblerTileEntity getController() {
BlockPos controllerPos = getPlotPos();
World w = AirshipDimensionManager.INSTANCE.getWorld();
if (!w.isLoaded(controllerPos))
return null;
TileEntity te = w.getBlockEntity(controllerPos);
if (!(te instanceof AirshipAssemblerTileEntity))
return null;
return (AirshipAssemblerTileEntity) te;
}
Aggregations