Browse Source

camp fire icon, bugfixes, fixed custom damage system, code refactoring

Kajetan Johannes Hammerle 7 years ago
parent
commit
bcc47c4326
45 changed files with 546 additions and 216 deletions
  1. 0 1
      build.gradle
  2. 1 1
      gradle.properties
  3. 0 3
      src/main/java/me/km/ClientEvents.java
  4. 19 42
      src/main/java/me/km/KajetansMod.java
  5. 2 1
      src/main/java/me/km/ObjectRegistry.java
  6. 2 2
      src/main/java/me/km/api/Location.java
  7. 0 1
      src/main/java/me/km/api/MessageSender.java
  8. 2 2
      src/main/java/me/km/api/SimpleConfig.java
  9. 2 2
      src/main/java/me/km/blocks/BlockBase.java
  10. 20 1
      src/main/java/me/km/blocks/BlockCampFire.java
  11. 0 2
      src/main/java/me/km/blocks/BlockCampFireBurning.java
  12. 0 2
      src/main/java/me/km/blocks/BlockEvents.java
  13. 2 2
      src/main/java/me/km/blocks/BlockHay.java
  14. 1 2
      src/main/java/me/km/blocks/BlockSpikeTrap.java
  15. 2 2
      src/main/java/me/km/blocks/IBlockBase.java
  16. 1 3
      src/main/java/me/km/blocks/ModBlocks.java
  17. 5 1
      src/main/java/me/km/blocks/TileEntityCampFire.java
  18. 1 1
      src/main/java/me/km/commands/CommandLastSeen.java
  19. 1 1
      src/main/java/me/km/commands/CommandSeen.java
  20. 41 2
      src/main/java/me/km/datatools/CommandHuman.java
  21. 2 2
      src/main/java/me/km/datatools/DataToolsEvents.java
  22. 47 53
      src/main/java/me/km/effects/passive/EntityDamageEffects.java
  23. 4 0
      src/main/java/me/km/effects/passive/EntityDrop.java
  24. 0 3
      src/main/java/me/km/entities/EntityHuman.java
  25. 18 4
      src/main/java/me/km/inventory/CustomContainer.java
  26. 140 2
      src/main/java/me/km/inventory/CustomContainerBase.java
  27. 0 20
      src/main/java/me/km/inventory/IdSlot.java
  28. 108 25
      src/main/java/me/km/inventory/InventoryBase.java
  29. 3 2
      src/main/java/me/km/inventory/TeleportContainer.java
  30. 32 0
      src/main/java/me/km/items/ItemBlockSpecial.java
  31. 6 2
      src/main/java/me/km/items/ModItems.java
  32. 7 4
      src/main/java/me/km/jobsystem/JobAPI.java
  33. 5 3
      src/main/java/me/km/networking/CampFireInventory.java
  34. 4 1
      src/main/java/me/km/networking/CustomInventory.java
  35. 2 2
      src/main/java/me/km/playerbank/GodMode.java
  36. 7 6
      src/main/java/me/km/skills/SkillContainer.java
  37. 33 5
      src/main/java/me/km/snuviscript/MinecraftFunctions.java
  38. 4 4
      src/main/java/me/km/snuviscript/ScriptEvents.java
  39. 2 2
      src/main/java/me/km/snuviscript/ScriptInventoryHolder.java
  40. 1 1
      src/main/java/me/km/snuviscript/ScriptModule.java
  41. 6 0
      src/main/java/me/km/snuviscript/SnuviInventory.java
  42. 1 1
      src/main/java/me/km/utils/NBTUtils.java
  43. 5 0
      src/main/resources/assets/km/lang/en_US.lang
  44. 7 0
      src/main/resources/assets/km/models/item/camp_fire_item.json
  45. BIN
      src/main/resources/assets/km/textures/items/campfire_icon.png

+ 0 - 1
build.gradle

@@ -11,7 +11,6 @@ buildscript {
 apply plugin: 'net.minecraftforge.gradle.forge'
 //Only edit below this line, the above code adds and enables the necessary things for Forge to be setup.
 
-
 version = "1.0"
 group = "me.hammerle.km" // http://maven.apache.org/guides/mini/guide-naming-conventions.html
 archivesBaseName = "km"

+ 1 - 1
gradle.properties

@@ -1,3 +1,3 @@
 # Sets default memory used for gradle commands. Can be overridden by user or command line properties.
 # This is required to provide enough memory for the Minecraft decompilation process.
-org.gradle.jvmargs=-Xmx3G
+org.gradle.jvmargs = -Xmx3G

+ 0 - 3
src/main/java/me/km/ClientEvents.java

@@ -2,8 +2,6 @@ package me.km;
 
 import java.util.List;
 import me.km.api.GlobalText;
-import me.km.entities.EntityHuman;
-import me.km.networking.ModPacketHandler;
 import me.km.networking.PlayerDisplayGui;
 import net.minecraft.item.Item;
 import net.minecraft.item.ItemArmor;
@@ -14,7 +12,6 @@ import net.minecraft.util.text.TextComponentTranslation;
 import net.minecraft.util.text.TextFormatting;
 import net.minecraftforge.client.event.ClientChatReceivedEvent;
 import net.minecraftforge.client.event.RenderGameOverlayEvent;
-import net.minecraftforge.event.entity.EntityJoinWorldEvent;
 import net.minecraftforge.event.entity.player.ItemTooltipEvent;
 import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
 import net.minecraftforge.fml.relauncher.Side;

+ 19 - 42
src/main/java/me/km/KajetansMod.java

@@ -4,7 +4,6 @@ import me.km.capabilities.CapabilitiesEvents;
 import me.km.api.Module;
 import me.km.api.SimpleConfig;
 import me.km.api.CommandOverloader;
-import me.km.api.Utils;
 import me.km.blockprotections.BlockProtectionBank;
 import me.km.capabilities.DamageUtils;
 import me.km.chatmanager.ChatManager;
@@ -12,8 +11,6 @@ import me.km.databank.DataBank;
 import me.km.dimensions.ModWorldGeneration;
 import me.km.dimensions.WorldData;
 import me.km.effects.EffectUtils;
-import me.km.entities.EntityHuman;
-import me.km.fluids.ModFluids;
 import me.km.jobsystem.JobAPI;
 import me.km.networking.ModPacketHandler;
 import me.km.permissions.PermissionManager;
@@ -71,7 +68,7 @@ public class KajetansMod
 
     public static final String MODID = "km";
     public static final String NAME = "Kajetans Mod";
-    public static final String VERSION = "0.0.15";
+    public static final String VERSION = "0.0.16";
 
     @Mod.Instance(MODID)
     public static KajetansMod instance;
@@ -91,65 +88,45 @@ public class KajetansMod
     {
         System.out.println(NAME + " is loading!");
         ModPacketHandler.init();
-        ModFluids.init();
         GameRegistry.registerWorldGenerator(new ModWorldGeneration(), 3);
         
         DamageUtils.init();
         CapabilitiesEvents.init();
         
-        net.minecraftforge.common.MinecraftForge.EVENT_BUS.register(new Object()
+        /*net.minecraftforge.common.MinecraftForge.EVENT_BUS.register(new Object()
             {
                 public me.km.inventory.InventoryBase inv = null;
                 
-                @net.minecraftforge.fml.common.eventhandler.SubscribeEvent
-                public void wusi(net.minecraftforge.client.event.ClientChatEvent e) 
-                {
-                    net.minecraft.client.entity.EntityPlayerSP p = net.minecraft.client.Minecraft.getMinecraft().player;
-                }
-                
                 @net.minecraftforge.fml.common.eventhandler.SubscribeEvent
                 public void wusi2(net.minecraftforge.event.ServerChatEvent e) 
                 {
                     net.minecraft.entity.player.EntityPlayerMP p = e.getPlayer();
-                    /*if(inv == null)
+                    if(inv == null)
                     {
                         System.out.println("NEU");
-                        inv = new me.km.inventory.InventoryBase("Test Titel", "21102111", p);
+                        inv = new me.km.inventory.InventoryBase("Test Titel", "2110211112302", p);
                     }
-                    new me.km.inventory.CustomContainer(inv, p).openForPlayer();*/
-                    try
+                    new me.km.inventory.CustomContainer(inv, p)
                     {
-                        String[] parts = e.getMessage().split(" ");
-                        switch(parts[0])
+                        @Override
+                        public boolean onButtonClick(int slotId, int dragType, ClickType clickTypeIn, net.minecraft.entity.player.EntityPlayerMP player) 
                         {
-                            case "spawn": 
-                            {
-                                EntityHuman h = new EntityHuman(p.world);
-                                h.setPosition(p.posX, p.posY, p.posZ);
-                                p.world.spawnEntity(h);
-                                break;
-                            }
-                            case "name": 
-                            {
-                                Utils.getEntities(p.world, p.posX, p.posY, p.posZ, 2, EntityHuman.class).forEach(h -> h.setName(parts[1]));
-                                break;
-                            }
-                            case "slim": 
-                            {
-                                Utils.getEntities(p.world, p.posX, p.posY, p.posZ, 2, EntityHuman.class).forEach(h -> h.setSlim(!h.isSlim()));
-                                break;
-                            }
-                            default:
-                                float f = Float.parseFloat(e.getMessage());
-                                Utils.getEntities(p.world, p.posX, p.posY, p.posZ, 5, EntityHuman.class).forEach(h -> h.setScale(f));
+                            return true;
                         }
-                            
-                    }
-                    catch(Exception ex)
+                    }.openForPlayer();
+                }
+                
+                @net.minecraftforge.fml.common.eventhandler.SubscribeEvent
+                public void changeConnectionOnJoin(net.minecraftforge.fml.common.gameevent.PlayerEvent.PlayerLoggedInEvent e)
+                {      
+                    if(e.player != null && e.player instanceof net.minecraft.entity.player.EntityPlayerMP)
                     {
+                        net.minecraft.entity.player.EntityPlayerMP p = (net.minecraft.entity.player.EntityPlayerMP) e.player;
+                        // new handler sets connection with player in constructor, doing it twice
+                        p.connection = new me.km.playerbank.ModNetHandlerPlayServer(p.mcServer, p.connection.netManager, p);
                     }
                 }
-            });
+            });*/
     }
     
     @Mod.EventHandler

