Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

last spawned entity does not always return #3063

Closed
ghost opened this issue Jun 21, 2020 · 7 comments
Closed

last spawned entity does not always return #3063

ghost opened this issue Jun 21, 2020 · 7 comments
Labels
bug An issue that needs to be fixed. Alternatively, a PR fixing an issue. completed The issue has been fully resolved and the change will be in the next Skript update. priority: medium Issues that are detrimental to user experience (prohibitive bugs or lack of useful implementation).

Comments

@ghost
Copy link

ghost commented Jun 21, 2020

Description

last spawned entity does not always return, it'll return none in some cases

Steps to Reproduce

simple code:

spawn a villager at location of {_p}
set {_villager} to last spawned entity

sometimes, with about 30% chance, {_villager} will be none while the villager did get spawned

Expected Behavior

I expect it to return villager entity at ALL times

Errors / Screenshots

None

Server Information

  • Server version/platform: 1.12.2 paper
  • Skript version: 2.5 alpha3

Additional Context

@ShaneBeee
Copy link
Contributor

I can not replicate this issue:

command /test:
    trigger:
        loop 20 times:
            spawn a villager at spawn of world "world"
            set {_v} to last spawned villager
            send "Villlager: &a%{_v}% &7UUID: &b%uuid of {_v}%" to console
        kill all villagers

Screen Shot 2020-06-21 at 4 35 00 AM

@ghost
Copy link
Author

ghost commented Jun 21, 2020

I can not replicate this issue:

command /test:
    trigger:
        loop 20 times:
            spawn a villager at spawn of world "world"
            set {_v} to last spawned villager
            send "Villlager: &a%{_v}% &7UUID: &b%uuid of {_v}%" to console
        kill all villagers
Screen Shot 2020-06-21 at 4 35 00 AM

oh you can, check the output more, some UUIDS are the same, you aren't deleting {_v}

@ShaneBeee
Copy link
Contributor

Hmm, not sure then, Ill mark it as a bug.

@ShaneBeee ShaneBeee added bug An issue that needs to be fixed. Alternatively, a PR fixing an issue. priority: low Issues that are not harmful to the experience but are related to useful changes or additions. priority: medium Issues that are detrimental to user experience (prohibitive bugs or lack of useful implementation). and removed priority: low Issues that are not harmful to the experience but are related to useful changes or additions. labels Jun 21, 2020
@ShaneBeee
Copy link
Contributor

changed

@ghost
Copy link
Author

ghost commented Jun 21, 2020

if anyone runs into the same issue before it is fixed, here's a temporary skript-mirror workaround:

import:
	org.bukkit.entity.EntityType
function entityType(type: string) :: string:
	switch {_type}:
		case "ender dragon":
			return "ENDER_DRAGON"
		case "TNT":
			return "PRIMED_TNT"
		case "ender crystal":
			return "ENDER_CRYSTAL"
		case "armor stand":
			return "ARMOR_STAND"
		case "dropped item":
			return "DROPPED_ITEM"
	return {_type}
expression (spawn|summon) [custom] %entitytypes% at %location%:
	get:
		return (expression 2).getWorld().spawnEntity((expression 2), EntityType.valueOf((entityType("%expression-1%")).toUpperCase()))

@Moderocky
Copy link
Member

Moderocky commented Jul 4, 2020

This issue does not appear to affect newer versions at all, from what I can see.

While it might still be happening, it has not appeared in over a dozen tests on either my local or remote servers. It seems to be limited to outdated MC versions from what I can tell (I'm going to test 1.13 through 1.15 today)

EDIT: I've tested a bunch of versions. It seems to be absolutely fine in 1.14+ :)

1.12.2 (issue present - there are duplicate indices):
image

1.16.1 (issue presumably absent - no duplicate indices):
image

@ShaneBeee ShaneBeee added the completed The issue has been fully resolved and the change will be in the next Skript update. label Jul 20, 2020
@ShaneBeee
Copy link
Contributor

So turns out this was just a silly little typo in VillagerData.
Its always those teeny tiny things right!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug An issue that needs to be fixed. Alternatively, a PR fixing an issue. completed The issue has been fully resolved and the change will be in the next Skript update. priority: medium Issues that are detrimental to user experience (prohibitive bugs or lack of useful implementation).
Projects
None yet
Development

No branches or pull requests

2 participants