Jump to content

Entity gets not loaded back into the world after saving and quitting.


WorldsEnder

Recommended Posts

I began to write some code but as I began to write a mob it was all okay and worked fine. The only thing is that the mob does not get written into the NBT of the save. (I checked with NBTExplorer) Here are my classes

[spoiler=mainclass]package de.gmx.worldsbegin;

 

import java.lang.annotation.ElementType;

import java.lang.annotation.Retention;

import java.lang.annotation.RetentionPolicy;

import java.lang.annotation.Target;

import java.util.ArrayList;

import java.util.BitSet;

 

import javax.annotation.PreDestroy;

 

import net.minecraft.client.model.ModelBat;

import net.minecraft.client.renderer.EntityRenderer;

import net.minecraft.client.renderer.entity.RenderBlaze;

import net.minecraft.client.renderer.entity.RenderLiving;

import net.minecraft.client.settings.GameSettings;

import net.minecraft.entity.EnumCreatureType;

import net.minecraft.tileentity.MobSpawnerBaseLogic;

import net.minecraft.world.SpawnerAnimals;

import net.minecraft.world.biome.BiomeGenBase;

import net.minecraft.world.biome.SpawnListEntry;

import net.minecraftforge.client.MinecraftForgeClient;

import net.minecraftforge.common.MinecraftForge;

import net.minecraftforge.event.ForgeEventFactory;

import net.minecraftforge.event.ForgeSubscribe;

import cpw.mods.fml.client.registry.RenderingRegistry;

import cpw.mods.fml.common.Mod;

import cpw.mods.fml.common.Mod.Block;

import cpw.mods.fml.common.Mod.Init;

import cpw.mods.fml.common.Mod.Item;

import cpw.mods.fml.common.Mod.PostInit;

import cpw.mods.fml.common.Mod.PreInit;

import cpw.mods.fml.common.event.FMLInitializationEvent;

import cpw.mods.fml.common.event.FMLPostInitializationEvent;

import cpw.mods.fml.common.event.FMLPreInitializationEvent;

import cpw.mods.fml.common.network.NetworkMod;

import cpw.mods.fml.common.registry.EntityRegistry;

import cpw.mods.fml.common.registry.EntityRegistry.EntityRegistration;

import cpw.mods.fml.common.registry.GameData;

import cpw.mods.fml.common.registry.LanguageRegistry;

import cpw.mods.fml.relauncher.IFMLLoadingPlugin.MCVersion;

import de.gmx.worldsbegin.entities.EntityTigrex;

 

@Mod(modid="MonsterHunterMinedomUnite", name="Monster Hunter Minedom Unite", version="a0.1")

@NetworkMod(clientSideRequired=true, serverSideRequired=false)

@MCVersion(value="1.5.1")

 

public class MonsterHunterMinedomUnite

