Kajetan Johannes Hammerle 7 years ago
parent
commit
56961967d3

+ 1 - 1
build.gradle

@@ -22,7 +22,7 @@ compileJava {
 }
 }
 
 
 minecraft {
 minecraft {
-    version = "1.12-14.21.1.2387"
+    version = "1.12-14.21.1.2405"
     runDir = "run"
     runDir = "run"
     
     
     // the mappings can be changed at any time, and must be in the following format.
     // the mappings can be changed at any time, and must be in the following format.

+ 75 - 79
src/main/java/me/km/KajetansMod.java

@@ -41,6 +41,7 @@ import net.minecraftforge.fml.relauncher.SideOnly;
 @Mod(modid = KajetansMod.MODID, version = KajetansMod.VERSION, name = KajetansMod.NAME)
 @Mod(modid = KajetansMod.MODID, version = KajetansMod.VERSION, name = KajetansMod.NAME)
 public class KajetansMod
 public class KajetansMod
 {    
 {    
+    @SideOnly(Side.SERVER)
     public static SimpleConfig conf;
     public static SimpleConfig conf;
     
     
     public static Module error;
     public static Module error;
@@ -69,7 +70,7 @@ public class KajetansMod
 
 
     public static final String MODID = "km";
     public static final String MODID = "km";
     public static final String NAME = "Kajetans Mod";
     public static final String NAME = "Kajetans Mod";
-    public static final String VERSION = "0.0.7";
+    public static final String VERSION = "0.0.8";
 
 
     @Mod.Instance(MODID)
     @Mod.Instance(MODID)
     public static KajetansMod instance;
     public static KajetansMod instance;
@@ -117,6 +118,10 @@ public class KajetansMod
         singlePlayer = e.getServer().isSinglePlayer();
         singlePlayer = e.getServer().isSinglePlayer();
         // Workaround
         // Workaround
         event = e;
         event = e;
+        if(singlePlayer)
+        {
+            return;
+        }
         // Konfiguration und Error-Dummy
         // Konfiguration und Error-Dummy
         error = new Module("ERROR", "ERROR", TextFormatting.RED);
         error = new Module("ERROR", "ERROR", TextFormatting.RED);
         conf = new SimpleConfig(error, "", "config", true);
         conf = new SimpleConfig(error, "", "config", true);
@@ -134,106 +139,97 @@ public class KajetansMod
             System.out.println("------------------------------------------------");
             System.out.println("------------------------------------------------");
         }
         }
         
         
-        if(!singlePlayer)
+        // Datenbankverbindung
+        databank = new DataBank("DataBank", "DataBank", TextFormatting.RED, conf.getString("user", "root"), conf.getString("password", ""));
+        if(!databank.openDataBankConnection())
         {
         {
-            // Datenbankverbindung
-            databank = new DataBank("DataBank", "DataBank", TextFormatting.RED, conf.getString("user", "root"), conf.getString("password", ""));
-            if(!databank.openDataBankConnection())
-            {
-                return;
-            }
-            
-            // Scheduler
-            scheduler = new SnuviScheduler("Scheduler", "Scheduler", TextFormatting.GREEN);
-            scheduler.registerEvents("me.km.scheduler");
-            
-            // Spielerdatenbank
-            playerbank = new PlayerManager("PlayerBank", "PlayerBank", TextFormatting.RED);
-            playerbank.setDataBank(new PlayerBank(playerbank, databank.getConnection()));
-            playerbank.registerEvents("me.km.playerbank");
+            return;
         }
         }
+
+        // Scheduler
+        scheduler = new SnuviScheduler("Scheduler", "Scheduler", TextFormatting.GREEN);
+        scheduler.registerEvents("me.km.scheduler");
+
+        // Spielerdatenbank
+        playerbank = new PlayerManager("PlayerBank", "PlayerBank", TextFormatting.RED);
+        playerbank.setDataBank(new PlayerBank(playerbank, databank.getConnection()));
+        playerbank.registerEvents("me.km.playerbank");
         
         
         // Grundlegende Commands
         // Grundlegende Commands
         generalCommands = new Module("GeneralCommands", "Commands", TextFormatting.GOLD);
         generalCommands = new Module("GeneralCommands", "Commands", TextFormatting.GOLD);
         generalCommands.registerCommands(e, "me.km.commands");
         generalCommands.registerCommands(e, "me.km.commands");
-        
-        if(!singlePlayer)
-        {     
-            // Chatmanager
-            chatManager = new ChatManager("ChatManager", "Chat", TextFormatting.BLUE);
-            chatManager.registerCommands(e, "me.km.chatmanager");
-            chatManager.registerEvents("me.km.chatmanager");
+         
+        // Chatmanager
+        chatManager = new ChatManager("ChatManager", "Chat", TextFormatting.BLUE);
+        chatManager.registerCommands(e, "me.km.chatmanager");
+        chatManager.registerEvents("me.km.chatmanager");
 
 
-            // AFK-Manager
-            afkManager = new Module("AfkManager", "AFK", TextFormatting.GRAY);
-            afkManager.registerCommands(e, "me.km.afk");
-            afkManager.registerEvents("me.km.afk");
+        // AFK-Manager
+        afkManager = new Module("AfkManager", "AFK", TextFormatting.GRAY);
+        afkManager.registerCommands(e, "me.km.afk");
+        afkManager.registerEvents("me.km.afk");
 
 
-            // Plot-System
-            plots = new Module("Plots", "Plots", TextFormatting.GOLD);
-            plots.setDataBank(new ProtectionBank(plots, databank.getConnection()));
-            plots.registerCommands(e, "me.km.plots");          
-            plots.registerEvents("me.km.plots");
+        // Plot-System
+        plots = new Module("Plots", "Plots", TextFormatting.GOLD);
+        plots.setDataBank(new ProtectionBank(plots, databank.getConnection()));
+        plots.registerCommands(e, "me.km.plots");          
+        plots.registerEvents("me.km.plots");
 
 
-            // Chests- und Co-Protections
-            blocks = new Module("BlockProtections", "Blocks", TextFormatting.BLUE);
-            blocks.setDataBank(new BlockProtectionBank(blocks, databank.getConnection()));
-            blocks.registerCommands(e, "me.km.blockprotections");          
-            blocks.registerEvents("me.km.blockprotections");
+        // Chests- und Co-Protections
+        blocks = new Module("BlockProtections", "Blocks", TextFormatting.BLUE);
+        blocks.setDataBank(new BlockProtectionBank(blocks, databank.getConnection()));
+        blocks.registerCommands(e, "me.km.blockprotections");          
+        blocks.registerEvents("me.km.blockprotections");
 
 
-            // DataTools
-            datatools = new Module("DataTools", "DataTools", TextFormatting.GRAY);
-            datatools.registerCommands(e, "me.km.datatools");          
-            datatools.registerEvents("me.km.datatools");
+        // DataTools
+        datatools = new Module("DataTools", "DataTools", TextFormatting.GRAY);
+        datatools.registerCommands(e, "me.km.datatools");          
+        datatools.registerEvents("me.km.datatools");
 
 
-            // Worldmanager
-            worldManager = new WorldData("WorldManager", "Worlds", TextFormatting.RED);
-            worldManager.registerCommands(e, "me.km.dimensions");          
-            worldManager.registerEvents("me.km.dimensions");
+        // Worldmanager
+        worldManager = new WorldData("WorldManager", "Worlds", TextFormatting.RED);
+        worldManager.registerCommands(e, "me.km.dimensions");          
+        worldManager.registerEvents("me.km.dimensions");
 
 
-            // Scriptsystem
-            scripts = new ScriptModule("Scripts", "Scripts", TextFormatting.LIGHT_PURPLE);
-            scripts.setDataBank(new ScriptBank(scripts, databank.getConnection()));
-            scripts.registerCommands(e, "me.km.snuviscript");          
-            scripts.registerEvents("me.km.snuviscript");
+        // Scriptsystem
+        scripts = new ScriptModule("Scripts", "Scripts", TextFormatting.LIGHT_PURPLE);
+        scripts.setDataBank(new ScriptBank(scripts, databank.getConnection()));
+        scripts.registerCommands(e, "me.km.snuviscript");          
+        scripts.registerEvents("me.km.snuviscript");
 
 
-            // Jobsystem
-            jobs = new JobAPI("JobSystem", "Jobs", TextFormatting.GREEN);
-            // databank is initialized in JobAPI in order to have a reference
-            jobs.registerCommands(e, "me.km.jobsystem");      
-            jobs.registerEvents("me.km.jobsystem"); 
+        // Jobsystem
+        jobs = new JobAPI("JobSystem", "Jobs", TextFormatting.GREEN);
+        // databank is initialized in JobAPI in order to have a reference
+        jobs.registerCommands(e, "me.km.jobsystem");      
+        jobs.registerEvents("me.km.jobsystem"); 
 
 
-            // Effectsystem
-            effects = new EffectUtils("Effects", "Effects", TextFormatting.BLUE);
-            effects.registerCommands(e, "me.km.effects"); 
-            effects.registerEvents("me.km.effects.passive"); 
+        // Effectsystem
+        effects = new EffectUtils("Effects", "Effects", TextFormatting.BLUE);
+        effects.registerCommands(e, "me.km.effects"); 
+        effects.registerEvents("me.km.effects.passive"); 
 
 
-            // Skills
-            skills = new SkillManager("SkillSystem", "Skills", TextFormatting.BLUE);
-            skills.registerCommands(e, "me.km.skills"); 
-            skills.registerEvents("me.km.skills");
+        // Skills
+        skills = new SkillManager("SkillSystem", "Skills", TextFormatting.BLUE);
+        skills.registerCommands(e, "me.km.skills"); 
+        skills.registerEvents("me.km.skills");
 
 
-            // Scrollsystem
-            scrolls = new Module("Scrolls", "Scrolls", TextFormatting.BLUE);
-            scrolls.registerCommands(e, "me.km.scrolls"); 
+        // Scrollsystem
+        scrolls = new Module("Scrolls", "Scrolls", TextFormatting.BLUE);
+        scrolls.registerCommands(e, "me.km.scrolls"); 
 
 
-            // Environment
-            environment = new Module("Environment", "Environment", TextFormatting.GREEN);
-            environment.registerCommands(e, "me.km.environment");      
-            environment.registerEvents("me.km.environment");
+        // Environment
+        environment = new Module("Environment", "Environment", TextFormatting.GREEN);
+        environment.registerCommands(e, "me.km.environment");      
+        environment.registerEvents("me.km.environment");
+
+        // Scoreboard
+        scoreboard = new ScoreboardAPI("Scoreboard", "Scoreboard", TextFormatting.GOLD);
+        scoreboard.registerEvents("me.km.scoreboard");
 
 
-            // Scoreboard
-            scoreboard = new ScoreboardAPI("Scoreboard", "Scoreboard", TextFormatting.GOLD);
-            scoreboard.registerEvents("me.km.scoreboard");
-        }
         // Permissions
         // Permissions
         perms = new PermissionManager("Permissions", "Perms", TextFormatting.DARK_PURPLE);
         perms = new PermissionManager("Permissions", "Perms", TextFormatting.DARK_PURPLE);
         perms.registerEvents("me.km.permissions");
         perms.registerEvents("me.km.permissions");
 
 
-        if(singlePlayer)
-        {
-            return;
-        }       
         scripts.startScript(server, "startscript");
         scripts.startScript(server, "startscript");
     }
     }
     
     

