Posted February 16, 20178 yr So this is partially related to this thread I made: But it's a mostly different topic, so yeah. Basically, I want to create a custom furnace that behaves exactly like the vanilla one, except for my custom recipes. I know I need to implement TileEntity, and all the gui stuff, but I have some questions: What is tileentity exactly? What should I extend? TileEntity? TileEntityLockable? How does TileEntity relate to my Block? How do I save the inventory in the TileEntity? How do I properly add the IItemHandler capability to my TileEntity? How do I make the block face different ways? How do I make the texture go from not burning to burning, and have pretty particles? How do I handle timers? How do I figure out what items are fuel, and how long the fuel is supposed to burn? How do I make the GUI have the pretty animations? (Moving arrow, burning fire). Developer of Randores (adds 256^3 ores to the game) and Arcane Bags (adds ridiculous storage with ridiculous crafting recipes). I know Java pretty well... So yeah... Quote This is where I'd put an inspirational and/or clever quote, but I can't think of one right now... This is the output of the totally, 100% working compiler for my programming language, Planet9: Beginning Compilation... Failed compilation! planet9.compiler.error.CompilationException: Compiler not yet implemented at planet9.compiler.Compiler.compile(Compiler.java:39) at planet9.compiler.app.CompilerApp.main(CompilerApp.java:147)
February 16, 20178 yr Quote What is tileentity exactly? What should I extend? TileEntity? A TileEntity is a class that extends (surprise) TileEntity. Quote How does TileEntity relate to my Block? Override hasTileEntity and createTileEntity in your block class. Quote How do I save the inventory in the TileEntity? By using an IItemHandler and writeToNBT on your TileEntity (you'll also need readFromNBT too, surprisingly enough). Quote How do I properly add the IItemHandler capability to my TileEntity? By overriding hasCapability and getCapability on your TileEntity, checking if the reqrequested Capability is CapabilityItemHandler.ITEM_HANDLER_CAPABILITY, and if so, returning the IItemHandler field stored in your TE. Quote How do I make the block face different ways? Same as you would without a TE. Using metadata. Quote How do I make the texture go from not burning to burning, and have pretty particles? Using a boolean in your blockstate, then in your blockstate json file, using a different texture. Particles: look at the vanilla furnace. Quote How do I handle timers? MORE FIELDS, this time one that's an integer that you add (or subtract) from every tick. Look at the vanilla furnace for a field called (curiously) "burnTime" Quote How do I figure out what items are fuel, and how long the fuel is supposed to burn? Look at the vanilla furnace. There's an interface called IFuelHandler that is polled to find out. Quote How do I make the GUI have the pretty animations? (Moving arrow, burning fire). Technically it doesn't animate. It's just a progress bar that's handled by the client saying "the current burn time is 120, the maximum is 600. I should display (120/600) pixels worth of this texture." https://github.com/Draco18s/ReasonableRealism/blob/master/src/main/java/com/draco18s/ores/client/gui/GuiContainerSifter.java#L37-L41 Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable. If you think this is the case, JUST REPORT ME. Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice. Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked. DO NOT PM ME WITH PROBLEMS. No help will be given.
February 16, 20178 yr Author 4 hours ago, Draco18s said: A TileEntity is a class that extends (surprise) TileEntity. Yeah, but what, like is it. Conceptually I mean, what purpose does it serve in the game? Developer of Randores (adds 256^3 ores to the game) and Arcane Bags (adds ridiculous storage with ridiculous crafting recipes). I know Java pretty well... So yeah... Quote This is where I'd put an inspirational and/or clever quote, but I can't think of one right now... This is the output of the totally, 100% working compiler for my programming language, Planet9: Beginning Compilation... Failed compilation! planet9.compiler.error.CompilationException: Compiler not yet implemented at planet9.compiler.Compiler.compile(Compiler.java:39) at planet9.compiler.app.CompilerApp.main(CompilerApp.java:147)
February 16, 20178 yr Author @Draco18s @diesieben07 Should my block extend BlockContainer? I remember seeing somewhere that BlockContainer was evil and to stay away from it... Developer of Randores (adds 256^3 ores to the game) and Arcane Bags (adds ridiculous storage with ridiculous crafting recipes). I know Java pretty well... So yeah... Quote This is where I'd put an inspirational and/or clever quote, but I can't think of one right now... This is the output of the totally, 100% working compiler for my programming language, Planet9: Beginning Compilation... Failed compilation! planet9.compiler.error.CompilationException: Compiler not yet implemented at planet9.compiler.Compiler.compile(Compiler.java:39) at planet9.compiler.app.CompilerApp.main(CompilerApp.java:147)
February 16, 20178 yr No. Do not extend BlockContainer. Edited February 16, 20178 yr by Draco18s Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable. If you think this is the case, JUST REPORT ME. Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice. Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked. DO NOT PM ME WITH PROBLEMS. No help will be given.
February 16, 20178 yr Author 25 minutes ago, Draco18s said: No. Do not extend BlockContainer. Okay. (Also, YAY there is much success, the furnace is block and it can switch on and off and it is orientable and has a nice texture... now for the actual furnace-y part, thanks for all the help!) Developer of Randores (adds 256^3 ores to the game) and Arcane Bags (adds ridiculous storage with ridiculous crafting recipes). I know Java pretty well... So yeah... Quote This is where I'd put an inspirational and/or clever quote, but I can't think of one right now... This is the output of the totally, 100% working compiler for my programming language, Planet9: Beginning Compilation... Failed compilation! planet9.compiler.error.CompilationException: Compiler not yet implemented at planet9.compiler.Compiler.compile(Compiler.java:39) at planet9.compiler.app.CompilerApp.main(CompilerApp.java:147)
February 17, 20178 yr Author 7 hours ago, Draco18s said: A TileEntity is a class that extends (surprise) TileEntity. Does the TileEntity implement inventory or container, or should that be a seperate class store in the tile entity as a field? Edit: and what interfaces should the TileEntity implement (if any)? Edited February 17, 20178 yr by Socratic_Phoenix Developer of Randores (adds 256^3 ores to the game) and Arcane Bags (adds ridiculous storage with ridiculous crafting recipes). I know Java pretty well... So yeah... Quote This is where I'd put an inspirational and/or clever quote, but I can't think of one right now... This is the output of the totally, 100% working compiler for my programming language, Planet9: Beginning Compilation... Failed compilation! planet9.compiler.error.CompilationException: Compiler not yet implemented at planet9.compiler.Compiler.compile(Compiler.java:39) at planet9.compiler.app.CompilerApp.main(CompilerApp.java:147)
February 17, 20178 yr 16 minutes ago, Socratic_Phoenix said: Does the TileEntity implement inventory or container, or should that be a seperate class store in the tile entity as a field? Edit: and what interfaces should the TileEntity implement (if any)? The TileEntity should only implement ITickable (not the client/sound one). And do not use IInventory on TEs, for the Container use SlotItemHandler instead of Slot. VANILLA MINECRAFT CLASSES ARE THE BEST RESOURCES WHEN MODDING I will be posting 1.15.2 modding tutorials on this channel. If you want to be notified of it do the normal YouTube stuff like subscribing, ect. Forge and vanilla BlockState generator.
February 17, 20178 yr Author 1 hour ago, diesieben07 said: Not always. Only if you need tick updates. I assume a furnace needs tick updates though.... that's what I was referring to Developer of Randores (adds 256^3 ores to the game) and Arcane Bags (adds ridiculous storage with ridiculous crafting recipes). I know Java pretty well... So yeah... Quote This is where I'd put an inspirational and/or clever quote, but I can't think of one right now... This is the output of the totally, 100% working compiler for my programming language, Planet9: Beginning Compilation... Failed compilation! planet9.compiler.error.CompilationException: Compiler not yet implemented at planet9.compiler.Compiler.compile(Compiler.java:39) at planet9.compiler.app.CompilerApp.main(CompilerApp.java:147)
February 17, 20178 yr Author Thanks to everyone for all their help! The furnace works perfectly! (Even with hoppers! It's like magic!) Developer of Randores (adds 256^3 ores to the game) and Arcane Bags (adds ridiculous storage with ridiculous crafting recipes). I know Java pretty well... So yeah... Quote This is where I'd put an inspirational and/or clever quote, but I can't think of one right now... This is the output of the totally, 100% working compiler for my programming language, Planet9: Beginning Compilation... Failed compilation! planet9.compiler.error.CompilationException: Compiler not yet implemented at planet9.compiler.Compiler.compile(Compiler.java:39) at planet9.compiler.app.CompilerApp.main(CompilerApp.java:147)
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.