{

private static BitSet freeEntityIds;

private ArrayList<String> preloadedTexture;

//Load config etc.

@PreInit

private void preInitMod(FMLPreInitializationEvent fpreie)

{

freeEntityIds = new BitSet(256);

freeEntityIds.flip(0, 255);

//TODO well... that's not all e.g. config etc.

}

//Setup the blocks etc.

@Init

private void initMod(FMLInitializationEvent fie)

{

this.registerBlocks();

this.registerAndNameItems();

this.registerCustomBiomes();

this.registerCustomMobs();

this.registerMHMUEvents();

//TODO maybe something else.. not sure yet

}

//Communicate with other mods etc.

@PostInit

private void postInit(FMLPostInitializationEvent fpostie)

{

//TODO maybe ... just mark

}

//Save config and everything else

@PreDestroy

private void saveAndQuit()

{

 

}

private void registerBlocks()

{

//TODO maybe some blocks, like "mining station" and gathering plants etc.

}

private void registerAndNameItems()

{

//TODO all of them items... that are many :)

//TODO them armory and weapons puha

}

private void registerCustomSmelting()

{

//TODO well I don't know... there is no such thing in Monster Hunter, is there?

}

private void registerCustomCrafting()

{

//TODO puh all them combinations them combinations... Str-C, Str-V

}

private void registerCustomBiomes()

{

//TODO Do you even quest?

}

private void registerCustomMobs()

{

//global

EntityRegistry.registerGlobalEntityID(EntityTigrex.class, "Tigrex", EntityRegistry.findGlobalUniqueEntityId(), 0xffffff, 0x001100);

//...

//local

EntityRegistry.registerModEntity(EntityTigrex.class, "Tigrex", this.findUniqueEntityIdAndRegister(),this, 84, 3, true);

//...

//name them all

LanguageRegistry.instance().addStringLocalization("entity.Tigrex.name", "Tigrex");

}

private void registerMHMUEvents()

{

 

}

//Only call this when you really want to register an entity

private static int findUniqueEntityIdAndRegister(){

int id = MonsterHunterMinedomUnite.freeEntityIds.nextSetBit(0);

if(id==-1){

throw new RuntimeException("No ids left... Oh god I'm spamming lol");

}

MonsterHunterMinedomUnite.freeEntityIds.set(id);

return id;

}

}

 

 

 

[spoiler=a superclass]package de.gmx.worldsbegin.entities;

 

import java.util.HashMap;

 

import de.gmx.worldsbegin.events.FlashBombEvent;

import de.gmx.worldsbegin.events.SonicBombEvent;

import net.minecraft.entity.EntityLiving;

import net.minecraft.nbt.NBTTagCompound;

import net.minecraft.world.World;

import net.minecraftforge.common.MinecraftForge;

import net.minecraftforge.event.ForgeSubscribe;

 

public abstract class EntityMinedom extends EntityLiving{

/**

* the attack that is currently performed

*/

protected MonsterAttack currentattack;

/**

* the current frame in the animatic flow

*/

protected int currentAttackFrame = 0;

/**

* the rank of this monster

*/

protected Rank rank;

//methods

public EntityMinedom(World par1World, Rank rank) {

super(par1World);

}

public abstract HashMap<MonsterAttack, Integer> getAttacksWithWeight();

public abstract byte getBrokenParts();

@Override

public void initCreature()

{

super.initCreature();

//timeEnragedLeft

this.dataWatcher.addObject(16, Integer.valueOf((int) 0));

//durationFlashedLeft

this.dataWatcher.addObject(17, Integer.valueOf((int) 0));

//durationSonicLeft (by sonic grenade e.g.)

this.dataWatcher.addObject(18, Integer.valueOf((int) 0));

}

@Override

public void writeEntityToNBT(NBTTagCompound par1nbtTagCompound)

{

super.writeEntityToNBT(par1nbtTagCompound);

par1nbtTagCompound.setInteger("enragedTimeLeft", this.dataWatcher.getWatchableObjectInt(16));

par1nbtTagCompound.setInteger("flashedTimeLeft", this.dataWatcher.getWatchableObjectInt(17));

par1nbtTagCompound.setInteger("sonicTimeLeft", this.dataWatcher.getWatchableObjectInt(18));

par1nbtTagCompound.setInteger("rank", this.rank.ordinal());

}

@Override

public void readEntityFromNBT(NBTTagCompound par1nbtTagCompound)

{

super.readEntityFromNBT(par1nbtTagCompound);

this.dataWatcher.updateObject(16, par1nbtTagCompound.getInteger("enragedTimeLeft"));

this.dataWatcher.updateObject(17, par1nbtTagCompound.getInteger("flashedTimeLeft"));

this.dataWatcher.updateObject(18, par1nbtTagCompound.getInteger("sonicTimeLeft"));

this.rank = Rank.values()[par1nbtTagCompound.getInteger("rank")];

}

/**

* @return - Whether the entity is in a enraged state, mostly

* used to give it more attack/def.

*/

public boolean isEnraged()

{

return this.dataWatcher.getWatchableObjectByte(16)>0;

}

/**

* @return - the frame the animation is momentarily at

*/

public final int getCurrentAttackFrame()

{

return this.currentAttackFrame;

}

/**

* @return - the attack that is currently executed

*/

public final MonsterAttack getCurrentAttack()

{

return this.currentattack;

}

/**

* Called when a flash bomb explodes in the world. Check where it exploded and do your stuff.

*/

@ForgeSubscribe(receiveCanceled=false)

protected void onFlashBomb(FlashBombEvent fbe)

{

 

}

/**

* Called when a sonic bomb explodes in the world. Check where it exploded and stuff.

*/

@ForgeSubscribe(receiveCanceled=false)

protected void onSonicBomb(SonicBombEvent sbe)

{

 

}

 

//enum

public enum Rank

{

low, high, G;

}

 

}

 

 