+ 0 - 7
src/main/java/me/km/api/SimpleConfig.java

@@ -1,13 +1,6 @@
 package me.km.api;
 package me.km.api;
 
 
 import java.io.File;
 import java.io.File;
-import java.io.IOException;
-import java.nio.charset.Charset;
-import java.nio.charset.MalformedInputException;
-import java.nio.file.Files;
-import java.nio.file.Paths;
-import java.util.TreeMap;
-import java.util.stream.Collectors;
 import me.hammerle.code.ISnuviLogger;
 import me.hammerle.code.ISnuviLogger;
 import me.hammerle.code.Script;
 import me.hammerle.code.Script;
 import me.hammerle.config.SnuviConfig;
 import me.hammerle.config.SnuviConfig;

+ 0 - 168
src/main/java/me/km/blocks/BlockBed.java

@@ -1,168 +0,0 @@
-package me.km.blocks;
-
-import java.util.Random;
-import javax.annotation.Nullable;
-import net.minecraft.block.SoundType;
-import net.minecraft.block.state.IBlockState;
-import net.minecraft.entity.Entity;
-import net.minecraft.entity.player.EntityPlayer;
-import net.minecraft.entity.player.EntityPlayerMP;
-import net.minecraft.init.Biomes;
-import net.minecraft.init.Items;
-import net.minecraft.item.Item;
-import net.minecraft.item.ItemStack;
-import net.minecraft.util.EnumFacing;
-import net.minecraft.util.EnumHand;
-import net.minecraft.util.math.BlockPos;
-import net.minecraft.util.text.TextComponentTranslation;
-import net.minecraft.world.IBlockAccess;
-import net.minecraft.world.World;
-
-public class BlockBed extends net.minecraft.block.BlockBed
-{
-    protected String name;
-    private SoundType type;
-    private final Item drop;
-    
-    public BlockBed(String name, String local, Item drop)
-    {
-        this.name = name;
-        this.setRegistryName(name);
-        super.setUnlocalizedName(local);
-        this.type = SoundType.CLOTH;
-        this.drop = drop;
-        super.setHardness(0.2F);
-        super.disableStats();
-    }
-    
-    @Override
-    public final Item getItemDropped(IBlockState state, Random rand, int fortune)
-    {
-        return state.getValue(PART) == BlockBed.EnumPartType.HEAD ? Items.AIR : drop;
-    }
-
-    @Override
-    public final ItemStack getItem(World worldIn, BlockPos pos, IBlockState state) 
-    {
-        return new ItemStack(drop);
-    }
-
-    @Override
-    public final BlockBed setSoundType(SoundType sound) 
-    {
-        this.type = sound;
-        return this;
-    }
-
-    @Override
-    public final SoundType getSoundType(IBlockState state, World w, BlockPos pos, Entity entity) 
-    {
-        return type;
-    }     
-
-    @Override
-    public final boolean isBed(IBlockState state, IBlockAccess world, BlockPos pos, Entity player) 
-    {
-        return true;
-    }
-    
-    // copied from net.minecraft.block.BlockBed
-    @Override
-    public final boolean onBlockActivated(World w, BlockPos pos, IBlockState state, EntityPlayer p, EnumHand hand, EnumFacing facing, float hitX, float hitY, float hitZ)
-    {
-        if(w.isRemote)
-        {
-            return true;
-        }
-        else
-        {
-            if(state.getValue(PART) != EnumPartType.HEAD)
-            {
-                pos = pos.offset((EnumFacing)state.getValue(FACING));
-                state = w.getBlockState(pos);
-                if (state.getBlock() != this)
-                {
-                    return true;
-                }
-            }
-            if(w.provider.canRespawnHere() && w.getBiome(pos) != Biomes.HELL)
-            {
-                if(state.getValue(OCCUPIED))
-                {
-                    EntityPlayer anotherPlayer = this.getPlayerInBed(w, pos);
-                    if (anotherPlayer != null)
-                    {
-                        p.sendStatusMessage(new TextComponentTranslation("tile.bed.occupied", new Object[0]), true);
-                        return true;
-                    }
-                    state = state.withProperty(OCCUPIED, false);
-                    w.setBlockState(pos, state, 4);
-                }
-
-                EntityPlayer.SleepResult result = p.trySleep(pos);
-
-                if(result == EntityPlayer.SleepResult.OK)
-                {
-                    state = state.withProperty(OCCUPIED, true);
-                    // set players real position
-                    // subtracting normal bedsize, adding custom
-                    p.setPosition(p.posX, p.posY - 0.4375f + getLayingHigh(), p.posZ);
-                    // this is for evil servers which render the position wrong
-                    if(p instanceof EntityPlayerMP)
-                    {
-                        ((EntityPlayerMP) p).connection.setPlayerLocation(p.posX, p.posY, p.posZ, p.rotationYaw, p.rotationPitch);
-                    }
-                    // end
-                    w.setBlockState(pos, state, 4);
-                    return true;
-                }
-                else
-                {
-                    switch (result) 
-                    {
-                        case NOT_POSSIBLE_NOW:
-                            p.sendStatusMessage(new TextComponentTranslation("tile.bed.noSleep", new Object[0]), true);
-                            break;
-                        case NOT_SAFE:
-                            p.sendStatusMessage(new TextComponentTranslation("tile.bed.notSafe", new Object[0]), true);
-                            break;
-                        case TOO_FAR_AWAY:
-                            p.sendStatusMessage(new TextComponentTranslation("tile.bed.tooFarAway", new Object[0]), true);
-                            break;
-                    }
-                    return true;
-                }
-            }
-            else
-            {
-                w.setBlockToAir(pos);
-                BlockPos blockpos = pos.offset(state.getValue(FACING).getOpposite());
-                if(w.getBlockState(blockpos).getBlock() == this)
-                {
-                    w.setBlockToAir(blockpos);
-                }
-                w.newExplosion(null, pos.getX() + 0.5d, pos.getY() + 0.5d, pos.getZ() + 0.5d, 5, true, true);
-                return true;
-            }
-        }
-    }
-    
-    public float getLayingHigh()
-    {
-        return 0.6875f;
-    }
-    
-    // copied from net.minecraft.block.BlockBed
-    @Nullable
-    private EntityPlayer getPlayerInBed(World w, BlockPos pos)
-    {
-        for(EntityPlayer entityplayer : w.playerEntities)
-        {
-            if(entityplayer.isPlayerSleeping() && entityplayer.bedLocation.equals(pos))
-            {
-                return entityplayer;
-            }
-        }
-        return null;
-    }
-}

