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

Block Detection #1544

Closed
DroidVengeance opened this issue Sep 17, 2018 · 8 comments
Closed

Block Detection #1544

DroidVengeance opened this issue Sep 17, 2018 · 8 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

@DroidVengeance
Copy link

DroidVengeance commented Sep 17, 2018

I noticed using "block behind" is no longer working.

on place of wall sign:
        if block behind event-block is a chest:
                do this...

Now has to be "south of" instead of "behind":

on place of wall sign:
        if block south of event-block is a chest:
                do this...

No errors in the console
Addons - skUtilities, SKQuery

Can someone else confirm?

@ShaneBeee
Copy link
Contributor

I can confirm this.
In 1.12.2 (Skript dev37c) the block behind is the chest
in 1.13 (Skript alpha 3) the block behind is air, yet the block infront is a chest. Therefor showing that the direction appears to be reversed.

@TheBentoBox TheBentoBox added bug An issue that needs to be fixed. Alternatively, a PR fixing an issue. priority: medium Issues that are detrimental to user experience (prohibitive bugs or lack of useful implementation). labels Sep 18, 2018
@bensku
Copy link
Member

bensku commented Oct 3, 2018

I'm not sure if this is an error. Behind now points towards negative Z axis, which makes sense. I'm not sure why exactly it'd point to south before, honestly.

@weberlepecheur
Copy link

weberlepecheur commented Oct 16, 2018

Skript 2.3-beta1
Paper 1.13.1-b355

on break:
	cancel event
	loop blocks in radius 1 of event-location:
		loop-block is wall sign:
			send "Event: %event-location%"
			send "Loop: %location of loop-block%"
			send "Behind: %location of block behind location of loop-block%"

If wall sign facing south then the event-location is the location of the bock behind the location of loop-block but if the wall sign facing west, east or north the block behind the loop-block become air and not the event-location.

Im not sure if my explanation is accurate but I can say this, actually the expression "behind" means "-1" on the Z axe (in the 1.13 release) so I trying to use facing expression but I got an error:

on break:
	cancel event
	loop blocks in radius 1 of event-location:
		loop-block is wall sign:
			send "Event: %event-location%"
			send "Loop: %location of loop-block%"
			send "Behind: %location of block behind location of loop-block%"
			send "Facing: %facing of loop-block%"