[spoiler=The Entity]package de.gmx.worldsbegin.entities;

 

import java.util.HashMap;

 

import net.minecraft.entity.ai.EntityAIFleeSun;

import net.minecraft.entity.ai.EntityAINearestAttackableTarget;

import net.minecraft.entity.ai.EntityAISwimming;

import net.minecraft.entity.ai.EntityAIWander;

import net.minecraft.entity.monster.EntityMob;

import net.minecraft.nbt.NBTTagCompound;

import net.minecraft.util.DamageSource;

import net.minecraft.world.World;

 

/**

*

* Specified data to watch:

* dataWatcher(19): byte containing bitwise booleans:

* b&1 - head broken

* b&2 - rightWing broken

* b&4 - leftWing broken

* b&8 - tail broken

* @author Carbon

*

*/

public class EntityTigrex extends EntityMinedom{

/**Tigrex is a multiBBEntity thus we need an array*/

protected EntityTigrexPart[] entityParts;

protected EntityTigrexPart head1;

protected EntityTigrexPart head2;

protected EntityTigrexPart body1;

//TODO more bodyparts... the real ones... ;)

protected static MonsterAttack[] perfomableAttacks;

 

public EntityTigrex(World p1)

{

this(p1, Rank.low);

}

public EntityTigrex(World p1, Rank rank)

{

super(p1, rank);

this.tasks.addTask(0, new EntityAISwimming(this));

//TODO write an AI to add here

//add texture

}

@Override

public int getMaxHealth() {

// TODO Auto-generated method stub

return 4;//TODO a real health here not debug-value

}

@Override

protected boolean isAIEnabled() {

return true;//At least I think so...

}

/**

* This only adjusts the body-parts and spawn particles.

* Movement should be done by the AI.

*/

@Override

public void onLivingUpdate()

{

super.onLivingUpdate();

//TODO something at least....

//TODO update the animation and particles

}

@Override

public void writeEntityToNBT(NBTTagCompound par1nbtTagCompound)

{

super.writeEntityToNBT(par1nbtTagCompound);

par1nbtTagCompound.setBoolean("headBroken", (this.dataWatcher.getWatchableObjectByte(19)&1)==1);

par1nbtTagCompound.setBoolean("rightWingBroken", (this.dataWatcher.getWatchableObjectByte(19)>>1&1)==1);

par1nbtTagCompound.setBoolean("leftWingBroken", (this.dataWatcher.getWatchableObjectByte(19)>>2&1)==1);

par1nbtTagCompound.setBoolean("tailCut", (this.dataWatcher.getWatchableObjectByte(19)>>3&1)==1);

}

@Override

public void readEntityFromNBT(NBTTagCompound par1nbtTagCompound)

{

super.readEntityFromNBT(par1nbtTagCompound);

byte toDataWatcher = 0;

if(par1nbtTagCompound.getBoolean("headBroken")) toDataWatcher += 1;

if(par1nbtTagCompound.getBoolean("rightWingBroken")) toDataWatcher += (1<<1);

if(par1nbtTagCompound.getBoolean("leftWingBroken")) toDataWatcher += (1<<2);

if(par1nbtTagCompound.getBoolean("tailCut")) toDataWatcher += (1<<3);

this.dataWatcher.updateObject(19, toDataWatcher);

}

@Override

public void initCreature()

{

super.initCreature();

//broken Parts

this.dataWatcher.addObject(19, Byte.valueOf((byte) 0));

//TODO ini the bodyParts

}

@Override

public HashMap<MonsterAttack, Integer> getAttacksWithWeight()

{

HashMap<MonsterAttack, Integer> returnMap= new HashMap<MonsterAttack, Integer>();

for(int i=0;i<this.entityParts.length;i++){

returnMap.put(this.perfomableAttacks, 5);//TODO real values not just 5 for every attack....

}

return returnMap;

}

/**

* @return - compare this bitwise:

* b&1 - whether head is broken

* b&2 -        leftWing is broken

* b&4 -        rightWing is broken

* b&8 -        tail is cutoff

*/

public byte getBrokenParts()

{

return this.dataWatcher.getWatchableObjectByte(17);

}

/**

* Should return false as collision is handeled by the sub-bodyparts.

*/

@Override

public boolean canBeCollidedWith()

{

return false;

}

/**

* Damage should by applied though the sub-bodyparts so this returns false.

* @return - always false

*/

@Override

public boolean attackEntityFrom(DamageSource par1DamageSource, int par2)

{

return true;//FIXME debug value set to false

}

/**

*

*/

public boolean attackEntityFromPart(EntityTigrexPart par1partFrom, DamageSource par1DamageSource, int par2)

{

return !this.isDead;

}

}

 

 