+ 2 - 1
src/main/java/me/km/ObjectRegistry.java

@@ -1,6 +1,7 @@
 package me.km;
 
 import me.km.blocks.ModBlocks;
+import me.km.fluids.ModFluids;
 import me.km.items.ModItems;
 import me.km.recipes.ModRecipes;
 import me.km.sounds.Sounds;
@@ -12,7 +13,6 @@ import net.minecraft.util.SoundEvent;
 import net.minecraftforge.event.RegistryEvent;
 import net.minecraftforge.fml.common.Mod;
 import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
-import net.minecraftforge.registries.IForgeRegistry;
 
 @Mod.EventBusSubscriber
 public class ObjectRegistry 
@@ -20,6 +20,7 @@ public class ObjectRegistry
     @SubscribeEvent
     public static void onBlockRegistry(RegistryEvent.Register<Block> e) 
     {
+        ModFluids.init();
         ModBlocks.initBlocks(e.getRegistry());
     }
     

+ 2 - 2
src/main/java/me/km/api/Location.java

@@ -82,12 +82,12 @@ public class Location
                 this.pitch = 0;
                 return;
             }
-            sc.getLogger().printException(new IllegalStringLocationException(location), sc, sc.getActiveRealCodeLine());
+            sc.getLogger().printException(new IllegalStringLocationException(location), "read.location", sc, sc.getActiveRealCodeLine());
             throw new HoldCodeException();
         }
         catch(PatternSyntaxException | NumberFormatException ex)
         {
-            sc.getLogger().printException(new IllegalStringLocationException(location), sc, sc.getActiveRealCodeLine());
+            sc.getLogger().printException(new IllegalStringLocationException(location), "read.location", sc, sc.getActiveRealCodeLine());
             throw new HoldCodeException();
         }
     }

+ 0 - 1
src/main/java/me/km/api/MessageSender.java

@@ -3,7 +3,6 @@ package me.km.api;
 import me.km.KajetansMod;
 import net.minecraft.command.ICommandSender;
 import net.minecraft.entity.player.EntityPlayer;
-import net.minecraft.util.math.Vec3d;
 import net.minecraft.util.text.ITextComponent;
 import net.minecraft.util.text.TextFormatting;
 import net.minecraft.util.text.TextComponentString;

+ 2 - 2
src/main/java/me/km/api/SimpleConfig.java

@@ -16,13 +16,13 @@ public class SimpleConfig extends SnuviConfig
         super(new ISnuviLogger() 
         {
             @Override
-            public void printException(Exception ex, Script sc, int line)
+            public void printException(Exception ex, String function, Script sc, int line)
             {
                 // should not happen
             }
 
             @Override
-            public void printException(Exception ex, String s, int line) 
+            public void printException(Exception ex, String function, String s, int line) 
             {
                  // should not happen
             }

+ 2 - 2
src/main/java/me/km/blocks/BlockBase.java

@@ -7,7 +7,7 @@ import net.minecraft.block.material.Material;
 import net.minecraft.block.state.IBlockState;
 import net.minecraft.creativetab.CreativeTabs;
 import net.minecraft.entity.Entity;
-import net.minecraft.item.ItemBlock;
+import net.minecraft.item.Item;
 import net.minecraft.util.math.BlockPos;
 import net.minecraft.world.IBlockAccess;
 import net.minecraft.world.World;
@@ -42,7 +42,7 @@ public class BlockBase extends Block implements IBlockBase
     }
     
     @Override
-    public void registerItemModel(ItemBlock itemBlock) 
+    public void registerItemModel(Item itemBlock) 
     {
         KajetansMod.proxy.registerItemRenderer(itemBlock, 0, name);
     }

+ 20 - 1
src/main/java/me/km/blocks/BlockCampFire.java

@@ -1,11 +1,18 @@
 package me.km.blocks;
 
+import java.util.Random;
+import static me.km.blocks.BlockModBed.PART;
+import me.km.items.ModItems;
 import net.minecraft.block.Block;
+import net.minecraft.block.BlockBed;
 import net.minecraft.block.material.Material;
 import net.minecraft.block.state.IBlockState;
 import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.init.Items;
+import net.minecraft.item.Item;
 import net.minecraft.item.ItemStack;
 import net.minecraft.util.BlockRenderLayer;
+import net.minecraft.util.EnumBlockRenderType;
 import net.minecraft.util.EnumFacing;
 import net.minecraft.util.EnumHand;
 import net.minecraft.util.math.AxisAlignedBB;
@@ -62,7 +69,13 @@ public class BlockCampFire extends BlockBase
     @Override
     public ItemStack getItem(World worldIn, BlockPos pos, IBlockState state) 
     {
-        return new ItemStack(ModBlocks.campFire);
+        return new ItemStack(ModItems.campFire);
+    }
+    
+    @Override
+    public Item getItemDropped(IBlockState state, Random rand, int fortune)
+    {
+        return ModItems.campFire;
     }
     
     @SideOnly(Side.CLIENT)
@@ -79,6 +92,12 @@ public class BlockCampFire extends BlockBase
         return BlockRenderLayer.CUTOUT;
     }
     
+    @Override
+    public EnumBlockRenderType getRenderType(IBlockState state)
+    {
+        return EnumBlockRenderType.MODEL;
+    }
+    
     @Override
     public boolean canPlaceBlockAt(World w, BlockPos pos)
     {

+ 0 - 2
src/main/java/me/km/blocks/BlockCampFireBurning.java

@@ -2,7 +2,6 @@ package me.km.blocks;
 
 import java.util.Random;
 import me.km.inventory.ContainerCampFire;
-import me.km.networking.ModPacketHandler;
 import net.minecraft.block.ITileEntityProvider;
 import net.minecraft.block.state.IBlockState;
 import net.minecraft.entity.player.EntityPlayer;
@@ -107,7 +106,6 @@ public class BlockCampFireBurning extends BlockCampFire implements ITileEntityPr
         {
             InventoryHelper.dropInventoryItems(w, pos, (TileEntityCampFire) tile);
         }
-        System.out.println("REMOVING");
         w.removeTileEntity(pos);
     }
 }

