Jump to content

Recommended Posts

Posted

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

Posted

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

Posted

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.

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

    • Please see https://forums.minecraftforge.net/topic/125488-rules-and-frequently-asked-questions-faq/ for information on how to post your log correctly.
    • Hello!  The detailed description of how you got to where you are is certainly valuable.  But, at the end of the day (well, any time of the day actually), it is going to be the actual logs that going to provide the necessary details to hopefully solve your startup issue. Part of me wonders if you have installed a client-only mod on a dedicated server.  But I may very well be wrong, and it will be the logs that will tell that story.
    • Hello there! I didn't quite know where to go regarding this, but ended up deciding to post it here. I have been running a forge server with around 200 mods for me and some friends to play on casually, but have recently started to get an issue when booting the server. This all started after I decided to add some new mods to the server. Like usual, I add a mod, test run the server for any issues, and if all is well, I'll add a next one and so on until I have added all that I wanted to. After doing so, in all test runs, it all seemed to work just fine. However, the next day, after trying to boot the server, I kept getting an error regarding java.lang.NullPointerException, towards one of the mods I had recently added. So far so good, I removed the mod that was causing the issue, started up the server again, and here in when things took a turn for the worse. I received another java.lang.NullPointerException null error that wouldn't allow me to boot the server, but this time with a mod that wasn't part of the new ones I had recently added. I found this weird, but nonetheless, I removed it thinking it might be causing some conflicts with some of the new ones. Afterwards, booting the server again proved to be impossible, as it gave me another java.lang.NullPointerException null error with the 3rd mod I had ever installed on the server! This mod was there since the start, it added some biomes and had been just fine so far. This turn of events made me remove all the newer mods I had recently added in hopes to fix this whole ordeal, but alas, to no avail. Same error, with that same biome mod that had been there since day one. Reluctantly, I removed the biome mod, booted the server, and voila! The server was running, although without a major mod that had always been there to begin with. As I do not wish to part ways with this mod, specially since it had been working so far without any issues, I tried to bring everything back to how it was before I added those new mods, but kept on getting the same java.lang.NullPointerException null error for the biome mod. Even adding the newer mods won't cause me this error, with exception of the one that started it all, which I find quite odd since the mods I had been using without any issues are now giving me the same error the newer one that started it all gave me. Now, I have checked that everything is up to date regarding the mods, forge (forge-1.20.1-47.3.12) and java. The modpack runs perfectly fine when I start Minecraft itself, and play singleplayer, or even when I open a LAN world, everything works. Everything aside from the server. From what I could gather, this java.lang.NullPointerException null error would point to a missing value of sorts, for an item perhaps, within the mod that is causing the error, but aside from removing the whole mod, I lack the knowledge on how to fix this. With this in mind, if anyone would be so kind as to shine some light into this situation, with a way to fix all this blunder, I would be most grateful!
    • If you want a mana GUI, call Minecraft.getInstance().setScreen(new ManaScreen()); somewhere display your GUI. I would recommend creating a keybind and listening to key events, and if your key bind is pressed down, running that code.
    • You are creating an entire new screen, or GUI. What you probably want is an Overlay.
  • Topics

×
×
  • Create New...

Important Information

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