+ 1 - 1
src/main/java/me/km/blocks/BlockHayBed.java

@@ -7,7 +7,7 @@ import net.minecraft.util.math.AxisAlignedBB;
 import net.minecraft.util.math.BlockPos;
 import net.minecraft.util.math.BlockPos;
 import net.minecraft.world.IBlockAccess;
 import net.minecraft.world.IBlockAccess;
 
 
-public class BlockHayBed extends BlockBed
+public class BlockHayBed extends BlockModBed
 { 
 { 
     private static final AxisAlignedBB BOX = new AxisAlignedBB(0, 0, 0, 1, 0.125d, 1);
     private static final AxisAlignedBB BOX = new AxisAlignedBB(0, 0, 0, 1, 0.125d, 1);
     
     

+ 400 - 0
src/main/java/me/km/blocks/BlockModBed.java

@@ -0,0 +1,400 @@
+package me.km.blocks;
+
+import java.util.Random;
+import javax.annotation.Nullable;
+import net.minecraft.block.Block;
+import net.minecraft.block.BlockBed;
+import net.minecraft.block.BlockHorizontal;
+import net.minecraft.block.SoundType;
+import net.minecraft.block.material.EnumPushReaction;
+import net.minecraft.block.material.MapColor;
+import net.minecraft.block.material.Material;
+import net.minecraft.block.properties.IProperty;
+import net.minecraft.block.properties.PropertyBool;
+import net.minecraft.block.properties.PropertyEnum;
+import net.minecraft.block.state.BlockFaceShape;
+import net.minecraft.block.state.BlockStateContainer;
+import net.minecraft.block.state.IBlockState;
+import net.minecraft.entity.Entity;
+import net.minecraft.entity.EntityLivingBase;
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.entity.player.EntityPlayerMP;
+import net.minecraft.init.Biomes;
+import net.minecraft.init.Items;
+import net.minecraft.item.Item;
+import net.minecraft.item.ItemStack;
+import net.minecraft.tileentity.TileEntity;
+import net.minecraft.util.BlockRenderLayer;
+import net.minecraft.util.EnumBlockRenderType;
+import net.minecraft.util.EnumFacing;
+import net.minecraft.util.EnumHand;
+import net.minecraft.util.Mirror;
+import net.minecraft.util.Rotation;
+import net.minecraft.util.math.AxisAlignedBB;
+import net.minecraft.util.math.BlockPos;
+import net.minecraft.util.text.TextComponentTranslation;
+import net.minecraft.world.IBlockAccess;
+import net.minecraft.world.World;
+import net.minecraftforge.fml.relauncher.Side;
+import net.minecraftforge.fml.relauncher.SideOnly;
+
+public abstract class BlockModBed extends BlockHorizontal
+{
+    public static final PropertyEnum<BlockBed.EnumPartType> PART = PropertyEnum.<BlockBed.EnumPartType>create("part", BlockBed.EnumPartType.class);
+    public static final PropertyBool OCCUPIED = PropertyBool.create("occupied");
+    
+    protected String name;
+    private SoundType type;
+    private final Item drop;
+    
+    public BlockModBed(String name, String local, Item drop)
+    {
+        super(Material.CLOTH);
+        this.setDefaultState(this.blockState.getBaseState().withProperty(PART, BlockBed.EnumPartType.FOOT)
+                        .withProperty(OCCUPIED, false));
+        this.isBlockContainer = true;
+        
+        this.name = name;
+        this.setRegistryName(name);
+        super.setUnlocalizedName(local);
+        this.type = SoundType.CLOTH;
+        this.drop = drop;
+        super.setHardness(0.2F);
+        super.disableStats();
+    }
+
+    @Override
+    public final BlockModBed setSoundType(SoundType sound) 
+    {
+        this.type = sound;
+        return this;
+    }
+
+    @Override
+    public final SoundType getSoundType(IBlockState state, World w, BlockPos pos, Entity ent) 
+    {
+        return type;
+    }     
+
+    @Override
+    public final boolean isBed(IBlockState state, IBlockAccess w, BlockPos pos, Entity p) 
+    {
+        return true;
+    }   
+    
+    public float getLayingHigh()
+    {
+        return 0.6875f;
+    }
+
+    @Override
+    public MapColor getMapColor(IBlockState state, IBlockAccess w, BlockPos pos)
+    {
+        return MapColor.CLOTH;
+    }
+
+    @Override
+    public boolean onBlockActivated(World w, BlockPos pos, IBlockState state, EntityPlayer p, EnumHand hand, EnumFacing facing, float hitX, float hitY, float hitZ)
+    {
+        if(w.isRemote)
+        {
+            return true;
+        }
+        else
+        {
+            if(state.getValue(PART) != BlockBed.EnumPartType.HEAD)
+            {
+                pos = pos.offset(state.getValue(FACING));
+                state = w.getBlockState(pos);
+                if(state.getBlock() != this)
+                {
+                    return true;
+                }
+            }
+
+            if(w.provider.canRespawnHere() && w.getBiome(pos) != Biomes.HELL)
+            {
+                if((state.getValue(OCCUPIED)))
+                {
+                    EntityPlayer entityplayer = this.getPlayerInBed(w, pos);
+                    if(entityplayer != null)
+                    {
+                        p.sendStatusMessage(new TextComponentTranslation("tile.bed.occupied", new Object[0]), true);
+                        return true;
+                    }
+                    state = state.withProperty(OCCUPIED, false);
+                    w.setBlockState(pos, state, 4);
+                }
+
+                EntityPlayer.SleepResult sleep = p.trySleep(pos);
+                if(sleep == EntityPlayer.SleepResult.OK)
+                {
+                    state = state.withProperty(OCCUPIED, true);
+                    // set players real position
+                    // subtracting normal bedsize, adding custom
+                    p.setPosition(p.posX, p.posY - 0.4375f + getLayingHigh(), p.posZ);
+                    // this is for evil servers which render the position wrong
+                    if(p instanceof EntityPlayerMP)
+                    {
+                        ((EntityPlayerMP) p).connection.setPlayerLocation(p.posX, p.posY, p.posZ, p.rotationYaw, p.rotationPitch);
+                    }
+                    // end
+                    w.setBlockState(pos, state, 4);
+                    return true;
+                }
+                else
+                {
+                    switch (sleep) 
+                    {
+                        case NOT_POSSIBLE_NOW:
+                            p.sendStatusMessage(new TextComponentTranslation("tile.bed.noSleep", new Object[0]), true);
+                            break;
+                        case NOT_SAFE:
+                            p.sendStatusMessage(new TextComponentTranslation("tile.bed.notSafe", new Object[0]), true);
+                            break;
+                        case TOO_FAR_AWAY:
+                            p.sendStatusMessage(new TextComponentTranslation("tile.bed.tooFarAway", new Object[0]), true);
+                            break;
+                    }
+                    return true;
+                }
+            }
+            else
+            {
+                w.setBlockToAir(pos);
+                BlockPos blockpos = pos.offset(state.getValue(FACING).getOpposite());
+                if(w.getBlockState(blockpos).getBlock() == this)
+                {
+                    w.setBlockToAir(blockpos);
+                }
+                w.newExplosion(null, pos.getX() + 0.5d, pos.getY() + 0.5d, pos.getZ() + 0.5d, 5, true, true);
+                return true;
+            }
+        }
+    }
+
+    @Nullable
+    private EntityPlayer getPlayerInBed(World w, BlockPos pos)
+    {
+        for(EntityPlayer p : w.playerEntities)
+        {
+            if (p.isPlayerSleeping() && p.bedLocation.equals(pos))
+            {
+                return p;
+            }
+        }
+        return null;
+    }
+
+    @Override
+    public boolean isFullCube(IBlockState state)
+    {
+        return false;
+    }
+
+    @Override
+    public boolean isOpaqueCube(IBlockState state)
+    {
+        return false;
+    }
+
+    @Override
+    public void onFallenUpon(World worldIn, BlockPos pos, Entity entityIn, float fallDistance)
+    {
+        super.onFallenUpon(worldIn, pos, entityIn, fallDistance * 0.5F);
+    }
+
+    @Override
+    public void onLanded(World w, Entity ent)
+    {
+        if(ent.isSneaking())
+        {
+            super.onLanded(w, ent);
+        }
+        else if(ent.motionY < 0)
+        {
+            ent.motionY = -ent.motionY * 0.66d;
+
+            if(!(ent instanceof EntityLivingBase))
+            {
+                ent.motionY *= 0.8d;
+            }
+        }
+    }
+
+    @Override
+    public void neighborChanged(IBlockState state, World w, BlockPos pos, Block blockIn, BlockPos fromPos)
+    {
+        EnumFacing enumfacing = (EnumFacing)state.getValue(FACING);
+
+        if(state.getValue(PART) == BlockBed.EnumPartType.FOOT)
+        {
+            if(w.getBlockState(pos.offset(enumfacing)).getBlock() != this)
+            {
+                w.setBlockToAir(pos);
+            }
+        }
+        else if(w.getBlockState(pos.offset(enumfacing.getOpposite())).getBlock() != this)
+        {
+            if(!w.isRemote)
+            {
+                this.dropBlockAsItem(w, pos, state, 0);
+            }
+            w.setBlockToAir(pos);
+        }
+    }
+
+    @Override
+    public Item getItemDropped(IBlockState state, Random rand, int fortune)
+    {
+        return state.getValue(PART) == BlockBed.EnumPartType.FOOT ? Items.AIR : drop;
+    }
+
+    @Override
+    public abstract AxisAlignedBB getBoundingBox(IBlockState state, IBlockAccess source, BlockPos pos);
+
+    @SideOnly(Side.CLIENT)
+    @Override
+    public boolean hasCustomBreakingProgress(IBlockState state)
+    {
+        return true;
+    }
+
+    @Nullable
+    public static BlockPos getSafeExitLocation(World w, BlockPos pos, int tries)
+    {
+        return net.minecraft.block.BlockBed.getSafeExitLocation(w, pos, tries);
+    }
+
+    @Override
+    public void dropBlockAsItemWithChance(World worldIn, BlockPos pos, IBlockState state, float chance, int fortune)
+    {
+        if(state.getValue(PART) == BlockBed.EnumPartType.HEAD)
+        {
+            spawnAsEntity(worldIn, pos, new ItemStack(drop));
+        }
+    }
+
+    @Override
+    public EnumPushReaction getMobilityFlag(IBlockState state)
+    {
+        return EnumPushReaction.DESTROY;
+    }
+
+    @SideOnly(Side.CLIENT)
+    @Override
+    public BlockRenderLayer getBlockLayer()
+    {
+        return BlockRenderLayer.CUTOUT;
+    }
+
+    @Override
+    public EnumBlockRenderType getRenderType(IBlockState state)
+    {
+        return EnumBlockRenderType.MODEL;
+    }
+
+    @Override
+    public ItemStack getItem(World worldIn, BlockPos pos, IBlockState state)
+    {
+        return new ItemStack(drop);
+    }
+
+    @Override
+    public void onBlockHarvested(World w, BlockPos pos, IBlockState state, EntityPlayer player)
+    {
+        if(player.capabilities.isCreativeMode && 
+                state.getValue(PART) == BlockBed.EnumPartType.FOOT)
+        {
+            BlockPos blockpos = pos.offset((EnumFacing)state.getValue(FACING));
+            if(w.getBlockState(blockpos).getBlock() == this)
+            {
+                w.setBlockToAir(blockpos);
+            }
+        }
+    }
+
+    @Override
+    public void harvestBlock(World worldIn, EntityPlayer player, BlockPos pos, IBlockState state, TileEntity te, ItemStack stack)
+    {
+        super.harvestBlock(worldIn, player, pos, state, null, stack);
+    }
+
+    @Override
+    public void breakBlock(World worldIn, BlockPos pos, IBlockState state)
+    {
+        super.breakBlock(worldIn, pos, state);
+    }
+
+    @Override
+    public IBlockState getStateFromMeta(int meta)
+    {
+        EnumFacing f = EnumFacing.getHorizontal(meta);
+        return (meta & 8) > 0 ? this.getDefaultState()
+                .withProperty(PART, BlockBed.EnumPartType.HEAD)
+                .withProperty(FACING, f)
+                .withProperty(OCCUPIED, (meta & 4) > 0) : 
+                this.getDefaultState().withProperty(PART, BlockBed.EnumPartType.FOOT)
+                        .withProperty(FACING, f);
+    }
+
+    @Override
+    public IBlockState getActualState(IBlockState state, IBlockAccess w, BlockPos pos)
+    {
+        if(state.getValue(PART) == BlockBed.EnumPartType.FOOT)
+        {
+            IBlockState iblockstate = w.getBlockState(pos.offset(state.getValue(FACING)));
+            if(iblockstate.getBlock() == this)
+            {
+                state = state.withProperty(OCCUPIED, iblockstate.getValue(OCCUPIED));
+            }
+        }
+        return state;
+    }
+
+    @Override
+    public IBlockState withRotation(IBlockState state, Rotation rot)
+    {
+        return state.withProperty(FACING, rot.rotate(state.getValue(FACING)));
+    }
+
+    @Override
+    public IBlockState withMirror(IBlockState state, Mirror mirrorIn)
+    {
+        return state.withRotation(mirrorIn.toRotation(state.getValue(FACING)));
+    }
+
+    @Override
+    public int getMetaFromState(IBlockState state)
+    {
+        int i = 0;
+        i = i | (state.getValue(FACING)).getHorizontalIndex();
+        if(state.getValue(PART) == BlockBed.EnumPartType.HEAD)
+        {
+            i |= 8;
+            if (state.getValue(OCCUPIED))
+            {
+                i |= 4;
+            }
+        }
+        return i;
+    }
+
+    @Override
+    public BlockFaceShape getBlockFaceShape(IBlockAccess p_193383_1_, IBlockState p_193383_2_, BlockPos p_193383_3_, EnumFacing p_193383_4_)
+    {
+        return BlockFaceShape.UNDEFINED;
+    }
+
+    @Override
+    protected BlockStateContainer createBlockState()
+    {
+        return new BlockStateContainer(this, new IProperty[] {FACING, PART, OCCUPIED});
+    }
+
+    @SideOnly(Side.CLIENT)
+    public static boolean isHeadPiece(int metadata)
+    {
+        return (metadata & 8) != 0;
+    }
+}

+ 13 - 15
src/main/java/me/km/blocks/ModBlocks.java

@@ -102,26 +102,24 @@ public class ModBlocks
     // THIS IS ONLY FOR REPLACING VANILLA BLOCKS
     // THIS IS ONLY FOR REPLACING VANILLA BLOCKS
     public static void initReplacementBlocks(IForgeRegistry<Block> r) 
     public static void initReplacementBlocks(IForgeRegistry<Block> r) 
     {
     {
-        BlockTallGrass grass = new BlockTallGrass();
-        overwriteBlock(r, Blocks.TALLGRASS, grass);
+        overwriteBlockWorkaround(r, Blocks.TALLGRASS, new BlockTallGrass());
+        overwriteBlock(r, Blocks.TALLGRASS, new BlockTallGrass());
     }
     }
     
     
     @SuppressWarnings("")
     @SuppressWarnings("")
     private static void overwriteBlock(IForgeRegistry<Block> r, Block old, Block block)
     private static void overwriteBlock(IForgeRegistry<Block> r, Block old, Block block)
     {
     {
-        /*try
-        {*/
-            block.setRegistryName(old.getRegistryName().getResourcePath());
-            block.setUnlocalizedName(old.getUnlocalizedName().substring(5));
-            r.register(block);
-            /*GameRegistry.addSubstitutionAlias(old.getRegistryName().toString(), 
-                    GameRegistry.Type.BLOCK, 
-                    block.setRegistryName(old.getRegistryName().getResourcePath()).setUnlocalizedName(old.getUnlocalizedName().substring(5)));
-        }
-        catch(ExistingSubstitutionException | NullPointerException ex)
-        {
-            System.out.println(ex);
-        }*/
+        block.setRegistryName(old.getRegistryName());
+        block.setUnlocalizedName(old.getUnlocalizedName().substring(5));
+        r.register(block);
+    }
+    
+    @SuppressWarnings("")
+    private static void overwriteBlockWorkaround(IForgeRegistry<Block> r, Block old, Block block)
+    {
+        block.setRegistryName(old.getRegistryName().getResourcePath());
+        block.setUnlocalizedName(old.getUnlocalizedName().substring(5));
+        r.register(block);
     }
     }
     //END OF REPLACING VANILLA BLOCKS
     //END OF REPLACING VANILLA BLOCKS
 
 

+ 2 - 7
src/main/java/me/km/events/CustomEventCaller.java

@@ -9,7 +9,6 @@ import net.minecraft.entity.projectile.EntityArrow;
 import net.minecraft.entity.projectile.EntityThrowable;
 import net.minecraft.entity.projectile.EntityThrowable;
 import net.minecraftforge.common.MinecraftForge;
 import net.minecraftforge.common.MinecraftForge;
 import net.minecraftforge.event.entity.EntityJoinWorldEvent;
 import net.minecraftforge.event.entity.EntityJoinWorldEvent;
-import net.minecraftforge.event.entity.living.LivingEvent;
 import net.minecraftforge.event.entity.living.LivingHurtEvent;
 import net.minecraftforge.event.entity.living.LivingHurtEvent;
 import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
 import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
 import net.minecraftforge.fml.common.gameevent.TickEvent;
 import net.minecraftforge.fml.common.gameevent.TickEvent;
@@ -19,13 +18,9 @@ public class CustomEventCaller
     private static final ArrayList<EntityArrow> ARROWS = new ArrayList<>();
     private static final ArrayList<EntityArrow> ARROWS = new ArrayList<>();
     
     
     @SubscribeEvent
     @SubscribeEvent
-    public void onPlayerMove(LivingEvent.LivingUpdateEvent e)
+    public void onPlayerMove(TickEvent.PlayerTickEvent e)
     {      
     {      
-        if(!(e.getEntityLiving() instanceof EntityPlayer))
-        {
-            return;
-        }
-        EntityPlayer p = (EntityPlayer) e.getEntityLiving();
+        EntityPlayer p = e.player;
         if(p.lastTickPosX != p.posX || p.lastTickPosY != p.posY || p.lastTickPosZ != p.posZ)
         if(p.lastTickPosX != p.posX || p.lastTickPosY != p.posY || p.lastTickPosZ != p.posZ)
         {
         {
             MinecraftForge.EVENT_BUS.post(new PlayerMoveEvent(p));
             MinecraftForge.EVENT_BUS.post(new PlayerMoveEvent(p));

+ 2 - 1
src/main/java/me/km/snuviscript/MinecraftFunctions.java

@@ -31,7 +31,6 @@ import me.km.inventory.InventoryUtils;
 import me.km.permissions.Permissions;
 import me.km.permissions.Permissions;
 import me.km.table.Table;
 import me.km.table.Table;
 import me.km.utils.ItemStackUtils;
 import me.km.utils.ItemStackUtils;
-import me.km.utils.RecipeUtils;
 import me.km.utils.ReflectionUtils;
 import me.km.utils.ReflectionUtils;
 import me.km.utils.SpecialBlockUtils;
 import me.km.utils.SpecialBlockUtils;
 import net.minecraft.block.Block;
 import net.minecraft.block.Block;
@@ -461,6 +460,8 @@ public class MinecraftFunctions implements ISnuviLogger
                 getPotionType(args));
                 getPotionType(args));
         parser.registerConsumer("entity.setgravity", (args, qd) -> 
         parser.registerConsumer("entity.setgravity", (args, qd) -> 
                 ((Entity) args[0]).setNoGravity(!(boolean) args[1]));
                 ((Entity) args[0]).setNoGravity(!(boolean) args[1]));
+        parser.registerConsumer("entity.iswet", (args, qd) -> 
+                ((Entity) args[0]).isWet());
 
 
         // -------------------------------------------------------------
         // -------------------------------------------------------------
         // Status-Bibliothek
         // Status-Bibliothek

+ 0 - 2
src/main/java/me/km/snuviscript/MinecraftScript.java

@@ -30,8 +30,6 @@ public class MinecraftScript extends Script
     
     
     public boolean removeLocation(Location l)
     public boolean removeLocation(Location l)
     {
     {
-        l = l.copy();
-        l.round();
         return loadedLocations.remove(l);
         return loadedLocations.remove(l);
     }
     }
     
     

+ 66 - 63
src/main/java/me/km/snuviscript/ScriptEvents.java

@@ -9,6 +9,7 @@ import java.util.function.Consumer;
 import java.util.stream.Collectors;
 import java.util.stream.Collectors;
 import me.hammerle.code.Code;
 import me.hammerle.code.Code;
 import me.hammerle.code.Script;
 import me.hammerle.code.Script;
+import me.hammerle.code.ScriptUtils;
 import me.hammerle.code.SnuviParser;
 import me.hammerle.code.SnuviParser;
 import me.hammerle.exceptions.SnuviException;
 import me.hammerle.exceptions.SnuviException;
 import me.km.KajetansMod;
 import me.km.KajetansMod;
@@ -138,9 +139,11 @@ public class ScriptEvents extends ModuleListener
     public void onPlayerMove(PlayerMoveEvent e)
     public void onPlayerMove(PlayerMoveEvent e)
     {      
     {      
         EntityPlayer p = e.getEntityPlayer();
         EntityPlayer p = e.getEntityPlayer();
+        Location l = new Location(p);
+        l.round();
         parser.getScripts().stream().filter(sc -> sc.isLoadedEvent("player_move")).forEach(sc -> 
         parser.getScripts().stream().filter(sc -> sc.isLoadedEvent("player_move")).forEach(sc -> 
         {
         {
-            if(((MinecraftScript) sc).removeLocation(new Location(p)))
+            if(((MinecraftScript) sc).removeLocation(l))
             {
             {
                 ScriptVars.setPlayerVars(sc, p);   
                 ScriptVars.setPlayerVars(sc, p);   
                 parser.callEvent("player_move", sc, null, null);
                 parser.callEvent("player_move", sc, null, null);
@@ -148,7 +151,7 @@ public class ScriptEvents extends ModuleListener
         });
         });
 
 
         PlayerScript sc = KajetansMod.scripts.getScript(p);
         PlayerScript sc = KajetansMod.scripts.getScript(p);
-        if(sc != null && sc.isLoadedEvent("player_move") && sc.removeLocation(new Location(p)))
+        if(sc != null && sc.isLoadedEvent("player_move") && sc.removeLocation(l))
         {
         {
             ScriptVars.setPlayerVars(sc, p); 
             ScriptVars.setPlayerVars(sc, p); 
             parser.callEvent("player_move", sc, null, null);
             parser.callEvent("player_move", sc, null, null);
@@ -160,9 +163,9 @@ public class ScriptEvents extends ModuleListener
         parser.callEvent("inv_click", qd, sc -> 
         parser.callEvent("inv_click", qd, sc -> 
         {
         {
             ScriptVars.setPlayerVars(qd, p); 
             ScriptVars.setPlayerVars(qd, p); 
-            qd.setEventVar("inv_id", inv.getId());
+            qd.setEventVar("inv_id", (double) inv.getId());
             qd.setEventVar("inv_name", inv.getName());
             qd.setEventVar("inv_name", inv.getName());
-            qd.setEventVar("inv_slot", slot);
+            qd.setEventVar("inv_slot", (double) slot);
             ScriptVars.setItemVars(qd, inv.getStackInSlot(slot));
             ScriptVars.setItemVars(qd, inv.getStackInSlot(slot));
             qd.setVar("cancel", false); 
             qd.setVar("cancel", false); 
         }, null);
         }, null);
@@ -174,7 +177,7 @@ public class ScriptEvents extends ModuleListener
         parser.callEvent("inv_close", qd, sc -> 
         parser.callEvent("inv_close", qd, sc -> 
         {
         {
             ScriptVars.setPlayerVars(qd, p); 
             ScriptVars.setPlayerVars(qd, p); 
-            qd.setEventVar("inv_id", inv.getId());
+            qd.setEventVar("inv_id", (double) inv.getId());
             qd.setEventVar("inv_name", inv.getName());
             qd.setEventVar("inv_name", inv.getName());
             qd.setVar("cancel", false); 
             qd.setVar("cancel", false); 
         }, null);
         }, null);
@@ -186,8 +189,8 @@ public class ScriptEvents extends ModuleListener
     {
     {
         handleEvent(e.getEntityPlayer(), "player_respawn", (qd) -> 
         handleEvent(e.getEntityPlayer(), "player_respawn", (qd) -> 
         {
         {
-            qd.setVar("keep_inventory", e.isInventoryKeepingForced());
-            qd.setVar("respawn_loc", new Location(e.getWorld(), e.getRespawnLoc()));
+            qd.setEventVar("keep_inventory", e.isInventoryKeepingForced());
+            qd.setEventVar("respawn_loc", new Location(e.getWorld(), e.getRespawnLoc()));
         }, (qd) -> 
         }, (qd) -> 
         {
         {
             try 
             try 
@@ -212,23 +215,23 @@ public class ScriptEvents extends ModuleListener
         {
         {
             if(p.getHealth() <= e.getAmount())
             if(p.getHealth() <= e.getAmount())
             {
             {
-                qd.setVar("player_killed", true);   
+                qd.setEventVar("player_killed", true);   
             }  
             }  
             else
             else
             {
             {
-                qd.setVar("player_killed", false); 
+                qd.setEventVar("player_killed", false); 
             }
             }
-            qd.setVar("player_damage", e.getAmount());   
-            qd.setVar("player_damage_cause", e.getSource().getDamageType());
+            qd.setEventVar("player_damage", (double) e.getAmount());   
+            qd.setEventVar("player_damage_cause", e.getSource().getDamageType());
             EntityPlayer ent = Utils.getDamager(e.getSource());
             EntityPlayer ent = Utils.getDamager(e.getSource());
             if(ent != null)
             if(ent != null)
             {
             {
-                qd.setVar("player_involved", true);
+                qd.setEventVar("player_involved", true);
                 ScriptVars.setSecPlayer(qd, ent);
                 ScriptVars.setSecPlayer(qd, ent);
             }
             }
             else
             else
             {
             {
-                qd.setVar("player_involved", false);
+                qd.setEventVar("player_involved", false);
             }
             }
             qd.setVar("cancel", e.isCanceled()); 
             qd.setVar("cancel", e.isCanceled()); 
         }, (qd) -> 
         }, (qd) -> 
@@ -249,12 +252,12 @@ public class ScriptEvents extends ModuleListener
                 EntityPlayer p = Utils.getDamager(e.getSource());
                 EntityPlayer p = Utils.getDamager(e.getSource());
                 if(p != null)
                 if(p != null)
                 {
                 {
-                    qd.setVar("player_involved", true);
+                    qd.setEventVar("player_involved", true);
                     ScriptVars.setPlayerVars(qd, p);
                     ScriptVars.setPlayerVars(qd, p);
                 }  
                 }  
                 else
                 else
                 {
                 {
-                    qd.setVar("player_involved", false);
+                    qd.setEventVar("player_involved", false);
                 }
                 }
                 qd.setVar("cancel", e.isCanceled()); 
                 qd.setVar("cancel", e.isCanceled()); 
             }, (qd) -> 
             }, (qd) -> 
@@ -266,8 +269,8 @@ public class ScriptEvents extends ModuleListener
         EntityPlayer p = (EntityPlayer) e.getEntity();    
         EntityPlayer p = (EntityPlayer) e.getEntity();    
         handleEvent(p, "player_death", (qd) -> 
         handleEvent(p, "player_death", (qd) -> 
         {
         {
-            //qd.setVar("message", e.getDeathMessage());
-            qd.setVar("clear", false);
+            //qd.setEventVar("message", e.getDeathMessage());
+            qd.setEventVar("clear", false);
             EntityPlayer ent = Utils.getDamager(e.getSource());
             EntityPlayer ent = Utils.getDamager(e.getSource());
             if(ent != null)
             if(ent != null)
             {
             {
@@ -295,10 +298,10 @@ public class ScriptEvents extends ModuleListener
         }
         }
         handleEvent(p, "entity_hurt", (qd) -> 
         handleEvent(p, "entity_hurt", (qd) -> 
         {
         {
-            qd.setVar("entity_killed", e.getEntityLiving().getHealth() <= e.getAmount());        
+            qd.setEventVar("entity_killed", e.getEntityLiving().getHealth() <= e.getAmount());        
             ScriptVars.setEntityVars(qd, e.getEntity()); 
             ScriptVars.setEntityVars(qd, e.getEntity()); 
-            qd.setVar("entity_damage", e.getAmount());   
-            qd.setVar("entity_damage_cause", e.getSource().getDamageType());
+            qd.setEventVar("entity_damage", (double) e.getAmount());   
+            qd.setEventVar("entity_damage_cause", e.getSource().getDamageType());
             qd.setVar("cancel", e.isCanceled());   
             qd.setVar("cancel", e.isCanceled());   
         }, (qd) -> 
         }, (qd) -> 
         {
         {
@@ -313,17 +316,17 @@ public class ScriptEvents extends ModuleListener
         {
         {
             handleEvent(null, "entity_drop", (qd) -> 
             handleEvent(null, "entity_drop", (qd) -> 
             {
             {
-                qd.setVar("drops", e.getDrops());
+                qd.setEventVar("drops", e.getDrops());
                 ScriptVars.setEntityVars(qd, e.getEntityLiving());
                 ScriptVars.setEntityVars(qd, e.getEntityLiving());
                 EntityPlayer p = Utils.getDamager(e.getSource());
                 EntityPlayer p = Utils.getDamager(e.getSource());
                 if(p != null)
                 if(p != null)
                 {
                 {
-                    qd.setVar("player_involved", true);
+                    qd.setEventVar("player_involved", true);
                     ScriptVars.setPlayerVars(qd, p);
                     ScriptVars.setPlayerVars(qd, p);
                 }  
                 }  
                 else
                 else
                 {
                 {
-                    qd.setVar("player_involved", false);
+                    qd.setEventVar("player_involved", false);
                 }
                 }
                 qd.setVar("cancel", e.isCanceled()); 
                 qd.setVar("cancel", e.isCanceled()); 
             }, (qd) -> 
             }, (qd) -> 
@@ -359,12 +362,12 @@ public class ScriptEvents extends ModuleListener
             {
             {
                 if(e.getRayTraceResult().entityHit != null)
                 if(e.getRayTraceResult().entityHit != null)
                 {
                 {
-                    qd.setVar("is_entity_hit", true);
-                    qd.setVar("entity_hit", e.getRayTraceResult().entityHit);
+                    qd.setEventVar("is_entity_hit", true);
+                    qd.setEventVar("entity_hit", e.getRayTraceResult().entityHit);
                 }
                 }
                 else
                 else
                 {
                 {
-                    qd.setVar("is_entity_hit", false);
+                    qd.setEventVar("is_entity_hit", false);
                 }
                 }
                 ScriptVars.setEntityVars(qd, e.getEntityThrowable());
                 ScriptVars.setEntityVars(qd, e.getEntityThrowable());
             });
             });
@@ -376,7 +379,7 @@ public class ScriptEvents extends ModuleListener
         handleEvent(p, "item_hit", (qd) -> 
         handleEvent(p, "item_hit", (qd) -> 
         {
         {
             ScriptVars.setItemVars(qd, stack);
             ScriptVars.setItemVars(qd, stack);
-            qd.setVar("entities", ents);
+            qd.setEventVar("entities", ents);
         });      
         });      
     }
     }
     
     
@@ -396,8 +399,8 @@ public class ScriptEvents extends ModuleListener
         handleEvent(p, "entity_shear", (qd) -> 
         handleEvent(p, "entity_shear", (qd) -> 
         {
         {
             ScriptVars.setEntityVars(qd, sheep);
             ScriptVars.setEntityVars(qd, sheep);
-            qd.setVar("entity_sheared", sheep.getSheared());
-            qd.setVar("entity_color", sheep.getFleeceColor().toString());
+            qd.setEventVar("entity_sheared", sheep.getSheared());
+            qd.setEventVar("entity_color", sheep.getFleeceColor().toString());
             qd.setVar("cancel", e.isCanceled()); 
             qd.setVar("cancel", e.isCanceled()); 
         }, (qd) -> 
         }, (qd) -> 
         {
         {
@@ -429,10 +432,10 @@ public class ScriptEvents extends ModuleListener
         }
         }
         handleEvent(p, "player_login", (qd) -> 
         handleEvent(p, "player_login", (qd) -> 
         {       
         {       
-            qd.setVar("first_join", Utils.hasPlayedBefore(p));
+            qd.setEventVar("first_join", Utils.hasPlayedBefore(p));
             PlayerList list = KajetansMod.server.getPlayerList();
             PlayerList list = KajetansMod.server.getPlayerList();
-            qd.setVar("is_banned", list.getBannedPlayers().isBanned(p.getGameProfile()));
-            qd.setVar("is_whitelisted", list.getWhitelistedPlayers().isWhitelisted(p.getGameProfile()));
+            qd.setEventVar("is_banned", list.getBannedPlayers().isBanned(p.getGameProfile()));
+            qd.setEventVar("is_whitelisted", list.getWhitelistedPlayers().isWhitelisted(p.getGameProfile()));
         });
         });
     }
     }
     
     
@@ -442,8 +445,8 @@ public class ScriptEvents extends ModuleListener
         EntityPlayer p = e.getEntityPlayer();
         EntityPlayer p = e.getEntityPlayer();
         handleEvent(p, "player_join_server", (qd) -> 
         handleEvent(p, "player_join_server", (qd) -> 
         {       
         {       
-            qd.setVar("message", e.getMessage());
-            qd.setVar("changed_name", e.hasNameChanged());
+            qd.setEventVar("message", e.getMessage());
+            qd.setEventVar("changed_name", e.hasNameChanged());
             qd.setVar("cancel", e.isCanceled()); 
             qd.setVar("cancel", e.isCanceled()); 
         }, (qd) -> 
         }, (qd) -> 
         {
         {
@@ -458,7 +461,7 @@ public class ScriptEvents extends ModuleListener
         EntityPlayer p = e.getEntityPlayer();
         EntityPlayer p = e.getEntityPlayer();
         handleEvent(p, "player_leave", (qd) -> 
         handleEvent(p, "player_leave", (qd) -> 
         {       
         {       
-            qd.setVar("message", e.getMessage());
+            qd.setEventVar("message", e.getMessage());
             qd.setVar("cancel", e.isCanceled()); 
             qd.setVar("cancel", e.isCanceled()); 
         }, (qd) -> 
         }, (qd) -> 
         {
         {
@@ -478,17 +481,17 @@ public class ScriptEvents extends ModuleListener
                 BlockPos pos = ray.getBlockPos();
                 BlockPos pos = ray.getBlockPos();
                 if(pos != null)
                 if(pos != null)
                 {
                 {
-                    qd.setVar("has_block", true); 
+                    qd.setEventVar("has_block", true); 
                     ScriptVars.setBlockVars(qd, e.getWorld(), pos);
                     ScriptVars.setBlockVars(qd, e.getWorld(), pos);
                 }
                 }
                 else
                 else
                 {
                 {
-                    qd.setVar("has_block", false); 
+                    qd.setEventVar("has_block", false); 
                 }
                 }
             }
             }
             else
             else
             {
             {
-                qd.setVar("has_block", false); 
+                qd.setEventVar("has_block", false); 
             }
             }
             qd.setVar("cancel", e.isCanceled()); 
             qd.setVar("cancel", e.isCanceled()); 
         }, (qd) -> 
         }, (qd) -> 
@@ -502,7 +505,7 @@ public class ScriptEvents extends ModuleListener
     {
     {
         handleEvent(e.getPlayer(), "block_place", (qd) -> 
         handleEvent(e.getPlayer(), "block_place", (qd) -> 
         {
         {
-            qd.setVar("block_type_after", e.getPlacedBlock().getBlock().getRegistryName());
+            qd.setEventVar("block_type_after", e.getPlacedBlock().getBlock().getRegistryName());
             ScriptVars.setBlockVars(qd, e.getWorld(), e.getPos());
             ScriptVars.setBlockVars(qd, e.getWorld(), e.getPos());
             qd.setVar("cancel", e.isCanceled()); 
             qd.setVar("cancel", e.isCanceled()); 
         }, (qd) -> 
         }, (qd) -> 
@@ -520,7 +523,7 @@ public class ScriptEvents extends ModuleListener
         }
         }
         handleEvent(e.getEntityPlayer(), "block_click", (qd) -> 
         handleEvent(e.getEntityPlayer(), "block_click", (qd) -> 
         {
         {
-            qd.setVar("action", "right");
+            qd.setEventVar("action", "right");
             ScriptVars.setBlockVars(qd, e.getWorld(), e.getPos());
             ScriptVars.setBlockVars(qd, e.getWorld(), e.getPos());
             qd.setVar("cancel", e.isCanceled()); 
             qd.setVar("cancel", e.isCanceled()); 
         }, (qd) -> 
         }, (qd) -> 
@@ -538,7 +541,7 @@ public class ScriptEvents extends ModuleListener
         }
         }
         handleEvent(e.getEntityPlayer(), "block_click", (qd) -> 
         handleEvent(e.getEntityPlayer(), "block_click", (qd) -> 
         {
         {
-            qd.setVar("action", "left");
+            qd.setEventVar("action", "left");
             ScriptVars.setBlockVars(qd, e.getWorld(), e.getPos());
             ScriptVars.setBlockVars(qd, e.getWorld(), e.getPos());
             qd.setVar("cancel", e.isCanceled()); 
             qd.setVar("cancel", e.isCanceled()); 
         }, (qd) -> 
         }, (qd) -> 
@@ -568,7 +571,7 @@ public class ScriptEvents extends ModuleListener
     {
     {
         handleEvent(e.getEntityPlayer(), "fishing", (qd) -> 
         handleEvent(e.getEntityPlayer(), "fishing", (qd) -> 
         {
         {
-            qd.setVar("drops", e.getDrops());
+            qd.setEventVar("drops", e.getDrops());
             qd.setVar("cancel", e.isCanceled()); 
             qd.setVar("cancel", e.isCanceled()); 
         }, (qd) -> 
         }, (qd) -> 
         {
         {
@@ -582,7 +585,7 @@ public class ScriptEvents extends ModuleListener
         handleEvent(e.getEntityPlayer(), "item_air_click", (qd) -> 
         handleEvent(e.getEntityPlayer(), "item_air_click", (qd) -> 
         {
         {
             ScriptVars.setItemVars(qd, e.getItemStack());
             ScriptVars.setItemVars(qd, e.getItemStack());
-            qd.setVar("hand", e.getHand().toString());
+            qd.setEventVar("hand", e.getHand().toString());
             qd.setVar("cancel", e.isCanceled());  
             qd.setVar("cancel", e.isCanceled());  
         }, (qd) -> 
         }, (qd) -> 
         {
         {
@@ -594,7 +597,7 @@ public class ScriptEvents extends ModuleListener
     {        
     {        
         handleEvent(p, "arm_swing", (qd) -> 
         handleEvent(p, "arm_swing", (qd) -> 
         {
         {
-            qd.setVar("hand", hand);
+            qd.setEventVar("hand", hand);
         });
         });
     }
     }
     
     
@@ -607,14 +610,14 @@ public class ScriptEvents extends ModuleListener
         }
         }
         handleEvent((EntityPlayer) e.getEntityLiving(), "item_use_start", (qd) -> 
         handleEvent((EntityPlayer) e.getEntityLiving(), "item_use_start", (qd) -> 
         {
         {
-            qd.setVar("duration", e.getDuration());
+            qd.setEventVar("duration", (double) e.getDuration());
             qd.setVar("cancel", e.isCanceled());  
             qd.setVar("cancel", e.isCanceled());  
         }, (qd) -> 
         }, (qd) -> 
         {
         {
             e.setCanceled(qd.getBooleanVar("cancel"));
             e.setCanceled(qd.getBooleanVar("cancel"));
             try
             try
             {
             {
-                e.setDuration((int) qd.getVar("duration"));
+                e.setDuration(ScriptUtils.getInt(qd.getVar("duration")));
             }
             }
             catch(Exception ex)
             catch(Exception ex)
             {
             {
@@ -632,7 +635,7 @@ public class ScriptEvents extends ModuleListener
         }
         }
         handleEvent((EntityPlayer) e.getEntityLiving(), "item_use_finish", (qd) -> 
         handleEvent((EntityPlayer) e.getEntityLiving(), "item_use_finish", (qd) -> 
         {
         {
-            qd.setVar("result_stack", e.getResultStack());  
+            qd.setEventVar("result_stack", e.getResultStack());  
         });
         });
     }
     }
     
     
@@ -681,7 +684,7 @@ public class ScriptEvents extends ModuleListener
         EntityPlayer p = (EntityPlayer) e.getEntityMounting();
         EntityPlayer p = (EntityPlayer) e.getEntityMounting();
         handleEvent(p, "entity_mount", (qd) -> 
         handleEvent(p, "entity_mount", (qd) -> 
         {
         {
-            qd.setVar("mounting", e.isMounting()); 
+            qd.setEventVar("mounting", e.isMounting()); 
             ScriptVars.setEntityVars(qd, e.getEntityBeingMounted()); 
             ScriptVars.setEntityVars(qd, e.getEntityBeingMounted()); 
             qd.setVar("cancel", e.isCanceled()); 
             qd.setVar("cancel", e.isCanceled()); 
         }, (qd) -> 
         }, (qd) -> 
@@ -695,8 +698,8 @@ public class ScriptEvents extends ModuleListener
     {
     {
         handleEvent(e.player, "portal", (qd) -> 
         handleEvent(e.player, "portal", (qd) -> 
         {
         {
-            qd.setVar("from", ModDimensions.getWorldName(e.fromDim));
-            qd.setVar("to", ModDimensions.getWorldName(e.toDim));
+            qd.setEventVar("from", ModDimensions.getWorldName(e.fromDim));
+            qd.setEventVar("to", ModDimensions.getWorldName(e.toDim));
         });
         });
     }
     }
     
     
@@ -707,8 +710,8 @@ public class ScriptEvents extends ModuleListener
         {
         {
             handleEvent((EntityPlayer) e.getSender(), "command", (qd) -> 
             handleEvent((EntityPlayer) e.getSender(), "command", (qd) -> 
             {
             {
-                qd.setVar("command", e.getCommand().getName()); 
-                qd.setVar("args", Arrays.stream(e.getParameters()).map(s -> Code.convertInput(s, false)).collect(Collectors.toList()));
+                qd.setEventVar("command", e.getCommand().getName()); 
+                qd.setEventVar("args", Arrays.stream(e.getParameters()).map(s -> Code.convertInput(s, false)).collect(Collectors.toList()));
                 qd.setVar("cancel", e.isCanceled()); 
                 qd.setVar("cancel", e.isCanceled()); 
             }, (qd) -> 
             }, (qd) -> 
             {
             {
@@ -721,13 +724,13 @@ public class ScriptEvents extends ModuleListener
     {
     {
         handleEvent(p, "custom_command", (qd) -> 
         handleEvent(p, "custom_command", (qd) -> 
         {
         {
-            qd.setVar("command", command);
+            qd.setEventVar("command", command);
             if(args.length() == 0)
             if(args.length() == 0)
             {
             {
-                qd.setVar("args", new ArrayList<>());
+                qd.setEventVar("args", new ArrayList<>());
                 return;
                 return;
             }
             }
-            qd.setVar("args", Arrays.stream(args.trim().split(" ")).map(s -> Code.convertInput(s, false)).collect(Collectors.toList()));
+            qd.setEventVar("args", Arrays.stream(args.trim().split(" ")).map(s -> Code.convertInput(s, false)).collect(Collectors.toList()));
         });
         });
     }
     }
       
       
@@ -735,16 +738,16 @@ public class ScriptEvents extends ModuleListener
     {    
     {    
         handleEvent(e.getPlayer(), "player_use_effect", (qd) -> 
         handleEvent(e.getPlayer(), "player_use_effect", (qd) -> 
         {       
         {       
-            qd.setVar("power", e.getPower());
-            qd.setVar("mana_cost", e.getMana());
-            qd.setVar("cause", e.getCause().toString());
-            qd.setVar("effect", e.getEffect());
+            qd.setEventVar("power", (double) e.getPower());
+            qd.setEventVar("mana_cost", (double) e.getMana());
+            qd.setEventVar("cause", e.getCause().toString());
+            qd.setEventVar("effect", e.getEffect());
             qd.setVar("cancel", e.isCanceled());
             qd.setVar("cancel", e.isCanceled());
         }, (qd) -> 
         }, (qd) -> 
         {
         {
             try
             try
             {
             {
-                int power = (int) qd.getVar("power");
+                int power = ScriptUtils.getInt(qd.getVar("power"));
                 if(power < 1 || power > 20)
                 if(power < 1 || power > 20)
                 {
                 {
                     throw new IllegalArgumentException();
                     throw new IllegalArgumentException();
@@ -757,7 +760,7 @@ public class ScriptEvents extends ModuleListener
             }
             }
             try
             try
             {
             {
-                int mana = (int) qd.getVar("mana_cost");
+                int mana = ScriptUtils.getInt(qd.getVar("mana_cost"));
                 if(mana < 0)
                 if(mana < 0)
                 {
                 {
                     throw new IllegalArgumentException();
                     throw new IllegalArgumentException();
@@ -801,8 +804,8 @@ public class ScriptEvents extends ModuleListener
             data.setVar("event", "villager_give");
             data.setVar("event", "villager_give");
             ScriptVars.setPlayerVars(data, p); 
             ScriptVars.setPlayerVars(data, p); 
             ScriptVars.setItemVars(data, itemEnt.getItem());
             ScriptVars.setItemVars(data, itemEnt.getItem());
-            data.setVar("villager_loc", new Location(v));                    
-            data.setVar("villager_prof", v.getProfessionForge().getRegistryName());
+            data.setEventVar("villager_loc", new Location(v));                    
+            data.setEventVar("villager_prof", v.getProfessionForge().getRegistryName());
             data.setVar("cancel", e.isCanceled()); 
             data.setVar("cancel", e.isCanceled()); 
             data.runCode();
             data.runCode();
             if(data.getBooleanVar("cancel"))
             if(data.getBooleanVar("cancel"))

+ 10 - 1
src/main/resources/assets/forge/models/textures/items/honey_bucket.png


+ 0 - 0
src/main/resources/assets/km/lang/en_US.lang