+ 0 - 2
src/main/java/me/km/blocks/BlockEvents.java

@@ -4,7 +4,6 @@ import com.google.common.collect.Sets;
 import java.util.List;
 import java.util.Random;
 import java.util.Set;
-import me.km.networking.ModPacketHandler;
 import me.km.utils.ReflectionUtils;
 import net.minecraft.block.Block;
 import net.minecraft.block.material.Material;
@@ -14,7 +13,6 @@ import net.minecraft.entity.Entity;
 import net.minecraft.entity.EntityLivingBase;
 import net.minecraft.entity.item.EntityTNTPrimed;
 import net.minecraft.entity.player.EntityPlayer;
-import net.minecraft.entity.player.EntityPlayerMP;
 import net.minecraft.init.Blocks;
 import net.minecraft.init.SoundEvents;
 import net.minecraft.util.DamageSource;

+ 2 - 2
src/main/java/me/km/blocks/BlockHay.java

@@ -7,7 +7,7 @@ import net.minecraft.block.material.Material;
 import net.minecraft.block.state.IBlockState;
 import net.minecraft.creativetab.CreativeTabs;
 import net.minecraft.entity.Entity;
-import net.minecraft.item.ItemBlock;
+import net.minecraft.item.Item;
 import net.minecraft.util.EnumFacing;
 import net.minecraft.util.math.BlockPos;
 import net.minecraft.world.World;
@@ -36,7 +36,7 @@ public class BlockHay extends BlockRotatedPillar implements IBlockBase
     }
 
     @Override
-    public void registerItemModel(ItemBlock itemBlock) 
+    public void registerItemModel(Item itemBlock) 
     {
         KajetansMod.proxy.registerItemRenderer(itemBlock, 0, name);
     }

+ 1 - 2
src/main/java/me/km/blocks/BlockSpikeTrap.java

@@ -13,7 +13,6 @@ import net.minecraft.creativetab.CreativeTabs;
 import net.minecraft.entity.Entity;
 import net.minecraft.entity.EntityLivingBase;
 import net.minecraft.item.Item;
-import net.minecraft.item.ItemBlock;
 import net.minecraft.item.ItemStack;
 import net.minecraft.util.DamageSource;
 import net.minecraft.util.NonNullList;
@@ -54,7 +53,7 @@ public class BlockSpikeTrap extends BlockTrap
     }
 
     @Override
-    public void registerItemModel(ItemBlock itemBlock) 
+    public void registerItemModel(Item itemBlock) 
     {
         for(EnumMetals metal : EnumMetals.values())
         {

+ 2 - 2
src/main/java/me/km/blocks/IBlockBase.java

@@ -1,10 +1,10 @@
 package me.km.blocks;
 
 import net.minecraft.block.SoundType;
-import net.minecraft.item.ItemBlock;
+import net.minecraft.item.Item;
 
 public interface IBlockBase 
 {
-    public void registerItemModel(ItemBlock itemBlock);
+    public void registerItemModel(Item itemBlock);
     public IBlockBase setSoundType(SoundType sound);
 }

+ 1 - 3
src/main/java/me/km/blocks/ModBlocks.java

@@ -110,8 +110,6 @@ public class ModBlocks
         
         register(r, realHayBlock, getItemBlock(realHayBlock));
         
-        register(r, campFire, getItemBlock(campFire));
-        
         // traps
         register(r, spikes, getItemMetal(spikes));
         
@@ -120,7 +118,7 @@ public class ModBlocks
         register(r, honey, getItemBlock(honey));
     }
 
-    private static void register(IForgeRegistry<Item> r, Block block, ItemBlock itemBlock) 
+    private static void register(IForgeRegistry<Item> r, Block block, Item itemBlock) 
     {
         r.register(itemBlock);
         if(block instanceof IBlockBase) 

+ 5 - 1
src/main/java/me/km/blocks/TileEntityCampFire.java

@@ -29,7 +29,7 @@ public class TileEntityCampFire extends TileEntityLockable implements ITickable
         this.cookTime = new int[3];
         Arrays.fill(this.cookTime, 0);
         this.furnaceCustomName = null;
-        this.burnTime = 960;
+        this.burnTime = 9600;
     }
     
     @Override
@@ -179,6 +179,10 @@ public class TileEntityCampFire extends TileEntityLockable implements ITickable
                     }
                 }
             }
+            if(this.burnTime < 0)
+            {
+                world.setBlockState(pos, ModBlocks.campFireBurnt.getDefaultState());
+            }
             if(update)
             {
                 this.markDirty();

+ 1 - 1
src/main/java/me/km/commands/CommandLastSeen.java

@@ -25,7 +25,7 @@ public class CommandLastSeen extends ModuleCommand
     @Override
     public boolean execute(ICommandSender cs, String[] arg) 
     {
-        File[] files = new File("./saves/world/playerdata/").listFiles();
+        File[] files = new File("./world/playerdata/").listFiles();
         String helper;
         String name;
         long longhelper;

+ 1 - 1
src/main/java/me/km/commands/CommandSeen.java

@@ -39,7 +39,7 @@ public class CommandSeen extends ModuleCommand
                 this.getModule().send(cs, arg[0] + " war noch nie auf dem Server.");
                 return true;
             }
-            File f = new File("./saves/world/playerdata/" + uuid + ".dat"); 
+            File f = new File("./world/playerdata/" + uuid + ".dat"); 
             if(!f.exists())
             {
                 this.getModule().send(cs, "Die Spielerdaten wurden nicht gefunden.");

+ 41 - 2
src/main/java/me/km/datatools/CommandHuman.java

@@ -8,7 +8,6 @@ import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.List;
 import me.km.entities.EntityHuman;
-import me.km.networking.ModPacketHandler;
 import me.km.permissions.Permissions;
 import net.minecraft.command.ICommandSender;
 import net.minecraft.entity.player.EntityPlayerMP;
@@ -29,7 +28,7 @@ public class CommandHuman extends ModuleCommand
         super.addAlias("h");
         
         first = new ArrayList<>(Arrays.asList(new String[]
-                {"spawn", "set", "kill"})); 
+                {"spawn", "set", "kill", "size", "slim"})); 
     }
 
     @Override
@@ -98,6 +97,44 @@ public class CommandHuman extends ModuleCommand
                     m.send(cs, "Der Human wurde getötet.");
                     return true;
                 }
+                case "size":
+                {
+                    if(arg.length < 2)
+                    {
+                        break;
+                    }
+                    EntityHuman h = Utils.getTargetedEntity(p, 3, EntityHuman.class);
+                    if(h == null)
+                    {
+                        m.send(cs, "Du musst auf einen Human gerichtet sein.");
+                        return true;
+                    }       
+                    float scale;
+                    try
+                    {
+                        scale = Float.parseFloat(arg[1]);
+                    }
+                    catch(NumberFormatException ex)
+                    {
+                        m.send(cs, "Du musst einen gültigen Float eingeben.");
+                        return true;
+                    }
+                    h.setScale(scale);
+                    m.send(cs, "Der Human wurde skaliert.");
+                    return true;
+                }
+                case "slim":
+                {
+                    EntityHuman h = Utils.getTargetedEntity(p, 3, EntityHuman.class);
+                    if(h == null)
+                    {
+                        m.send(cs, "Du musst auf einen Human gerichtet sein.");
+                        return true;
+                    }       
+                    h.setSlim(!h.isSlim());
+                    m.send(cs, "Der Skin wurde geändert.");
+                    return true;
+                }
             }
         }
                     
