Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

copy over missing changes to cargo rocket #95

Merged
merged 2 commits into from
Dec 6, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -111,12 +111,16 @@ public void onUpdate() {
if (this.rumble < 0) {
this.rumble++;
}
final boolean isIgnited = this.launchPhase == EnumLaunchPhase.IGNITED.ordinal();
final boolean isLaunched = this.launchPhase == EnumLaunchPhase.LAUNCHED.ordinal();

if (this.launchPhase == EnumLaunchPhase.IGNITED.ordinal()
|| this.launchPhase == EnumLaunchPhase.LAUNCHED.ordinal()) {
if (isIgnited || isLaunched) {
this.performHurtAnimation();

this.rumble = (float) this.rand.nextInt(3) - 3;

if (this.destinationFrequency != -1 && !this.landing && isLaunched) {
this.onReachAtmosphere();
}
}

int i;
Expand Down Expand Up @@ -256,7 +260,7 @@ public void onReachAtmosphere() {
final WorldProvider targetDim = WorldUtil.getProviderForDimensionServer(this.targetDimension);
if (targetDim != null && targetDim.worldObj instanceof WorldServer) {
GCLog.debug("Loaded destination dimension " + this.targetDimension);
this.setPosition(this.targetVec.x + 0.5F, this.targetVec.y + 800, this.targetVec.z + 0.5F);
this.moveToDestination(800);
final Entity e = WorldUtil.transferEntityToDimension(
this,
this.targetDimension,
Expand All @@ -266,7 +270,7 @@ public void onReachAtmosphere() {

if (e instanceof EntityCargoRocket) {
GCLog.debug("Cargo rocket arrived at destination dimension, going into landing mode.");
e.setPosition(this.targetVec.x + 0.5F, this.targetVec.y + 800, this.targetVec.z + 0.5F);
this.moveToDestination(800);
((EntityCargoRocket) e).landing = true;
// No setDead() following successful transferEntityToDimension() - see javadoc
// on that
Expand All @@ -282,7 +286,7 @@ public void onReachAtmosphere() {
this.setDead();
} else {
GCLog.debug("Cargo rocket going into landing mode in same destination.");
this.setPosition(this.targetVec.x + 0.5F, this.targetVec.y + 800, this.targetVec.z + 0.5F);
this.moveToDestination(800);
this.landing = true;
}
return;
Expand Down Expand Up @@ -330,13 +334,20 @@ public int getSizeInventory() {
@Override
public void onWorldTransferred(World world) {
if (this.targetVec != null) {
this.setPosition(this.targetVec.x + 0.5F, this.targetVec.y + 2, this.targetVec.z + 0.5F);
moveToDestination(2);
this.landing = true;
} else {
this.setDead();
}
}

private void moveToDestination(int reentryHeight) {
if (this.destinationFrequency != 1) {
reentryHeight = 0;
}
this.setPosition(this.targetVec.x + 0.5F, this.targetVec.y + reentryHeight, this.targetVec.z + 0.5F);
}

@Override
public void onPadDestroyed() {
if (!this.isDead && this.launchPhase != EnumLaunchPhase.LAUNCHED.ordinal()) {
Expand Down
Loading