Blogs Other

Server lag remover (Minecraft 1.12 function)

  • 1.4k views 0 today
Added CreditmegaCOOL1
  • 1
  • 1
megaCOOL1
Lvl 8Apprentice Network
1
I've always been excited about every upcoming Minecraft update: 1.9, 1.11 and especially 1.12, which adds functions and advancements. So I've been experimenting with functions, and I created a lag remover for my server, which I thought I'd share with you. Be aware that it also requires a named entity in order for it to work, and that the code on it's own simply isn't enough.
So I will show you how to set it up:
1) Go to your Minecraft world and create a folder under the functions folder:
world/data/functions/yourfunctions

2) Save the function inside the folder you just created:
world/data/functions/yourfunctions/itemclear.mcfunction
3) Create a scoreboard called "killitmcountdown"
/scoreboard objectives add killitmcountdown dummy
4) Summon an armor stand called "Wrapper" (if you haven't already sone so)
/summon armor_stand ~ ~ ~ {Invulnerable:1b,PersistenceRequired:1b,NoBasePlate:1b,Small:1b,CustomName:"Wrapper"}

5) That's it! Now all you need to do is continuously run this function!
/function yourfunctions:itemclear(Run this in a repeating command block), OR
/gamerule gameLoopFunction yourfunctions:itemclear
Source code
#Set killitmcountdown to 72000 when it reaches 0
scoreboard players set @e[type=armor_stand,name=Wrapper,score_killitmcountdown=0] killitmcountdown 72000

#Keep decreasing killitmcountdown by 1
scoreboard players remove @e[type=armor_stand,name=Wrapper] killitmcountdown 1

#When killitmcountdown becomes 1200, warn players that items and hostile mobs will be destroyed in 1min
execute @e[type=armor_stand,name=Wrapper,score_killitmcountdown=1200,score_killitmcountdown_min=1200] ~ ~ ~ tellraw @a ["",{"text":"SERVER]","bold":true,"color":"dark_blue"},{"text":" "},{"text":"All hostile mobs and ground items will be killed in ","color":"gold"},{"text":"(1)","bold":true,"color":"yellow"},{"text":" minutes!","color":"gold"}]

#When killitmcountdown reaches 0, kill all hostile mobs and items and tell players they have been destroyed
execute @e[type=armor_stand,name=Wrapper,score_killitmcountdown=0,score_killitmcountdown_min=-5] ~ ~ ~ kill @e[type=item]
execute @e[type=armor_stand,name=Wrapper,score_killitmcountdown=0,score_killitmcountdown_min=-5] ~ ~ ~ kill @e[type=creeper]
execute @e[type=armor_stand,name=Wrapper,score_killitmcountdown=0,score_killitmcountdown_min=-5] ~ ~ ~ kill @e[type=zombie]
execute @e[type=armor_stand,name=Wrapper,score_killitmcountdown=0,score_killitmcountdown_min=-5] ~ ~ ~ kill @e[type=spider]
execute @e[type=armor_stand,name=Wrapper,score_killitmcountdown=0,score_killitmcountdown_min=-5] ~ ~ ~ kill @e[type=slime]
execute @e[type=armor_stand,name=Wrapper,score_killitmcountdown=0,score_killitmcountdown_min=-5] ~ ~ ~ kill @e[type=skeleton]
execute @e[type=armor_stand,name=Wrapper,score_killitmcountdown=0,score_killitmcountdown_min=-5] ~ ~ ~ kill @e[type=zombie_pigman]
execute @e[type=armor_stand,name=Wrapper,score_killitmcountdown=0,score_killitmcountdown_min=-5] ~ ~ ~ kill @e[type=husk]
execute @e[type=armor_stand,name=Wrapper,score_killitmcountdown=0,score_killitmcountdown_min=-5] ~ ~ ~ kill @e[type=stray]
execute @e[type=armor_stand,name=Wrapper,score_killitmcountdown=0,score_killitmcountdown_min=-5] ~ ~ ~ kill @e[type=witch]
execute @e[type=armor_stand,name=Wrapper,score_killitmcountdown=0,score_killitmcountdown_min=-5] ~ ~ ~ kill @e[type=wither_skeleton]
execute @e[type=armor_stand,name=Wrapper,score_killitmcountdown=0,score_killitmcountdown_min=-5] ~ ~ ~ kill @e[type=vex]
execute @e[type=armor_stand,name=Wrapper,score_killitmcountdown=0,score_killitmcountdown_min=-5] ~ ~ ~ kill @e[type=ghast]
execute @e[type=armor_stand,name=Wrapper,score_killitmcountdown=0,score_killitmcountdown_min=-5] ~ ~ ~ kill @e[type=cave_spider]
execute @e[type=armor_stand,name=Wrapper,score_killitmcountdown=0,score_killitmcountdown_min=-5] ~ ~ ~ kill @e[type=silverfish]
execute @e[type=armor_stand,name=Wrapper,score_killitmcountdown=0,score_killitmcountdown_min=-5] ~ ~ ~ kill @e[type=magma_cube]
execute @e[type=armor_stand,name=Wrapper,score_killitmcountdown=0,score_killitmcountdown_min=0] ~ ~ ~ tellraw @a ["",{"text":"SERVER]","bold":true,"color":"dark_blue"},{"text":" "},{"text":"Killed all hostile mobs and ground items!","color":"red"}]


Anyways, I hope you all enjoy this! Feel free to use it in your world or on your server, but be sure to credit me for this, and DO NOT re-upload! Provide a link to this page instead!

More like this

  Have something to say?

Welcome