@@ -105,6 +142,8 @@ public class CommandHuman extends ModuleCommand
         m.sendHelpListElement(cs, "spawn", "Spawnt einen Human");
         m.sendHelpListElement(cs, "set <name>", "Setzt den Namen");
         m.sendHelpListElement(cs, "kill", "Tötet einen Human");
+        m.sendHelpListElement(cs, "size <scale>", "Setzt die Größenskalierung");
+        m.sendHelpListElement(cs, "slim", "Schaltet Alex/Steve Skin");
         return true;  
     }
 }

+ 2 - 2
src/main/java/me/km/datatools/DataToolsEvents.java

@@ -10,8 +10,8 @@ import net.minecraft.entity.passive.EntityVillager;
 import net.minecraft.item.ItemStack;
 import net.minecraft.village.MerchantRecipe;
 import net.minecraft.village.MerchantRecipeList;
-import net.minecraftforge.event.entity.living.LivingHurtEvent;
 import net.minecraftforge.event.entity.EntityJoinWorldEvent;
+import net.minecraftforge.event.entity.living.LivingAttackEvent;
 import net.minecraftforge.event.entity.player.PlayerContainerEvent;
 import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
 
@@ -86,7 +86,7 @@ public class DataToolsEvents extends ModuleListener
 
     
     @SubscribeEvent
-    public void VillagerProtect(LivingHurtEvent e)
+    public void VillagerProtect(LivingAttackEvent e)
     { 
         if(e.getEntityLiving() instanceof EntityVillager && !e.getSource().isCreativePlayer())
         {

+ 47 - 53
src/main/java/me/km/effects/passive/EntityDamageEffects.java

@@ -72,61 +72,9 @@ public class EntityDamageEffects extends ModuleListener
         }
     }
     
-    @SubscribeEvent(priority = EventPriority.LOWEST)
+    @SubscribeEvent
     public void onEntityDamage(LivingHurtEvent e)
     {         
-        // ---------------------------------------------------------------------
-        // injection of new damage system
-        // ---------------------------------------------------------------------
-        
-        if(!e.isCanceled())
-        {
-            e.setCanceled(true);
-            KajetansMod.scheduler.scheduleTask(() -> 
-            {
-                float damageAmount = e.getAmount();
-                DamageSource ds = e.getSource();
-                EntityLivingBase liv = e.getEntityLiving();
-
-                if(ds != DamageSource.LAVA && ds != DamageSource.IN_WALL && ds != DamageSource.CRAMMING && ds != DamageSource.DROWN)
-                {
-                    if(ds.isMagicDamage() && !ds.isDamageAbsolute())
-                    {
-                        ReflectionUtils.damageArmor(liv, damageAmount);
-                        damageAmount = CombatRules.getDamageAfterAbsorb(damageAmount, DamageUtils.getMagicDefense(liv), 0);
-                    }
-                    else
-                    {
-                        damageAmount = ReflectionUtils.applyArmorCalculations(liv, ds, damageAmount);
-                    }           
-                    damageAmount = ReflectionUtils.applyPotionDamageCalculations(liv, ds, damageAmount);
-                }
-                else
-                {
-                    damageAmount = liv.getMaxHealth() / 10;
-                }
-
-                float f = damageAmount;
-                damageAmount = Math.max(damageAmount - liv.getAbsorptionAmount(), 0.0F);
-                liv.setAbsorptionAmount(liv.getAbsorptionAmount() - (f - damageAmount));
-
-                if (damageAmount != 0.0F)
-                {
-                    float f1 = liv.getHealth();
-                    liv.setHealth(f1 - damageAmount);
-                    liv.getCombatTracker().trackDamage(ds, f1, damageAmount);
-                    liv.setAbsorptionAmount(liv.getAbsorptionAmount() - damageAmount);
-                }
-            });
-        }
-        else
-        {
-            return;
-        }
-        
-        // ---------------------------------------------------------------------
-        // end of new damage system injection
-        // ---------------------------------------------------------------------
         if(!KajetansMod.worldManager.getWorldPreferences(e.getEntity().world).skills)
         {
             return;
@@ -222,6 +170,52 @@ public class EntityDamageEffects extends ModuleListener
         e.setAmount(e.getAmount() * damageBonus);
     }
     
+    @SubscribeEvent(priority = EventPriority.LOWEST)
+    public void newDamageSystem(LivingHurtEvent e)
+    {         
+        // ---------------------------------------------------------------------
+        // injection of new damage system
+        // ---------------------------------------------------------------------
+        if(!e.isCanceled())
+        {
+            e.setCanceled(true);
+
+            float damageAmount = e.getAmount();
+            DamageSource ds = e.getSource();
+            EntityLivingBase liv = e.getEntityLiving();
+
+            if(ds != DamageSource.LAVA && ds != DamageSource.IN_WALL && ds != DamageSource.CRAMMING && ds != DamageSource.DROWN)
+            {
+                if(ds.isMagicDamage() && !ds.isDamageAbsolute())
+                {
+                    ReflectionUtils.damageArmor(liv, damageAmount);
+                    damageAmount = CombatRules.getDamageAfterAbsorb(damageAmount, DamageUtils.getMagicDefense(liv), 0);
+                }
+                else
+                {
+                    damageAmount = ReflectionUtils.applyArmorCalculations(liv, ds, damageAmount);
+                }           
+                damageAmount = ReflectionUtils.applyPotionDamageCalculations(liv, ds, damageAmount);
+            }
+            else
+            {
+                damageAmount = liv.getMaxHealth() / 10;
+            }
+
+            float f = damageAmount;
+            damageAmount = Math.max(damageAmount - liv.getAbsorptionAmount(), 0.0F);
+            liv.setAbsorptionAmount(liv.getAbsorptionAmount() - (f - damageAmount));
+
+            if (damageAmount != 0.0F)
+            {
+                float f1 = liv.getHealth();
+                liv.setHealth(f1 - damageAmount);
+                liv.getCombatTracker().trackDamage(ds, f1, damageAmount);
+                liv.setAbsorptionAmount(liv.getAbsorptionAmount() - damageAmount);
+            }
+        }
+    }
+    
     @SubscribeEvent(receiveCanceled = false)
     public void onEntityHeal(LivingHealEvent e)
     {         

+ 4 - 0
src/main/java/me/km/effects/passive/EntityDrop.java

@@ -59,6 +59,10 @@ public class EntityDrop extends ModuleListener
             return;
         }
         EntityPlayer p = e.getAttackingPlayer();
+        if(p == null)
+        {
+            return;
+        }
         int xp = EffectUtils.getEffectLevel(p, Effect.XP_COLLECTOR);
         if(xp >= 1)
         {

+ 0 - 3
src/main/java/me/km/entities/EntityHuman.java

@@ -5,8 +5,6 @@ import java.nio.charset.StandardCharsets;
 import me.km.KajetansMod;
 import me.km.networking.ModPacketHandler;
 import me.km.snuviscript.ScriptEvents;
-import net.minecraft.entity.EntityAgeable;
-import net.minecraft.client.renderer.entity.RenderZombie;
 import net.minecraft.entity.Entity;
 import net.minecraft.entity.EntityCreature;
 import net.minecraft.entity.EntityLiving;
@@ -21,7 +19,6 @@ import net.minecraft.util.DamageSource;
 import net.minecraft.util.ResourceLocation;
 import net.minecraft.util.SoundCategory;
 import net.minecraft.util.SoundEvent;
-import net.minecraft.util.math.AxisAlignedBB;
 import net.minecraft.util.text.ITextComponent;
 import net.minecraft.util.text.TextComponentString;
 import net.minecraft.world.World;

+ 18 - 4
src/main/java/me/km/inventory/CustomContainer.java

@@ -61,26 +61,40 @@ public class CustomContainer extends CustomContainerBase
         {
             return super.slotClick(slotId, dragType, clickTypeIn, p);
         }
-        switch(inv.getSlotStatus(((IdSlot) this.getSlot(slotId)).getRealId()))
+        switch(inv.getSlotStatus(slotId))
         {
             case 0: return ItemStack.EMPTY;
             case 1: return super.slotClick(slotId, dragType, clickTypeIn, p);
             case 2: 
                 if(isServerSide)
                 {
-                    System.out.println("Button was pressed");
+                    //System.out.println("Button was pressed");
                     EntityPlayerMP player = (EntityPlayerMP) p;
                     canBeClosed = false;
                     onButtonClick(slotId, dragType, clickTypeIn, player);
                     canBeClosed = true;
                 }
                 return ItemStack.EMPTY;
-            case 3: return ItemStack.EMPTY; 
+            case 3:
+                if(isServerSide)
+                {
+                    //System.out.println("Button was pressed, serverside cancel possible");
+                    EntityPlayerMP player = (EntityPlayerMP) p;
+                    canBeClosed = false;
+                    if(onButtonClick(slotId, dragType, clickTypeIn, player))
+                    {
+                        canBeClosed = true;
+                        return ItemStack.EMPTY;
+                    }
+                    canBeClosed = true;
+                }
+                return super.slotClick(slotId, dragType, clickTypeIn, p);
         }
         return ItemStack.EMPTY;
     }  
     
-    public void onButtonClick(int slotId, int dragType, ClickType clickTypeIn, EntityPlayerMP player)
+    public boolean onButtonClick(int slotId, int dragType, ClickType clickTypeIn, EntityPlayerMP player)
     {
+        return false;
     }
 }

