Modding questions! Hello! i am a decently experienced modder, having done many things with my mods, including a custom level system for every mob, dimensions, gui's, HUD drawing, mobs, items, commands, advanced configs, biomes, blocks, potions, creative tabs, tile entities and more! i was bored and decided to start this thread, so that other modders can look at this for a reference, because some things in the internet are buried SO deep that it takes days to find an answer to. So i want anyone with questions about modding to post the question below and i will add it to the post!
How do I make my mob destroy blocks and shoot fire out of it's mouth? I also want it to do some animation attacks. sorry im new to modding
for breaking blocks, put this into the onLivingUpdate() method:
int time = 20; //change this variable to change how many times it goes per second. 20 is one second
if(this.ticksExisted % time == 0)
{
int amount = 1; //change this variable to alter how many blocks it breaks each time.
int range = 16; //change this to alter the spread of the blocks.
Block block = Blocks.air; //change this to set the block to a different block.
for(int i = 0; i < amount; ++i)
{
int x = (int)this.posX + (rand.nextInt(range) - range);
int z = (int)this.posZ + (rand.nextInt(range) - range);
int y = this.worldObj.getHeightValue(x, z) - 1;
this.worldObj.setBlock(x, y, z, block, 0, 3);
}
}
for shooting fireballs, just look at the blaze code, thats what i first used.
for making animated attacks, do you just mean like the blazes, where it sets on fire? or do you mean a model part moving?
Sure why not... I'm lead designer, texturer and manager of a mod development team. I have no idea if my coder knows how to do this or not since we are just getting started on our first (well technically second) mod but pretty sure he could figure it out since he works in application development for a federal bank. Anyways, I thought I would preemptively ask on his behalf how to go about pursuing a process that we are going to need done. How do you go about adding custom models as blocks or entities? Do they have to be a particular file-type? My modeler is experienced with 3D Studio Max but he's new to the modding experience. I'm sure there is information about this out there but 1.7.2 may have changed that and sometimes its just easier to ask someone who knows than scrounge around looking for old information. Thanks in advance.
well okey this helped me a lot now the other thing is how do i do the instance in the preInit method ? could you give me an example for the code if the biome class would be named BiomeGenExample ?
here is the code:
@EventHandler
public void load(FMLInitializationEvent event)
{
ModFile.EXAMPLE_BIOME = new BiomeGenExample(ModFile.ID_BIOME_EXAMPLE);
}
Sure why not... I'm lead designer, texturer and manager of a mod development team. I have no idea if my coder knows how to do this or not since we are just getting started on our first (well technically second) mod but pretty sure he could figure it out since he works in application development for a federal bank. Anyways, I thought I would preemptively ask on his behalf how to go about pursuing a process that we are going to need done. How do you go about adding custom models as blocks or entities? Do they have to be a particular file-type? My modeler is experienced with 3D Studio Max but he's new to the modding experience. I'm sure there is information about this out there but 1.7.2 may have changed that and sometimes its just easier to ask someone who knows than scrounge around looking for old information. Thanks in advance.
to add a Model to a block, you need 4 classes: a ModelBase class, a TileEntity class, a Block class & a TileEntitySpecialRenderer class. here is an example:
BlockExample:
public class BlockExample extends BlockContainer
{
//essential methods, so that the model is visible
public int getRenderType()
{
return -1;
}
public boolean isOpaqueCube()
{
return false;
}
public boolean renderAsNormalBlock()
{
return false;
}
@Override
public TileEntity createNewTileEntity(World var1, int var2)
{
return new TileEntityExample();
}
/**
* Called when the block is placed in the world.
*/
public void onBlockPlacedBy(World w, int x, int y, int z, EntityLivingBase e, ItemStack i)
{
super.onBlockPlacedBy(w, x, y, z, e, i);
if (i.hasDisplayName())
{
}
}
}
for the TileEntity class:
You can add methods to this to make it more complex. But for a modeled block, this is all you need:
public class TileEntityExample extends TileEntity
{
}
for the TileEntitySpecialRenderer class:
public class TileEntityExampleRenderer extends TileEntitySpecialRenderer
{
public ModelExample model = new ModelExample();
@Override
public void renderTileEntityAt(TileEntity var1, double var2, double var4, double var6, float var8)
{
this.renderTileEntityTrophyAt((TileEntityExample) var1, var2, var4, var6, var8);
}
private void renderTileEntityTrophyAt(TileEntityExample t, double x, double y, double z, float partialTime)
{
GL11.glPushMatrix();
GL11.glTranslated(x + 0.5D, y + 1.5D, z + 0.5D);
this.bindTexture(new ResourceLocation("creaturelevels", "textures/entity/example.png"));
GL11.glEnable(GL12.GL_RESCALE_NORMAL);
GL11.glScalef(1.0F, -1.0F, -1.0F);
model.render((Entity)null, 0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0625F);
GL11.glDisable(GL12.GL_RESCALE_NORMAL);
GL11.glScalef(1.0F, 1.0F, 1.0F);
GL11.glPopMatrix();
}
}
The model class just needs to extends ModelBase, it can be a normal model, so there is nothing extra that you need!
for breaking blocks, put this into the onLivingUpdate() method:
int time = 20; //change this variable to change how many times it goes per second. 20 is one second
if(this.ticksExisted % time == 0)
{
int amount = 1; //change this variable to alter how many blocks it breaks each time.
int range = 16; //change this to alter the spread of the blocks.
Block block = Blocks.air; //change this to set the block to a different block.
for(int i = 0; i < amount; ++i)
{
int x = (int)this.posX + (rand.nextInt(range) - range);
int z = (int)this.posZ + (rand.nextInt(range) - range);
int y = this.worldObj.getHeightValue(x, z) - 1;
this.worldObj.setBlock(x, y, z, block, 0, 3);
}
}
for shooting fireballs, just look at the blaze code, thats what i first used.
for making animated attacks, do you just mean like the blazes, where it sets on fire? or do you mean a model part moving?
I found out that all you need to do is make an instance of the biome in your onInit method in the main mod file and it should register.
I mean model moving, like I want my mob to open it's mouth everytime it breathes fire
I mean model moving, like I want my mob to open it's mouth everytime it breathes fire
Thats easy enough, so what you can do, is this to your model file:
/**
* Used for easily adding entity-dependent animations. The second and third float params here are the same second
* and third as in the setRotationAngles method.
*/
public void setLivingAnimations(EntityLivingBase e, float par2, float par3, float par4)
{
super.setLivingAnimations(e, par2, par3, par4);
this.fireAngle= ((EntityExample)e).fireBreathAngle;
}
then put a field called fireBreathAngle in your mob file, a field called fireAngle in your model file, and change fireBreathAngle as it breathes fire and change it back when it's done breathing fire! or, what i do, is i have a second parameter, that decides whether it slowly increments up, or slowly increments down, or stays put.
public int jawDirection;
then to apply the animation, just go to the setRotation angles method and do this:
/**
* Sets the model's various rotation angles. For s, par1 and par2 are used for animating the movement of arms
* and legs, where par1 represents the time(so that arms and legs swing back and forth) and par2 represents how
* "far" arms and legs can swing at most.
*/
public void setRotationAngles(float par1, float par2, float par3, float par4, float par5, float par6, Entity par7Entity)
{
this.jaw.rotateAngleX = par5 / (180F / (float)Math.PI) + this.fireAngle;
}
Thats easy enough, so what you can do, is this to your model file:
/**
* Used for easily adding entity-dependent animations. The second and third float params here are the same second
* and third as in the setRotationAngles method.
*/
public void setLivingAnimations(EntityLivingBase e, float par2, float par3, float par4)
{
super.setLivingAnimations(e, par2, par3, par4);
this.fireAngle= ((EntityExample)e).fireBreathAngle;
}
then put a field called fireBreathAngle in your mob file, a filed called fireAngle in your model file, and change fireBreathAngle as it breathes fire and change it back when it's done breathing fire! or, what i do, is i have a second parameter, that decides whether it slowly increments up, or slowly increments down, or stays put.
public int jawDirection;
then to apply the animation, just go to the setRotation angles method and do this:
/**
* Sets the model's various rotation angles. For s, par1 and par2 are used for animating the movement of arms
* and legs, where par1 represents the time(so that arms and legs swing back and forth) and par2 represents how
* "far" arms and legs can swing at most.
*/
public void setRotationAngles(float par1, float par2, float par3, float par4, float par5, float par6, Entity par7Entity)
{
this.jaw.rotateAngleX = par5 / (180F / (float)Math.PI) + this.fireAngle;
}
Where is the parameter? will both options have the same effect?
Where is the parameter? will both options have the same effect?
there is one parameter in the mob file, a float called "fireBreathAngle", and a float in your model file called "fireAngle". The fireBreathAngle gives you the seperation between entities so that only one mob at a time will breathe fire, instead of all of them breathing fire at once. The fireAngle is a copy of fireBreathAngle, but gets reset after rendering each entity, if you put it in setLivingAnimations, because in setLivingAnimations, the render file calls that as it's own model, not the universal model.
So basically, one in the Entity file for control, and one in the ModelBase file for output.
Hey Fire, I do have a question for you and hope its one that you can answer.
Without using FORGE, and only using MCP, I'm trying to figure out how to intercept and modify packets on the CLIENT SIDE. (I know your title says "Forge", but thought I'd ask how to do it without)
So for instance, I am wanting to:
1. Intercept the packet responsible for the "Flying Speed", and modify it.
2. intercept the packet responsible for displaying the F3 information, and modify it.
If you have an answer, it would be great if you could explain exactly what .class file to modify, along with the exact code.
there is one parameter in the mob file, a float called "fireBreathAngle", and a float in your model file called "fireAngle". The fireBreathAngle gives you the seperation between entities so that only one mob at a time will breathe fire, instead of all of them breathing fire at once. The fireAngle is a copy of fireBreathAngle, but gets reset after rendering each entity, if you put it in setLivingAnimations, because in setLivingAnimations, the render file calls that as it's own model, not the universal model.
So basically, one in the Entity file for control, and one in the ModelBase file for output.
Thanks man! this helps a lot. (might come back for more stupid questions I can solve on my own :P)
EntityFishHook looks overwhelming and i can't find any tutorial on that, can you help me?(make a tutorial of custom fishingrod and fish hook)
here is a pastebin i made of an EntityExampleFishHook, which is identical to the regular one, but has all the fields renamed to be user friendly. http://pastebin.com/PJm0xA1c
Hey Fire, I do have a question for you and hope its one that you can answer. Without using FORGE, and only using MCP, I'm trying to figure out how to intercept and modify packets on the CLIENT SIDE. (I know your title says "Forge", but thought I'd ask how to do it without) So for instance, I am wanting to: 1. Intercept the packet responsible for the "Flying Speed", and modify it. 2. intercept the packet responsible for displaying the F3 information, and modify it. If you have an answer, it would be great if you could explain exactly what .class file to modify, along with the exact code. Much appreciated!
I would really love to help you, but im not very experienced with non forge modding... i can't help you with that.
So, I saw this thread and couldn't help asking on how to damage an Item when used on a crafting recipe, either an explanation or a sample code should be good. Thanks in advance.
What you should do is make an ICraftingHandler, and put this code in the ICraftingHandler:
Is there a way to prevent a vanilla biome from generating?
Hmm... i know of a way, though it's very risky, but ill show you it.
I will show you how to do this using reflections, but i will include in the code a copy of the BiomeGenBase.biomeList, so you can edit the biome if needed.
here is what you put in your preInit method:
BiomeGenBase[] biomeArray = null;
for (Field f : BiomeGenBase.class.getDeclaredFields())
{
f.setAccessible(true);
try
{
if (f.getName().equals("biomeList"))
{
Field modfield = Field.class.getDeclaredField("modifiers");
modfield.setAccessible(true);
modfield.setInt(f, f.getModifiers() & ~Modifier.FINAL);
biomeArray = (BiomeGenBase[])f.get(null);
final BiomeGenBase[] newBiomeArray = new BiomeGenBase[256];
//Do what you want to edit with newBiomeArray, BiomeGenBase.biomeList will equal it after the method below.
System.arraycopy(potionTypes, 0, newBiomeArray, 0, potionTypes.length);
f.set(null, newBiomeArray);
}
}
catch (Exception e)
{
System.err.println("Severe error while changing BiomeGenBase.biomeList, please report this to the mod author:");
e.printStackTrace();
}
}
Nope, not a problem! But yeah, I kinda had the feeling that you wouldn't be able to. Well, could you tell me how you would do it in Forge then? Maybe I can apply that on my own if I could see how others are doing it. Thanks!
I'll answer you later, i got to go, but i'll edit this post once i have time to give you an answer, sorry, i'll update it soon!
Thankyousomuchhhhhhhhhhhhhh It's easier to understandnow
but i crash when i tried to cast the hook
---- Minecraft Crash Report ----
// Hi. I'm Minecraft, and I'm a crashaholic.
Time: 26/4/2557, 8:12 น.
Description: Ticking entity
java.lang.NullPointerException: Ticking entity
at net.minecraft.entity.projectile.EntityFishHook.onUpdate(SourceFile:197)
at chett.fishymod.entity.EntityExampleFishHook.onUpdate(EntityExampleFishHook.java:182)
at net.minecraft.world.World.updateEntityWithOptionalForce(World.java:2019)
at net.minecraft.world.WorldServer.updateEntityWithOptionalForce(WorldServer.java:659)
at net.minecraft.world.World.updateEntity(World.java:1983)
at net.minecraft.world.World.updateEntities(World.java:1836)
at net.minecraft.world.WorldServer.updateEntities(WorldServer.java:500)
at net.minecraft.server.MinecraftServer.updateTimeLightAndEntities(MinecraftServer.java:616)
at net.minecraft.server.MinecraftServer.tick(MinecraftServer.java:527)
at net.minecraft.server.integrated.IntegratedServer.tick(IntegratedServer.java:111)
at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:414)
at net.minecraft.server.MinecraftServer$2.run(MinecraftServer.java:665)
A detailed walkthrough of the error, its code path and all known details is as follows:
---------------------------------------------------------------------------------------
-- Head --
Stacktrace:
at net.minecraft.entity.projectile.EntityFishHook.onUpdate(SourceFile:197)
at chett.fishymod.entity.EntityExampleFishHook.onUpdate(EntityExampleFishHook.java:182)
at net.minecraft.world.World.updateEntityWithOptionalForce(World.java:2019)
at net.minecraft.world.WorldServer.updateEntityWithOptionalForce(WorldServer.java:659)
at net.minecraft.world.World.updateEntity(World.java:1983)
-- Entity being ticked --
Details:
Entity Type: EntityExampleFishHook (chett.fishymod.entity.EntityExampleFishHook)
Entity ID: 71
Entity Name: entity.EntityExampleFishHook.name
Entity's Exact location: 465.24, 17.52, -50.44
Entity's Block location: World: (465,17,-51), Chunk: (at 1,1,13 in 29,-4; contains blocks 464,0,-64 to 479,255,-49), Region: (0,-1; contains chunks 0,-32 to 31,-1, blocks 0,0,-512 to 511,255,-1)
Entity's Momentum: -1.48, 0.26, -0.12
Stacktrace:
at net.minecraft.world.World.updateEntities(World.java:1836)
at net.minecraft.world.WorldServer.updateEntities(WorldServer.java:500)
-- Affected level --
Details:
Level name: New World
All players: 1 total; [EntityPlayerMP['Player192'/39, l='New World', x=465.23, y=16.00, z=-50.28]]
Chunk stats: ServerChunkCache: 625 Drop: 0
Level seed: 7999106561926874898
Level generator: ID 01 - flat, ver 0. Features enabled: true
Level generator options: 2;7,5x1,5x3,5x12,9;1;biome_1,village
Level spawn location: World: (460,4,-40), Chunk: (at 12,0,8 in 28,-3; contains blocks 448,0,-48 to 463,255,-33), Region: (0,-1; contains chunks 0,-32 to 31,-1, blocks 0,0,-512 to 511,255,-1)
Level time: 1673 game time, 1673 day time
Level dimension: 0
Level storage version: 0x04ABD - Anvil
Level weather: Rain time: 150986 (now: false), thunder time: 98107 (now: false)
Level game mode: Game mode: survival (ID 0). Hardcore: false. Cheats: true
Stacktrace:
at net.minecraft.server.MinecraftServer.updateTimeLightAndEntities(MinecraftServer.java:616)
at net.minecraft.server.MinecraftServer.tick(MinecraftServer.java:527)
at net.minecraft.server.integrated.IntegratedServer.tick(IntegratedServer.java:111)
at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:414)
at net.minecraft.server.MinecraftServer$2.run(MinecraftServer.java:665)
-- System Details --
Details:
Minecraft Version: 1.7.2
Operating System: Windows 7 (amd64) version 6.1
Java Version: 1.7.0_03, Oracle Corporation
Java VM Version: Java HotSpot™ 64-Bit Server VM (mixed mode), Oracle Corporation
Memory: 867008888 bytes (826 MB) / 1038876672 bytes (990 MB) up to 1038876672 bytes (990 MB)
JVM Flags: 3 total; -Xincgc -Xmx1024M -Xms1024M
AABB Pool Size: 677 (37912 bytes; 0 MB) allocated, 329 (18424 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 5 mods loaded, 5 mods active
mcp{8.09} [Minecraft Coder Pack] (minecraft.jar) Unloaded->Constructed->Pre-initialized->Initialized->Post-initialized->Available->Available->Available->Available
FML{7.2.156.1060} [Forge Mod Loader] (forgeBin-1.7.2-10.12.1.1060.jar) Unloaded->Constructed->Pre-initialized->Initialized->Post-initialized->Available->Available->Available->Available
Forge{10.12.1.1060} [Minecraft Forge] (forgeBin-1.7.2-10.12.1.1060.jar) Unloaded->Constructed->Pre-initialized->Initialized->Post-initialized->Available->Available->Available->Available
FishyMod{1.0.0 Alpha} [Fishy Mod] (bin) Unloaded->Constructed->Pre-initialized->Initialized->Post-initialized->Available->Available->Available->Available
examplemod{1.0} [Example Mod] (bin) Unloaded->Constructed->Pre-initialized->Initialized->Post-initialized->Available->Available->Available->Available
Profiler Position: N/A (disabled)
Vec3 Pool Size: 285 (15960 bytes; 0 MB) allocated, 51 (2856 bytes; 0 MB) used
Player Count: 1 / 8; [EntityPlayerMP['Player192'/39, l='New World', x=465.23, y=16.00, z=-50.28]]
Type: Integrated Server (map_client.txt)
Is Modded: Definitely; Client brand changed to 'fml,forge'
i'm using your exact code apart from the package
// i just replace super.onUpdate() with super.onEntityUpdate() and now it work
//new problem. fishing line is not rendered and when i tried to retract the hook ,it crashed.
Hmm... i know of a way, though it's very risky, but ill show you it.
I will show you how to do this using reflections, but i will include in the code a copy of the BiomeGenBase.biomeList, so you can edit the biome if needed.
here is what you put in your preInit method:
Thanks! Ill definitely try it. But just so I know, what kind of risks are we talking?
Is it something that could mess with the end user? difficulty in updating when vanilla/forge updates?
Or something more runtime?
EDIT:
also, what is potionTypes and what does it have to do with biomes?
eclipse doesn't suggest anything to import for it...
EDIT2:
ok so something like this?
BiomeGenBase[] biomeArray = null;
for (Field f : BiomeGenBase.class.getDeclaredFields())
{
f.setAccessible(true);
try
{
if (f.getName().equals("biomeList"))
{
Field modfield = Field.class.getDeclaredField("modifiers");
modfield.setAccessible(true);
modfield.setInt(f, f.getModifiers() & ~Modifier.FINAL);
biomeArray = (BiomeGenBase[])f.get(null);
final BiomeGenBase[] newBiomeArray = new BiomeGenBase[256];
int bL = newBiomeArray.length;
for (int i = 0; i <= bL; i++)
{
if (newBiomeArray[bL] == BiomeGenBase.roofedForest
|| newBiomeArray[bL] == BiomeGenBase.mushroomIsland
|| newBiomeArray[bL] == BiomeGenBase.mushroomIslandShore)
{
newBiomeArray[bL] = (new BiomeGenPlains(1)).setColor(9286496).setBiomeName("Plains");
}
}
System.arraycopy(biomeArray, 0, newBiomeArray, 0, biomeArray.length);
f.set(null, newBiomeArray);
}
}
catch (Exception e)
{
System.err.println("Severe error while changing BiomeGenBase.biomeList, please report this to the mod author:");
e.printStackTrace();
}
}
Thanks! Ill definitely try it. But just so I know, what kind of risks are we talking? Is it something that could mess with the end user? difficulty in updating when vanilla/forge updates? Or something more runtime? EDIT: also, what is potionTypes and what does it have to do with biomes? eclipse doesn't suggest anything to import for it... EDIT2: ok so something like this?
BiomeGenBase[] biomeArray = null; for (Field f : BiomeGenBase.class.getDeclaredFields()) { f.setAccessible(true); try { if (f.getName().equals("biomeList")) { Field modfield = Field.class.getDeclaredField("modifiers"); modfield.setAccessible(true); modfield.setInt(f, f.getModifiers() & ~Modifier.FINAL); biomeArray = (BiomeGenBase[])f.get(null); final BiomeGenBase[] newBiomeArray = new BiomeGenBase[256]; int bL = newBiomeArray.length; for (int i = 0; i <= bL; i++) { if (newBiomeArray[bL] == BiomeGenBase.roofedForest || newBiomeArray[bL] == BiomeGenBase.mushroomIsland || newBiomeArray[bL] == BiomeGenBase.mushroomIslandShore) { newBiomeArray[bL] = (new BiomeGenPlains(1)).setColor(9286496).setBiomeName("Plains"); } } System.arraycopy(biomeArray, 0, newBiomeArray, 0, biomeArray.length); f.set(null, newBiomeArray); } } catch (Exception e) { System.err.println("Severe error while changing BiomeGenBase.biomeList, please report this to the mod author:"); e.printStackTrace(); } }
The risks is other biome mods might want to add biomes, but by removing the biome array and replacing it might screw up biome specific stuff, and with the = (new BiomeGenPlains(1)), change the 1 to bL, so that it replaces the biomeID too, otherwise you WILL mess up the biomes in minecraft, so by doing that it fully replaces the biome.
Thankyousomuchhhhhhhhhhhhhh It's easier to understandnow but i crash when i tried to cast the hook i'm using your exact code apart from the package // i just replace super.onUpdate() with super.onEntityUpdate() and now it work //new problem. fishing line is not rendered and when i tried to retract the hook ,it crashed.
Just don't call it, or, if that doesn't work, just call it as super.onUpdate(). I found that with some of the entities, you need to extend a class that extends EntityLivingBase for it to render. As for the crashing when you retract the hook, that has the reason of super.onEntityUpdate();
And to Saki2fifty, look at this tutorial for packet handling in forge. I hope it helps!
Hello! i am a decently experienced modder, having done many things with my mods, including a custom level system for every mob, dimensions, gui's, HUD drawing, mobs, items, commands, advanced configs, biomes, blocks, potions, creative tabs, tile entities and more! i was bored and decided to start this thread, so that other modders can look at this for a reference, because some things in the internet are buried SO deep that it takes days to find an answer to. So i want anyone with questions about modding to post the question below and i will add it to the post!
97
for breaking blocks, put this into the onLivingUpdate() method:
for shooting fireballs, just look at the blaze code, thats what i first used.
for making animated attacks, do you just mean like the blazes, where it sets on fire? or do you mean a model part moving?
I found out that all you need to do is make an instance of the biome in your onInit method in the main mod file and it should register.
97
here is the code:
to add a Model to a block, you need 4 classes: a ModelBase class, a TileEntity class, a Block class & a TileEntitySpecialRenderer class. here is an example:
BlockExample:
for the TileEntity class:
You can add methods to this to make it more complex. But for a modeled block, this is all you need:
for the TileEntitySpecialRenderer class:
The model class just needs to extends ModelBase, it can be a normal model, so there is nothing extra that you need!
Hope i helped
97
I mean model moving, like I want my mob to open it's mouth everytime it breathes fire
Thats easy enough, so what you can do, is this to your model file:
then put a field called fireBreathAngle in your mob file, a field called fireAngle in your model file, and change fireBreathAngle as it breathes fire and change it back when it's done breathing fire! or, what i do, is i have a second parameter, that decides whether it slowly increments up, or slowly increments down, or stays put.
then to apply the animation, just go to the setRotation angles method and do this:
97
Where is the parameter? will both options have the same effect?
there is one parameter in the mob file, a float called "fireBreathAngle", and a float in your model file called "fireAngle". The fireBreathAngle gives you the seperation between entities so that only one mob at a time will breathe fire, instead of all of them breathing fire at once. The fireAngle is a copy of fireBreathAngle, but gets reset after rendering each entity, if you put it in setLivingAnimations, because in setLivingAnimations, the render file calls that as it's own model, not the universal model.
So basically, one in the Entity file for control, and one in the ModelBase file for output.
97
Without using FORGE, and only using MCP, I'm trying to figure out how to intercept and modify packets on the CLIENT SIDE. (I know your title says "Forge", but thought I'd ask how to do it without)
So for instance, I am wanting to:
1. Intercept the packet responsible for the "Flying Speed", and modify it.
2. intercept the packet responsible for displaying the F3 information, and modify it.
If you have an answer, it would be great if you could explain exactly what .class file to modify, along with the exact code.
Much appreciated!
http://www.sakkiswonderland.com
Thanks man! this helps a lot. (might come back for more stupid questions I can solve on my own :P)
You're welcome!
here is a pastebin i made of an EntityExampleFishHook, which is identical to the regular one, but has all the fields renamed to be user friendly. http://pastebin.com/PJm0xA1c
I would really love to help you, but im not very experienced with non forge modding... i can't help you with that.
What you should do is make an ICraftingHandler, and put this code in the ICraftingHandler:
and put this in your mod file, in the .load(FMLInitializationEvent event) method:
and that should work!
and again Saki2fifty, sorry i can't help you, i wish i could.
97
Nope, not a problem! But yeah, I kinda had the feeling that you wouldn't be able to.
Well, could you tell me how you would do it in Forge then? Maybe I can apply that on my own if I could see how others are doing it.
Thanks!
http://www.sakkiswonderland.com
Hmm... i know of a way, though it's very risky, but ill show you it.
I will show you how to do this using reflections, but i will include in the code a copy of the BiomeGenBase.biomeList, so you can edit the biome if needed.
here is what you put in your preInit method:
I'll answer you later, i got to go, but i'll edit this post once i have time to give you an answer, sorry, i'll update it soon!
97
but i crash when i tried to cast the hook
---- Minecraft Crash Report ----
// Hi. I'm Minecraft, and I'm a crashaholic.
Time: 26/4/2557, 8:12 น.
Description: Ticking entity
java.lang.NullPointerException: Ticking entity
at net.minecraft.entity.projectile.EntityFishHook.onUpdate(SourceFile:197)
at chett.fishymod.entity.EntityExampleFishHook.onUpdate(EntityExampleFishHook.java:182)
at net.minecraft.world.World.updateEntityWithOptionalForce(World.java:2019)
at net.minecraft.world.WorldServer.updateEntityWithOptionalForce(WorldServer.java:659)
at net.minecraft.world.World.updateEntity(World.java:1983)
at net.minecraft.world.World.updateEntities(World.java:1836)
at net.minecraft.world.WorldServer.updateEntities(WorldServer.java:500)
at net.minecraft.server.MinecraftServer.updateTimeLightAndEntities(MinecraftServer.java:616)
at net.minecraft.server.MinecraftServer.tick(MinecraftServer.java:527)
at net.minecraft.server.integrated.IntegratedServer.tick(IntegratedServer.java:111)
at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:414)
at net.minecraft.server.MinecraftServer$2.run(MinecraftServer.java:665)
A detailed walkthrough of the error, its code path and all known details is as follows:
---------------------------------------------------------------------------------------
-- Head --
Stacktrace:
at net.minecraft.entity.projectile.EntityFishHook.onUpdate(SourceFile:197)
at chett.fishymod.entity.EntityExampleFishHook.onUpdate(EntityExampleFishHook.java:182)
at net.minecraft.world.World.updateEntityWithOptionalForce(World.java:2019)
at net.minecraft.world.WorldServer.updateEntityWithOptionalForce(WorldServer.java:659)
at net.minecraft.world.World.updateEntity(World.java:1983)
-- Entity being ticked --
Details:
Entity Type: EntityExampleFishHook (chett.fishymod.entity.EntityExampleFishHook)
Entity ID: 71
Entity Name: entity.EntityExampleFishHook.name
Entity's Exact location: 465.24, 17.52, -50.44
Entity's Block location: World: (465,17,-51), Chunk: (at 1,1,13 in 29,-4; contains blocks 464,0,-64 to 479,255,-49), Region: (0,-1; contains chunks 0,-32 to 31,-1, blocks 0,0,-512 to 511,255,-1)
Entity's Momentum: -1.48, 0.26, -0.12
Stacktrace:
at net.minecraft.world.World.updateEntities(World.java:1836)
at net.minecraft.world.WorldServer.updateEntities(WorldServer.java:500)
-- Affected level --
Details:
Level name: New World
All players: 1 total; [EntityPlayerMP['Player192'/39, l='New World', x=465.23, y=16.00, z=-50.28]]
Chunk stats: ServerChunkCache: 625 Drop: 0
Level seed: 7999106561926874898
Level generator: ID 01 - flat, ver 0. Features enabled: true
Level generator options: 2;7,5x1,5x3,5x12,9;1;biome_1,village
Level spawn location: World: (460,4,-40), Chunk: (at 12,0,8 in 28,-3; contains blocks 448,0,-48 to 463,255,-33), Region: (0,-1; contains chunks 0,-32 to 31,-1, blocks 0,0,-512 to 511,255,-1)
Level time: 1673 game time, 1673 day time
Level dimension: 0
Level storage version: 0x04ABD - Anvil
Level weather: Rain time: 150986 (now: false), thunder time: 98107 (now: false)
Level game mode: Game mode: survival (ID 0). Hardcore: false. Cheats: true
Stacktrace:
at net.minecraft.server.MinecraftServer.updateTimeLightAndEntities(MinecraftServer.java:616)
at net.minecraft.server.MinecraftServer.tick(MinecraftServer.java:527)
at net.minecraft.server.integrated.IntegratedServer.tick(IntegratedServer.java:111)
at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:414)
at net.minecraft.server.MinecraftServer$2.run(MinecraftServer.java:665)
-- System Details --
Details:
Minecraft Version: 1.7.2
Operating System: Windows 7 (amd64) version 6.1
Java Version: 1.7.0_03, Oracle Corporation
Java VM Version: Java HotSpot™ 64-Bit Server VM (mixed mode), Oracle Corporation
Memory: 867008888 bytes (826 MB) / 1038876672 bytes (990 MB) up to 1038876672 bytes (990 MB)
JVM Flags: 3 total; -Xincgc -Xmx1024M -Xms1024M
AABB Pool Size: 677 (37912 bytes; 0 MB) allocated, 329 (18424 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 5 mods loaded, 5 mods active
mcp{8.09} [Minecraft Coder Pack] (minecraft.jar) Unloaded->Constructed->Pre-initialized->Initialized->Post-initialized->Available->Available->Available->Available
FML{7.2.156.1060} [Forge Mod Loader] (forgeBin-1.7.2-10.12.1.1060.jar) Unloaded->Constructed->Pre-initialized->Initialized->Post-initialized->Available->Available->Available->Available
Forge{10.12.1.1060} [Minecraft Forge] (forgeBin-1.7.2-10.12.1.1060.jar) Unloaded->Constructed->Pre-initialized->Initialized->Post-initialized->Available->Available->Available->Available
FishyMod{1.0.0 Alpha} [Fishy Mod] (bin) Unloaded->Constructed->Pre-initialized->Initialized->Post-initialized->Available->Available->Available->Available
examplemod{1.0} [Example Mod] (bin) Unloaded->Constructed->Pre-initialized->Initialized->Post-initialized->Available->Available->Available->Available
Profiler Position: N/A (disabled)
Vec3 Pool Size: 285 (15960 bytes; 0 MB) allocated, 51 (2856 bytes; 0 MB) used
Player Count: 1 / 8; [EntityPlayerMP['Player192'/39, l='New World', x=465.23, y=16.00, z=-50.28]]
Type: Integrated Server (map_client.txt)
Is Modded: Definitely; Client brand changed to 'fml,forge'
// i just replace super.onUpdate() with super.onEntityUpdate() and now it work
//new problem. fishing line is not rendered and when i tried to retract the hook ,it crashed.
Thanks! Ill definitely try it. But just so I know, what kind of risks are we talking?
Is it something that could mess with the end user? difficulty in updating when vanilla/forge updates?
Or something more runtime?
EDIT:
also, what is potionTypes and what does it have to do with biomes?
eclipse doesn't suggest anything to import for it...
EDIT2:
ok so something like this?
OOPS, i was looking at the wrong version of my mod. What you should do is register a class on the FML EVENT_BUS by calling this method:
and then in ExampleEventHooks, put this method:
Okay, so to make a mob that just breathes fire, put this in your entity file:
The risks is other biome mods might want to add biomes, but by removing the biome array and replacing it might screw up biome specific stuff, and with the = (new BiomeGenPlains(1)), change the 1 to bL, so that it replaces the biomeID too, otherwise you WILL mess up the biomes in minecraft, so by doing that it fully replaces the biome.
Just don't call it, or, if that doesn't work, just call it as super.onUpdate(). I found that with some of the entities, you need to extend a class that extends EntityLivingBase for it to render. As for the crashing when you retract the hook, that has the reason of super.onEntityUpdate();
And to Saki2fifty, look at this tutorial for packet handling in forge. I hope it helps!
97