2626import com .sk89q .worldedit .registry .state .BooleanProperty ;
2727import com .sk89q .worldedit .registry .state .EnumProperty ;
2828import com .sk89q .worldedit .registry .state .Property ;
29+ import com .sk89q .worldedit .world .block .BlockCategories ;
2930import com .sk89q .worldedit .world .block .BlockState ;
31+ import com .sk89q .worldedit .world .block .BlockType ;
3032import com .sk89q .worldedit .world .block .BlockTypes ;
3133
3234import java .util .Locale ;
33- import java .util .Map ;
3435
3536public class SnowSimulator implements LayerFunction {
3637
@@ -120,22 +121,19 @@ public boolean apply(BlockVector3 position, int depth) throws WorldEditException
120121 abovePosition ) > 10 ) {
121122 return false ;
122123 } else if (!block .getBlockType ().getMaterial ().isFullCube ()) {
123- Map < Property <?>, Object > states = block .getStates ();
124- if (states . containsKey (slab ) && block .getState (slab ).equalsIgnoreCase ("bottom" )) {
124+ BlockType type = block .getBlockType ();
125+ if (type . hasProperty (slab ) && block .getState (slab ).equalsIgnoreCase ("bottom" )) {
125126 return false ;
126- } else if (states . containsKey (trapdoorOpen ) && states . containsKey ( trapdoor ) && ( block .getState (trapdoorOpen )
127- || block .getState (trapdoor ).equalsIgnoreCase ("bottom" ))) {
127+ } else if (( type . hasProperty (trapdoorOpen ) && block .getState (trapdoorOpen )) ||
128+ ( type . hasProperty ( trapdoor ) && block .getState (trapdoor ).equalsIgnoreCase ("bottom" ))) {
128129 return false ;
129- } else if (states . containsKey (stair ) && block .getState (stair ).equalsIgnoreCase ("bottom" )) {
130+ } else if (type . hasProperty (stair ) && block .getState (stair ).equalsIgnoreCase ("bottom" )) {
130131 return false ;
131132 } else {
132133 return false ;
133134 }
134135 //FAWE end
135- } else if (!block .getBlockType ().id ().toLowerCase (Locale .ROOT ).contains ("ice" ) && block
136- .getBlockType ()
137- .getMaterial ()
138- .isTranslucent ()) {
136+ } else if (!BlockCategories .SNOW_LAYER_CAN_SURVIVE_ON .contains (block .getBlockType ())) {
139137 return false ;
140138 }
141139
@@ -144,14 +142,14 @@ public boolean apply(BlockVector3 position, int depth) throws WorldEditException
144142 // We've hit the highest layer (If it doesn't contain current + 2 it means it's 1 away from full)
145143 if (!snowLayersProperty .getValues ().contains (currentHeight + 2 )) {
146144 if (this .extent .setBlock (abovePosition , snowBlock )) {
147- if (block .getStates ().containsKey (snowy )) {
145+ if (block .getBlockType ().hasProperty (snowy )) {
148146 this .extent .setBlock (position , block .with (snowy , true ));
149147 }
150148 this .affected ++;
151149 }
152150 } else {
153151 if (this .extent .setBlock (abovePosition , above .with (snowLayersProperty , currentHeight + 1 ))) {
154- if (block .getStates ().containsKey (snowy )) {
152+ if (block .getBlockType ().hasProperty (snowy )) {
155153 this .extent .setBlock (position , block .with (snowy , true ));
156154 }
157155 this .affected ++;
@@ -160,7 +158,7 @@ public boolean apply(BlockVector3 position, int depth) throws WorldEditException
160158 return false ;
161159 }
162160 if (this .extent .setBlock (abovePosition , snow )) {
163- if (block .getStates ().containsKey (snowy )) {
161+ if (block .getBlockType ().hasProperty (snowy )) {
164162 this .extent .setBlock (position , block .with (snowy , true ));
165163 }
166164 this .affected ++;
0 commit comments