I think this should be enough.... if you need anything more to know why this isn't saved just tell me :D

Link to comment
Share on other sites

I began to write some code but as I began to write a mob it was all okay and worked fine. The only thing is that the mob does not get written into the NBT of the save. (I checked with NBTExplorer) Here are my classes

[spoiler=mainclass]package de.gmx.worldsbegin;

 

import java.lang.annotation.ElementType;

import java.lang.annotation.Retention;

import java.lang.annotation.RetentionPolicy;

import java.lang.annotation.Target;

import java.util.ArrayList;

import java.util.BitSet;

 

import javax.annotation.PreDestroy;

 

import net.minecraft.client.model.ModelBat;

import net.minecraft.client.renderer.EntityRenderer;

import net.minecraft.client.renderer.entity.RenderBlaze;

import net.minecraft.client.renderer.entity.RenderLiving;

import net.minecraft.client.settings.GameSettings;

import net.minecraft.entity.EnumCreatureType;

import net.minecraft.tileentity.MobSpawnerBaseLogic;

import net.minecraft.world.SpawnerAnimals;

import net.minecraft.world.biome.BiomeGenBase;

import net.minecraft.world.biome.SpawnListEntry;

import net.minecraftforge.client.MinecraftForgeClient;

import net.minecraftforge.common.MinecraftForge;

import net.minecraftforge.event.ForgeEventFactory;

import net.minecraftforge.event.ForgeSubscribe;

import cpw.mods.fml.client.registry.RenderingRegistry;

import cpw.mods.fml.common.Mod;

import cpw.mods.fml.common.Mod.Block;

import cpw.mods.fml.common.Mod.Init;

import cpw.mods.fml.common.Mod.Item;

import cpw.mods.fml.common.Mod.PostInit;

import cpw.mods.fml.common.Mod.PreInit;

import cpw.mods.fml.common.event.FMLInitializationEvent;

import cpw.mods.fml.common.event.FMLPostInitializationEvent;

import cpw.mods.fml.common.event.FMLPreInitializationEvent;

import cpw.mods.fml.common.network.NetworkMod;

import cpw.mods.fml.common.registry.EntityRegistry;

import cpw.mods.fml.common.registry.EntityRegistry.EntityRegistration;

