Particle Swirls

Makes a cool particle effect with math

您需要先安裝使用者腳本管理器擴展,如 TampermonkeyGreasemonkeyViolentmonkey 之後才能安裝該腳本。

You will need to install an extension such as Tampermonkey to install this script.

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyViolentmonkey 後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyUserscripts 後才能安裝該腳本。

你需要先安裝一款使用者腳本管理器擴展,比如 Tampermonkey,才能安裝此腳本

您需要先安裝使用者腳本管理器擴充功能後才能安裝該腳本。

(我已經安裝了使用者腳本管理器,讓我安裝!)

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

(我已經安裝了使用者樣式管理器,讓我安裝!)

// ==UserScript==
// @namespace          hankcolewu
// @name               Particle Swirls
// @version            1.0.1
// @description        Makes a cool particle effect with math
// @author             Hank
// @license            MIT
// @minecraft          1.20.1
// @match              https://customnpcs.com
// @scripttype         npc
// ==/UserScript==

function interact(t){
t.setCanceled(true)
ParticleOrbit(t.npc)
}

function ParticleOrbit(npc){
var Thread = Java.type("java.lang.Thread");
var HankThread = Java.extend(Thread,{
run: function(){
for(var j = 0;j<3;++j){
for(var i = 0;i<30;++i){
var d = FrontVectors(npc,i*12,0,1.3,0)
Thread.sleep(8);
npc.world.spawnParticle("smoke",npc.x+d[0],npc.y+(j+i*0.01)+d[1],npc.z+d[2], 0,0,0,0,1);
npc.world.spawnParticle("flame",npc.x+d[0],npc.y+(j+i*0.01)+d[1],npc.z+d[2], 0.1,0.1,0.1,0.01,3);}}}});
var H = new HankThread();
H.start();}

function FrontVectors(entity,dr,dp,distance,mode){
if(mode == 1){var angle = dr + entity.getRotation();
var pitch = (-entity.getPitch()+dp)*Math.PI/180}
if(mode == 0){var angle = dr;var pitch = dp*Math.PI/180}
var dx = -Math.sin(angle*Math.PI/180)*(distance*Math.cos(pitch))
var dy = Math.sin(pitch)*distance
var dz = Math.cos(angle*Math.PI/180)*(distance*Math.cos(pitch))
return [dx,dy,dz]}

//end