Jump to content

[1.14.4] how to make a gui progress bar?


Kenneth201998

Recommended Posts

As I've started on a number of occasions:

Nothing prevents you from performing the cooking operation on the client, provided you synchronize the test of the data when appropriate. 

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

2 hours ago, Kenneth201998 said:

the arrow and flame

Instead of drawing a whole arrow/flame, draw (progress / total) of the arrow/flame. You can still use the same textured-rectangle-drawing method you always use. You can always look in some source classes to get a better idea of what you're doing, too.

Fancy 3D Graphing Calculator mod, with many different coordinate systems.

Lightweight 3D/2D position/vector transformations library, also with support for different coordinate systems.

Link to comment
Share on other sites

5 hours ago, Kenneth201998 said:

Im talking about the arrow and flame you see in the furnace gui... 

Wow, what a surprise.

So am I.

See this line here? Notice that this executes even when isRemote is true? That's because the client utilizes the same logic the server uses to update the smelting arrow.

https://github.com/Draco18s/ReasonableRealism/blob/1.14.4/src/main/java/com/draco18s/harderores/client/gui/SifterGuiContainer.java#L46

https://github.com/Draco18s/ReasonableRealism/blob/1.14.4/src/main/java/com/draco18s/harderores/entity/SifterTileEntity.java#L182

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.

Link to comment
Share on other sites

10 hours ago, Draco18s said:

Wow, what a surprise.

So am I.

See this line here? Notice that this executes even when isRemote is true? That's because the client utilizes the same logic the server uses to update the smelting arrow.

https://github.com/Draco18s/ReasonableRealism/blob/1.14.4/src/main/java/com/draco18s/harderores/client/gui/SifterGuiContainer.java#L46

https://github.com/Draco18s/ReasonableRealism/blob/1.14.4/src/main/java/com/draco18s/harderores/entity/SifterTileEntity.java#L182

where does the 40 come from in you blit function?

Link to comment
Share on other sites

Can you help me with this? I am not sure where you are getting your numbers in you blit function from but I can give you the GUI I created so you can help me get those numbers:

smelting_furnace_gui_1.png

There is a free program:

https://pixlr.com/editor/

It allows you to see the coordinates of each pixel by hovering over the image.

 

Edited by Kenneth201998
Link to comment
Share on other sites

2 hours ago, Kenneth201998 said:

where does the 40 come from in you blit function?

That happens to be the maximum time:

https://github.com/Draco18s/ReasonableRealism/blob/1.14.4/src/main/java/com/draco18s/harderores/entity/SifterTileEntity.java#L90

Timer gets set to 40 and it counts down (values like this one being more as "abort, wait for valid inputs")

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

Ok so I have:

package com.kenneths_medieval_mod.objects.blocks.workstations.smelting_forge;

import org.lwjgl.opengl.GL11;

import com.kenneths_medieval_mod.KenmodMain;

import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.screen.inventory.ContainerScreen;
import net.minecraft.entity.player.PlayerInventory;
import net.minecraft.util.ResourceLocation;
import net.minecraft.util.text.ITextComponent;

public class SmeltingForgeGUI extends ContainerScreen<SmeltingForgeContainer> {
	
	SmeltingForgeTileEntity tile_entity;
	
	private static final ResourceLocation texture = new ResourceLocation("kenmod:textures/gui/smelting_forge_gui_1.png");
	
	public SmeltingForgeGUI(SmeltingForgeContainer screenContainer, PlayerInventory inv, ITextComponent titleIn) {
		super(screenContainer, inv, titleIn);
		this.xSize = 176;
		this.ySize = 166;
		this.tile_entity = (SmeltingForgeTileEntity)screenContainer.tile_entity;
	}
	@Override
	public void render(int mouseX, int mouseY, float partialTicks) {
		this.renderBackground();
		super.render(mouseX, mouseY, partialTicks);
		this.renderHoveredToolTip(mouseX, mouseY);
	}
	@Override
	protected void drawGuiContainerBackgroundLayer(float partialTicks, int mouseX, int mouseY) {
		GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
		Minecraft.getInstance().getTextureManager().bindTexture(texture);
		int k = (this.width - this.xSize) / 2;
		int l = (this.height - this.ySize) / 2;
		this.blit(k, l, 0, 0, this.xSize, this.ySize);
		
		if(tile_entity != null) {
			//int burn_time = Math.round(24 * (100 - tile_entity.getBurnTime()) / 100);
			int cook_progress = Math.round(24 / tile_entity.getCookProgress());
			int le = this.guiLeft;
			int to = this.guiTop;
			
			//this.blit(le + 17, to + 40, 176, 14, burn_time + 1, 16);
			this.blit(le + 67, to + 39, 176, 14, cook_progress + 1, 16);
		}
	}
	@Override
	public void tick() {
		super.tick();
	}
	@Override
	protected void drawGuiContainerForegroundLayer(int mouseX, int mouseY) {
		this.font.drawString("Smelting Forge", 16, 5, -1);
	}
	@Override
	public void removed() {
		super.removed();
		Minecraft.getInstance().keyboardListener.enableRepeatEvents(false);
	}
	@Override
	public void init(Minecraft minecraft, int width, int height) {
		super.init(minecraft, width, height);
		minecraft.keyboardListener.enableRepeatEvents(true);
	}
}

And:

package com.kenneths_medieval_mod.objects.blocks.workstations.smelting_forge;

import com.kenneths_medieval_mod.objects.blocks.BlockList;

import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.entity.player.PlayerInventory;
import net.minecraft.entity.player.ServerPlayerEntity;
import net.minecraft.inventory.container.Container;
import net.minecraft.inventory.container.INamedContainerProvider;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.CompoundNBT;
import net.minecraft.tileentity.ITickableTileEntity;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.Direction;
import net.minecraft.util.text.ITextComponent;
import net.minecraft.util.text.StringTextComponent;
import net.minecraftforge.common.capabilities.Capability;
import net.minecraftforge.common.util.LazyOptional;
import net.minecraftforge.fml.network.NetworkHooks;
import net.minecraftforge.items.CapabilityItemHandler;
import net.minecraftforge.items.IItemHandler;
import net.minecraftforge.items.ItemStackHandler;

public class SmeltingForgeTileEntity extends TileEntity implements ITickableTileEntity, INamedContainerProvider {
	
	protected ItemStackHandler slots = new ItemStackHandler();
	private final LazyOptional<IItemHandler> slots_holder = LazyOptional.of(() -> slots);
	private int burn_time;
	private int cook_progress;
	private int cook_goal = 200;
	
	public SmeltingForgeTileEntity() {
		super(BlockList.smelting_forge_tile_entity);
		slots = new ItemStackHandler();
		slots.setSize(4);
	}
	
	@Override
	public void tick() {
		//Fuel sent to the furnace has a max fuel life.
		if(burn_time < 1000 && slots.getStackInSlot(0) != ItemStack.EMPTY) {
			burn_time++;
			if(cook_progress < cook_goal) {
				cook_progress++;
			} else {
				cook_progress = 0;
			}
		} else {
			//When burn time reaches max fuel life get more fuel and reset the burn timer:
			burn_time = 0;
		}
	}
	
	public float getCookProgress () {
		return Math.round(cook_progress + 1 / cook_goal);
	}
	public int getBurnTime () {
		return burn_time;
	}
	
	@Override
	public void read(CompoundNBT tag) {
		super.read(tag);
		slots.deserializeNBT(tag.getCompound("kenmod:slots"));
		burn_time = tag.getInt("kenmod:burn_time");
		cook_progress = tag.getInt("kenmod:cook_progress");
	}
	@Override
	public CompoundNBT write(CompoundNBT tag) {
		super.write(tag);
		tag.put("kenmodlcb:slots", slots.serializeNBT());
		tag.putInt("kenmod:burn_time", burn_time);
		tag.putInt("kenmod:cook_progress", cook_progress);
		return tag;
	}
	@Override
	public <T> LazyOptional<T> getCapability(Capability<T> cap, Direction side) {
		if(cap == CapabilityItemHandler.ITEM_HANDLER_CAPABILITY) {
			return slots_holder.cast();
		}
		return super.getCapability(cap, side);
	}
	@Override
	public Container createMenu(int id, PlayerInventory player_inventory, PlayerEntity player) {
		return new SmeltingForgeContainer(id, player_inventory, slots, this);
	}
	@Override
	public ITextComponent getDisplayName() {
		return new StringTextComponent("block.kenmodlcb.furnace_station");
	}
	
	public void openGUI (ServerPlayerEntity player) {
		if(!world.isRemote) {
			NetworkHooks.openGui(player, this, getPos());
		}
	}
}

But the arrow does not update. Whats wrong?

Link to comment
Share on other sites

You need to synchronize the data to the client. 

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

Just to note, for simple data like an integer progress value, you can take advantage of the vanilla Container#trackInt() method to automatically sync values from server to client while the container is open.  The vanilla furnace uses it, and McJty has a tutorial about it here: https://wiki.mcjty.eu/modding/index.php?title=Tut14_Ep5 ("Showing Energy in GUI").

 

But beware - despite the method's name, it will only sync up to 16 bits of data - see SWindowPropertyPacket.  Shouldn't be a problem in this case, however.

  • Thanks 1
Link to comment
Share on other sites

I wonder if there are some methods in the tile entity class regarding update packets.

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

huh... this is odd:

when I use:

public float getCookProgress () {
	float test0 = cook_progress;
	KenmodMain.debugString("test0: " + test0);
	float test1 = cook_goal;
	KenmodMain.debugString("test1: " + test1);
	float test2 = ((float)cook_progress + 1.0F) / (float)cook_goal;
	KenmodMain.debugString("Get cook progress: " + test2);
	return test2;
}

the arrow updates, but only when I save and quit, and rejoin the world.

18 minutes ago, Draco18s said:

