Jump to content

[1.10]Double Furnace


shane020482

Recommended Posts

Im trying to create a furnace with 2 inputs, 2 outputs, and 1 fuel that will smelt both items at the same time and I cant figure out the update method to get this to work. I can get one slot or the other to smelt but not at the same time. Any help would be greatly appreciated

Heres my Tile

http://pastebin.com/yUScx40u

 

and this is how i have my slots setup

 

this.addSlotToContainer(new Slot(furnaceInventory, 0, 70, 21));

this.addSlotToContainer(new Slot(furnaceInventory, 1, 70, 48));

     

this.addSlotToContainer(new SlotFurnaceFuel(furnaceInventory, 2, 14, 53));

       

this.addSlotToContainer(new SlotFurnaceOutput(playerInventory.player, furnaceInventory, 3, 132, 35));

this.addSlotToContainer(new SlotFurnaceOutput(playerInventory.player, furnaceInventory, 4, 132, 55));

Link to comment
Share on other sites

Your slot setup is irrelevant to making the recipe work.

What is your goal here, are both inputs required (copper ore + tin ore -> bronze)? Or are you making a "double furnace" where you've got two separate inputs that smelt to their respective outputs (iron ore -> iron bars, twice)?

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.

Link to comment
Share on other sites

So, what you'll need to do is check if slot 0 or slot 1 is smeltable, and that the output can go to slot 3 or 4 (respectively).  If either is valid, start burning fuel.

 

You'll also need two timers.

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.

Link to comment
Share on other sites

Thats what i did i have 2 canSmelts and 2 smeltItems one for each input output iv also got 2 cookTimes thats why i think my prob is in my update method

 

public void update() {

        boolean flag = this.isBurning();

        boolean flag1 = false;

 

        if (this.isBurning()) {

            --this.furnaceBurnTime;

        }

 

        if (!this.worldObj.isRemote) {

            if (this.isBurning() || this.furnaceItemStacks[2] != null && this.furnaceItemStacks[1] != null) {

                if (!this.isBurning() && this.canSmelt1()) {

                    this.furnaceBurnTime = getItemBurnTime(this.furnaceItemStacks[2]);

                    this.currentItemBurnTime = this.furnaceBurnTime;

 

                    if (this.isBurning()) {

                        flag1 = true;

 

                        if (this.furnaceItemStacks[2] != null) {

                            --this.furnaceItemStacks[2].stackSize;

 

                            if (this.furnaceItemStacks[2].stackSize == 0) {

                                this.furnaceItemStacks[2] = furnaceItemStacks[2].getItem()

                                        .getContainerItem(furnaceItemStacks[2]);

                            }

                        }

                    }

                }

 

                if (this.isBurning() && this.canSmelt1()) {

                    ++this.cookTime;

 

                    if (this.cookTime == this.totalCookTime) {

                        this.cookTime = 0;

                        this.totalCookTime = this.getCookTime(this.furnaceItemStacks[0]);

                        this.smeltItem2();

                        flag1 = true;

                    }

                } else {

                    this.cookTime = 0;

                }

            }

 

            if (this.isBurning() || this.furnaceItemStacks[2] != null && this.furnaceItemStacks[1] != null) {

                if (!this.isBurning() && this.canSmelt2()) {

                    this.furnaceBurnTime = getItemBurnTime(this.furnaceItemStacks[2]);

                    this.currentItemBurnTime = this.furnaceBurnTime;

 

                    if (this.isBurning()) {

                        flag1 = true;

 

                        if (this.furnaceItemStacks[2] != null) {

                            --this.furnaceItemStacks[2].stackSize;

 

                            if (this.furnaceItemStacks[2].stackSize == 0) {

                                this.furnaceItemStacks[2] = furnaceItemStacks[1].getItem()

                                        .getContainerItem(furnaceItemStacks[2]);

                            }

                        }

                    }

                }

 

                if (this.isBurning() && this.canSmelt2()) {

                    ++this.cookTime2;

 

                    if (this.cookTime2 == this.totalCookTime) {

                        this.cookTime2 = 0;

                        this.totalCookTime = this.getCookTime(this.furnaceItemStacks[1]);

                        this.smeltItem2();

                        flag1 = true;

                    }

                } else {

                    this.cookTime2 = 0;

                }

            }

 

            else if (!this.isBurning() && this.cookTime > 0) {

                this.cookTime = MathHelper.clamp_int(this.cookTime - 2, 0, this.totalCookTime);

            } else if (!this.isBurning() && this.cookTime2 > 0) {

                this.cookTime2 = MathHelper.clamp_int(this.cookTime2 - 2, 0, this.totalCookTime);

            }

 

            if (flag != this.isBurning()) {

                flag1 = true;

                BlockFurnace.setState(this.isBurning(), this.worldObj, this.pos);

            }

        }

 

        if (flag1) {

            this.markDirty();

        }

    }