+ 140 - 2
src/main/java/me/km/inventory/CustomContainerBase.java

@@ -13,7 +13,6 @@ import net.minecraft.inventory.SlotCrafting;
 import net.minecraft.item.ItemStack;
 import net.minecraft.network.play.server.SPacketSetSlot;
 import net.minecraft.network.play.server.SPacketWindowItems;
-import net.minecraft.network.play.server.SPacketWindowProperty;
 import net.minecraft.util.NonNullList;
 
 public abstract class CustomContainerBase extends Container
@@ -40,7 +39,7 @@ public abstract class CustomContainerBase extends Container
             {
                 if(inv.isSlotValid(x, y))
                 {
-                    super.addSlotToContainer(new IdSlot(inv, counter, 8 + x * 18, 18 + y * 18, x + y * 9));
+                    super.addSlotToContainer(new Slot(inv, counter, 8 + x * 18, 18 + y * 18));
                     counter++;
                 }
             }
@@ -128,6 +127,7 @@ public abstract class CustomContainerBase extends Container
         return this.inv.isUsableByPlayer(p);
     }
 
+    // ignore special slots stuff
     @Override
     public ItemStack transferStackInSlot(EntityPlayer p, int index)
     {
@@ -161,4 +161,142 @@ public abstract class CustomContainerBase extends Container
         }
         return stack;
     }
+    
+    @Override
+    public boolean canMergeSlot(ItemStack stack, Slot slot)
+    {
+        return inv.getSlotStatus(slot.slotNumber) == 1;
+    }
+    
+    @Override
+    public boolean canDragIntoSlot(Slot slot)
+    {
+        return inv.getSlotStatus(slot.slotNumber) == 1;
+    }
+    
+    @Override
+    protected boolean mergeItemStack(ItemStack stack, int startIndex, int endIndex, boolean reverseDirection)
+    {
+        boolean flag = false;
+        int i = startIndex;
+
+        if (reverseDirection)
+        {
+            i = endIndex - 1;
+        }
+
+        if (stack.isStackable())
+        {
+            while (!stack.isEmpty())
+            {
+                if (reverseDirection)
+                {
+                    if (i < startIndex)
+                    {
+                        break;
+                    }
+                }
+                else if (i >= endIndex)
+                {
+                    break;
+                }
+                
+                if(inv.getSlotStatus(i) == 1)
+                {
+                    Slot slot = this.inventorySlots.get(i);
+                    ItemStack itemstack = slot.getStack();
+
+                    if (!itemstack.isEmpty() && itemstack.getItem() == stack.getItem() && (!stack.getHasSubtypes() || stack.getMetadata() == itemstack.getMetadata()) && ItemStack.areItemStackTagsEqual(stack, itemstack))
+                    {
+                        int j = itemstack.getCount() + stack.getCount();
+                        int maxSize = Math.min(slot.getSlotStackLimit(), stack.getMaxStackSize());
+
+                        if (j <= maxSize)
+                        {
+                            stack.setCount(0);
+                            itemstack.setCount(j);
+                            slot.onSlotChanged();
+                            flag = true;
+                        }
+                        else if (itemstack.getCount() < maxSize)
+                        {
+                            stack.shrink(maxSize - itemstack.getCount());
+                            itemstack.setCount(maxSize);
+                            slot.onSlotChanged();
+                            flag = true;
+                        }
+                    }
+                }
+
+                if (reverseDirection)
+                {
+                    --i;
+                }
+                else
+                {
+                    ++i;
+                }
+            }
+        }
+
+        if (!stack.isEmpty())
+        {
+            if (reverseDirection)
+            {
+                i = endIndex - 1;
+            }
+            else
+            {
+                i = startIndex;
+            }
+
+            while (true)
+            {
+                if (reverseDirection)
+                {
+                    if (i < startIndex)
+                    {
+                        break;
+                    }
+                }
+                else if (i >= endIndex)
+                {
+                    break;
+                }
+
+                if(inv.getSlotStatus(i) == 1)
+                {
+                    Slot slot1 = this.inventorySlots.get(i);
+                    ItemStack itemstack1 = slot1.getStack();
+
+                    if (itemstack1.isEmpty() && slot1.isItemValid(stack))
+                    {
+                        if (stack.getCount() > slot1.getSlotStackLimit())
+                        {
+                            slot1.putStack(stack.splitStack(slot1.getSlotStackLimit()));
+                        }
+                        else
+                        {
+                            slot1.putStack(stack.splitStack(stack.getCount()));
+                        }
+
+                        slot1.onSlotChanged();
+                        flag = true;
+                        break;
+                    }
+                }
+
+                if (reverseDirection)
+                {
+                    --i;
+                }
+                else
+                {
+                    ++i;
+                }
+            }
+        }
+
+        return flag;
+    }
 }

+ 0 - 20
src/main/java/me/km/inventory/IdSlot.java

@@ -1,20 +0,0 @@
-package me.km.inventory;
-
-import net.minecraft.inventory.IInventory;
-import net.minecraft.inventory.Slot;
-
-public class IdSlot extends Slot
-{
-    private int realId;
-    
-    public IdSlot(IInventory inventoryIn, int index, int xPosition, int yPosition, int realId) 
-    {
-        super(inventoryIn, index, xPosition, yPosition);
-        this.realId = realId;
-    }
-
-    public int getRealId() 
-    {
-        return realId;
-    }
-}

+ 108 - 25
src/main/java/me/km/inventory/InventoryBase.java

@@ -1,5 +1,6 @@
 package me.km.inventory;
 
+import java.util.Arrays;
 import net.minecraft.entity.Entity;
 import net.minecraft.inventory.InventoryBasic;
 import net.minecraft.item.ItemStack;
@@ -9,6 +10,7 @@ public class InventoryBase extends InventoryBasic
     private final Entity owner;
     private final int rows;
     private final byte[] data;
+    private final byte[] smallData;
     
     public InventoryBase(String title, byte[] data, int slots, Entity owner) 
     {
@@ -16,6 +18,7 @@ public class InventoryBase extends InventoryBasic
         this.owner = owner;
         this.rows = slots / 9 + (slots % 9 == 0 ? 0 : 1);
         this.data = data;
+        this.smallData = deleteZeros(data);
     }
     
     private static int countZeros(String slots)
@@ -31,6 +34,42 @@ public class InventoryBase extends InventoryBasic
         return i;
     }
     