I wonder if there are some methods in the tile entity class regarding update packets.

package com.kenneths_medieval_mod.objects.blocks.workstations.smelting_forge;

import com.kenneths_medieval_mod.KenmodMain;
import com.kenneths_medieval_mod.objects.blocks.BlockList;

import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.entity.player.PlayerInventory;
import net.minecraft.entity.player.ServerPlayerEntity;
import net.minecraft.inventory.container.Container;
import net.minecraft.inventory.container.INamedContainerProvider;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.CompoundNBT;
import net.minecraft.network.NetworkManager;
import net.minecraft.network.play.server.SUpdateTileEntityPacket;
import net.minecraft.tileentity.ITickableTileEntity;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.Direction;
import net.minecraft.util.text.ITextComponent;
import net.minecraft.util.text.StringTextComponent;
import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.api.distmarker.OnlyIn;
import net.minecraftforge.common.capabilities.Capability;
import net.minecraftforge.common.util.LazyOptional;
import net.minecraftforge.fml.network.NetworkHooks;
import net.minecraftforge.items.CapabilityItemHandler;
import net.minecraftforge.items.IItemHandler;
import net.minecraftforge.items.ItemStackHandler;

public class SmeltingForgeTileEntity extends TileEntity implements ITickableTileEntity, INamedContainerProvider {
	
	protected ItemStackHandler slots = new ItemStackHandler();
	private final LazyOptional<IItemHandler> slots_holder = LazyOptional.of(() -> slots);
	private int burn_time;
	private int cook_progress;
	private int cook_goal = 200;
	
	public SmeltingForgeTileEntity() {
		super(BlockList.smelting_forge_tile_entity);
		slots = new ItemStackHandler();
		slots.setSize(4);
	}
	
	@Override
	public void tick() {
		//Fuel sent to the furnace has a max fuel life.
		if(burn_time < 1000 && slots.getStackInSlot(0) != ItemStack.EMPTY) {
			burn_time++;
			
			cook_progress++;
			KenmodMain.debugString("cp: " + cook_progress);
			if(cook_progress >= cook_goal) {
				cook_progress = 0;
			}
		} else {
			//When burn time reaches max fuel life get more fuel and reset the burn timer:
			burn_time = 0;
		}
		markDirty();
	}
	
	public float getCookProgress () {
		float test0 = cook_progress;
		KenmodMain.debugString("test0: " + test0);
		float test1 = cook_goal;
		KenmodMain.debugString("test1: " + test1);
		float test2 = ((float)cook_progress + 1.0F) / (float)cook_goal;
		KenmodMain.debugString("Get cook progress: " + test2);
		return test2;
	}
	public int getBurnTime () {
		return burn_time;
	}
	
	@Override
	public SUpdateTileEntityPacket getUpdatePacket() {
		return new SUpdateTileEntityPacket(this.pos, 0, this.getUpdateTag());
	}
	@Override
	public CompoundNBT getUpdateTag() {
		return this.write(new CompoundNBT());
	}
	@Override
	public void onDataPacket(NetworkManager net, SUpdateTileEntityPacket pkt) {
		read(pkt.getNbtCompound());
	}
	
	@Override
	public void read(CompoundNBT tag) {
		super.read(tag);
		slots.deserializeNBT(tag.getCompound("kenmod:slots"));
		burn_time = tag.getInt("kenmod:burn_time");
		cook_progress = tag.getInt("kenmod:cook_progress");
	}
	@Override
	public CompoundNBT write(CompoundNBT tag) {
		super.write(tag);
		tag.put("kenmod:slots", slots.serializeNBT());
		tag.putInt("kenmod:burn_time", burn_time);
		tag.putInt("kenmod:cook_progress", cook_progress);
		return tag;
	}
	@Override
	public <T> LazyOptional<T> getCapability(Capability<T> cap, Direction side) {
		if(cap == CapabilityItemHandler.ITEM_HANDLER_CAPABILITY) {
			return slots_holder.cast();
		}
		return super.getCapability(cap, side);
	}
	@Override
	public Container createMenu(int id, PlayerInventory player_inventory, PlayerEntity player) {
		return new SmeltingForgeContainer(id, player_inventory, slots, this);
	}
	@Override
	public ITextComponent getDisplayName() {
		return new StringTextComponent("block.kenmodlcb.furnace_station");
	}
	
	public void openGUI (ServerPlayerEntity player) {
		if(!world.isRemote) {
			NetworkHooks.openGui(player, this, getPos());
		}
	}
}

 

Link to comment
Share on other sites

43 minutes ago, Kenneth201998 said:

but only when I save and quit, and rejoin the world.

Because tile entity data is only "automatically" "synchronized" upon loading the world (quotes, because the way it works isn't really automatic and isn't really synchronizing, its just that certain vanilla calls regarding loading the TE from disk in single player has this net result).

 

44 minutes ago, Kenneth201998 said:

markDirty();

Don't do this every tick. Your burn time only really needs to be synchronized when the item slots change because your TE is already ticking the burn time on the client.

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

13 hours ago, Kenneth201998 said:

This thing of getting the progress bar to update still eludes me. Know any example code? 

I will refer you to my previous comment in this thread.  Go and look up McJty's tutorial that I linked (although it's for syncing an energy value, the same principle of syncing an int value applies).  And also take a look at the vanilla furnace code, which uses that tracked int system.

Link to comment
Share on other sites

Ok. So I created my own capability known as Progress:

package com.kenneth.hard_survival_craft.objects.custom_capabilities;

public interface IProgress {
	void incrementProgress (int ammount);
	int getProgress ();
	void setProgress (int ammount);
}
package com.kenneth.hard_survival_craft.objects.custom_capabilities;

import net.minecraft.nbt.CompoundNBT;
import net.minecraftforge.common.util.INBTSerializable;

public class Progress implements IProgress, INBTSerializable<CompoundNBT> {
	
	protected int progress;
	
	public Progress(int progress) {
		this.progress = progress;
	}
	
	@Override
	public void incrementProgress(int ammount) {
		this.progress += ammount;
	}

	@Override
	public int getProgress() {
		return progress;
	}

	@Override
	public void setProgress(int ammount) {
		this.progress = ammount;
	}

	@Override
	public CompoundNBT serializeNBT() {
		CompoundNBT tag = new CompoundNBT();
		tag.putInt("progress", getProgress());
		return tag;
	}

	@Override
	public void deserializeNBT(CompoundNBT nbt) {
		setProgress(nbt.getInt("progress"));
	}
}
package com.kenneth.hard_survival_craft.objects.custom_capabilities;

import net.minecraft.nbt.INBT;
import net.minecraft.nbt.IntNBT;
import net.minecraft.util.Direction;
import net.minecraftforge.common.capabilities.Capability;
import net.minecraftforge.common.capabilities.CapabilityInject;
import net.minecraftforge.common.capabilities.CapabilityManager;

public class CapabilityProgress {
	
	@CapabilityInject(IProgress.class)
	public static Capability<IProgress> PROGRESS = null;
	
	public static void register () {
		CapabilityManager.INSTANCE.register(IProgress.class, new Capability.IStorage<IProgress> () {
			@Override
			public INBT writeNBT(Capability<IProgress> capability, IProgress instance, Direction side) {
				return new IntNBT(instance.getProgress());
			}
			@Override
			public void readNBT(Capability<IProgress> capability, IProgress instance, Direction side, INBT nbt) {
				if(!(instance instanceof Progress)) {
					throw new IllegalArgumentException("Can not deserialize to an instance that isn't the default implementation");
				}
				((Progress)instance).progress = ((IntNBT)nbt).getInt();
			}
			
		}, () -> new Progress(0));
	}
	
}

Then I added it to my tile entity as so:

package com.kenneth.hard_survival_craft.objects.blocks.workstations.smelting_forge;

import com.kenneth.hard_survival_craft.KenmodMain;
import com.kenneth.hard_survival_craft.objects.blocks.BlockList;
import com.kenneth.hard_survival_craft.objects.custom_capabilities.CapabilityProgress;
import com.kenneth.hard_survival_craft.objects.custom_capabilities.IProgress;
import com.kenneth.hard_survival_craft.objects.custom_capabilities.Progress;

import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.entity.player.PlayerInventory;
import net.minecraft.entity.player.ServerPlayerEntity;
import net.minecraft.inventory.container.Container;
import net.minecraft.inventory.container.INamedContainerProvider;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.CompoundNBT;
import net.minecraft.network.NetworkManager;
import net.minecraft.network.play.server.SUpdateTileEntityPacket;
import net.minecraft.tileentity.ITickableTileEntity;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.Direction;
import net.minecraft.util.text.ITextComponent;
import net.minecraft.util.text.StringTextComponent;
import net.minecraftforge.common.capabilities.Capability;
import net.minecraftforge.common.util.INBTSerializable;
import net.minecraftforge.common.util.LazyOptional;
import net.minecraftforge.fml.network.NetworkHooks;
import net.minecraftforge.items.CapabilityItemHandler;
import net.minecraftforge.items.IItemHandler;
import net.minecraftforge.items.ItemStackHandler;

public class SmeltingForgeTileEntity extends TileEntity implements ITickableTileEntity, INamedContainerProvider {
	
	protected ItemStackHandler slots = new ItemStackHandler();
	private LazyOptional<IItemHandler> slots_holder = LazyOptional.of(() -> slots);
	private LazyOptional<IProgress> progress = LazyOptional.of(this::createProgress);
	
	private int burn_time;
	private int cook_progress;
	private int cook_goal = 200;
	
	public SmeltingForgeTileEntity() {
		super(BlockList.smelting_forge_tile_entity);
		slots = new ItemStackHandler();
		slots.setSize(4);
	}

