Hello,
if i create an item and spawn it on a world.
How to stop the item by falling down.
The item you spawn spawns at the position you specified. Then it follows the rules of “minecraft physics”, like gravity and water flow. So it can only fall if it was not spawned on the ground.
Am I guessing right what you mean?
Are there a way do disable this rule?
I don’t think there is a way to “lock” the (item)entity position without mods. A workaround could be setting the location rapidly with the scheduler but this could be glitchy. Just try.
Make it ride an invisible armor stand.
Just set it Passager?
Yeah, and set armor stand to no gravity.
only got: IllegalStateException: Entity is already tracked!
Report what you did as a bug to the SpongeCommon bug tracker, that shouldn’t happen. https://github.com/SpongePowered/SpongeCommon/issues
Back on topic though, I should have been more specific, when I said invisible armor stand I mean,
Marker
Invisible
NoGravity
Also not sure if you need both Marker and Invisible.
I’m not sure what data they represent in SpongeAPI.
I tryed this:
Extent extent = spawnLocation.getExtent(); Entity stand = extent.createEntity(EntityTypes.ARMOR_STAND, spawnLocation.getPosition()).get(); Entity item = extent.createEntity(EntityTypes.ITEM, spawnLocation.getPosition()).get(); ArmorStand as = (ArmorStand) stand; as.setGravity(false); InvisibilityData invisibilityData= as.getOrCreate(InvisibilityData.class).get(); invisibilityData.invisible().set(true); as.offer(invisibilityData); as.offer(Keys.PASSENGER,EntitySnapshot.builder().from(item).build()); extent.spawnEntity(as, Cause.of(this));
InvisibilityData is also used for vanish, so I’m not 100% sure on whether this is the correct form of invisibility.
the Error is thrown in this line:
as.offer(Keys.PASSENGER,EntitySnapshot.builder().from(item).build());
Try this:
Extent extent = spawnLocation.getExtent();
Entity stand = extent.createEntity(EntityTypes.ARMOR_STAND, spawnLocation.getPosition()).get();
Entity item = extent.createEntity(EntityTypes.ITEM, spawnLocation.getPosition()).get();
ArmorStand as = (ArmorStand) stand;
as.setGravity(false);
as.offer(Keys.INVISIBLE, true);
extent.spawnEntity(as, Cause.of(this));
extent.spawnEntity(item, Cause.of(this));
as.setPassenger(item);
java.lang.IllegalStateException
at com.google.common.base.Preconditions.checkState(Preconditions.java:161)
Cause by as.setPassenger(item);
Version: spongeforge-1.8-1577-3.1.0-BETA-1045
It looks like setPassenger in the implementation is not correctly building the DataTransactionResult. This will be fixed soon
https://github.com/SpongePowered/SpongeCommon/blob/master/src/main/java/org/spongepowered/common/mixin/core/entity/MixinEntity.java#L611-L628
OK fixed the issue
How can i get this version of SpongeCommon(With this fix) for my server
Did it exist for mc 1.8
did i need to use Gradle for it?
The next build on spongeforge will have it (1062). Changes in spongecommon get added to spongeforge when someone bumps the reference in the repo.
The ref will be bumped soon