Fog Wall

Makes dark souls like fog wall

您需要先安裝使用者腳本管理器擴展,如 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               Fog Wall
// @version            1.0.1
// @description        Makes dark souls like fog wall
// @author             Hank
// @license            MIT
// @minecraft          1.12.2
// @match              https://customnpcs.com
// @scripttype         block
// ==/UserScript==

var direction = "north" //use north/south/east/west or barrier
var message = "You cannot leave!"
var particle = "cloud"

/* For block above
function init(t){
t.block.setModel("minecraft:barrier")
t.block.setIsPassible(true)}
*/

var dx,dz
function init(t){
DD(t);
t.block.setModel("minecraft:barrier")
if(direction == "barrier")t.block.setIsPassible(false)
else{t.block.setIsPassible(true)}}

function collide(t){
if(t.entity.getType() == 2){t.entity.setMotionX(dx);t.entity.setMotionZ(dz)}
if(t.entity.getType() == 1){
var inside = t.block.world.getBlock(t.block.x+dx,t.block.y,t.block.z+dz).getPos()
var outside = t.block.world.getBlock(t.block.x-dx,t.block.y,t.block.z-dz).getPos()
if(!t.block.timers.has(1) && t.entity.getPos().distanceTo(inside) <= t.entity.getPos().distanceTo(outside)){
if(!t.block.timers.has(2))t.entity.message(message)
t.block.timers.forceStart(2,20,false)
t.entity.setMotionX(dx)
t.entity.setMotionZ(dz)}
else{
t.block.timers.forceStart(1,1,false)}}}

function DD(t){
if(direction == "north"){dx = 0;dz = -1;}
else if(direction == "south"){dx = 0;dz = 1;}
else if(direction == "east"){dx = 1;dz = 0;}
else if(direction == "west"){dx = -1;dz = 0;}
else{dx=0,dz=0}}

function tick(t){
t.block.world.spawnParticle(particle,t.block.x+0.5,t.block.y+1,t.block.z+0.5,0.3,0.7,0.3,0,50)}

//end