HappleAcks
-
Posts
124 -
Joined
-
Last visited
Posts posted by HappleAcks
-
-
Wait a minute, that is even wrong. Something like this.
if (entityhusser.getState()) == 1){
model = new modelrHusser();
}else{
model = new modelrHusser2();
}
But really, you shouldn't construct a new one each time. You need to define them up above as different variables and plug them into model as you go.
I did define them above as variables, at the top in the code I pasted earlier.
-
You are using the same texture for both model's? Possible, but seems odd.
Explain how you changed the model. Did you just say model = model2 or such?
Did you change it in your constructur for RenderLiving, ect? You need to look at the classes you are extending and make sure just changing model really changes everything.
How different is your new model? Your other option is to have everythign in one model and choose which peices to render.
What I did was this:
I know the state function works because it is used inside the entity file to change behaviour and that part works fine.
@SideOnly(Side.CLIENT)
public class RenderHusser extends RenderLiving {
private static final ResourceLocation EntityTexture = new ResourceLocation("darkmod:textures/mobs/Husser.png");
protected modelrHusser model;
protected modelrHusser2 model2;
public RenderrHusser(ModelBase par1ModelBase, float par2) {
super(par1ModelBase, par2);
}
public void renderrHusser(EntityLiving par1EntityLiving, double par2, double par4, double par6, float par8, float par9){
*Bind EntityHusser here*
if (entityhusser.getState()) == 1){
model = ((modelrHusser)mainModel);
}else{
model2= ((modelrHusser2)mainModel);
}
renderrHusser((EntityrHusser)par1EntityLiving, par2, par4, par6, par8, par9);
}
@Override
protected ResourceLocation getEntityTexture(Entity entity) {
return EntityTexture;
}
}
-
Just set model via the entity's state in the renderHusser function.
Tried this, but the model doesn't seem to update.
-
That is true.
But then again: @SideOnly on the render files is not needed. If you do NOT have it and it crashes, adding it will most likely not fix it.
So I just had this issue again, and with the previous fixes.
Particle spawn:
@Override
public void onUpdate()
{
super.onUpdate();
if (!this.worldObj.isRemote) {
for (int var3 = 0; var3 < 8; ++var3)
{
Powder var1 = new Powder(this.worldObj, this.posX, this.posY-1, this.posZ, 0.0D, 0.0D, 0.0D, 5);
FMLClientHandler.instance().getClient().effectRenderer.addEffect(var1);
}
}
}
Particle code:
@SideOnly(Side.CLIENT)
public class Powder extends EntityFX
{
public float portalParticleScale;
public int last;
public Powder (World par1World, double par2, double par4, double par6, double par8, double par10, double par12, int age)
{
super(par1World, par2, par4, par6, par8, par10, par12);
this.last = age;
this.motionX = par8 + (float)(Math.random() * 2.0D - 1.0D) * 0.05F;
this.motionY = par10 + (float)(Math.random() * 2.0D - 1.0D) * 0.05F;
this.motionZ = par12 + (float)(Math.random() * 2.0D - 1.0D) * 0.05F;
float var14 = this.rand.nextFloat() * 0.6F + 0.4F;
this.portalParticleScale = this.particleScale = this.rand.nextFloat() * 0.2F + 0.5F;
this.particleRed = this.particleGreen = this.particleBlue = 1.0F * var14;
this.particleGreen *= 0.3F;
this.particleRed *= 0.9F;
this.particleScale = this.rand.nextFloat() * this.rand.nextFloat() * 6.0F + 1.0F;
this.particleMaxAge = (int)(16.0D / (this.rand.nextFloat() * 0.8D + 0.2D)) + 2;
}
/**
* Called to update the entity's position/logic.
*/
@Override
public void onUpdate()
{
this.prevPosX = this.posX;
this.prevPosY = this.posY;
this.prevPosZ = this.posZ;
if (this.particleAge++ >= this.particleMaxAge)
{
this.setDead();
}
this.setParticleTextureIndex(7 - this.particleAge * last / this.particleMaxAge);
this.motionY += 0.004D;
this.motionX *= 0.8999999761581421D;
this.motionY *= 0.8999999761581421D;
this.motionZ *= 0.8999999761581421D;
if (this.onGround)
{
this.motionX *= 0.699999988079071D;
this.motionZ *= 0.699999988079071D;
}
}
}
-
So if I wanted to change a mob model depending on a state (using a method getState() in the entity file).
My current render file:
@SideOnly(Side.CLIENT)
public class RenderHusser extends RenderLiving {
private static final ResourceLocation EntityTexture = new ResourceLocation("darkmod:textures/mobs/Husser.png");
protected modelrHusser model;
protected modelrHusser2 model2;
public RenderrHusser(ModelBase par1ModelBase, float par2) {
super(par1ModelBase, par2);
model = ((modelrHusser)mainModel);
}
public void renderrHusser(EntityLiving par1EntityLiving, double par2, double par4, double par6, float par8, float par9){
renderrHusser((EntityrHusser)par1EntityLiving, par2, par4, par6, par8, par9);
}
@Override
protected ResourceLocation getEntityTexture(Entity entity) {
return EntityTexture;
}
}
-
I don't see where you are setting your value.
DataWatcher#updateObject(id, newValue) from previous post. not sure the exact syntax and I don't have my code handy right now.
You need to set this value initially with a random.
My bad..
So now it works. I forgot that I removed my random number generator at one point when I implemented the data watcher methods.
-
@OP The render class' getEntityTexture method has an Entity parameter, which is your entity - you can cast it to your custom entity class to access your entity class methods:
protected ResourceLocation getEntityTexture(Entity entity) { // cast to your entity YourEntityClass blah = (YourEntityClass) entity; // now you can access class methods, such as my hypothetical getType() which // returns the integer value from datawatcher used to store the mob's type, i.e. texture switch(blah.getType()) { case 1: return texture1; case 2: return texture2; etc; } }
DataWatcher is just for storing a single value, in this case an integer, that is synchronized between server and client - you set the value on the server, and all of the player clients will see the same value, in this case texture.
@delpi DataWatcher ranges vary from Entity to Entity - players use the most of any, and I tend to start mine at around 21 or 22 just from habit, but if you really need to know exactly which indices are still available, the most sure method of finding out is to open up all the parent classes of the entity in question and look at the constructors and entityInit methods to see which values are used. This page lists some of them, but it may be outdated.
@OP - you may want to check out that link as well, it's a tutorial on DataWatcher, though I think SanAndreasP pretty much covered it all
I'm still having the same problem as before where it only does whatever is the 'default:' in the switch, and without default there it has an error as it thinks it has a chance of not returning anything and thus would want void on the function.
My related code:
In Entity File:
protected void entityInit()
{
super.entityInit();
this.getDataWatcher().addObject(12, Byte.valueOf((byte)0));
this.getDataWatcher().addObject(13, Byte.valueOf((byte)0));
this.getDataWatcher().addObject(25, 5);
}
public int getTextureType()
{
return this.dataWatcher.getWatchableObjectInt(25);
}
In Render File:
@Override
protected ResourceLocation getEntityTexture(Entity entity) {
EntityRider thisentity = (EntityRider) entity;
switch(thisentity.getTextureType()){
case 0:
return EntityTexture1;
case 1:
return EntityTexture2;
case 2:
return EntityTexture3;
case 3:
return EntityTexture4;
case 4:
return EntityTexture5;
default:
return EntityTexture3;
}
}
-
Make sure your texture field is not static, and also that the field is visible / updated on the client. Personally, I use DataWatcher to store an integer that I can retrieve using a method such as 'entity.getType()', and place the switch in my render class as 'switch(((MyEntity) parEntity).getType())'
I haven't worked with the Data Watchers much before, so I got lost a little bit. So I'll create the method, but how do I save and read from the watcher [in order to call from 1 of my 6 possible textures].
First, you need to register a field ("object") inside the DataWatcher with the
DataWatcher#addObject(id, initialValue)
method, preferably inside the
entityInit()
method in your entity.
id
is an unique object id which you need to reference the object. Please note that there are pre-occupied IDs already, so if it crashes with the ID, try another one. Also there's a cap of max. 32 objects within a DataWatcher.
initialValue
is pretty self-explanatory. Possible data types can be:
ItemStack, String, Integer, Short, Byte, Float, ChunkCoordinates
. Either use new DataType() (e.g.
new ItemStack(...)
) or, for primitive datatypes, cast it (e.g. to have a short, use
(short) 10
)
Second, to get an object from the DataWatcher, use
DataWatcher#getWatchableObject[DataType](id)
, where
[DataType]
is the datatype you've defined previously (e.g. for integer, use getWatchableObjectInt(id)). The only exceptions where you can't use this is ChunkCoordinates.
Here's a list of datatypes and getters:
ItemStack : getWatchableObjectItemStack String : getWatchableObjectString Float : getWatchableObjectFloat Integer : getWatchableObjectInt Short : getWatchableObjectShort Byte : getWatchableObjectByte
Third, to write to the defined object, use
DataWatcher#updateObject(id, newValue)
, which follows the same rules as the in initialValue from the registration for the newValue. Also make sure to only update values on the server (worldObj.isRemote == false), or you get discrepancies with client and server.
This was very helpful, but I can't seem to get it to work at all. I've run into a lot of things such as:
1) It won't let me access the value from the render class because it wants it to be static to do that, but a this.x cannot be static [in this case, x is the datawatcher].
2)I don't know how data watchers will help me get any more of a random number than it did before. Because I understand I can generate a random number, saved it in the data watcher and then use it, but I can just do that without a data watcher by generating a random number and using that directly.
-
Make sure your texture field is not static, and also that the field is visible / updated on the client. Personally, I use DataWatcher to store an integer that I can retrieve using a method such as 'entity.getType()', and place the switch in my render class as 'switch(((MyEntity) parEntity).getType())'
I haven't worked with the Data Watchers much before, so I got lost a little bit. So I'll create the method, but how do I save and read from the watcher [in order to call from 1 of my 6 possible textures].
-
So if I have a mob and a few possible textures, how would I make it have a random texture [from my list] each time it spawns.
I've tried doing a switch and generating a random int, but both times it determined the texture for all of them upon startup.
-
That is true.
But then again: @SideOnly on the render files is not needed. If you do NOT have it and it crashes, adding it will most likely not fix it.
Okay good to know. Thank you.
-
@SideOnly does NOT do what you think it does.
You should never actually use it.
@SideOnly(Side.CLIENT) means the class/method/field will not be present in the minecraft_server.jar, only in the minecraft.jar. That means it WILL be present on the Integrated Server.
isRemote doesn't do this and therefor is the way to go.
Is the new place where I placed the isRemote [in previous post] correct? Also, in all my Render files I always have @SideOnly(Side.CLIENT) at the beginning because I was told a while back that's how you make things properly work for SMP. I assume this is okay for the render files though [like the mob render files]. However, for an entity I should always use the isRemote (I already had the isRemote in the weapon code for spawning the entity too)?
-
onUpdate get's called on both client & server.
You must a) check for the client with world.isRemote and
b) not call client-only stuff (particles) from common code (entities).
My bad for B, I didn't actually copy this part, but right before the on update there is:
@SideOnly(Side.CLIENT) <--- This
@Override
public void onUpdate()
{
super.onUpdate();
---
So I can assume the client only thing wasn't a problem. Now, for checking if the world is remote, I do this in the entity projectile file correct? So something like the following:
@SideOnly(Side.CLIENT)
@Override
public void onUpdate()
{
super.onUpdate();
if (!this.worldObj.isRemote) {
for (int var3 = 0; var3 < 8; ++var3)
{
Powder var1 = new Powder(this.worldObj, this.posX, this.posY-1, this.posZ, 0.0D, 0.0D, 0.0D, 5);
FMLClientHandler.instance().getClient().effectRenderer.addEffect(var1);
}
}
}
-
Still unsolved.
Mod works fine in 1024, and grants 0 errors in 1060 so I'm not sure why I'm getting the crash.
-
Can you show your particle spawning code?
The code spawning it from the projectile:
@Override
public void onUpdate()
{
super.onUpdate();
for (int var3 = 0; var3 < 8; ++var3)
{
Powder var1 = new Powder(this.worldObj, this.posX, this.posY-1, this.posZ, 0.0D, 0.0D, 0.0D, 5);
FMLClientHandler.instance().getClient().effectRenderer.addEffect(var1);
}
}
And the actual particle code:
@SideOnly(Side.CLIENT)
public class Powder extends EntityFX
{
public float portalParticleScale;
public int last;
public Powder (World par1World, double par2, double par4, double par6, double par8, double par10, double par12, int age)
{
super(par1World, par2, par4, par6, par8, par10, par12);
this.last = age;
this.motionX = par8 + (float)(Math.random() * 2.0D - 1.0D) * 0.05F;
this.motionY = par10 + (float)(Math.random() * 2.0D - 1.0D) * 0.05F;
this.motionZ = par12 + (float)(Math.random() * 2.0D - 1.0D) * 0.05F;
float var14 = this.rand.nextFloat() * 0.6F + 0.4F;
this.portalParticleScale = this.particleScale = this.rand.nextFloat() * 0.2F + 0.5F;
this.particleRed = this.particleGreen = this.particleBlue = 1.0F * var14;
this.particleGreen *= 0.3F;
this.particleRed *= 0.9F;
this.particleScale = this.rand.nextFloat() * this.rand.nextFloat() * 6.0F + 1.0F;
this.particleMaxAge = (int)(16.0D / (this.rand.nextFloat() * 0.8D + 0.2D)) + 2;
}
/**
* Called to update the entity's position/logic.
*/
@Override
public void onUpdate()
{
this.prevPosX = this.posX;
this.prevPosY = this.posY;
this.prevPosZ = this.posZ;
if (this.particleAge++ >= this.particleMaxAge)
{
this.setDead();
}
this.setParticleTextureIndex(7 - this.particleAge * last / this.particleMaxAge);
this.motionY += 0.004D;
this.motionX *= 0.8999999761581421D;
this.motionY *= 0.8999999761581421D;
this.motionZ *= 0.8999999761581421D;
if (this.onGround)
{
this.motionX *= 0.699999988079071D;
this.motionZ *= 0.699999988079071D;
}
}
}
-
So I got this out of bounds error, and I see it's with the particle effects. I was shooting a weapon that leaves a particle effect trail, so I'm not sure how it got out of bounds.
[19:08:26] [Client thread/FATAL]: Unreported exception thrown!
java.lang.IndexOutOfBoundsException: Index: 3999, Size: 4000
at java.util.ArrayList.rangeCheck(Unknown Source) ~[?:1.7.0_51]
at java.util.ArrayList.get(Unknown Source) ~[?:1.7.0_51]
at net.minecraft.client.particle.EffectRenderer.updateEffects(EffectRenderer.java:77) ~[EffectRenderer.class:?]
at net.minecraft.client.Minecraft.runTick(Minecraft.java:2153) ~[Minecraft.class:?]
at net.minecraft.client.Minecraft.runGameLoop(Minecraft.java:1036) ~[Minecraft.class:?]
at net.minecraft.client.Minecraft.run(Minecraft.java:951) [Minecraft.class:?]
at net.minecraft.client.main.Main.main(Main.java:112) [Main.class:?]
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.7.0_51]
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) ~[?:1.7.0_51]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[?:1.7.0_51]
at java.lang.reflect.Method.invoke(Unknown Source) ~[?:1.7.0_51]
at net.minecraft.launchwrapper.Launch.launch(Launch.java:134) [launchwrapper-1.9.jar:?]
at net.minecraft.launchwrapper.Launch.main(Launch.java:28) [launchwrapper-1.9.jar:?]
-
Still haven't been able to solve this, if it helps anyone here is my class path [if that is the issue] to my main class:
ForgeFolder\src\main\java\com\darkMod\common\DarkMod.java
-
So I just updated to forge build 1060 and I don't have any errors in the mod, but I get this error [and a crash] upon trying to start up MC within development now. The building and updating was successful in gradle.
It only happens when my mod source is in the src folder. Was something changed about the class path that I don't know about?
Description: Initializing game
java.lang.NullPointerException: Initializing game
at cpw.mods.fml.common.registry.FMLControlledNamespacedRegistry.addObjectRaw(FMLControlledNamespacedRegistry.java:393)
at cpw.mods.fml.common.registry.FMLControlledNamespacedRegistry.set(FMLControlledNamespacedRegistry.java:55)
at cpw.mods.fml.common.registry.GameData.set(GameData.java:698)
at cpw.mods.fml.common.registry.GameData.<init>(GameData.java:692)
at cpw.mods.fml.common.registry.GameData.freezeData(GameData.java:645)
at cpw.mods.fml.common.Loader.initializeMods(Loader.java:683)
at cpw.mods.fml.client.FMLClientHandler.finishMinecraftLoading(FMLClientHandler.java:268)
at net.minecraft.client.Minecraft.startGame(Minecraft.java:583)
at net.minecraft.client.Minecraft.run(Minecraft.java:890)
at net.minecraft.client.main.Main.main(Main.java:112)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at net.minecraft.launchwrapper.Launch.launch(Launch.java:134)
at net.minecraft.launchwrapper.Launch.main(Launch.java:28)
A detailed walkthrough of the error, its code path and all known details is as follows:
---------------------------------------------------------------------------------------
-- Head --
Stacktrace:
at cpw.mods.fml.common.registry.FMLControlledNamespacedRegistry.addObjectRaw(FMLControlledNamespacedRegistry.java:393)
at cpw.mods.fml.common.registry.FMLControlledNamespacedRegistry.set(FMLControlledNamespacedRegistry.java:55)
at cpw.mods.fml.common.registry.GameData.set(GameData.java:698)
at cpw.mods.fml.common.registry.GameData.<init>(GameData.java:692)
at cpw.mods.fml.common.registry.GameData.freezeData(GameData.java:645)
at cpw.mods.fml.common.Loader.initializeMods(Loader.java:683)
at cpw.mods.fml.client.FMLClientHandler.finishMinecraftLoading(FMLClientHandler.java:268)
at net.minecraft.client.Minecraft.startGame(Minecraft.java:583)
-- Initialization --
Details:
Stacktrace:
at net.minecraft.client.Minecraft.run(Minecraft.java:890)
at net.minecraft.client.main.Main.main(Main.java:112)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at net.minecraft.launchwrapper.Launch.launch(Launch.java:134)
at net.minecraft.launchwrapper.Launch.main(Launch.java:28)
-- System Details --
Details:
Minecraft Version: 1.7.2
Operating System: Windows 8 (x86) version 6.2
Java Version: 1.7.0_51, Oracle Corporation
Java VM Version: Java HotSpot Client VM (mixed mode), Oracle Corporation
Memory: 754589880 bytes (719 MB) / 1046937600 bytes (998 MB) up to 1046937600 bytes (998 MB)
JVM Flags: 3 total; -Xincgc -Xmx1024M -Xms1024M
AABB Pool Size: 0 (0 bytes; 0 MB) allocated, 0 (0 bytes; 0 MB) used
IntCache: cache: 0, tcache: 0, allocated: 0, tallocated: 0
FML: MCP v9.01-pre FML v7.2.156.1060 Minecraft Forge 10.12.1.1060 4 mods loaded, 4 mods active
mcp{8.09} [Minecraft Coder Pack] (minecraft.jar) Unloaded->Constructed->Pre-initialized->Initialized->Post-initialized->Available
FML{7.2.156.1060} [Forge Mod Loader] (forgeSrc-1.7.2-10.12.1.1060.jar) Unloaded->Constructed->Pre-initialized->Initialized->Post-initialized->Available
Forge{10.12.1.1060} [Minecraft Forge] (forgeSrc-1.7.2-10.12.1.1060.jar) Unloaded->Constructed->Pre-initialized->Initialized->Post-initialized->Available
eternisles{Alpha 1.5} [Eternal Isles] (bin) Unloaded->Constructed->Pre-initialized->Initialized->Post-initialized->Available
Launched Version: 1.6
LWJGL: 2.9.0
OpenGL: GeForce GT 630/PCIe/SSE2 GL version 4.4.0, NVIDIA Corporation
Is Modded: Definitely; Client brand changed to 'fml,forge'
Type: Client (map_client.txt)
Resource Packs: []
Current Language: English (US)
Profiler Position: N/A (disabled)
Vec3 Pool Size: ~~ERROR~~ NullPointerException: null
Anisotropic Filtering: Off (1)
#@!@# Game crashed! Crash report saved to: #@!@# C:\Users\Brendan\Downloads\The Isles\eclipse\.\crash-reports\crash-2014-05-08_09.40.23-client.txt
AL lib: (EE) alc_cleanup: 1 device not closed
-
So I just updated to forge build 1060 and I don't have any errors in the mod, but I get this error [and a crash] upon trying to start up MC within development now. The building and updating was successful in gradle.
It only happens when my mod source is in the src folder. Was something changed about the class path that I don't know about?
Description: Initializing game
java.lang.NullPointerException: Initializing game
at cpw.mods.fml.common.registry.FMLControlledNamespacedRegistry.addObjectRaw(FMLControlledNamespacedRegistry.java:393)
at cpw.mods.fml.common.registry.FMLControlledNamespacedRegistry.set(FMLControlledNamespacedRegistry.java:55)
at cpw.mods.fml.common.registry.GameData.set(GameData.java:698)
at cpw.mods.fml.common.registry.GameData.<init>(GameData.java:692)
at cpw.mods.fml.common.registry.GameData.freezeData(GameData.java:645)
at cpw.mods.fml.common.Loader.initializeMods(Loader.java:683)
at cpw.mods.fml.client.FMLClientHandler.finishMinecraftLoading(FMLClientHandler.java:268)
at net.minecraft.client.Minecraft.startGame(Minecraft.java:583)
at net.minecraft.client.Minecraft.run(Minecraft.java:890)
at net.minecraft.client.main.Main.main(Main.java:112)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at net.minecraft.launchwrapper.Launch.launch(Launch.java:134)
at net.minecraft.launchwrapper.Launch.main(Launch.java:28)
A detailed walkthrough of the error, its code path and all known details is as follows:
---------------------------------------------------------------------------------------
-- Head --
Stacktrace:
at cpw.mods.fml.common.registry.FMLControlledNamespacedRegistry.addObjectRaw(FMLControlledNamespacedRegistry.java:393)
at cpw.mods.fml.common.registry.FMLControlledNamespacedRegistry.set(FMLControlledNamespacedRegistry.java:55)
at cpw.mods.fml.common.registry.GameData.set(GameData.java:698)
at cpw.mods.fml.common.registry.GameData.<init>(GameData.java:692)
at cpw.mods.fml.common.registry.GameData.freezeData(GameData.java:645)
at cpw.mods.fml.common.Loader.initializeMods(Loader.java:683)
at cpw.mods.fml.client.FMLClientHandler.finishMinecraftLoading(FMLClientHandler.java:268)
at net.minecraft.client.Minecraft.startGame(Minecraft.java:583)
-- Initialization --
Details:
Stacktrace:
at net.minecraft.client.Minecraft.run(Minecraft.java:890)
at net.minecraft.client.main.Main.main(Main.java:112)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at net.minecraft.launchwrapper.Launch.launch(Launch.java:134)
at net.minecraft.launchwrapper.Launch.main(Launch.java:28)
-- System Details --
Details:
Minecraft Version: 1.7.2
Operating System: Windows 8 (x86) version 6.2
Java Version: 1.7.0_51, Oracle Corporation
Java VM Version: Java HotSpot Client VM (mixed mode), Oracle Corporation
Memory: 754589880 bytes (719 MB) / 1046937600 bytes (998 MB) up to 1046937600 bytes (998 MB)
JVM Flags: 3 total; -Xincgc -Xmx1024M -Xms1024M
AABB Pool Size: 0 (0 bytes; 0 MB) allocated, 0 (0 bytes; 0 MB) used
IntCache: cache: 0, tcache: 0, allocated: 0, tallocated: 0
FML: MCP v9.01-pre FML v7.2.156.1060 Minecraft Forge 10.12.1.1060 4 mods loaded, 4 mods active
mcp{8.09} [Minecraft Coder Pack] (minecraft.jar) Unloaded->Constructed->Pre-initialized->Initialized->Post-initialized->Available
FML{7.2.156.1060} [Forge Mod Loader] (forgeSrc-1.7.2-10.12.1.1060.jar) Unloaded->Constructed->Pre-initialized->Initialized->Post-initialized->Available
Forge{10.12.1.1060} [Minecraft Forge] (forgeSrc-1.7.2-10.12.1.1060.jar) Unloaded->Constructed->Pre-initialized->Initialized->Post-initialized->Available
eternisles{Alpha 1.5} [Eternal Isles] (bin) Unloaded->Constructed->Pre-initialized->Initialized->Post-initialized->Available
Launched Version: 1.6
LWJGL: 2.9.0
OpenGL: GeForce GT 630/PCIe/SSE2 GL version 4.4.0, NVIDIA Corporation
Is Modded: Definitely; Client brand changed to 'fml,forge'
Type: Client (map_client.txt)
Resource Packs: []
Current Language: English (US)
Profiler Position: N/A (disabled)
Vec3 Pool Size: ~~ERROR~~ NullPointerException: null
Anisotropic Filtering: Off (1)
#@!@# Game crashed! Crash report saved to: #@!@# C:\Users\Brendan\Downloads\The Isles\eclipse\.\crash-reports\crash-2014-05-08_09.40.23-client.txt
AL lib: (EE) alc_cleanup: 1 device not closed
-
So I currently have a ranged mob, which will fire at me and then fire in that direction 5ish times before deciding to change it's direction and fire at me again. It repeats this at all times.
public class EntityBoomer extends EntityMob implements IRangedAttackMob {
private EntityAIArrowAttack aiArrowAttack = new EntityAIArrowAttack(this, this.getEntityAttribute(SharedMonsterAttributes.movementSpeed).getAttributeValue(), 20, 60, 15.0F);
public EntityBoomer (World par1World) {
super(par1World);
float moveSpeed = 0.45F;
this.tasks.addTask(7, new EntityAIArrowAttack(this, this.getEntityAttribute(SharedMonsterAttributes.movementSpeed).getAttributeValue(), 20, 64.0F));
this.tasks.addTask(1, new EntityAISwimming(this));
this.tasks.addTask(2, new EntityAIRestrictSun(this));
this.tasks.addTask(5, new EntityAIWander(this, moveSpeed));
this.tasks.addTask(6, new EntityAIWatchClosest(this, EntityPlayer.class, 8.0F));
this.tasks.addTask(6, new EntityAILookIdle(this));
this.targetTasks.addTask(1, new EntityAIHurtByTarget(this, false));
this.targetTasks.addTask(2, new EntityAINearestAttackableTarget(this, EntityPlayer.class, 0, true));
this.setSize(0.6F, 2.3F);
// TODO Auto-generated constructor stub
}
protected String getLivingSound(){
return "eternisles:BoomerLiving";
}
protected String getDeathSound(){
return "eternisles:BoomerDeath";
}
protected String getHurtSound(){
return "eternisles:BoomerHit";
}
@Override
public void onLivingUpdate(){
super.onLivingUpdate();
}
@Override
protected void entityInit()
{
super.entityInit();
this.dataWatcher.addObject(16, new Integer(5));
}
@Override
public void applyEntityAttributes(){
super.applyEntityAttributes();
this.getEntityAttribute(SharedMonsterAttributes.attackDamage).setBaseValue(6.0D);
this.getEntityAttribute(SharedMonsterAttributes.movementSpeed).setBaseValue(0.5D);
this.getEntityAttribute(SharedMonsterAttributes.maxHealth).setBaseValue(10.0D);
}
@Override
public boolean isAIEnabled()
{
return true;
}
@Override
public void attackEntityWithRangedAttack(EntityLivingBase var1, float f){
EntityBoomerBallvar2 = new EntityBoomerBall(this.worldObj, this, 4.0F);
this.playSound("random.bow", 1.0F, 1.0F / (this.getRNG().nextFloat() * 0.4F + 0.8F));
this.worldObj.spawnEntityInWorld(var2);
}
}
-
So, I noticed that I keep getting a reoccuring bug whenever I used the new AI. The mob will walk towards me but it will be facing on an angle (slightly away from me) while it does it.
My entity class:
public class EntityRunner extends EntityMob { public EntityRunner (World par1World) { super(par1World); this.tasks.addTask(0, new EntityAISwimming(this)); this.tasks.addTask(2, new EntityAIAttackOnCollide(this, EntityPlayer.class, 1.0D, false)); this.tasks.addTask(4, new EntityAIAttackOnCollide(this, EntityVillager.class, 1.0D, true)); this.tasks.addTask(5, new EntityAIMoveTowardsRestriction(this, 1.0D)); this.tasks.addTask(6, new EntityAIMoveThroughVillage(this, 1.0D, false)); this.tasks.addTask(7, new EntityAIWander(this, 1.0D)); this.tasks.addTask(8, new EntityAIWatchClosest(this, EntityPlayer.class, 8.0F)); this.tasks.addTask(8, new EntityAILookIdle(this)); this.targetTasks.addTask(1, new EntityAIHurtByTarget(this, true)); this.targetTasks.addTask(2, new EntityAINearestAttackableTarget(this, EntityPlayer.class, 0, true)); this.targetTasks.addTask(2, new EntityAINearestAttackableTarget(this, EntityVillager.class, 0, false)); this.setSize(1.0F, 1.0F); // TODO Auto-generated constructor stub } protected String getLivingSound(){ return "darkMod:RunnerLiving"; } protected String getDeathSound(){ return "darkMod:RunnerDeath"; } protected String getHurtSound(){ return "darkMod:RunnerHurt"; } protected void func_145780_a(int p_145780_1_, int p_145780_2_, int p_145780_3_, Block p_145780_4_) { this.playSound("mob.pig.step", 0.15F, 1.0F); } protected Entity findPlayerToAttack(){ EntityPlayer entityPlayer = this.worldObj.getClosestVulnerablePlayerToEntity(this, 32.0D); return entityPlayer != null && this.canEntityBeSeen(entityPlayer) ? entityPlayer : null; } public void applyEntityAttributes(){ super.applyEntityAttributes(); this.getEntityAttribute(SharedMonsterAttributes.attackDamage).setBaseValue(5.0D); this.getEntityAttribute(SharedMonsterAttributes.followRange).setBaseValue(52.0D); this.getEntityAttribute(SharedMonsterAttributes.knockbackResistance).setBaseValue(0.0D); this.getEntityAttribute(SharedMonsterAttributes.movementSpeed).setBaseValue(0.54D); this.getEntityAttribute(SharedMonsterAttributes.maxHealth).setBaseValue(13.0D); } @Override protected boolean isAIEnabled() { return true; } }
-
Hi
This link might help, it worked for 1.6.4 and might still be valid (not sure)
-TGG
Which link?
You stack the images vertically in a *.png, then add a *.png.mcmeta with the same name.
{ "animation": {} }
I was under the impression this was phased out when they separated the images a few updates ago, but if it still works that's great! Where do I put the "animation" though? (Also is that the actual code or is it a form of suedocode?)
-
Is it just a simple block texture or is it an "entity texture" for a custom tile entity renderer?
Simple block.
-
So, if I have a block, how can I make the texture on it animate (if I have a bunch of images for each frame). I know Minecraft added support for it, but I don't know how to make it cycle through the textures.
Change mob model depending on state?
in Modder Support
Posted
This looks very helpful, but it might be a bit much just to make my pet sit. :\