Jump to content

[UNSOLVED]Problem with IExtendedEntityProperties


Recommended Posts

Im trying to properly register IEE, but they are not saved probably. I can't make out the problem.

Here are the classes and where i register the IEE:




package itsamysterious.mods.reallifemod.core.lifesystem;


import net.minecraft.client.entity.EntityPlayerSP;

import net.minecraft.entity.Entity;

import net.minecraft.entity.player.EntityPlayer;

import net.minecraft.nbt.NBTTagCompound;

import net.minecraft.potion.Potion;

import net.minecraft.potion.PotionEffect;

import net.minecraft.util.BlockPos;

import net.minecraft.util.EnumParticleTypes;

import net.minecraft.world.World;

import net.minecraftforge.common.IExtendedEntityProperties;


public class RLMPlayerProps implements IExtendedEntityProperties {


protected EntityPlayer player;

protected World theWorld;


public String name;

public String surname;


public double toilet;

public double water;

private int timeWaterless = 0;

private int waterlowmessagetime = 0;

public float money;

public double energy;

public double stamina;

private int gender;


public boolean shownGui;


public static final String EXT_PROP_NAME = "RealLifeProperties";


public RLMPlayerProps(EntityPlayer player) {




public static final void register(EntityPlayer player){

player.registerExtendedProperties(EXT_PROP_NAME, new RLMPlayerProps(player));



public static final RLMPlayerProps get(EntityPlayer player) {

return (RLMPlayerProps) player.getExtendedProperties(EXT_PROP_NAME);



public void circleOfLife() {

if (player != null && !player.capabilities.isCreativeMode) {


if (water > 0.1) {

water -= 0.00138888889D;



if (toilet < 100) {

toilet += 0.00415151515151515D;








private void updateEffects() {

if (!player.worldObj.isRemote) {

if (water < 40 &&water>10&& waterlowmessagetime % 200 == 0) {




if (water < 10&&water>0.1) {


player.addPotionEffect(new PotionEffect(Potion.confusion

.getId(), 100));

} else if (player.getActivePotionEffect(Potion.confusion) != null) {




if (water < 0.1) {

player.addPotionEffect(new PotionEffect(

Potion.weakness.getId(), 100));


if (timeWaterless == 200) {


player.setHealth(player.getHealth() - 1);





// Toilet stuff

if (toilet > 50) {

player.addPotionEffect(new PotionEffect(Potion.digSlowdown

.getId(), 1));

} else {











public void saveNBTData(NBTTagCompound compound) {

NBTTagCompound theTag = new NBTTagCompound();

compound.setTag(EXT_PROP_NAME, theTag);

if (player != null) {

theTag.setDouble("WATER", water);

theTag.setDouble("TOILET", toilet);

theTag.setFloat("MONEY", money);

theTag.setString("NAME", name);

theTag.setString("SURNAME", surname);

theTag.setDouble("ENERGIE", energy);

theTag.setBoolean("GUISHOWN", shownGui);

theTag.setInteger("GENDER", gender);






public void loadNBTData(NBTTagCompound compound) {

NBTTagCompound theTag = compound.getCompoundTag(EXT_PROP_NAME);

if (player != null) {

water = theTag.getDouble("WATER");

toilet = theTag.getDouble("TOILET");

money = theTag.getFloat("MONEY");

name = theTag.getString("NAME");

surname = theTag.getString("SURNAME");

energy = theTag.getDouble("ENERGIE");







public void init(Entity entity, World world) {

if (entity instanceof EntityPlayer) {

player = (EntityPlayer) entity;






public void pee() {






public static String getGender(EntityPlayer player){




return "female";



public void setGender(String s){







public boolean requestMariage(EntityPlayer requester){

return true;



public static final String getFullname(EntityPlayerSP thePlayer) {

return get(thePlayer).name+" "+get(thePlayer).surname;







Registration in the ClientHandler registered to MinecraftForge.EVENT_BUS:




public void onEntityConstructing(EntityConstructing event) {

if (event.entity instanceof EntityPlayer) {


new RLMPlayerProps((EntityPlayer) event.entity));





Link to comment
Share on other sites

In your event


try "RLMPlayerProps.register((EntityPlayer) event.entity))


instead of "event.entity.registerExtendedProperties(RLMPlayerProps.EXT_PROP_NAME, new RLMPlayerProps((EntityPlayer) event.entity);"


you don't really need to have that in two places.




for your problem on not saved, I believe it is because you are overwriting the data each time.  you need to check for the property to exist before writing it.


Add this to your property:




public static final ExtendedPlayer get(EntityPlayer player) {

return (ExtendedPlayer) player.getExtendedProperties(EXT_PROP_NAME);





In your construction





  public void onEntityConstructing(EntityConstructing event) {

      if (event.entity instanceof EntityPlayer) {

        if (RLMPlayerProps.get((EntityPlayer) event.entity) == null) {RLMPlayerProps.register((EntityPlayer) event.entity);}






I suspect you used Jabelar's tutorial (which is great) but from looking at it, its a one time horse, not a long term recuring entity like the player.


I originally used this one to learn it.




Long time Bukkit & Forge Programmer

Happy to try and help

Link to comment
Share on other sites

Ok, first things first, your handling of names and gender is horribly incomplete and irritating (if you want to learn more,

, but the other one is good, too. /edit).

Also that "pee" method is a joke. It is equivalent to just doing "toilet = 0" (which the JVM will probably optimize it to, but still).


Now: What makes you think that the data is not properly saved? What are the symptoms?

When i spawn in the world the guiscreen pops back up in which ive set the name and gender before. probably this is cuz i don't have the -username argument in JVM-Arguments properly?

Link to comment
Share on other sites

Okay - i tried doing the packethandling stuff but it gives me a svere error and just sais that the packet couldn't be handled also it does not set the properties right. Please help. PS - No errorcode available - just a crash


Here is the packagehandler method:




public SetPropertiesPackage onMessage(SetPropertiesPackage message, MessageContext ctx) {

EntityPlayer player = ctx.getServerHandler().playerEntity;

World world = player.worldObj;






return null;





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.

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.


  • Recently Browsing

    • No registered users viewing this page.
  • Posts

    • Another Minecraft Launcher https://multimc.org/#Download or https://atlauncher.com/downloads
    • Remove these mods and combine OptiFine HD U I6 with Forge 47.2.18 Start with Optifine - without any other mods - if this works, add the mods one by one or in groups until you find the mod, conflicting with Optifine
    • Ok yeah I think this might be where the problem starts. For starters, I think you can get rid of your RecipeType impl and make it a static constant instead. I'm not 100% sure this will fix it but it's posssible. RuneInscribingRecipe public class RuneInscribingRecipe implements Recipe<SimpleContainer> { public static final RecipeType<RuneInscribingRecipe> RECIPE_TYPE = new RecipeType<>(){}; // .... @Override public RecipeType<?> getType() { return RECIPE_TYPE; } // .... } RuneInscriberMenu private Optional<RecipeHolder<RuneInscribingRecipe>> getCurrentRecipe() { SimpleContainer inventory = new SimpleContainer(2); inventory.setItem(BASE_INPUT_SLOT, this.inventory.getStackInSlot(BASE_INPUT_SLOT)); inventory.setItem(TEMPLATE_INPUT_SLOT, this.inventory.getStackInSlot(TEMPLATE_INPUT_SLOT)); List<RecipeHolder<RuneInscribingRecipe>> list = this.blockEntity.getLevel().getRecipeManager().getRecipesFor(RuneInscribingRecipe.RECIPE_TYPE, inventory, this.blockEntity.getLevel()); if (list.isEmpty()) { return Optional.empty(); } return Optional.of(list.get(0)); }   Also, this here is a little suspicious where you're getting the `this.inventory.getStackInSlot` calls. I'd try and make sure those are what you expect they are with either a Debug line in IDE or print statement SimpleContainer inventory = new SimpleContainer(2); inventory.setItem(BASE_INPUT_SLOT, this.inventory.getStackInSlot(BASE_INPUT_SLOT)); System.out.printf("CHECKING BASE INPUT OF RECIPE: %s\n", this.inventory.getStackInSlot(BASE_INPUT_SLOT)); inventory.setItem(TEMPLATE_INPUT_SLOT, this.inventory.getStackInSlot(TEMPLATE_INPUT_SLOT)); System.out.printf("CHECKING TEMPLATE INPUT OF RECIPE: %s\n", this.inventory.getStackInSlot(TEMPLATE_INPUT_SLOT)); ^ See what the result of those print statements are, make sure they're right
    • Upon testing again after adding them, the game still doesn't crash however the resource packs are still unfortunately broken.
    • Hi! Can someone please point me to the correct FAQ or place? I'm not able do DuckDuckGo myself out of this one. As you can hopefully see, chunks are not rendered. I run a forge server, fresh install on a linux VM. Curseforge on the Win11 client with Embeddium, Oculus and Unbound shader. No mods. Forge 47.2.23 on server & client.  No errors, no crashes, no apparent CPU or RAM issues with the VM. This screenshot was captured while creative, but the same happens when flying in survival. Waiting (floating) for a few minutes sooner or (often) later, lets the missing chunks appear. Usually takes 5-10 minutes.  When on a local game, the chunks appear slowly, but they do appear without pause.   This must be something simple, obvious, but I can't find the correct "search words" to find my way out. "Chunks not loading / rendering" didn't help. Browsing several forums neither. 
  • Topics

  • Create New...

Important Information

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