Jump to content

Recommended Posts

Posted

I'm working with a system of:

Press Keybinding to open "Player Class Menu"

Select Class and/or Profession in GUI

Press save

Fire packet from client to server

check to see if player has a class, no class allow free class change. Else check to see if they have enough gold to change.

Send Response Packet to update client (server > client)

 

Where it apparently is failing is I'm guessing the saving portion within the "requestPacket"(client > server)

As the changes never stay, or save.

 

[spoiler=gui code]

package htd.rot.client.gui;

import org.lwjgl.opengl.GL11;

import htd.rot.Rot;
import htd.rot.capability.attribute.CapAttribute;
import htd.rot.capability.attribute.CapAttributeData;
import htd.rot.capability.playerextra.CapPlayerExtra;
import htd.rot.capability.playerextra.CapPlayerExtraData;
import htd.rot.comms.packets.ClassRequestPacket;
import htd.rot.comms.packets.ProfessionRequestPacket;
import htd.rot.managers.PacketManager;
import htd.rot.managers.PlayerCPTypeManager;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.GuiButton;
import net.minecraft.client.gui.inventory.GuiContainer;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.util.ResourceLocation;

public class GuiClassSelection extends GuiContainer {
public static final ResourceLocation texture = new ResourceLocation(Rot.MODID.toLowerCase(),
		"textures/gui/rotGui.png");

private EntityPlayer player;
private int pad = 4;
private int ch = 20;
private int selectedClass = -1;
private int selectedProfession = -1;

public GuiClassSelection(EntityPlayer player)
{
	super(new ContainerNull());

	this.player = player;
	this.xSize = 176;
	this.ySize = 166;
	this.selectedClass = player.getCapability(CapPlayerExtra.CAPABILITY, null).currentClass;
	this.selectedProfession = player.getCapability(CapPlayerExtra.CAPABILITY, null).currentProfession;
}

/** Button Clicks **/
@Override
protected void actionPerformed(GuiButton button)
{
	switch (button.id)
	{
	case 0: // Class Forward
		this.selectedClass++;
		this.selectedClass = this.selectedClass == PlayerCPTypeManager.classes.length ? 0 : this.selectedClass;
		break;
	case 1: // Class Back
		this.selectedClass--;
		this.selectedClass = this.selectedClass < 0 ? PlayerCPTypeManager.classes.length - 1 : this.selectedClass;
		break;
	case 2: // Change Class
		PacketManager.INSTANCE.sendToServer(new ClassRequestPacket(selectedClass));
		break;
	case 3: // Refresh Class
		PacketManager.INSTANCE.sendToServer(new ClassRequestPacket(0));
		break;
	case 4: // Profession Forward
		this.selectedProfession++;
		this.selectedProfession = this.selectedProfession == PlayerCPTypeManager.professions.length ? 0
				: this.selectedProfession;
		break;
	case 5: // Profession Back
		this.selectedProfession--;
		this.selectedProfession = this.selectedProfession < 0 ? PlayerCPTypeManager.professions.length - 1
				: this.selectedProfession;
		break;
	case 6: // Change Profession
		PacketManager.INSTANCE.sendToServer(new ProfessionRequestPacket(selectedProfession));
		break;
	case 7:// Refresh Profession
		PacketManager.INSTANCE.sendToServer(new ProfessionRequestPacket(0));
		break;
	}
}

@Override
protected void drawGuiContainerBackgroundLayer(float f, int i, int j)
{

	/*
	 * TextureManager manager = Minecraft.getMinecraft().renderEngine;
	 * manager.bindTexture(manager.getResourceLocation(1)); //RENDER ITEMS
	 * drawTexturedModelRectFromIcon(300, 300,
	 * RotItems.itemGunpowderInfuser.getIconFromDamage(0), 16, 16);
	 */

	GL11.glColor4f(1F, 1F, 1F, 1F);
	Minecraft.getMinecraft().renderEngine.bindTexture(texture);
	drawTexturedModalRect(this.guiLeft, this.guiTop, 0, 0, this.xSize, this.ySize);

	this.buttonList.clear();
	// Start with main control buttons

	CapPlayerExtraData playerExtra = player.getCapability(CapPlayerExtra.CAPABILITY, null);
	CapAttributeData attrs = player.getCapability(CapAttribute.CAPABILITY, null);

	int x1 = this.guiLeft + this.pad;
	int x2 = (this.guiLeft + this.xSize) - (8 + this.pad);
	int x3 = (x2 + x1) / 2;

	int textY = this.guiTop + this.pad;
	int textX = (this.guiLeft + this.xSize) + pad;

	this.buttonList.add(new GuiClassSelectionButton(0, x2, this.guiTop + this.pad, "", 1));
	this.buttonList.add(new GuiClassSelectionButton(4, x2, this.guiTop + this.pad + (8 * 2), "", 1));

	this.drawString(this.fontRendererObj, this.selectedClass != -1 ? PlayerCPTypeManager.classes[this.selectedClass].className : "None", x3,
			this.guiTop + this.pad + 5, 0xddeeee);

	this.drawString(this.fontRendererObj, this.selectedProfession != -1 ? PlayerCPTypeManager.professions[this.selectedProfession].professionName : "None",
			x3, this.guiTop + this.pad + 20, 0xddeeee);

	this.buttonList.add(new GuiClassSelectionButton(1, x2 - 8, this.guiTop + this.pad, "", 0));
	this.buttonList.add(new GuiClassSelectionButton(2, x2 - 8, this.guiTop + this.pad + 8, "", 2));
	this.buttonList.add(new GuiClassSelectionButton(3, x2, this.guiTop + this.pad + 8, "", 3));

	this.buttonList.add(new GuiClassSelectionButton(5, x2 - 8, this.guiTop + this.pad + (8 * 2), "", 0));
	this.buttonList.add(new GuiClassSelectionButton(6, x2 - 8, this.guiTop + this.pad + (8 * 3), "", 2));
	this.buttonList.add(new GuiClassSelectionButton(7, x2, this.guiTop + this.pad + (8 * 3), "", 3));

	this.drawString(this.fontRendererObj, "Current Class:", textX, textY, 0xdbdd15);
	textY += 15;
	this.drawString(this.fontRendererObj, playerExtra.currentClass == -1 ? "None" : PlayerCPTypeManager.classes[playerExtra.currentClass].className, textX, textY,
			0xdbdd15);
	textY += 15;
	for (int index = 0; index < attrs.attributes.length;index++)
	{
		this.drawString(this.fontRendererObj, attrs.ATTRIBUTE_TAGS[index] + ": " + attrs.attributes[index], textX, textY,
				attrs.attributes[index] == 0 ? 0xFFFFFF
						: attrs.attributes[index] > 0 ? 0x00ff42 : 0xff0c00);
		textY += 15;
	}
	this.drawString(this.fontRendererObj, "Current Profession:", textX, textY, 0xdbdd15);
	textY += 15;
	this.drawString(this.fontRendererObj, playerExtra.currentProfession == -1 ? "None" : PlayerCPTypeManager.professions[playerExtra.currentClass].professionName, textX, textY,
			0xdbdd15);

	// Visual information on location
	/*
	 * this.drawString(fontRendererObj, "X: "+(xOffset+te.xCoord)+
	 * " offSet: "+xOffset, (startLeft + ((gridSizeX * 2) * cw)) + cw * 5,
	 * (startTop + (gridSizeZ * ch) + 4) - ch, 0xFFFFFF);
	 * this.drawString(fontRendererObj, "Y: "+(yOffset+te.yCoord)+
	 * " offSet: "+yOffset, (startLeft + ((gridSizeX * 2) * cw)) + cw * 5,
	 * (startTop + (gridSizeZ * ch) + 4), 0xFFFFFF);
	 * this.drawString(fontRendererObj, "Z: "+(zOffset+te.zCoord)+
	 * " offSet: "+zOffset, (startLeft + ((gridSizeX * 2) * cw)) + cw * 5,
	 * (startTop + (gridSizeZ * ch) + 4) + ch, 0xFFFFFF);
	 */
}

/** Keyboard Clicks **/
@Override
protected void keyTyped(char par1, int par2)
{
	if ((par2 == 1) || (par2 == this.mc.gameSettings.keyBindInventory.getKeyCode()))
	{
		this.mc.thePlayer.closeScreen();
	}
}
}

 

 