+    private static byte[] deleteZeros(byte[] bytes)
+    {
+        int size = 0;
+        for(byte b : bytes)
+        {
+            size += (b & 3) != 0 ? 1 : 0;
+            size += (b & 12) != 0 ? 1 : 0;
+            size += (b & 48) != 0 ? 1 : 0;
+            size += (b & 192) != 0 ? 1 : 0;
+        }
+        size = (size >> 2) + ((size & 3) != 0 ? 1 : 0);
+        
+        byte[] b = new byte[size];
+        byte current;
+        int index = 0;
+        int pos = 0;
+        for(int i = 0; i < bytes.length; i++)
+        {
+            for(int j = 0; j < 8; j += 2)
+            {
+                current = (byte) ((bytes[i] >> j) & 3);
+                if(current != 0)
+                {
+                    b[index] |= current << pos;
+                    pos += 2;
+                    if(pos == 8)
+                    {
+                        pos = 0;
+                        index++;
+                    }
+                }
+            }
+        }
+        return b;
+    }
+    
     public InventoryBase(String title, String slots, Entity owner) 
     {
         super(title, true, Math.min(54, slots.length() - countZeros(slots)));
@@ -65,6 +104,7 @@ public class InventoryBase extends InventoryBasic
                     break;
             }
         }
+        this.smallData = deleteZeros(data);
     }
     
     public InventoryBase(String title, int slots, Entity owner) 
@@ -73,26 +113,9 @@ public class InventoryBase extends InventoryBasic
         this.owner = owner;
         this.rows = super.getSizeInventory() / 9;
         this.data = new byte[14];
-        
-        int end = super.getSizeInventory();
-        for(int i = 0; i < end; i++)
-        {
-            switch(i % 4)
-            {
-                case 0:
-                    data[i / 4] += 1;
-                    break;
-                case 1:
-                    data[i / 4] += 4;
-                    break;
-                case 2:
-                    data[i / 4] += 16;
-                    break;
-                case 3:
-                    data[i / 4] += 64;
-                    break;
-            }
-        }
+        // default is 3 to every 2 bits
+        Arrays.fill(this.data, (byte) 0xFF);
+        this.smallData = data;
     }
 
     public byte[] getData() 
@@ -127,6 +150,24 @@ public class InventoryBase extends InventoryBasic
     
     public int getSlotStatus(int slot)
     {
+        if(slot < 0 || slot >= this.getSizeInventory())
+        {
+            return 1;
+        }
+        int index = Math.max(0, Math.min(smallData.length, slot / 4));
+        switch(slot % 4)
+        {
+            case 0: return smallData[index] & 3;
+            case 1: return (smallData[index] >> 2) & 3;
+            case 2: return (smallData[index] >> 4) & 3;
+            case 3: return (smallData[index] >> 6) & 3;
+        }
+        return 0;
+    }
+    
+    public int getSlotStatus(int x, int y)
+    {
+        int slot = y * 9 + x;
         int index = Math.max(0, Math.min(13, slot / 4));
         switch(slot % 4)
         {
@@ -138,11 +179,6 @@ public class InventoryBase extends InventoryBasic
         return 0;
     }
     
-    public int getSlotStatus(int x, int y)
-    {
-        return getSlotStatus(y * 9 + x);
-    }
-    
     public boolean isSlotValid(int slot)
     {
         return getSlotStatus(slot) != 0;
@@ -152,4 +188,51 @@ public class InventoryBase extends InventoryBasic
     {
         return getSlotStatus(x, y) != 0;
     }
+    
+    @Override
+    public ItemStack addItem(ItemStack itemstack)
+    {
+        ItemStack stack = itemstack.copy();
+        for(int i = 0; i < this.getSizeInventory(); i++)
+        {
+            // ignore special fields
+            if(getSlotStatus(i) != 1)
+            {
+                continue;
+            }
+            ItemStack slotStack = this.getStackInSlot(i);
+            
+            if(slotStack.isEmpty())
+            {
+                this.setInventorySlotContents(i, stack);
+                this.markDirty();
+                return ItemStack.EMPTY;
+            }
+
+            if(ItemStack.areItemsEqual(slotStack, stack))
+            {
+                int j = Math.min(this.getInventoryStackLimit(), slotStack.getMaxStackSize());
+                int k = Math.min(stack.getCount(), j - slotStack.getCount());
+
+                if (k > 0)
+                {
+                    slotStack.grow(k);
+                    stack.shrink(k);
+
+                    if (stack.isEmpty())
+                    {
+                        this.markDirty();
+                        return ItemStack.EMPTY;
+                    }
+                }
+            }
+        }
+
+        if (stack.getCount() != stack.getCount())
+        {
+            this.markDirty();
+        }
+
+        return stack;
+    }
 }

+ 3 - 2
src/main/java/me/km/inventory/TeleportContainer.java

@@ -33,11 +33,11 @@ public class TeleportContainer extends CustomContainer
     }
 
     @Override
-    public void onButtonClick(int slotId, int dragType, ClickType clickTypeIn, EntityPlayerMP p) 
+    public boolean onButtonClick(int slotId, int dragType, ClickType clickTypeIn, EntityPlayerMP p) 
     {
         if(slotId >= players.size())
         {
-            return;
+            return true;
         }
         Module m = KajetansMod.effects;
         EntityPlayer p2 = players.get(slotId);
@@ -47,5 +47,6 @@ public class TeleportContainer extends CustomContainer
         HashMap<UUID, UUID> tpaccept = KajetansMod.generalCommands.getCommand(CommandTeleportAccept.class).tpaccept;
         tpaccept.put(p2.getUniqueID(), p.getUniqueID());
         this.closeSafe();
+        return true;
     }
 }

+ 32 - 0
src/main/java/me/km/items/ItemBlockSpecial.java

@@ -0,0 +1,32 @@
+package me.km.items;
+
+import me.km.KajetansMod;
+import net.minecraft.block.Block;
+import net.minecraft.creativetab.CreativeTabs;
+import net.minecraft.item.Item;
+
+public class ItemBlockSpecial extends net.minecraft.item.ItemBlockSpecial implements ItemModelProvider
+{
+    protected String name;
+    
+    public ItemBlockSpecial(String registry, String name, String local, Block block) 
+    {
+        super(block);
+        this.name = name;
+        super.setUnlocalizedName(local);
+        this.setRegistryName(KajetansMod.MODID, registry);
+    }
+
+    @Override
+    public void registerItemModel(Item item) 
+    {
+        KajetansMod.proxy.registerItemRenderer(this, 0, name);
+    }
+    
+    @Override
+    public ItemBlockSpecial setCreativeTab(CreativeTabs tab) 
+    {
+        super.setCreativeTab(tab);
+        return this;
+    }
+}

+ 6 - 2
src/main/java/me/km/items/ModItems.java

@@ -3,6 +3,7 @@ package me.km.items;
 import me.km.items.noglint.ItemNoGlintPotion;
 import me.km.KajetansMod;
 import me.km.blocks.EnumMetals;
+import me.km.blocks.ModBlocks;
 import me.km.items.noglint.ItemNoGlintLingeringPotion;
 import me.km.items.noglint.ItemNoGlintSplashPotion;
 import me.km.sounds.Sounds;
@@ -182,6 +183,7 @@ public class ModItems
     public static ItemBase hayBundle; 
     public static ItemBase batWing; 
     public static ItemBase wolfFur; 
+    public static ItemBlockSpecial campFire; 
     
     public static void init(IForgeRegistry<Item> r) 
     {
@@ -316,7 +318,10 @@ public class ModItems
         hayBundle = register(r, new ItemBase("hay_bundle", "bundleHay").setCreativeTab(CreativeTabs.MATERIALS));
         batWing = register(r, new ItemBase("bat_wing", "batWing").setCreativeTab(CreativeTabs.MATERIALS));
         wolfFur = register(r, new ItemBase("wolf_fur", "wolfFur").setCreativeTab(CreativeTabs.MATERIALS));
-    
+        
+        campFire = new ItemBlockSpecial("camp_fire", "camp_fire_item", "campFire", ModBlocks.campFire);
+        r.register(campFire);
+        campFire.registerItemModel(campFire);
         
         try
         {
@@ -337,7 +342,6 @@ public class ModItems
             ex.printStackTrace();
         }
         
-        
         // workaround
         EnumMetals.fixMetalIngots();
     }

