2022-09-15 11:58:52 -04:00
nonAdjacentCoords = [
[ 1 , 1 ] ,
[ 1 , - 1 ] ,
[ - 1 , 1 ] ,
[ - 1 , - 1 ]
] ;
2022-01-27 20:41:55 -05:00
//pyrotheum
elements . blazing _pyrotheum = {
color : "#ffdd55" ,
2022-09-15 11:58:52 -04:00
behavior : behaviors . LIQUID ,
2022-01-27 20:41:55 -05:00
tick : function ( pixel ) {
if ( pixel . temp >= - 273 && pixel . temp <= 3707 ) { //temperature minimum of 3727
2022-02-07 02:11:25 -05:00
pixel . temp += 50
} else if ( pixel . temp > 3677 && pixel . temp < 3727 ) {
2022-01-27 20:41:55 -05:00
pixel . temp = 3727
}
2022-09-15 11:58:52 -04:00
var pX = pixel . x ;
var pY = pixel . y ;
for ( i = 0 ; i < adjacentCoords . length ; i ++ ) {
var oX = adjacentCoords [ i ] [ 0 ] ;
var oY = adjacentCoords [ i ] [ 1 ] ;
var fX = pX + oX ;
var fY = pY + oY ;
if ( ! isEmpty ( fX , fY , true ) ) {
var checkPixel = pixelMap [ fX ] [ fY ] ;
2022-09-15 12:39:21 -04:00
var thisElementName = pixel . element ;
var otherElementName = checkPixel . element ;
var thisElement = elements [ pixel . element ] ;
var otherElement = elements [ checkPixel . element ] ;
thisElementName === otherElementName ? checkPixel . temp += 0.1 : checkPixel . temp == 10 ;
2022-09-15 11:58:52 -04:00
} else if ( isEmpty ( fX , fY , false ) ) {
if ( Math . random ( ) < 0.05 ) {
createPixel ( "fire" , fX , fY ) ;
var checkPixel = pixelMap [ fX ] [ fY ] ;
checkPixel . temp = pixel . temp ;
}
} ;
} ;
2022-01-27 20:41:55 -05:00
} ,
2022-02-07 02:00:01 -05:00
viscosity : 1.2 * * 4 ,
2022-01-27 20:41:55 -05:00
category : "liquids" ,
2022-02-07 02:00:01 -05:00
state : "liquid" ,
2022-01-27 20:41:55 -05:00
density : 1994 ,
insulate : false ,
temp : 3727 ,
} ,
elements . gelid _cryotheum = {
color : "#00ddff" ,
2022-09-15 11:58:52 -04:00
behavior : behaviors . LIQUID ,
2022-01-27 20:41:55 -05:00
tick : function ( pixel ) {
2022-02-07 02:11:25 -05:00
if ( pixel . temp >= - 223 ) { //temperature maximum of -223
pixel . temp -= 50
} else if ( pixel . temp > - 223 && pixel . temp < - 273 ) {
2022-01-27 20:41:55 -05:00
pixel . temp = - 223
}
2022-09-15 11:58:52 -04:00
var pX = pixel . x ;
var pY = pixel . y ;
for ( i = 0 ; i < adjacentCoords . length ; i ++ ) {
var oX = adjacentCoords [ i ] [ 0 ] ;
var oY = adjacentCoords [ i ] [ 1 ] ;
var fX = pX + oX ;
var fY = pY + oY ;
if ( ! isEmpty ( fX , fY , true ) ) {
var checkPixel = pixelMap [ fX ] [ fY ] ;
var thisElementName = pixel . element ;
var otherElementName = checkPixel . element ;
var thisElement = elements [ pixel . element ] ;
var otherElement = elements [ checkPixel . element ] ;
thisElementName === otherElementName ? checkPixel . temp -= 0.1 : checkPixel . temp -= 10 ;
} ;
} ;
/ * f o r ( i = 0 ; i < n o n A d j a c e n t C o o r d s . l e n g t h ; i + + ) {
var oX = nonAdjacentCoords [ i ] [ 0 ] ;
var oY = nonAdjacentCoords [ i ] [ 1 ] ;
var fX = pX + oX ;
var fY = pY + oY ;
if ( isEmpty ( fX , fY , false ) ) {
if ( Math . random ( ) < 0.025 ) {
createPixel ( "snow" , fX , fY ) ;
var checkPixel = pixelMap [ fX ] [ fY ] ;
checkPixel . temp = pixel . temp ;
} ;
} ;
} ; * / / / It should create snow , but the snow freezes into ice and it leaves unsightly floating ice everywhere .
2022-01-27 20:41:55 -05:00
} ,
2022-02-07 02:00:01 -05:00
viscosity : 3 * * 4 ,
2022-01-27 20:41:55 -05:00
category : "liquids" ,
2022-02-07 02:00:01 -05:00
state : "liquid" ,
2022-01-27 20:41:55 -05:00
density : 3988 ,
insulate : false ,
temp : - 223 ,
} ,
elements . tectonic _petrotheum = {
color : [ "#342414" , "#3C2414" , "#2C1C14" , "#543424" , "#643C28" , "#74442C" ] ,
behavior : [
"XX|XX|XX" ,
"M2|XX|M2" ,
"M1|M1|M1" ,
] ,
2022-09-02 15:40:47 -04:00
tick : function ( pixel ) { //Code from R74n/vanilla "smash" tool
2022-09-15 12:39:21 -04:00
var pX = pixel . x ;
var pY = pixel . y ;
for ( i = 0 ; i < adjacentCoords . length ; i ++ ) {
var oX = adjacentCoords [ i ] [ 0 ] ;
var oY = adjacentCoords [ i ] [ 1 ] ;
var fX = pX + oX ;
var fY = pY + oY ;
if ( ! isEmpty ( fX , fY , true ) ) {
var checkPixel = pixelMap [ fX ] [ fY ] ;
var thisElementName = pixel . element ;
var otherElementName = checkPixel . element ;
var thisElement = elements [ pixel . element ] ;
var otherElement = elements [ checkPixel . element ] ;
if ( typeof ( otherElement . breakInto ) !== "undefined" ) {
2022-09-02 15:40:47 -04:00
var hardness = null ;
2022-09-15 12:39:21 -04:00
if ( typeof ( otherElement . hardness ) === "number" ) {
hardness = otherElement . hardness ;
2022-09-02 15:40:47 -04:00
} else {
2022-09-15 12:39:21 -04:00
hardness = 1 ;
} ;
2022-09-02 15:40:47 -04:00
if ( Math . random ( ) < hardness ) {
2022-09-15 12:39:21 -04:00
var breakInto = otherElement . breakInto ;
2022-09-02 15:40:47 -04:00
// if breakInto is an array, pick one
if ( Array . isArray ( breakInto ) ) {
breakInto = breakInto [ Math . floor ( Math . random ( ) * breakInto . length ) ] ;
} ;
2022-09-15 12:39:21 -04:00
changePixel ( checkPixel , breakInto ) ;
2022-09-02 15:40:47 -04:00
}
}
2022-09-15 12:39:21 -04:00
} ;
} ;
2022-09-02 15:40:47 -04:00
} ,
2022-01-27 20:41:55 -05:00
temp : 120 ,
2022-02-07 02:00:01 -05:00
viscosity : 1.5 * * 4 ,
2022-01-27 20:41:55 -05:00
category : "liquids" ,
2022-02-07 02:00:01 -05:00
state : "liquid" ,
2022-01-27 20:41:55 -05:00
density : 3988 ,
insulate : false ,
} ,
elements . zephyrean _aerotheum = {
color : [ "#FFFCD9" , "#FEFFFC" , "#FDFFDB" , "#FFFFE8" , "#FBF6D3" , "#F1EDD0" ] ,
behavior : behaviors . AGLIQUID ,
2022-02-07 02:00:01 -05:00
viscosity : 0.1 * * 4 ,
2022-01-27 20:41:55 -05:00
category : "liquids" ,
2022-02-07 02:00:01 -05:00
state : "liquid" ,
density : - 800 ,
2022-01-27 20:41:55 -05:00
insulate : false ,
2022-09-15 12:39:21 -04:00
} ;
if ( enabledMods . includes ( "mods/velocity.js" ) ) {
elements . zephyrean _aerotheum . tick = function ( pixel ) {
//"Projectiles that come into contact with zephyrean aerotheum are sent flying in a random direction away from the fluid."
var pX = pixel . x ;
var pY = pixel . y ;
for ( i = 0 ; i < adjacentCoords . length ; i ++ ) {
var oX = adjacentCoords [ i ] [ 0 ] ;
var oY = adjacentCoords [ i ] [ 1 ] ;
var fX = pX + oX ;
var fY = pY + oY ;
if ( ! isEmpty ( fX , fY , true ) ) {
var checkPixel = pixelMap [ fX ] [ fY ] ;
var thisElementName = pixel . element ;
var otherElementName = checkPixel . element ;
var thisElement = elements [ pixel . element ] ;
var otherElement = elements [ checkPixel . element ] ;
if ( otherElement . movable ) {
if ( typeof ( checkPixel . vx ) === "undefined" ) {
checkPixel . vx = 0 ;
} ;
if ( typeof ( checkPixel . vy ) === "undefined" ) {
checkPixel . vy = 0 ;
} ;
if ( Math . random ( ) < 1 / 3 ) {
var randomVxChange = Math . floor ( Math . random ( ) * 9 ) - 4 ; //random value from -3 to 3
var randomVyChange = Math . floor ( Math . random ( ) * 9 ) - 4 ; //different random value from -3 to 3
//Notes
/ *
Positive vx = right
Positive vy = down
adjacentCoords [ 0 ] : [ 0 , 1 ] is downward ; when it is detected , the pixel there should be sent farther down ( positive vy ) .
adjacentCoords [ 1 ] : [ 0 , - 1 ] is upward ; when it is detected , the pixel there should be sent farther up ( negative vy ) .
adjacentCoords [ 2 ] : [ 1 , 0 ] is rightward ; when it is detected , the pixel there should be sent farther right ( positive vx ) .
adjacentCoords [ 3 ] : [ - 1 , 0 ] is leftward ; when it is detected , the pixel there should be sent farther left ( negative vx ) .
* /
switch ( i ) {
case 0 :
randomVyChange = Math . abs ( randomVyChange ) ;
break ;
case 1 :
randomVyChange = ( Math . abs ( randomVyChange ) * - 1 ) - 1 ;
break ;
case 2 :
randomVxChange = Math . abs ( randomVxChange ) ;
break ;
case 3 :
randomVxChange = Math . abs ( randomVxChange ) * - 1 ;
break ;
default :
console . log ( "Uh-oh, i was somehow above 3!" )
} ;
if ( otherElementName !== thisElementName ) {
checkPixel . vx += randomVxChange ;
checkPixel . vy += randomVyChange ;
}
}
} ;
} ;
} ;
} ;
} ;
2022-01-27 20:41:55 -05:00
elements . energized _glowstone = {
color : [ "#fbb204" , "#fcf605" , "#fce704" , "#f8c414" , "#f8e814" ] ,
behavior : [
"M1 AND SW:light|M1 AND CR:light%40 AND SW:light|M1 AND SW:light" ,
"M2 AND CR:light%40|XX|M2 AND CR:light%40" ,
"XX|CR:light%40|XX" ,
] ,
2022-02-07 02:00:01 -05:00
viscosity : 0.1 * * 4 ,
2022-01-27 20:41:55 -05:00
category : "liquids" ,
2022-02-07 02:00:01 -05:00
state : "liquid" ,
density : - 500 ,
2022-02-07 02:11:25 -05:00
insulate : false , //TODO: > Energized glowstone source blocks will gradually float upwards if there are no blocks above them. If they float at high levels (layers 120 and above by default) they will condense back into solid glowstone. They will also condense at 80% of this height if the fluid has no space to flow.
2022-02-07 02:00:01 -05:00
} ,
2022-01-27 20:41:55 -05:00
2022-02-07 02:00:01 -05:00
elements . resonant _ender = {
color : [ "#062c2c" , "#062c2c" , "#19a8a8" , "#0a4646" , "#1f8c8e" , "#0c5c54" , "#0c5c54" ] ,
behavior : behaviors . LIQUID ,
tick : function ( pixel ) {
for ( let i = - 2 ; i < 3 ; i ++ ) {
for ( let j = - 2 ; j < 3 ; j ++ ) {
if ( ! isEmpty ( pixel . x + j , pixel . y + i ) && ! outOfBounds ( pixel . x + j , pixel . y + i ) ) {
if ( lifeArray . includes ( pixelMap [ pixel . x + j ] [ pixel . y + i ] . element ) ) {
pixel . eeex = pixel . x + Math . floor ( Math . random ( ) * ( ( 2 * 8 ) + 1 ) ) - 8
pixel . eeey = pixel . y + Math . floor ( Math . random ( ) * ( ( 2 * 8 ) + 1 ) ) - 8
//if human
//handle heads
if ( pixelMap [ pixel . x + j ] [ pixel . y + i ] . element == "head" ) {
if ( isEmpty ( pixel . eeex , pixel . eeey ) && ! outOfBounds ( pixel . eeex , pixel . eeey ) && isEmpty ( pixel . eeex , pixel . eeey + 1 ) && ! outOfBounds ( pixel . eeex , pixel . eeey + 1 ) ) {
tryMove ( pixelMap [ pixel . x + j ] [ pixel . y + i ] , pixel . eeex , pixel . eeey )
tryMove ( pixelMap [ pixel . x + j ] [ pixel . y + i + 1 ] , pixel . eeex , pixel . eeey + 1 )
}
} else if ( pixelMap [ pixel . x + j ] [ pixel . y + i ] . element == "body" ) {
} else {
if ( isEmpty ( pixel . eeex , pixel . eeey ) && ! outOfBounds ( pixel . eeex , pixel . eeey ) ) {
tryMove ( pixelMap [ pixel . x + j ] [ pixel . y + i ] , pixel . eeex , pixel . eeey )
}
}
}
}
}
}
} ,
category : "liquids" ,
density : 3000 ,
state : "liquid" ,
viscosity : 3 * * 4 ,
}
2022-02-11 22:43:24 -05:00
2022-02-15 08:23:10 -05:00
if ( enabledMods . includes ( "minecraft.js" ) ) {
minecraftModEnabled = true
} else {
minecraftModEnabled = false
}
2022-02-11 22:43:24 -05:00
runAfterLoad ( function ( ) {
lifeArray = Object . keys ( elements ) . filter ( function ( e ) {
return elements [ e ] . category == "life" ;
} ) ;
2022-02-15 08:23:10 -05:00
if ( minecraftModEnabled == true ) {
elements . redstone _dust . tempHigh = 2500
elements . redstone _dust . stateHigh = "destabilized_redstone"
elements . destabilized _redstone = {
color : [ "#9e0303" , "#98061a" , "#b80704" , "#c4020c" , "#f70008" , "#9e0303" , "#98061a" , "#b80704" , "#e3020a" , "#8c0303" , "#8c0303" ] ,
behavior : [
"XX|SH|XX" ,
"M2 AND SH|XX|M2 AND SH" ,
"M1|M1 AND SH|M1" ,
] ,
viscosity : 1.5 * * 4 ,
category : "liquids" ,
state : "liquid" ,
density : 1200 ,
}
elements . signalum = {
color : "#ff9321" ,
behavior : behaviors . WALL ,
category : "solids" ,
density : 10500 ,
conduct : 1 ,
tempHigh : 1550 ,
stateHigh : "molten_signalum" ,
state : "solid" ,
}
if ( ! elements . molten _sterling ) {
elements . molten _sterling = {
"color" : [ "#FFA53C" , "#FF843C" , "#FF6300" , "#FFFF71" , "#FFE871" , "#FFAE00" , "#FFEB5C" , "#FFB55C" , "#FF8D00" ] ,
"behavior" : behaviors . MOLTEN ,
"temp" : 802 ,
"tempLow" : 702 ,
"stateLow" : "sterling" ,
"viscosity" : 10000 ,
"hidden" : true ,
"state" : "liquid" ,
"category" : "molten" ,
"density" : 9337.7 ,
"conduct" : 1 ,
"reactions" : {
"ash" : {
"elem1" : null ,
"elem2" : "molten_slag"
} ,
"dust" : {
"elem1" : null ,
"elem2" : "molten_slag"
} ,
"magma" : {
"elem1" : null ,
"elem2" : "molten_slag"
}
}
}
}
if ( ! elements . molten _sterling . reactions ) {
elements . molten _sterling . reactions = { }
}
elements . molten _sterling . reactions . destabilized _redstone = { "elem1" : null , "elem2" : "molten_signalum" }
elements . molten _signalum = {
color : "#f17414" ,
behavior : behaviors . MOLTEN ,
density : 10500 * 0.9 ,
conduct : 0.30 ,
temp : 600 ,
tempLow : 550 ,
stateLow : "signalum" ,
category : "liquids" ,
state : "liquid" ,
hidden : true ,
}
if ( ! elements . energized _glowstone . reactions ) {
elements . energized _glowstone . reactions = { }
}
elements . energized _glowstone . reactions . gelid _cryotheum = { "elem1" : "glowstone_dust" }
} ;
2022-02-11 22:43:24 -05:00
} ) ;