| 
					
				 | 
			
			
				@@ -120,7 +120,10 @@ import net.minecraft.util.Direction; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import net.minecraft.util.NonNullList; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import net.minecraft.util.ResourceLocation; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import net.minecraft.util.SoundEvent; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+import net.minecraft.util.math.BlockRayTraceResult; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import net.minecraft.util.math.MathHelper; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+import net.minecraft.util.math.RayTraceContext; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+import net.minecraft.util.math.RayTraceResult; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import net.minecraft.util.text.ITextComponent; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import net.minecraft.util.text.StringTextComponent; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import net.minecraft.util.text.Style; 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -128,9 +131,10 @@ import net.minecraft.util.text.TextFormatting; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import net.minecraft.util.text.event.ClickEvent; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import net.minecraft.util.text.event.HoverEvent; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import net.minecraft.world.Difficulty; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+import net.minecraft.world.GameRules; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import net.minecraft.world.GameType; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import net.minecraft.world.IWorld; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-import net.minecraft.world.ServerWorld; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+import net.minecraft.world.server.ServerWorld; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import net.minecraft.world.storage.WorldInfo; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 public class MinecraftFunctions 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -307,7 +311,6 @@ public class MinecraftFunctions 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             ((PlayerEntity) in[0].get(sc)).getFoodStats().setFoodLevel(in[1].getInt(sc));  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             return Void.TYPE;  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         }); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        ; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         sm.registerFunction("player.getsaturation", (sc, in) -> (double) ((PlayerEntity) in[0].get(sc)).getFoodStats().getSaturationLevel()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         sm.registerFunction("player.setsaturation", (sc, in) ->  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         {  
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -319,7 +322,7 @@ public class MinecraftFunctions 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             Object o = in[0].get(sc); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             if(o instanceof PlayerEntity) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                return ((PlayerEntity) o).getName(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                return ((PlayerEntity) o).getName().getFormattedText(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             return server.getPlayerProfileCache().getProfileByUUID(getUUID(o.toString())).getName(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         }); 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -332,7 +335,7 @@ public class MinecraftFunctions 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             return playerBank.getUUID(o.toString()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         }); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        sm.registerFunction("player.getid", (sc, in) -> getId(playerBank, in[0].get(sc))); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        sm.registerFunction("player.getid", (sc, in) -> (double) getId(playerBank, in[0].get(sc))); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         sm.registerFunction("player.get", (sc, in) -> server.getPlayerList().getPlayerByUUID(getUUID(in[0].get(sc)))); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         sm.registerFunction("player.getuuidfromid", (sc, in) -> playerBank.getUUIDfromID(in[0].getInt(sc))); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         sm.registerFunction("player.getnamefromid", (sc, in) -> playerBank.getNamefromID(in[0].getInt(sc))); 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -403,12 +406,37 @@ public class MinecraftFunctions 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         }); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         sm.registerFunction("player.gettarget", (sc, in) ->  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         {  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            if(in.length > 2) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            PlayerEntity p = (PlayerEntity) in[0].get(sc); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+             
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            double radius = in[1].getDouble(sc); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            if(radius > 128.0) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                radius = 128.0; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+             
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            RayTraceContext.BlockMode bm = RayTraceContext.BlockMode.OUTLINE; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            if(in.length >= 3 && in[2].getBoolean(sc)) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                bm = RayTraceContext.BlockMode.COLLIDER; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            RayTraceContext.FluidMode fm = RayTraceContext.FluidMode.NONE; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            if(in.length >= 4 && in[3].getBoolean(sc)) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                return new Location(((PlayerEntity) in[0].get(sc)).world,  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                        Utils.getTargetBlock((PlayerEntity) in[0].get(sc), in[1].getInt(sc), in[2].getBoolean(sc), in[3].getBoolean(sc))); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                fm = RayTraceContext.FluidMode.ANY; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            return new Location(((PlayerEntity) in[0].get(sc)).world, Utils.getTargetBlock((PlayerEntity) in[0].get(sc), in[1].getInt(sc), true, false)); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+             
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            Vec3d start = p.getEyePosition(0.0f); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            Vec3d unit = p.getLook(0.0f); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            Vec3d end = start.add(unit.x * radius, unit.y * radius, unit.z * radius); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+             
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            BlockRayTraceResult result = p.world.rayTraceBlocks(new RayTraceContext(start, end, bm, fm, p)); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+             
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            if(result.getType() == RayTraceResult.Type.BLOCK)  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                return new Location(p.world, result.getPos()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+             
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            return new Location(p.world, end); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         }); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         sm.registerFunction("player.gettargetentity", (sc, in) -> Utils.getTargetedEntity((PlayerEntity) in[0].get(sc), in[1].getDouble(sc), getClass(in[2].getString(sc)))); 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -559,12 +587,30 @@ public class MinecraftFunctions 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         });   
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         sm.registerFunction("world.setgamerule", (sc, in) ->  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         {                     
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            ((World) in[0].get(sc)).getGameRules().setOrCreateGameRule(in[1].getString(sc), in[2].getString(sc), server); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            /*Object o = ((World) in[0].get(sc)).getGameRules().get(Mapper.getGameRule(in[1].getString(sc))); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            if(o instanceof GameRules.BooleanValue) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                ((GameRules.BooleanValue) o).set(in[2].getBoolean(sc), server); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            if(o instanceof GameRules.IntegerValue) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                ((GameRules.IntegerValue) o).set(in[2].getInt(sc), server); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            ((World) in[0].get(sc)).getGameRules().setOrCreateGameRule(in[1].getString(sc), in[2].getString(sc), server);*/ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             return Void.TYPE; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         });   
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         sm.registerFunction("world.getgamerule", (sc, in) ->  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         {                     
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            return ((World) in[0].get(sc)).getGameRules().get(in[1].getString(sc)).getString(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            Object o = ((World) in[0].get(sc)).getGameRules().get(Mapper.getGameRule(in[1].getString(sc))); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            if(o instanceof GameRules.BooleanValue) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                return ((GameRules.BooleanValue) o).get(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            if(o instanceof GameRules.IntegerValue) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                return (double) ((GameRules.IntegerValue) o).get(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            return null; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         });   
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         sm.registerFunction("world.setspawn", (sc, in) ->  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         {     
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -1191,7 +1237,7 @@ public class MinecraftFunctions 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             ent.setCustomNameVisible(false);   
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             return Void.TYPE;  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         });  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        sm.registerFunction("entity.getname", (sc, in) -> ((Entity) in[0].get(sc)).getDisplayName().getString());  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        sm.registerFunction("entity.getname", (sc, in) -> ((Entity) in[0].get(sc)).getDisplayName().getFormattedText());  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         sm.registerFunction("entity.throw", (sc, in) ->  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         {  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             Entity ent = (Entity) in[0].get(sc); 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -2284,32 +2330,44 @@ public class MinecraftFunctions 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 case "all": 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                     PlayerList list = server.getPlayerList(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                    scripts.getPlayerList(sc.getId()).forEach(uuid ->  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    if(list != null) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                     { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                        ServerPlayerEntity p = list.getPlayerByUUID(uuid); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                        if(p != null) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        scripts.getPlayerList(sc.getId()).forEach(uuid ->  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                         { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                            c.accept(p); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                    }); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                            ServerPlayerEntity p = list.getPlayerByUUID(uuid); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                            if(p != null) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                            { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                c.accept(p); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        }); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                     break; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 case "online": 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                    server.getPlayerList().getPlayers().forEach(p -> c.accept(p)); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    if(server.getPlayerList() != null) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        server.getPlayerList().getPlayers().forEach(p -> c.accept(p)); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    }    
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                     break; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 case "dev": 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                    server.getPlayerList().getPlayers().forEach(p ->  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    if(server.getPlayerList() != null) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                     { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                        if(perms.hasPermission(p, "script.error")) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        server.getPlayerList().getPlayers().forEach(p ->  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                         { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                            c.accept(p); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                    }); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                            if(perms.hasPermission(p, "script.error")) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                            { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                c.accept(p); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        }); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                     break; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 case "server": 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                     c.accept(server); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                     break; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 default: 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                    c.accept(Utils.getPlayerByName(server, group.toString())); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    if(server.getPlayerList() != null) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        c.accept(Utils.getPlayerByName(server, group.toString())); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                     break; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             return; 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -2431,4 +2489,4 @@ public class MinecraftFunctions 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         w.addEntity(launch); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         return (T) launch; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+} 
			 |