[spoiler=request packet]

package htd.rot.comms.packets;

import htd.rot.capability.playerextra.CapPlayerExtra;
import htd.rot.capability.playerextra.CapPlayerExtraData;
import io.netty.buffer.ByteBuf;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraftforge.fml.common.network.simpleimpl.IMessage;
import net.minecraftforge.fml.common.network.simpleimpl.IMessageHandler;
import net.minecraftforge.fml.common.network.simpleimpl.MessageContext;

public class ClassRequestPacket implements IMessage {

public static class ClassRequestPacketHandler implements IMessageHandler<ClassRequestPacket, IMessage> {

	@Override
	public IMessage onMessage(ClassRequestPacket message, MessageContext ctx)
	{
		final int goldCost = 500;

		if (message.classID == -1)
		{
			return null;
		}

		EntityPlayer player = ctx.getServerHandler().playerEntity;
		CapPlayerExtraData props = player.getCapability(CapPlayerExtra.CAPABILITY, null);
		if (props.currentClass == -1)
		{
			props.currentClass = message.classID;
			return new ClassResponsePacket(props.currentClass,props.gold);
		} else
		{
			if (props.playerInfo[props.gold] >= goldCost)
			{
				props.playerInfo[props.gold] -= goldCost;
				props.currentClass = message.classID;
				return new ClassResponsePacket(props.currentClass,props.gold);
			}
		}			
		return null;
	}

}

public int classID;

public ClassRequestPacket()
{

}

public ClassRequestPacket(int className)
{
	this.classID = className;
}

@Override
public void fromBytes(ByteBuf buf)
{
	this.classID = buf.readInt();
}

@Override
public void toBytes(ByteBuf buf)
{
	buf.writeInt(this.classID);
}

}

 

 

[spoiler=response packet]

package htd.rot.comms.packets;

import htd.rot.capability.playerextra.CapPlayerExtra;
import htd.rot.capability.playerextra.CapPlayerExtraData;
import io.netty.buffer.ByteBuf;
import net.minecraft.client.Minecraft;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraftforge.fml.common.network.simpleimpl.IMessage;
import net.minecraftforge.fml.common.network.simpleimpl.IMessageHandler;
import net.minecraftforge.fml.common.network.simpleimpl.MessageContext;

public class ClassResponsePacket implements IMessage {

public static class ClassResponsePacketHandler implements IMessageHandler<ClassResponsePacket, IMessage> {

	@Override
	public IMessage onMessage(ClassResponsePacket message, MessageContext ctx)
	{
		EntityPlayer player = Minecraft.getMinecraft().thePlayer;
		player.getCapability(CapPlayerExtra.CAPABILITY, null).currentClass = message.classID;
		player.getCapability(CapPlayerExtra.CAPABILITY, null).playerInfo[CapPlayerExtraData.gold] = message.gold;
		return null;
	}

}

public int classID, gold;

public ClassResponsePacket()
{

}

public ClassResponsePacket(int className, int gold)
{
	this.classID = className;
	this.gold = gold;
}

@Override
public void fromBytes(ByteBuf buf)
{
	this.classID = buf.readInt();
	this.gold = buf.readInt();
}

@Override
public void toBytes(ByteBuf buf)
{
	buf.writeInt(this.classID);
	buf.writeInt(this.gold);
}

}

 

 

I'm pulling most of my code from the old 1.8.2 era and trying to touch it up. And this is more or less the same format

 

