diff options
| author | OnyxDarkKnight <sor1n.iliutza16@gmail.com> | 2015-05-07 13:34:21 +0100 |
|---|---|---|
| committer | OnyxDarkKnight <sor1n.iliutza16@gmail.com> | 2015-05-07 13:34:21 +0100 |
| commit | c5e04f2c8e0c5393d9a5ef63a87ae4f0094af301 (patch) | |
| tree | 170a49181f336842c82cf6e12f63f7e4b8e2cad1 /src/main/java | |
| parent | 208b1f1e0d5faf601b53818b04f6699b2e6cb6bc (diff) | |
- Added EE3 EMC values, thank you to MineMarteen for providing the ThirdPartyManager code :)
- Working on making it possible to translate every part of the mod
- Created an interface modders can use to make an item wearable in the jewelry inventory and have special effects
Diffstat (limited to 'src/main/java')
23 files changed, 452 insertions, 68 deletions
diff --git a/src/main/java/darkknight/jewelrycraft/JewelrycraftMod.java b/src/main/java/darkknight/jewelrycraft/JewelrycraftMod.java index 38ed0e7..7275cd0 100644 --- a/src/main/java/darkknight/jewelrycraft/JewelrycraftMod.java +++ b/src/main/java/darkknight/jewelrycraft/JewelrycraftMod.java @@ -32,6 +32,7 @@ import darkknight.jewelrycraft.network.PacketHandler; import darkknight.jewelrycraft.potions.PotionList; import darkknight.jewelrycraft.proxy.CommonProxy; import darkknight.jewelrycraft.recipes.CraftingRecipes; +import darkknight.jewelrycraft.thirdparty.ThirdPartyManager; import darkknight.jewelrycraft.util.Variables; import darkknight.jewelrycraft.worldGen.village.VillageHandler; @@ -69,6 +70,7 @@ public class JewelrycraftMod { dir = e.getModConfigurationDirectory(); ConfigHandler.INSTANCE.loadConfig(e); + ThirdPartyManager.instance().index(); BlockList.preInit(e); ItemList.preInit(e); CraftingRecipes.preInit(e); @@ -78,6 +80,7 @@ public class JewelrycraftMod VillageHandler.preInit(e); EventList.preInit(e); PotionList.preInit(e); + ThirdPartyManager.instance().preInit(); } @EventHandler @@ -85,11 +88,13 @@ public class JewelrycraftMod { EventList.init(e); PotionList.init(e); + ThirdPartyManager.instance().init(); } @EventHandler public void postInit(FMLPostInitializationEvent e) { + ThirdPartyManager.instance().postInit(); EventList.postInit(e); PotionList.postInit(e); } diff --git a/src/main/java/darkknight/jewelrycraft/api/IJewelryItem.java b/src/main/java/darkknight/jewelrycraft/api/IJewelryItem.java new file mode 100644 index 0000000..26ce183 --- /dev/null +++ b/src/main/java/darkknight/jewelrycraft/api/IJewelryItem.java @@ -0,0 +1,57 @@ +/** + * + */ +package darkknight.jewelrycraft.api; + +import net.minecraft.entity.EntityLivingBase; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.util.DamageSource; +import net.minecraftforge.event.entity.player.PlayerEvent; + +/** + * @author Sorin + * + */ +public interface IJewelryItem +{ + /** + * @return Returns the id of the type, 0 is for ring, 1 is for bracelet, 2 is for necklace and 3 is for earrings + */ + public int type(); + + /** + * This is the action performed each player tick + * @param player The player wearing the jewelry + */ + public void onWearAction(EntityPlayer player); + + /** + * This performs an action whenever a player gets attacked by an entity besides another Player + * @param player The player that was attacked + * @param source Source of the damage + * @param amount The amount of damage taken + */ + public void onPlayerAttackedAction(EntityPlayer player, DamageSource source, float amount); + + /** + * This does an action whenever an Entity gets attacked by a player, this includes other Players + * @param player The attacking player + * @param entity The target entity + * @param amount The amount of damage dealt + */ + public void onEntityAttackedByPlayer(EntityPlayer player, EntityLivingBase entity, float amount); + + /** + * This runs whenever a player dies + * @param player The player that died + * @param source The damage source that caused the death + */ + public void onPlayerDeadAction(EntityPlayer player, DamageSource source); + + /** + * Runs whenever a player respawns (switches dimensions or actually respawns) + * @param player The player that respawns + * @param event The clone event that runs whenever a player respawns, either because he died or switched dimensions + */ + public void onPlayerRespawnAction(PlayerEvent.Clone event); +} diff --git a/src/main/java/darkknight/jewelrycraft/api/ModifierEffects.java b/src/main/java/darkknight/jewelrycraft/api/ModifierEffects.java index ded92c0..2aa3254 100644 --- a/src/main/java/darkknight/jewelrycraft/api/ModifierEffects.java +++ b/src/main/java/darkknight/jewelrycraft/api/ModifierEffects.java @@ -7,6 +7,7 @@ import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.util.DamageSource; +import net.minecraftforge.event.entity.player.PlayerEvent; public class ModifierEffects { @@ -85,4 +86,7 @@ public class ModifierEffects public void onPlayerDead(ItemStack item, EntityPlayer player, DamageSource source, Item jewelry) {} + + public void onPlayerRespawn(ItemStack item, PlayerEvent.Clone event, Item jewelry) + {} } diff --git a/src/main/java/darkknight/jewelrycraft/block/BlockSmelter.java b/src/main/java/darkknight/jewelrycraft/block/BlockSmelter.java index b7a456d..ed03a45 100644 --- a/src/main/java/darkknight/jewelrycraft/block/BlockSmelter.java +++ b/src/main/java/darkknight/jewelrycraft/block/BlockSmelter.java @@ -169,9 +169,9 @@ public class BlockSmelter extends BlockContainer te.isDirty = true; } te.isDirty = true; - }else if (item != null && (te.hasMetal || te.hasMoltenMetal) && !itemCoincidesWithMoltenMetal && te.quantity < .9f) entityPlayer.addChatMessage(new ChatComponentText(StatCollector.translateToLocal("Item does not match contents!"))); + }else if (item != null && (te.hasMetal || te.hasMoltenMetal) && !itemCoincidesWithMoltenMetal && te.quantity < .9f) entityPlayer.addChatMessage(new ChatComponentText(StatCollector.translateToLocal("chatmessage." + Variables.MODID + ".smelter.contentdoesnotmatch"))); else if (item != null && !item.getUnlocalizedName().toLowerCase().contains("ingot") && te.quantity < .9f) entityPlayer.addChatMessage(new ChatComponentText(StatCollector.translateToLocal("chatmessage." + Variables.MODID + ".smelter.itemrenamedtoingot"))); - else if (item != null && te.quantity >= .9f) entityPlayer.addChatMessage(new ChatComponentText(StatCollector.translateToLocal("Smelter is at full capacity."))); + else if (item != null && te.quantity >= .9f) entityPlayer.addChatMessage(new ChatComponentText(StatCollector.translateToLocal("chatmessage." + Variables.MODID + ".smelter.full"))); }else if (item != null && item.getItem() != null && item.getItem() instanceof ItemMoltenMetalBucket && !te.hasMoltenMetal && !te.hasMetal){ te.hasMoltenMetal = true; ItemStack ingot = JewelryNBT.ingot(item); diff --git a/src/main/java/darkknight/jewelrycraft/client/gui/GuiTabIntroduction.java b/src/main/java/darkknight/jewelrycraft/client/gui/GuiTabIntroduction.java index ebed63b..de84af0 100644 --- a/src/main/java/darkknight/jewelrycraft/client/gui/GuiTabIntroduction.java +++ b/src/main/java/darkknight/jewelrycraft/client/gui/GuiTabIntroduction.java @@ -34,7 +34,7 @@ public class GuiTabIntroduction extends GuiTab Page.addTextPage(gui, gui.getLeft() + xPos, gui.getTop(), text); break; case 3: - text = "the gem used. To see what modifiers are currently implemented, just look in the Modifiers tab located in this guide (it is the one with the blaze powder as an icon)."; + text = "the gem used. To see what modifiers are currently implemented, just look in the Modifiers tab located in this guide (it is the one with the blaze powder as an icon). This mod was made by OnyxDarkKnight and the help of domi1819, pau101, Damien Hazard, boni and MineMarteen."; Page.addTextPage(gui, gui.getLeft() + xPos, gui.getTop(), text); break; } diff --git a/src/main/java/darkknight/jewelrycraft/client/gui/GuiTabItems.java b/src/main/java/darkknight/jewelrycraft/client/gui/GuiTabItems.java index efbea61..02f9640 100644 --- a/src/main/java/darkknight/jewelrycraft/client/gui/GuiTabItems.java +++ b/src/main/java/darkknight/jewelrycraft/client/gui/GuiTabItems.java @@ -108,14 +108,10 @@ public class GuiTabItems extends GuiTab case 13: String link = "HERE"; if (x >= gui.getLeft() && x <= gui.getLeft() + 30 && y >= gui.getTop() + 104 && y <= gui.getTop() + 124) link = EnumChatFormatting.DARK_BLUE + "HERE" + EnumChatFormatting.BLACK; - text = "installing it so you can see all the recipes. Since you are reading this, how about making a youtube video spotlighting this mod. I'd really appreciate it. After that you can share it in the main thread " + link + "." + " This mod was made by OnyxDarkKnight and the help of domi1819,"; + text = "installing it so you can see all the recipes. Since you are reading this, how about making a youtube video spotlighting this mod. I'd really appreciate it. After that you can share it in the main thread " + link + "."; Page.addTextPage(gui, gui.getLeft() + xPos, gui.getTop(), text); break; case 14: - text = "pau101 and Damien Hazard."; - Page.addTextPage(gui, gui.getLeft() + xPos, gui.getTop(), text); - break; - case 15: ItemStack item = new ItemStack(ItemList.bucket); if (del == 0) values++; del++; @@ -125,11 +121,11 @@ public class GuiTabItems extends GuiTab text = "These buckets contain molten metal. To obtain one simply Right Click a full Smelter to get a bucket. You can pour the metal, other than that it has no use. You can place the molten metal back in a Smelter by Right Clicking one with it."; Page.addImageTextPage(gui, gui.getLeft() + xPos, gui.getTop() - 5, item, text, 40f, 0, 0, true, 45, 10, true); break; - case 16: + case 15: text = "This item is a creative only item! Right click it while in creative mode to open a GUI. Place a piece of jewelery inside the slot, select what you want to add, then click on 'Add Items'. If you selected Modifiers, you can select multiple"; Page.addImageTextPage(gui, gui.getLeft() + xPos, gui.getTop() - 5, new ItemStack(ItemList.jewelryModifier), text, 40f, 0, 0, true, 45, 10, true); break; - case 17: + case 16: text = "items at once. The 'Item' button is to add an Item to a Golden Object, which can not be obtained normally. This tool can be really useful, especially for those who want to test the mod and can't wait for the normal processes to finish (Smelter, Jewelers Table, Ritual)."; Page.addTextPage(gui, gui.getLeft() + xPos, gui.getTop(), text); break; @@ -144,7 +140,7 @@ public class GuiTabItems extends GuiTab @Override public int getMaxPages() { - return 17; + return 16; } /** diff --git a/src/main/java/darkknight/jewelrycraft/client/gui/container/ContainerJewelryTab.java b/src/main/java/darkknight/jewelrycraft/client/gui/container/ContainerJewelryTab.java index 3b323e6..634782c 100644 --- a/src/main/java/darkknight/jewelrycraft/client/gui/container/ContainerJewelryTab.java +++ b/src/main/java/darkknight/jewelrycraft/client/gui/container/ContainerJewelryTab.java @@ -5,6 +5,7 @@ import net.minecraft.inventory.Container; import net.minecraft.inventory.IInventory; import net.minecraft.inventory.Slot; import net.minecraft.item.ItemStack; +import darkknight.jewelrycraft.api.IJewelryItem; import darkknight.jewelrycraft.client.gui.container.slots.SlotBracelet; import darkknight.jewelrycraft.client.gui.container.slots.SlotEarrings; import darkknight.jewelrycraft.client.gui.container.slots.SlotNecklace; @@ -67,29 +68,14 @@ public class ContainerJewelryTab extends Container if (slot != null && slot.getHasStack()){ ItemStack itemstack1 = slot.getStack(); itemstack = itemstack1.copy(); - // if (slotID < 18){ - // if (!mergeItemStack(itemstack1, 18, 54, true)) return null; - // slot.onSlotChange(itemstack1, itemstack); - // }else if (itemstack1.getItem() instanceof ItemRing){ - // if (!mergeItemStack(itemstack1, 0, 10, false)) return null; - // }else if (itemstack1.getItem() instanceof ItemBracelet){ - // if (!mergeItemStack(itemstack1, 10, 14, false)) return null; - // }else if (itemstack1.getItem() instanceof ItemNecklace){ - // if (!mergeItemStack(itemstack1, 14, 17, false)) return null; - // }else if (itemstack1.getItem() instanceof ItemEarrings){ - // if (!mergeItemStack(itemstack1, 17, 18, false)) return null; - // }else{ - // if (!mergeItemStack(itemstack1, 18, 54, true)) return null; - // slot.onSlotChange(itemstack1, itemstack); - // } if (slotID >= 18){ - if (itemstack.getItem() instanceof ItemRing){ + if (itemstack.getItem() instanceof ItemRing || (itemstack.getItem() instanceof IJewelryItem && ((IJewelryItem)itemstack.getItem()).type() == 0)){ if (!mergeItemStack(itemstack, 0, 10, false) && !slot.getHasStack()) return null; - }else if (itemstack.getItem() instanceof ItemBracelet){ + }else if (itemstack.getItem() instanceof ItemBracelet || (itemstack.getItem() instanceof IJewelryItem && ((IJewelryItem)itemstack.getItem()).type() == 1)){ if (!mergeItemStack(itemstack, 10, 14, false) && !slot.getHasStack()) return null; - }else if (itemstack.getItem() instanceof ItemNecklace ){ + }else if (itemstack.getItem() instanceof ItemNecklace || (itemstack.getItem() instanceof IJewelryItem && ((IJewelryItem)itemstack.getItem()).type() == 2)){ if (!mergeItemStack(itemstack, 14, 17, false) && !slot.getHasStack()) return null; - }else if (itemstack.getItem() instanceof ItemEarrings){ + }else if (itemstack.getItem() instanceof ItemEarrings || (itemstack.getItem() instanceof IJewelryItem && ((IJewelryItem)itemstack.getItem()).type() == 3)){ if (!mergeItemStack(itemstack, 17, 18, false) && !slot.getHasStack()) return null; } else{ @@ -104,8 +90,6 @@ public class ContainerJewelryTab extends Container else slot.onSlotChanged(); if (itemstack.stackSize != itemstack.stackSize) slot.onPickupFromSlot(player, itemstack); else return null; - // if (itemstack1.stackSize == 0) slot.putStack((ItemStack)null); - // else slot.onSlotChanged(); } return itemstack; } diff --git a/src/main/java/darkknight/jewelrycraft/client/gui/container/slots/SlotBracelet.java b/src/main/java/darkknight/jewelrycraft/client/gui/container/slots/SlotBracelet.java index 3bdbb64..bab265b 100644 --- a/src/main/java/darkknight/jewelrycraft/client/gui/container/slots/SlotBracelet.java +++ b/src/main/java/darkknight/jewelrycraft/client/gui/container/slots/SlotBracelet.java @@ -4,6 +4,7 @@ import net.minecraft.entity.player.EntityPlayer; import net.minecraft.inventory.IInventory; import net.minecraft.inventory.Slot; import net.minecraft.item.ItemStack; +import darkknight.jewelrycraft.api.IJewelryItem; import darkknight.jewelrycraft.item.ItemBracelet; public class SlotBracelet extends Slot @@ -27,7 +28,7 @@ public class SlotBracelet extends Slot @Override public boolean isItemValid(ItemStack stack) { - return stack.getItem() instanceof ItemBracelet; + return stack.getItem() instanceof ItemBracelet || (stack.getItem() instanceof IJewelryItem && ((IJewelryItem)stack.getItem()).type() == 1); } /** diff --git a/src/main/java/darkknight/jewelrycraft/client/gui/container/slots/SlotEarrings.java b/src/main/java/darkknight/jewelrycraft/client/gui/container/slots/SlotEarrings.java index de062bc..c968fc0 100644 --- a/src/main/java/darkknight/jewelrycraft/client/gui/container/slots/SlotEarrings.java +++ b/src/main/java/darkknight/jewelrycraft/client/gui/container/slots/SlotEarrings.java @@ -4,6 +4,7 @@ import net.minecraft.entity.player.EntityPlayer; import net.minecraft.inventory.IInventory; import net.minecraft.inventory.Slot; import net.minecraft.item.ItemStack; +import darkknight.jewelrycraft.api.IJewelryItem; import darkknight.jewelrycraft.item.ItemEarrings; public class SlotEarrings extends Slot @@ -27,7 +28,7 @@ public class SlotEarrings extends Slot @Override public boolean isItemValid(ItemStack stack) { - return stack.getItem() instanceof ItemEarrings; + return stack.getItem() instanceof ItemEarrings || (stack.getItem() instanceof IJewelryItem && ((IJewelryItem)stack.getItem()).type() == 3); } /** diff --git a/src/main/java/darkknight/jewelrycraft/client/gui/container/slots/SlotNecklace.java b/src/main/java/darkknight/jewelrycraft/client/gui/container/slots/SlotNecklace.java index 9a64079..d102ba8 100644 --- a/src/main/java/darkknight/jewelrycraft/client/gui/container/slots/SlotNecklace.java +++ b/src/main/java/darkknight/jewelrycraft/client/gui/container/slots/SlotNecklace.java @@ -4,6 +4,7 @@ import net.minecraft.entity.player.EntityPlayer; import net.minecraft.inventory.IInventory; import net.minecraft.inventory.Slot; import net.minecraft.item.ItemStack; +import darkknight.jewelrycraft.api.IJewelryItem; import darkknight.jewelrycraft.item.ItemNecklace; public class SlotNecklace extends Slot @@ -27,7 +28,7 @@ public class SlotNecklace extends Slot @Override public boolean isItemValid(ItemStack stack) { - return stack.getItem() instanceof ItemNecklace; + return stack.getItem() instanceof ItemNecklace || (stack.getItem() instanceof IJewelryItem && ((IJewelryItem)stack.getItem()).type() == 2); } /** diff --git a/src/main/java/darkknight/jewelrycraft/client/gui/container/slots/SlotRing.java b/src/main/java/darkknight/jewelrycraft/client/gui/container/slots/SlotRing.java index a52cf6b..6a7e956 100644 --- a/src/main/java/darkknight/jewelrycraft/client/gui/container/slots/SlotRing.java +++ b/src/main/java/darkknight/jewelrycraft/client/gui/container/slots/SlotRing.java @@ -4,6 +4,7 @@ import net.minecraft.entity.player.EntityPlayer; import net.minecraft.inventory.IInventory; import net.minecraft.inventory.Slot; import net.minecraft.item.ItemStack; +import darkknight.jewelrycraft.api.IJewelryItem; import darkknight.jewelrycraft.item.ItemRing; public class SlotRing extends Slot @@ -27,7 +28,7 @@ public class SlotRing extends Slot @Override public boolean isItemValid(ItemStack stack) { - return stack.getItem() instanceof ItemRing; + return stack.getItem() instanceof ItemRing || (stack.getItem() instanceof IJewelryItem && ((IJewelryItem)stack.getItem()).type() == 0); } /** diff --git a/src/main/java/darkknight/jewelrycraft/curses/CurseMidasTouch.java b/src/main/java/darkknight/jewelrycraft/curses/CurseMidasTouch.java index b665b0d..68a1440 100644 --- a/src/main/java/darkknight/jewelrycraft/curses/CurseMidasTouch.java +++ b/src/main/java/darkknight/jewelrycraft/curses/CurseMidasTouch.java @@ -6,6 +6,7 @@ import net.minecraft.block.BlockPressurePlate; import net.minecraft.block.BlockPressurePlateWeighted; import net.minecraft.entity.Entity; import net.minecraft.entity.EntityLiving; +import net.minecraft.entity.EntityLivingBase; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.init.Blocks; import net.minecraft.init.Items; @@ -26,7 +27,6 @@ import darkknight.jewelrycraft.entities.EntityHeart; import darkknight.jewelrycraft.item.ItemList; import darkknight.jewelrycraft.tileentity.TileEntityMidasTouch; import darkknight.jewelrycraft.util.JewelryNBT; -import darkknight.jewelrycraft.util.JewelrycraftUtil; public class CurseMidasTouch extends Curse { @@ -38,7 +38,7 @@ public class CurseMidasTouch extends Curse @Override public void attackedByPlayerAction(World world, EntityPlayer player, Entity target) { - if (!world.isRemote && target instanceof EntityLiving && !(target instanceof EntityHeart) && !(target instanceof EntityHalfHeart) && player.inventory.getCurrentItem() == null){ + if (!world.isRemote && target instanceof EntityLivingBase && !(target instanceof EntityHeart) && !(target instanceof EntityHalfHeart) && player.inventory.getCurrentItem() == null){ world.setBlock(MathHelper.floor_double(target.posX), MathHelper.floor_double(target.posY), MathHelper.floor_double(target.posZ), BlockList.midasTouchBlock, 0, 2); TileEntityMidasTouch midasTouchVictim = new TileEntityMidasTouch(); midasTouchVictim.setEntity(target); diff --git a/src/main/java/darkknight/jewelrycraft/events/EntityEventHandler.java b/src/main/java/darkknight/jewelrycraft/events/EntityEventHandler.java index 0c4e9c6..dc13b09 100644 --- a/src/main/java/darkknight/jewelrycraft/events/EntityEventHandler.java +++ b/src/main/java/darkknight/jewelrycraft/events/EntityEventHandler.java @@ -36,6 +36,7 @@ import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; import darkknight.jewelrycraft.JewelrycraftMod; import darkknight.jewelrycraft.api.Curse; +import darkknight.jewelrycraft.api.IJewelryItem; import darkknight.jewelrycraft.damage.DamageSourceList; import darkknight.jewelrycraft.entities.EntityHalfHeart; import darkknight.jewelrycraft.entities.EntityHeart; @@ -118,7 +119,10 @@ public class EntityEventHandler if (playerInfo.hasKey("ext" + i)){ NBTTagCompound nbt = (NBTTagCompound)playerInfo.getTag("ext" + i); ItemStack item = ItemStack.loadItemStackFromNBT(nbt); - if (item != null && item.getItem() instanceof ItemBaseJewelry) ((ItemBaseJewelry)item.getItem()).action(item, player); + if (item != null){ + if(item.getItem() instanceof ItemBaseJewelry)((ItemBaseJewelry)item.getItem()).action(item, player); + if(item.getItem() instanceof IJewelryItem)((IJewelryItem)item.getItem()).onWearAction(player); + } } if (!player.worldObj.isRemote){ if (playerInfo.hasKey("reselectCurses") && !playerInfo.getBoolean("reselectCurses")){ @@ -168,7 +172,7 @@ public class EntityEventHandler @SubscribeEvent public void onEntityAttacked(LivingAttackEvent event) { - Entity entity = event.entityLiving; + EntityLivingBase entity = event.entityLiving; if (event.source.getEntity() != null && event.source.getEntity() instanceof EntityLivingBase && ((EntityLivingBase)event.source.getEntity()).isPotionActive(PotionList.stun)) event.setCanceled(true); if (entity instanceof EntityPlayer && !(event.source.getEntity() instanceof EntityPlayer)){ EntityPlayer player = (EntityPlayer)entity; @@ -186,7 +190,10 @@ public class EntityEventHandler event.setCanceled(true); break; } - if (item != null && item.getItem() instanceof ItemBaseJewelry) ((ItemBaseJewelry)item.getItem()).onPlayerAttacked(item, player, event.source, event.ammount); + if (item != null){ + if(item.getItem() instanceof ItemBaseJewelry)((ItemBaseJewelry)item.getItem()).onPlayerAttacked(item, player, event.source, event.ammount); + if(item.getItem() instanceof IJewelryItem)((IJewelryItem)item.getItem()).onPlayerAttackedAction(player, event.source, event.ammount); + } } if (player.getHealth() != player.prevHealth){ if (playerInfo.getFloat("WhiteHeart") > 0){ @@ -244,7 +251,10 @@ public class EntityEventHandler event.setCanceled(true); break; } - if (item != null && item.getItem() instanceof ItemBaseJewelry) ((ItemBaseJewelry)item.getItem()).onEntityAttacked(item, player, entity, event.ammount); + if (item != null){ + if(item.getItem() instanceof ItemBaseJewelry)((ItemBaseJewelry)item.getItem()).onEntityAttacked(item, player, entity, event.ammount); + if(item.getItem() instanceof IJewelryItem)((IJewelryItem)item.getItem()).onEntityAttackedByPlayer(player, entity, event.ammount); + } } for(Curse curse: Curse.getCurseList()) if (playerInfo.getInteger(curse.getName()) > 0) curse.attackedByPlayerAction(entity.worldObj, player, entity); @@ -274,6 +284,15 @@ public class EntityEventHandler playerInfo.setFloat("WhiteHeart", 0f); for(Curse curse: Curse.getCurseList()) if (playerInfo.getInteger(curse.getName()) > 0) curse.respawnAction(player.worldObj, player); + for(int i = 0; i < 18; i++) + if (playerInfo.hasKey("ext" + i)){ + NBTTagCompound nbt = (NBTTagCompound)playerInfo.getTag("ext" + i); + ItemStack item = ItemStack.loadItemStackFromNBT(nbt); + if (item != null){ + if(item.getItem() instanceof ItemBaseJewelry)((ItemBaseJewelry)item.getItem()).onPlayerRespawn(item, event); + if(item.getItem() instanceof IJewelryItem)((IJewelryItem)item.getItem()).onPlayerRespawnAction(event); + } + } } if (event.entity instanceof EntityPlayer && !(event.entity instanceof EntityPlayerMP)) JewelrycraftMod.netWrapper.sendToServer(new PacketRequestPlayerInfo()); if (!player.worldObj.isRemote){ @@ -383,7 +402,10 @@ public class EntityEventHandler if (playerInfo.hasKey("ext" + i)){ NBTTagCompound nbt = (NBTTagCompound)playerInfo.getTag("ext" + i); ItemStack item = ItemStack.loadItemStackFromNBT(nbt); - if (item != null && item.getItem() instanceof ItemBaseJewelry) ((ItemBaseJewelry)item.getItem()).onPlayerDead(item, player, event.source); + if (item != null){ + if(item.getItem() instanceof ItemBaseJewelry)((ItemBaseJewelry)item.getItem()).onPlayerDead(item, player, event.source); + if(item.getItem() instanceof IJewelryItem)((IJewelryItem)item.getItem()).onPlayerDeadAction(player, event.source); + } } } if (event.entity instanceof EntityPlayer && !(event.entity instanceof EntityPlayerMP)) JewelrycraftMod.netWrapper.sendToServer(new PacketRequestPlayerInfo()); diff --git a/src/main/java/darkknight/jewelrycraft/item/ItemBaseJewelry.java b/src/main/java/darkknight/jewelrycraft/item/ItemBaseJewelry.java index 4c2b425..dcf7804 100644 --- a/src/main/java/darkknight/jewelrycraft/item/ItemBaseJewelry.java +++ b/src/main/java/darkknight/jewelrycraft/item/ItemBaseJewelry.java @@ -25,11 +25,13 @@ import net.minecraft.util.EnumChatFormatting; import net.minecraft.util.IIcon; import net.minecraft.util.ResourceLocation; import net.minecraft.util.StatCollector; +import net.minecraftforge.event.entity.player.PlayerEvent; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; import darkknight.jewelrycraft.JewelrycraftMod; import darkknight.jewelrycraft.api.ModifierEffects; import darkknight.jewelrycraft.util.JewelryNBT; +import darkknight.jewelrycraft.util.Variables; public abstract class ItemBaseJewelry extends Item { @@ -192,11 +194,11 @@ public abstract class ItemBaseJewelry extends Item { if (stack.hasTagCompound() && par4){ ItemStack ingot = JewelryNBT.ingot(stack); - if (ingot != null && Item.getIdFromItem(JewelryNBT.ingot(stack).getItem()) > 0) list.add("Metal: " + EnumChatFormatting.YELLOW + ingot.getDisplayName().replace("Ingot", " ")); + if (ingot != null && Item.getIdFromItem(JewelryNBT.ingot(stack).getItem()) > 0) list.add(StatCollector.translateToLocal("info." + Variables.MODID + ".metal") +": " + EnumChatFormatting.YELLOW + ingot.getDisplayName().replace(StatCollector.translateToLocal("info." + Variables.MODID + ".ingot"), " ")); ItemStack gem = JewelryNBT.gem(stack); - if (gem != null) list.add("Gem: " + EnumChatFormatting.BLUE + gem.getDisplayName()); + if (gem != null) list.add(StatCollector.translateToLocal("info." + Variables.MODID + ".gem")+": " + EnumChatFormatting.BLUE + gem.getDisplayName()); ArrayList<ItemStack> modifier = JewelryNBT.modifier(stack); - if (!modifier.isEmpty()) list.add("Modifiers: "); + if (!modifier.isEmpty()) list.add(StatCollector.translateToLocal("info." + Variables.MODID + ".modifiers")+": "); for(int i = 0; i < modifier.size(); i++) list.add(EnumChatFormatting.DARK_PURPLE + modifier.get(i).getDisplayName() + " x" + modifier.get(i).stackSize); } @@ -265,4 +267,10 @@ public abstract class ItemBaseJewelry extends Item for(ModifierEffects mod: ModifierEffects.getEffects()) mod.onPlayerDead(stack, player, source, this); } + + public void onPlayerRespawn(ItemStack stack, PlayerEvent.Clone event) + { + for(ModifierEffects mod: ModifierEffects.getEffects()) + mod.onPlayerRespawn(stack, event, this); + } } diff --git a/src/main/java/darkknight/jewelrycraft/item/ItemGoldObj.java b/src/main/java/darkknight/jewelrycraft/item/ItemGoldObj.java index 6d20408..182644b 100644 --- a/src/main/java/darkknight/jewelrycraft/item/ItemGoldObj.java +++ b/src/main/java/darkknight/jewelrycraft/item/ItemGoldObj.java @@ -14,6 +14,7 @@ import net.minecraft.item.ItemFood; import net.minecraft.item.ItemStack; import net.minecraft.util.EnumChatFormatting; import net.minecraft.util.IIcon; +import net.minecraft.util.StatCollector; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; import darkknight.jewelrycraft.util.JewelryNBT; @@ -57,13 +58,13 @@ public class ItemGoldObj extends Item public String getItemStackDisplayName(ItemStack stack) { - if (stack != null && stack.hasTagCompound() && stack.getTagCompound().hasKey("target") && Item.getItemById(Integer.valueOf(stack.getTagCompound().getTag("target").toString().split(",")[0].substring(4).replace("s", ""))) != null && JewelryNBT.item(stack) != null) return "Golden " + JewelryNBT.item(stack).getDisplayName(); - return "Golden Object"; + if (stack != null && stack.hasTagCompound() && stack.getTagCompound().hasKey("target") && Item.getItemById(Integer.valueOf(stack.getTagCompound().getTag("target").toString().split(",")[0].substring(4).replace("s", ""))) != null && JewelryNBT.item(stack) != null) return StatCollector.translateToLocal("info." + Variables.MODID + ".golden") + " " + JewelryNBT.item(stack).getDisplayName(); + return StatCollector.translateToLocal("item." + Variables.MODID + ".goldObject.name"); } public void addInformation(ItemStack stack, EntityPlayer player, List list, boolean displayInfo) { - if (displayInfo) if (stack != null && JewelryNBT.item(stack) != null && JewelryNBT.item(stack).getItem() instanceof ItemFood) list.add(EnumChatFormatting.DARK_PURPLE + "It's made of solid gold! How are you suppose to eat this?"); - else list.add(EnumChatFormatting.DARK_PURPLE + "Shiny, but useless :("); + if (displayInfo) if (stack != null && JewelryNBT.item(stack) != null && JewelryNBT.item(stack).getItem() instanceof ItemFood) list.add(EnumChatFormatting.DARK_PURPLE + StatCollector.translateToLocal("item." + Variables.MODID + ".goldObject.info.food")); + else list.add(EnumChatFormatting.DARK_PURPLE + StatCollector.translateToLocal("item." + Variables.MODID + ".goldObject.info.standard")); } } diff --git a/src/main/java/darkknight/jewelrycraft/item/ItemGuide.java b/src/main/java/darkknight/jewelrycraft/item/ItemGuide.java index 28d0c76..cf773c8 100644 --- a/src/main/java/darkknight/jewelrycraft/item/ItemGuide.java +++ b/src/main/java/darkknight/jewelrycraft/item/ItemGuide.java @@ -1,12 +1,18 @@ package darkknight.jewelrycraft.item; +import net.minecraft.entity.EntityLivingBase; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; +import net.minecraft.potion.Potion; +import net.minecraft.potion.PotionEffect; +import net.minecraft.util.DamageSource; import net.minecraft.world.World; +import net.minecraftforge.event.entity.player.PlayerEvent.Clone; import darkknight.jewelrycraft.JewelrycraftMod; +import darkknight.jewelrycraft.api.IJewelryItem; -public class ItemGuide extends Item +public class ItemGuide extends Item implements IJewelryItem { public ItemGuide() { @@ -19,4 +25,55 @@ public class ItemGuide extends Item if (world.isRemote) player.openGui(JewelrycraftMod.instance, 1, player.worldObj, 0, 0, 0); return stack; } + + /** + * @return + */ + @Override + public int type() + { + return 0; + } + + /** + * @param player + */ + @Override + public void onWearAction(EntityPlayer player) + { + player.addPotionEffect(new PotionEffect(Potion.fireResistance.id, 20, 0)); + } + + /** + * @param player + * @param source + * @param amount + */ + @Override + public void onPlayerAttackedAction(EntityPlayer player, DamageSource source, float amount) + {} + + /** + * @param player + * @param entity + * @param amount + */ + @Override + public void onEntityAttackedByPlayer(EntityPlayer player, EntityLivingBase entity, float amount) + {} + + /** + * @param player + * @param source + */ + @Override + public void onPlayerDeadAction(EntityPlayer player, DamageSource source) + {} + + /** + * @param event + */ + @Override + public void onPlayerRespawnAction(Clone event) + {} }
\ No newline at end of file diff --git a/src/main/java/darkknight/jewelrycraft/item/ItemThiefGloves.java b/src/main/java/darkknight/jewelrycraft/item/ItemThiefGloves.java index decf34e..204eab4 100644 --- a/src/main/java/darkknight/jewelrycraft/item/ItemThiefGloves.java +++ b/src/main/java/darkknight/jewelrycraft/item/ItemThiefGloves.java @@ -15,6 +15,7 @@ import net.minecraft.potion.Potion; import net.minecraft.util.AxisAlignedBB; import net.minecraft.util.ChatComponentText; import net.minecraft.util.EnumChatFormatting; +import net.minecraft.util.StatCollector; import net.minecraft.village.MerchantRecipe; import net.minecraft.village.MerchantRecipeList; import org.lwjgl.input.Keyboard; @@ -23,6 +24,7 @@ import cpw.mods.fml.relauncher.ReflectionHelper; import cpw.mods.fml.relauncher.Side; import darkknight.jewelrycraft.util.JewelrycraftUtil; import darkknight.jewelrycraft.util.PlayerUtils; +import darkknight.jewelrycraft.util.Variables; public class ItemThiefGloves extends Item { @@ -45,6 +47,7 @@ public class ItemThiefGloves extends Item @Override public boolean itemInteractionForEntity(ItemStack stack, EntityPlayer player, EntityLivingBase entity) { + String villagerString = StatCollector.translateToLocal("info." + Variables.MODID + ".villager"); if (entity instanceof EntityVillager){ EntityVillager villager = (EntityVillager)entity; int wealth = (Integer)ReflectionHelper.getPrivateValue(EntityVillager.class, villager, "wealth", "field_70956_bz"); @@ -84,37 +87,37 @@ public class ItemThiefGloves extends Item if (player.inventory.addItemStackToInventory(s)) ; else villager.entityDropItem(s, 0); if (!player.capabilities.isCreativeMode) JewelrycraftUtil.addCursePoints(player, 5); - player.addChatMessage(new ChatComponentText("Villager #" + villager.getProfession() + ": Hmmm... I seem to have lost my " + s.getDisplayName() + "!")); + player.addChatMessage(new ChatComponentText(villagerString+" #" + villager.getProfession() + ": "+StatCollector.translateToLocal("chatmessage." + Variables.MODID + ".villager.confusion") + s.getDisplayName() + "!")); stack.damageItem(1, player); } buyingList.clear(); ReflectionHelper.setPrivateValue(EntityVillager.class, villager, 300, "timeUntilReset", "field_70961_j"); ReflectionHelper.setPrivateValue(EntityVillager.class, villager, true, "needsInitilization", "field_70959_by"); - player.addChatMessage(new ChatComponentText("You hear a faint whisper in your ear: ")); - player.addChatMessage(new ChatComponentText(EnumChatFormatting.DARK_PURPLE + "Those who steal but don't get caught get rewarded and do not.")); - player.addChatMessage(new ChatComponentText(EnumChatFormatting.DARK_PURPLE + "Embrace the path you have gone, for the darkness will not")); - player.addChatMessage(new ChatComponentText(EnumChatFormatting.DARK_PURPLE + "dwell on.")); + player.addChatMessage(new ChatComponentText(StatCollector.translateToLocal("chatmessage." + Variables.MODID + ".whisper")+": ")); + player.addChatMessage(new ChatComponentText(EnumChatFormatting.DARK_PURPLE + StatCollector.translateToLocal("chatmessage." + Variables.MODID + ".stealSuccess1"))); + player.addChatMessage(new ChatComponentText(EnumChatFormatting.DARK_PURPLE + StatCollector.translateToLocal("chatmessage." + Variables.MODID + ".stealSuccess2"))); + player.addChatMessage(new ChatComponentText(EnumChatFormatting.DARK_PURPLE + StatCollector.translateToLocal("chatmessage." + Variables.MODID + ".stealSuccess3"))); }else{ stack.damageItem(1, player); if (!player.capabilities.isCreativeMode) JewelrycraftUtil.addCursePoints(player, 25); if (player.isPotionActive(Potion.invisibility)){ - player.addChatMessage(new ChatComponentText("Villager #" + villager.getProfession() + " sensed a strange presence around him, making him cling on to his items. You didn't get anything.")); + player.addChatMessage(new ChatComponentText(villagerString+" #" + villager.getProfession() + " " +StatCollector.translateToLocal("chatmessage." + Variables.MODID + ".steal.fail"))); } else{ if (areOtherVillagersAround){ if (!canTheySeeYou){ - player.addChatMessage(new ChatComponentText("As he was passing by, a random villager caught you trying to steal from Villager #" + villager.getProfession() + ".")); - player.addChatMessage(new ChatComponentText("Villager #" + villager.getProfession() + " curses you for the attempt.")); + player.addChatMessage(new ChatComponentText(StatCollector.translateToLocal("chatmessage." + Variables.MODID + ".steal.caught1")+" "+villagerString+" #" + villager.getProfession() + ".")); + player.addChatMessage(new ChatComponentText(villagerString+" #" + villager.getProfession() + " "+StatCollector.translateToLocal("chatmessage." + Variables.MODID + ".steal2"))); return true; } else{ - player.addChatMessage(new ChatComponentText("A villager nearby saw you trying to steal from Villager #" + villager.getProfession() + ".")); - player.addChatMessage(new ChatComponentText("Villager #" + villager.getProfession() + " curses you for the attempt.")); + player.addChatMessage(new ChatComponentText(StatCollector.translateToLocal("chatmessage." + Variables.MODID + ".steal.caught2")+" "+villagerString+" #" + villager.getProfession() + ".")); + player.addChatMessage(new ChatComponentText(villagerString+" #" + villager.getProfession() + " "+StatCollector.translateToLocal("chatmessage." + Variables.MODID + ".steal2"))); return true; } }else{ - player.addChatMessage(new ChatComponentText("Villager #" + villager.getProfession() + " caught you trying to steal from him.")); - player.addChatMessage(new ChatComponentText("Villager #" + villager.getProfession() + " curses you for the attempt.")); + player.addChatMessage(new ChatComponentText(villagerString+" #" + villager.getProfession() + " "+StatCollector.translateToLocal("chatmessage." + Variables.MODID + ".steal1"))); + player.addChatMessage(new ChatComponentText(villagerString+" #" + villager.getProfession() + " "+StatCollector.translateToLocal("chatmessage." + Variables.MODID + ".steal2"))); return true; } } @@ -136,9 +139,9 @@ public class ItemThiefGloves extends Item { if (!shouldAddAdditionalInfo()) list.add(EnumChatFormatting.GRAY + additionalInfoInstructions()); else{ - list.add(EnumChatFormatting.GRAY + "Right click with the gloves,"); - list.add(EnumChatFormatting.GRAY + "while sneaking, on a villager"); - list.add(EnumChatFormatting.GRAY + "to steal his stuff."); + list.add(EnumChatFormatting.GRAY + StatCollector.translateToLocal("item." + Variables.MODID + ".thievingGloves.info.1")); + list.add(EnumChatFormatting.GRAY + StatCollector.translateToLocal("item." + Variables.MODID + ".thievingGloves.info.2")); + list.add(EnumChatFormatting.GRAY + StatCollector.translateToLocal("item." + Variables.MODID + ".thievingGloves.info.3")); } } @@ -156,7 +159,7 @@ public class ItemThiefGloves extends Item */ public static String additionalInfoInstructions() { - String message = "\247oPress \247b<SHIFT>\2477\247o for more information."; + String message = StatCollector.translateToLocal("item." + Variables.MODID + ".thievingGloves.info.extra"); return message; } } diff --git a/src/main/java/darkknight/jewelrycraft/thirdparty/EE3.java b/src/main/java/darkknight/jewelrycraft/thirdparty/EE3.java new file mode 100644 index 0000000..1222d7c --- /dev/null +++ b/src/main/java/darkknight/jewelrycraft/thirdparty/EE3.java @@ -0,0 +1,36 @@ +package darkknight.jewelrycraft.thirdparty; + +import java.util.Arrays; +import java.util.List; +import net.minecraft.item.ItemStack; +import com.pahimar.ee3.api.EnergyValueRegistryProxy; +import darkknight.jewelrycraft.block.BlockList; +import darkknight.jewelrycraft.item.ItemList; + +public class EE3 implements IThirdParty +{ + @Override + public void preInit() + { + EnergyValueRegistryProxy.addPostAssignedEnergyValue(new ItemStack(BlockList.shadowOre), 4096); + EnergyValueRegistryProxy.addPostAssignedEnergyValue(new ItemStack(ItemList.shadowIngot), 4096); + EnergyValueRegistryProxy.addPostAssignedEnergyValue(new ItemStack(ItemList.clayMolds), 128); + EnergyValueRegistryProxy.addPostAssignedEnergyValue(new ItemStack(ItemList.molds), 128);} + + @Override + public void init() + {} + + @Override + public void postInit() + { + } + + @Override + public void clientSide() + {} + + @Override + public void clientInit() + {} +}
\ No newline at end of file diff --git a/src/main/java/darkknight/jewelrycraft/thirdparty/IRegistryListener.java b/src/main/java/darkknight/jewelrycraft/thirdparty/IRegistryListener.java new file mode 100644 index 0000000..703a226 --- /dev/null +++ b/src/main/java/darkknight/jewelrycraft/thirdparty/IRegistryListener.java @@ -0,0 +1,12 @@ +package darkknight.jewelrycraft.thirdparty; + +import net.minecraft.block.Block; +import net.minecraft.item.Item; +/** + * @author MineMarteen from Pneumaticraft + */ +public interface IRegistryListener{ + public void onItemRegistry(Item item); + + public void onBlockRegistry(Block block); +}
\ No newline at end of file diff --git a/src/main/java/darkknight/jewelrycraft/thirdparty/IThirdParty.java b/src/main/java/darkknight/jewelrycraft/thirdparty/IThirdParty.java new file mode 100644 index 0000000..8aaba72 --- /dev/null +++ b/src/main/java/darkknight/jewelrycraft/thirdparty/IThirdParty.java @@ -0,0 +1,23 @@ +package darkknight.jewelrycraft.thirdparty; + +/** + * @author MineMarteen from Pneumaticraft + */ +public interface IThirdParty{ + + public void preInit(); + + public void init(); + + public void postInit(); + + /** + * Gets called from the ClientProxy in the preInit. + */ + public void clientSide(); + + /** + * Gets called from the ClientProxy in the Init. + */ + public void clientInit(); +}
\ No newline at end of file diff --git a/src/main/java/darkknight/jewelrycraft/thirdparty/ModIds.java b/src/main/java/darkknight/jewelrycraft/thirdparty/ModIds.java new file mode 100644 index 0000000..61fcf99 --- /dev/null +++ b/src/main/java/darkknight/jewelrycraft/thirdparty/ModIds.java @@ -0,0 +1,28 @@ +package darkknight.jewelrycraft.thirdparty; + +/** + * @author MineMarteen from Pneumaticraft + */ +public class ModIds{ + public static final String BUILDCRAFT = "BuildCraft|Core"; + public static final String COMPUTERCRAFT = "ComputerCraft"; + public static final String INDUSTRIALCRAFT = "IC2"; + public static final String IGWMOD = "IGWMod"; + public static final String FMP = "ForgeMultipart"; + public static final String WAILA = "Waila"; + public static final String TE = "ThermalExpansion"; + public static final String HC = "HydCraft"; + public static final String NEI = "NotEnoughItems"; + public static final String THAUMCRAFT = "Thaumcraft"; + public static final String BLOOD_MAGIC = "AWWayofTime"; + public static final String AE2 = "appliedenergistics2"; + public static final String CHISEL = "chisel"; + public static final String FORESTRY = "Forestry"; + public static final String MFR = "MineFactoryReloaded"; + public static final String OPEN_BLOCKS = "OpenBlocks"; + public static final String COFH_CORE = "CoFHCore"; + public static final String NOT_ENOUGH_KEYS = "notenoughkeys"; + public static final String OPEN_COMPUTERS = "OpenComputers|Core"; + public static final String EE3 = "EE3"; + public static final String PENUMATICRAFT = "PneumaticCraft"; +}
\ No newline at end of file diff --git a/src/main/java/darkknight/jewelrycraft/thirdparty/ThirdPartyManager.java b/src/main/java/darkknight/jewelrycraft/thirdparty/ThirdPartyManager.java new file mode 100644 index 0000000..5bc45b6 --- /dev/null +++ b/src/main/java/darkknight/jewelrycraft/thirdparty/ThirdPartyManager.java @@ -0,0 +1,144 @@ +package darkknight.jewelrycraft.thirdparty; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.logging.Level; +import net.minecraft.block.Block; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.item.Item; +import net.minecraft.world.World; +import cpw.mods.fml.common.Loader; +import cpw.mods.fml.common.Optional; +import cpw.mods.fml.common.network.IGuiHandler; +import darkknight.jewelrycraft.JewelrycraftMod; +import darkknight.jewelrycraft.config.ConfigHandler; + +/** + * @author MineMarteen from Pneumaticraft + */ +public class ThirdPartyManager implements IGuiHandler{ + + private static ThirdPartyManager INSTANCE = new ThirdPartyManager(); + private final List<IThirdParty> thirdPartyMods = new ArrayList<IThirdParty>(); + + public static ThirdPartyManager instance(){ + return INSTANCE; + } + + public void index(){ + Map<String, Class<? extends IThirdParty>> thirdPartyClasses = new HashMap<String, Class<? extends IThirdParty>>(); + thirdPartyClasses.put(ModIds.EE3, EE3.class); + + List<String> enabledThirdParty = new ArrayList<String>(); + ConfigHandler.config.addCustomCategoryComment("third_party_enabling", "With these options you can disable third party content by mod. Useful if something in the mod changes and causes crashes."); + for(String modid : thirdPartyClasses.keySet()) { + if(ConfigHandler.config.get("Third_Party_Enabling", modid, true).getBoolean()) { + enabledThirdParty.add(modid); + } + } + ConfigHandler.config.save(); + + for(Map.Entry<String, Class<? extends IThirdParty>> entry : thirdPartyClasses.entrySet()) { + if(enabledThirdParty.contains(entry.getKey()) && Loader.isModLoaded(entry.getKey())) { + try { + thirdPartyMods.add(entry.getValue().newInstance()); + } catch(Exception e) { + JewelrycraftMod.logger.log(Level.SEVERE, "Failed to instantiate third party handler!"); + e.printStackTrace(); + } + } + } + } + + public void onItemRegistry(Item item){ + for(IThirdParty thirdParty : thirdPartyMods) { + if(thirdParty instanceof IRegistryListener) ((IRegistryListener)thirdParty).onItemRegistry(item); + } + } + + public void onBlockRegistry(Block block){ + for(IThirdParty thirdParty : thirdPartyMods) { + if(thirdParty instanceof IRegistryListener) ((IRegistryListener)thirdParty).onBlockRegistry(block); + } + } + + public void preInit(){ + for(IThirdParty thirdParty : thirdPartyMods) { + try { + thirdParty.preInit(); + } catch(Throwable e) { + JewelrycraftMod.logger.log(Level.SEVERE, "Jewelrycraft wasn't able to load third party content from the third party class " + thirdParty.getClass() + " in the PreInit phase!"); + e.printStackTrace(); + } + } + } + + public void init(){ + for(IThirdParty thirdParty : thirdPartyMods) { + try { + thirdParty.init(); + } catch(Throwable e) { + JewelrycraftMod.logger.log(Level.SEVERE, "Jewelrycraft wasn't able to load third party content from the third party class " + thirdParty.getClass() + " in the Init phase!"); + e.printStackTrace(); + } + } + } + + public void postInit(){ + for(IThirdParty thirdParty : thirdPartyMods) { + try { + thirdParty.postInit(); + } catch(Throwable e) { + JewelrycraftMod.logger.log(Level.SEVERE, "Jewelrycraft wasn't able to load third party content from the third party class " + thirdParty.getClass() + " in the PostInit phase!"); + e.printStackTrace(); + } + } + } + + public void clientSide(){ + for(IThirdParty thirdParty : thirdPartyMods) { + try { + thirdParty.clientSide(); + } catch(Throwable e) { + JewelrycraftMod.logger.log(Level.SEVERE, "Jewelrycraft wasn't able to load third party content from the third party class " + thirdParty.getClass() + " client side!"); + e.printStackTrace(); + } + } + } + + public void clientInit(){ + for(IThirdParty thirdParty : thirdPartyMods) { + try { + thirdParty.clientInit(); + } catch(Throwable e) { + JewelrycraftMod.logger.log(Level.SEVERE, "Jewelrycraft wasn't able to load third party content from the third party class " + thirdParty.getClass() + " client side on the init!"); + e.printStackTrace(); + } + } + } + + @Override + public Object getServerGuiElement(int ID, EntityPlayer player, World world, int x, int y, int z){ + for(IThirdParty thirdParty : thirdPartyMods) { + if(thirdParty instanceof IGuiHandler) { + Object obj = ((IGuiHandler)thirdParty).getServerGuiElement(ID, player, world, x, y, z); + if(obj != null) return obj; + } + } + return null; + } + + @Override + public Object getClientGuiElement(int ID, EntityPlayer player, World world, int x, int y, int z){ + for(IThirdParty thirdParty : thirdPartyMods) { + if(thirdParty instanceof IGuiHandler) { + Object obj = ((IGuiHandler)thirdParty).getClientGuiElement(ID, player, world, x, y, z); + if(obj != null) return obj; + } + } + return null; + } + +}
\ No newline at end of file diff --git a/src/main/java/darkknight/jewelrycraft/util/Variables.java b/src/main/java/darkknight/jewelrycraft/util/Variables.java index fd41064..dc43254 100644 --- a/src/main/java/darkknight/jewelrycraft/util/Variables.java +++ b/src/main/java/darkknight/jewelrycraft/util/Variables.java @@ -6,7 +6,7 @@ public class Variables { public static final String MODID = "jewelrycraft2"; public static final String MODNAME = "Jewelrycraft 2"; - public static final String VERSION = "1.0.8"; + public static final String VERSION = "1.0.9"; public static final String PACKET_CHANNEL = "jewelrycraft2"; public static final String CONFIG_GUI = "darkknight.jewelrycraft.config.ConfigGuiFactory"; |
