Jump to content

Toastrackenigma

Members
  • Posts

    49
  • Joined

  • Last visited

Converted

  • Gender
    Male
  • Location
    New Zealand
  • Personal Text
    I am new!

Toastrackenigma's Achievements

Tree Puncher

Tree Puncher (2/8)

4

Reputation

  1. If I don't use Minecraft.getMinecraft(), then how do I call displayGuiScreen? Also, I changed InventoryEffectRenderer from GuiContainer, because I was reading through forum posts of people that had had similar issues, and someone said that changing that to that fixed a similar issue. I tried it on mine and it didn't really do... anything. I guess I just forgot to change it back.
  2. Hi everyone! I have been working on making a custom GUI for an item (so that when you shift right-click with the item in hand, the GUI opens), and have run into an issue when trying to render the player's inventory inside. Specifically, the main inventory slots work fine, however the hotbar slots do not work (if you try to pick an item up, it looks like it's about to move then returns to the original state). I have been debugging this problem for a few hours now, and so I have decided to ask you guys for help. Here is my code: magnet.java magnetGui.java magnetGuiContainer.java Thanks
  3. @elix onEntityCollidedWithBlock sounds like exactly what I need! Now to see if it actually will work...
  4. @Abastro I wasn't wanting a right-click to happen anyway, I was just using that method as an example of something similar to what I want to do. To put it in clearer terms, I want the liquid to alter items dropped into it using the Q key - for example, if I drop in four gold the ItemStack changes into one diamond. I was wondering if there was a method similar to onItemRightClick but for detecting if an item was dropped into a liquid (onItemDropped maybe)
  5. Hey, I have my fluid registered and working (it works in a bucket and also shows up in the world), but I want to know how to make it change items that are dropped in it (like PneumaticCraft's etching acid, or the fluix seeds in AE2). I have looked all over the internet and can't find a reference as to how to do something like this anywhere. I would imagine that the fluid could have some sort of function which fires when an item is dropped into it and gives me back the ItemStack to play with, but that sounds too easy I'm thinking along the lines of the public ItemStack onItemRightClick(ItemStack is, World world, EntityPlayer ep) function for items, but I could be completely wrong. Any suggestions? Thanks, -Toastrackenigma
  6. Seriously. I can't believe I missed that. OK, it works now. Thanks for all of your help
  7. I put a system.out.println("Hello World"); in the public void onBucketFill(FillBucketEvent event) { event and when I tried to pick up the liquid nothing was printed, so it's probably not getting called. I have tried changing the order in which I call my statements but it doesn't seem to do anything. Any advice on how to make that handler get called?
  8. I assume that you're using System.out.println("Whatever Text"); - that's the correct way to do it. Have you looked through all of the console? It may be closer to the beginning rather than at the end.
  9. Hey forum, I have been following this tutorial (http://www.minecraftforge.net/wiki/Create_a_Fluid) to create a custom liquid in forge 1.7.10. I have the source "block" which I can place in the world and it flows and works fine. I also have a custom bucket which can place down the liquid and then transforms into a vanilla bucket. The problem is that when I then proceed to right-click the liquid with a vanilla bucket to pick it up, I get a water bucket rather than a bucket of my custom liquid. Here is the code: From the main class (in pre-int method): Block diamondliquidblock = new DiamondLiquidBlock(diamondliquid); GameRegistry.registerBlock(diamondliquidblock, diamondliquidblock.getUnlocalizedName().substring(5)); Item diamondliquidbucket = new DiamondLiquidBucket(diamondliquidblock); GameRegistry.registerItem(diamondliquidbucket, diamondliquidbucket.getUnlocalizedName().substring(5)); FluidContainerRegistry.registerFluidContainer(diamondliquid, new ItemStack(diamondliquidbucket), new ItemStack(Items.bucket)); BucketHandler.INSTANCE.buckets.put(diamondliquidblock, diamondliquidbucket); MinecraftForge.EVENT_BUS.register(BucketHandler.INSTANCE); DiamondLiquidBlock class: package com.toastrackenigma.toastcraft; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; import net.minecraft.block.material.Material; import net.minecraft.client.renderer.texture.IIconRegister; import net.minecraft.util.IIcon; import net.minecraft.world.IBlockAccess; import net.minecraft.world.World; import net.minecraftforge.fluids.BlockFluidClassic; import net.minecraftforge.fluids.Fluid; public class DiamondLiquidBlock extends BlockFluidClassic { @SideOnly(Side.CLIENT) protected IIcon stillIcon; @SideOnly(Side.CLIENT) protected IIcon flowingIcon; public DiamondLiquidBlock(Fluid fluid) { super(fluid,Material.water); this.setCreativeTab(Main.maintab); this.setBlockName("liquiddiamond"); } @Override public IIcon getIcon(int side, int meta) { IIcon result = stillIcon; if (side==1) { result = flowingIcon; } return result; } @SideOnly(Side.CLIENT) @Override public void registerBlockIcons(IIconRegister iir) { stillIcon = iir.registerIcon(Main.MODID + ":" + "diamondflowing"); flowingIcon = iir.registerIcon(Main.MODID + ":" + "diamondstill"); } @Override public boolean canDisplace(IBlockAccess world, int x, int y, int z) { if (world.getBlock(x, y, z).getMaterial().isLiquid()) { return false; } else { return super.canDisplace(world, x, y, z); } } @Override public boolean displaceIfPossible(World world, int x, int y, int z) { if (world.getBlock(x, y, z).getMaterial().isLiquid()) { return false; } else { return super.displaceIfPossible(world, x, y, z); } } } DiamondLiquidBucket Class: package com.toastrackenigma.toastcraft; import net.minecraft.block.Block; import net.minecraft.init.Items; import net.minecraft.item.ItemBucket; public class DiamondLiquidBucket extends ItemBucket{ public DiamondLiquidBucket(Block fluidblock) { super(fluidblock); this.setCreativeTab(Main.maintab); this.setContainerItem(Items.bucket); this.setUnlocalizedName("diamondliquidbucket"); this.setTextureName(Main.MODID + ":" + "diamondliquidbucket"); } } BucketHandler Class: package com.toastrackenigma.toastcraft; import java.util.HashMap; import java.util.Map; import cpw.mods.fml.common.eventhandler.Event.Result; import net.minecraft.block.Block; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.util.MovingObjectPosition; import net.minecraft.world.World; import net.minecraftforge.event.entity.player.FillBucketEvent; public class BucketHandler { public static BucketHandler INSTANCE = new BucketHandler(); public Map<Block, Item> buckets = new HashMap<Block, Item>(); public void onBucketFill(FillBucketEvent event) { ItemStack result = fillBucket(event.world, event.target); if (result == null) { return; } event.result = result; event.setResult(Result.ALLOW); } private ItemStack fillBucket(World world, MovingObjectPosition pos) { Block block = world.getBlock(pos.blockX, pos.blockY, pos.blockZ); Item bucket = buckets.get(block); if (bucket != null && world.getBlockMetadata(pos.blockX, pos.blockY, pos.blockZ) == 0) { world.setBlockToAir(pos.blockX, pos.blockY, pos.blockZ); return new ItemStack(bucket); } else { return null; } } } I at one point tried to change the super(fluid,Material.water); line in DiamondLiquidBlock to super(fluid,Material.lava); and the empty bucket turned into a lava bucket instead, so the bucket that I get is obviously determined by the material that I use. Infact, inside the ItemBucket Class there is and if statement for what is returned (water or lava bucket) based off the material of the liquid: if (material == Material.water && l == 0) { p_77659_2_.setBlockToAir(i, j, k); return this.func_150910_a(p_77659_1_, p_77659_3_, Items.water_bucket); } My question is, how to I override this default functionality and make an empty bucket pick up my liquid rather than water / lava? I have searched the internet and have found some people having a similar problem, but their fixes didn't resolve my issue and most were for 1.6 and 1.5 and not 1.7.10. Please help! -Toastrackenigma
  10. I'm trying to make something a little similar to the way Applied Energistics's Quantum Entangled Singularities work: I want it to be that every time that you perform the crafting recipe the item's damage value goes up one, i.e. GameRegistry.addShapelessRecipe(new ItemStack(Techcraft.magnetHalf, 2, , new Object[] { Techcraft.magnetItem}); Replacing 8 with the damage value. So, the first time you craft this the damage on both of these is 1, then the next time it's 2, etc. Pretty much only two are ever going to have the same damage, so they're a linked pair. I was going to store the damage in the WorldSavedData part
  11. Whenever I'm on a site and the editor buttons don't work it makes me cringe because one of the first projects I did when I learnt how to program was make one that worked properly. It only took me < 1 hour and it never did this to anyone I've sorta fixed the problem myself, I put that code into my item and used onRightClick and it worked (incremented each time I right clicked and when I opened MC again continued where it left off). However, what would I do if I wanted it in my Mod's main class (where I had it initially)? I get that there is no reference to world in there, so how do I give it one? Thanks for all of your help
  12. ****Editor buttons still not working**** markDirty() is being called. Here's the worldsave.newChannel() code: public int newChannel() { markDirty(); return loadstoneChannels++; } I think I've posted the whole worldSave file earlier this post.
  13. ****Insert quote here, none of the editor buttons are working, who knows why?**** I know that, I just wasn't thinking about this worldSave thing the same way for some reason. I now have: worldSave worldsave = worldSave.get(world); int thesave = worldsave.newChannel(); While this counts up from zero every time it's called, when I close the game and reopen it the variable's forgotten, which kindof defeats the whole point.
  14. Yes, durability == max damage. There should be plenty of tutorials about this subject online ([lmgtfy]how to make a pickaxe forge 1.7.10[/lmgtfy])
  15. Thanks for telling me that, I thought the params at the top of a method were what I was giving IT, rather than what IT was giving ME (big difference). Although it worked for my other public boolean canConnectRedstone(IBlockAccess world, int x, int y, int z, int side) method, it didn't work for my actual isProvidingStrongPower block. (While it used to provide power to all 6 sides, it now provides power to none). Here's the code: public int isProvidingStrongPower(IBlockAccess world, int x, int y, int z, int side) { if (side==3) { return 15; } else { return 0; } }
×
×
  • Create New...

Important Information

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