Jump to content

Recommended Posts

Posted (edited)

You need to create a new class that extends GuiContainer. Look at the vanilla examples of such.

You will also need one that extends Container (again, look at the vanilla examples).

And a class that implements IGuiHandler

Edited 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.

Posted

You need to mimic what the furnace does (assuming single input + fuel) or what the crafting table does (any number of inputs or outputs greater than 1).

 

I have something similar here:

https://github.com/Draco18s/ReasonableRealism/blob/1.12.1/src/main/java/com/draco18s/ores/recipes/OreProcessingRecipes.java#L35-93

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.

Posted
  On 4/14/2018 at 2:18 AM, Draco18s said:

You need to mimic what the furnace does (assuming single input + fuel) or what the crafting table does (any number of inputs or outputs greater than 1).

 

I have something similar here:

https://github.com/Draco18s/ReasonableRealism/blob/1.12.1/src/main/java/com/draco18s/ores/recipes/OreProcessingRecipes.java#L35-93

Expand  

Thanks for now, I'll see if my noob skills will be able to do it.

Posted (edited)

And how can I implement some code that makes the items inside the Container to go back to the player's inventory, when the container is closed? I can't manage to find any clue in the vanilla classes.

Edited by Arthur Wesley
Posted (edited)
  On 4/14/2018 at 1:15 PM, Arthur Wesley said:

And how can I implement some code that makes the items inside the Container to go back to the player's inventory, when the container is closed? I can't manage to find any clue in the vanilla classes.

Expand  

 