[18:25:32] [Server thread/ERROR]: #!#!
[18:25:32] [Server thread/ERROR]: #!#! Stack trace:
[18:25:32] [Server thread/ERROR]: #!#! java.lang.IllegalArgumentException: Cannot get new data of Modern Material
[18:25:32] [Server thread/ERROR]: #!#! at org.apache.commons.lang.Validate.isTrue(Validate.java:136)
[18:25:32] [Server thread/ERROR]: #!#! at org.bukkit.Material.getNewData(Material.java:2050)
[18:25:32] [Server thread/ERROR]: #!#! at ch.njol.skript.expressions.ExprFacing.convert(ExprFacing.java:70)
[18:25:32] [Server thread/ERROR]: #!#! at ch.njol.skript.expressions.ExprFacing.convert(ExprFacing.java:1)
[18:25:32] [Server thread/ERROR]: #!#! at ch.njol.skript.registrations.Converters.convert(Converters.java:342)
[18:25:32] [Server thread/ERROR]: #!#! at ch.njol.skript.registrations.Converters.convertUnsafe(Converters.java:333)
[18:25:32] [Server thread/ERROR]: #!#! at ch.njol.skript.expressions.base.PropertyExpression.get(PropertyExpression.java:104)
[18:25:32] [Server thread/ERROR]: #!#! at ch.njol.skript.expressions.base.SimplePropertyExpression.get(SimplePropertyExpression.java:55)
[18:25:32] [Server thread/ERROR]: #!#! at ch.njol.skript.expressions.base.PropertyExpression.get(PropertyExpression.java:75)
[18:25:32] [Server thread/ERROR]: #!#! at ch.njol.skript.lang.util.SimpleExpression.getArray(SimpleExpression.java:102)
[18:25:32] [Server thread/ERROR]: #!#! at ch.njol.skript.lang.VariableString.toUnformattedString(VariableString.java:493)
[18:25:32] [Server thread/ERROR]: #!#! at ch.njol.skript.lang.VariableString.getMessageComponents(VariableString.java:508)
[18:25:32] [Server thread/ERROR]: #!#! at ch.njol.skript.effects.EffMessage.execute(EffMessage.java:87)
[18:25:32] [Server thread/ERROR]: #!#! at ch.njol.skript.lang.Effect.run(Effect.java:52)
[18:25:32] [Server thread/ERROR]: #!#! at ch.njol.skript.lang.TriggerItem.walk(TriggerItem.java:61)
[18:25:32] [Server thread/ERROR]: #!#! at ch.njol.skript.lang.TriggerItem.walk(TriggerItem.java:89)
[18:25:32] [Server thread/ERROR]: #!#! at ch.njol.skript.lang.Trigger.execute(Trigger.java:57)
[18:25:32] [Server thread/ERROR]: #!#! at ch.njol.skript.SkriptEventHandler.check(SkriptEventHandler.java:152)
[18:25:32] [Server thread/ERROR]: #!#! at ch.njol.skript.SkriptEventHandler$1.execute(SkriptEventHandler.java:110)
[18:25:32] [Server thread/ERROR]: #!#! at co.aikar.timings.TimedEventExecutor.execute(TimedEventExecutor.java:78)
[18:25:32] [Server thread/ERROR]: #!#! at org.bukkit.plugin.RegisteredListener.callEvent(RegisteredListener.java:62)
[18:25:32] [Server thread/ERROR]: #!#! at org.bukkit.plugin.SimplePluginManager.callEvent(SimplePluginManager.java:513)
[18:25:32] [Server thread/ERROR]: #!#! at org.bukkit.craftbukkit.v1_13_R2.event.CraftEventFactory.callPlayerInteractEvent(CraftEventFactory.java:256)
[18:25:32] [Server thread/ERROR]: #!#! at org.bukkit.craftbukkit.v1_13_R2.event.CraftEventFactory.callPlayerInteractEvent(CraftEventFactory.java:223)
[18:25:32] [Server thread/ERROR]: #!#! at net.minecraft.server.v1_13_R2.PlayerInteractManager.a(PlayerInteractManager.java:109)
[18:25:32] [Server thread/ERROR]: #!#! at net.minecraft.server.v1_13_R2.PlayerConnection.a(PlayerConnection.java:1232)
[18:25:32] [Server thread/ERROR]: #!#! at net.minecraft.server.v1_13_R2.PacketPlayInBlockDig.a(SourceFile:40)
[18:25:32] [Server thread/ERROR]: #!#! at net.minecraft.server.v1_13_R2.PacketPlayInBlockDig.a(SourceFile:10)
[18:25:32] [Server thread/ERROR]: #!#! at net.minecraft.server.v1_13_R2.PlayerConnectionUtils.lambda$ensureMainThread$0(PlayerConnectionUtils.java:12)
[18:25:32] [Server thread/ERROR]: #!#! at java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source)
[18:25:32] [Server thread/ERROR]: #!#! at java.util.concurrent.FutureTask.run(Unknown Source)
[18:25:32] [Server thread/ERROR]: #!#! at net.minecraft.server.v1_13_R2.SystemUtils.a(SystemUtils.java:109)
[18:25:32] [Server thread/ERROR]: #!#! at net.minecraft.server.v1_13_R2.MinecraftServer.b(MinecraftServer.java:1016)
[18:25:32] [Server thread/ERROR]: #!#! at net.minecraft.server.v1_13_R2.DedicatedServer.b(DedicatedServer.java:434)
[18:25:32] [Server thread/ERROR]: #!#! at net.minecraft.server.v1_13_R2.MinecraftServer.a(MinecraftServer.java:943)
[18:25:32] [Server thread/ERROR]: #!#! at net.minecraft.server.v1_13_R2.MinecraftServer.run(MinecraftServer.java:841)
[18:25:32] [Server thread/ERROR]: #!#! at java.lang.Thread.run(Unknown Source)
[18:25:32] [Server thread/ERROR]: #!#!
[18:25:32] [Server thread/ERROR]: #!#! Version Information:
[18:25:32] [Server thread/ERROR]: #!#! Skript: 2.3-beta1 (latest)
[18:25:32] [Server thread/ERROR]: #!#! Bukkit: 1.13.1-R0.1-SNAPSHOT
[18:25:32] [Server thread/ERROR]: #!#! Minecraft: 1.13.1
[18:25:32] [Server thread/ERROR]: #!#! Java: 1.8.0_181 (Java HotSpot(TM) 64-Bit Server VM 25.181-b13)
[18:25:32] [Server thread/ERROR]: #!#! OS: Windows 10 amd64 10.0
[18:25:32] [Server thread/ERROR]: #!#!
[18:25:32] [Server thread/ERROR]: #!#! Server platform: Paper
[18:25:32] [Server thread/ERROR]: #!#!
[18:25:32] [Server thread/ERROR]: #!#! Current node: null
[18:25:32] [Server thread/ERROR]: #!#! Current item: send "Facing: %the facing of loop-block%" to event-player/console
[18:25:32] [Server thread/ERROR]: #!#! Current trigger: left click (leftclick) (test.sk, line 1)
[18:25:32] [Server thread/ERROR]: #!#!
[18:25:32] [Server thread/ERROR]: #!#! Thread: Server thread
[18:25:32] [Server thread/ERROR]: #!#!
[18:25:32] [Server thread/ERROR]: #!#! Language: english
[18:25:32] [Server thread/ERROR]: #!#! Link parse mode: DISABLED
[18:25:32] [Server thread/ERROR]: #!#!
[18:25:32] [Server thread/ERROR]: #!#! End of Error.
[18:25:32] [Server thread/ERROR]: #!#!