	@Override
	public void tick() {
		//Fuel sent to the furnace has a max fuel life.
		if(burn_time < 1000 && slots.getStackInSlot(0) != ItemStack.EMPTY) {
			burn_time++;
			
			cook_progress++;
			getCookProgress();
			if(cook_progress >= cook_goal) {
				cook_progress = 0;
			}
		} else {
			//When burn time reaches max fuel life get more fuel and reset the burn timer:
			burn_time = 0;
		}
		markDirty();
	}
	
	public int getCookProgress() {
		int prog = this.getCapability(CapabilityProgress.PROGRESS).map(IProgress::getProgress).orElse(0) + 1;
		KenmodMain.debugString("Progress: " + prog);
		return prog;
	}
	public int getCookGoal () {
		KenmodMain.debugString("Cook Goal: " + cook_goal);
		return cook_goal;
	}
	
	private IProgress createProgress () {
		return new Progress(0);
	}
	
	@Override
	public SUpdateTileEntityPacket getUpdatePacket() {
		return new SUpdateTileEntityPacket(this.pos, 0, this.getUpdateTag());
	}
	@Override
	public CompoundNBT getUpdateTag() {
		return this.write(new CompoundNBT());
	}
	@Override
	public void onDataPacket(NetworkManager net, SUpdateTileEntityPacket pkt) {
		read(pkt.getNbtCompound());
	}
	
	@SuppressWarnings("unchecked")
	@Override
	public void read(CompoundNBT tag) {
		slots.deserializeNBT(tag.getCompound("slots"));
		CompoundNBT progressTag = tag.getCompound("progress");
		progress.ifPresent(h -> ((INBTSerializable<CompoundNBT>)h).deserializeNBT(progressTag));
		super.read(tag);
	}
	@SuppressWarnings("unchecked")
	@Override
	public CompoundNBT write(CompoundNBT tag) {
		tag.put("slots", slots.serializeNBT());
		progress.ifPresent(h -> {
			CompoundNBT compound = ((INBTSerializable<CompoundNBT>)h).serializeNBT();
			tag.put("progress", compound);
		});
		return super.write(tag);
	}
	@Override
	public <T> LazyOptional<T> getCapability(Capability<T> cap, Direction side) {
		if(cap == CapabilityItemHandler.ITEM_HANDLER_CAPABILITY) {
			return slots_holder.cast();
		}
		if(cap == CapabilityProgress.PROGRESS) {
			return progress.cast();
		}
		return super.getCapability(cap, side);
	}
	@Override
	public Container createMenu(int id, PlayerInventory player_inventory, PlayerEntity player) {
		return new SmeltingForgeContainer(id, player_inventory, slots, this);
	}
	@Override
	public ITextComponent getDisplayName() {
		return new StringTextComponent("block.kenmodlcb.furnace_station");
	}
	
	public void openGUI (ServerPlayerEntity player) {
		if(!world.isRemote) {
			NetworkHooks.openGui(player, this, getPos());
		}
	}
}

And to the container:

package com.kenneth.hard_survival_craft.objects.blocks.workstations.smelting_forge;

import com.kenneth.hard_survival_craft.objects.blocks.BlockList;
import com.kenneth.hard_survival_craft.objects.custom_capabilities.CapabilityProgress;
import com.kenneth.hard_survival_craft.objects.custom_capabilities.IProgress;
import com.kenneth.hard_survival_craft.objects.custom_capabilities.Progress;

import net.minecraft.client.Minecraft;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.entity.player.PlayerInventory;
import net.minecraft.inventory.container.Container;
import net.minecraft.inventory.container.Slot;
import net.minecraft.item.ItemStack;
import net.minecraft.network.PacketBuffer;
import net.minecraft.util.IntReferenceHolder;
import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.api.distmarker.OnlyIn;
import net.minecraftforge.items.IItemHandler;
import net.minecraftforge.items.ItemStackHandler;
import net.minecraftforge.items.SlotItemHandler;

public class SmeltingForgeContainer extends Container {
	
	SmeltingForgeTileEntity tile_entity;
	
	@OnlyIn(Dist.CLIENT)
	public SmeltingForgeContainer (int id, PlayerInventory player_inventory, PacketBuffer extra_data) {
		this(id, player_inventory, new ItemStackHandler(4), (SmeltingForgeTileEntity)Minecraft.getInstance().world.getTileEntity(extra_data.readBlockPos()));
	}
	public SmeltingForgeContainer(int id, PlayerInventory player_inventory, IItemHandler smelting_forge_inventory, SmeltingForgeTileEntity te) {
		super(BlockList.smelting_forge_container, id);
		this.addSlot(new SlotItemHandler(smelting_forge_inventory, 0, 17, 21));
		this.addSlot(new SlotItemHandler(smelting_forge_inventory, 1, 44, 21));
		this.addSlot(new SlotItemHandler(smelting_forge_inventory, 2, 17, 57));
		this.addSlot(new SlotItemHandler(smelting_forge_inventory, 3, 98, 39) {
			@Override
			public boolean isItemValid(ItemStack stack) {
				return false;
			}
		});
		int si;
		int sj;
		for (si = 0; si < 3; ++si) {
			for (sj = 0; sj < 9; ++sj) {
				this.addSlot(new Slot(player_inventory, sj + (si + 1) * 9, 0 + 8 + sj * 18, 0 + 84 + si * 18));
			}
		}
		for (si = 0; si < 9; ++si) {
			this.addSlot(new Slot(player_inventory, si, 0 + 8 + si * 18, 0 + 142));
		}
		this.tile_entity = te;
		trackInt(new IntReferenceHolder() {
			@Override
			public void set(int value) {
				tile_entity.getCapability(CapabilityProgress.PROGRESS).ifPresent(h -> ((Progress)h).setProgress(value));
			}
			@Override
			public int get() {
				return getProgress();
			}
		});
	}
	@Override
	public ItemStack transferStackInSlot(PlayerEntity playerIn, int index) {
		ItemStack itemstack = ItemStack.EMPTY;
		Slot slot = (Slot) this.inventorySlots.get(index);
		if (slot != null && slot.getHasStack()) {
			ItemStack itemstack1 = slot.getStack();
			itemstack = itemstack1.copy();
			if (index < 4) {
				if (!this.mergeItemStack(itemstack1, 4, this.inventorySlots.size(), true)) {
					return ItemStack.EMPTY;
				}
				slot.onSlotChange(itemstack1, itemstack);
			} else if (!this.mergeItemStack(itemstack1, 0, 4, false)) {
				if (index < 4 + 27) {
					if (!this.mergeItemStack(itemstack1, 4 + 27, this.inventorySlots.size(), true)) {
						return ItemStack.EMPTY;
					}
				} else {
					if (!this.mergeItemStack(itemstack1, 4, 4 + 27, false)) {
						return ItemStack.EMPTY;
					}
				}
				return ItemStack.EMPTY;
			}
			if (itemstack1.getCount() == 0) {
				slot.putStack(ItemStack.EMPTY);
			} else {
				slot.onSlotChanged();
			}
			if (itemstack1.getCount() == itemstack.getCount()) {
				return ItemStack.EMPTY;
			}
			slot.onTake(playerIn, itemstack1);
		}
		return itemstack;
	}
	@Override
	protected boolean mergeItemStack(ItemStack stack, int startIndex, int endIndex, boolean reverseDirection) {
		boolean flag = false;
		int i = startIndex;
		if (reverseDirection) {
			i = endIndex - 1;
		}
		if (stack.isStackable()) {
			while (!stack.isEmpty()) {
				if (reverseDirection) {
					if (i < startIndex) {
						break;
					}
				} else if (i >= endIndex) {
					break;
				}
				Slot slot = this.inventorySlots.get(i);
				ItemStack itemstack = slot.getStack();
				if (slot.isItemValid(itemstack) && !itemstack.isEmpty() && areItemsAndTagsEqual(stack, itemstack)) {
					int j = itemstack.getCount() + stack.getCount();
					int maxSize = Math.min(slot.getSlotStackLimit(), stack.getMaxStackSize());
					if (j <= maxSize) {
						stack.setCount(0);
						itemstack.setCount(j);
						slot.putStack(itemstack);
						flag = true;
					} else if (itemstack.getCount() < maxSize) {
						stack.shrink(maxSize - itemstack.getCount());
						itemstack.setCount(maxSize);
						slot.putStack(itemstack);
						flag = true;
					}
				}
				if (reverseDirection) {
					--i;
				} else {
					++i;
				}
			}
		}
		if (!stack.isEmpty()) {
			if (reverseDirection) {
				i = endIndex - 1;
			} else {
				i = startIndex;
			}
			while (true) {
				if (reverseDirection) {
					if (i < startIndex) {
						break;
					}
				} else if (i >= endIndex) {
					break;
				}
				Slot slot1 = this.inventorySlots.get(i);
				ItemStack itemstack1 = slot1.getStack();
				if (itemstack1.isEmpty() && slot1.isItemValid(stack)) {
					if (stack.getCount() > slot1.getSlotStackLimit()) {
						slot1.putStack(stack.split(slot1.getSlotStackLimit()));
					} else {
						slot1.putStack(stack.split(stack.getCount()));
					}
					slot1.onSlotChanged();
					flag = true;
					break;
				}
				if (reverseDirection) {
					--i;
				} else {
					++i;
				}
			}
		}
		return flag;
	}
	public int getProgress () {
		return tile_entity.getCapability(CapabilityProgress.PROGRESS).map(IProgress::getProgress).orElse(0);
	}
	public int getGoal () {
		return tile_entity.getCookGoal();
	}
	@Override
	public void onContainerClosed(PlayerEntity playerIn) {
		super.onContainerClosed(playerIn);
	}
	@Override
	public boolean canInteractWith(PlayerEntity playerIn) {
		return true;
	}
}

And the gui screen:

package com.kenneth.hard_survival_craft.objects.blocks.workstations.smelting_forge;

import org.lwjgl.opengl.GL11;