Link to comment
Share on other sites

You have this check (twice, even):

if (this.isBurning() || this.furnaceItemStacks[2] != null && this.furnaceItemStacks[1] != null)

 

Double check that for yourself and make sure that it's doing what you want.

(Hint: its not)

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.

Link to comment
Share on other sites

Thanks that got me looking a a few things first I didnt set cookTime2 which meant I needed another isBurning to account for cookTime2 because you cant have a || inside of a bool so I redid the update and Im still having no luck

and yes Iv tried merging them into || statements and Iv also changed around the order as well.

This cant be all that hard the  Grey Ghost did it sequentially so there has to be a way to do it in parallel.

https://github.com/TheGreyGhost/MinecraftByExample/tree/1-10-2-inprogress/src/main/java/minecraftbyexample/mbe31_inventory_furnace

 

public void update() {
	boolean flag = this.isBurning1();
	boolean flag1 = this.isBurning2();
	boolean flag2 = false;

	if (this.isBurning1() || this.isBurning2()) {
		--this.furnaceBurnTime;
	}

	if (!this.worldObj.isRemote) {
		if (this.isBurning1() || this.slots[2] != null && this.slots[0] != null) {
			if (!this.isBurning1() && this.canSmeltSlot1()) {
				this.furnaceBurnTime = getItemBurnTime(this.slots[2]);
				this.currentItemBurnTime = this.furnaceBurnTime;

				if (this.isBurning1()) {
					flag2 = true;

					if (this.slots[2] != null) {
						--this.slots[2].stackSize;

						if (this.slots[2].stackSize == 0) {
							this.slots[2] = slots[2].getItem().getContainerItem(slots[2]);
						}
					}
				}
			}

			if (this.isBurning1() && this.canSmeltSlot1()) {
				++this.cookTime1;

				if (this.cookTime1 == this.totalCookTime) {
					this.cookTime1 = 0;
					this.totalCookTime = this.getCookTime(this.slots[0]);
					this.smeltItemSlot2();
					;
					flag2 = true;
				}
			} else {
				this.cookTime1 = 0;
			}
		} else if (!this.isBurning1() && this.cookTime1 > 0) {
			this.cookTime1 = MathHelper.clamp_int(this.cookTime1 - 2, 0, this.totalCookTime);
		}

		if (this.isBurning2() || this.slots[2] != null && this.slots[1] != null) {
			if (!this.isBurning2() && this.canSmeltSlot2()) {
				this.furnaceBurnTime = getItemBurnTime(this.slots[2]);
				this.currentItemBurnTime = this.furnaceBurnTime;

				if (this.isBurning2()) {
					flag2 = true;

					if (this.slots[2] != null) {
						--this.slots[2].stackSize;

						if (this.slots[2].stackSize == 0) {
							this.slots[2] = slots[1].getItem().getContainerItem(slots[2]);
						}
					}
				}
			}

			if (this.isBurning2() && this.canSmeltSlot2()) {
				++this.cookTime2;

				if (this.cookTime2 == this.totalCookTime) {
					this.cookTime2 = 0;
					this.totalCookTime = this.getCookTime(this.slots[1]);
					this.smeltItemSlot2();
					;
					flag2 = true;
				}
			} else {
				this.cookTime2 = 0;
			}
		}

		else if (!this.isBurning2() && this.cookTime2 > 0) {
			this.cookTime2 = MathHelper.clamp_int(this.cookTime2 - 2, 0, this.totalCookTime);
		}

		if (flag1 != this.isBurning1() || this.isBurning2()) {
			flag2 = true;
			BlockFurnace.setState(this.isBurning1(), this.worldObj, this.pos);
		}
	}

	if (flag2) {
		this.markDirty();
	}
}

Link to comment
Share on other sites

2 questions: do you understand and know what each line in your code does? If not, do you at least know Java?

Don't PM me with questions. They will be ignored! Make a thread on the appropriate board for support.

 

1.12 -> 1.13 primer by williewillus.

 