Oh the packet registery (for the sides, hopefully I have them correct, I do get some action if I use a Console.Out in the request so it's at least going somewhere)

 

		INSTANCE.registerMessage(CapAttributePacketHandler.class, CapAttributePacket.class, packetId++, Side.CLIENT);
	INSTANCE.registerMessage(CapPlayerExtraPacketHandler.class, CapPlayerExtraPacket.class, packetId++,
			Side.CLIENT);
	INSTANCE.registerMessage(CapPlayerUpdateRequestPacketHandler.class, CapPlayerUpdateRequestPacket.class,
			packetId++, Side.SERVER);
	INSTANCE.registerMessage(ClassGUIPacketHandler.class, ClassGUIPacket.class, packetId++, Side.SERVER);
	INSTANCE.registerMessage(ClassRequestPacketHandler.class, ClassRequestPacket.class, packetId++, Side.SERVER);
	INSTANCE.registerMessage(ClassResponsePacketHandler.class, ClassResponsePacket.class, packetId++, Side.CLIENT);
	INSTANCE.registerMessage(ProfessionRequestPacketHandler.class, ProfessionRequestPacket.class, packetId++,
			Side.SERVER);
	INSTANCE.registerMessage(ProfessionResponsePacketHandler.class, ProfessionResponsePacket.class, packetId++,
			Side.CLIENT);

Posted

Packet handlers are run on a separate thread, you must schedule a task to run on the main thread before you can safely interact with normal Minecraft classes. Forge's documentation explains this here.

 

Apart from that, your code looks like it should work. Could you post the

ICapabilityProvider

you attach to players to provide your capability?

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

Posted

[spoiler=CapPlayerExtraProvider]

package htd.rot.capability.playerextra;

import htd.rot.Rot;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.ResourceLocation;
import net.minecraftforge.common.capabilities.Capability;
import net.minecraftforge.common.capabilities.ICapabilityProvider;
import net.minecraftforge.common.capabilities.ICapabilitySerializable;

public class CapPlayerExtraProvider implements ICapabilityProvider, ICapabilitySerializable<NBTTagCompound> 
{

public static final ResourceLocation KEY = new ResourceLocation(Rot.MODID, "htd_playerextra");

private CapPlayerExtraData INSTANCE = new CapPlayerExtraData();

public CapPlayerExtraProvider(EntityLivingBase entity)
{
	INSTANCE.setEntity(entity);
}

@Override
public boolean hasCapability(Capability<?> capability, EnumFacing facing)
{
	return capability == CapPlayerExtra.CAPABILITY;
}

@Override
public <T> T getCapability(Capability<T> capability, EnumFacing facing)
{
	if (capability == CapPlayerExtra.CAPABILITY)return (T)INSTANCE;
	return null;
}

@Override
public NBTTagCompound serializeNBT()
{
	return (NBTTagCompound)CapPlayerExtra.CAPABILITY.writeNBT(INSTANCE, null);
}

@Override
public void deserializeNBT(NBTTagCompound nbt)
{
	CapPlayerExtra.CAPABILITY.readNBT(INSTANCE, null, nbt);
}

}

 

 

I know strangely if I have the Capability randomly assign values to values, and have a full data sync (so server and client are out of sync with different Random.nextInt() values) the client will be updated through the code in the playerTick and livingUpdate events with a simple just fire it off from the server to client (dataChanged() method).

 

So would I have to rewrite some of my packet handlers to appear like this?

 

		@Override
	public IMessage onMessage(ClassGUIPacket message, MessageContext ctx)
	{
		// Open the gui on the server so we can actually do stuff.
		EntityPlayer player = ctx.getServerHandler().playerEntity;
		ctx.getServerHandler().
			playerEntity.
				getServerWorld().
					addScheduledTask(
							new Runnable() {
								public void run()
								{
									player.openGui(Rot.INSTANCE, GuiHandler.CLASS_GUI, player.worldObj, 
											(int) player.posX, 
											(int) player.posY,
											(int) player.posZ);
								}
							});			
		return null;
	}
}

 

Of course if I have a request/repsonse system would I add inside the runnable (task) a "PacketManager.INSTANCE.SendTo()" and just leave my returns as NULL?

Posted

OMG I'm just an idiot

Was switching from an old way how I did things to a new way that I figure would be "easier" to manage the reading/writing of packet buffers and NBT

 

Where I have 3 vars 2 of them are arrays

One set to be a named Index

One Array for Name/Keys

Final Array for stored Data

 

So in the given packet classes

 

I have "props.currentClass" which is my index...

It should have been "props.playerInfo[props.currentClass]"

 

So now i'm changing the indexes to FINAL and making them all CAPS, and will be creating some getter/setter methods

 

EDIT:

 

Thanks for the help, but I still have the question of the

New Runable(SendTo(message,player)) for my request packets to send the response. or any packet for that matter.

Posted

Yes, the return value of

IMessageHandler#onMessage

isn't that useful these days, since you need to do the actual processing asynchronously on the main thread. Just send the response message manually with your

SimpleNetworkWrapper

