Jump to content

Block Overlay Skript


steveshatt

Recommended Posts

Hey everyone, I made a cool script for block overlay to let you know where you place! It still has some minor bugs so I'll fix those soon, but for now enjoy! 

To my knowledge it doesn't cause lag.

Original code made by me steveshat (ofc)

Requirements:

- SkBee

- Skript

 

image.thumb.png.f1ad0afdd27705e6052f7b8fe5eae9a0.png

 

import:
	org.bukkit.World

options:
    color: pink

function displayBlockOverlay(player: player, location: location):
	set {_point::1} to {_location} ~ vector(0.5, -0.5, 0.5)
	set {_point::2} to {_location} ~ vector(-0.5, -0.5, 0.5)
	set {_point::3} to {_location} ~ vector(-0.5, -0.5, -0.5)
	set {_point::4} to {_location} ~ vector(0.5, -0.5, -0.5)
	loop 2 times:
		loop 4 times:
			make 1 of dust using dustOption({@color}, 0.5) at getLineLocations(({_point::%loop-integer-2%} ~ {_offset}), (({_point::%loop-integer-2 + 1%} ? {_point::1}) ~ {_offset})) to {_player}
			if loop-integer-1 is 1:
				make 1 of dust using dustOption({@color}, 0.5) at getLineLocations(({_point::%loop-integer-2%}), ({_point::%loop-integer-2%} ~ vector(0,1,0))) to {_player}
		set {_offset} to vector(0,1,0)

function getLineLocations(location1: location, location2: location, density: integer=10) :: locations:
	set {_vector} to vector between {_location1} and {_location2}
	add {_location1} to {_return::*}
	loop {_density} times:
		set vector length of {_vector} to loop-integer/{_density} * (distance between {_location1} and {_location2})
		add ({_location1} ~ {_vector}) to {_return::*}
	return {_return::*}

every tick:
	loop all players where [{blockoverlay::%input's uuid%} is set]:
		set {_rayTrace.Result} to (loop-player's world).rayTraceBlocks(location of loop-player's eyes, (vector from yaw (loop-player's yaw) and pitch (loop-player's pitch)), 5)
		set {_rayTrace.hitBlock} to {_rayTrace.Result}.getHitBlock()
		set {_rayTrace.hitBlockFace} to "%{_rayTrace.Result}.getHitBlockFace()%"
		if {_rayTrace.hitBlockFace} is "UP":
			set {_focusedArea} to vector(0,1,0)
		else if {_rayTrace.hitBlockFace} is "SOUTH":
			set {_focusedArea} to vector(0,0,1)
		else if {_rayTrace.hitBlockFace} is "NORTH":
			set {_focusedArea} to vector(0,0,-1)
		else if {_rayTrace.hitBlockFace} is "DOWN":
			set {_focusedArea} to vector(0,-1,0)
		else if {_rayTrace.hitBlockFace} is "EAST":
			set {_focusedArea} to vector(1,0,0)
		else if {_rayTrace.hitBlockFace} is "WEST":
			set {_focusedArea} to vector(-1,0,0)
		displayBlockOverlay(loop-player, ({_rayTrace.hitBlock} ~ {_focusedArea}))

command /blockoverlay [<string="help">]:
	trigger:
		if arg-1 is "help":
			send "&6Block Overlay Help:"
			send "1. /blockoverlay off"
			send "2. /blockoverlay on"
		else if arg-1 is "on":
			set {blockoverlay::%player's uuid%} to true
			send "&aYou turned on the Block Overlay!"
		else if arg-1 is "off":
			delete {blockoverlay::%player's uuid%}
			send "&cYou turned off the Block Overlay!"
		else:
			player command "/blockoverlay"

Fixed the particles to be client sided

Edited by steveshatt
New code using ray tracing + better line function
Link to comment
Share on other sites

5 minutes ago, DjDisaster said:

Sub-Optimal, using vectors would achieve a greater performance. Find example attached if curious.
https://pastebin.com/SBkq2epD

😂 i have never seen more sub-optimal code than whatever obfuscated nonsense that pastebin contains. Don't insult Block Overlay Skript By steveshatt again.

 

Edited by skwiptasdf
idk if i can swear
Link to comment
Share on other sites

3 minutes ago, skwiptasdf said:

😂 i have never seen more sub-optimal code than whatever obfuscated nonsense that pastebin contains. Don't insult Block Overlay Skript By steveshatt again.

 

Would you please explain any inquiries or issues with the scripts functionality please? If not then I expect for there to be no argument on this being better.

Changes in the one I posted:
More optimised Code
More configurable
Neater

Edited by DjDisaster
Link to comment
Share on other sites

Just now, DjDisaster said:

Would you please explain any inquiries or issues with the scripts functionality please? If not then I expect for there to be no argument on this being better.

well there's too many ~s, *s, _s and {s, and i cant understand it. i hate it so delete it

Link to comment
Share on other sites

5 minutes ago, skwiptasdf said:

well there's too many ~s, *s, _s and {s, and i cant understand it. i hate it so delete it

{_s} is literally just 0.5
~s does not appear

Unless you have any functionality errors I see no such problem with the script I have posted.

 

Edited by DjDisaster
Link to comment
Share on other sites

2 minutes ago, DjDisaster said:

{_s} is literally just 0.5
~s does not appear

Unless you have any functionality errors I see no such problem with the script I have posted.

FIND ATTACHED
RELEVENT MATERIAL

Fish.png

I appreciate the relevant material that you attached, and to counter i give you my relevant material.

image.png.3a2cfba134acd332af500926ed36d224.png

Link to comment
Share on other sites

13 minutes ago, skwiptasdf said:

I appreciate the relevant material that you attached, and to counter i give you my relevant material.

image.png.3a2cfba134acd332af500926ed36d224.png

To counter such evidence I must say that Devil.Sk is 

A. No proof to be me
B. The skript works, the message was edited about 20 minutes ago
C. There is no proof it is not superior

Thank you for taking your time to read this,

Love you,

DjDisaster 

Link to comment
Share on other sites

3 minutes ago, DjDisaster said:

To counter such evidence I must say that Devil.Sk is 

A. No proof to be me
B. The skript works, the message was edited about 20 minutes ago
C. There is no proof it is not superior

Thank you for taking your time to read this,

Love you,

DjDisaster 

I counteract your evidence by disabling Devil.sk. If you would now please delete your profile.

Lots of love,
 

skript lord (knighted by gigi)

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...