Jump to content
View in the app

A better way to browse. Learn more.

Forge Forums

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Featured Replies

Posted

Hi,

I’m trying to make a custom minecart entity but it has some strange behavior: whenever I spawn one on rails, it stutters; it moves for a bit then jumps forward, then moves a bit again and so on. But if the class inherits MinecartEntity, it works as it should.

I don’t understand why.

Here’s how I declare my entity class:

public class TestMinecartEntity extends AbstractMinecartEntity {
  public TestMinecartEntity(EntityType<?> type, World world) {
    super(type, world);
  }

  public TestMinecartEntity(World world, double x, double y, double z) {
    super(ModEntities.TEST_MINECART.get(), world, x, y, z);
  }

  @Override
  public ActionResultType processInitialInteract(PlayerEntity player, Hand hand) {
    if (player.isSecondaryUseActive() || this.isBeingRidden()) {
      return ActionResultType.PASS;
    } else if (!this.world.isRemote) {
      return player.startRiding(this) ? ActionResultType.CONSUME : ActionResultType.PASS;
    } else {
      return ActionResultType.SUCCESS;
    }
  }

  @Override
  public Type getMinecartType() {
    return Type.RIDEABLE;
  }

  @Override
  public IPacket<?> createSpawnPacket() {
    return NetworkHooks.getEntitySpawningPacket(this);
  }
}

The entity type definition:

public class ModEntities {
  public static final RegistryObject<EntityType<TestMinecartEntity>> TEST_MINECART = REGISTER.register(
      "test_minecart",
      () -> EntityType.Builder.<TestMinecartEntity>create(TestMinecartEntity::new, EntityClassification.MISC)
          .size(0.98f, 0.98f)
          .trackingRange(10)
          .updateInterval(10)
          .immuneToFire()
          .build("test_minecart")
  );
}

Am I missing something here? Is there some vanilla code that might cause this behavior?

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

Important Information

By using this site, you agree to our Terms of Use.

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.