diff --git a/src/main/java/tconstruct/armor/player/TPlayerStats.java b/src/main/java/tconstruct/armor/player/TPlayerStats.java index d5bd3d77..41bd0b24 100644 --- a/src/main/java/tconstruct/armor/player/TPlayerStats.java +++ b/src/main/java/tconstruct/armor/player/TPlayerStats.java @@ -27,6 +27,7 @@ public class TPlayerStats implements IExtendedEntityProperties, IPlayerExtendedI public boolean beginnerManual; public boolean materialManual; public boolean smelteryManual; + public boolean weaponryManual; public boolean battlesignBonus; // death-penality @@ -61,6 +62,7 @@ public class TPlayerStats implements IExtendedEntityProperties, IPlayerExtendedI tTag.setBoolean("beginnerManual", this.beginnerManual); tTag.setBoolean("materialManual", this.materialManual); tTag.setBoolean("smelteryManual", this.smelteryManual); + tTag.setBoolean("weaponryManual", this.weaponryManual); tTag.setBoolean("battlesignBonus", this.battlesignBonus); tTag.setInteger("derpLevel", this.derpLevel); compound.setTag(PROP_NAME, tTag); @@ -76,6 +78,7 @@ public class TPlayerStats implements IExtendedEntityProperties, IPlayerExtendedI this.beginnerManual = properties.getBoolean("beginnerManual"); this.materialManual = properties.getBoolean("materialManual"); this.smelteryManual = properties.getBoolean("smelteryManual"); + this.weaponryManual = properties.getBoolean("weaponryManual"); this.battlesignBonus = properties.getBoolean("battlesignBonus"); this.derpLevel = properties.getInteger("derpLevel"); } @@ -95,6 +98,7 @@ public class TPlayerStats implements IExtendedEntityProperties, IPlayerExtendedI this.beginnerManual = stats.beginnerManual; this.materialManual = stats.materialManual; this.smelteryManual = stats.smelteryManual; + this.weaponryManual = stats.weaponryManual; this.battlesignBonus = stats.battlesignBonus; this.derpLevel = stats.derpLevel; diff --git a/src/main/java/tconstruct/tools/TinkerTools.java b/src/main/java/tconstruct/tools/TinkerTools.java index fb758089..2f9b29ca 100644 --- a/src/main/java/tconstruct/tools/TinkerTools.java +++ b/src/main/java/tconstruct/tools/TinkerTools.java @@ -612,7 +612,9 @@ public class TinkerTools GameRegistry.addShapelessRecipe(new ItemStack(TinkerTools.manualBook, 2, 1), new ItemStack(TinkerTools.manualBook, 1, 1), Items.book); GameRegistry.addShapelessRecipe(new ItemStack(TinkerTools.manualBook, 1, 2), new ItemStack(TinkerTools.manualBook, 1, 1)); GameRegistry.addShapelessRecipe(new ItemStack(TinkerTools.manualBook, 2, 2), new ItemStack(TinkerTools.manualBook, 1, 2), Items.book); - GameRegistry.addShapelessRecipe(new ItemStack(TinkerTools.manualBook, 1, 3), new ItemStack(TinkerTools.manualBook, 1, 2)); + GameRegistry.addShapelessRecipe(new ItemStack(TinkerTools.manualBook, 2, 4), new ItemStack(TinkerTools.manualBook, 1, 4), Items.book); + GameRegistry.addShapelessRecipe(new ItemStack(TinkerTools.manualBook, 1, 4), new ItemStack(TinkerTools.manualBook, 1, 2)); + GameRegistry.addShapelessRecipe(new ItemStack(TinkerTools.manualBook, 1, 3), new ItemStack(TinkerTools.manualBook, 1, 4)); // alternative Vanilla Book Recipe GameRegistry.addShapelessRecipe(new ItemStack(Items.book), Items.paper, Items.paper, Items.paper, Items.string, TinkerTools.blankPattern, TinkerTools.blankPattern); GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(Items.name_tag), "P~ ", "~O ", " ~", '~', Items.string, 'P', Items.paper, 'O', "slimeball")); diff --git a/src/main/java/tconstruct/weaponry/TinkerWeaponry.java b/src/main/java/tconstruct/weaponry/TinkerWeaponry.java index 9bfccd28..ebd34087 100644 --- a/src/main/java/tconstruct/weaponry/TinkerWeaponry.java +++ b/src/main/java/tconstruct/weaponry/TinkerWeaponry.java @@ -1,6 +1,7 @@ package tconstruct.weaponry; +import cpw.mods.fml.common.FMLCommonHandler; import cpw.mods.fml.common.SidedProxy; import cpw.mods.fml.common.event.FMLInitializationEvent; import cpw.mods.fml.common.event.FMLPostInitializationEvent; @@ -111,7 +112,9 @@ public class TinkerWeaponry { public void postInit(FMLPostInitializationEvent event) { // this handler takes care that ammo weapons get ammo. - MinecraftForge.EVENT_BUS.register(new WeaponryHandler()); + WeaponryHandler weaponryHandler = new WeaponryHandler(); + MinecraftForge.EVENT_BUS.register(weaponryHandler); + FMLCommonHandler.instance().bus().register(weaponryHandler); proxy.init(); } diff --git a/src/main/java/tconstruct/weaponry/WeaponryHandler.java b/src/main/java/tconstruct/weaponry/WeaponryHandler.java index d17b5f5b..cd35f487 100644 --- a/src/main/java/tconstruct/weaponry/WeaponryHandler.java +++ b/src/main/java/tconstruct/weaponry/WeaponryHandler.java @@ -1,5 +1,8 @@ package tconstruct.weaponry; +import cpw.mods.fml.common.gameevent.PlayerEvent; +import tconstruct.armor.player.TPlayerStats; +import tconstruct.tools.TinkerTools; import tconstruct.weaponry.ammo.ArrowAmmo; import tconstruct.weaponry.ammo.BoltAmmo; import tconstruct.library.tools.DualMaterialToolPart; @@ -21,6 +24,24 @@ import tconstruct.weaponry.weapons.LongBow; import tconstruct.weaponry.weapons.ShortBow; public class WeaponryHandler { + @SubscribeEvent + public void onCrafting (PlayerEvent.ItemCraftedEvent event) + { + Item item = event.crafting.getItem(); + if (!event.player.worldObj.isRemote) + { + if (item == Item.getItemFromBlock(TinkerTools.toolStationWood)) + { + TPlayerStats stats = TPlayerStats.get(event.player); + if (!stats.weaponryManual) + { + stats.weaponryManual = true; + AbilityHelper.spawnItemAtPlayer(event.player, new ItemStack(TinkerTools.manualBook, 1, 4)); + } + } + } + } + // Provides ammo-items with the necessary NBT @SubscribeEvent public void onAmmoCrafted(ToolCraftEvent.NormalTool event) diff --git a/weaponry.txt b/weaponry.txt index 54bd6749..04f106fe 100644 --- a/weaponry.txt +++ b/weaponry.txt @@ -1,6 +1,5 @@ TODO: * Effect graphics for arrows, throwing knifes, javelins,... MOSTLY DONE -* Separate book explaining the system, text only, sorry folks * Partbuilder stuff for weaponry stuff? * Bring bowmaterial stats etc in line? * Knockback on projectiles knocks towards their moving direction DONEish