Jump to content

superckl

Members
  • Posts

    52
  • Joined

  • Last visited

Everything posted by superckl

  1. I knew it was something easy >.< Thanks!
  2. I'm having a very strange problem. I've been banging my head against it for three hours now and gave up. I'm trying to create a custom furnace. I have it so it opens a custom GUI and everything. Everything works perfectly except for one thing. The burn time symbol (the fire) and cook time arrow are never drawn. It's hard to explain, but the GUI sits there like nothing is happening (except it consumes items and produces the result). The furnace itself lights up with beautiful fire and smoke effects. In my research, I found that at any given time there are two TileEntities "in" the furnace. I was quite surprised at this. It appears the first TileEntity that is created is actually doing the work of smelting, and the second is just sitting there. The only problem, my GuiContainer class decides to read data from the second one causing it to think nothing is happening and thus not rendering the smelting progress. I've tried and tried and can't figure out where the second one is coming from or how it even gets into my reference passing. Here is all the relevant information : Furnace Texture: GuiHandler: FishBoneFurnace: FishBoneFurnaceTileEntity: FishBoneFurnaceContainer: FishBoneFurnaceGui: I copied a lot of it from the vanilla files, so I might of messed something up there, but I have no idea. If there is anything missing, just ask and I can provide it.
  3. Yeah, I know that. I was wondering how that would translate through to a NPE.
  4. Okay, thanks for the help. I'll give it a shot.
  5. I don't have a container class. Just a TileEntity that implements IInventory.I just call displayGUIChest whenever someone right clicks the containing block.
  6. Is there an easier way to add your own slots than replacing each slot in EntityPlayer.openContainer? It just seems a bit messy.
  7. Okay, thanks!
  8. So, I have a TileEntity that extends IInventory. I now want to make it so players can only take items out of the inventory and never put them in. How would I go about that?
  9. That was left over from me being a noob about the integrated server thing. That appears to have fixed it. Could you explain why?
  10. Hey everyone, I have a strange problem with my Tile Entities. I recently changed my Fish Mod (yes, it a silly mod I'm making for practice) to use Tile Entities for the fish dirt rather than a tick handler. The only problem is, I get a NPE 5-30 seconds after placing the block: http://paste.minecraftforge.net/view/40bb4ec6 The Entity that throws the NPE on move varies from EntityITem to EntityFallingSand each time. If I make the Tile Entity not shoot out fish, it doesn't cause a crash. I suspect something with bounding boxes but I'm not really sure how to fix it. Here is all the relevant code: FishMod FishGodDirt: ItemFakeFish: TileEntityFishGodDirt: Thanks!
  11. Thanks! I'll try getting it to work when I get home.
  12. Hey everyone, I've been wanting to make a block that slowly gathers an item. Since I'm new, I was wondering if any of you more experienced modders could give me a few tips. Should I implement a TickHandler with a very small chance to collect an item. And how do I keep track of the blocks over a restart?
  13. Never mind, I solved it. It was due to the client-server thing. I forgot to change the method call that sets the metadata to 0 to use the world passed in onBlockActivated... Thanks for the help guys!
  14. Here's my base class: @Mod(modid="FirstMod", name="First Mod", version="1.0") @NetworkMod(clientSideRequired=true) public class FirstMod{ public final ItemStack fishRod = new ItemStack(new FishRod(900)); public final Block fishDirt = new FishDirt(901); @Instance(value = "FirstMod") public static FirstMod instance; public Set<Location> fishDirts = new LocationSet(); @cpw.mods.fml.common.Mod.EventHandler public void preInit(FMLPreInitializationEvent e){ } @cpw.mods.fml.common.Mod.EventHandler public void load(FMLInitializationEvent e){ TickRegistry.registerTickHandler(new PlayerTickListener(), Side.CLIENT); TickRegistry.registerTickHandler(new WorldTickListener(), Side.CLIENT); MinecraftForge.EVENT_BUS.register(new EventHandler()); GameRegistry.registerBlock(this.fishDirt, "FishDirt"); GameRegistry.registerItem(this.fishRod.getItem(), "FishRod"); LanguageRegistry.addName(this.fishRod, "Great Rod of the Fish God"); LanguageRegistry.addName(this.fishDirt, "Great Dirt of the Fish God"); GameRegistry.addRecipe(this.fishRod, " x", " y ", 'x', new ItemStack(Item.fishRaw), 'y', new ItemStack(Item.stick)); GameRegistry.addRecipe(new ItemStack(this.fishDirt), "xxx", "xyx", "xxx", 'x', new ItemStack(Item.fishRaw), 'y', new ItemStack(Block.dirt)); } @cpw.mods.fml.common.Mod.EventHandler public void postInit(FMLPostInitializationEvent e){ } } If you require anything else, just ask. I don't think the Tick or Event handlers are necessary as they don't touch anything with blocks or metadata (except the chunk load one).
  15. Thanks for the reply. I have extended HashSet as a LocationSet, so yes, it's correctly overridden. This still doesn't fix my problem. I do think it has something to do with the client-server thing but I don't know what. I'll post more of my code when I get home.
  16. The metadata is still stuck at 1... I've stared at this for hours now. Does anyway have any ideas?
  17. Well, if you're using eclipse, you can tell eclipse to import it right into your project. Right click where you want it imported and click Import.
  18. Thanks for all your help today Maybe you'll be inspired overnight. I realize that I recreated Vec3, but I prefer the way I made it. It stores ints, not doubles, and doesn't require a static constructor method. I think it comes from the Bukkit programmer in me
  19. @Override public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int par6, float par7, float par8, float par9) { if(world.isRemote){ return true; } Location location = new Location(x, y, z); if(!FirstMod.instance.fishDirts.remove(location)){ FirstMod.instance.fishDirts.add(location); if(world.setBlockMetadataWithNotify(x, y, z, 1, 2)) System.out.println("set to 1"); Minecraft.getMinecraft().theWorld.addWeatherEffect(new EntityLightningBolt(Minecraft.getMinecraft().theWorld, x, y, z)); }else{ if(Minecraft.getMinecraft().theWorld.setBlockMetadataWithNotify(x, y, z, 0, 2)) System.out.println("set to 0"); } return true; } That's my onBlockActivated method. The metadata is now somehow permanently set to 1. The "set to 1" print never happens, but the "set to 0" print happens when I deactivate it, as expected. The Location class is made by me for storing x-y-z triplets, if you were wondering (I'm a Bukkit programmer at heart ).
  20. I'm not entirely sure why, but something happens during obfuscation so that the path to your class has changed (maybe because you have minecraft in the package structure? ) and the ModClassLoader can't find it based on the path it received. I would suggest two things: 1. Remove minecraft from your package structure. 2. Change: @Mod.Instance("com.awesomesauce.minecraft.overhaulcraft.OverhaulCraft") to: @Instance(value = "OverhaulCraft") That way you aren't hard coding the path to your mod Hope that is of some help.
  21. Well, that didn't fix anything but the world.isRemote is true.
  22. Which code? The chunk load or the block activate? And why would that fix it? It would just make the code not activate if I'm not mistaken.
  23. That's an interesting concept, but not the problem. I changed the code so it uses the world passed in onBlockActivated and get the same result.
  24. I'm having a strange problem... When someone right clicks my custom block, I set it's metadata to 1 with: world.setBlockMetadataWithNotify(x, y, z, 1, 2) Where x, y, z, and world are the values passed in onBlockActivated. I have a check in that method so I can make sure the set metadata method returns true, and it does. The problem is, when I close Minecraft and come back, the metadata has reset itself to 0. This is how I am checking the metadata (onChunkLoad): @ForgeSubscribe public void onChunkLoad(ChunkDataEvent.Load e){ for(ExtendedBlockStorage storage:e.getChunk().getBlockStorageArray()) if(storage != null && !storage.isEmpty()) for(int x = 0; x < 16; x++) for(int z = 0; z < 16; z++) for(int y = 0; y < 16; y++) if(storage.getExtBlockID(x, y, z) == FirstMod.instance.fishDirt.blockID){ System.out.println(storage.getExtBlockMetadata(x, y, z)); System.out.println(((e.getChunk().xPosition << 4) + x) +":"+ (storage.getYLocation()+y) +":"+ ((e.getChunk().zPosition << 4) + z)); } } The prints are from me testing if the coordinates matched up to when I set the metadata(they do). The fist print prints 0. I can not figure out why. I'm a fairly adept java programmer (about a year's experience) but I just started this whole forge modding thing, so if I made a stupid mistake somewhere, please correct me (nicely ). And, before you ask, yes I did a Google search and a search on here.
×
×
  • Create New...

Important Information

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