Jump to content

p455w0rd

Forge Modder
  • Posts

    61
  • Joined

  • Last visited

Everything posted by p455w0rd

  1. MalformedJsonException means your JSON formatting is incorrect somwhere...in this case, remove the first and last curly brackets
  2. you can't you use or dev/doebf or source versions in a legit MC instance..you need the universal versions
  3. So this mod is my first time working with TileEntities. I cannot for the life of me figure this out. When I place down a block that implements IEnergyReceiver and then place my 'Battery' block next to it, it receives energy indefinitely. I set the energy to 10000 rf on the battery just for testing, but the other block (a furnace) just keeps adding rf. However if I place another furnace down and the battery has 'given' the 10k rf it holds it will not give any rf to the newer block. Here's a gif: http://p455w0rd.net/mc/p1.9te_weirdness.gif[/img] What is happening is the first furnace is taking the 10k rf from the battery, this is the reason for the pause. ( transfers @ 2k rf/t, so 0.5 second needs to pass). The second furnace is placed and no rf is added meaning something is kind of working. I know this is probably really simple, but I've been working on it for probably 3 days now with no ability to get it to stop transferring energy after the 10k the battery has is drained. The relevant TileEntities are: Battery: https://github.com/p455w0rd/p455w0rds1.9Things/blob/master/src/java/p455w0rd/p455w0rdsthings/blocks/tileentities/TileEntityBattery.java Furnace: https://github.com/p455w0rd/p455w0rds1.9Things/blob/master/src/java/p455w0rd/p455w0rdsthings/blocks/tileentities/TileEntityFurnace.java Also, before someone yells at me for it, I plan to convert to capabilities as soon as I get the RF working. SOLUTION don't be a nub like me and remember to register your new Packet messages
  4. I was under the impression everything that is in InventoryPlayer is ticked..good to know =D
  5. Okay, for your Item (assuming it extends Item (net.minecraft.item.Item), you can override the onUpdate method which takes the following parameters: ItemStack, World, Entity, int, boolean from Entity you can check that it is an instance of EntityPlayer. if it is an instance of EntityPlayer, you can get the player's inventory to check if they have the required pieces of armor equipped if they have all of the required pieces, you can check for capabilities.isFlying and so on...
  6. I could be wrong, but I think it would be better to do this on something like an armor item's onUpdate event..by using the PlayerTick event, you're messing with anything any other mod might be using that event for..when you set the value of player.capabilities.allowFlying to false, you're doing this on a global scale.. Also..whoever told you that this doesn't need to happen every tick is correct..doing a check every tick should be fine (I would assume)... If it has changed from it's previous state, then update player accordingly
  7. Look into net.minecraft.item.Item. The addInformation method
  8. Figured I'd post my success thus far. I've solved the shield damage issue. As I stated in the edit of the OP, the shield damage is handled in EntityPlayer, so therefore an event handler must be used to calculate it for our custom shield. The event handler needed in this case is LivingAttackEvent. Here is my resulting code in which the shield takes damage. Feel free to criticize/inform me of better ways of doing this or if I have done something in error. @SubscribeEvent public void attackEvent(LivingAttackEvent e) { float damage = e.getAmount(); ItemStack activeItemStack; EntityPlayer player; if (!(e.getEntityLiving() instanceof EntityPlayer)) { return; } player = (EntityPlayer) e.getEntityLiving(); if (player.getActiveItemStack() == null) { return; } activeItemStack = player.getActiveItemStack(); if (damage > 0.0F && activeItemStack != null && activeItemStack.getItem() == ModItems.ItemShield) { int i = 1 + MathHelper.floor_float(damage); activeItemStack.damageItem(i, player); if (activeItemStack.stackSize <= 0) { EnumHand enumhand = player.getActiveHand(); net.minecraftforge.event.ForgeEventFactory.onPlayerDestroyItem(player, activeItemStack, enumhand); if (enumhand == EnumHand.MAIN_HAND) { player.setItemStackToSlot(EntityEquipmentSlot.MAINHAND, (ItemStack) null); } else { player.setItemStackToSlot(EntityEquipmentSlot.OFFHAND, (ItemStack) null); } activeItemStack = null; if (FMLCommonHandler.instance().getSide() == Side.CLIENT) { player.playSound(SoundEvents.item_shield_break, 0.8F, 0.8F + player.worldObj.rand.nextFloat() * 0.4F); } } } } Replace ModItems.ItemShield with your mod's item. Something else I've discovered worth mentioning: There is now a single forge event bus! FMLCommonHandler's bus is now deprecated, so use MinecraftForge.EVENT_BUS from here forward =]
  9. Well, the shield I made is functional. It blocks arrows and in 3rd person plays the correct animation. My model also loads fine. I'm having 2 issues: 1) when right-clicking, the first person animation doesn't play (just does a similar animation to what happens when you right-click an empty bucket on a block in creative) 2) the shield doesn't take damage when hit I've tried adding "textures" and "elements" to p455w0rdshield_blocking.json and this had no effect. I thought maybe I needed a custom IItemPropertyGetter as you do with ItemBow, but ItemShield doesn't check for an instanceof ItemShield ItemPShield.java public class ItemPShield extends ItemShield { private final String name = "p455w0rdshield"; public ItemPShield() { setRegistryName(this.name); setUnlocalizedName(this.name); GameRegistry.register(this); this.setMaxStackSize(1); this.setMaxDamage(336); this.setCreativeTab(CreativeTabs.tabCombat); this.setCreativeTab(CommonProxy.creativeTab); this.addPropertyOverride(new ResourceLocation(Globals.MODID, "blocking"), new IItemPropertyGetter() { @SideOnly(Side.CLIENT) public float apply(ItemStack stack, World worldIn, EntityLivingBase entityIn) { return entityIn != null && entityIn.isHandActive() && entityIn.getActiveItemStack() == stack ? 1.0F : 0.0F; } }); } @SideOnly(Side.CLIENT) public void initModel() { ModelLoader.setCustomModelResourceLocation(this, 0, new ModelResourceLocation(this.getRegistryName(), "inventory")); } @Override public String getItemStackDisplayName(ItemStack stack) { return LocaleHandler.p455w0rdshield.getLocal(); } /** * allows items to add custom lines of information to the mouseover description */ @SideOnly(Side.CLIENT) @Override public void addInformation(ItemStack stack, EntityPlayer playerIn, List<String> tooltip, boolean advanced) { //ItemBanner.func_185054_a(stack, tooltip); tooltip.add("Tooltip"); } } models/item/p455w0rdshield.json { "textures": { "0": "minecraft:blocks/diamond_block", "1": "minecraft:blocks/iron_block" }, "elements": [ { "name": "Cube", "from": [ 6.0, 0.0, 8.0 ], "to": [ 10.0, 1.0, 9.0 ], "faces": { "north": { "texture": "#0", "uv": [ 6.0, 14.0, 10.0, 15.0 ] }, "east": { "texture": "#0", "uv": [ 10.0, 14.0, 11.0, 15.0 ] }, "south": { "texture": "#0", "uv": [ 6.0, 14.0, 10.0, 15.0 ] }, "west": { "texture": "#0", "uv": [ 5.0, 14.0, 6.0, 15.0 ] }, "up": { "texture": "#-1", "uv": [ 1.0, 2.0, 5.0, 3.0 ] }, "down": { "texture": "#0", "uv": [ 6.0, 14.0, 10.0, 15.0 ] } } }, { "name": "Cube", "from": [ 5.0, 1.0, 8.0 ], "to": [ 11.0, 2.0, 9.0 ], "faces": { "north": { "texture": "#0", "uv": [ 5.0, 13.0, 11.0, 14.0 ] }, "east": { "texture": "#0", "uv": [ 11.0, 13.0, 12.0, 14.0 ] }, "south": { "texture": "#0", "uv": [ 5.0, 13.0, 11.0, 14.0 ] }, "west": { "texture": "#0", "uv": [ 4.0, 13.0, 5.0, 14.0 ] }, "up": { "texture": "#-1", "uv": [ 0.0, 0.0, 6.0, 1.0 ] }, "down": { "texture": "#0", "uv": [ 5.0, 13.0, 11.0, 14.0 ] } } }, { "name": "Cube", "from": [ 3.0, 2.0, 8.0 ], "to": [ 13.0, 3.0, 9.0 ], "faces": { "north": { "texture": "#0", "uv": [ 3.0, 12.0, 13.0, 13.0 ] }, "east": { "texture": "#0", "uv": [ 13.0, 12.0, 14.0, 13.0 ] }, "south": { "texture": "#0", "uv": [ 3.0, 12.0, 13.0, 13.0 ] }, "west": { "texture": "#0", "uv": [ 2.0, 12.0, 3.0, 13.0 ] }, "up": { "texture": "#-1", "uv": [ 0.0, 0.0, 10.0, 1.0 ] }, "down": { "texture": "#0", "uv": [ 3.0, 12.0, 13.0, 13.0 ] } } }, { "name": "Cube", "from": [ 2.0, 3.0, 8.0 ], "to": [ 14.0, 4.0, 9.0 ], "faces": { "north": { "texture": "#0", "uv": [ 2.0, 11.0, 14.0, 12.0 ] }, "east": { "texture": "#0", "uv": [ 14.0, 11.0, 15.0, 12.0 ] }, "south": { "texture": "#0", "uv": [ 2.0, 11.0, 14.0, 12.0 ] }, "west": { "texture": "#0", "uv": [ 1.0, 11.0, 2.0, 12.0 ] }, "up": { "texture": "#-1", "uv": [ 0.0, 0.0, 12.0, 1.0 ] }, "down": { "texture": "#0", "uv": [ 2.0, 11.0, 14.0, 12.0 ] } } }, { "name": "Cube", "from": [ 1.0, 4.0, 8.0 ], "to": [ 15.0, 14.0, 9.0 ], "faces": { "north": { "texture": "#0", "uv": [ 1.0, 1.0, 15.0, 11.0 ] }, "east": { "texture": "#0", "uv": [ 14.0, 2.0, 15.0, 12.0 ] }, "south": { "texture": "#0", "uv": [ 1.0, 1.0, 15.0, 11.0 ] }, "west": { "texture": "#0", "uv": [ 1.0, 12.0, 2.0, 2.0 ] }, "up": { "texture": "#0", "uv": [ 2.0, 2.0, 15.0, 1.0 ] }, "down": { "texture": "#0", "uv": [ 1.0, 11.0, 15.0, 12.0 ] } } }, { "name": "Cube", "from": [ 2.0, 14.0, 8.0 ], "to": [ 14.0, 15.0, 9.0 ], "faces": { "north": { "texture": "#0", "uv": [ 2.0, 1.0, 14.0, 2.0 ] }, "east": { "texture": "#0", "uv": [ 14.0, 1.0, 15.0, 2.0 ] }, "south": { "texture": "#0", "uv": [ 2.0, 1.0, 14.0, 2.0 ] }, "west": { "texture": "#0", "uv": [ 1.0, 1.0, 2.0, 2.0 ] }, "up": { "texture": "#0", "uv": [ 2.0, 1.0, 14.0, 2.0 ] }, "down": { "texture": "#-1", "uv": [ 0.0, 0.0, 12.0, 1.0 ] } } }, { "name": "Cube", "from": [ 7.0, 6.0, 4.0 ], "to": [ 9.0, 7.0, 8.0 ], "faces": { "north": { "texture": "#-1", "uv": [ 0.0, 0.0, 2.0, 1.0 ] }, "east": { "texture": "#1", "uv": [ 1.0, 14.0, 5.0, 15.0 ] }, "south": { "texture": "#-1", "uv": [ 0.0, 0.0, 2.0, 1.0 ] }, "west": { "texture": "#1", "uv": [ 1.0, 14.0, 5.0, 15.0 ] }, "up": { "texture": "#1", "uv": [ 1.0, 1.0, 3.0, 5.0 ] }, "down": { "texture": "#1", "uv": [ 1.0, 1.0, 3.0, 5.0 ] } } }, { "name": "Cube", "from": [ 7.0, 11.0, 4.0 ], "to": [ 9.0, 12.0, 8.0 ], "faces": { "north": { "texture": "#-1", "uv": [ 0.0, 0.0, 2.0, 1.0 ] }, "east": { "texture": "#1", "uv": [ 1.0, 11.0, 5.0, 12.0 ] }, "south": { "texture": "#-1", "uv": [ 0.0, 0.0, 2.0, 1.0 ] }, "west": { "texture": "#1", "uv": [ 1.0, 11.0, 5.0, 12.0 ] }, "up": { "texture": "#1", "uv": [ 2.0, 2.0, 4.0, 6.0 ] }, "down": { "texture": "#1", "uv": [ 1.0, 1.0, 3.0, 5.0 ] } } }, { "name": "Cube", "from": [ 7.0, 6.0, 3.0 ], "to": [ 9.0, 12.0, 4.0 ], "faces": { "north": { "texture": "#1", "uv": [ 1.0, 11.0, 3.0, 17.0 ] }, "east": { "texture": "#1", "uv": [ 3.0, 11.0, 4.0, 17.0 ] }, "south": { "texture": "#1", "uv": [ 1.0, 2.0, 3.0, 8.0 ] }, "west": { "texture": "#1", "uv": [ 3.0, 11.0, 4.0, 17.0 ] }, "up": { "texture": "#1", "uv": [ 2.0, 1.0, 4.0, 2.0 ] }, "down": { "texture": "#1", "uv": [ 1.0, 1.0, 3.0, 2.0 ] } } } ], "display": { "thirdperson_righthand": { "rotation": [ 0, 90, 0 ], "translation": [ 2, -3, 3 ], "scale": [ 1, 1, 1 ] }, "thirdperson_lefthand": { "rotation": [ 0, 90, 0 ], "translation": [ 2, -3, 3 ], "scale": [ 1, 1, 1 ] }, "firstperson_righthand": { "rotation": [ 0, 180, 5 ], "translation": [ -4, -1, 6 ], "scale": [ 1, 1, 1 ] }, "firstperson_lefthand": { "rotation": [ 0, 180, 5 ], "translation": [ -2, -2, 6 ], "scale": [ 1.25, 1.25, 1.25 ] }, "gui": { "rotation": [ 15, -25, -5 ], "translation": [ 2, 1, 0 ], "scale": [ 1, 1, 1 ] }, "fixed": { "rotation": [ 0, 180, 0 ], "translation": [ 0, 0, -2], "scale":[ 1, 1, 1] }, "ground": { "rotation": [ 0, 0, 0 ], "translation": [ 0, 5, 0], "scale":[ 0.5, 0.5, 0.5] } }, "overrides": [ { "predicate": { "blocking": 1 }, "model": "p455w0rdsthings:item/p455w0rdshield_blocking" } ] } models/item/p455w0rdshield_blocking.json { "display": { "thirdperson_righthand": { "rotation": [ 45, 135, 0 ], "translation": [ 3.51, 11, -2 ], "scale": [ 1, 1, 1 ] }, "thirdperson_lefthand": { "rotation": [ 45, 135, 0 ], "translation": [ 13.51, 3, 5 ], "scale": [ 1, 1, 1 ] }, "firstperson_righthand": { "rotation": [ 0, 180, -5 ], "translation": [ -15, 5, -11 ], "scale": [ 1.25, 1.25, 1.25 ] }, "firstperson_lefthand": { "rotation": [ 0, 180, -5 ], "translation": [ 5, 5, -11 ], "scale": [ 1.25, 1.25, 1.25 ] }, "gui": { "rotation": [ 15, -25, -5 ], "translation": [ 2, 3, 0 ], "scale": [ 0.65, 0.65, 0.65 ] } } } More possibly relevant info: Item is registered in commonproxy on preinit Custom model is loaded via ModelLoader.setCustomModelResourceLocation in clientproxy on preinit Any help/guidence is greatly appreciated =] ============================ Okay, so I figured out why the shield isn't taking damage. It's tracked in EntityPlayer and doesn't check for instanceof, rather it checks for Items.shield. I'm now going to work on figuring out which event bus I should use to do the detection and will post back if/when I figure it out for anyone else who might have this same question.
  10. ohhh..the inventory is instantiated in the container-ContainerWirelessCraftingTerminal's constructor with the magnetInventory variable
  11. I'm not. I do a check to make sure there is no GUI open (checking for player.openContainer to be instanceof ContainerPlayer). The check is done in net.p455w0rd.wirelesscraftingterminal.handlers.KeybindHandler which is where the event listener is
  12. What would I need to post here to get someone to try to help me? I've been at this for three days now and nothing I have tried has worked. It seems like I've tried everything, but if I had, it would work. I just don't know what beyond what I've already posted you guys would need.
  13. I will add that if you're wanting the second blue durability bar, EnderIO's Source is available for download on GitHub.
  14. You will see a lot of <Class>#<method> references on this board and that's exactly what that format is. So in those references, "Item" is a reference to your presumed item's super class (net.minecraft.item.Item) and "showDurabilityBar" is a method within that class.
  15. In my previous post I posted the methods necessary to get your display bar working. Apparently you didn't feel like doing your own research into them, so I will spell it out for you. Item#showDurabilityBar In your item class override this method and return true when you want the durability bar to display. You can use conditionals to not display the bar when your item has max energy. @Override public boolean showDurabilityBar(ItemStack is) { if (getEnergyStored(is) >= getMaxEnergyStored(is)) { return false; } return true; } Item#getDurabilityForDisplay In your item class override this method and return a double value in a percentage value of 1 for the current stored energy. So if you're using purely RF (no conversions) it would look something like this: @Override public double getDurabilityForDisplay(ItemStack is) { return (double) (1 - getEnergyStored(is) / getMaxEnergyStored(is)); } Item#isDamageable This isn't required as it is true by default. What this does is set whether or not your item has durability. My item, the AE2 Wireless Crafting Terminal, has this set to false simply so "Durability 32/32" isn't displayed in the tooltip.
  16. Item#showDurabilityBar Item#getDurabilityForDisplay Item#isDamageable
  17. I would just ask that you learn from this (in other words, don't copy pasta and move on or you'll be back here in a few minutes). Notice the final else in that clause...these are essential.
  18. well you can't have 2 consecutive returns..the second will never be executed..your IDE should be complaining to you about this. so this: public Item getItemDropped(IBlockState state, Random rand, int fortune) { return this == MAOres.SapphireOre ? MAItems.Sapphire : Item.getItemFromBlock(this); return this == MAOres.RubyOre ? MAItems.Ruby : Item.getItemFromBlock(this); } public int quantityDropped(Random random) { return this == MAOres.SapphireOre ? 4 + random.nextInt(5) : 1; return this == MAOres.RubyOre ? 4 + random.nextInt(5) : 1; } should be more like this: public Item getItemDropped(IBlockState state, Random rand, int fortune) { if (this == MAOres.SapphireOre) { return MAItems.Sapphire; } else if (this == MAOres.RubyOre) { return MAItems.Ruby; } else { return null; } } public int quantityDropped(Random random) { if (this == MAOres.SapphireOre) { return 4 + random.nextInt(5) } else if (this == MAOres.RubyOre) { return 4 + random.nextInt(5) } else { return 0; } } As for dropping different items, you would use the same random/conditional logic above, just do it before you return
  19. I would post code, but I don't even know where to begin. I've been as concise I as can be. I reference the repo and in post #2 made direct references to specific classes/methods. Also, as far as implementing an NBT helper class: I just don't see a real point. It does the same thing Forge already has implemented without adding any functionality. Not bashing in any way. I just don't see a reason to do this. There is probably something I'm missing in that aspect since I trust your judgement, I just don't see it atm.
  20. Okay, so I've tried setting an empty NBT tag as soon as the item is created thinking that maybe that was the problem. It's certainly not. I even tried automatically adding a stack on creation using a new Instantiation of InventoryMagnetFilter (specifically I tried InventoryMagnetFilter#setInventorySlotContents) to no avail. This wouldn't make sense though since using the "Whitelisting/Blacklisting" button has nothing to do with the inventory and it has no effect either. It just seems that until it is initialized via right-click, it somehow references a wrong instantiation of the ItemStack. I was thinking client/server sync might be the problem, but since it works after the initial right-click I think that is ruled out. It's like it references a new instance of the itemstack until the item is initialized via right click. After that it references correctly. The item is retrieved via RandomUtils#getMagnet. I should also note that if the keybind is used and the item is held/in InventoryPlayer, it also works fine. RandomUtils#getMagnet first tries to get the held item if it's the magnet and this works. also if there is no magnet in the WCT, but there is one in player's inventory, it works fine as RandomUtils#getMagnet does this check as a final check for returning the magnet ItemStack before giving up and returning null. It only fails to initialize when first inserted into the custom inventory (InventoryMagnet instantiated in ContainerWirelessCraftingTerminal) and the keybind is then used without first having right-clicked with item in-hand.
  21. Well, here's the scenario: I have my Wireless Crafting Terminal mod which is an item that has slots for various things. One of those things is a filterable magnet upgrade, which upon right-click opens a GUI. I also have a keybind performing the same action (opening the GUI), but of course done via packets. The issue is initial saving of NBT data. If I right-click using the item, it "initializes" it. and then I can put items in the filter slots and so forth. At this point everything is great. The keybind functions, NBT data is saved and all is well. However, if I create the magnet item and place it in it's appropriate slot in my Wireless Crafting Terminal without first right-clicking and then try to access the magnet GUI, it does open the magnet GUI, but none of the NBT data is saved when I add items to the filter list or change the mode from whitelisting to blacklisting. This issue is referenced on my GitHub repo @ https://github.com/p455w0rd/WirelessCraftingTerminal/issues/7 Any ideas? Note: 1.7.10 Also, if you just want to install the mod to reproduce what I'm talking about, get it @ http://minecraft.curseforge.com/projects/wireless-crafting-terminal
  22. Introducing the Applied Energistics 2 Wireless Crafting Terminal For clarity's sake: Get v1.1b for AE2 RV2 Stable here: http://minecraft.curseforge.com/projects/wireless-crafting-terminal/files/2297148 Get v1.1b for AE2 RV3 Beta Here: http://minecraft.curseforge.com/projects/wireless-crafting-terminal/files/2297080 Main UI Items Wireless Crafting Terminal A version of the AE2 Wireless Terminal with a 3x3 crafting table integrated Also includes armor slots Trash slot Infinity Booster Card Slot Magnet Card Slot Infinty Booster Card Allows use of the Wireless Crafting Terminal at any range and across dimensions To use, insert into Infinity Booster Card Slot in the Wireless Crafting Terminal GUI Magnet Card A magnet that will automatically insert items directly into your AE network Crouch+Right-Click to activate Right-click to open filter GUI Filter can be set to whitelist or blacklist mode Filter supports the Ore Dictionary Filter Ignores NBT/MetaData (Damage values) Features -Two modes: Easy and Hard (Default) --In hard mode: ---The recipe for the Wireless Crafting Terminal is expensive ---No recipe for Infinity Booster Card, though it is still obtainable. (Up to you to figure out how) --In easy mode: ---The recipe for the Wireless Crafting Terminal is cheap ---Infinity Booster Card has a recipe -Automatic GUI resizing (No more tall/standard modes) -NEI Integration -Keybind Support --Wireless Terminal must be in your inventory Config options (Looking at you Modpack authors =D) -Max Power (AE Units) -Default is same as standard AE Wireless Terminal (1.6M AE) --Min: 800K AE/Max: 6.4M AE -Disable Infinity Booster (Enabled by default) -Enable Easy Mode (Default=false) -No View Cells - I think these are pointless and just clutter the GUI Modpacks: Do what you will, would be cool to know who is using my mod though Source/License: I'm a huge fan of Open Source software as well as helping people learn in general. As far as licensing, do what you want..claim it as your own. I don't care =D If you become popular due to claiming that you made my mod, I'm just glad I could help make another person's life better in some way. Source available on GitHub: https://github.com/p455w0rd/WirelessCraftingTerminal Buy me a coffee? https://www.patreon.com/p455w0rd
  23. THANK YOU SO MUCH! I forgot bout Container#setValidConainter, which is, I assume, what you were thinking..if so, you were correct =D
  24. Jesus mother fucking Christ in a hand basket to Hell this is a complicated network system. lol you can thank AlgorythmX2 I have cleaned the code up quite a bit, tho I still need to do some merging. I'll look into the container. Baffles me that it works perfectly when in-hand. The only refences to the player's hand(getHeldItem) are in RandomUtils#getWirelessTerm, which search the player's inventory for a wireless terminal and returns the first one. The exception is if a player is holding a wireless crafting terminal. That one takes precidence since ppl like Soaryn would make 2 terminals on 2 diff networks just to show a mod is broken . I have removed the code the prefers the held item to test and it makes no difference....Thanks for at least trying tho
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.