1.7.10 and older versions of Minecraft are no longer supported due to it's age! Update to the latest version for support.

 

http://www.howoldisminecraft1710.today/

Link to comment
Share on other sites

Im no expert but yes to both, but  thats why Im asking for help like I said I have reworked this code every which way I can. The posted codes are by no means all that I have done, and so far i have been able to get ether one slot or the other to smelt but not the other, or both slots smelt together but only if you have items in both input slots, and more but those werent even close. So right now I know Im missing something simple because Iv gotten close I just cant figure out why.

Link to comment
Share on other sites

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

    • I have the problem that when I have flares or blocks to build in my offhand, they seem to be assigned an NBT tag, so I can't stack them with other flares or blocks.  
    • Thank you that was this mod indeed, it tried to spawn a structure at spawn but since It was already generated he was not able to and so crashed the server lol. I was looking for mod during the pregen and added it just before the ram issue, thank you
    • I’m trying to make a mod that lets me put beacon beams through barrels for a mod pack I’m making but I don’t know what code to put and where to make this happen   (Forge 1.20.1)  
    • ---- Minecraft Crash Report ---- // My bad. Time: 2024-07-17 11:17:18 Description: Unexpected error java.lang.NullPointerException: Unexpected error     at com.google.common.collect.Iterators$6.transform(Iterators.java:829)     at com.google.common.collect.TransformedIterator.next(TransformedIterator.java:52)     at net.minecraft.class_2370.remap(class_2370.java:744)     at net.minecraft.class_2370.unmap(class_2370.java:875)     at net.fabricmc.fabric.impl.registry.sync.RegistrySyncManager.unmap(RegistrySyncManager.java:368)     at net.minecraft.class_310.handler$bma000$fabric-registry-sync-v0$disconnectAfter(class_310.java:11691)     at net.minecraft.class_310.method_18096(class_310.java:2269)     at net.minecraft.class_8673.method_10839(class_8673.java:319)     at net.minecraft.class_2535.method_10768(class_2535.java:673)     at net.minecraft.class_636.method_2927(class_636.java:290)     at net.minecraft.class_310.method_1574(class_310.java:1908)     at net.minecraft.class_310.method_1523(class_310.java:1246)     at net.minecraft.class_310.method_1514(class_310.java:882)     at net.minecraft.client.main.Main.main(Main.java:256)     at net.fabricmc.loader.impl.game.minecraft.MinecraftGameProvider.launch(MinecraftGameProvider.java:470)     at net.fabricmc.loader.impl.launch.knot.Knot.launch(Knot.java:74)     at net.fabricmc.loader.impl.launch.knot.KnotClient.main(KnotClient.java:23) A detailed walkthrough of the error, its code path and all known details is as follows: --------------------------------------------------------------------------------------- -- Head -- Thread: Render thread Stacktrace:     at com.google.common.collect.Iterators$6.transform(Iterators.java:829)     at com.google.common.collect.TransformedIterator.next(TransformedIterator.java:52)     at net.minecraft.class_2370.remap(class_2370.java:744)     at net.minecraft.class_2370.unmap(class_2370.java:875)     at net.fabricmc.fabric.impl.registry.sync.RegistrySyncManager.unmap(RegistrySyncManager.java:368)     at net.minecraft.class_310.handler$bma000$fabric-registry-sync-v0$disconnectAfter(class_310.java:11691)     at net.minecraft.class_310.method_18096(class_310.java:2269)     at net.minecraft.class_8673.method_10839(class_8673.java:319)     at net.minecraft.class_2535.method_10768(class_2535.java:673)     at net.minecraft.class_636.method_2927(class_636.java:290) -- Uptime -- Details:     JVM uptime: 111.259s     Wall uptime: 70.335s     High-res time: 44.634s     Client ticks: 508 ticks / 25.400s Stacktrace:     at net.minecraft.class_310.method_1587(class_310.java:2501)     at net.minecraft.class_310.method_54580(class_310.java:949)     at net.minecraft.class_310.method_1514(class_310.java:905)     at net.minecraft.client.main.Main.main(Main.java:256)     at net.fabricmc.loader.impl.game.minecraft.MinecraftGameProvider.launch(MinecraftGameProvider.java:470)     at net.fabricmc.loader.impl.launch.knot.Knot.launch(Knot.java:74)     at net.fabricmc.loader.impl.launch.knot.KnotClient.main(KnotClient.java:23) -- Last reload -- Details:     Reload number: 1     Reload reason: initial     Finished: Yes     Packs: vanilla, fabric, accessories, advanced-xray-fabric, appleskin, armoroftheages, auditory, balm-fabric, beautify, betterf3, betterthirdperson, biolith, bobby, bosses_of_mass_destruction, caffeineconfig, cardinal-components, cardinal-components-base, cardinal-components-block, cardinal-components-chunk, cardinal-components-entity, cardinal-components-item, cardinal-components-level, cardinal-components-scoreboard, cardinal-components-world, carryon, chipped, chunky, cinderscapes, cinderscapes-client, cinderscapes-common, cinderscapes-worldgen, cloth-config, comforts, conditional-mixin, cool_elytra, cratedelight, creativecore, creeperoverhaul, cristellib, croptopia, dramaticdoors, duckling, eatinganimationid, elytratrims, entity_texture_features, epherolib, explorerscompass, fabric-api, fabric-api-base, fabric-api-lookup-api-v1, fabric-biome-api-v1, fabric-block-api-v1, fabric-block-view-api-v2, fabric-blockrenderlayer-v1, fabric-client-tags-api-v1, fabric-command-api-v1, fabric-command-api-v2, fabric-commands-v0, fabric-content-registries-v0, fabric-convention-tags-v1, fabric-convention-tags-v2, fabric-crash-report-info-v1, fabric-data-attachment-api-v1, fabric-data-generation-api-v1, fabric-dimensions-v1, fabric-entity-events-v1, fabric-events-interaction-v0, fabric-game-rule-api-v1, fabric-item-api-v1, fabric-item-group-api-v1, fabric-key-binding-api-v1, fabric-keybindings-v0, fabric-language-kotlin, fabric-lifecycle-events-v1, fabric-loot-api-v2, fabric-loot-api-v3, fabric-message-api-v1, fabric-model-loading-api-v1, fabric-networking-api-v1, fabric-object-builder-api-v1, fabric-particles-v1, fabric-recipe-api-v1, fabric-registry-sync-v0, fabric-renderer-api-v1, fabric-renderer-indigo, fabric-renderer-registries-v1, fabric-rendering-data-attachment-v1, fabric-rendering-fluids-v1, fabric-rendering-v0, fabric-rendering-v1, fabric-resource-conditions-api-v1, fabric-resource-loader-v0, fabric-screen-api-v1, fabric-screen-handler-api-v1, fabric-sound-api-v1, fabric-transfer-api-v1, fabric-transitive-access-wideners-v1, fabricloader, forf, freecam, friendsandfoes, geocluster, glassential, glore, grassoverhaul, horizontal_glass_panes, infinity-cave, iris, jade, jamlib, jankson, libgui, mavapi, mavm, medieval_buildings, mes, midnightlib, mns, more_armor_trims, mostructures, mr_dungeons_andtavernsdeserttempleoverhaul, mr_dungeons_andtavernsendcastlestandalone, mr_dungeons_andtavernsjungletempleoverhaul, mr_dungeons_andtavernsnetherfortressoverhaul, mr_dungeons_andtavernsoceanmonumentoverhaul, mr_dungeons_andtavernswoodlandmansionoverhaul, mss, mvs, natures_spirit, necronomicon, new_slab_variants, nicer-skies, noisium, notenoughanimations, polymer-core, polymer-resource-pack, resourcefulconfig, simple_backpack, sodium, sodium-extra, sound_physics_remastered, spectrelib, status-effect-bars, stendhal, sulfurpotassiummod, terraform-biome-remapper-api-v1, terraform-shapes-api-v1, terraform-surfaces-api-v1, terraform-wood-api-v1, the_bumblezone, time_on_display, toggleableitemframes, toomanypaintings, travelersbackpack, trimeffects, universal-graves, utility_belt, variantbarrels, variantbeehives, variantbookshelves, variantcomposters, variantsandventures, visuality, waterframes, waxablecoral, waystones, xaerominimap, xaeroworldmap, yet_another_config_lib_v3, zoomify, minecraft:supporteatinganimation, file/Stay_True_1.21.zip, file/Better Cats v2.0 1.21.zip, file/Better Horses v2.0 1.21.zip, file/Torrezx-Bad_omen.zip, file/Torrezx-Sculk_power.zip, file/Torrezx-Warden_Power.zip, file/Torrezx-Heavy_core_tools.zip, file/waystones_1.21.zip  
    • Maybe an issue with spawnstructures_forge
  • Topics

×
×
  • Create New...

Important Information

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