import cpw.mods.fml.common.registry.GameData;

import cpw.mods.fml.common.registry.LanguageRegistry;

import cpw.mods.fml.relauncher.IFMLLoadingPlugin.MCVersion;

import de.gmx.worldsbegin.entities.EntityTigrex;

 

@Mod(modid="MonsterHunterMinedomUnite", name="Monster Hunter Minedom Unite", version="a0.1")

@NetworkMod(clientSideRequired=true, serverSideRequired=false)

@MCVersion(value="1.5.1")

 

public class MonsterHunterMinedomUnite

{

private static BitSet freeEntityIds;

private ArrayList<String> preloadedTexture;

//Load config etc.

@PreInit

private void preInitMod(FMLPreInitializationEvent fpreie)

{

freeEntityIds = new BitSet(256);

freeEntityIds.flip(0, 255);

//TODO well... that's not all e.g. config etc.

}

//Setup the blocks etc.

@Init

private void initMod(FMLInitializationEvent fie)

{

this.registerBlocks();

this.registerAndNameItems();

this.registerCustomBiomes();

this.registerCustomMobs();

this.registerMHMUEvents();

//TODO maybe something else.. not sure yet

}

//Communicate with other mods etc.

@PostInit

private void postInit(FMLPostInitializationEvent fpostie)

{

//TODO maybe ... just mark

}

//Save config and everything else

@PreDestroy

private void saveAndQuit()

{

 

}

private void registerBlocks()

{

//TODO maybe some blocks, like "mining station" and gathering plants etc.

}

private void registerAndNameItems()

{

//TODO all of them items... that are many :)

//TODO them armory and weapons puha

}

private void registerCustomSmelting()

{

//TODO well I don't know... there is no such thing in Monster Hunter, is there?

}

private void registerCustomCrafting()

{

//TODO puh all them combinations them combinations... Str-C, Str-V

}

private void registerCustomBiomes()

{

//TODO Do you even quest?

}

private void registerCustomMobs()

{

//global

EntityRegistry.registerGlobalEntityID(EntityTigrex.class, "Tigrex", EntityRegistry.findGlobalUniqueEntityId(), 0xffffff, 0x001100);

//...

//local

EntityRegistry.registerModEntity(EntityTigrex.class, "Tigrex", this.findUniqueEntityIdAndRegister(),this, 84, 3, true);

//...

//name them all

LanguageRegistry.instance().addStringLocalization("entity.Tigrex.name", "Tigrex");

}

private void registerMHMUEvents()

{

 

}

//Only call this when you really want to register an entity

private static int findUniqueEntityIdAndRegister(){

int id = MonsterHunterMinedomUnite.freeEntityIds.nextSetBit(0);

if(id==-1){

throw new RuntimeException("No ids left... Oh god I'm spamming lol");

}

MonsterHunterMinedomUnite.freeEntityIds.set(id);

return id;

}

}

 

 

 

[spoiler=a superclass]package de.gmx.worldsbegin.entities;

 

import java.util.HashMap;

 

import de.gmx.worldsbegin.events.FlashBombEvent;

import de.gmx.worldsbegin.events.SonicBombEvent;

import net.minecraft.entity.EntityLiving;

import net.minecraft.nbt.NBTTagCompound;

import net.minecraft.world.World;

import net.minecraftforge.common.MinecraftForge;

import net.minecraftforge.event.ForgeSubscribe;

 