import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.screen.inventory.ContainerScreen;
import net.minecraft.entity.player.PlayerInventory;
import net.minecraft.util.ResourceLocation;
import net.minecraft.util.text.ITextComponent;

public class SmeltingForgeGUI extends ContainerScreen<SmeltingForgeContainer> {
	
	private static final ResourceLocation texture = new ResourceLocation("kenmod:textures/gui/smelting_forge_gui.png");
	
	public SmeltingForgeGUI(SmeltingForgeContainer screenContainer, PlayerInventory inv, ITextComponent titleIn) {
		super(screenContainer, inv, titleIn);
		this.xSize = 176;
		this.ySize = 166;
	}
	
	@Override
	public void render(int mouseX, int mouseY, float partialTicks) {
		this.renderBackground();
		super.render(mouseX, mouseY, partialTicks);
		this.renderHoveredToolTip(mouseX, mouseY);
	}
	@Override
	protected void drawGuiContainerBackgroundLayer(float partialTicks, int mouseX, int mouseY) {
		GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
		Minecraft.getInstance().getTextureManager().bindTexture(texture);
		int k = (this.width - this.xSize) / 2;
		int l = (this.height - this.ySize) / 2;
		this.blit(k, l, 0, 0, this.xSize, this.ySize);
		
		int cook_progress = Math.round(24 * getCookProgressScaled());
		int le = this.guiLeft;
		int to = this.guiTop;
		this.blit(le + 67, to + 39, 176, 14, cook_progress + 1, 16);
	}
	private float getCookProgressScaled () {
		int prog = container.getProgress();
		int goal = container.getGoal();
		return (float)prog / (float) goal;
	}
	@Override
	protected void drawGuiContainerForegroundLayer(int mouseX, int mouseY) {
		this.font.drawString("Smelting Forge", 16, 5, -1);
	}
	@Override
	public void tick() {
		super.tick();
	}
	@Override
	public void removed() {
		super.removed();
		Minecraft.getInstance().keyboardListener.enableRepeatEvents(false);
	}
	@Override
	public void init(Minecraft minecraft, int width, int height) {
		super.init(minecraft, width, height);
		minecraft.keyboardListener.enableRepeatEvents(true);
	}
}

However it sill does not update the progress bar. And when the line: 

KenmodMain.debugString("Progress: " + prog);

is called in my tile entity it still returns 1.

 

Still need help with this. Can someone at least tell me if I am getting close?

Link to comment
Share on other sites

Ok I have ran into one more problem:

package com.kenneth.hard_survival_craft.objects.blocks.workstations.smelting_forge;

import com.kenneth.hard_survival_craft.objects.blocks.BlockList;
import com.kenneth.hard_survival_craft.objects.custom_capabilities.block_capabilites.CapabilityProgress;
import com.kenneth.hard_survival_craft.objects.custom_capabilities.block_capabilites.CapabilityProgressGoal;
import com.kenneth.hard_survival_craft.objects.custom_capabilities.block_capabilites.CapabilityBurnTime;
import com.kenneth.hard_survival_craft.objects.custom_capabilities.block_capabilites.IProgress;
import com.kenneth.hard_survival_craft.objects.custom_capabilities.block_capabilites.IProgressGoal;
import com.kenneth.hard_survival_craft.objects.custom_capabilities.block_capabilites.IBurnTime;
import com.kenneth.hard_survival_craft.objects.custom_capabilities.block_capabilites.Progress;
import com.kenneth.hard_survival_craft.objects.custom_capabilities.block_capabilites.ProgressGoal;
import com.kenneth.hard_survival_craft.objects.custom_capabilities.block_capabilites.BurnTime;

import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.entity.player.PlayerInventory;
import net.minecraft.entity.player.ServerPlayerEntity;
import net.minecraft.inventory.InventoryHelper;
import net.minecraft.inventory.container.Container;
import net.minecraft.inventory.container.INamedContainerProvider;
import net.minecraft.item.ItemStack;
import net.minecraft.item.Items;
import net.minecraft.nbt.CompoundNBT;
import net.minecraft.network.NetworkManager;
import net.minecraft.network.play.server.SUpdateTileEntityPacket;
import net.minecraft.tileentity.ITickableTileEntity;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.Direction;
import net.minecraft.util.text.ITextComponent;
import net.minecraft.util.text.StringTextComponent;
import net.minecraftforge.common.capabilities.Capability;
import net.minecraftforge.common.util.INBTSerializable;
import net.minecraftforge.common.util.LazyOptional;
import net.minecraftforge.fml.network.NetworkHooks;
import net.minecraftforge.items.CapabilityItemHandler;
import net.minecraftforge.items.IItemHandler;
import net.minecraftforge.items.ItemStackHandler;

public class SmeltingForgeTileEntity extends TileEntity implements ITickableTileEntity, INamedContainerProvider {
	
	protected ItemStackHandler slots = new ItemStackHandler();
	private LazyOptional<IItemHandler> slots_holder = LazyOptional.of(() -> slots);
	private LazyOptional<IProgress> progress = LazyOptional.of(this::createProgress);
	private LazyOptional<IProgressGoal> progress_goal = LazyOptional.of(this::createGoal);
	private LazyOptional<IBurnTime> burn_time = LazyOptional.of(this::createBurnTime);
	
	public SmeltingForgeTileEntity() {
		super(BlockList.smelting_forge_tile_entity);
		slots = new ItemStackHandler();
		slots.setSize(4);
	}

	@Override
	public void tick() {
		
		if(getProgressGoal() != 300) {
			setGoal(300);
		}
		
		if(itemsValid() && (getBurnTime() > 0 || hasFuel())) {
			incrementProgress(1);
			if(getProgress() >= getProgressGoal()) {
				smelt();
				setProgress(0);
			}
		} else if (getProgress() > 0){
			decrementProgress(1);
		}
		
		
		//Decrement burn time:
		if(getBurnTime() > 0) {
			decrementBurn(1);
		} else if (hasFuel() && itemsValid()) {
			//If burn time reaches zero and there is still fuel and there is items left to smelt then reset the burn time:
			setBurn(400);
			slots.getStackInSlot(2).shrink(1);
		}
		
		if(isBurning() && world.getBlockState(pos).get(SmeltingForge.LIT) == false) {
			world.setBlockState(pos, world.getBlockState(pos).with(SmeltingForge.LIT, true).with(SmeltingForge.FACING, world.getBlockState(pos).get(SmeltingForge.FACING)));
		} else if (!isBurning() && world.getBlockState(pos).get(SmeltingForge.LIT) == true){
			world.setBlockState(pos, world.getBlockState(pos).with(SmeltingForge.LIT, false).with(SmeltingForge.FACING, world.getBlockState(pos).get(SmeltingForge.FACING)));
		}
		
		markDirty();
	}
	
	public boolean isBurning () {
		return getBurnTime() > 0 || (hasFuel() && itemsValid());
	}
	
	//Check if there is fuel left in slot 2:
	private boolean hasFuel () {
		if(slots.getStackInSlot(2).getItem() == Items.COAL || slots.getStackInSlot(2).getItem() == Items.CHARCOAL) {
			return true;
		}
		return false;
	}
	
	//Check if the inventory has proper items for smelting:
	private boolean itemsValid () {
		if(slots.getStackInSlot(0).getItem() == Items.IRON_INGOT && ((slots.getStackInSlot(3).getItem() == Items.GOLD_INGOT && slots.getStackInSlot(3).getCount() < slots.getStackInSlot(3).getMaxStackSize()) || slots.getStackInSlot(3) == ItemStack.EMPTY) && (slots.getStackInSlot(1).getItem() == Items.COAL || slots.getStackInSlot(1).getItem() == Items.CHARCOAL)) {
			return true;
		}
		return false;
	}
	//Smelt something:
	private void smelt () {
		if(slots.getStackInSlot(3) == ItemStack.EMPTY) {
			slots.setStackInSlot(3, new ItemStack(Items.GOLD_INGOT, 1));
		} else {
			slots.getStackInSlot(3).setCount(slots.getStackInSlot(3).getCount() + 1);
		}
		slots.getStackInSlot(0).shrink(1);
		slots.getStackInSlot(1).shrink(1);
	}
	
	public int getProgress() {
		int prog = this.getCapability(CapabilityProgress.PROGRESS).map(IProgress::getProgress).orElse(0);
		return prog;
	}
	public int getProgressGoal () {
		int goal = this.getCapability(CapabilityProgressGoal.PROGRESS_GOAL).map(IProgressGoal::getGoal).orElse(0) + 1;
		return goal;
	}
	public int getBurnTime () {
		int burn = this.getCapability(CapabilityBurnTime.BURN_TIME).map(IBurnTime::getBurnTime).orElse(0);
		return burn;
	}
	private void incrementProgress (int amount) {
		progress.ifPresent(p -> ((Progress)p).incrementProgress(amount));
	}
	private void decrementProgress (int amount) {
		progress.ifPresent(p -> ((Progress)p).decrementProgress(amount));
	}
	private void setProgress (int amount) {
		progress.ifPresent(p -> ((Progress)p).setProgress(amount));
	}
	private void setGoal (int amount) {
		progress_goal.ifPresent(g -> ((ProgressGoal)g).setGoal(amount));
	}
	private void decrementBurn (int amount) {
		burn_time.ifPresent(b -> ((BurnTime)b).decrementBurnTime(amount));
	}
	private void setBurn (int amount) {
		burn_time.ifPresent(b -> ((BurnTime)b).setBurnTime(amount));
	}
	
	private IProgress createProgress () {
		return new Progress(0);
	}
	private IProgressGoal createGoal () {
		return new ProgressGoal(0);
	}
	private IBurnTime createBurnTime () {
		return new BurnTime(0);
	}
	
