scroll down for codes of the previous video....
Code Block Loader ( Infinite lines for code block )
{
let _IF={state:0,handler:()=>{},args:[],delay:0,limit:1,phase:400000,cache:null,defaultPhase:400000,wasInterrupted:!1,tick:null},I={},E=0,D=1,S=0,L=[],X=1,N=0;
Object.defineProperty(globalThis.InternalError.prototype,"name",{configurable:!0,get:()=>{if(X){if(_IF.state){I[++E]=[_IF.phase,_IF.cache,_IF.handler,_IF.args,_IF.delay+N,_IF.limit];S++}}else{L[0]=_IF.phase;_IF.wasInterrupted=!1;X=1}_IF.cache=null;_IF.state=0;return"InternalError"}});
_IF.tick=()=>{_IF.state=0;if(!S){_IF.cache=null;N++;return}X=0;_IF.wasInterrupted=!0;let l,m=E;while(D<=m){l=L=I[D];if(l[4]<=N){if(l[5]>0){l[5]--;_IF.phase=l[0];_IF.cache=l[1];l[2](...l[3])}delete I[D++];S--}else{delete I[D++];I[++E]=l}}_IF.state=0;_IF.cache=null;_IF.wasInterrupted=!1;X=1;N++};
Object.seal(_IF);
globalThis.IF=_IF;
void 0
}
const Configuration={
ACTIVE_EVENTS:[
"onPlayerClick",
"onPlayerLeave",
"onPlayerJoin",
"onPlayerSelectInventorySlot",
"tick",
"onPlayerDamagingOtherPlayer",
"onPlayerDamagingMob"
],
BLOCKS:[
],
boot_manager:{
boot_delay_ms: 100,
show_load_time: true,
show_executed_blocks: false,
show_errors: true,
},
block_manager:{
default_locked_status: true,
default_execution_status: true,
max_registrations_per_tick: 32,
max_chunk_requests_per_tick: 8,
max_executions_per_tick: 16,
max_errors_count: 32,
},
join_manager:{
reset_on_reboot: true,
max_dequeue_per_tick: 16,
},
event_manager:{
is_interruption_framework_enabled: false,
default_retry_delay_ticks: 0,
default_retry_limit_ticks: 2,
},
EVENT_REGISTRY:{
tick:null,
onClose:[!1],
onPlayerJoin:[!1],
onPlayerLeave:[!1],
onPlayerJump:[!1],
onRespawnRequest:[[0,-200000,0]],
playerCommand:[null],
onPlayerChat:[null],
onPlayerChangeBlock:["preventChange"],
onPlayerDropItem:["preventDrop"],
onPlayerPickedUpItem:[!1],
onPlayerSelectInventorySlot:[!1],
onBlockStand:[!1],
onPlayerAttemptCraft:["preventCraft"],
onPlayerCraft:[!1],
onPlayerAttemptOpenChest:["preventOpen"],
onPlayerOpenedChest:[!1],
onPlayerMoveItemOutOfInventory:["preventChange"],
onPlayerMoveInvenItem:["preventChange"],
onPlayerMoveItemIntoIdxs:["preventChange"],
onPlayerSwapInvenSlots:["preventChange"],
onPlayerMoveInvenItemWithAmt:["preventChange"],
onPlayerAttemptAltAction:["preventAction"],
onPlayerAltAction:[!1],
onPlayerClick:[!1],
onClientOptionUpdated:[!1],
onMobSettingUpdated:[!1],
onInventoryUpdated:[!1],
onChestUpdated:[!1],
onWorldChangeBlock:["preventChange"],
onCreateBloxdMeshEntity:[!1],
onEntityCollision:[!1],
onPlayerAttemptSpawnMob:["preventSpawn"],
onWorldAttemptSpawnMob:["preventSpawn"],
onPlayerSpawnMob:[!1],
onWorldSpawnMob:[!1],
onWorldAttemptDespawnMob:["preventDespawn"],
onMobDespawned:[!1],
onPlayerAttack:[!1],
onPlayerDamagingOtherPlayer:["preventDamage"],
onPlayerDamagingMob:["preventDamage"],
onMobDamagingPlayer:["preventDamage"],
onMobDamagingOtherMob:["preventDamage"],
onAttemptKillPlayer:["preventDeath"],
onPlayerKilledOtherPlayer:["keepInventory"],
onMobKilledPlayer:["keepInventory"],
onPlayerKilledMob:["preventDrop"],
onMobKilledOtherMob:["preventDrop"],
onPlayerPotionEffect:[!1],
onPlayerDamagingMeshEntity:[!1],
onPlayerBreakMeshEntity:[!1],
onPlayerUsedThrowable:[!1],
onPlayerThrowableHitTerrain:[!1],
onTouchscreenActionButton:[!1],
onTaskClaimed:[!1],
onChunkLoaded:[!1],
onPlayerRequestChunk:[!1],
onItemDropCreated:[!1],
onPlayerStartChargingItem:[!1],
onPlayerFinishChargingItem:[!1],
doPeriodicSave:[!1],
},
LOG_STYLE:{
error:{color:"#ff9d87",fontWeight:"600",fontSize:"1rem"},
warning:{color:"#fcd373",fontWeight:"600",fontSize:"1rem"},
success:{color:"#2eeb82",fontWeight:"600",fontSize:"1rem"},
},
};
const CF_=Configuration,IF_={state:0,handler:()=>{},args:[],delay:0,limit:1,phase:400000,cache:null,defaultPhase:400000,wasInterrupted:!1,tick:null},EM_={a:null,b:!1,c:{},d:{},e:[],f:[],g:!1,h:null,i:null,j:null,k:null,l:null},TM_={a:null,b:!1,c:null,d:null,e:null},JM_={a:!1,b:null,c:null,d:null,e:null,f:null},BM_={a:null,b:4,c:null,d:null,e:!1,f:null,g:null,h:null},OM_={a:-2,b:!0,c:!1,d:null,e:null,f:null,g:null,h:null,i:null},CL_={configuration:null,isPrimaryBoot:!0,isRunning:!1,isBlockLocked:null,logBootResult:null,logLoadTime:null,logExecutedBlocks:null,logErrors:null},N_=function(){};
{let W=IF_,I={},E=0,D=1,S=0,L=[],X=1,N=0;Object.defineProperty(globalThis.InternalError.prototype,"name",{configurable:!0,get:()=>{if(X){if(W.state){I[++E]=[W.phase,W.cache,W.handler,W.args,W.delay+N,W.limit];S++}}else{L[0]=W.phase;W.wasInterrupted=!1;X=1}W.cache=null;W.state=0;return"InternalError"}});W.tick=()=>{W.state=0;if(!S){W.cache=null;N++;return}X=0;W.wasInterrupted=!0;let l,m=E;while(D<=m){l=L=I[D];if(l[4]<=N){if(l[5]>0){l[5]--;W.phase=l[0];W.cache=l[1];l[2](...l[3])}delete I[D++];S--}else{delete I[D++];I[++E]=l}}W.state=0;W.cache=null;W.wasInterrupted=!1;X=1;N++}}
{let V=EM_,N=N_,C=0,P=[],A=null,G=null,R=0,S=0;V.h=()=>{if(V.b){return}G=CF_.EVENT_REGISTRY;A=CF_.ACTIVE_EVENTS;let a=CF_.event_manager,b=!!a.is_interruption_framework_enabled,c=a.default_retry_delay_ticks|0;c=c&~(c>>31);let d=a.default_retry_limit_ticks|0;d=(d&~(d>>31))+(-d>>31)+1;let e=V.c,f=V.d,g=V.e,h=A.length,i=0;while(i<h){let j=A[i],k=j;if(j instanceof Array){k=j[0]}let l=G[k];if(l===void 0){g[g.length]=k;i++;continue}if(k==="tick"){i++;continue}P[P.length]=k;f[k]=!0;if(!(l instanceof Array)){l=G[k]=[!1]}let m=!!l[1];if(b&m){let n=l[2];if(n==null){n=c}n|=0;let o=l[3];if(o==null){o=d}o|=0;let p=IF_;e[k]=N;globalThis[k]=function handler(a0,a1,a2,a3,a4,a5,a6,a7,a8){p.state=1;p.handler=handler;p.args=[a0,a1,a2,a3,a4,a5,a6,a7,a8];p.delay=n;p.limit=o;p.phase=400000;try{return e[k](a0,a1,a2,a3,a4,a5,a6,a7,a8)}finally{p.state=0}}}else{e[k]=N;globalThis[k]=function(a0,a1,a2,a3,a4,a5,a6,a7,a8){return e[k](a0,a1,a2,a3,a4,a5,a6,a7,a8)}}i++}f.tick=!0};V.i=()=>{let a=V.c,b=P.length;while(C<b){let c=P[C];Object.defineProperty(globalThis,c,{configurable:!0,set:F=>{if(F instanceof Function){a[c]=F}else{a[c]=N}}});C++}Object.defineProperty(globalThis,"tick",{configurable:!0,set:F=>{if(F instanceof Function){a.tick=F}else{a.tick=N}}})};V.j=()=>{if(V.g){return}A=CF_.ACTIVE_EVENTS;V.f=[];R=0;S=0;V.g=!0};V.k=()=>{let a=V.c,b=P.length;while(R<b){a[P[R]]=N;R++}};V.l=()=>{let a=V.d,b=A.length;while(S<b){let c=A[S],d=c;if(c instanceof Array){d=c[0]}if(d==="tick"){S++;continue}if(a[d]){let e;if(c instanceof Array){e=c[1]}if(e===void 0){e=G[d][0]}else if(e==="undefined"){e=void 0}api.setCallbackValueFallback(d,e)}else{V.f[V.f.length]=d}S++}}}
{let X=TM_,W=IF_,V=EM_,N=N_,B=null,M=null,L=!1,Z=!1;X.c=()=>{if(X.b){return}B=N;X.a=N;M=N;L=!1;Z=!1;X.b=!0};let H=()=>{W.tick();B();X.a();M()};X.d=()=>{if(L){return}Object.defineProperty(globalThis,"tick",{configurable:!0,set:F=>{if(F instanceof Function){M=F}else{M=N}}});B=V.c.tick;V.c.tick=H;L=!0};X.e=()=>{if(Z){return}let a=V.c;Object.defineProperty(globalThis,"tick",{configurable:!0,set:F=>{if(F instanceof Function){a.tick=F}else{a.tick=N}}});a.tick=M;B=N;X.a=N;Z=!0}}
{let J=JM_,W=IF_,V=EM_,Y=OM_,N=N_,R=!0,Q=1,M=null,B=null,S=null,C=0,L=!1,Z=!1;J.b=()=>{if(J.a){return}let a=CF_.join_manager;R=!!a.reset_on_reboot;Q=a.max_dequeue_per_tick|0;Q=(Q&~(Q>>31))+(-Q>>31)+1;M=N;B=[];if(R|!S){S={}}C=0;L=!1;Z=!1;J.a=!0};let H=(a0,a1)=>{B[B.length]=[a0,a1];S[a0]=1};J.d=()=>{if(L){return}V.c.onPlayerJoin=H;Object.defineProperty(globalThis,"onPlayerJoin",{configurable:!0,set:F=>{if(F instanceof Function){M=F}else{M=N}}});L=!0};J.c=()=>{if(R|Y.b){let a=api.getPlayerIds(),b=a.length,c=0;while(c<b){let d=a[c];if(!S[d]){B[B.length]=[d,!1];S[d]=1}c++}}};J.e=()=>{let a=Q;while(C<B.length&a>0){let b=B[C],c=b[0];if(S[c]!==2){C++;S[c]=2;W.state=1;W.handler=M;W.args=b;W.delay=0;W.limit=1;W.phase=400000;try{M(c,b[1])}catch(d){W.state=0;api.broadcastMessage("Code Loader: JoinManager: "+d.name+": "+d.message,{color:"#ff9d87"})}W.state=0;a--;C--}C++}return C>=B.length};J.f=()=>{if(Z){return}let a=V.c;Object.defineProperty(globalThis,"onPlayerJoin",{configurable:!0,set:F=>{if(F instanceof Function){a.onPlayerJoin=F}else{a.onPlayerJoin=N}}});a.onPlayerJoin=M;B=null;Z=!0}}
{let B=BM_,Y=OM_,C=!0,A=!0,I=1,Q=1,V=1,O=0,K=null,L=null,H=0,G=0,E=0,X=0,Z=!1;B.f=()=>{if(B.e){return}B.c=CF_.BLOCKS instanceof Array?CF_.BLOCKS.slice():[];let a=CF_.block_manager;C=!!a.default_locked_status;A=!!a.default_execution_status;I=a.max_registrations_per_tick|0;I=(I&~(I>>31))+(-I>>31)+1;Q=a.max_chunk_requests_per_tick|0;Q=(Q&~(Q>>31))+(-Q>>31)+1;V=a.max_executions_per_tick|0;V=(V&~(V>>31))+(-V>>31)+1;O=a.max_errors_count|0;O=O&~(O>>31);B.b=0;K={};L={};B.d=[null];H=0;G=0;X=0;E=0;Z=!1;B.e=!0};let T=()=>{let a=B.c,b=a.length,c=Q,d=I;while(G<b&d>0&c>0){let e=a[G].slice(),x=e[0];x=(x|0)-(x<(x|0));let y=e[1];y=(y|0)-(y<(y|0));let z=e[2];z=(z|0)-(z<(z|0));let f=x+"|"+y+"|"+z,g=e[3];if(g==null){K[f]=C}else{K[f]=!!g}let h=e[4];if(h==null){h=e[3]=A}else{h=e[3]=!!h}if(h){let i=(x>>5)+"|"+(y>>5)+"|"+(z>>5);if(L[i]===void 0){let j=e[4]=api.getBlock(x,y,z);if(j==="Unloaded"){L[i]=!1;c--}else{L[i]=!0}}else{e[4]="Unloaded"}H=1}else{e[4]=null}a[G]=e;d--;G++}B.b=(G>=b)<<1|H^1};let U=()=>{let a=B.c,b=B.d,c=a.length,d=V;while(X<c&d>0){let e=a[X];if(!e[3]){X++;continue}let x=e[0],y=e[1],z=e[2];if(e[4]==="Unloaded"){let f=api.getBlock(x,y,z);if(f==="Unloaded"){break}e[4]=f}try{let f=api.getBlockData(x,y,z)?.persisted?.shared?.text;(0,eval)(f)}catch(g){E++;b[E*+(b.length-1<O)]=[x,y,z,g.name,g.message]}d--;X++}B.b=2|X>=c};B.a=()=>{if(B.b<2){return T()}if(B.b===2){U()}};B.g=()=>{if(Z){return}B.d[0]=null;L=null;Z=!0};B.h=a=>{let x=a[0],y=a[1],z=a[2],b=(x|0)-(x<(x|0))+"|"+((y|0)-(y<(y|0)))+"|"+((z|0)-(z<(z|0)));if(K[b]!==!1){return!Y.c}return!1}}
{let Y=OM_,V=EM_,Z=TM_,J=JM_,B=BM_,C=CL_,D=0,L=!0,E=!0,X=!1,N=-1,T=-1;Y.f=a=>{let b=B.d.length-1,c="Code Loader: BootManager: Code was loaded in "+T*50+" ms";if(b===0){c+=a?" with 0 errors.":".";api.broadcastMessage([{str:c,style:Y.d.success??{}}])}else{c+=a?" with "+b+" error"+(b===1?"":"s")+".":".";api.broadcastMessage([{str:c,style:Y.d.warning??{}}])}};Y.g=()=>{let a=B.c,b=a.length,c="",d=0,e=0;while(e<b){let f=a[e];if(f[3]){c+='\n"'+f[4]+'" at ('+f[0]+", "+f[1]+", "+f[2]+")";d++}e++}c="Code Loader: BlockManager: Executed "+d+" block"+(d===1?"":"s")+":"+c;api.broadcastMessage([{str:c,style:(B.d.length-1?Y.d.warning:Y.d.success)??{}}])};Y.h=()=>{let a=B.d,b=a.length-1;if(b>0){let c="Code Loader: BlockManager: Code execution error"+(b===1?"":"s")+":",d=1;while(d<=b){let e=a[d];c+="\n"+e[3]+" at ("+e[0]+", "+e[1]+", "+e[2]+"): "+e[4];d++}api.broadcastMessage([{str:c,style:Y.d.error??{}}])}};Y.e=(a,b,c)=>{if(V.e.length){api.broadcastMessage([{str:'Code Loader: EventManager: Unregistered active events: "'+V.e.join('", "')+'".',style:Y.d.warning??{}}])}if(V.f.length){api.broadcastMessage([{str:'Code Loader: EventManager: Invalid active events: "'+V.f.join('", "')+'".',style:Y.d.warning??{}}])}if(a){Y.f(b)}if(c){Y.g()}if(b){Y.h()}};Y.i=()=>{N++;if(Y.a<6){if(Y.a===-2){if(Y.b&!V.b&N>20){let a=V.a,b=`Code Loader: EventManager: ${a===null?"Undefined e":"E"}rror on events primary setup${a===null?".":` - ${a[0]}: ${a[1]}.`}`,c=api.getPlayerIds();for(let d of c){if(api.checkValid(d)){api.kickPlayer(d,b)}}}return}if(Y.a===0){N=0;let e=CF_.boot_manager;D=(e.boot_delay_ms|0)*.02|0;D=D&~(D>>31);L=!!e.show_load_time;E=!!e.show_errors;X=!!e.show_executed_blocks;Y.d={error:Object.assign({},CF_.LOG_STYLE.error),warning:Object.assign({},CF_.LOG_STYLE.warning),success:Object.assign({},CF_.LOG_STYLE.success)};T=-1;V.g=!1;Z.b=!1;J.a=!1;B.e=!1;C.isRunning=Y.c=!0;Y.a=1}if(Y.a===1){if(N<D){return}Y.a=2}if(Y.a===2){V.j();Z.c();if(V.d.onPlayerJoin){J.b()}B.f();Y.a=3}if(Y.a===3){if(Y.b){V.i()}else{V.k()}V.l();Y.a=4}if(Y.a===4){if(V.d.onPlayerJoin){J.c();J.d()}Z.d();Y.a=5}if(Y.a===5){Z.a=B.a;Y.a=6;return}}if(Y.a===6){if(B.b===3){B.g();Y.a=6+1+!V.d.onPlayerJoin}}if(Y.a===7){if(J.e()){J.f();Y.a=8}}if(Y.a===8){Z.e();B.b=4;C.isPrimaryBoot=Y.b=!1;C.isRunning=Y.c=!1;Y.a=-1;T=N-D+1;Y.e(L,E,X)}}}
{let C=CL_,V=EM_,B=BM_,Y=OM_;C.configuration=CF_;C.isBlockLocked=a=>{return a instanceof Array&&a.length===3&&B.h(a)};C.reboot=()=>{if(!Y.c){V.c.tick=Y.i;Y.a=0}else{api.broadcastMessage([{str:"Code Loader: BootManager: Wait until current running boot session is finished.",style:Y.d.warning??{}}])}};C.logBootResult=(a=!0,b=!0,c=!1)=>{Y.e(a,b,c)};C.logLoadTime=(a=!0)=>{Y.f(a)};C.logErrors=()=>{Y.h()};C.logExecutedBlocks=()=>{Y.g()}}
{let a=EM_.c;a.tick=OM_.i;globalThis.tick=function(){a.tick()}}
try{EM_.h();let a=[CF_,CF_.boot_manager,CF_.block_manager,CF_.join_manager,CF_.event_manager,CF_.LOG_STYLE,IF_,EM_,TM_,JM_,BM_,OM_,CL_],b=a.length,c=0;while(c<b){Object.seal(a[c]);c++}Object.freeze(CF_.EVENT_REGISTRY);EM_.b=!0;OM_.a=0}catch(error){EM_.a=[error.name,error.message]}
globalThis.IF=IF_;
globalThis.CL=CL_;
void 0;
Advanced Smp System Code ( Durability )
const SHOW_DURABILITY = true;const POTION_DURATION = 300000;const SPLASH_DURATION = 30000000000;const GLIDER_DURABILITY_INTERVAL = 1000;const DURABILITY_WARN_RATIO = 0.15;const ON_JOIN_INSTRUCTIONS = [{str:"Welcome To R2G Land [Still In Progress Fr Fr\n",style:{color:"springgreen",fontSize:"18px"}},{str:"",style:{color:"aqua"}},{str:"\n\n"},{str:"",style:{color:"aqua"}},{str:"\nThis Is The Best Game On Bloxd.io!\nIf Ur Unsure How To Play Ask Anyone, Everyone Is Kind!"}];const playerSetup={};const ITEM_DATA={Chestplate:{materials:["Wood","Iron","Gold","Diamond"],durability:[64,128,256,512]},Leggings:{materials:["Wood","Iron","Gold","Diamond"],durability:[64,128,256,512]},Boots:{materials:["Wood","Iron","Gold","Diamond"],durability:[64,128,256,512]},Helmet:{materials:["Wood","Iron","Gold","Diamond"],durability:[64,128,256,512]},Gauntlets:{materials:["Wood","Iron","Gold","Diamond"],durability:[64,128,256,512]},Sword:{materials:["Wood","Stone","Iron","Gold","Diamond","Knight"],durability:[64,128,256,512,1024,1024]},Pickaxe:{materials:["Wood","Stone","Iron","Golem","Gold","Diamond","Moonstone"],durability:[128,256,512,512,1024,2048,4096]},Axe:{materials:["Wood","Stone","Iron","Gold","Diamond","Moonstone","Artisan"],durability:[128,256,512,1024,2048,4096,Infinity]},Spade:{materials:["Wood","Stone","Iron","Gold","Diamond"],durability:[128,256,512,1024,2048]},Hoe:{materials:["Wood","Stone","Iron","Gold","Diamond"],durability:[128,256,512,1024,2048]},Bow:{materials:["Wood","Stone","Iron","Gold","Diamond"],durability:[64,128,256,512,1024]},Crossbow:{materials:["Wood","Stone","Iron","Gold","Diamond"],durability:[64,128,256,512,1024]},"Hang Glider":{materials:["Wood","Iron","Gold","Diamond"],durability:[256,512,1024,2048]}};const REPAIR_DATA={"Wood":["Maple Wood Planks","Pine Wood Planks","Spectral Wood Planks","Cherry Wood Planks","Aspen Wood Planks","Plum Wood Planks","Palm Wood Planks","Pear Wood Planks","Cedar Wood Planks","Mango Wood Planks"],"Iron":"Iron Bar","Gold":"Gold Bar","Stone":"Messy Stone","Diamond":"Diamond","Moonstone":"Moonstone Fragment"};const AURA_REPAIR_DATA={"Aura XP Fragment":5,"Aura XP Orb":15,"Aura XP Potion":45,"Aura XP Potion II":90};function isValidItem(text){if(typeof text!="string")return false;const parts=text.trim().split(" ");for(let i=1;i<=Math.min(3,parts.length);i++){const itemType=parts.slice(-i).join(" ");const material=parts.slice(0,parts.length-i).join(" ");if(ITEM_DATA[itemType]?.materials.includes(material)){return true}}return false}function armorDurability(p){for(let i=46;i<51;i++){let item=api.getItemSlot(p,i);if(!item)continue;let max=getDurability(item.name);let d=item.attributes.customAttributes.durability??max;d-=1+(Math.random()>0.8?1:0);if(d<=0){api.setItemSlot(p,i,"Air");itemBreakSound(p)}else{item.attributes.customAttributes.durability=d;item.attributes.customDescription=`Durability: ${d}/${max}`;api.setItemSlot(p,i,item.name,item.amount,item.attributes)}}displayDurability(p)}function getDurability(text){if(typeof text!="string")return null;const parts=text.trim().split(" ");for(let i=1;i<=Math.min(3,parts.length);i++){const itemType=parts.slice(-i).join(" ");const material=parts.slice(0,parts.length-i).join(" ");const item=ITEM_DATA[itemType];if(item){const index=item.materials.indexOf(material);if(index!==-1)return item.durability[index];}}return"---"}function onPlayerDamagingOtherPlayer(p,o,d,i,b){if((i=="Poison Potion"||i=="Brain Rot Potion")&&api.getHealth(o)-d<=0)api.setHealth(o,1+d);if(i.includes("Potion"))return;armorDurability(o);heldDurability(p)}function onPlayerDamagingMob(p){heldDurability(p)}function onMobDamagingPlayer(_,p,d,i){if((i=="Poison Potion"||i=="Brain Rot Potion")&&api.getHealth(p)-d<=0)api.setHealth(p,1+d);if(i.includes("Potion"))return;armorDurability(p)}function onPlayerChangeBlock(e,t,i,s,a,o){if(a!=o&&!api.getHeldItem(e)?.name?.includes("Hang Glider"))heldDurability(e);if(a.includes("Iron Chest")&&"Air"==o){let e=api.getBlockData(t,i,s).persisted.shared,a=api.getStandardChestItems([t,i,s]);if(a.every((e)=>null==e))return;let o=e.passkey,n=formatItems(a);return(api.setBlockData(t,i,s,{persisted:{shared:{chestStr:""}}}),api.createItemDrop(t+0.5,i+0.5,s+0.5,"White Paintball",1,!1,{customDisplayName:e.itemName??"Iron Chest",customDescription:"Includes:\n"+n,customAttributes:{chestPos:[t,height,s],passkey:o}}),operations.add({x:t,y:height,z:s,savedNewHeight:!1,idx:0,items:a,func:(e)=>{if(e.savedNewHeight){if("Unloaded"==api.getBlock(e.x,e.y,e.z))return;"Chest"!=api.getBlock(e.x,e.y,e.z)&&api.setBlock(e.x,e.y,e.z,"Chest");for(let t=e.idx;t<36;t++)null!=a[t]?(api.setStandardChestItemSlot([e.x,e.y,e.z],t,a[t]?.name,a[t]?.amount,void 0,a[t]?.attributes),(e.idx=t)):(e.idx=t);operations.delete(e)}else{if("Chest"==!api.getBlock(0,-9999,0))return;(height-=1),api.setStandardChestItemSlot([0,-9999,0],0,"Chest",1,void 0,{customAttributes:{ironChestSaveHeight:height}}),(e.savedNewHeight=!0)}}}),"preventDrop")}}function heldDurability(p){let s=api.getSelectedInventorySlotI(p);let item=api.getItemSlot(p,s);if(!item||!isValidItem(item.name))return;let max=getDurability(item.name);let d=item.attributes.customAttributes.durability??max;d-=1;if(d<=0){api.setItemSlot(p,s,"Air");itemBreakSound(p)}else{item.attributes.customAttributes.durability=d;item.attributes.customDescription=`Durability: ${d}/${max}`;api.setItemSlot(p,s,item.name,item.amount,item.attributes)}displayDurability(p)}function displayDurability(p){if(!playerSetup[p].sd){api.setClientOption(p,"crosshairText","");return}let space={str:" ".repeat(40),style:{fontSize:"3vw"}};let style={fontSize:"3vw"};let items=[];for(let i=46;i<51;i++)items.push(api.getItemSlot(p,i));items.push(api.getHeldItem(p));let max=[];items.forEach(i=>max.push(getDurability(i?.name??"")));let text=[{str:"\n".repeat(20),style:{fontSize:"1vh"}}];for(let i=0;i<6;i++){let d=items[i]?.attributes?.customAttributes?.durability??max[i];text.push(...[space,{icon:items[i]?.name??"",style:style},{str:durabilityFormat(items[i],playerSetup[p].df,d,max[i]),style:{color:(d/max[i]>0.15)||d=="---"?"white":"red"}},{str:"\n",style:{fontSize:"1vw"}}])}api.setClientOption(p,"crosshairText",text)}ticks=0;tick=function(){if(ticks++ %20==0)api.getPlayerIds().forEach(p=>displayDurability(p));if(ticks%Math.round(GLIDER_DURABILITY_INTERVAL/50)==0)api.getPlayerIds().forEach(gliderDurability);for(const e of operations)e.func?.(e);};function onPlayerJoin(p){api.editItemCraftingRecipes(p,"Cornbread",[{requires:[{items:["Corn"],amt:2},{items:["Bread"],amt:1}],produces:1,station:["Workbench"]}]);api.setClientOption(p,"potionEffectDuration",POTION_DURATION);api.setClientOption(p,"splashPotionEffectDuration",SPLASH_DURATION);api.sendFlyingMiddleMessage(p,[{str:"\n".repeat(10)},{str:"This world is using BETTER SMP FEATURES V1 by WBSTP",style:{fontSize:"2vh"}}],0);playerSetup[p]={df:"relative",sd:true};api.sendMessage(p,ON_JOIN_INSTRUCTIONS)}function gliderDurability(p){let slot=api.getSelectedInventorySlotI(p);let item=api.getItemSlot(p,slot);if(!item||!item.name.includes("Hang Glider")||api.getBlockTypesPlayerStandingOn(p).length>0)return;let max=getDurability(item.name);let d=item.attributes.customAttributes.durability??max;d-=1;if(d<=0)api.setItemSlot(p,slot,"Air");else{item.attributes.customAttributes.durability=d;item.attributes.customDescription=`Durability: ${d}/${max}`;api.setItemSlot(p,slot,item.name,item.amount,item.attributes)}}function isRepairItem(item,repair){if(!isValidItem(repair))return false;mat=repair.split(" ").slice(0,1);let data=REPAIR_DATA[mat];api.log(item,repair);if(typeof data=="string")return item==data;if(data instanceof Array)return data.includes(item);return}function playerCommand(p,cmd){let args=cmd.split(" ");let ps=playerSetup[p];if(args[0]==".smp"&&args[1]=="durability_format"){if(ps.df=="absolute")ps.df="relative";else ps.df="absolute";api.sendMessage(p,"Changed durability display mode to "+ps.df,{color:"springgreen"});return true}if(args[0]==".smp"&&args[1]=="show_durability"){ps.sd=!ps.sd;api.sendMessage(p,"Durability display is now "+(ps.sd?"visible":"hidden"),{color:"springgreen"});return true}}function durabilityFormat(item,format,d,max){if(format=="absolute")return isValidItem(item?.name)?(" "+d+"/"+max):" ---";else return isValidItem(item?.name)?" "+Math.ceil((d/max)*100)+"%":" ---";}function onPlayerFinishChargingItem(p,done,item){if(!done)return;if(AURA_REPAIR_DATA[item])repairArmor(p,AURA_REPAIR_DATA[item]);if(isValidItem(item))heldDurability(p);if(item=="Cornbread"){api.applyEffect(p,"Health Regen",5000,{inbuiltLevel:2});api.applyEffect(p,"Damage Reduction",6000,{})}}function repairArmor(p,amount){for(let i=46;i<51;i++){let item=api.getItemSlot(p,i);if(!item)continue;let max=getDurability(item.name);let d=item.attributes.customAttributes.durability??max;d+=amount;if(d>max)d=max;item.attributes.customAttributes.durability=d;item.attributes.customDescription=`Durability: ${d}/${max}`;api.setItemSlot(p,i,item.name,item.amount,item.attributes)}for (let i = 0; i < 10; i++) {let item = api.getItemSlot(p, i);if (!item || !isValidItem(item.name)) continue;let max = getDurability(item.name);let d = item.attributes.customAttributes.durability ?? max;d += amount;if (d > max) d = max;item.attributes.customAttributes.durability = d;item.attributes.customDescription = `Durability: ${d}/${max}`;api.setItemSlot(p, i, item.name, item.amount, item.attributes)}displayDurability(p)}function itemBreakSound(p){api.broadcastSound("glass",0.5,1.6,{playerIdOrPos:p});api.broadcastSound("pickUp",0.8,0.8,{playerIdOrPos:p});api.broadcastSound("hit",0.8,2,{playerIdOrPos:p});api.broadcastSound("step_cloth",0.8,1,{playerIdOrPos:p});api.broadcastSound("wood",1,0.3,{playerIdOrPos:p})}function onPlayerClick(e,t){if(!(api.isMobile(e)||t))return;let i=api.getHeldItem(e),s=api.getPlayerTargetInfo(e);if(i?.name=="Yellow Paintball"){if(!api.getEffects(e).includes("Totem")){api.applyEffect(e,"Totem",null,{icon:"Yellow Paintball",displayName:"Totem"});api.setItemSlot(e,api.getSelectedInventorySlotI(e),"Air")}}else if("White Paintball"==i?.name&&s){let t=s.adjacent;api.setBlock(...t,"Iron Chest");let a=i.attributes.customAttributes.passkey,o=api.getPlayerDbId(e);operations.add({pk:a,itemName:i.customDisplayName,ownerDbId:o,npos:t,opos:i.attributes.customAttributes.chestPos,items:null,idx:0,func:(e)=>{if("Chest"==api.getBlock(...e.opos)){null==e.items&&(e.items=api.getStandardChestItems(e.opos)),api.setBlockData(...e.npos,{persisted:{shared:{ownerDbId:e.ownerDbId,passkey:e.passkey+"",itemName:e.itemName}}});for(let t=e.idx;t<36;t++){let i=e.items[t];null!=i?api.setStandardChestItemSlot(e.npos,t,i.name,i.amount,void 0,i.attributes):(e.idx=t)}operations.delete(e)}}}),api.setItemSlot(e,api.getSelectedInventorySlotI(e),"Air")}}function formatItems(e){const t=e.filter((e)=>null!==e),i=t.slice(0,5),s=i.map((e)=>`${e.amount}x ${e.name}`).join("\n"),a=t.length-i.length;return a>0?`${s}\n⦠and ${a} more`:s}(operations=new Set()),(height=null),operations.add({func:(e)=>{let block=api.getBlock(0,-9999,0);if(block!="Unloaded"){if(block.includes("Chest")){height=api.getStandardChestItemSlot([0,-9999,0],0)?.attributes?.customAttributes?.ironChestSaveHeight??-1e4;operations.delete(e)}else api.setBlock(0,-9999,0,"Chest");}}});function onWorldSpawnMob(m){if(Math.random()<=0.075&&api.getEntityType(m)=="Stag"){let p=api.getPosition(m);api.despawnMob(m);api.attemptSpawnMob("Gold Watermelon Stag",...p)}}function onPlayerKilledMob(p,m){if(Math.random()<=0.25&&api.getEntityType(m)=="Gold Watermelon Stag"){api.createItemDrop(...api.getPosition(m),"Yellow Paintball",1,false,{customDisplayName:"Totem of Undying",customDescription:"Right Click to apply to offhand."})}}function onAttemptKillPlayer(p,o){if(api.getEffects(p).includes("Totem")){let[x,y,z]=api.getPosition(p);y+=1;api.playParticleEffect({dir1:[-1,-1,-1],dir2:[1,1,1],pos1:[x+2,y+1.5,z+2],pos2:[x-2,y-1.5,z-2],texture:"glint",minLifeTime:0.5,maxLifeTime:2,minEmitPower:4,maxEmitPower:6,minSize:0.1,maxSize:0.5,manualEmitCount:85,gravity:[0,-10,0],colorGradients:[{timeFraction:0,minColor:[211,214,0,0.5],maxColor:[0,255,0,0.8]}],velocityGradients:[{timeFraction:1,factor:0.2,factor2:1}],blendMode:1});operations.add({p:p,i:10,func:(t)=>{let o=(100-t.i)/100;if(t.i<50)o=1;api.setClientOption(t.p,"crosshairText",[{icon:"Gold Spade",style:{fontSize:`${t.i}vh`,opacity:o}}]);t.i+=10;if(t.i>100){api.setClientOption(t.p,"crosshairText","");operations.delete(t)}}});api.applyEffect(p,"Health Regen",8000,{inbuiltLevel:9});api.applyEffect(p,"Damage Reduction",8000,{inbuiltLevel:7});api.broadcastSound("cannonFire",1,4,{playerIdOrPos:p});api.broadcastSound("cashRegister",1,1.5,{playerIdOrPos:p});api.removeEffect(p,"Totem");return"preventDeath"}}function onPlayerLeave(p){if(api.getEffects(p).includes("Totem"))api.giveItem(p, "Yellow Paintball", 1, {customDisplayName:"Totem of Undying",customDescription:"Right Click to apply to offhand."})}
Custom Mob " The Faceless Eagle " Code :
function onWorldAttemptDespawnMob(m){if (m==s){return "preventDespawn"}}
function onPlayerDamagingOtherPlayer(){return "preventDamage"}
function onPlayerKilledMob(){
egr = api.now()
}
function dists(){
let se = []
let ids = api.getPlayerIds().filter(i => (api.isAlive(i)))
if (ids == []){
return false
} else {
for (k=0;k<ids.length;k++){
try{se.push(aoa(dc(api.getPosition(s),api.getPosition(ids[k]))))} catch(e){}
}
return ids[se.indexOf(Math.min(...se))]}
}
function aoa(a){
return Math.abs(a[0]+a[1]+a[2])/3
}
function dc(a,b){
return [a[0]-b[0],a[1]-b[1],a[2]-b[2]]
}
var eint = api.now()
var s = "n"
var pf = {}
var egr = "tnull"
function onPlayerKilledMob(p,m){}
var trgt = "null";
var lstht = api.now()
var i = [0,api.now()]
var ny = 50
var rd = 6
var dcon = false
var di = api.now()
var dir = -0.5
function onPlayerDamagingMob(p,m,w){
if (m==s && w != "Black Ceramic"){
let yh = api.getPlayerFacingInfo(p).dir
api.applyImpulse(s,yh[0]*10*Math.random(),yh[1]*5,yh[2]*10*Math.random())
}
}
function onMobDamagingPlayer(m,p){
if (m==s){
pf[p] = true
}
}
function v(i){try {api.getPosition(i);return true} catch(e){return false}}
function tick(){
for (const p of api.getPlayerIds()){
if (api.getPosition(p)[1] <= 1){
api.setVelocity(p,0,20,0)
api.attemptApplyDamage({
eId:s,
hitEId:p,
attemptedDmgAmt:99999,
withItem:"VoidJump",
bodyPartHit:undefined,
attackDir:[Math.random(),Math.random(),Math.random()],
showCritParticles:false,
reduceVerticalKbVelocity: true,
horizontalKbMultiplier:2,
verticalKbMultiplier:2,
broadcastEntityHurt:true,
attackCooldownSettings:null,
})
}
}
if (s == "n" || !v(s)){
for (const m of api.getMobIds())api.despawnMob(m)
api.broadcastMessage([{str:"The FACELESS EAGLE has been spawned with "+500*api.getNumPlayers()+" HP and "+(50+(api.getNumPlayers()*4))+" true damage per hit!",style:{fontSize:"25px",color:"crimson"}}])
s = api.attemptSpawnMob("Draugr Zombie",-69,322,-538,{name:"EAGLE"})
i = [0,api.now()]
} else {
if (i[0] == 0 && api.now() - i[1] > 500){
try{api.setPlayerPose(s,"gliding")}catch(e){}
api.setMobSetting(s,"hostilityRadius",99999)
api.setMobSetting(s,"idleSound","")
api.setTargetedPlayerSettingForEveryone(s,"killfeedColour","brown",true)
api.setMobSetting(s,"attackItemName","Gold Antlers")
api.setTargetedPlayerSettingForEveryone(s,"nameTagInfo",{backgroundColor:"rgba(0,0,0,0)",content:[{str:"THE FACELESS EAGLE",style:{fontSize:"200px",color:"Crimson"}}]},true)
api.setMobSetting(s,"maxHealth",500*api.getNumPlayers())
api.setHealth(s,500*api.getNumPlayers())
api.setMobSetting(s,"attackRadius",3)
api.setMobSetting(s,"attackDamage",50+(api.getNumPlayers()*4))
api.scalePlayerMeshNodes(s,{"TorsoNode":[1,1,1],"ArmLeftMesh":[1,1.5,1],"ArmRightMesh":[1,1.5,1]})
api.updateEntityNodeMeshAttachment(s,"HeadMesh","BloxdBlock",{blockName:"White Concrete",size:1,meshOffset:[0,0,0]},[0,0.7,0.2],[0,0,0])
api.updateEntityNodeMeshAttachment(s,"TorsoNode","BloxdBlock",{blockName:"Cedar Ladder",size:1.25,meshOffset:[0,0,0]},[0,-0.5,-0.001],[0,0,0])
api.updateEntityNodeMeshAttachment(s,"ArmLeftMesh","BloxdBlock",{blockName:"Fallen Pine Cone",size:1.5,meshOffset:[0,0,0]},[0,-0.75,0.25],[0,1.57,Math.PI+0.5])
api.updateEntityNodeMeshAttachment(s,"ArmRightMesh","BloxdBlock",{blockName:"Fallen Pine Cone",size:1.5,meshOffset:[0,0,0]},[0,-0.75,0.25],[0,1.57,Math.PI+0.5])
api.updateEntityNodeMeshAttachment(s,"LegLeftMesh","BloxdBlock",{blockName:"Gold Antlers",size:0.4,meshOffset:[0,0,0]},[-0.7,-1,0.65],[1.57+0.3,0,0])
api.updateEntityNodeMeshAttachment(s,"LegRightMesh","BloxdBlock",{blockName:"Gold Antlers",size:0.4,meshOffset:[0,0,0]},[0.7,-1,0.65],[1.57+0.3,0,0])
i[0] = 1
} else if (i[0] == 1){
if (trgt == "null")trgt = dists()
let yv = -3*((api.getPosition(s)[1])-ny)
if (!dists() || typeof trgt == "undefined" || trgt == "null" || !v(trgt)){
ny = 50
if (!dists()){} else {
trgt = dists()}
if (Math.abs(yv)/3 > 20){
yv = 3*Math.sign(yv)
}
api.applyImpulse(s,0,yv,0)
} else {
let dis = dc([api.getPosition(trgt)[0],api.getPosition(trgt)[1]+1.25,api.getPosition(trgt)[2]],api.getPosition(s))
yv = -3*((api.getPosition(s)[1])-ny)
if (Math.abs(yv) > 16){
yv = 3*Math.sign(yv)
}
api.applyImpulse(s,0,yv,0)
if (api.now() - di > 350){
// ny = 40+(4-(Math.random()*8))
api.applyImpulse(s,rd*(dis[0]/aoa(dis)),0,rd*(dis[2]/aoa(dis)))
di = api.now()
}
if (api.now() - eint > 1000 || (aoa(dc(api.getPosition(trgt),api.getPosition(s))) > 20)){
if (!dcon){
api.setVelocity(s,0,0,0)
try{api.setVelocity(s,7*(dis[0]/aoa(dis)),0,7*(dis[2]/aoa(dis)));} catch(e){}
api.attemptApplyDamage({
eId:trgt,
hitEId:s,
attemptedDmgAmt:0,
withItem:"Black Ceramic",
bodyPartHit:undefined,
attackDir:[Math.random(),Math.random(),Math.random()],
showCritParticles:false,
reduceVerticalKbVelocity: true,
horizontalKbMultiplier:2,
verticalKbMultiplier:2,
broadcastEntityHurt:false,
attackCooldownSettings:null,
})
dcon = true}
rd = 6
trgt = dists()
ny = api.getPosition(trgt)[1]+0.5
if (api.now() - eint > 2500 && Math.abs(api.getPosition(s)[1] - ny) < 1 && aoa(dc(api.getPosition(trgt),api.getPosition(s))) < 2){
if (dcon){
let dis = dc([api.getPosition(trgt)[0],api.getPosition(trgt)[1]+1.25,api.getPosition(trgt)[2]],api.getPosition(s))
api.applyImpulse(s,rd*(dis[0]/aoa(dis)),0,rd*(dis[2]/aoa(dis)))
dcon = false
rd = -3
ny = 50
}
eint = api.now()
} else if ((api.now() - eint > 20000 || api.raycastForBlock(api.getPosition(s),[(dis[0]/aoa(dis)),0,rd*(dis[2]/aoa(dis))]) != null) || api.raycastForBlock(api.getPosition(s),[0,2,0]) != null){
if (dcon){
let dis = dc([api.getPosition(trgt)[0],api.getPosition(trgt)[1]+1.25,api.getPosition(trgt)[2]],api.getPosition(s))
api.applyImpulse(s,rd*(dis[0]/aoa(dis)),10,rd*(dis[2]/aoa(dis)))
dcon = false
rd = -3
ny = 50
}
eint = api.now()
}
}
}
}
}
}
function onPlayerJoin(p){
api.setClientOption(p,"skyBox",{type:"earth",vertexTint:[50,50,50],luminance:0.75,turbidity:30,azimuth:3443})
if (!["CobraxRebelGuyDev"].includes(api.getEntityName(p))){
api.clearInventory(p)
for (ki=1;ki<10;ki++){
if (ki < 7){
api.setItemSlot(p,ki,"Splash Instant Healing Potion II")} else {api.setItemSlot(p,ki,"Splash Speed Potion II")}}
api.setItemSlot(p,0,"M16",1,{customAttributes:{enchantments:{
"Damage":2
}}})}
api.setClientOption(p,"autoRespawn",true)
try{
api.updateEntityNodeMeshAttachment(s,"HeadMesh","BloxdBlock",{blockName:"White Concrete",size:1,meshOffset:[0,0,0]},[0,0.7,0.2],[0,0,0])
api.updateEntityNodeMeshAttachment(s,"TorsoNode","BloxdBlock",{blockName:"Cedar Ladder",size:1.25,meshOffset:[0,0,0]},[0,-0.5,-0.001],[0,0,0])
api.updateEntityNodeMeshAttachment(s,"ArmLeftMesh","BloxdBlock",{blockName:"Fallen Pine Cone",size:1.5,meshOffset:[0,0,0]},[0,-0.75,0.25],[0,1.57,Math.PI+0.5])
api.updateEntityNodeMeshAttachment(s,"ArmRightMesh","BloxdBlock",{blockName:"Fallen Pine Cone",size:1.5,meshOffset:[0,0,0]},[0,-0.75,0.25],[0,1.57,Math.PI+0.5])
api.updateEntityNodeMeshAttachment(s,"LegLeftMesh","BloxdBlock",{blockName:"Gold Antlers",size:0.4,meshOffset:[0,0,0]},[-0.7,-1,0.65],[1.57+0.3,0,0])
api.updateEntityNodeMeshAttachment(s,"LegRightMesh","BloxdBlock",{blockName:"Gold Antlers",size:0.4,meshOffset:[0,0,0]},[0.7,-1,0.65],[1.57+0.3,0,0])
} catch(e){}
api.applyEffect(p,"Damage Reduction",null,{inbuiltLevel:3})
}
function weee(){
}
function onRespawnRequest(p){
pf[p] = undefined
api.clearInventory(p)
for (ki=1;ki<10;ki++){
if (ki < 7){
api.setItemSlot(p,ki,"Splash Instant Healing Potion II")} else {api.setItemSlot(p,ki,"Splash Speed Potion II")}}
api.setItemSlot(p,0,"M16",1,{customAttributes:{enchantments:{
"Damage":2
}}})
}ā
- Telekenesis Normal Code block Code :
api.giveItem(myId,"Fireball Block",1, {customDisplayName:"Grabber" } ) api.giveItem(myId ,"Iceball Block",1, {customDisplayName:"Thrower" } )
Telekenesis World code :
const ACTIVATOR="Fireball Block",THROWER="Iceball Block",PICK_RADIUS=1.5,HOLD_DISTANCE=3,HOLD_HEIGHT=1.5,THROW_POWER=88,holding={},lastHeld={}
function release(p,t){const e=holding[p];if(!e){delete holding[p];return}if(t&&api.checkValid(e)){const i=api.getPlayerFacingInfo(p);if(i&&i.dir){const d=i.dir;api.applyImpulse(e,d[0]*THROW_POWER,Math.max(d[1],0.15)*THROW_POWER+3,d[2]*THROW_POWER)}}delete holding[p]}
function tick(){for(const p of api.getPlayerIds()){if(holding[p]){const t=holding[p];if(!api.checkValid(t)){delete holding[p];continue}const i=api.getPlayerFacingInfo(p);if(!i)continue;const c=i.camPos,d=i.dir;api.setPosition(t,c[0]+d[0]*HOLD_DISTANCE,c[1]+d[1]*HOLD_DISTANCE+HOLD_HEIGHT,c[2]+d[2]*HOLD_DISTANCE)}}}
onPlayerDamagingOtherPlayer=function(a,v){const c=api.getHeldItem(a)?.name;if(c!==lastHeld[a]){if(c!==ACTIVATOR&&holding[a])release(a,true);lastHeld[a]=c}if(c===ACTIVATOR&&!holding[a]&&api.checkValid(v))holding[a]=v}
onPlayerClick=function(p){const i=api.getHeldItem(p)?.name;if(i===THROWER&&holding[p])release(p,true)}
onPlayerJoin=(id)=>{
}- Kill Aura Code :
const allowedPlayers = ["Itz_Pika_YT"] const reach = 3 // increase reach const cps = 10 //change to the speed u wanna hit, doesnt change damage function onPlayerClick(p, alt){ if (!alt){ pos = api.getPosition(p) let Pradius = [pos[0]+reach, pos[1]+reach, pos[2]+reach] let Nradius = [pos[0]-reach, pos[1]-reach, pos[2]-reach] let entities = api.getEntitiesInRect(Pradius, Nradius).splice(!0) if (allowedPlayers.includes(api.getEntityName(p))){ for (entity of entities){ damage(p, entity)} } } } function damage(id, hId){ api.attemptApplyDamage({ eId: id, hitEId: hId, attemptedDmgAmt: 5, withItem: "Dirt", bodyPartHit: undefined, attackDir: undefined, showCritParticles: true, reduceVerticalKbVelocity: true, horizontalKbMultiplier: cps/2, verticalKbMultiplier: cps/2, broadcastEntityHurt: true, attackCooldownSettings: null, hittingSoundOverride: null, ignoreOtherEntitySettingCanAttack: false, isTrueDamage:true, damagerDbId: null}) }
Totem of Undying World code :ā
function onPlayerAttemptAltAction(id){
if (api.getHeldItem(id)?.name == "Gold Spade" &&
api.getHeldItem(id)?.attributes.customDisplayName == "Totem Of Undying" && api.getEffects(id).includes ("Totem") == false){
/* ---apply totem effect--- */
api.applyEffect(id, "Totem", null, {icon: "Gold Spade"})
slot = api.getSelectedInventorySlotI(id)
api.setItemSlot(id, slot, "Air")
}
}
function onPlayerDamagingOtherPlayer(attacker, victim, dmg) {
if (api.getHeldItem(victim)?.attributes.customDisplayName ==="Totem Of Undying" && api.getHealth(victim) - dmg < 5 || api.getEffects(victim).includes('Totem')
&& api.getHealth(victim) - dmg < 5) {
/* ---TOTEM WORK--- */
const pos = api.getPosition(victim);
api.applyEffect(victim, 'Health Regen', 5000, {inbuiltLevel: 1});
api.applyEffect(victim, "Heat Resistance", 10000, {inbuiltLevel: 1})
api.applyEffect(victim, "Damage Reduction", 5000, {inbuiltLevel: 1})
api.setHealth(victim, 30)
api.setShieldAmount(victim, 30);
particle(pos[0], pos[1], pos[2]);
if (api.getHeldItem(victim)?.attributes.customDisplayName ==="Totem Of Undying"){
slot = api.getSelectedInventorySlotI(victim)
api.setItemSlot(victim, slot, "Air")}
else {api.removeEffect(victim, 'Totem');}
}
}
function onMobDamagingPlayer(attacker, victim, dmg) {
if (api.getHeldItem(victim)?.attributes.customDisplayName ==="Totem Of Undying" && api.getHealth(victim) - dmg < 5 || api.getEffects(victim).includes('Totem')
&& api.getHealth(victim) - dmg < 5) {
/* ---TOTEM WORK--- */
const pos = api.getPosition(victim);
api.applyEffect(victim, 'Health Regen', 5000, {inbuiltLevel: 1});
api.applyEffect(victim, "Heat Resistance", 10000, {inbuiltLevel: 1})
api.applyEffect(victim, "Damage Reduction", 5000, {inbuiltLevel: 1})
api.setHealth(victim, 30)
api.setShieldAmount(victim, 30);
particle(pos[0], pos[1], pos[2]);
if (api.getHeldItem(victim)?.attributes.customDisplayName ==="Totem Of Undying"){
slot = api.getSelectedInventorySlotI(victim)
api.setItemSlot(victim, slot, "Air")}
else {api.removeEffect(victim, 'Totem');}
}
}
function particle(x, y, z){
y += 1
api.playParticleEffect({
dir1: [-1, -1, -1],
dir2: [1, 1, 1],
pos1: [x + 2, y + 1.5, z + 2],
pos2: [x - 2, y - 1.5, z - 2],
texture: "glint",
minLifeTime: 0.5,
maxLifeTime: 2,
minEmitPower: 4,
maxEmitPower: 6,
minSize: 0.1,
maxSize: 0.5,
manualEmitCount: 85,
gravity: [0, -10, 0],
colorGradients: [
{
timeFraction: 0,
minColor: [211, 214, 0, 0.5],
maxColor: [0, 255, 0, 0.8],
},
],
velocityGradients: [
{
timeFraction: 1,
factor: 0.2,
factor2: 1,
},
],
blendMode: 1,
})
}
Totem of Undying Normal Code :
api.giveItem(myId, "Gold Spade", 50, {customDisplayName: "Totem Of Undying", customDescription: "Save yourself from dying"})
TNT Minecarts Code :
var __initMobs__=[],ticks=0,minecarts=[],customDrops={"Spawn Block (Gray)":{customDisplayName:"Rail",customDescription:"Place to let minecarts roll on it."},"Spawn Block (Orange)":{customDisplayName:"Powered Rail",customDescription:"Place to speed minecarts up."}},customCrafts={"Gray Quick Paintball Explosive Item":{att:{customDisplayName:"TNT Minecart",customDescription:"Place on rails. Hit it to blow it up."},amt:1,req:[{name:"Moonstone Explosive",amt:1},{name:"Iron Bar",amt:5}]},"Spawn Block (Gray)":{att:{customDisplayName:"Rail",customDescription:"Place to let minecarts roll on it."},amt:16,req:[{name:"Stick",amt:1},{name:"Iron Bar",amt:6}]},"Spawn Block (Orange)":{att:{customDisplayName:"Powered Rail",customDescription:"Place to speed minecarts up."},amt:16,req:[{name:"Stick",amt:1},{name:"Gold Bar",amt:6}]}};function tick(){for(m of(ticks++,__initMobs__))api.updateEntityNodeMeshAttachment(m.id,"HeadMesh","BloxdBlock",{blockName:"Moonstone Explosive",size:.6}),api.updateEntityNodeMeshAttachment(m.id,"LegLeftMesh","BloxdBlock",{blockName:"Block of Iron",size:1}),api.applyEffect(m.id,"Invisible",null,{}),m.time+5<ticks&&(__initMobs__=__initMobs__.filter((t=>t.id!=m.id)));for(let t of minecarts){if(!api.getMobIds().includes(t.id))continue;let e=api.getPosition(t.id),[i,a,o]=e,n=api.getBlock(e[0],e[1]-1,e[2]).split("|");void 0===n[2]&&(n[2]="rot1");let s=n[2].slice(3);if("Spawn Block (Gray)"==n[0]){let i={x:0,z:0};if(1==s&&(i.z=-1),2==s&&(i.x=-1),3==s&&(i.z=1),4==s&&(i.x=1),1!=s&&3!=s||(e[0]=Math.floor(e[0])+.5),2!=s&&4!=s||(e[2]=Math.floor(e[2])+.5),api.setPosition(t.id,e[0],e[1],e[2]),t.speed<=0)continue;t.lastRot!=i&&(i.z!=t.lastRot.z?i.x=0:i.x!=t.lastRot.x&&(i.z=0)),api.applyImpulse(t.id,t.speed*i.x,0,t.speed*i.z),t.speed-=.1,t.lastRot=i}if("Spawn Block (Orange)"==n[0]){let i={x:0,z:0};1==s&&(i.z=-1),2==s&&(i.x=-1),3==s&&(i.z=1),4==s&&(i.x=1),1!=s&&3!=s||(e[0]=Math.floor(e[0])+.5),2!=s&&4!=s||(e[2]=Math.floor(e[2])+.5),api.setPosition(t.id,e[0],e[1],e[2]),t.speed=2,t.lastRot!=i&&(i.z!=t.lastRot.z?i.x=0:i.x!=t.lastRot.x&&(i.z=0)),api.applyImpulse(t.id,t.speed*i.x,0,t.speed*i.z),t.lastRot=i}}}function onWorldSpawnMob(t){api.despawnMob(t)}function onPlayerClick(t,e){if(e&&"Gray Quick Paintball Explosive Item"==api.getHeldItem(t)?.name&&api.getPlayerTargetInfo(t)?.position){var[i,a,o]=api.getPlayerTargetInfo(t)?.position;if(null!=i&&api.getBlock([i,a,o]).includes("Spawn Block (")){let e=api.attemptSpawnMob("Draugr Zombie",i+.5,a+1,o+.5,{spawnerId:t,name:"TNT Minecart",playSoundOnSpawn:!1});e&&(api.setMobSetting(e,"metaInfo","tnt-minecart"),api.removeItemName(t,"Gray Quick Paintball Explosive Item",1))}}}function onPlayerChangeBlock(t,e,i,a,o,n,s){if(Object.keys(customDrops).includes(s))return null!=s?(api.createItemDrop(e+.5,i+.5,a+.5,s,1,!1,customDrops[s]),"preventDrop"):void 0}function onPlayerJoin(t){for(const e of Object.keys(customCrafts)){const i=customCrafts[e];let a={requires:[],produces:void 0};for(const t of i.req)a.requires.push({items:[t.name],amt:t.amt});a.produces=i.amt,a.station=i.station,api.editItemCraftingRecipes(t,e,[a])}}function onPlayerAttemptCraft(t,e){const i=customCrafts[e];if(i){for(const e of i.req)api.removeItemName(t,e.name,e.amt);return api.giveItem(t,e,i.amt,i.att),"preventCraft"}}function onMobKilledOtherMob(t,e){minecarts.includes(e)&&(minecarts=minecarts.filter((t=>t.id!=e)))}function onMobDespawned(t){minecarts.includes(t)&&(minecarts=minecarts.filter((e=>e.id!=t)))}onPlayerSpawnMob=(t,e,i,a,o,n,s,r)=>{"TNT Minecart"==api.getMobSetting(e,"name")&&(api.setMobSetting(e,"onDeathItemDrops",[{itemName:"Raw Porkchop",probabilityOfDrop:0,dropMinAmount:1,dropMaxAmount:3}]),api.setMobSetting(e,"walkingSpeedMultiplier",0),api.setMobSetting(e,"runningSpeedMultiplier",0),api.setMobSetting(e,"metaInfo","tnt-minecart"),api.setMobSetting(e,"attackRadius",0),api.setMobSetting(e,"jumpMultiplier",0),api.setMobSetting(e,"name",""),api.setMobSetting(e,"idleSound",null),__initMobs__.push({id:e,time:ticks}),minecarts.push({id:e,speed:0,lastRot:{x:0,z:0}}))},onPlayerDamagingMob=(t,e,i,a)=>{let o=api.getMobSetting(e,"metaInfo");if("Draugr Zombie"!=api.getEntityType(e)||"tnt-minecart"!=o)return;let[n,s,r]=api.getPosition(e);const l=Math.min(10,6+Math.floor(i/10)),p=api.getEntitiesInRect([n-l,s-l,r-l],[n+l,s+l,r+l]);for(const i of p){if(i===e)continue;if("Player"!=api.getEntityType(i))continue;const[a,o,p]=api.getPosition(i),m=a-n,c=o-s,u=p-r,d=Math.sqrt(m*m+c*c+u*u);if(d>l||0===d)continue;const f=1-d/l,M=Math.ceil(100*f);api.attemptApplyDamage({eId:t,hitEId:i,attemptedDmgAmt:M,withItem:"Gray Quick Paintball Explosive Item",isTrueDamage:!1,broadcastEntityHurt:!0});const b=30*f,g=m/d*b,y=15*f,k=u/d*b;api.applyImpulse(i,g,y,k)}s+=1,api.playParticleEffect({dir1:[-1,-1,-1],dir2:[1,1,1],pos1:[n,s,r],pos2:[n,s,r],texture:"generic_2",minLifeTime:1,maxLifeTime:1.5,minEmitPower:30,maxEmitPower:40,minSize:.25,maxSize:.35,manualEmitCount:750,gravity:[0,-1,0],colorGradients:[{timeFraction:0,minColor:[255,255,255,1],maxColor:[100,100,100,.5]}],velocityGradients:[{timeFraction:0,factor:1,factor2:1}],blendMode:1}),api.despawnMob(e),minecarts.filter((t=>t!=e)),__initMobs__=__initMobs__.filter((t=>t!=e)),api.broadcastSound("cannonFire3",1,1)};
Fireworks World code :
onPlayerAltAction=(pid)=>{
let item=api.getHeldItem(pid)
if(item?.attributes.customDisplayName ==="Firework Rocket"){
api.removeItemName(pid, "Arrow of Heat Resistance", 1)
let k = api.getPlayerFacingInfo(pid)?.dir
api.applyImpulse(pid,...k.map(v=>v*50))
let [x, y, z] = api.getPosition(pid)
api.playParticleEffect({
dir1: [0, 0, 0],
dir2: [1, 10, 1],
pos1: [x, y, z],
pos2: [x, y, z],
texture: "glint",
minLifeTime: 0.5,
maxLifeTime: 4,
minEmitPower: 0.5,
maxEmitPower: 2,
minSize: 0.5,
maxSize: 1,
manualEmitCount: 10,
gravity: [0, 5, 0],
colorGradients: [
{
timeFraction: 0,
minColor: [200, 200, 200, 0, 1], // Assuming alpha is the 4th or 5th component
maxColor: [255, 255, 255, 1], // Ensure color array lengths are consistent if alpha is intended
},
],
velocityGradients: [
{
timeFraction: 0,
factor: 1,
factor2: 1,
},
],
blendMode: 1, // Assuming 1 is a valid blend mode (e.g., Additive)
});
}}Fireworks and elytra normal code block code :
api.giveItem(myId, "Arrow of Heat Resistance", 999, {customDisplayName: "Firework Rocket"})
api.giveItem(myId, "Diamond Hang Glider", 1, {customDisplayName: "Elytra"})- Golem spawning code
var k = api.attemptSpawnMob("Cave Golem", -12, 9, -94)
api.log(k)2. Lava golem code
api.updateEntityNodeMeshAttachment(k, "HeadMesh", "BloxdBlock",{blockName:"Magma",size:0.9,meshOffset:[0,0,0]},[0,0.2,0],[0,0,0])
api.updateEntityNodeMeshAttachment(k, "ArmRightMesh", "BloxdBlock",{blockName:"Magma",size:0.7,meshOffset:[0,0,0]},[-0.2,-0.7,0],[0,0,0])
api.updateEntityNodeMeshAttachment(k, "ArmLeftMesh", "BloxdBlock",{blockName:"Magma",size:0.7,meshOffset:[0,0,0]},[0.2,-0.7,0],[0,0,0])
api.updateEntityNodeMeshAttachment(k, "LegRightMesh", "BloxdBlock",{blockName:"Magma",size:0.7,meshOffset:[0,0,0]},[0,-0.5,0],[0,0,0])
api.updateEntityNodeMeshAttachment(k, "LegLeftMesh", "BloxdBlock",{blockName:"Magma",size:0.7,meshOffset:[0,0,0]},[0,-0.5,0],[0,0,0])
api.setMobSetting(k, "maxHealth", 2000)
api.setMobSetting(k, "initialHealth", 2000)
api.setHealth(k, 2000)
api.setMobSetting(k, "attackDamage", 25)
api.setMobSetting(k, "attackRadius", 3)
api.setMobSetting(k, "hostilityRadius", 10)
api.setMobSetting(k, "chaseRadius", 5)
api.setMobSetting(k, "onDeathItemDrops", [
{
itemName: "Diamond",
probabilityOfDrop: 1,
dropMinAmount: 2,
dropMaxAmount: 4,
},
])
api.setMobSetting(k, "onDeathAura", 40)
api.setMobSetting(k, "baseRunningSpeed", 5)
api.setMobSetting(k, "baseWalkingSpeed", 2)