Jump to content

jibbity

Members
  • Posts

    35
  • Joined

  • Last visited

Everything posted by jibbity

  1. Thank you very much for the help
  2. gotta hate typo's I will have a look thought http://www.minecraftforge.net/wiki/Packet_Handling i think that's what your getting at. But for now im off to party, Happy new years (even if it's a bit late / early depending on timezones)
  3. I missed that, I must have used add unimplemented method at one point. I think that made some progress, it still flickers however it doesn't require to be clicked for it to be seen.
  4. I have set up the block so that I has multiple textures however, there seems to be a bug were it only displays the correct textures when it's clicked you can see what I mean Does anyone know why this is happening The git hubs Block https://github.com/PandaTeam/HydroBlocks/blob/master/src/hydroblocks/blocks/BatteryBlock.java TileEntity https://github.com/PandaTeam/HydroBlocks/blob/master/src/hydroblocks/blocks/tileentities/TileEntityBattery.java
  5. I cant think of any way to do this is a crafting table, but you could create your own version of the FurnaceRecipes.class and build a custom block to do it for you.
  6. I have updated the code slightly, the main problem I'm having before I address scheduling updates (for now i'm just manually updating the texture my adding and breaking a block next to it), is that in the tool bar the block Icon appears correctly and when it's first placed it the texture changes correctly however it wont change under manual update to the correct texture. I think it may have to do with @Override @SideOnly(Side.CLIENT) public Icon getBlockTexture(IBlockAccess world, int x, int y, int z, int side) { TileEntityBattery battery = (TileEntityBattery)world.getBlockTileEntity(x, y, z); if (battery.isEmpty()) return emptyIcon; if (battery.isCharging()) return chargingIcon; if (battery.isFull()) return fullIcon; return blockIcon; } is there anther way to do this? or is this even correct Block Tile Entity
  7. What Im trying to do is change the texture of a block to have the appearance of a battery charge meter, and that every 10% the block updates the textures to show progress. I have tried to follow Vswe's tutorial however I haven't had much success. Is there something I have missed or im doing wrong? BatteryBlock TileEntityBattery.
  8. Thank you so much I have been looking in vain for a way to do this.
  9. That block ID belongs to forestry, and so far I haven't found an effective way other than using block ID to Idenfity that that block is Copper Ore.
  10. How do I fix the error with the X Y Z variable or make it so it knows that the X Y Z are. package hydroblocks.lib; import java.util.Random; import hydroblocks.items.Items; import net.minecraft.block.Block; import net.minecraft.client.resources.data.MetadataSection; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemStack; import net.minecraft.world.World; import net.minecraftforge.event.ForgeSubscribe; import net.minecraftforge.event.world.BlockEvent; import net.minecraftforge.event.world.BlockEvent.HarvestDropsEvent; public class EventHooks { Random random = new Random(); @ForgeSubscribe public void onHarvestDrops(HarvestDropsEvent event) { int meta = World.getBlockMetaData(x,y,z); // cobble sledgehammer if (event.harvester != null && event.harvester.getHeldItem() != null && event.harvester.getHeldItem().itemID == Items.cobblesledgehammer.itemID) { if (event.block.blockID == 1398 && meta == 2) { event.drops.clear(); event.dropChance = 1.0F; event.drops.add(new ItemStack(Items.copperfragments, random.nextInt(2) + 1)); } }
  11. I want to check for a blocks meta data but im not sure how. Im useing this within the onHarvestDrops(BlockEvent.HarvestDropsEvent event) forge event. if (event.block.blockID == 1398){ //if block meta data == 2 { event.drops.clear(); event.drops.add(new ItemStack(Items.tinfragments, random.nextInt(2) + 1)); event.dropChance = 1.0F;
  12. Are there any videos of setting u gradle, and btw What is gradle and how is it better or worse then current eclipse setup.
  13. Check out these are the most up to date setup and by Pahimar
  14. MrrGingerNinja has a very nice tutorial http://www.minecraftforum.net/topic/1942082-162-minecraft-forge-modding-9d-utility-part-4-creative-tabs/
  15. Oh for poops sake that sneaky mother trucker Thanks for your help Final working code package hydroblocks.lib; import java.util.Random; import hydroblocks.items.Items; import net.minecraft.block.Block; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemStack; import net.minecraftforge.event.ForgeSubscribe; import net.minecraftforge.event.world.BlockEvent; public class EventHooks { Random random; @ForgeSubscribe public void onHarvestDrops(BlockEvent.HarvestDropsEvent event) { random = new Random(); Block block = event.block; EntityPlayer player = event.harvester; if(player!=null) { ItemStack heldItemStack = player.getCurrentEquippedItem(); if(heldItemStack != null && player != null) { int heldItem = heldItemStack.itemID; if(heldItem == Items.ironsledgehammer.itemID) { if(block.blockID == Block.oreIron.blockID) { event.drops.clear(); event.drops.add(new ItemStack(Block.blockGold, random.nextInt(2) + 1)); event.dropChance = 1.0F; } } } } } }
  16. A few more changes, not ever block is dropping gold, however any block broken with ironsledgehammer still drops gold public class EventHooks { @ForgeSubscribe public void onHarvestDrops(BlockEvent.HarvestDropsEvent event) { Block block = event.block; EntityPlayer player = event.harvester; if(player!=null) { ItemStack heldItemStack = player.getCurrentEquippedItem(); if(heldItemStack != null && player != null) { int heldItem = heldItemStack.itemID; if(heldItem == Items.ironsledgehammer.itemID) { if(block.blockID == Block.oreIron.blockID); { event.drops.clear(); event.drops.add(new ItemStack(Block.blockGold, 2)); event.dropChance = 1.0F; } } } } } }
  17. Ok so I know that it is EntityPlayer player = event.harvester; ItemStack heldItem = player.inventory.getCurrentItem(); section, by removing it the error goes away, however now any block that is destroyed will drop gold blocks.
  18. In this case it cant be null, because the block is being broken by an item held by the player.
  19. Im having a bug with the harvest drop event apparently it's this line (line 34) within , can anyone spot what I have done wrong. Crash Report http://pastebin.com/LJihSaRS Git Hub https://github.com/PandaTeam/HydroBlocks/blob/master/src/hydroblocks/lib/EventHooks.java ItemStack heldItem = player.inventory.getCurrentItem(); package hydroblocks.lib; import java.util.Random; import hydroblocks.items.Items; import net.minecraft.block.Block; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemStack; import net.minecraftforge.event.ForgeSubscribe; import net.minecraftforge.event.world.BlockEvent; /** * Name and cast of this class are irrelevant */ public class EventHooks { Random random; /** * The key is the @ForgeSubscribe annotation and the cast of the Event you put in as argument. * The method name you pick does not matter. Method signature is public void, always. */ @ForgeSubscribe public void onHarvestDrops(BlockEvent.HarvestDropsEvent event) { random = new Random(); /* * You can then proceed to read and change the Event's fields where possible */ EntityPlayer player = event.harvester; ItemStack heldItem = player.inventory.getCurrentItem(); Block block = event.block; if(heldItem.itemID == Items.ironsledgehammer.itemID) { if(block.blockID == Block.oreIron.blockID); { event.drops.clear(); event.drops.add(new ItemStack(Block.blockGold, random.nextInt(2) + 1)); event.dropChance = 1.0F; } } } }
  20. Is there a better way of doing this such as over riding the idDropped and quantityDropped of a block? Although what I have works is very convoluted and strange.
  21. I have not been able to get the block break events to work however I used another method. I created a custom recipe handler, I copied the minecraft FurnaceRecipies into a new class and modified it to do want I want, I also used the code from http://www.minecraftforum.net/topic/1964932-pick-that-smelts-ores/ and modified that .
  22. I found the code by MrArcane111, this is the closest that I can find to do I want. How would I now change this code to be effective with the specific tool. I should point out that I don't have much experience with coding and modding. @ForgeSubscribe public void onHarvestBlocks(BlockEvent.HarvestDropsEvent event) { EntityPlayer player = event.harvester; ItemStack heldItem = player.inventory.getCurrentItem(); Block block = event.block; flameTouchAmount = EnchantmentHelper.getEnchantmentLevel(ArcaneEnchantments.flameTouch.effectId, heldItem); if(heldItem == null) { return; } else if(flameTouchAmount > 0) { isFlameTouched = true; } if(isFlameTouched = true) { if(player.worldObj.rand.nextInt(2) == 0) { // So I was going to use FurnaceRecipes, but then I decided against it because this way gives me more flexibility if(block == Block.oreIron) { event.drops.add(new ItemStack(Item.ingotIron, 1)); event.drops.remove(15); } if(block == Block.oreGold) { event.drops.add(new ItemStack(Item.ingotGold, 1)); event.drops.remove(Block.oreGold); } } } }
×
×
  • Create New...

Important Information

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