	@Override
	public SUpdateTileEntityPacket getUpdatePacket() {
		return new SUpdateTileEntityPacket(this.pos, 0, this.getUpdateTag());
	}
	@Override
	public CompoundNBT getUpdateTag() {
		return this.write(new CompoundNBT());
	}
	@Override
	public void onDataPacket(NetworkManager net, SUpdateTileEntityPacket pkt) {
		read(pkt.getNbtCompound());
	}
	
	@SuppressWarnings("unchecked")
	@Override
	public void read(CompoundNBT tag) {
		slots.deserializeNBT(tag.getCompound("slots"));
		CompoundNBT progressTag = tag.getCompound("progress");
		CompoundNBT progessGoalTag = tag.getCompound("progress_goal");
		CompoundNBT burnTimeTag = tag.getCompound("burn_time");
		progress.ifPresent(h -> ((INBTSerializable<CompoundNBT>)h).deserializeNBT(progressTag));
		progress_goal.ifPresent(i -> ((INBTSerializable<CompoundNBT>)i).deserializeNBT(progessGoalTag));
		burn_time.ifPresent(j -> ((INBTSerializable<CompoundNBT>)j).deserializeNBT(burnTimeTag));
		super.read(tag);
	}
	@SuppressWarnings("unchecked")
	@Override
	public CompoundNBT write(CompoundNBT tag) {
		tag.put("slots", slots.serializeNBT());
		progress.ifPresent(h -> {
			CompoundNBT compound = ((INBTSerializable<CompoundNBT>)h).serializeNBT();
			tag.put("progress", compound);
		});
		progress_goal.ifPresent(i -> {
			CompoundNBT compound = ((INBTSerializable<CompoundNBT>)i).serializeNBT();
			tag.put("progress_goal", compound);
		});
		burn_time.ifPresent(j -> {
			CompoundNBT compound = ((INBTSerializable<CompoundNBT>)j).serializeNBT();
			tag.put("burn_time", compound);
		});
		return super.write(tag);
	}
	@Override
	public <T> LazyOptional<T> getCapability(Capability<T> cap, Direction side) {
		if(cap == CapabilityItemHandler.ITEM_HANDLER_CAPABILITY) {
			return slots_holder.cast();
		}
		if(cap == CapabilityProgress.PROGRESS) {
			return progress.cast();
		}
		if(cap == CapabilityProgressGoal.PROGRESS_GOAL) {
			return progress_goal.cast();
		}
		if(cap == CapabilityBurnTime.BURN_TIME) {
			return burn_time.cast();
		}
		return super.getCapability(cap, side);
	}
	@Override
	public Container createMenu(int id, PlayerInventory player_inventory, PlayerEntity player) {
		return new SmeltingForgeContainer(id, player_inventory, slots, this);
	}
	@Override
	public ITextComponent getDisplayName() {
		return new StringTextComponent("block.kenmodlcb.furnace_station");
	}
	
	public void openGUI (ServerPlayerEntity player) {
		if(!world.isRemote) {
			NetworkHooks.openGui(player, this, getPos());
		}
	}
	
	@Override
	public void remove() {
		super.remove();
		slots_holder.invalidate();
		progress.invalidate();
		progress_goal.invalidate();
		burn_time.invalidate();
	}
	
	public void onDestroyed () {
		
		for(int i = 0; i < 4; i++) {
			if(slots.getStackInSlot(i) != ItemStack.EMPTY) {
				InventoryHelper.spawnItemStack(world, pos.getX(), pos.getY(), pos.getZ(), slots.getStackInSlot(i));
			}
		}
	}
}

 

package com.kenneth.hard_survival_craft.objects.blocks.workstations.smelting_forge;

//import com.kenneth.hard_survival_craft.KenmodMain;
import com.kenneth.hard_survival_craft.objects.blocks.BlockList;
import com.kenneth.hard_survival_craft.objects.custom_capabilities.block_capabilites.BurnTime;
import com.kenneth.hard_survival_craft.objects.custom_capabilities.block_capabilites.CapabilityBurnTime;
import com.kenneth.hard_survival_craft.objects.custom_capabilities.block_capabilites.CapabilityProgress;
import com.kenneth.hard_survival_craft.objects.custom_capabilities.block_capabilites.CapabilityProgressGoal;
import com.kenneth.hard_survival_craft.objects.custom_capabilities.block_capabilites.IProgress;
import com.kenneth.hard_survival_craft.objects.custom_capabilities.block_capabilites.Progress;
import com.kenneth.hard_survival_craft.objects.custom_capabilities.block_capabilites.ProgressGoal;

import net.minecraft.client.Minecraft;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.entity.player.PlayerInventory;
import net.minecraft.inventory.container.Container;
import net.minecraft.inventory.container.Slot;
import net.minecraft.item.ItemStack;
import net.minecraft.network.PacketBuffer;
import net.minecraft.util.IntReferenceHolder;
import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.api.distmarker.OnlyIn;
import net.minecraftforge.items.IItemHandler;
import net.minecraftforge.items.ItemStackHandler;
import net.minecraftforge.items.SlotItemHandler;

public class SmeltingForgeContainer extends Container {
	
	SmeltingForgeTileEntity tile_entity;
	
	@OnlyIn(Dist.CLIENT)
	public SmeltingForgeContainer (int id, PlayerInventory player_inventory, PacketBuffer extra_data) {
		this(id, player_inventory, new ItemStackHandler(4), (SmeltingForgeTileEntity)Minecraft.getInstance().world.getTileEntity(extra_data.readBlockPos()));
	}
	public SmeltingForgeContainer(int id, PlayerInventory player_inventory, IItemHandler smelting_forge_inventory, SmeltingForgeTileEntity te) {
		super(BlockList.smelting_forge_container, id);
		this.addSlot(new SlotItemHandler(smelting_forge_inventory, 0, 17, 21));
		this.addSlot(new SlotItemHandler(smelting_forge_inventory, 1, 44, 21));
		this.addSlot(new SlotItemHandler(smelting_forge_inventory, 2, 17, 57));
		this.addSlot(new SlotItemHandler(smelting_forge_inventory, 3, 98, 39) {
			@Override
			public boolean isItemValid(ItemStack stack) {
				return false;
			}
		});
		int si;
		int sj;
		for (si = 0; si < 3; ++si) {
			for (sj = 0; sj < 9; ++sj) {
				this.addSlot(new Slot(player_inventory, sj + (si + 1) * 9, 0 + 8 + sj * 18, 0 + 84 + si * 18));
			}
		}
		for (si = 0; si < 9; ++si) {
			this.addSlot(new Slot(player_inventory, si, 0 + 8 + si * 18, 0 + 142));
		}
		this.tile_entity = te;
		trackInt(new IntReferenceHolder() {
			@Override
			public void set(int value) {
				tile_entity.getCapability(CapabilityProgress.PROGRESS).ifPresent(h -> ((Progress)h).setProgress(value));
			}
			@Override
			public int get() {
				return getProgress();
			}
		});
		trackInt(new IntReferenceHolder() {
			@Override
			public void set(int value) {
				tile_entity.getCapability(CapabilityProgressGoal.PROGRESS_GOAL).ifPresent(h -> ((ProgressGoal)h).setGoal(value));
			}
			@Override
			public int get() {
				return getGoal();
			}
		});
		trackInt(new IntReferenceHolder() {
			@Override
			public void set(int value) {
				tile_entity.getCapability(CapabilityBurnTime.BURN_TIME).ifPresent(j -> ((BurnTime)j).setBurnTime(value));
			}
			@Override
			public int get() {
				return getBurnTime();
			}
		});
	}
	@Override
	public ItemStack transferStackInSlot(PlayerEntity playerIn, int index) {
		ItemStack itemstack = ItemStack.EMPTY;
		Slot slot = (Slot) this.inventorySlots.get(index);
		if (slot != null && slot.getHasStack()) {
			ItemStack itemstack1 = slot.getStack();
			itemstack = itemstack1.copy();
			if (index < 4) {
				if (!this.mergeItemStack(itemstack1, 4, this.inventorySlots.size(), true)) {
					return ItemStack.EMPTY;
				}
				slot.onSlotChange(itemstack1, itemstack);
			} else if (!this.mergeItemStack(itemstack1, 0, 4, false)) {
				if (index < 4 + 27) {
					if (!this.mergeItemStack(itemstack1, 4 + 27, this.inventorySlots.size(), true)) {
						return ItemStack.EMPTY;
					}
				} else {
					if (!this.mergeItemStack(itemstack1, 4, 4 + 27, false)) {
						return ItemStack.EMPTY;
					}
				}
				return ItemStack.EMPTY;
			}
			if (itemstack1.getCount() == 0) {
				slot.putStack(ItemStack.EMPTY);
			} else {
				slot.onSlotChanged();
			}
			if (itemstack1.getCount() == itemstack.getCount()) {
				return ItemStack.EMPTY;
			}
			slot.onTake(playerIn, itemstack1);
		}
		return itemstack;
	}
	@Override
	protected boolean mergeItemStack(ItemStack stack, int startIndex, int endIndex, boolean reverseDirection) {
		boolean flag = false;
		int i = startIndex;
		if (reverseDirection) {
			i = endIndex - 1;
		}
		if (stack.isStackable()) {
			while (!stack.isEmpty()) {
				if (reverseDirection) {
					if (i < startIndex) {
						break;
					}
				} else if (i >= endIndex) {
					break;
				}
				Slot slot = this.inventorySlots.get(i);
				ItemStack itemstack = slot.getStack();
				if (slot.isItemValid(itemstack) && !itemstack.isEmpty() && areItemsAndTagsEqual(stack, itemstack)) {
					int j = itemstack.getCount() + stack.getCount();
					int maxSize = Math.min(slot.getSlotStackLimit(), stack.getMaxStackSize());
					if (j <= maxSize) {
						stack.setCount(0);
						itemstack.setCount(j);
						slot.putStack(itemstack);
						flag = true;
					} else if (itemstack.getCount() < maxSize) {
						stack.shrink(maxSize - itemstack.getCount());
						itemstack.setCount(maxSize);
						slot.putStack(itemstack);
						flag = true;
					}
				}
				if (reverseDirection) {
					--i;
				} else {
					++i;
				}
			}
		}
		if (!stack.isEmpty()) {
			if (reverseDirection) {
				i = endIndex - 1;
			} else {
				i = startIndex;
			}
			while (true) {
				if (reverseDirection) {
					if (i < startIndex) {
						break;
					}
				} else if (i >= endIndex) {
					break;
				}
				Slot slot1 = this.inventorySlots.get(i);
				ItemStack itemstack1 = slot1.getStack();
				if (itemstack1.isEmpty() && slot1.isItemValid(stack)) {
					if (stack.getCount() > slot1.getSlotStackLimit()) {
						slot1.putStack(stack.split(slot1.getSlotStackLimit()));
					} else {
						slot1.putStack(stack.split(stack.getCount()));
					}
					slot1.onSlotChanged();
					flag = true;
					break;
				}
				if (reverseDirection) {
					--i;
				} else {
					++i;
				}
			}
		}
		return flag;
	}
	public int getProgress () {
		//KenmodMain.debugString("test 0: " + tile_entity.getProgress());
		return tile_entity.getCapability(CapabilityProgress.PROGRESS).map(IProgress::getProgress).orElse(0);
	}
	public int getGoal () {
		//KenmodMain.debugString("test 1: " + tile_entity.getProgressGoal());
		return tile_entity.getProgressGoal();
	}
	public int getBurnTime () {
		//KenmodMain.debugString("test 2: " + tile_entity.getBurnTime());
		return tile_entity.getBurnTime();
	}
	@Override
	public void onContainerClosed(PlayerEntity playerIn) {
		super.onContainerClosed(playerIn);
	}
	@Override
	public boolean canInteractWith(PlayerEntity playerIn) {
		return true;
	}
}

 