+ 7 - 4
src/main/java/me/km/jobsystem/JobAPI.java

@@ -3,7 +3,9 @@ package me.km.jobsystem;
 import java.util.ArrayList;
 import java.util.HashMap;
 import java.util.HashSet;
+import java.util.List;
 import java.util.Set;
+import java.util.stream.Collectors;
 import me.km.KajetansMod;
 import me.km.api.Module;
 import me.km.skills.LeveledSkill;
@@ -141,11 +143,12 @@ public class JobAPI extends Module
         return map;
     }
     
-    public HashMap<Integer, LeveledSkill> getActiveSkillMap(EntityPlayer p)
+    public List<LeveledSkill> getActiveSkills(EntityPlayer p)
     {
-        HashMap<Integer, LeveledSkill> map = new HashMap<>();
-        getSkillMap(p).forEach((k, v) -> map.put(k.getId(), new LeveledSkill(k, v)));
-        return map;
+        return getSkillMap(p).entrySet().stream()
+                .filter(e -> e.getKey().isActive())
+                .map(e -> new LeveledSkill(e.getKey(), e.getValue()))
+                .collect(Collectors.toList());
     }
     
     // -------------------------------------------------------------------------

+ 5 - 3
src/main/java/me/km/networking/CampFireInventory.java

@@ -5,11 +5,12 @@ import java.nio.charset.StandardCharsets;
 import net.minecraft.client.Minecraft;
 import net.minecraft.client.entity.EntityPlayerSP;
 import net.minecraft.client.player.inventory.ContainerLocalMenu;
-import net.minecraft.util.text.TextComponentString;
 import net.minecraft.util.text.TextComponentTranslation;
 import net.minecraftforge.fml.common.network.simpleimpl.IMessage;
 import net.minecraftforge.fml.common.network.simpleimpl.IMessageHandler;
 import net.minecraftforge.fml.common.network.simpleimpl.MessageContext;
+import net.minecraftforge.fml.relauncher.Side;
+import net.minecraftforge.fml.relauncher.SideOnly;
 
 public class CampFireInventory implements IMessage
 {
@@ -47,11 +48,12 @@ public class CampFireInventory implements IMessage
 
     public static class Handler implements IMessageHandler<CampFireInventory, IMessage>
     {
+        @SideOnly(Side.CLIENT)
         @Override
         public IMessage onMessage(CampFireInventory m, MessageContext ctx) 
         {
-            Minecraft mc = Minecraft.getMinecraft();
-            final EntityPlayerSP p = mc.player;
+            Minecraft mc = net.minecraft.client.Minecraft.getMinecraft();
+            EntityPlayerSP p = mc.player;
             mc.addScheduledTask(() -> 
             {
                 mc.displayGuiScreen(new CampFireInventoryGui(p.inventory, 

+ 4 - 1
src/main/java/me/km/networking/CustomInventory.java

@@ -8,6 +8,8 @@ import net.minecraft.client.entity.EntityPlayerSP;
 import net.minecraftforge.fml.common.network.simpleimpl.IMessage;
 import net.minecraftforge.fml.common.network.simpleimpl.IMessageHandler;
 import net.minecraftforge.fml.common.network.simpleimpl.MessageContext;
+import net.minecraftforge.fml.relauncher.Side;
+import net.minecraftforge.fml.relauncher.SideOnly;
 
 public class CustomInventory implements IMessage
 {
@@ -58,11 +60,12 @@ public class CustomInventory implements IMessage
 
     public static class Handler implements IMessageHandler<CustomInventory, IMessage>
     {
+        @SideOnly(Side.CLIENT)
         @Override
         public IMessage onMessage(CustomInventory m, MessageContext ctx) 
         {
             Minecraft mc = Minecraft.getMinecraft();
-            final EntityPlayerSP p = mc.player;
+            EntityPlayerSP p = mc.player;
             mc.addScheduledTask(() -> 
             {
                 mc.displayGuiScreen(new CustomInventoryGui(p.inventory, new InventoryBase(m.windowTitle, m.data, m.slotCount, p)));

+ 2 - 2
src/main/java/me/km/playerbank/GodMode.java

@@ -5,7 +5,7 @@ import me.km.api.Module;
 import me.km.api.ModuleListener;
 import net.minecraft.entity.EntityLivingBase;
 import net.minecraft.entity.player.EntityPlayer;
-import net.minecraftforge.event.entity.living.LivingHurtEvent;
+import net.minecraftforge.event.entity.living.LivingAttackEvent;
 import net.minecraftforge.fml.common.eventhandler.EventPriority;
 import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
 
@@ -17,7 +17,7 @@ public class GodMode extends ModuleListener
     }
     
     @SubscribeEvent(priority = EventPriority.LOW)
-    public void GodGetsDamageEvent(LivingHurtEvent e)
+    public void GodGetsDamageEvent(LivingAttackEvent e)
     {
         EntityLivingBase ent = e.getEntityLiving();
         if(ent instanceof EntityPlayer && KajetansMod.playerbank.getDataBank().getTag((EntityPlayer) ent, "god") == 1)

+ 7 - 6
src/main/java/me/km/skills/SkillContainer.java

@@ -100,7 +100,7 @@ public class SkillContainer extends CustomContainer
     }
     
     @Override
-    public void onButtonClick(int slot, int dragType, ClickType clickTypeIn, EntityPlayerMP p) 
+    public boolean onButtonClick(int slot, int dragType, ClickType clickTypeIn, EntityPlayerMP p) 
     {
         if(slot >= 45)
         {
@@ -109,7 +109,7 @@ public class SkillContainer extends CustomContainer
                 List<ItemStack> list = getPreviousPage();
                 if(list == null)
                 {
-                    return;
+                    return true;
                 }
                 inv.setContents(list);
                 placeButtons(inv);
@@ -119,26 +119,27 @@ public class SkillContainer extends CustomContainer
                 List<ItemStack> list = getNextPage();
                 if(list == null)
                 {
-                    return;
+                    return true;
                 }
                 inv.setContents(list);
                 placeButtons(inv);
             }
-            return;
+            return true;
         }
         if(castClickedSkill())
         {
             Map.Entry<Skill, Byte> entry = getSkill(slot);
             if(entry == null)
             {
-                return;
+                return true;
             }
             Skill s = entry.getKey();
             if(s == null)
             {
-                return;
+                return true;
             }
             onCastSkill(p, s, entry.getValue());
         }
+        return true;
     }
 }

+ 33 - 5
src/main/java/me/km/snuviscript/MinecraftFunctions.java

@@ -80,6 +80,7 @@ import me.km.inventory.CustomContainer;
 import me.km.networking.ModPacketHandler;
 import me.km.pathfinder.PathfinderUtils;
 import me.km.skills.LeveledSkill;
+import me.km.skills.Skill;
 import net.minecraft.entity.item.EntityItem;
 import net.minecraft.util.math.MathHelper;
 import net.minecraft.util.text.ITextComponent;
@@ -376,9 +377,11 @@ public class MinecraftFunctions implements ISnuviLogger
         parser.registerConsumer("skill.clear", (args, qd) -> 
                 KajetansMod.skills.clearSkills());
         parser.registerConsumer("skill.getactive", (args, qd) -> 
-                qd.setVar(args[0].toString(), KajetansMod.jobs.getActiveSkillMap((EntityPlayer) args[1]))); 
+                qd.setVar(args[0].toString(), KajetansMod.jobs.getActiveSkills((EntityPlayer) args[1]))); 
         parser.registerFunction("skill.getid", (args, qd) -> 
                 ((LeveledSkill) args[0]).getId());
+        parser.registerFunction("skill.fromid", (args, qd) -> 
+                getSkillFromId(args));
         parser.registerFunction("skill.getstack", (args, qd) -> 
                 ((LeveledSkill) args[0]).getItemStack());
         parser.registerFunction("skill.use", (args, qd) -> 
@@ -642,7 +645,9 @@ public class MinecraftFunctions implements ISnuviLogger
         // Inventory-Bibliothek   
         // -------------------------------------------------------------
         parser.registerConsumer("inv.new", (args, qd) -> 
-                qd.setVar(args[0].toString(), new SnuviInventory(args[2].toString(), ScriptUtils.getInt(args[1]), ((MinecraftScript) qd).getNewId())));   
+                qd.setVar(args[0].toString(), new SnuviInventory(args[2].toString(), ScriptUtils.getInt(args[1]), ((MinecraftScript) qd).getNewId()))); 
+        parser.registerConsumer("inv.newdynamic", (args, qd) -> 
+                qd.setVar(args[0].toString(), new SnuviInventory(args[2].toString(), args[1].toString(), ((MinecraftScript) qd).getNewId()))); 
         parser.registerConsumer("inv.loadblock", (args, qd) -> 
                 qd.setVar(args[0].toString(), newInventory((Location) args[1], (MinecraftScript) qd, args[2].toString())));
         parser.registerConsumer("inv.setitem", (args, qd) -> 
@@ -704,7 +709,7 @@ public class MinecraftFunctions implements ISnuviLogger
     }
     
     @Override
-    public void printException(Exception ex, String s, int line)
+    public void printException(Exception ex, String function, String s, int line)
     {
         if(KajetansMod.debugMode || KajetansMod.scripts.getSnuviParser().printStack)
         {
@@ -715,6 +720,10 @@ public class MinecraftFunctions implements ISnuviLogger
                 m.sendWarningToConsole("Zeile: " + line);
             }
             m.sendWarningToConsole("Fehler: " + ex.getClass().getSimpleName() + " - " + ex.getLocalizedMessage());
+            if(function != null)
+            {
+                m.sendWarningToConsole("Funktion: " + function);
+            }
         }
         sendToDevsWithSuffix("§cError in '" + s + "'");
         if(line != -1)
@@ -722,12 +731,16 @@ public class MinecraftFunctions implements ISnuviLogger
             sendToDevsWithHelpList("§cZeile:", String.valueOf(line));
         }
         sendToDevsWithHelpList("§cFehler:", ex.getClass().getSimpleName() + " - " + ex.getLocalizedMessage());
+        if(function != null)
+        {
+            sendToDevsWithHelpList("§cFunktion: ", function);
+        }
     }
     
     @Override
-    public void printException(Exception ex, Script sc, int line)
+    public void printException(Exception ex, String function, Script sc, int line)
     {
-        printException(ex, sc == null ? "null" : sc.getName(), line);
+        printException(ex, function, sc == null ? "null" : sc.getName(), line);
     }
     
     @Override
@@ -788,6 +801,21 @@ public class MinecraftFunctions implements ISnuviLogger
                 ScriptUtils.getInt(args[7]), ScriptUtils.getInt(args[8]));
     }
     
+    private static LeveledSkill getSkillFromId(Object[] args)
+    {
+        Skill skill = KajetansMod.skills.getSkill(ScriptUtils.getInt(args[0]));
+        if(skill == null)
+        {
+            return null;
+        }
+        byte level = (byte) EffectUtils.getEffectLevel((EntityPlayer) args[1], skill.getEffect());
+        if(level <= 0)
+        {
+            return null;
+        }
+        return new LeveledSkill(skill, level);
+    }
+    
     private static void walkTo(Object[] args)
     {
         Location l = (Location) args[1];

+ 4 - 4
src/main/java/me/km/snuviscript/ScriptEvents.java

@@ -202,7 +202,7 @@ public class ScriptEvents extends ModuleListener
             } 
             catch(ClassCastException | NullPointerException ex) 
             {
-                KajetansMod.scripts.logger.printException(ex, qd, qd.getActiveRealCodeLine());
+                KajetansMod.scripts.logger.printException(ex, "player_respawn", qd, qd.getActiveRealCodeLine());
             }
         });
     }
@@ -620,7 +620,7 @@ public class ScriptEvents extends ModuleListener
             }
             catch(Exception ex)
             {
-                KajetansMod.scripts.logger.printException(ex, qd, qd.getActiveRealCodeLine());
+                KajetansMod.scripts.logger.printException(ex, "item_use_start", qd, qd.getActiveRealCodeLine());
             }
         });
     }