public abstract class EntityMinedom extends EntityLiving{

/**

* the attack that is currently performed

*/

protected MonsterAttack currentattack;

/**

* the current frame in the animatic flow

*/

protected int currentAttackFrame = 0;

/**

* the rank of this monster

*/

protected Rank rank;

//methods

public EntityMinedom(World par1World, Rank rank) {

super(par1World);

}

public abstract HashMap<MonsterAttack, Integer> getAttacksWithWeight();

public abstract byte getBrokenParts();

@Override

public void initCreature()

{

super.initCreature();

//timeEnragedLeft

this.dataWatcher.addObject(16, Integer.valueOf((int) 0));

//durationFlashedLeft

this.dataWatcher.addObject(17, Integer.valueOf((int) 0));

//durationSonicLeft (by sonic grenade e.g.)

this.dataWatcher.addObject(18, Integer.valueOf((int) 0));

}

@Override

public void writeEntityToNBT(NBTTagCompound par1nbtTagCompound)

{

super.writeEntityToNBT(par1nbtTagCompound);

par1nbtTagCompound.setInteger("enragedTimeLeft", this.dataWatcher.getWatchableObjectInt(16));

par1nbtTagCompound.setInteger("flashedTimeLeft", this.dataWatcher.getWatchableObjectInt(17));

par1nbtTagCompound.setInteger("sonicTimeLeft", this.dataWatcher.getWatchableObjectInt(18));

par1nbtTagCompound.setInteger("rank", this.rank.ordinal());

}

@Override

public void readEntityFromNBT(NBTTagCompound par1nbtTagCompound)

{

super.readEntityFromNBT(par1nbtTagCompound);

this.dataWatcher.updateObject(16, par1nbtTagCompound.getInteger("enragedTimeLeft"));

this.dataWatcher.updateObject(17, par1nbtTagCompound.getInteger("flashedTimeLeft"));

this.dataWatcher.updateObject(18, par1nbtTagCompound.getInteger("sonicTimeLeft"));

this.rank = Rank.values()[par1nbtTagCompound.getInteger("rank")];

}

/**

* @return - Whether the entity is in a enraged state, mostly

* used to give it more attack/def.

*/

public boolean isEnraged()

{

return this.dataWatcher.getWatchableObjectByte(16)>0;

}

/**

* @return - the frame the animation is momentarily at

*/

public final int getCurrentAttackFrame()

{

return this.currentAttackFrame;

}

/**

* @return - the attack that is currently executed

*/

public final MonsterAttack getCurrentAttack()

{

return this.currentattack;

}

/**

* Called when a flash bomb explodes in the world. Check where it exploded and do your stuff.

*/

@ForgeSubscribe(receiveCanceled=false)

protected void onFlashBomb(FlashBombEvent fbe)

{

 

}

/**

* Called when a sonic bomb explodes in the world. Check where it exploded and stuff.

*/

@ForgeSubscribe(receiveCanceled=false)

protected void onSonicBomb(SonicBombEvent sbe)

{

 

}

 

//enum

public enum Rank

{

low, high, G;

}

 

}

 

 

[spoiler=The Entity]package de.gmx.worldsbegin.entities;

 

import java.util.HashMap;

 

import net.minecraft.entity.ai.EntityAIFleeSun;

import net.minecraft.entity.ai.EntityAINearestAttackableTarget;

import net.minecraft.entity.ai.EntityAISwimming;

import net.minecraft.entity.ai.EntityAIWander;

import net.minecraft.entity.monster.EntityMob;

import net.minecraft.nbt.NBTTagCompound;

import net.minecraft.util.DamageSource;

import net.minecraft.world.World;

 

/**

*

* Specified data to watch:

* dataWatcher(19): byte containing bitwise booleans:

* b&1 - head broken

* b&2 - rightWing broken

* b&4 - leftWing broken

* b&8 - tail broken

* @author Carbon

*

*/