package com.kenneth.hard_survival_craft.objects.blocks.workstations.smelting_forge;

import org.lwjgl.opengl.GL11;

import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.screen.inventory.ContainerScreen;
import net.minecraft.entity.player.PlayerInventory;
import net.minecraft.util.ResourceLocation;
import net.minecraft.util.text.ITextComponent;

public class SmeltingForgeGUI extends ContainerScreen<SmeltingForgeContainer> {
	
	private static final ResourceLocation texture = new ResourceLocation("kenmod:textures/gui/smelting_forge_gui.png");
	
	public SmeltingForgeGUI(SmeltingForgeContainer screenContainer, PlayerInventory inv, ITextComponent titleIn) {
		super(screenContainer, inv, titleIn);
		this.xSize = 176;
		this.ySize = 166;
	}
	
	@Override
	public void render(int mouseX, int mouseY, float partialTicks) {
		this.renderBackground();
		super.render(mouseX, mouseY, partialTicks);
		this.renderHoveredToolTip(mouseX, mouseY);
	}
	@Override
	protected void drawGuiContainerBackgroundLayer(float partialTicks, int mouseX, int mouseY) {
		GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
		Minecraft.getInstance().getTextureManager().bindTexture(texture);
		int k = (this.width - this.xSize) / 2;
		int l = (this.height - this.ySize) / 2;
		this.blit(k, l, 0, 0, this.xSize, this.ySize);
		
		int cook_progress = Math.round(24 * getCookProgressScaled());
		int le = this.guiLeft;
		int to = this.guiTop;
		this.blit(le + 67, to + 39, 176, 14, cook_progress + 1, 16);
		
		int burn_time = Math.round(13 - (13.0F * getBurnTimeScaled()));
		this.blit(le + 17, to + 39 + 13 - burn_time, 176, 12 - burn_time, 14, burn_time);
	}
	private float getBurnTimeScaled() {
		int burn = container.getBurnTime();
		int burn_goal = 400;
		if(burn_goal == 0) {
			return 0;
		} else {
			return 1.0F - ((float)burn / (float)burn_goal);
		}
	}
	private float getCookProgressScaled () {
		int prog = container.getProgress();
		int goal = container.getGoal();
		return (float)prog / (float) goal;
	}
	@Override
	protected void drawGuiContainerForegroundLayer(int mouseX, int mouseY) {
		this.font.drawString("Smelting Forge", 16, 5, -1);
	}
	@Override
	public void tick() {
		super.tick();
	}
	@Override
	public void removed() {
		super.removed();
		Minecraft.getInstance().keyboardListener.enableRepeatEvents(false);
	}
	@Override
	public void init(Minecraft minecraft, int width, int height) {
		super.init(minecraft, width, height);
		minecraft.keyboardListener.enableRepeatEvents(true);
	}
}

 