instance.

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

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

    • Rubidium and Embeddium are versions of the same mod, you can only have one. I believe Embeddium is the one that's actively maintained.
    • Hello, New to modding, but have a solid CS foundation. I've created multiple custom BlockEntities that all have the same issue, which is that the inventory only updates on right click (overriding the useItemOn method). I've seen multiple posts on here outlining a similar issue to mine, but I've already implemented the solution of: overriding the correct methods in the BlockEntity class and calling setChanged(). I've tried every different place for setChanged() to no success. I'm wondering if I'm missing something else or if there was some change to sending data to the client in 1.21.5? Or will I have to use a custom packet sender? Here is the code for one of my BlockEntity classes with a single inventory slot: public class MyCustomBlockEntity extends BlockEntity { public final ItemStackHandler inventory = new ItemStackHandler(1) { @Override protected int getStackLimit(int slot, @NotNull ItemStack stack) { return 1; } @Override protected void onContentsChanged(int slot) { setChanged(); if (!level.isClientSide()) { level.setBlockAndUpdate(getBlockPos(), getBlockState()); } } }; public MyCustomBlockEntity(BlockPos pPos, BlockState pBlockState) { super(ModBlockEntities.MY_CUSTOM_BE.get(), pPos, pBlockState); } public void clearContents() { inventory.setStackInSlot(0, ItemStack.EMPTY); } public void dropItem() { SimpleContainer inv = new SimpleContainer(inventory.getSlots()); inv.setItem(0, inventory.getStackInSlot(0)); Containers.dropContents(this.level, this.worldPosition, inv); } @Override public void setRemoved() { dropItem(); super.setRemoved(); } @Override protected void saveAdditional(CompoundTag pTag, HolderLookup.Provider pRegistries) { super.saveAdditional(pTag, pRegistries); pTag.put("inventory", inventory.serializeNBT(pRegistries)); } @Override protected void loadAdditional(CompoundTag pTag, HolderLookup.Provider pRegistries) { super.loadAdditional(pTag, pRegistries); inventory.deserializeNBT(pRegistries, pTag.getCompound("inventory").get()); } @Override public Packet<ClientGamePacketListener> getUpdatePacket() { return ClientboundBlockEntityDataPacket.create(this); } @Override public CompoundTag getUpdateTag(HolderLookup.Provider pRegistries) { return saveWithoutMetadata(pRegistries); } } Mostly encountering the issue when calling the clearContents() method anywhere outside of useItemOn() in the Block class. I've also tried overriding both the handleUpdateTag() and onDataPacket() methods, calling their super along with loadAdditional(), but neither changed the outcome. Thanks in advance for any replies.
    • Hi all! I’m working on a Jurassic Park-themed mod for Minecraft 1.20.1, aiming to include dinosaurs, fossils, DNA extraction, and cool machines. This is a free project, mainly passion-driven, and I’ll give full credit to everyone involved. this is the perfect opportunity for beginners of modeling and coding. This project will give you experience and a creative freedom If you love dinosaurs and Minecraft modding, hit me up! Thanks! Add Me ogfrost. <--- Discord
    • I'm just really confused. This bug only applies to modpacks made by me. i have tried using different launchers prism, modrinth etc. I have tried with multiple modpacks. All of this has not prevented this bug. Relevant part of log is here: [06Jun2025 16:18:49.882] [main/ERROR] [net.minecraftforge.fml.loading.moddiscovery.ModDiscoverer/SCAN]: Failed to build unique mod list after mod discovery. net.minecraftforge.fml.loading.EarlyLoadingException: Duplicate mods found     at net.minecraftforge.fml.loading.UniqueModListBuilder.buildUniqueList(UniqueModListBuilder.java:87) ~[loader-47.2.2.jar:47.2]     at net.minecraftforge.fml.loading.moddiscovery.ModDiscoverer.discoverMods(ModDiscoverer.java:106) ~[loader-47.2.2.jar:47.2]     at net.minecraftforge.fml.loading.FMLLoader.beginModScan(FMLLoader.java:164) ~[loader-47.2.2.jar:47.2]     at net.minecraftforge.fml.loading.FMLServiceProvider.beginScanning(FMLServiceProvider.java:86) ~[loader-47.2.2.jar:47.2]     at cpw.mods.modlauncher.TransformationServiceDecorator.runScan(TransformationServiceDecorator.java:112) ~[modlauncher-10.0.9.jar:?]     at cpw.mods.modlauncher.TransformationServicesHandler.lambda$runScanningTransformationServices$8(TransformationServicesHandler.java:100) ~[modlauncher-10.0.9.jar:?]     at java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:197) ~[?:?]     at java.util.HashMap$ValueSpliterator.forEachRemaining(HashMap.java:1779) ~[?:?]     at java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:509) ~[?:?]     at java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:499) ~[?:?]     at java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:575) ~[?:?]     at java.util.stream.AbstractPipeline.evaluateToArrayNode(AbstractPipeline.java:260) ~[?:?]     at java.util.stream.ReferencePipeline.toArray(ReferencePipeline.java:616) ~[?:?]     at java.util.stream.ReferencePipeline.toArray(ReferencePipeline.java:622) ~[?:?]     at java.util.stream.ReferencePipeline.toList(ReferencePipeline.java:627) ~[?:?]     at cpw.mods.modlauncher.TransformationServicesHandler.runScanningTransformationServices(TransformationServicesHandler.java:102) ~[modlauncher-10.0.9.jar:?]     at cpw.mods.modlauncher.TransformationServicesHandler.initializeTransformationServices(TransformationServicesHandler.java:55) ~[modlauncher-10.0.9.jar:?]     at cpw.mods.modlauncher.Launcher.run(Launcher.java:88) ~[modlauncher-10.0.9.jar:?]     at cpw.mods.modlauncher.Launcher.main(Launcher.java:78) ~[modlauncher-10.0.9.jar:?]     at cpw.mods.modlauncher.BootstrapLaunchConsumer.accept(BootstrapLaunchConsumer.java:26) ~[modlauncher-10.0.9.jar:?]     at cpw.mods.modlauncher.BootstrapLaunchConsumer.accept(BootstrapLaunchConsumer.java:23) ~[modlauncher-10.0.9.jar:?]     at cpw.mods.bootstraplauncher.BootstrapLauncher.main(BootstrapLauncher.java:141) ~[bootstraplauncher-1.1.2.jar:?]     at jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:?]     at jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77) ~[?:?]     at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:?]     at java.lang.reflect.Method.invoke(Method.java:568) ~[?:?]     at io.github.zekerzhayard.forgewrapper.installer.Main.main(Main.java:67) ~[?:?]     at org.prismlauncher.launcher.impl.StandardLauncher.launch(StandardLauncher.java:105) ~[?:?]     at org.prismlauncher.EntryPoint.listen(EntryPoint.java:129) ~[?:?]     at org.prismlauncher.EntryPoint.main(EntryPoint.java:70) ~[?:?] [06Jun2025 16:18:49.894] [main/ERROR] [net.minecraftforge.fml.loading.moddiscovery.ModDiscoverer/SCAN]: Mod Discovery failed. Skipping dependency discovery.     Full log [06Jun2025 16:18:48.612] [main/INFO] [cpw.mods.modlauncher.Launcher/MODLAUNCHER]: ModLauncher running: args [--username, DeltaBlack_, --version, 1.20.1, --gameDir, C:/Users/sammi/AppData/Roaming/PrismLauncher/instances/SITE 111/minecraft, --assetsDir, C:/Users/sammi/AppData/Roaming/PrismLauncher/assets, --assetIndex, 5, --uuid, 0ff86c0727f444f1a926b954a58d8c44, --accessToken, ????????, --userType, msa, --versionType, release, --launchTarget, forgeclient, --fml.forgeVersion, 47.1.105, --fml.fmlVersion, 47.2.2, --fml.mcVersion, 1.20.1, --fml.mcpVersion, 20230612.114412, --width, 854, --height, 480] [06Jun2025 16:18:48.615] [main/INFO] [cpw.mods.modlauncher.Launcher/MODLAUNCHER]: ModLauncher 10.0.9+10.0.9+main.dcd20f30 starting: java version 17.0.8 by Microsoft; OS Windows 11 arch amd64 version 10.0 [06Jun2025 16:18:49.050] [main/INFO] [net.minecraftforge.fml.loading.ImmediateWindowHandler/]: Loading ImmediateWindowProvider fmlearlywindow [06Jun2025 16:18:49.173] [main/INFO] [EARLYDISPLAY/]: Trying GL version 4.6 [06Jun2025 16:18:49.311] [main/INFO] [EARLYDISPLAY/]: Requested GL version 4.6 got version 4.6 [06Jun2025 16:18:49.496] [main/INFO] [mixin/]: SpongePowered MIXIN Subsystem Version=0.8.5 Source=union:/C:/Users/sammi/AppData/Roaming/PrismLauncher/libraries/org/spongepowered/mixin/0.8.5/mixin-0.8.5.jar%23152!/ Service=ModLauncher Env=CLIENT [06Jun2025 16:18:49.502] [pool-2-thread-1/INFO] [EARLYDISPLAY/]: GL info: AMD Radeon Graphics GL version 4.6.0 Core Profile Context 24.10.21.03.240627, ATI Technologies Inc. [06Jun2025 16:18:49.713] [main/INFO] [net.minecraftforge.fml.loading.moddiscovery.ModDiscoverer/SCAN]: Found mod file "[1.20.1] SecurityCraft v1.10.0.1.jar" of type MOD with provider {mods folder locator at C:\Users\sammi\AppData\Roaming\PrismLauncher\instances\SITE 111\minecraft\mods} [06Jun2025 16:18:49.713] [main/INFO] [net.minecraftforge.fml.loading.moddiscovery.ModDiscoverer/SCAN]: Found mod file "ad_astra-forge-1.20.1-1.15.20.jar" of type MOD with provider {mods folder locator at C:\Users\sammi\AppData\Roaming\PrismLauncher\instances\SITE 111\minecraft\mods} [06Jun2025 16:18:49.713] [main/INFO] [net.minecraftforge.fml.loading.moddiscovery.ModDiscoverer/SCAN]: Found mod file "architectury-9.2.14-forge.jar" of type MOD with provider {mods folder locator at C:\Users\sammi\AppData\Roaming\PrismLauncher\instances\SITE 111\minecraft\mods} [06Jun2025 16:18:49.713] [main/INFO] [net.minecraftforge.fml.loading.moddiscovery.ModDiscoverer/SCAN]: Found mod file "bellsandwhistles-0.4.5-1.20.x-Create6.0+.jar" of type MOD with provider {mods folder locator at C:\Users\sammi\AppData\Roaming\PrismLauncher\instances\SITE 111\minecraft\mods} [06Jun2025 16:18:49.713] [main/INFO] [net.minecraftforge.fml.loading.moddiscovery.ModDiscoverer/SCAN]: Found mod file "botarium-forge-1.20.1-2.3.4.jar" of type MOD with provider {mods folder locator at C:\Users\sammi\AppData\Roaming\PrismLauncher\instances\SITE 111\minecraft\mods} [06Jun2025 16:18:49.713] [main/INFO] [net.minecraftforge.fml.loading.moddiscovery.ModDiscoverer/SCAN]: Found mod file "chloride-FORGE-mc1.20.1-v1.7.2.jar" of type MOD with provider {mods folder locator at C:\Users\sammi\AppData\Roaming\PrismLauncher\instances\SITE 111\minecraft\mods} [06Jun2025 16:18:49.713] [main/INFO] [net.minecraftforge.fml.loading.moddiscovery.ModDiscoverer/SCAN]: Found mod file "copycats-3.0.1+mc.1.20.1-forge.jar" of type MOD with provider {mods folder locator at C:\Users\sammi\AppData\Roaming\PrismLauncher\instances\SITE 111\minecraft\mods} [06Jun2025 16:18:49.713] [main/INFO] [net.minecraftforge.fml.loading.moddiscovery.ModDiscoverer/SCAN]: Found mod file "Create Encased-1.20.1-1.7.1-fix2.jar" of type MOD with provider {mods folder locator at C:\Users\sammi\AppData\Roaming\PrismLauncher\instances\SITE 111\minecraft\mods} [06Jun2025 16:18:49.713] [main/INFO] [net.minecraftforge.fml.loading.moddiscovery.ModDiscoverer/SCAN]: Found mod file "create-1.20.1-6.0.4.jar" of type MOD with provider {mods folder locator at C:\Users\sammi\AppData\Roaming\PrismLauncher\instances\SITE 111\minecraft\mods} [06Jun2025 16:18:49.713] [main/INFO] [net.minecraftforge.fml.loading.moddiscovery.ModDiscoverer/SCAN]: Found mod file "create_enchantment_industry-1.3.2-for-create-6.0.4.jar" of type MOD with provider {mods folder locator at C:\Users\sammi\AppData\Roaming\PrismLauncher\instances\SITE 111\minecraft\mods} [06Jun2025 16:18:49.713] [main/INFO] [net.minecraftforge.fml.loading.moddiscovery.ModDiscoverer/SCAN]: Found mod file "create_security-0.1.2-forge-1.20.1.jar" of type MOD with provider {mods folder locator at C:\Users\sammi\AppData\Roaming\PrismLauncher\instances\SITE 111\minecraft\mods} [06Jun2025 16:18:49.714] [main/INFO] [net.minecraftforge.fml.loading.moddiscovery.ModDiscoverer/SCAN]: Found mod file "createdeco-2.0.3-1.20.1-forge.jar" of type MOD with provider {mods folder locator at C:\Users\sammi\AppData\Roaming\PrismLauncher\instances\SITE 111\minecraft\mods} [06Jun2025 16:18:49.714] [main/INFO] [net.minecraftforge.fml.loading.moddiscovery.ModDiscoverer/SCAN]: Found mod file "createframed-1.20.1-1.6.5.jar" of type MOD with provider {mods folder locator at C:\Users\sammi\AppData\Roaming\PrismLauncher\instances\SITE 111\minecraft\mods} [06Jun2025 16:18:49.714] [main/INFO] [net.minecraftforge.fml.loading.moddiscovery.ModDiscoverer/SCAN]: Found mod file "creategoggles-1.20.1-6.0.0-[FORGE].jar" of type MOD with provider {mods folder locator at C:\Users\sammi\AppData\Roaming\PrismLauncher\instances\SITE 111\minecraft\mods} [06Jun2025 16:18:49.715] [main/INFO] [net.minecraftforge.fml.loading.moddiscovery.ModDiscoverer/SCAN]: Found mod file "Crystal-Clear-2.1-Beta-forge.jar" of type MOD with provider {mods folder locator at C:\Users\sammi\AppData\Roaming\PrismLauncher\instances\SITE 111\minecraft\mods} [06Jun2025 16:18:49.715] [main/INFO] [net.minecraftforge.fml.loading.moddiscovery.ModDiscoverer/SCAN]: Found mod file "design_decor-0.4.0b-1.20.1.jar" of type MOD with provider {mods folder locator at C:\Users\sammi\AppData\Roaming\PrismLauncher\instances\SITE 111\minecraft\mods} [06Jun2025 16:18:49.715] [main/INFO] [net.minecraftforge.fml.loading.moddiscovery.ModDiscoverer/SCAN]: Found mod file "embeddium-0.3.31+mc1.20.1.jar" of type MOD with provider {mods folder locator at C:\Users\sammi\AppData\Roaming\PrismLauncher\instances\SITE 111\minecraft\mods} [06Jun2025 16:18:49.715] [main/INFO] [net.minecraftforge.fml.loading.moddiscovery.ModDiscoverer/SCAN]: Found mod file "entityculling-forge-1.7.4-mc1.20.1.jar" of type MOD with provider {mods folder locator at C:\Users\sammi\AppData\Roaming\PrismLauncher\instances\SITE 111\minecraft\mods} [06Jun2025 16:18:49.715] [main/INFO] [net.minecraftforge.fml.loading.moddiscovery.ModDiscoverer/SCAN]: Found mod file "interiors-0.5.6+forge-mc1.20.1-local.jar" of type MOD with provider {mods folder locator at C:\Users\sammi\AppData\Roaming\PrismLauncher\instances\SITE 111\minecraft\mods} [06Jun2025 16:18:49.715] [main/INFO] [net.minecraftforge.fml.loading.moddiscovery.ModDiscoverer/SCAN]: Found mod file "Jade-1.20.1-Forge-11.13.1.jar" of type MOD with provider {mods folder locator at C:\Users\sammi\AppData\Roaming\PrismLauncher\instances\SITE 111\minecraft\mods} [06Jun2025 16:18:49.715] [main/INFO] [net.minecraftforge.fml.loading.moddiscovery.ModDiscoverer/SCAN]: Found mod file "jei-1.20.1-forge-15.20.0.112.jar" of type MOD with provider {mods folder locator at C:\Users\sammi\AppData\Roaming\PrismLauncher\instances\SITE 111\minecraft\mods} [06Jun2025 16:18:49.715] [main/INFO] [net.minecraftforge.fml.loading.moddiscovery.ModDiscoverer/SCAN]: Found mod file "ManyIdeasCore-1.20.1-1.4.2.jar" of type MOD with provider {mods folder locator at C:\Users\sammi\AppData\Roaming\PrismLauncher\instances\SITE 111\minecraft\mods} [06Jun2025 16:18:49.715] [main/INFO] [net.minecraftforge.fml.loading.moddiscovery.ModDiscoverer/SCAN]: Found mod file "ManyIdeasDoors-1.20.1-1.2.3.jar" of type MOD with provider {mods folder locator at C:\Users\sammi\AppData\Roaming\PrismLauncher\instances\SITE 111\minecraft\mods} [06Jun2025 16:18:49.715] [main/INFO] [net.minecraftforge.fml.loading.moddiscovery.ModDiscoverer/SCAN]: Found mod file "prma-1.20.1-0.4.4-cr6.0-SIMPLE-beta-all.jar" of type MOD with provider {mods folder locator at C:\Users\sammi\AppData\Roaming\PrismLauncher\instances\SITE 111\minecraft\mods} [06Jun2025 16:18:49.715] [main/INFO] [net.minecraftforge.fml.loading.moddiscovery.ModDiscoverer/SCAN]: Found mod file "RecipesLibrary-1.20.1-2.0.1.jar" of type MOD with provider {mods folder locator at C:\Users\sammi\AppData\Roaming\PrismLauncher\instances\SITE 111\minecraft\mods} [06Jun2025 16:18:49.716] [main/INFO] [net.minecraftforge.fml.loading.moddiscovery.ModDiscoverer/SCAN]: Found mod file "resourcefulconfig-forge-1.20.1-2.1.3.jar" of type MOD with provider {mods folder locator at C:\Users\sammi\AppData\Roaming\PrismLauncher\instances\SITE 111\minecraft\mods} [06Jun2025 16:18:49.716] [main/INFO] [net.minecraftforge.fml.loading.moddiscovery.ModDiscoverer/SCAN]: Found mod file "resourcefullib-forge-1.20.1-2.1.29.jar" of type MOD with provider {mods folder locator at C:\Users\sammi\AppData\Roaming\PrismLauncher\instances\SITE 111\minecraft\mods} [06Jun2025 16:18:49.716] [main/INFO] [net.minecraftforge.fml.loading.moddiscovery.ModDiscoverer/SCAN]: Found mod file "rubidium-extra-0.5.4.4+mc1.20.1-build.131.jar" of type MOD with provider {mods folder locator at C:\Users\sammi\AppData\Roaming\PrismLauncher\instances\SITE 111\minecraft\mods} [06Jun2025 16:18:49.716] [main/INFO] [net.minecraftforge.fml.loading.moddiscovery.ModDiscoverer/SCAN]: Found mod file "rubidium-mc1.20.1-0.7.1.jar" of type MOD with provider {mods folder locator at C:\Users\sammi\AppData\Roaming\PrismLauncher\instances\SITE 111\minecraft\mods} [06Jun2025 16:18:49.716] [main/INFO] [net.minecraftforge.fml.loading.moddiscovery.ModDiscoverer/SCAN]: Found mod file "skinlayers3d-forge-1.7.5-mc1.20.1.jar" of type MOD with provider {mods folder locator at C:\Users\sammi\AppData\Roaming\PrismLauncher\instances\SITE 111\minecraft\mods} [06Jun2025 16:18:49.716] [main/INFO] [net.minecraftforge.fml.loading.moddiscovery.ModDiscoverer/SCAN]: Found mod file "Steam_Rails-1.6.7+forge-mc1.20.1.jar" of type MOD with provider {mods folder locator at C:\Users\sammi\AppData\Roaming\PrismLauncher\instances\SITE 111\minecraft\mods} [06Jun2025 16:18:49.716] [main/INFO] [net.minecraftforge.fml.loading.moddiscovery.ModDiscoverer/SCAN]: Found mod file "tacz-1.20.1-1.1.5.jar" of type MOD with provider {mods folder locator at C:\Users\sammi\AppData\Roaming\PrismLauncher\instances\SITE 111\minecraft\mods} [06Jun2025 16:18:49.716] [main/INFO] [net.minecraftforge.fml.loading.moddiscovery.ModDiscoverer/SCAN]: Found mod file "Xaeros_Minimap_25.2.6_Forge_1.20.jar" of type MOD with provider {mods folder locator at C:\Users\sammi\AppData\Roaming\PrismLauncher\instances\SITE 111\minecraft\mods} [06Jun2025 16:18:49.716] [main/INFO] [net.minecraftforge.fml.loading.moddiscovery.ModDiscoverer/SCAN]: Found mod file "XaerosWorldMap_1.39.9_Forge_1.20.jar" of type MOD with provider {mods folder locator at C:\Users\sammi\AppData\Roaming\PrismLauncher\instances\SITE 111\minecraft\mods} [06Jun2025 16:18:49.853] [main/WARN] [net.minecraftforge.fml.loading.moddiscovery.ModFileParser/LOADING]: Mod file C:\Users\sammi\AppData\Roaming\PrismLauncher\libraries\net\neoforged\fancymodloader\core\47.2.2\core-47.2.2.jar is missing mods.toml file [06Jun2025 16:18:49.856] [main/WARN] [net.minecraftforge.fml.loading.moddiscovery.ModFileParser/LOADING]: Mod file C:\Users\sammi\AppData\Roaming\PrismLauncher\libraries\net\neoforged\fancymodloader\language-java\47.2.2\language-java-47.2.2.jar is missing mods.toml file [06Jun2025 16:18:49.858] [main/WARN] [net.minecraftforge.fml.loading.moddiscovery.ModFileParser/LOADING]: Mod file C:\Users\sammi\AppData\Roaming\PrismLauncher\libraries\net\neoforged\fancymodloader\language-lowcode\47.2.2\language-lowcode-47.2.2.jar is missing mods.toml file [06Jun2025 16:18:49.861] [main/WARN] [net.minecraftforge.fml.loading.moddiscovery.ModFileParser/LOADING]: Mod file C:\Users\sammi\AppData\Roaming\PrismLauncher\libraries\net\neoforged\fancymodloader\language-minecraft\47.2.2\language-minecraft-47.2.2.jar is missing mods.toml file [06Jun2025 16:18:49.866] [main/INFO] [net.minecraftforge.fml.loading.moddiscovery.ModDiscoverer/SCAN]: Found mod file "core-47.2.2.jar" of type LIBRARY with provider net.minecraftforge.fml.loading.moddiscovery.MinecraftLocator@3c2fa57a [06Jun2025 16:18:49.867] [main/INFO] [net.minecraftforge.fml.loading.moddiscovery.ModDiscoverer/SCAN]: Found mod file "language-java-47.2.2.jar" of type LANGPROVIDER with provider net.minecraftforge.fml.loading.moddiscovery.MinecraftLocator@3c2fa57a [06Jun2025 16:18:49.867] [main/INFO] [net.minecraftforge.fml.loading.moddiscovery.ModDiscoverer/SCAN]: Found mod file "language-lowcode-47.2.2.jar" of type LANGPROVIDER with provider net.minecraftforge.fml.loading.moddiscovery.MinecraftLocator@3c2fa57a [06Jun2025 16:18:49.867] [main/INFO] [net.minecraftforge.fml.loading.moddiscovery.ModDiscoverer/SCAN]: Found mod file "language-minecraft-47.2.2.jar" of type LANGPROVIDER with provider net.minecraftforge.fml.loading.moddiscovery.MinecraftLocator@3c2fa57a [06Jun2025 16:18:49.867] [main/INFO] [net.minecraftforge.fml.loading.moddiscovery.ModDiscoverer/SCAN]: Found mod file "client-1.20.1-20230612.114412-srg.jar" of type MOD with provider net.minecraftforge.fml.loading.moddiscovery.MinecraftLocator@3c2fa57a [06Jun2025 16:18:49.867] [main/INFO] [net.minecraftforge.fml.loading.moddiscovery.ModDiscoverer/SCAN]: Found mod file "forge-1.20.1-47.1.105-universal.jar" of type MOD with provider net.minecraftforge.fml.loading.moddiscovery.MinecraftLocator@3c2fa57a [06Jun2025 16:18:49.872] [main/INFO] [net.minecraftforge.fml.loading.moddiscovery.ModDiscoverer/SCAN]: Found mod file "events-47.2.2.jar" of type GAMELIBRARY with provider net.minecraftforge.fml.loading.moddiscovery.BuiltinGameLibraryLocator@38834000 [06Jun2025 16:18:49.881] [main/ERROR] [net.minecraftforge.fml.loading.UniqueModListBuilder/LOADING]: Found duplicate mods:     Mod ID: 'rubidium' from mod files: rubidium-mc1.20.1-0.7.1.jar, embeddium-0.3.31+mc1.20.1.jar [06Jun2025 16:18:49.882] [main/ERROR] [net.minecraftforge.fml.loading.moddiscovery.ModDiscoverer/SCAN]: Failed to build unique mod list after mod discovery. net.minecraftforge.fml.loading.EarlyLoadingException: Duplicate mods found     at net.minecraftforge.fml.loading.UniqueModListBuilder.buildUniqueList(UniqueModListBuilder.java:87) ~[loader-47.2.2.jar:47.2]     at net.minecraftforge.fml.loading.moddiscovery.ModDiscoverer.discoverMods(ModDiscoverer.java:106) ~[loader-47.2.2.jar:47.2]     at net.minecraftforge.fml.loading.FMLLoader.beginModScan(FMLLoader.java:164) ~[loader-47.2.2.jar:47.2]     at net.minecraftforge.fml.loading.FMLServiceProvider.beginScanning(FMLServiceProvider.java:86) ~[loader-47.2.2.jar:47.2]     at cpw.mods.modlauncher.TransformationServiceDecorator.runScan(TransformationServiceDecorator.java:112) ~[modlauncher-10.0.9.jar:?]     at cpw.mods.modlauncher.TransformationServicesHandler.lambda$runScanningTransformationServices$8(TransformationServicesHandler.java:100) ~[modlauncher-10.0.9.jar:?]     at java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:197) ~[?:?]     at java.util.HashMap$ValueSpliterator.forEachRemaining(HashMap.java:1779) ~[?:?]     at java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:509) ~[?:?]     at java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:499) ~[?:?]     at java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:575) ~[?:?]     at java.util.stream.AbstractPipeline.evaluateToArrayNode(AbstractPipeline.java:260) ~[?:?]     at java.util.stream.ReferencePipeline.toArray(ReferencePipeline.java:616) ~[?:?]     at java.util.stream.ReferencePipeline.toArray(ReferencePipeline.java:622) ~[?:?]     at java.util.stream.ReferencePipeline.toList(ReferencePipeline.java:627) ~[?:?]     at cpw.mods.modlauncher.TransformationServicesHandler.runScanningTransformationServices(TransformationServicesHandler.java:102) ~[modlauncher-10.0.9.jar:?]     at cpw.mods.modlauncher.TransformationServicesHandler.initializeTransformationServices(TransformationServicesHandler.java:55) ~[modlauncher-10.0.9.jar:?]     at cpw.mods.modlauncher.Launcher.run(Launcher.java:88) ~[modlauncher-10.0.9.jar:?]     at cpw.mods.modlauncher.Launcher.main(Launcher.java:78) ~[modlauncher-10.0.9.jar:?]     at cpw.mods.modlauncher.BootstrapLaunchConsumer.accept(BootstrapLaunchConsumer.java:26) ~[modlauncher-10.0.9.jar:?]     at cpw.mods.modlauncher.BootstrapLaunchConsumer.accept(BootstrapLaunchConsumer.java:23) ~[modlauncher-10.0.9.jar:?]     at cpw.mods.bootstraplauncher.BootstrapLauncher.main(BootstrapLauncher.java:141) ~[bootstraplauncher-1.1.2.jar:?]     at jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:?]     at jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77) ~[?:?]     at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:?]     at java.lang.reflect.Method.invoke(Method.java:568) ~[?:?]     at io.github.zekerzhayard.forgewrapper.installer.Main.main(Main.java:67) ~[?:?]     at org.prismlauncher.launcher.impl.StandardLauncher.launch(StandardLauncher.java:105) ~[?:?]     at org.prismlauncher.EntryPoint.listen(EntryPoint.java:129) ~[?:?]     at org.prismlauncher.EntryPoint.main(EntryPoint.java:70) ~[?:?] [06Jun2025 16:18:49.894] [main/ERROR] [net.minecraftforge.fml.loading.moddiscovery.ModDiscoverer/SCAN]: Mod Discovery failed. Skipping dependency discovery.    
    • I've just started modding, and I'm trying to make custom swords. When I try to import SwordItem, I get the error:  What confuses me is that other item classes work fine: package io.github.xxx.denseswords.item; import io.github.xxx.denseswords.DenseSwords; import net.minecraft.world.item.Item; // works fine import net.minecraft.world.item.ShovelItem; // works fine import net.minecraft.world.item.SwordItem; // Error: The import cannot be resolved import net.minecraftforge.registries.DeferredRegister; import net.minecraftforge.registries.RegistryObject; Forge MDK v55.0.15 - Minecraft 1.21.5 Java v24.0.1 Windows 11 IDE: Visual Studio Code
  • Topics

×
×
  • Create New...

Important Information

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