And yes, I know, my english is bad ^^

@TheLimeGlass
Copy link
Collaborator

TheLimeGlass commented Nov 8, 2018

When testing on a block, the behind should return the opposite of the block facing, only if the block has a facing. That makes logical sense, if it doesn't have a face use the standard it has now. Less prone to user misunderstanding this way.

Main problem is that the direction is calculated with support of Entity, so it's all using calculations rather than just using BlockFaces for blocks.

@Blueyescat
Copy link
Contributor

Works fine on 2.4-alpha3

@Blueyescat
Copy link
Contributor

Sorry, i tested this again after i read @weberlepecheur's comment and yeah the issue is not fixed. Looks like using behind works like using north, no matter the block has a facing

@TheBentoBox
Copy link
Member

I was kinda surprised to hear this was fixed.

For context of how this could work in 1.13+, I implemented something like this in skript-mirror (except the opposite, the block in front instead of behind) and it was simple:

block property faced block:
	return type: block
	get:
		set {_direction} to try expr-1.getBlockData().getFacing().getDirection()
		if {_direction} is set:
			set {_facedLocation} to expr-1's location ~~ {_direction}
			return block at {_facedLocation}
		else:
			return

@TheLimeGlass
Copy link
Collaborator

TheLimeGlass commented Apr 3, 2021

block behind still returns block north of a wall sign. 2.5.3

@TPGamesNL TPGamesNL added the PR available Issues which have a yet-to-be merged PR resolving it label Aug 15, 2021
@APickledWalrus APickledWalrus added completed The issue has been fully resolved and the change will be in the next Skript update. and removed PR available Issues which have a yet-to-be merged PR resolving it labels Aug 30, 2021
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

9 participants