When looking at the progress arrow it will go forwards for a little bit, then jerk back a little, then continue going forward. What is causing this strangeness?

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

    • Hello, I'm trying to modify the effects of native enchantments for bows and arrows in Minecraft. After using a decompilation tool, I found that the specific implementations of native bow and arrow enchantments (including `ArrowDamageEnchantment`, `ArrowKnockbackEnchantment`, `ArrowFireEnchantment`, `ArrowInfiniteEnchantment`, `ArrowPiercingEnchantment`) do not contain any information about the enchantment effects (such as the `getDamageProtection` function for `ProtectionEnchantment`, `getDamageBonus` function for `DamageEnchantment`, etc.). Upon searching for the base class of arrows, `AbstractArrow`, I found a function named setEnchantmentEffectsFromEntity`, which seems to be used to retrieve the enchantment levels of the tool held by a `LivingEntity` and calculate the specific values of the enchantment effects. However, after testing with the following code, I found that this function is not being called:   @Mixin(AbstractArrow.class) public class ModifyArrowEnchantmentEffects {     private static final Logger LOGGER = LogUtils.getLogger();     @Inject(         method = "setEnchantmentEffectsFromEntity",         at = @At("HEAD")     )     private void logArrowEnchantmentEffectsFromEntity(CallbackInfo ci) {         LOGGER.info("Arrow enchantment effects from entity");     } }   Upon further investigation, I found that within the onHitEntity method, there are several lines of code:               if (!this.level().isClientSide &amp;&amp; entity1 instanceof LivingEntity) {                EnchantmentHelper.doPostHurtEffects(livingentity, entity1);                EnchantmentHelper.doPostDamageEffects((LivingEntity)entity1, livingentity);             }   These lines of code actually call the doPostHurt and doPostAttack methods of each enchantment in the enchantment list. However, this leads back to the issue because native bow and arrow enchantments do not implement these functions. Although their base class defines the functions, they are empty. At this point, I'm completely stumped and seeking assistance. Thank you.
    • I have been trying to make a server with forge but I keep running into an issue. I have jdk 22 installed as well as Java 8. here is the debug file  
    • it crashed again     What the console says : [00:02:03] [Server thread/INFO] [Easy NPC/]: [EntityManager] Server started! [00:02:03] [Server thread/INFO] [co.gi.al.ic.IceAndFire/]: {iceandfire:fire_dragon_roost=true, iceandfire:fire_lily=true, iceandfire:spawn_dragon_skeleton_fire=true, iceandfire:lightning_dragon_roost=true, iceandfire:spawn_dragon_skeleton_lightning=true, iceandfire:ice_dragon_roost=true, iceandfire:ice_dragon_cave=true, iceandfire:lightning_dragon_cave=true, iceandfire:cyclops_cave=true, iceandfire:spawn_wandering_cyclops=true, iceandfire:spawn_sea_serpent=true, iceandfire:frost_lily=true, iceandfire:hydra_cave=true, iceandfire:lightning_lily=true, iceandfireixie_village=true, iceandfire:myrmex_hive_jungle=true, iceandfire:myrmex_hive_desert=true, iceandfire:silver_ore=true, iceandfire:siren_island=true, iceandfire:spawn_dragon_skeleton_ice=true, iceandfire:spawn_stymphalian_bird=true, iceandfire:fire_dragon_cave=true, iceandfire:sapphire_ore=true, iceandfire:spawn_hippocampus=true, iceandfire:spawn_death_worm=true} [00:02:03] [Server thread/INFO] [co.gi.al.ic.IceAndFire/]: {TROLL_S=true, HIPPOGRYPH=true, AMPHITHERE=true, COCKATRICE=true, TROLL_M=true, DREAD_LICH=true, TROLL_F=true} [00:02:03] [Server thread/INFO] [ne.be.lo.WeaponRegistry/]: Encoded Weapon Attribute registry size (with package overhead): 41976 bytes (in 5 string chunks with the size of 10000) [00:02:03] [Server thread/INFO] [patchouli/]: Sending reload packet to clients [00:02:03] [Server thread/WARN] [voicechat/]: [voicechat] Running in offline mode - Voice chat encryption is not secure! [00:02:03] [VoiceChatServerThread/INFO] [voicechat/]: [voicechat] Using server-ip as bind address: 0.0.0.0 [00:02:03] [Server thread/WARN] [ModernFix/]: Dedicated server took 22.521 seconds to load [00:02:03] [VoiceChatServerThread/INFO] [voicechat/]: [voicechat] Voice chat server started at 0.0.0.0:25565 [00:02:03] [Server thread/WARN] [minecraft/SynchedEntityData]: defineId called for: class net.minecraft.world.entity.player.Player from class tschipp.carryon.common.carry.CarryOnDataManager [00:02:03] [Server thread/INFO] [ne.mi.co.AdvancementLoadFix/]: Using new advancement loading for net.minecraft.server.PlayerAdvancements@2941ffd5 [00:02:10] [Netty Epoll Server IO #2/INFO] [Calio/]: Received acknowledgment for login packet with id 0 [00:02:10] [Netty Epoll Server IO #2/INFO] [Calio/]: Received acknowledgment for login packet with id 1 [00:02:10] [Netty Epoll Server IO #2/INFO] [Calio/]: Received acknowledgment for login packet with id 2 [00:02:10] [Netty Epoll Server IO #2/INFO] [Calio/]: Received acknowledgment for login packet with id 3 [00:02:10] [Netty Epoll Server IO #2/INFO] [Calio/]: Received acknowledgment for login packet with id 4 [00:02:10] [Netty Epoll Server IO #2/INFO] [Calio/]: Received acknowledgment for login packet with id 5 [00:02:10] [Netty Epoll Server IO #2/INFO] [Calio/]: Received acknowledgment for login packet with id 6 [00:02:10] [Netty Epoll Server IO #2/INFO] [Calio/]: Received acknowledgment for login packet with id 7 [00:02:10] [Netty Epoll Server IO #2/INFO] [Calio/]: Received acknowledgment for login packet with id 8 [00:02:10] [Netty Epoll Server IO #2/INFO] [Calio/]: Received acknowledgment for login packet with id 9 [00:02:10] [Netty Epoll Server IO #2/INFO] [Calio/]: Received acknowledgment for login packet with id 10 [00:02:10] [Netty Epoll Server IO #2/INFO] [Calio/]: Received acknowledgment for login packet with id 11 [00:02:10] [Netty Epoll Server IO #2/INFO] [Calio/]: Received acknowledgment for login packet with id 12 [00:02:10] [Netty Epoll Server IO #2/INFO] [Calio/]: Received acknowledgment for login packet with id 13 [00:02:10] [Netty Epoll Server IO #2/INFO] [Calio/]: Received acknowledgment for login packet with id 14 [00:02:19] [Server thread/INFO] [ne.mi.co.AdvancementLoadFix/]: Using new advancement loading for net.minecraft.server.PlayerAdvancements@ebc7ef2 [00:02:19] [Server thread/INFO] [minecraft/PlayerList]: ZacAdos[/90.2.17.162:49242] logged in with entity id 1062 at (-1848.6727005281205, 221.0, -3054.2468255848935) [00:02:19] [Server thread/ERROR] [ModernFix/]: Skipping entity ID sync for com.talhanation.smallships.world.entity.ship.Ship: java.lang.NoClassDefFoundError: net/minecraft/client/CameraType [00:02:19] [Server thread/INFO] [minecraft/MinecraftServer]: - Gloop - ZacAdos joined the game [00:02:19] [Server thread/INFO] [xa.pa.OpenPartiesAndClaims/]: Updating all forceload tickets for cc56befd-d376-3526-a760-340713c478bd [00:02:19] [Server thread/INFO] [se.mi.te.da.DataManager/]: Sending data to client: ZacAdos [00:02:19] [Server thread/INFO] [voicechat/]: [voicechat] Received secret request of - Gloop - ZacAdos (17) [00:02:19] [Server thread/INFO] [voicechat/]: [voicechat] Sent secret to - Gloop - ZacAdos [00:02:21] [VoiceChatPacketProcessingThread/INFO] [voicechat/]: [voicechat] Successfully authenticated player cc56befd-d376-3526-a760-340713c478bd [00:02:22] [VoiceChatPacketProcessingThread/INFO] [voicechat/]: [voicechat] Successfully validated connection of player cc56befd-d376-3526-a760-340713c478bd [00:02:22] [VoiceChatPacketProcessingThread/INFO] [voicechat/]: [voicechat] Player - Gloop - ZacAdos (cc56befd-d376-3526-a760-340713c478bd) successfully connected to voice chat stop [00:02:34] [Server thread/INFO] [minecraft/MinecraftServer]: Stopping the server [00:02:34] [Server thread/INFO] [mo.pl.ar.ArmourersWorkshop/]: stop local service [00:02:34] [Server thread/INFO] [minecraft/MinecraftServer]: Stopping server [00:02:34] [Server thread/INFO] [minecraft/MinecraftServer]: Saving players [00:02:34] [Server thread/INFO] [minecraft/ServerGamePacketListenerImpl]: ZacAdos lost connection: Server closed [00:02:34] [Server thread/INFO] [minecraft/MinecraftServer]: - Gloop - ZacAdos left the game [00:02:34] [Server thread/INFO] [xa.pa.OpenPartiesAndClaims/]: Updating all forceload tickets for cc56befd-d376-3526-a760-340713c478bd [00:02:34] [Server thread/INFO] [minecraft/MinecraftServer]: Saving worlds [00:02:34] [Server thread/INFO] [minecraft/MinecraftServer]: Saving chunks for level 'ServerLevel[world]'/minecraft:overworld [00:02:34] [Server thread/INFO] [minecraft/MinecraftServer]: Saving chunks for level 'ServerLevel[world]'/minecraft:the_end [00:02:34] [Server thread/INFO] [minecraft/MinecraftServer]: Saving chunks for level 'ServerLevel[world]'/minecraft:the_nether [00:02:34] [Server thread/INFO] [minecraft/MinecraftServer]: ThreadedAnvilChunkStorage (world): All chunks are saved [00:02:34] [Server thread/INFO] [minecraft/MinecraftServer]: ThreadedAnvilChunkStorage (DIM1): All chunks are saved [00:02:34] [Server thread/INFO] [minecraft/MinecraftServer]: ThreadedAnvilChunkStorage (DIM-1): All chunks are saved [00:02:34] [Server thread/INFO] [minecraft/MinecraftServer]: ThreadedAnvilChunkStorage: All dimensions are saved [00:02:34] [Server thread/INFO] [xa.pa.OpenPartiesAndClaims/]: Stopping IO worker... [00:02:34] [Server thread/INFO] [xa.pa.OpenPartiesAndClaims/]: Stopped IO worker! [00:02:34] [Server thread/INFO] [Calio/]: Removing Dynamic Registries for: net.minecraft.server.dedicated.DedicatedServer@7dc879e1 [MineStrator Daemon]: Checking server disk space usage, this could take a few seconds... [MineStrator Daemon]: Updating process configuration files... [MineStrator Daemon]: Ensuring file permissions are set correctly, this could take a few seconds... [MineStrator Daemon]: Pulling Docker container image, this could take a few minutes to complete... [MineStrator Daemon]: Finished pulling Docker container image container@pterodactyl~ java -version openjdk version "17.0.10" 2024-01-16 OpenJDK Runtime Environment Temurin-17.0.10+7 (build 17.0.10+7) OpenJDK 64-Bit Server VM Temurin-17.0.10+7 (build 17.0.10+7, mixed mode, sharing) container@pterodactyl~ java -Xms128M -Xmx6302M -Dterminal.jline=false -Dterminal.ansi=true -Djline.terminal=jline.UnsupportedTerminal -p libraries/cpw/mods/bootstraplauncher/1.1.2/bootstraplauncher-1.1.2.jar:libraries/cpw/mods/securejarhandler/2.1.4/securejarhandler-2.1.4.jar:libraries/org/ow2/asm/asm-commons/9.5/asm-commons-9.5.jar:libraries/org/ow2/asm/asm-util/9.5/asm-util-9.5.jar:libraries/org/ow2/asm/asm-analysis/9.5/asm-analysis-9.5.jar:libraries/org/ow2/asm/asm-tree/9.5/asm-tree-9.5.jar:libraries/org/ow2/asm/asm/9.5/asm-9.5.jar:libraries/net/minecraftforge/JarJarFileSystems/0.3.16/JarJarFileSystems-0.3.16.jar --add-modules ALL-MODULE-PATH --add-opens java.base/java.util.jar=cpw.mods.securejarhandler --add-opens java.base/java.lang.invoke=cpw.mods.securejarhandler --add-exports java.base/sun.security.util=cpw.mods.securejarhandler --add-exports jdk.naming.dns/com.sun.jndi.dns=java.naming -Djava.net.preferIPv6Addresses=system -DignoreList=bootstraplauncher-1.1.2.jar,securejarhandler-2.1.4.jar,asm-commons-9.5.jar,asm-util-9.5.jar,asm-analysis-9.5.jar,asm-tree-9.5.jar,asm-9.5.jar,JarJarFileSystems-0.3.16.jar -DlibraryDirectory=libraries -DlegacyClassPath=libraries/cpw/mods/securejarhandler/2.1.4/securejarhandler-2.1.4.jar:libraries/org/ow2/asm/asm/9.5/asm-9.5.jar:libraries/org/ow2/asm/asm-commons/9.5/asm-commons-9.5.jar:libraries/org/ow2/asm/asm-tree/9.5/asm-tree-9.5.jar:libraries/org/ow2/asm/asm-util/9.5/asm-util-9.5.jar:libraries/org/ow2/asm/asm-analysis/9.5/asm-analysis-9.5.jar:libraries/net/minecraftforge/accesstransformers/8.0.4/accesstransformers-8.0.4.jar:libraries/org/antlr/antlr4-runtime/4.9.1/antlr4-runtime-4.9.1.jar:libraries/net/minecraftforge/eventbus/6.0.3/eventbus-6.0.3.jar:libraries/net/minecraftforge/forgespi/6.0.0/forgespi-6.0.0.jar:libraries/net/minecraftforge/coremods/5.0.1/coremods-5.0.1.jar:libraries/cpw/mods/modlauncher/10.0.8/modlauncher-10.0.8.jar:libraries/net/minecraftforge/unsafe/0.2.0/unsafe-0.2.0.jar:libraries/com/electronwill/night-config/core/3.6.4/core-3.6.4.jar:libraries/com/electronwill/night-config/toml/3.6.4/toml-3.6.4.jar:libraries/org/apache/maven/maven-artifact/3.8.5/maven-artifact-3.8.5.jar:libraries/net/jodah/typetools/0.8.3/typetools-0.8.3.jar:libraries/net/minecrell/terminalconsoleappender/1.2.0/terminalconsoleappender-1.2.0.jar:libraries/org/jline/jline-reader/3.12.1/jline-reader-3.12.1.jar:libraries/org/jline/jline-terminal/3.12.1/jline-terminal-3.12.1.jar:libraries/org/spongepowered/mixin/0.8.5/mixin-0.8.5.jar:libraries/org/openjdk/nashorn/nashorn-core/15.3/nashorn-core-15.3.jar:libraries/net/minecraftforge/JarJarSelector/0.3.16/JarJarSelector-0.3.16.jar:libraries/net/minecraftforge/JarJarMetadata/0.3.16/JarJarMetadata-0.3.16.jar:libraries/net/minecraftforge/fmlloader/1.19.2-43.3.0/fmlloader-1.19.2-43.3.0.jar:libraries/net/minecraft/server/1.19.2-20220805.130853/server-1.19.2-20220805.130853-extra.jar:libraries/com/github/oshi/oshi-core/5.8.5/oshi-core-5.8.5.jar:libraries/com/google/code/gson/gson/2.8.9/gson-2.8.9.jar:libraries/com/google/guava/failureaccess/1.0.1/failureaccess-1.0.1.jar:libraries/com/google/guava/guava/31.0.1-jre/guava-31.0.1-jre.jar:libraries/com/mojang/authlib/3.11.49/authlib-3.11.49.jar:libraries/com/mojang/brigadier/1.0.18/brigadier-1.0.18.jar:libraries/com/mojang/datafixerupper/5.0.28/datafixerupper-5.0.28.jar:libraries/com/mojang/javabridge/1.2.24/javabridge-1.2.24.jar:libraries/com/mojang/logging/1.0.0/logging-1.0.0.jar:libraries/commons-io/commons-io/2.11.0/commons-io-2.11.0.jar:libraries/io/netty/netty-buffer/4.1.77.Final/netty-buffer-4.1.77.Final.jar:libraries/io/netty/netty-codec/4.1.77.Final/netty-codec-4.1.77.Final.jar:libraries/io/netty/netty-common/4.1.77.Final/netty-common-4.1.77.Final.jar:libraries/io/netty/netty-handler/4.1.77.Final/netty-handler-4.1.77.Final.jar:libraries/io/netty/netty-resolver/4.1.77.Final/netty-resolver-4.1.77.Final.jar:libraries/io/netty/netty-transport/4.1.77.Final/netty-transport-4.1.77.Final.jar:libraries/io/netty/netty-transport-classes-epoll/4.1.77.Final/netty-transport-classes-epoll-4.1.77.Final.jar:libraries/io/netty/netty-transport-native-epoll/4.1.77.Final/netty-transport-native-epoll-4.1.77.Final-linux-x86_64.jar:libraries/io/netty/netty-transport-native-epoll/4.1.77.Final/netty-transport-native-epoll-4.1.77.Final-linux-aarch_64.jar:libraries/io/netty/netty-transport-native-unix-common/4.1.77.Final/netty-transport-native-unix-common-4.1.77.Final.jar:libraries/it/unimi/dsi/fastutil/8.5.6/fastutil-8.5.6.jar:libraries/net/java/dev/jna/jna/5.10.0/jna-5.10.0.jar:libraries/net/java/dev/jna/jna-platform/5.10.0/jna-platform-5.10.0.jar:libraries/net/sf/jopt-simple/jopt-simple/5.0.4/jopt-simple-5.0.4.jar:libraries/org/apache/commons/commons-lang3/3.12.0/commons-lang3-3.12.0.jar:libraries/org/apache/logging/log4j/log4j-api/2.17.0/log4j-api-2.17.0.jar:libraries/org/apache/logging/log4j/log4j-core/2.17.0/log4j-core-2.17.0.jar:libraries/org/apache/logging/log4j/log4j-slf4j18-impl/2.17.0/log4j-slf4j18-impl-2.17.0.jar:libraries/org/slf4j/slf4j-api/1.8.0-beta4/slf4j-api-1.8.0-beta4.jar cpw.mods.bootstraplauncher.BootstrapLauncher --launchTarget forgeserver --fml.forgeVersion 43.3.0 --fml.mcVersion 1.19.2 --fml.forgeGroup net.minecraftforge --fml.mcpVersion 20220805.130853 [00:02:42] [main/INFO] [cp.mo.mo.Launcher/MODLAUNCHER]: ModLauncher running: args [--launchTarget, forgeserver, --fml.forgeVersion, 43.3.0, --fml.mcVersion, 1.19.2, --fml.forgeGroup, net.minecraftforge, --fml.mcpVersion, 20220805.130853] [00:02:42] [main/INFO] [cp.mo.mo.Launcher/MODLAUNCHER]: ModLauncher 10.0.8+10.0.8+main.0ef7e830 starting: java version 17.0.10 by Eclipse Adoptium; OS Linux arch amd64 version 6.1.0-12-amd64 [00:02:43] [main/INFO] [mixin/]: SpongePowered MIXIN Subsystem Version=0.8.5 Source=union:/home/container/libraries/org/spongepowered/mixin/0.8.5/mixin-0.8.5.jar%2363!/ Service=ModLauncher Env=SERVER [00:02:43] [main/WARN] [ne.mi.fm.lo.mo.ModFileParser/LOADING]: Mod file /home/container/libraries/net/minecraftforge/fmlcore/1.19.2-43.3.0/fmlcore-1.19.2-43.3.0.jar is missing mods.toml file [00:02:43] [main/WARN] [ne.mi.fm.lo.mo.ModFileParser/LOADING]: Mod file /home/container/libraries/net/minecraftforge/javafmllanguage/1.19.2-43.3.0/javafmllanguage-1.19.2-43.3.0.jar is missing mods.toml file [00:02:43] [main/WARN] [ne.mi.fm.lo.mo.ModFileParser/LOADING]: Mod file /home/container/libraries/net/minecraftforge/lowcodelanguage/1.19.2-43.3.0/lowcodelanguage-1.19.2-43.3.0.jar is missing mods.toml file [00:02:43] [main/WARN] [ne.mi.fm.lo.mo.ModFileParser/LOADING]: Mod file /home/container/libraries/net/minecraftforge/mclanguage/1.19.2-43.3.0/mclanguage-1.19.2-43.3.0.jar is missing mods.toml file [00:02:44] [main/WARN] [ne.mi.ja.se.JarSelector/]: Attempted to select two dependency jars from JarJar which have the same identification: Mod File: and Mod File: . Using Mod File: [00:02:44] [main/WARN] [ne.mi.ja.se.JarSelector/]: Attempted to select a dependency jar for JarJar which was passed in as source: resourcefullib. Using Mod File: /home/container/mods/resourcefullib-forge-1.19.2-1.1.24.jar [00:02:44] [main/INFO] [ne.mi.fm.lo.mo.JarInJarDependencyLocator/]: Found 13 dependencies adding them to mods collection Latest log [29Mar2024 00:02:42.803] [main/INFO] [cpw.mods.modlauncher.Launcher/MODLAUNCHER]: ModLauncher running: args [--launchTarget, forgeserver, --fml.forgeVersion, 43.3.0, --fml.mcVersion, 1.19.2, --fml.forgeGroup, net.minecraftforge, --fml.mcpVersion, 20220805.130853] [29Mar2024 00:02:42.805] [main/INFO] [cpw.mods.modlauncher.Launcher/MODLAUNCHER]: ModLauncher 10.0.8+10.0.8+main.0ef7e830 starting: java version 17.0.10 by Eclipse Adoptium; OS Linux arch amd64 version 6.1.0-12-amd64 [29Mar2024 00:02:43.548] [main/INFO] [mixin/]: SpongePowered MIXIN Subsystem Version=0.8.5 Source=union:/home/container/libraries/org/spongepowered/mixin/0.8.5/mixin-0.8.5.jar%2363!/ Service=ModLauncher Env=SERVER [29Mar2024 00:02:43.876] [main/WARN] [net.minecraftforge.fml.loading.moddiscovery.ModFileParser/LOADING]: Mod file /home/container/libraries/net/minecraftforge/fmlcore/1.19.2-43.3.0/fmlcore-1.19.2-43.3.0.jar is missing mods.toml file [29Mar2024 00:02:43.877] [main/WARN] [net.minecraftforge.fml.loading.moddiscovery.ModFileParser/LOADING]: Mod file /home/container/libraries/net/minecraftforge/javafmllanguage/1.19.2-43.3.0/javafmllanguage-1.19.2-43.3.0.jar is missing mods.toml file [29Mar2024 00:02:43.877] [main/WARN] [net.minecraftforge.fml.loading.moddiscovery.ModFileParser/LOADING]: Mod file /home/container/libraries/net/minecraftforge/lowcodelanguage/1.19.2-43.3.0/lowcodelanguage-1.19.2-43.3.0.jar is missing mods.toml file [29Mar2024 00:02:43.878] [main/WARN] [net.minecraftforge.fml.loading.moddiscovery.ModFileParser/LOADING]: Mod file /home/container/libraries/net/minecraftforge/mclanguage/1.19.2-43.3.0/mclanguage-1.19.2-43.3.0.jar is missing mods.toml file [29Mar2024 00:02:44.033] [main/WARN] [net.minecraftforge.jarjar.selection.JarSelector/]: Attempted to select two dependency jars from JarJar which have the same identification: Mod File: and Mod File: . Using Mod File: [29Mar2024 00:02:44.034] [main/WARN] [net.minecraftforge.jarjar.selection.JarSelector/]: Attempted to select a dependency jar for JarJar which was passed in as source: resourcefullib. Using Mod File: /home/container/mods/resourcefullib-forge-1.19.2-1.1.24.jar [29Mar2024 00:02:44.034] [main/INFO] [net.minecraftforge.fml.loading.moddiscovery.JarInJarDependencyLocator/]: Found 13 dependencies adding them to mods collection
    • I am unable to do that. Brigadier is a mojang library that parses commands.
  • Topics

×
×
  • Create New...

Important Information

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