Skip to content

Conversation

TheLimeGlass
Copy link
Contributor

Description

vehicle itself cannot be used within an on mount event.

The only change is the registerDefault and removal of Delay.isDelayed because setTime handles this. The rest is code standards.

on mount:
	broadcast "%vehicle%"
	name of vehicle is "boat"
	passengers of vehicle is set
	cancel event

Errors:
Untitled


Target Minecraft Versions: any
Requirements: none
Related Issues: none

@TheLimeGlass TheLimeGlass requested a review from a team as a code owner July 29, 2025 21:55
@TheLimeGlass TheLimeGlass requested review from erenkarakal and Burbulinis and removed request for a team July 29, 2025 21:55
@skriptlang-automation skriptlang-automation bot added the needs reviews A PR that needs additional reviews label Jul 29, 2025
@Absolutionism Absolutionism added the bug An issue that needs to be fixed. Alternatively, a PR fixing an issue. label Jul 29, 2025
Co-authored-by: SirSmurfy2 <82696841+Absolutionism@users.noreply.github.com>
@Efnilite Efnilite added the 2.13 Targeting a 2.13.X version release. label Aug 11, 2025
@Example("""
set the vehicle of {game::players::*} to a saddled pig
give {game::players::*} a carrot on a stick
""")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
""")
""")

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, this is not proper Java standards. Avoids the addition of a blank line.

Copy link
Member

@sovdeeth sovdeeth Aug 13, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The indentation of the block string is determined by the location of the left-most non-space character, OR the ending """. If you put the """ all the way to the left like that, you cause the example string to be indented by a tab. We don't want that, so the """ needs to be on the same column as the example text.
See https://www.baeldung.com/java-text-blocks#indentation for examples

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why would you randomly put a new line break at the end. The existing annotations don't do this. This would essentially force a documentation page to check if the example ended with a new line break or not to differ between the annotations. Just keep it standardized and don't include a random new line break at the end of the returned string so the documentation page doesn't have to worry about varation.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This formatting still contains a line break at the end. If you wanted no line break, you would write:

@Example("""
	set the vehicle of {game::players::*} to a saddled pig
	give {game::players::*} a carrot on a stick""")

which is pretty ugly.

The difference between

@Example("""
	set the vehicle of {game::players::*} to a saddled pig
	give {game::players::*} a carrot on a stick
""")

and

@Example("""
	set the vehicle of {game::players::*} to a saddled pig
	give {game::players::*} a carrot on a stick
	""")

is simply indentation, and the second is what we want. The first causes the lines to have a tab at the front, the second doesn't have tabs.

Comment on lines +102 to +123
if (object instanceof Entity entity) {
entity.eject();
for (Entity passenger : passengers) {
// Avoid infinity mounting
if (event instanceof VehicleExitEvent && predicate.test(passenger) && passenger.equals(((VehicleExitEvent) event).getExited()))
continue;
if (event instanceof EntityDismountEvent && predicate.test(passenger) && passenger.equals(((EntityDismountEvent) event).getEntity()))
continue;
assert passenger != null;
passenger.leaveVehicle();
entity.addPassenger(passenger);
}
} else if (object instanceof EntityData entityData) {
VehicleExitEvent vehicleExitEvent = event instanceof VehicleExitEvent ? (VehicleExitEvent) event : null;
EntityDismountEvent entityDismountEvent = event instanceof EntityDismountEvent ? (EntityDismountEvent) event : null;
for (Entity passenger : passengers) {
// Avoid infinity mounting
if (vehicleExitEvent != null && predicate.test(passenger) && passenger.equals(vehicleExitEvent.getExited()))
continue;
if (entityDismountEvent != null && predicate.test(passenger) && passenger.equals(entityDismountEvent.getEntity()))
continue;
Entity vehicle = entityData.spawn(passenger.getLocation());
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not entirely sure about these checks within the loops, same reasoning as with #get
Would like thoughts from other team members

@Example("""
set the vehicle of {game::players::*} to a saddled pig
give {game::players::*} a carrot on a stick
""")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This formatting still contains a line break at the end. If you wanted no line break, you would write:

@Example("""
	set the vehicle of {game::players::*} to a saddled pig
	give {game::players::*} a carrot on a stick""")

which is pretty ugly.

The difference between

@Example("""
	set the vehicle of {game::players::*} to a saddled pig
	give {game::players::*} a carrot on a stick
""")

and

@Example("""
	set the vehicle of {game::players::*} to a saddled pig
	give {game::players::*} a carrot on a stick
	""")

is simply indentation, and the second is what we want. The first causes the lines to have a tab at the front, the second doesn't have tabs.

@skriptlang-automation skriptlang-automation bot removed the needs reviews A PR that needs additional reviews label Aug 26, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
2.13 Targeting a 2.13.X version release. bug An issue that needs to be fixed. Alternatively, a PR fixing an issue.
Projects
Status: In Review
Development

Successfully merging this pull request may close these issues.

5 participants