@@ -755,7 +755,7 @@ public class ScriptEvents extends ModuleListener
             }
             catch(Exception ex)
             {
-                KajetansMod.scripts.logger.printException(ex, qd, qd.getActiveRealCodeLine());
+                KajetansMod.scripts.logger.printException(ex, "player_use_effect", qd, qd.getActiveRealCodeLine());
             }
             try
             {
@@ -768,7 +768,7 @@ public class ScriptEvents extends ModuleListener
             }
             catch(Exception ex)
             {  
-                KajetansMod.scripts.logger.printException(ex, qd, qd.getActiveRealCodeLine());
+                KajetansMod.scripts.logger.printException(ex, "player_use_effect", qd, qd.getActiveRealCodeLine());
             }
             e.setCanceled(qd.getBooleanVar("cancel")); 
         });

+ 2 - 2
src/main/java/me/km/snuviscript/ScriptInventoryHolder.java

@@ -19,9 +19,9 @@ public class ScriptInventoryHolder extends CustomContainer
     }
 
     @Override
-    public void onButtonClick(int slot, int dragType, ClickType click, EntityPlayerMP p)
+    public boolean onButtonClick(int slot, int dragType, ClickType click, EntityPlayerMP p)
     {
-        e.onInventoryClick(qd, (SnuviInventory) inv, slot, click, p);
+        return e.onInventoryClick(qd, (SnuviInventory) inv, slot, click, p);
     }
 
     @Override

+ 1 - 1
src/main/java/me/km/snuviscript/ScriptModule.java

@@ -192,7 +192,7 @@ public class ScriptModule extends Module
         }
         catch(PreScriptException ex)
         {
-            logger.printException(ex, name, ex.getLine());
+            logger.printException(ex, null, name, ex.getLine());
         }
     }
 }

+ 6 - 0
src/main/java/me/km/snuviscript/SnuviInventory.java

@@ -12,6 +12,12 @@ public class SnuviInventory extends InventoryBase
         this.id = id;
     }
     
+    public SnuviInventory(String title, String slots, int id) 
+    {
+        super(title, slots, null);
+        this.id = id;
+    }
+    
     public int getId()
     {
         return id;

+ 1 - 1
src/main/java/me/km/utils/NBTUtils.java

@@ -62,7 +62,7 @@ public class NBTUtils
         }
         catch(NBTException ex)
         {
-            sc.getLogger().printException(new IllegalStringException(s), sc, sc.getActiveRealCodeLine());
+            sc.getLogger().printException(new IllegalStringException(s), "read.item", sc, sc.getActiveRealCodeLine());
             throw new HoldCodeException();
         }
     }

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

@@ -51,6 +51,11 @@ tile.spikes.gold.name=Gold Spikes
 tile.spikes.iron.name=Iron Spikes
 tile.spikes.silver.name=Silver Spikes
 
+tile.campFire.name=Camp Fire
+tile.campFireBurning.name=Burning Camp Fire
+tile.campFireBurnt.name=Burnt Camp Fire
+container.campfire=Camp Fire
+item.campFire.name=Camp Fire
 
 tile.fluid.poison.name=Poison
 tile.fluid.honey.name=Honey

+ 7 - 0
src/main/resources/assets/km/models/item/camp_fire_item.json

@@ -0,0 +1,7 @@
+{
+    "parent": "item/generated",
+    "textures": {
+        "layer0": "km:items/campfire_icon"
+    }
+}
+

BIN
src/main/resources/assets/km/textures/items/campfire_icon.png