Skip to content

Commit

Permalink
fix powered state
Browse files Browse the repository at this point in the history
  • Loading branch information
MBatt1 committed Nov 9, 2024
1 parent 1e501e5 commit 0585500
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,11 @@ protected void onEntityCollision(BlockState state, World world, BlockPos pos, En
List<AbstractMinecartEntity> list = this.getCarts(world, pos, AbstractMinecartEntity.class, e -> true);
for (AbstractMinecartEntity cart : list) {
var floatingComponent = ParadiseLostComponents.FLOATING_KEY.get(cart);
floatingComponent.startFloating();
if (state.get(POWERED)) {
floatingComponent.startFloating();
} else {
floatingComponent.stopFloating();
}
ParadiseLostComponents.FLOATING_KEY.sync(cart);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
import net.minecraft.client.particle.ParticleTextureSheet;
import net.minecraft.client.particle.SpriteBillboardParticle;
import net.minecraft.client.particle.SpriteProvider;
import net.minecraft.client.particle.SuspendParticle;
import net.minecraft.client.world.ClientWorld;
import net.minecraft.particle.SimpleParticleType;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,11 @@ public void startFloating() {
floatTime = 20 * FLOAT_SECONDS;
}

public void stopFloating() {
floating = false;
floatTime = 0;
}

public void tick() {
floatTime--;
if (floatTime == 0) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
import net.minecraft.entity.vehicle.AbstractMinecartEntity;
import net.minecraft.entity.vehicle.VehicleEntity;
import net.minecraft.particle.ParticleTypes;
import net.minecraft.sound.SoundEvents;
import net.minecraft.util.math.MathHelper;
import net.minecraft.util.math.Vec3d;
import net.minecraft.world.World;
Expand Down
Binary file not shown.

0 comments on commit 0585500

Please sign in to comment.