Jump to content

Recommended Posts

Posted

I'm trying to port the ClaySoldiersMod to 1.3.1 incl. MP compatibility. For stuff which should be shown on the clay soldier (like the stick weapon) will be handled per dataWatcher. Now I ran into a problem: the dataWatcher instance from the entity supports only 32 fields and 18 fields are already occupied for vanilla stuff. But I need more than 13 fields for the little clay soldier.

So I decided to make my own dataWatcher instance, which is called "clayWatcher". The problem is that the clayWatcher fields are only updated when they spawn with this code:

 

@Override
public void writeSpawnData(ByteArrayDataOutput data) {
	ByteArrayOutputStream bos = new ByteArrayOutputStream();
        DataOutputStream dos = new DataOutputStream(bos);
        try
        {
            this.clayWatcher.writeWatchableObjects(dos);
        }
        catch (IOException e)
        {
            // unpossible
        }

        data.write(bos.toByteArray());
}

@Override
public void readSpawnData(ByteArrayDataInput data) {
	byte[] ByteArr = new byte[33];		
	ByteArrayInputStream bis = new ByteArrayInputStream(ByteArr);
	DataInputStream dis = new DataInputStream(bis);
	List metadata = null;
	try
        {
            metadata = DataWatcher.readWatchableObjects(dis);
        }
        catch (IOException e)
        {
            // Nope
        }

        if (metadata != null)
        {
            this.clayWatcher.updateWatchedObjectsFromList((List)metadata);
        }
}

 

I want to make that the fields are updated while playing, like the dataWatcher, but I don't know how to do that. I probably have to send my own packets, but I don't know how because I never worked with packets before.

So if someone can show me what I have to do or where I can look, I would be very thankful.

 

 

Thanks in advance.

 

 

EDIT: I will use bitflags for my booleans now to decrease the amount of needed dataWatcher objects. Also the superclasses of my entity (EntityCreature->EntityLiving->Entity) occupy only 3 (instead of 18 which I thought) objects: index 0, 1 and 8.

Don't ask for support per PM! They'll get ignored! | If a post helped you, click the "Thank You" button at the top right corner of said post! |

mah twitter

This thread makes me sad because people just post copy-paste-ready code when it's obvious that the OP has little to no programming experience. This is not how learning works.

Posted