ContainerWorkbench (the Crafting Table's Container) does this in its onContainerClosed method. If you're using IItemHandler for your inventories (which you should be), you'll need to replicate the logic in Container#clearContainer rather than calling it directly.

Edited by Choonster

Please don't PM me to ask for help. Asking your question in a public thread preserves it for people who are having the same problem in the future.

Posted
  On 4/14/2018 at 2:23 PM, Choonster said:

 

ContainerWorkbench (the Crafting Table's Container) does this in its onContainerClosed method. If you're using IItemHandler for your inventories (which you should be), you'll need to replicate the logic in Container#clearContainer rather than calling it directly.

Expand  

Thank you.

Posted

Yay, the slots are worknig. I only need now a recipe system.

 

package tutuicraft3.sapphirecraft.blocks.msinfusortileentity;

import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.inventory.Container;
import net.minecraft.inventory.InventoryCraftResult;
import net.minecraft.inventory.InventoryCrafting;
import net.minecraft.inventory.Slot;
import net.minecraft.inventory.SlotCrafting;
import net.minecraft.item.ItemStack;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;
import net.minecraftforge.items.CapabilityItemHandler;
import net.minecraftforge.items.IItemHandler;

public class MSInfusorContainer extends Container {
	
	public InventoryCrafting craftMatrix = new InventoryCrafting(this, 3, 3);
	public InventoryCraftResult craftResult = new InventoryCraftResult();
	private final World world;
	
	public MSInfusorContainer(InventoryPlayer playerInv, World worldIn, final TileEntityMSInfusor infusor) {
		this.world = worldIn;
		IItemHandler inventory = infusor.getCapability(CapabilityItemHandler.ITEM_HANDLER_CAPABILITY, EnumFacing.NORTH);
        addSlotToContainer(new SlotCrafting(playerInv.player, this.craftMatrix, this.craftResult, 0, 134, 40));
        addSlotToContainer(new Slot(this.craftMatrix, 0, 27, 40));
		addSlotToContainer(new Slot(this.craftMatrix, 1, 76, 40) {
			@Override
			public void onSlotChanged() {
				infusor.markDirty();
			}
		});
	
		
		for (int i = 0; i < 3; i++) {
			for (int j = 0; j < 9; j++) {
				addSlotToContainer(new Slot(playerInv, j + i * 9 + 9, 8 + j * 18, 84 + i * 18));
			}
		}
	
		for (int k = 0; k < 9; k++) {
			addSlotToContainer(new Slot(playerInv, k, 8 + k * 18, 142));
		}
	}
	
	@Override
    public void onContainerClosed(EntityPlayer playerIn)
    {
        super.onContainerClosed(playerIn);

        if (!this.world.isRemote)
        {
            this.clearContainer(playerIn, this.world, this.craftMatrix);
        }
    }

	@Override
	public boolean canInteractWith(EntityPlayer player) {
		return true;
	}
	
	@Override
	public ItemStack transferStackInSlot(EntityPlayer player, int index) {
		ItemStack itemstack = ItemStack.EMPTY;
		Slot slot = inventorySlots.get(index);
	
		if (slot != null && slot.getHasStack()) {
			ItemStack itemstack1 = slot.getStack();
			itemstack = itemstack1.copy();
	
			int containerSlots = inventorySlots.size() - player.inventory.mainInventory.size();
	
			if (index < containerSlots) {
				if (!this.mergeItemStack(itemstack1, containerSlots, inventorySlots.size(), true)) {
					return ItemStack.EMPTY;
				}
			} else if (!this.mergeItemStack(itemstack1, 0, containerSlots, false)) {
				return ItemStack.EMPTY;
			}
	
			if (itemstack1.getCount() == 0) {
				slot.putStack(ItemStack.EMPTY);
			} else {
				slot.onSlotChanged();
			}
	
			if (itemstack1.getCount() == itemstack.getCount()) {
				return ItemStack.EMPTY;
			}
	
			slot.onTake(player, itemstack1);
		}
	
		return itemstack;
	}
}

 

Posted

One little thing, I noticed that my GUI is different from the others in one aspect, it doesn't get it's outer part darker. Normal GUIs have its "focus", making everything around it draker, but mine just opens the GUI and don't get darker, strange because I followed correctly the tutorial, and in there his GUI was darker around.

Posted
  On 4/14/2018 at 10:49 PM, Arthur Wesley said:

One little thing, I noticed that my GUI is different from the others in one aspect, it doesn't get it's outer part darker. Normal GUIs have its "focus", making everything around it draker, but mine just opens the GUI and don't get darker, strange because I followed correctly the tutorial, and in there his GUI was darker around.

Expand  

I've made it. Just had to add drawDefaultBackground(); to my GUI class on drawGuiContainerBackgroundLayer method:

	@Override
	protected void drawGuiContainerBackgroundLayer(float partialTicks, int mouseX, int mouseY) {
		drawDefaultBackground();
		GlStateManager.color(1, 1, 1, 1);
		mc.getTextureManager().bindTexture(BG_TEXTURE);
		int x = (width - xSize) / 2;
		int y = (height - ySize) / 2;
		drawTexturedModalRect(x, y, 0, 0, xSize, ySize);	}

 

Posted

Or you could call super

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.

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.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Announcements



  • Recently Browsing

    • No registered users viewing this page.
  • Posts

    • Unlock incredible savings this August 2025 with the Temu coupon code £100 Off (acv988160). Whether you’re a new or existing customer in the UK or across Europe, the Temu coupon code (acv988160) offers unbeatable discounts, making your shopping experience more rewarding than ever. I’m excited to share how you can maximize your savings using the Temu coupon code (acv988160) and the amazing Temu promo code (acv988160) for August 2025. Temu is widely known for its huge collection of trending items, unbeatable prices, fast delivery, free shipping in 86 countries, and discounts up to 90% off. Using the Temu coupon code (acv988160) not only grants you a flat £100 discount but also unlocks extra savings, coupon bundles, and free gifts. This blog will guide you through all the ways you and I can benefit from this exclusive offer. What Is The Coupon Code For Temu £100 Off? Both new and existing customers can enjoy fantastic benefits by applying our Temu coupon £100 Off code on the Temu app and website. Here’s why the Temu coupon code (acv988160) is your ultimate savings tool: acv988160: Flat £100 Off on any eligible order — instant savings without hassle. acv988160: £100 Off coupon pack allowing multiple uses — save repeatedly. acv988160: £100 Off flat discount designed specifically for new users — start smart. acv988160: Extra £100 Off promo code for existing customers — loyalty pays off. acv988160: £100 Off coupon valid for users across Europe — borders don’t limit your savings. Temu Coupon Code £100 Off For New Users In 2025 If you’re new to Temu, the Temu coupon £100 Off and Temu coupon code £100 Off (acv988160) give you the strongest possible discounts on your first order: acv988160: Immediate flat £100 Off discount for new users at checkout. acv988160: £100 Off coupon bundle exclusively for new customers — multiple savings opportunities. acv988160: Up to £100 Off coupon bundle allowing repeated use on your new account. acv988160: Free shipping in 86 countries including the UK — shop worry-free. acv988160: Extra £100 £100 Off on any purchase for first-time users — a generous welcome. How To Redeem The Temu Coupon £100 Off For New Customers? Redeeming your Temu £100 Off coupon using Temu £100 Off coupon code for new users (acv988160) is straightforward: Download the Temu app or visit temu.com and create your account. Add your favorite products to your shopping cart. During checkout, enter the acv988160 code in the promo code field. See your £100 discount applied instantly. Complete your purchase and enjoy free shipping and massive savings. Temu Coupon £100 Off For Existing Customers Temu generously rewards existing customers too. The Temu £100 Off coupon codes for existing users and Temu coupon £100 Off for existing customers free shipping (acv988160) allow you to keep saving: acv988160: Enjoy extra £100 Off discount for loyal UK customers. acv988160: Access £100 Off coupon bundles available for multiple purchases. acv988160: Receive free gift with fast express shipping all across Europe. acv988160: Take an additional £100 £100 Off on top of current promotions. acv988160: Always benefit from free shipping to 86 countries including the UK. How To Use The Temu Coupon Code £100 Off For Existing Customers? Here's how you can maximize the Temu coupon code £100 Off as an existing user: Log in to your Temu account. Select the items you want to purchase. Enter the acv988160 code at checkout in the promo code box. Confirm the £100 discount and finalize your order. Latest Temu Coupon £100 Off First Order For your first Temu order, the Temu coupon code £100 Off first order, Temu coupon code first order, and Temu coupon code £100 Off first time user (acv988160) provide additional benefits: acv988160: £100 Off your very first purchase. acv988160: Official Temu coupon for first order savings. acv988160: Multi-use £100 Off coupon bundles included. acv988160: Free shipping included on your first order to 86 countries. acv988160: Extra £100 £100 Off on every purchase in your debut transaction. How To Find The Temu Coupon Code £100 Off? Stay updated with the freshest Temu coupon £100 Off and related codes like Temu coupon £100 Off Reddit (acv988160) by: Signing up for Temu’s newsletter for verified and tested coupons. Following Temu’s social media for real-time promo alerts. Bookmarking trusted coupon sites to access working codes anytime. Is Temu £100 Off Coupon Legit? Yes, the Temu £100 Off Coupon Legit and Temu 100 off coupon legit (acv988160) are completely reliable: The acv988160 code is safe for use on both first-time and recurring Temu orders. Regularly tested to ensure it’s working properly. Valid internationally with no expiration date, ready for UK and European users. How Does Temu £100 Off Coupon Work? The Temu coupon code £100 Off first-time user and Temu coupon codes 100 off apply the discount instantly when you enter the acv988160 code at checkout. The system automatically deducts £100 from your order, and this can be combined with other offers on selected items — making your savings stretch even further! How To Earn Temu £100 Off Coupons As A New Customer? Getting the Temu coupon code £100 Off and 100 off Temu coupon code (acv988160) is as simple as signing up, shopping, and entering the coupon code in the payment section. The rewards are immediate and include bundles and gifts for you as a new user. What Are The Advantages Of Using The Temu Coupon £100 Off? Temu coupon code 100 off: Flat £100 Off immediately on your first order. Temu coupon code £100 Off: Coupon bundles for multiple uses. Up to 70% discount on popular, trending products. Extra £100 £100 Off for existing Temu customers. Massive savings up to 90% off on selected items. Free gifts exclusive for new users. Free delivery to 86 countries worldwide. Temu £100 Off Discount Code And Free Gift For New And Existing Customers By using the Temu £100 Off coupon code and £100 Off Temu coupon code (acv988160), you unlock: acv988160: £100 Off discount on your first order. acv988160: Extra £100 £100 Off on any item, anytime. acv988160: Free exclusive gift for new Temu users. acv988160: Discounts up to 70% on any item in the Temu app. acv988160: Gifts with free shipping in 86 countries, including Europe. Pros And Cons Of Using The Temu Coupon Code £100 Off This Month Temu coupon £100 Off code: Instant savings and multiple usages. Temu 100 off coupon: Great for both new and loyal customers. Regular flash deals combined with the coupon code. No shipping fees when using the coupon code. New bundles and updates frequently available. Some exclusions on certain categories. Time-limited offers may expire quickly. Terms And Conditions Of Using The Temu Coupon £100 Off In 2025 Temu coupon code £100 Off free shipping: Shipping is free on qualifying orders. Latest Temu coupon code £100 Off (acv988160): No expiration date—valid whenever you shop. Available for both new and existing users in 86 countries worldwide. No minimum purchase is required to use the coupon. Can be combined with seasonal and app-exclusive promotions. Final Note: Use The Latest Temu Coupon Code £100 Off Make sure you use the Temu coupon code £100 Off (acv988160) this August 2025 for the best discounts, freebies, and fast shipping. The Temu coupon £100 Off (acv988160) is your key to smarter, more affordable shopping across the UK and Europe — start saving now! FAQs Of Temu £100 Off Coupon Can I use the Temu coupon code £100 Off (acv988160) multiple times? Yes, the coupon bundles associated with acv988160 allow multiple uses for ongoing savings. Does Temu coupon code £100 Off (acv988160) work on all products? Almost all items qualify, with few exceptions in specific categories. Does Temu promo code (acv988160) include free shipping? Yes, every order with acv988160 receives free delivery to 86 countries including the UK. Is the Temu £100 Off Coupon Legit (acv988160)? Absolutely, tested rigorously and safe for all customers. Where can I find the latest Temu coupon code (acv988160)? Subscribe to newsletters, follow Temu on social, and use trusted coupon sites for up-to-date acv988160 codes.
    • So after a long break of minecraft I've decided to play but i got this crash when i would start up a world "The game crashed: exception in server tick loopError: net.minecraft.ResourceLocationException: Non [a-z0-9/._-] character in path of location: minecraft:gui/custom/curios/talent_slot - Copie" i moved all texture packs in case that was causing it but it wasn't that   https://pastebin.com/wjKtdMbU
    • 🔻 SERVER IP: 90.146.113.53 Watch the Server-Trailer now!     ArenaSMP is a brand new minecraft survival server combining the vanilla survival experience with the following exciting enhancements: In the PVE Arena, combat skeletons whom will when defeated by the player reward them with money which can be spent to purchase ranks with cool permissions such as disguising as a mob, setting multiple homes, accessing the enderchest by command and many more! To enhance your gameplay there are few tough named skeletons with a minor percent chance to drop highly enchanted tools when defeated! But that isn't all, theres a whole world dedicated to bring you the most exciting minecraft experience you've ever had. The treasurehunt world, a place made of massive scary abandoned mineshafts and underground ruins, is populated by very though skeletons and zombies guarding the most powerful treasures including armor and weapons with unique enchantments that will change the way you progress in survival forever! Some secret places hiding the most powerful treasures are difficult to find, only those who look behind every path and corner where nobody else would look might get the chance becomming an undefeatable GOD. The Enderdragon is yet alive, will you be the one to hunt it down first? Will you become the next GOD in arenasmp? Join now! As a bonus, the first 5 players joining will instantly recive a free rankup! What does ArenaSMP offer exactly? • Vanilla like Survival experience, Nether and End World • Hub with portals to various locations • PVE Arena • Treasurehunt World with many secrets • Powerful Hidden Gear • Ranks to be purchased with ingame-money • Landprotection for all players • Players with any minecraft version can join • Shields are disabled, we use the 1.8 combatsystem including sword blocking • Change your skin with the /skins command • Creepers don't destroy blocks and Phantoms are disabled • Defeated skeletons reward the player with ingame-money • Anticheat enabled • Survival World will never reset • Automatic Daily Server Backups Watch the Server-Trailer now! https://www.youtube.com/watch?v=xl5GfTizasI 🔻 SERVER IP: 90.146.113.53
    • I'm simply trying to start up a forever world with mods, but I don't understand what this crash report means. Can I get someone to diagnose the problem? https://pastebin.com/yRsq3C2A
  • Topics

×
×
  • Create New...

Important Information

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