Skip to content

Commit

Permalink
movement speeds are now saved.
Browse files Browse the repository at this point in the history
it's done kinda weird, but it's to be sure it doesn't conflict with the other movement stuff saved in the optional entity data that needs to be dealt with in 4.5.

this is good enough for now.
  • Loading branch information
EternalBlueFlame committed Dec 30, 2023
1 parent d05a5d8 commit 9e673b7
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/main/java/train/common/api/AbstractTrains.java
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
import net.minecraft.entity.player.EntityPlayerMP;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.nbt.NBTTagList;
import net.minecraft.util.AxisAlignedBB;
import net.minecraft.util.ChatComponentText;
import net.minecraft.util.DamageSource;
Expand Down Expand Up @@ -371,6 +372,7 @@ protected void writeEntityToNBT(NBTTagCompound nbttagcompound) {
nbttagcompound.setBoolean("linked", this.linked);
//nbttagcompound.setDouble("motionX", motionX);
//nbttagcompound.setDouble("motionZ", motionZ);
nbttagcompound.setTag("Motion", this.newDoubleNBTList(this.motionX, this.motionY, this.motionZ));
nbttagcompound.setDouble("Link1", Link1);
nbttagcompound.setDouble("Link2", Link2);

Expand Down Expand Up @@ -409,6 +411,9 @@ protected void readEntityFromNBT(NBTTagCompound nbttagcompound) {
linked = nbttagcompound.getBoolean("linked");
//motionX = nbttagcompound.getDouble("motionX");
//motionZ = nbttagcompound.getDouble("motionZ");
NBTTagList nbttaglist1 = nbttagcompound.getTagList("Motion", 6); this.motionX = nbttaglist1.func_150309_d(0);
this.motionX = nbttaglist1.func_150309_d(0);
this.motionZ = nbttaglist1.func_150309_d(2);
Link1 = nbttagcompound.getDouble("Link1");
Link2 = nbttagcompound.getDouble("Link2");
if(nbttagcompound.hasKey("Dim")){
Expand Down

0 comments on commit 9e673b7

Please sign in to comment.