How exactly are 18 taken up[ by vanilla items?

Also, That seems like a horrible idea to have so many objects synced between client and server.

You may need a re-design to lower that number. What exactly are you watching?

I do Forge for free, however the servers to run it arn't free, so anything is appreciated.
Consider supporting the team on Patreon

Posted

How exactly are 18 taken up[ by vanilla items?

Also, That seems like a horrible idea to have so many objects synced between client and server.

You may need a re-design to lower that number. What exactly are you watching?

 

1. ups, I saw a tutorial somewhere for dataWatchers which said that 18 are occupied by the superclasses (EntityCreature->EntityLiving->Entity). I've looked into these now and occupied are, as far as I saw, only 0, 1 and 8.

2. I would never use so many if I need those, but I looked in some classes which send the dataWatcher and it seems the dataWatcher will be send completely with all 32 possible fields, so it souldn't be that horrible. Please correct me if I'm wrong :P

3. Here's a list what I have to watch:

 

  • team color (value for texture picking)
  • if it has a stick and how many uses it has (one value)
  • if it has a blaze rod and how many uses it has (one value)
  • if the soldier has a crown
  • if the soldier has a cape
  • if a feather is deployed (when the soldier falls and has a feather)
  • if the soldier has gunpowder
  • if it has armor and how many "uses" it has(one value)
  • if the stick is sharpened
  • if it's glued to the ground and how long this effect works (one value)
  • if it has gravel
  • if it has snowballs
  • if it has firecharges
  • if it has a shield
  • if it has a bone and how many uses it has
  • if it has a studded shield
  • if it's camouflaged
  • if it has blaze powder

 

These are needed, because they will be rendered from the soldier, for example if it has a blaze rod, it renders a blaze rod in its hand.

I could put all these boolean stuff into one [short] field and access them with bitwise operators, but I just want to test stuff out before I improve the coding.

 

But thank you for opening me the eyes because of these occupied dataWatchers. For now I can use more.

Don't ask for support per PM! They'll get ignored! | If a post helped you, click the "Thank You" button at the top right corner of said post! |

mah twitter

This thread makes me sad because people just post copy-paste-ready code when it's obvious that the OP has little to no programming experience. This is not how learning works.

Posted

You should use Bitflags for all the booleans.

 

1 Byte = 8 bits = 00000000

 

1. bit = if it has gravel

2. bit = if it has snowballs

3  bit = if it has firecharges

4. bit = if it has a shield

5. bit = if it has a bone and how many uses it has

6. bit = if it has a studded shield

7. bit = if it's camouflaged

8. bit = if it has blaze powder

 

How to set and get single bits: http://www.vipan.com/htdocs/bitwisehelp.html

(couldn't find a better tutorial and it looks harder than it really is)

 

Just use bitwiseOperaters.

 

Posted

You should use Bitflags for all the booleans.

 

1 Byte = 8 bits = 00000000

 

1. bit = if it has gravel

2. bit = if it has snowballs

3  bit = if it has firecharges

4. bit = if it has a shield

5. bit = if it has a bone and how many uses it has

6. bit = if it has a studded shield

7. bit = if it's camouflaged

8. bit = if it has blaze powder

 

How to set and get single bits: http://www.vipan.com/htdocs/bitwisehelp.html

(couldn't find a better tutorial and it looks harder than it really is)

 

Just use bitwiseOperaters.

 

I know how to use bitwise stuff, but thanks :)

Yes, I think I'll stick with bitflags for all my booleans.

Don't ask for support per PM! They'll get ignored! | If a post helped you, click the "Thank You" button at the top right corner of said post! |

mah twitter

This thread makes me sad because people just post copy-paste-ready code when it's obvious that the OP has little to no programming experience. This is not how learning works.

Posted

For example, my TF2 dispenser mod uses a byte "options"

 

1. bit = heal player

2. bit = feed player

3. bit = repair players tool

4. bit = neutralize effects

 

In my TileEntity I'm using custom packets, but in your Entity you can use datawatcher instead :)

 

 

package net.minecraft.src;

import java.util.ArrayList;

public class TileEntityTF2Dispenser extends TileEntity implements IInventory
{

private ItemStack itemStack;
public int energy;
private int counter;
private int delay;
public int maxEnergy;
private boolean spawnBeam;
private Packet230ModLoader packet;
// ModelTF2Dispenser model;

// effects, repair, feed, heal
public byte options;

public TileEntityTF2Dispenser()
{
	// model = new ModelTF2Dispenser();
	energy = 0;
	options = 7;
	counter = 0;
	spawnBeam = false;
	delay = 20;
	packet = new Packet230ModLoader();
	packet.packetType = 0;
	int[] data =
	{ xCoord, yCoord, zCoord, energy, maxEnergy, options };
	packet.dataInt = data;
	packet.modId = ModLoaderMp.getModInstance(mod_TF2Dispenser.class).getId();
}

public void updateEntity()
{

	boolean flag = isActive();
	boolean flag1 = false;
	ArrayList<EntityPlayer> players = anyPlayerInRange();
	ArrayList<EntityPlayer> beams = new ArrayList<EntityPlayer>();
	++counter;

	if (counter > delay)
	{
		if (flag)
		{
			for (EntityPlayer player : players)
			{
				spawnBeam = false;
				if (player != null && canPlayerUseDispenser(player))
				{
					if (player.isBurning())
					{
						player.extinguish();
						spawnBeam = true;
					}

					if ((options & 1) == 1)
					{
						spawnBeam = heal(player) || spawnBeam;
					}
					if ((options & 2) == 2)
					{
						spawnBeam = feed(player) || spawnBeam;
					}
					if ((options & 4) == 4)
					{
						spawnBeam = repair(player) || spawnBeam;
					}
					if ((options &  == 
					{
						spawnBeam = neutralize(player) || spawnBeam;
					}
				}
				if(spawnBeam == true){
					beams.add(player);
				}
			}
		}

		if (!isActive() && itemStack != null)
		{
			fillUp();

		}

		if (flag != isActive())
		{
			flag1 = true;
			BlockTF2Dispenser.updateBlockState(energy > 0, worldObj, xCoord, yCoord, zCoord);
		}

		if (flag1)
		{
			onInventoryChanged();
		}
		counter = 0;
	}

	if (!beams.isEmpty() && flag && counter % 4 == 0 && options > 0)
	{
		mod_TF2Dispenser.sendSpawnBeam(players, this);
	}

	// { xCoord, yCoord, zCoord, energy, maxEnergy, options };

	if (packet.dataInt[3] != energy || packet.dataInt[5] != options)
	{
		sendUpdatePacket();
	}

}

private boolean canPlayerUseDispenser(EntityPlayer player)
{
	if(mod_TF2Dispenser.teamsEnabled){

		try{
			if (!isRed() )
			{
				if(mod_TF2TeamAddon.isPlayerInTeam(player.username, false)){
					return false;
				}
			}else{
				if(mod_TF2TeamAddon.isPlayerInTeam(player.username, true)){
					return false;
				}
			}
		}catch(Exception e){

		}
	}
	return true;
}

public void sendUpdatePacket()
{
//		System.out.println("send te");
	int[] data =
	{ xCoord, yCoord, zCoord, energy, maxEnergy, options };
	packet.dataInt = data;
	mod_TF2Dispenser.sendPacketToClosestPlayers(this, packet);

}

private void fillUp()
{
	int value = 0;
	if (itemStack.itemID == Item.ingotIron.shiftedIndex)
	{
		value = 100;

	} else if (itemStack.itemID == Item.ingotGold.shiftedIndex)
	{
		value = 200;

	} else if (itemStack.itemID == Item.diamond.shiftedIndex)
	{
		value = 800;

	}
	if (value != 0)
	{
		energy = maxEnergy = value;
		--itemStack.stackSize;
		if (itemStack.stackSize <= 0)
		{
			itemStack = null;
		}
		worldObj.playSoundEffect(xCoord, yCoord, zCoord, "TF2.dispenser.fillUp", mod_TF2Dispenser.fillUpVolume, 1F);
	}

}

private boolean heal(EntityPlayer player)
{
	if (player.getHealth() < player.getMaxHealth())
	{
		player.heal(1);
		energy -= 2;
		return true;
	}
	return false;
}

private boolean feed(EntityPlayer player)
{
	if (player.getFoodStats().needFood())
	{
		player.getFoodStats().addStats(1, 0.2f);
		energy -= 2;
		return true;
	}
	return false;

}

private boolean repair(EntityPlayer player)
{
	ItemStack item = player.getCurrentEquippedItem();
	if (item != null && item.isItemDamaged())
	{
		if (item.getItemDamage() - 50 > 0)
		{
			item.damageItem(-50, player);
		} else
		{
			item.setItemDamage(0);
		}
		energy -= energy >= 15 ? 15 : energy;

		return true;
	}
	return false;

}

private boolean neutralize(EntityPlayer player)
{
	if (!player.getActivePotionEffects().isEmpty())
	{

		player.clearActivePotions();
		energy -= 10;
		return true;
	}
	return false;
}

// @Override
// public Packet getDescriptionPacket()
// {
// // System.out.println("send");
//
//
//
// return packet;
// }

public boolean isRed()
{
	return worldObj.getBlockMetadata(xCoord, yCoord, zCoord) > 7 ? true : false;
}

public void readFromNBT(NBTTagCompound par1NBTTagCompound)
{
	super.readFromNBT(par1NBTTagCompound);

	NBTTagCompound nbttagcompound = par1NBTTagCompound.getCompoundTag("Item");
	itemStack = ItemStack.loadItemStackFromNBT(nbttagcompound);

	energy = par1NBTTagCompound.getInteger("Energy");
	maxEnergy = par1NBTTagCompound.getInteger("MaxEnergy");
	options = par1NBTTagCompound.getByte("Options");

}

public void writeToNBT(NBTTagCompound par1NBTTagCompound)
{
	super.writeToNBT(par1NBTTagCompound);
	par1NBTTagCompound.setInteger("Energy", energy);
	par1NBTTagCompound.setInteger("MaxEnergy", maxEnergy);
	par1NBTTagCompound.setByte("Options", options);

	if (itemStack != null)
	{
		par1NBTTagCompound.setCompoundTag("Item", itemStack.writeToNBT(new NBTTagCompound()));

	}
}

public ArrayList<EntityPlayer> anyPlayerInRange()
{
	ArrayList<EntityPlayer> players = new ArrayList<EntityPlayer>();

	for (int i = 0; i < worldObj.playerEntities.size(); i++)
	{
		EntityPlayer entityplayer1 = (EntityPlayer) worldObj.playerEntities.get(i);
		double d1 = entityplayer1.getDistanceSq(xCoord + 0.5, yCoord + 0.5, zCoord + 0.5);

		if ((5 < 0.0D || d1 < 15))
		{
			players.add(entityplayer1);
		}
	}

	return (ArrayList<EntityPlayer>) players.clone();
}

public int getSizeInventory()
{
	return 1;
}

public ItemStack getStackInSlot(int i)
{
	return itemStack;
}

public ItemStack decrStackSize(int i, int j)
{
	if (itemStack != null)
	{
		if (itemStack.stackSize <= j)
		{
			ItemStack itemstack = itemStack;
			itemStack = null;
			return itemstack;
		}

		ItemStack itemstack1 = itemStack.splitStack(j);

		if (itemStack.stackSize == 0)
		{
			itemStack = null;
		}

		return itemstack1;
	} else
	{
		return null;
	}
}

public void setInventorySlotContents(int i, ItemStack par2ItemStack)
{
	itemStack = par2ItemStack;

	if (par2ItemStack != null && par2ItemStack.stackSize > getInventoryStackLimit())
	{
		par2ItemStack.stackSize = getInventoryStackLimit();
	}

}

public String getInvName()
{
	return "TF2 Dispenser";
}

public int getInventoryStackLimit()
{

	return 64;
}

public int getMaxEnergie()
{
	return maxEnergy;
}

@Override
public ItemStack getStackInSlotOnClosing(int par1)
{
	if (itemStack != null)
	{
		ItemStack itemstack = itemStack;
		itemStack = null;
		return itemstack;
	} else
	{
		return null;
	}
}

@Override
public boolean isUseableByPlayer(EntityPlayer entityplayer)
{
	if (worldObj.getBlockTileEntity(xCoord, yCoord, zCoord) != this)
	{
		return false;
	}
	return entityplayer.getDistanceSq((double) xCoord + 0.5D, (double) yCoord + 0.5D, (double) zCoord + 0.5D) <= 64D;
}

public boolean isActive()
{
	return energy > 0;
}

@Override
public void openChest()
{
	// TODO Auto-generated method stub

}

@Override
public void closeChest()
{
	// TODO Auto-generated method stub

}

}

 

Posted

For example, my TF2 dispenser mod uses a byte "options"

 

1. bit = heal player

2. bit = feed player

3. bit = repair players tool

4. bit = neutralize effects

 

In my TileEntity I'm using custom packets, but in your Entity you can use datawatcher instead :)

 

 

package net.minecraft.src;

import java.util.ArrayList;

public class TileEntityTF2Dispenser extends TileEntity implements IInventory
{

private ItemStack itemStack;
public int energy;
private int counter;
private int delay;
public int maxEnergy;
private boolean spawnBeam;
private Packet230ModLoader packet;
// ModelTF2Dispenser model;

// effects, repair, feed, heal
public byte options;

public TileEntityTF2Dispenser()
{
	// model = new ModelTF2Dispenser();
	energy = 0;
	options = 7;
	counter = 0;
	spawnBeam = false;
	delay = 20;
	packet = new Packet230ModLoader();
	packet.packetType = 0;
	int[] data =
	{ xCoord, yCoord, zCoord, energy, maxEnergy, options };
	packet.dataInt = data;
	packet.modId = ModLoaderMp.getModInstance(mod_TF2Dispenser.class).getId();
}

public void updateEntity()
{

	boolean flag = isActive();
	boolean flag1 = false;
	ArrayList<EntityPlayer> players = anyPlayerInRange();
	ArrayList<EntityPlayer> beams = new ArrayList<EntityPlayer>();
	++counter;

	if (counter > delay)
	{
		if (flag)
		{
			for (EntityPlayer player : players)
			{
				spawnBeam = false;
				if (player != null && canPlayerUseDispenser(player))
				{
					if (player.isBurning())
					{
						player.extinguish();
						spawnBeam = true;
					}

					if ((options & 1) == 1)
					{
						spawnBeam = heal(player) || spawnBeam;
					}
					if ((options & 2) == 2)
					{
						spawnBeam = feed(player) || spawnBeam;
					}
					if ((options & 4) == 4)
					{
						spawnBeam = repair(player) || spawnBeam;
					}
					if ((options &  == 
					{
						spawnBeam = neutralize(player) || spawnBeam;
					}
				}
				if(spawnBeam == true){
					beams.add(player);
				}
			}
		}

		if (!isActive() && itemStack != null)
		{
			fillUp();

		}

		if (flag != isActive())
		{
			flag1 = true;
			BlockTF2Dispenser.updateBlockState(energy > 0, worldObj, xCoord, yCoord, zCoord);
		}

		if (flag1)
		{
			onInventoryChanged();
		}
		counter = 0;
	}

	if (!beams.isEmpty() && flag && counter % 4 == 0 && options > 0)
	{
		mod_TF2Dispenser.sendSpawnBeam(players, this);
	}

	// { xCoord, yCoord, zCoord, energy, maxEnergy, options };

	if (packet.dataInt[3] != energy || packet.dataInt[5] != options)
	{
		sendUpdatePacket();
	}

}

private boolean canPlayerUseDispenser(EntityPlayer player)
{
	if(mod_TF2Dispenser.teamsEnabled){

		try{
			if (!isRed() )
			{
				if(mod_TF2TeamAddon.isPlayerInTeam(player.username, false)){
					return false;
				}
			}else{
				if(mod_TF2TeamAddon.isPlayerInTeam(player.username, true)){
					return false;
				}
			}
		}catch(Exception e){

		}
	}
	return true;
}

public void sendUpdatePacket()
{
//		System.out.println("send te");
	int[] data =
	{ xCoord, yCoord, zCoord, energy, maxEnergy, options };
	packet.dataInt = data;
	mod_TF2Dispenser.sendPacketToClosestPlayers(this, packet);

}

private void fillUp()
{
	int value = 0;
	if (itemStack.itemID == Item.ingotIron.shiftedIndex)
	{
		value = 100;

	} else if (itemStack.itemID == Item.ingotGold.shiftedIndex)
	{
		value = 200;

	} else if (itemStack.itemID == Item.diamond.shiftedIndex)
	{
		value = 800;

	}
	if (value != 0)
	{
		energy = maxEnergy = value;
		--itemStack.stackSize;
		if (itemStack.stackSize <= 0)
		{
			itemStack = null;
		}
		worldObj.playSoundEffect(xCoord, yCoord, zCoord, "TF2.dispenser.fillUp", mod_TF2Dispenser.fillUpVolume, 1F);
	}

}

private boolean heal(EntityPlayer player)
{
	if (player.getHealth() < player.getMaxHealth())
	{
		player.heal(1);
		energy -= 2;
		return true;
	}
	return false;
}

private boolean feed(EntityPlayer player)
{
	if (player.getFoodStats().needFood())
	{
		player.getFoodStats().addStats(1, 0.2f);
		energy -= 2;
		return true;
	}
	return false;

}

private boolean repair(EntityPlayer player)
{
	ItemStack item = player.getCurrentEquippedItem();
	if (item != null && item.isItemDamaged())
	{
		if (item.getItemDamage() - 50 > 0)
		{
			item.damageItem(-50, player);
		} else
		{
			item.setItemDamage(0);
		}
		energy -= energy >= 15 ? 15 : energy;

		return true;
	}
	return false;

}

private boolean neutralize(EntityPlayer player)
{
	if (!player.getActivePotionEffects().isEmpty())
	{

		player.clearActivePotions();
		energy -= 10;
		return true;
	}
	return false;
}

// @Override
// public Packet getDescriptionPacket()
// {
// // System.out.println("send");
//
//
//
// return packet;
// }

public boolean isRed()
{
	return worldObj.getBlockMetadata(xCoord, yCoord, zCoord) > 7 ? true : false;
}

public void readFromNBT(NBTTagCompound par1NBTTagCompound)
{
	super.readFromNBT(par1NBTTagCompound);

	NBTTagCompound nbttagcompound = par1NBTTagCompound.getCompoundTag("Item");
	itemStack = ItemStack.loadItemStackFromNBT(nbttagcompound);

	energy = par1NBTTagCompound.getInteger("Energy");
	maxEnergy = par1NBTTagCompound.getInteger("MaxEnergy");
	options = par1NBTTagCompound.getByte("Options");

}

public void writeToNBT(NBTTagCompound par1NBTTagCompound)
{
	super.writeToNBT(par1NBTTagCompound);
	par1NBTTagCompound.setInteger("Energy", energy);
	par1NBTTagCompound.setInteger("MaxEnergy", maxEnergy);
	par1NBTTagCompound.setByte("Options", options);

	if (itemStack != null)
	{
		par1NBTTagCompound.setCompoundTag("Item", itemStack.writeToNBT(new NBTTagCompound()));

	}
}

public ArrayList<EntityPlayer> anyPlayerInRange()
{
	ArrayList<EntityPlayer> players = new ArrayList<EntityPlayer>();

	for (int i = 0; i < worldObj.playerEntities.size(); i++)
	{
		EntityPlayer entityplayer1 = (EntityPlayer) worldObj.playerEntities.get(i);
		double d1 = entityplayer1.getDistanceSq(xCoord + 0.5, yCoord + 0.5, zCoord + 0.5);

		if ((5 < 0.0D || d1 < 15))
		{
			players.add(entityplayer1);
		}
	}

	return (ArrayList<EntityPlayer>) players.clone();
}

public int getSizeInventory()
{
	return 1;
}

public ItemStack getStackInSlot(int i)
{
	return itemStack;
}

public ItemStack decrStackSize(int i, int j)
{
	if (itemStack != null)
	{
		if (itemStack.stackSize <= j)
		{
			ItemStack itemstack = itemStack;
			itemStack = null;
			return itemstack;
		}

		ItemStack itemstack1 = itemStack.splitStack(j);

		if (itemStack.stackSize == 0)
		{
			itemStack = null;
		}

		return itemstack1;
	} else
	{
		return null;
	}
}

public void setInventorySlotContents(int i, ItemStack par2ItemStack)
{
	itemStack = par2ItemStack;

	if (par2ItemStack != null && par2ItemStack.stackSize > getInventoryStackLimit())
	{
		par2ItemStack.stackSize = getInventoryStackLimit();
	}

}

public String getInvName()
{
	return "TF2 Dispenser";
}

public int getInventoryStackLimit()
{

	return 64;
}

public int getMaxEnergie()
{
	return maxEnergy;
}

@Override
public ItemStack getStackInSlotOnClosing(int par1)
{
	if (itemStack != null)
	{
		ItemStack itemstack = itemStack;
		itemStack = null;
		return itemstack;
	} else
	{
		return null;
	}
}

@Override
public boolean isUseableByPlayer(EntityPlayer entityplayer)
{
	if (worldObj.getBlockTileEntity(xCoord, yCoord, zCoord) != this)
	{
		return false;
	}
	return entityplayer.getDistanceSq((double) xCoord + 0.5D, (double) yCoord + 0.5D, (double) zCoord + 0.5D) <= 64D;
}

public boolean isActive()
{
	return energy > 0;
}

@Override
public void openChest()
{
	// TODO Auto-generated method stub

}

@Override
public void closeChest()
{
	// TODO Auto-generated method stub

}

}

 

 

Well, I think I'll stick with a short datatype, because I have some more booleans to handle than 8 ^^

Don't ask for support per PM! They'll get ignored! | If a post helped you, click the "Thank You" button at the top right corner of said post! |

mah twitter

This thread makes me sad because people just post copy-paste-ready code when it's obvious that the OP has little to no programming experience. This is not how learning works.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

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

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

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

×   Your previous content has been restored.   Clear editor

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

Announcements



  • Recently Browsing

    • No registered users viewing this page.
  • Posts

    • I'm testing a modpack for a server, and everything is fine, until I update the Aether mod from version "aether-1.20.1-1.4.2-neoforge" to version "aether-1.20.1-1.5.1-neoforge" now on the server it gives the error: Failed to load datapacks, can't proceed with server load. You can either fix your datapacks or reset to vanilla with --safeMode but in the game it says something different (scroll down) [21Nov2024 15:58:50.673] [main/WARN] [net.minecraft.server.Main/]: Failed to load datapacks, can't proceed with server load. You can either fix your datapacks or reset to vanilla with --safeMode 2002java.util.concurrent.ExecutionException: java.lang.IllegalStateException: Failed to load registries due to above errors 2003at java.util.concurrent.CompletableFuture.reportGet(CompletableFuture.java:396) ~[?:?] 2004at java.util.concurrent.CompletableFuture.get(CompletableFuture.java:2073) ~[?:?] 2005at net.minecraft.server.Main.main(Main.java:195) ~[server-1.20.1-20230612.114412-srg.jar%23535!/:?] 2006at jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:?] 2007at jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77) ~[?:?] 2008at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:?] 2009at java.lang.reflect.Method.invoke(Method.java:568) ~[?:?] 2010at net.minecraftforge.fml.loading.targets.CommonLaunchHandler.runTarget(CommonLaunchHandler.java:111) ~[fmlloader-1.20.1-47.3.12.jar%2369!/:?] 2011at net.minecraftforge.fml.loading.targets.CommonLaunchHandler.serverService(CommonLaunchHandler.java:103) ~[fmlloader-1.20.1-47.3.12.jar%2369!/:?] 2012at net.minecraftforge.fml.loading.targets.CommonServerLaunchHandler.lambda$makeService$0(CommonServerLaunchHandler.java:27) ~[fmlloader-1.20.1-47.3.12.jar%2369!/:?] 2013at cpw.mods.modlauncher.LaunchServiceHandlerDecorator.launch(LaunchServiceHandlerDecorator.java:30) ~[modlauncher-10.0.9.jar%2355!/:?] 2014at cpw.mods.modlauncher.LaunchServiceHandler.launch(LaunchServiceHandler.java:53) ~[modlauncher-10.0.9.jar%2355!/:?] 2015at cpw.mods.modlauncher.LaunchServiceHandler.launch(LaunchServiceHandler.java:71) ~[modlauncher-10.0.9.jar%2355!/:?] 2016at cpw.mods.modlauncher.Launcher.run(Launcher.java:108) ~[modlauncher-10.0.9.jar%2355!/:?] 2017at cpw.mods.modlauncher.Launcher.main(Launcher.java:78) ~[modlauncher-10.0.9.jar%2355!/:?] 2018at cpw.mods.modlauncher.BootstrapLaunchConsumer.accept(BootstrapLaunchConsumer.java:26) ~[modlauncher-10.0.9.jar%2355!/:?] 2019at cpw.mods.modlauncher.BootstrapLaunchConsumer.accept(BootstrapLaunchConsumer.java:23) ~[modlauncher-10.0.9.jar%2355!/:?] 2020at cpw.mods.bootstraplauncher.BootstrapLauncher.main(BootstrapLauncher.java:141) ~[bootstraplauncher-1.1.2.jar:?] 2021Caused by: java.lang.IllegalStateException: Failed to load registries due to above errors 2022at net.minecraft.resources.RegistryDataLoader.m_247207_(RegistryDataLoader.java:77) ~[server-1.20.1-20230612.114412-srg.jar%23535!/:?] 2023at net.minecraft.server.WorldLoader.m_246152_(WorldLoader.java:54) ~[server-1.20.1-20230612.114412-srg.jar%23535!/:?] 2024at net.minecraft.server.WorldLoader.m_245736_(WorldLoader.java:58) ~[server-1.20.1-20230612.114412-srg.jar%23535!/:?] 2025at net.minecraft.server.WorldLoader.m_214362_(WorldLoader.java:31) ~[server-1.20.1-20230612.114412-srg.jar%23535!/:?] 2026at net.minecraft.server.Main.lambda$main$2(Main.java:167) ~[server-1.20.1-20230612.114412-srg.jar%23535!/:?] 2027at net.minecraft.Util.m_214652_(Util.java:777) ~[server-1.20.1-20230612.114412-srg.jar%23535!/:?] 2028at net.minecraft.Util.m_214679_(Util.java:772) ~[server-1.20.1-20230612.114412-srg.jar%23535!/:?] 2029at net.minecraft.server.Main.main(Main.java:166) ~[server-1.20.1-20230612.114412-srg.jar%23535!/:?] 2030... 15 more   AND THE ERROR THAT THE GAME SAY WENT I WANT TO PLAY IN SOLO (local): Time: 2024-11-21 16:16:37 Description: mouseClicked event handler java.lang.IllegalStateException: Failed to load registries due to above errors     at net.minecraft.resources.RegistryDataLoader.m_247207_(RegistryDataLoader.java:77) ~[client-1.20.1-20230612.114412-srg.jar%23652!/:?] {re:mixin,pl:connector_pre_launch:A,re:classloading,pl:mixin:APP:bclib.mixins.common.json:RegistryDataLoaderMixin from mod bclib,pl:mixin:APP:lithostitched.mixins.json:common.RegistryDataLoaderMixin from mod lithostitched,pl:mixin:APP:zeta.mixins.json:RegistryDataLoaderMixin from mod zeta,pl:mixin:APP:fabric-registry-sync-v0.mixins.json:RegistryLoaderMixin from mod fabric_registry_sync_v0,pl:mixin:APP:together.mixins.common.json:RegistryDataLoaderMixin from mod bclib,pl:mixin:APP:connectormod.mixins.json:registries.RegistryDataLoaderMixin from mod connectormod,pl:mixin:A,pl:connector_pre_launch:A} at net.minecraft.server.WorldLoader.m_246152_(WorldLoader.java:54) ~[client-1.20.1-20230612.114412-srg.jar%23652!/:?] {re:mixin,pl:connector_pre_launch:A,re:classloading,pl:mixin:APP:together.mixins.common.json:WorldLoaderMixin from mod bclib,pl:mixin:A,pl:connector_pre_launch:A}     at net.minecraft.server.WorldLoader.m_245736_(WorldLoader.java:58) ~[client-1.20.1-20230612.114412-srg.jar%23652!/:?] {re:mixin,pl:connector_pre_launch:A,re:classloading,pl:mixin:APP:together.mixins.common.json:WorldLoaderMixin from mod bclib,pl:mixin:A,pl:connector_pre_launch:A}     at net.minecraft.server.WorldLoader.m_214362_(WorldLoader.java:31) ~[client-1.20.1-20230612.114412-srg.jar%23652!/:?] {re:mixin,pl:connector_pre_launch:A,re:classloading,pl:mixin:APP:together.mixins.common.json:WorldLoaderMixin from mod bclib,pl:mixin:A,pl:connector_pre_launch:A}     at net.minecraft.client.gui.screens.worldselection.CreateWorldScreen.m_232896_(CreateWorldScreen.java:125) ~[client-1.20.1-20230612.114412-srg.jar%23652!/:?] {re:mixin,pl:accesstransformer:B,pl:connector_pre_launch:A,pl:runtimedistcleaner:A,re:classloading,pl:accesstransformer:B,pl:mixin:APP:modernfix-common.mixins.json:perf.dedicated_reload_executor.CreateWorldScreenMixin from mod modernfix,pl:mixin:APP:modernfix-forge.mixins.json:bugfix.extra_experimental_screen.CreateWorldScreenMixin from mod modernfix,pl:mixin:APP:cumulus_menus.mixins.json:client.accessor.CreateWorldScreenAccessor from mod cumulus_menus,pl:mixin:APP:mediumcore.mixins.json:client.CreateWorldScreenMixin from mod mediumcore,pl:mixin:APP:aether.mixins.json:client.CreateWorldScreenMixin from mod aether,pl:mixin:APP:together.mixins.client.json:CreateWorldScreen_Mixin from mod bclib,pl:mixin:APP:fancymenu.mixins.json:client.MixinCreateWorldScreen from mod fancymenu,pl:mixin:A,pl:connector_pre_launch:A,pl:runtimedistcleaner:A}        
    • I just tried installing Forge version 1.21.3, and tried launching it with no mods installed. It loads, and immediately crashes while "loading bootstrap resourses." Does anyone know a fix for this? My Java is up to date, as well as my graphics drivers. Here's a snip right before it crashes: https://imgur.com/a/elLujPj
    • I know this is a forge only place, but just to be clear, my error is in Fabric I was actually super frustrated while trying to fix this, like this mod does work when I play it by launching it in minecraft, but when I was trying to install it onto the server it just kept crashing so I decided to delete every mod I've got but kept the bewitchment mod and the necessary mod it needs to function and I tried to run the server... But it somehow still crashed, and the thing is that I really do want the bewitchment mod to be in the SMP so it'll be SUPER helpful if anyone can figure out on how to fix this: It didn't give me any "crash-reports" so I'll be sending the logs and what the console said: Console: [18:51:46] [main/INFO]: SpongePowered MIXIN Subsystem Version=0.8.5 Source=file:/home/container/libraries/net/fabricmc/sponge-mixin/0.13.3+mixin.0.8.5/sponge-mixin-0.13.3+mixin.0.8.5.jar Service=Knot/Fabric Env=SERVER [18:51:46] [main/WARN]: Error loading class: io/github/apace100/origins/power/PreventItemUsePower (java.lang.ClassNotFoundException: io/github/apace100/origins/power/PreventItemUsePower) [18:51:46] [main/WARN]: @Mixin target io.github.apace100.origins.power.PreventItemUsePower was not found bewitchment.mixins.json:integration.origins.PreventItemUsePowerMixin from mod bewitchment [18:51:47] [main/INFO]: Initializing MixinExtras via com.llamalad7.mixinextras.service.MixinExtrasServiceImpl(version=0.3.5). [18:51:52] [main/FATAL]: Failed to start the minecraft server java.lang.RuntimeException: Could not execute entrypoint stage 'main' due to errors, provided by 'bewitchment'! at net.fabricmc.loader.impl.FabricLoaderImpl.lambda$invokeEntrypoints$2(FabricLoaderImpl.java:388) ~[fabric-loader-0.15.11.jar:?] at net.fabricmc.loader.impl.util.ExceptionUtil.gatherExceptions(ExceptionUtil.java:33) ~[fabric-loader-0.15.11.jar:?] at net.fabricmc.loader.impl.FabricLoaderImpl.invokeEntrypoints(FabricLoaderImpl.java:386) ~[fabric-loader-0.15.11.jar:?] at net.fabricmc.loader.impl.game.minecraft.Hooks.startServer(Hooks.java:63) ~[fabric-loader-0.15.11.jar:?] at net.minecraft.server.Main.main(Main.java:92) [server-intermediary.jar:?] at net.fabricmc.loader.impl.game.minecraft.MinecraftGameProvider.launch(MinecraftGameProvider.java:470) [fabric-loader-0.15.11.jar:?] at net.fabricmc.loader.impl.launch.knot.Knot.launch(Knot.java:74) [fabric-loader-0.15.11.jar:?] at net.fabricmc.loader.impl.launch.knot.KnotServer.main(KnotServer.java:23) [fabric-loader-0.15.11.jar:?] at net.fabricmc.loader.impl.launch.server.FabricServerLauncher.main(FabricServerLauncher.java:69) [fabric-loader-0.15.11.jar:?] at net.fabricmc.installer.ServerLauncher.main(ServerLauncher.java:69) [server.jar:1.0.1] Caused by: java.lang.NoSuchFieldError: TEXTURE at moriyashiine.bewitchment.common.item.SpecterBangleItem.<clinit>(SpecterBangleItem.java:28) ~[bewitchment-1.16.5-18.jar:?] at moriyashiine.bewitchment.common.registry.BWObjects.<clinit>(BWObjects.java:272) ~[bewitchment-1.16.5-18.jar:?] at moriyashiine.bewitchment.common.Bewitchment.onInitialize(Bewitchment.java:221) ~[bewitchment-1.16.5-18.jar:?] at net.fabricmc.loader.impl.FabricLoaderImpl.invokeEntrypoints(FabricLoaderImpl.java:384) ~[fabric-loader-0.15.11.jar:?] ... 7 more Logs: https://mclo.gs/wSsqMfn
    • I know this is a forge only place, but just so you know my error is in Fabric I was actually super frustrated while trying to fix this, like this mod does work when I play it by launching it in minecraft, but when I was trying to install it onto the server it just kept crashing so I decided to delete every mod I've got but kept the bewitchment mod and the necessary mod it needs to function and I tried to run the server... But it somehow still crashed, and the thing is that I really do want the bewitchment mod to be in the SMP so it'll be SUPER helpful if anyone can figure out on how to fix this: It didn't give me any "crash-reports" so I'll be sending the logs and what the console said: Console: [18:51:46] [main/INFO]: SpongePowered MIXIN Subsystem Version=0.8.5 Source=file:/home/container/libraries/net/fabricmc/sponge-mixin/0.13.3+mixin.0.8.5/sponge-mixin-0.13.3+mixin.0.8.5.jar Service=Knot/Fabric Env=SERVER [18:51:46] [main/WARN]: Error loading class: io/github/apace100/origins/power/PreventItemUsePower (java.lang.ClassNotFoundException: io/github/apace100/origins/power/PreventItemUsePower) [18:51:46] [main/WARN]: @Mixin target io.github.apace100.origins.power.PreventItemUsePower was not found bewitchment.mixins.json:integration.origins.PreventItemUsePowerMixin from mod bewitchment [18:51:47] [main/INFO]: Initializing MixinExtras via com.llamalad7.mixinextras.service.MixinExtrasServiceImpl(version=0.3.5). [18:51:52] [main/FATAL]: Failed to start the minecraft server java.lang.RuntimeException: Could not execute entrypoint stage 'main' due to errors, provided by 'bewitchment'! at net.fabricmc.loader.impl.FabricLoaderImpl.lambda$invokeEntrypoints$2(FabricLoaderImpl.java:388) ~[fabric-loader-0.15.11.jar:?] at net.fabricmc.loader.impl.util.ExceptionUtil.gatherExceptions(ExceptionUtil.java:33) ~[fabric-loader-0.15.11.jar:?] at net.fabricmc.loader.impl.FabricLoaderImpl.invokeEntrypoints(FabricLoaderImpl.java:386) ~[fabric-loader-0.15.11.jar:?] at net.fabricmc.loader.impl.game.minecraft.Hooks.startServer(Hooks.java:63) ~[fabric-loader-0.15.11.jar:?] at net.minecraft.server.Main.main(Main.java:92) [server-intermediary.jar:?] at net.fabricmc.loader.impl.game.minecraft.MinecraftGameProvider.launch(MinecraftGameProvider.java:470) [fabric-loader-0.15.11.jar:?] at net.fabricmc.loader.impl.launch.knot.Knot.launch(Knot.java:74) [fabric-loader-0.15.11.jar:?] at net.fabricmc.loader.impl.launch.knot.KnotServer.main(KnotServer.java:23) [fabric-loader-0.15.11.jar:?] at net.fabricmc.loader.impl.launch.server.FabricServerLauncher.main(FabricServerLauncher.java:69) [fabric-loader-0.15.11.jar:?] at net.fabricmc.installer.ServerLauncher.main(ServerLauncher.java:69) [server.jar:1.0.1] Caused by: java.lang.NoSuchFieldError: TEXTURE at moriyashiine.bewitchment.common.item.SpecterBangleItem.<clinit>(SpecterBangleItem.java:28) ~[bewitchment-1.16.5-18.jar:?] at moriyashiine.bewitchment.common.registry.BWObjects.<clinit>(BWObjects.java:272) ~[bewitchment-1.16.5-18.jar:?] at moriyashiine.bewitchment.common.Bewitchment.onInitialize(Bewitchment.java:221) ~[bewitchment-1.16.5-18.jar:?] at net.fabricmc.loader.impl.FabricLoaderImpl.invokeEntrypoints(FabricLoaderImpl.java:384) ~[fabric-loader-0.15.11.jar:?] ... 7 more Logs: https://mclo.gs/wSsqMfn
    • Open the Task Manager and check the Performance Tab At GPU the GPU is mentioned above the Graph
  • Topics

×
×
  • Create New...

Important Information

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