public class EntityTigrex extends EntityMinedom{

/**Tigrex is a multiBBEntity thus we need an array*/

protected EntityTigrexPart[] entityParts;

protected EntityTigrexPart head1;

protected EntityTigrexPart head2;

protected EntityTigrexPart body1;

//TODO more bodyparts... the real ones... ;)

protected static MonsterAttack[] perfomableAttacks;

 

public EntityTigrex(World p1)

{

this(p1, Rank.low);

}

public EntityTigrex(World p1, Rank rank)

{

super(p1, rank);

this.tasks.addTask(0, new EntityAISwimming(this));

//TODO write an AI to add here

//add texture

}

@Override

public int getMaxHealth() {

// TODO Auto-generated method stub

return 4;//TODO a real health here not debug-value

}

@Override

protected boolean isAIEnabled() {

return true;//At least I think so...

}

/**

* This only adjusts the body-parts and spawn particles.

* Movement should be done by the AI.

*/

@Override

public void onLivingUpdate()

{

super.onLivingUpdate();

//TODO something at least....

//TODO update the animation and particles

}

@Override

public void writeEntityToNBT(NBTTagCompound par1nbtTagCompound)

{

super.writeEntityToNBT(par1nbtTagCompound);

par1nbtTagCompound.setBoolean("headBroken", (this.dataWatcher.getWatchableObjectByte(19)&1)==1);

par1nbtTagCompound.setBoolean("rightWingBroken", (this.dataWatcher.getWatchableObjectByte(19)>>1&1)==1);

par1nbtTagCompound.setBoolean("leftWingBroken", (this.dataWatcher.getWatchableObjectByte(19)>>2&1)==1);

par1nbtTagCompound.setBoolean("tailCut", (this.dataWatcher.getWatchableObjectByte(19)>>3&1)==1);

}

@Override

public void readEntityFromNBT(NBTTagCompound par1nbtTagCompound)

{

super.readEntityFromNBT(par1nbtTagCompound);

byte toDataWatcher = 0;

if(par1nbtTagCompound.getBoolean("headBroken")) toDataWatcher += 1;

if(par1nbtTagCompound.getBoolean("rightWingBroken")) toDataWatcher += (1<<1);

if(par1nbtTagCompound.getBoolean("leftWingBroken")) toDataWatcher += (1<<2);

if(par1nbtTagCompound.getBoolean("tailCut")) toDataWatcher += (1<<3);

this.dataWatcher.updateObject(19, toDataWatcher);

}

@Override

public void initCreature()

{

super.initCreature();

//broken Parts

this.dataWatcher.addObject(19, Byte.valueOf((byte) 0));

//TODO ini the bodyParts

}

@Override

public HashMap<MonsterAttack, Integer> getAttacksWithWeight()

{

HashMap<MonsterAttack, Integer> returnMap= new HashMap<MonsterAttack, Integer>();

for(int i=0;i<this.entityParts.length;i++){

returnMap.put(this.perfomableAttacks, 5);//TODO real values not just 5 for every attack....

}

return returnMap;

}

/**

* @return - compare this bitwise:

* b&1 - whether head is broken

* b&2 -        leftWing is broken

* b&4 -        rightWing is broken

* b&8 -        tail is cutoff

*/

public byte getBrokenParts()

{

return this.dataWatcher.getWatchableObjectByte(17);

}

/**

* Should return false as collision is handeled by the sub-bodyparts.

*/

@Override

public boolean canBeCollidedWith()

{

return false;

}

/**

* Damage should by applied though the sub-bodyparts so this returns false.

* @return - always false

*/

@Override

public boolean attackEntityFrom(DamageSource par1DamageSource, int par2)

{

return true;//FIXME debug value set to false

}

/**

*

*/

public boolean attackEntityFromPart(EntityTigrexPart par1partFrom, DamageSource par1DamageSource, int par2)

{

return !this.isDead;

}

}

 

 

I think this should be enough.... if you need anything more to know why this isn't saved just tell me :D

Link to comment
Share on other sites

Okay I figured it out by myself (this forum isn't very helpful at all  :'( )

But: for anyone after me reading this: entityInit() is not initCreature()

entityInit(): everytime a new creature is created. This means that this is called BEFORE reading from the NBT.

initCreature(): called AFTER NBT-read at spawn. I think the entity is fully initialized at this point which means that you can get the worldObj and tweek your entity in regard of the enviroment it spawned in.

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



×
×
  • Create New...

Important Information

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