I only need to do one last thing before I release the newest version of my mod, which is making it so my arrow isn't invisible. All I did was copy code from the Arrow render file, and the Entity file, and it's not working. Here's my code:
RenderDarkArrow:
package net.minecraft.src;
import org.lwjgl.opengl.GL11;
import org.lwjgl.opengl.GL12;
public class RenderDarkArrow extends RenderArrow
{
public void renderArrow(EntityDarkArrow par1EntityDarkArrow, double par2, double par4, double par6, float par8, float par9)
{
this.loadTexture("/ocomo/darkarrows.png");
GL11.glPushMatrix();
GL11.glTranslatef((float)par2, (float)par4, (float)par6);
GL11.glRotatef(par1EntityDarkArrow.prevRotationYaw + (par1EntityDarkArrow.rotationYaw - par1EntityDarkArrow.prevRotationYaw) * par9 - 90.0F, 0.0F, 1.0F, 0.0F);
GL11.glRotatef(par1EntityDarkArrow.prevRotationPitch + (par1EntityDarkArrow.rotationPitch - par1EntityDarkArrow.prevRotationPitch) * par9, 0.0F, 0.0F, 1.0F);
Tessellator var10 = Tessellator.instance;
byte var11 = 0;
float var12 = 0.0F;
float var13 = 0.5F;
float var14 = (float)(0 + var11 * 10) / 32.0F;
float var15 = (float)(5 + var11 * 10) / 32.0F;
float var16 = 0.0F;
float var17 = 0.15625F;
float var18 = (float)(5 + var11 * 10) / 32.0F;
float var19 = (float)(10 + var11 * 10) / 32.0F;
float var20 = 0.05625F;
GL11.glEnable(GL12.GL_RESCALE_NORMAL);
float var21 = (float)par1EntityDarkArrow.arrowShake - par9;
if (var21 > 0.0F)
{
float var22 = -MathHelper.sin(var21 * 3.0F) * var21;
GL11.glRotatef(var22, 0.0F, 0.0F, 1.0F);
}
GL11.glRotatef(45.0F, 1.0F, 0.0F, 0.0F);
GL11.glScalef(var20, var20, var20);
GL11.glTranslatef(-4.0F, 0.0F, 0.0F);
GL11.glNormal3f(var20, 0.0F, 0.0F);
var10.startDrawingQuads();
var10.addVertexWithUV(-7.0D, -2.0D, -2.0D, (double)var16, (double)var18);
var10.addVertexWithUV(-7.0D, -2.0D, 2.0D, (double)var17, (double)var18);
var10.addVertexWithUV(-7.0D, 2.0D, 2.0D, (double)var17, (double)var19);
var10.addVertexWithUV(-7.0D, 2.0D, -2.0D, (double)var16, (double)var19);
var10.draw();
GL11.glNormal3f(-var20, 0.0F, 0.0F);
var10.startDrawingQuads();
var10.addVertexWithUV(-7.0D, 2.0D, -2.0D, (double)var16, (double)var18);
var10.addVertexWithUV(-7.0D, 2.0D, 2.0D, (double)var17, (double)var18);
var10.addVertexWithUV(-7.0D, -2.0D, 2.0D, (double)var17, (double)var19);
var10.addVertexWithUV(-7.0D, -2.0D, -2.0D, (double)var16, (double)var19);
var10.draw();
for (int var23 = 0; var23 < 4; ++var23)
{
GL11.glRotatef(90.0F, 1.0F, 0.0F, 0.0F);
GL11.glNormal3f(0.0F, 0.0F, var20);
var10.startDrawingQuads();
var10.addVertexWithUV(-8.0D, -2.0D, 0.0D, (double)var12, (double)var14);
var10.addVertexWithUV(8.0D, -2.0D, 0.0D, (double)var13, (double)var14);
var10.addVertexWithUV(8.0D, 2.0D, 0.0D, (double)var13, (double)var15);
var10.addVertexWithUV(-8.0D, 2.0D, 0.0D, (double)var12, (double)var15);
var10.draw();
}
GL11.glDisable(GL12.GL_RESCALE_NORMAL);
GL11.glPopMatrix();
}
/**
* Actually renders the given argument. This is a synthetic bridge method, always casting down its argument and then
* handing it off to a worker function which does the actual work. In all probabilty, the class Render is generic
* (Render<T extends Entity) and this method has signature public void doRender(T entity, double d, double d1,
* double d2, float f, float f1). But JAD is pre 1.5 so doesn't do that.
*/
public void doRender(Entity par1Entity, double par2, double par4, double par6, float par8, float par9)
{
this.renderArrow((EntityDarkArrow)par1Entity, par2, par4, par6, par8, par9);
}
}
mod_XXXXX:
package net.minecraft.src;
import java.util.Map;
import java.io.File;
import net.minecraft.client.Minecraft;
public class mod_Scoaleton extends BaseMod{
public mod_Scoaleton()
{
}
public static DamageSource causeDarkArrowDamage(EntityDarkArrow par0EntityDarkArrow, Entity par1Entity)
{
return (new EntityDamageSourceIndirect("darkarrow", par0EntityDarkArrow, par1Entity)).setProjectile();
}
-stuff-
public static Item darkArrow = (new
Item(3841).setItemName("arrowDark").setTabToDisplayOn(CreativeTabs.tabMisc));
-more stuff-
public void load()
{
-stuff-
ModLoader.registerEntityID(EntityDarkArrow.class, "DarkArrow", 88);
ModLoader.addName(darkArrow, "Dark Arrow");
darkArrow.iconIndex = ModLoader.addOverride("/gui/items.png", "/ocomo/darkarrow.png");
-more stuff-
}
public void addRenderer(Map map)
{
-stuff-
map.put(EntityDarkArrow.class, new RenderDarkArrow());
-more stuff-
}
public String getVersion()
{
return "1.2.5";
}
}
/ocomo/darkarrows.png loads perfectly fine if I use it in RenderArrow. Does anyone have any idea why this isn't working? And if you need any more information, don't expect me to respond for a while since I'll be asleep.
It's an issue with the texture. Make sure the directory is correct and that the texture isn't used by any item.
I don't know why the second one is an issue, but I had this problem with a WIP mod I'm making. I had used my texture for another item. Instead of fixing the problem, I just added a particle effect to it and ended up making it much cooler.
It's an issue with the texture. Make sure the directory is correct and that the texture isn't used by any item.
I don't know why the second one is an issue, but I had this problem with a WIP mod I'm making. I had used my texture for another item. Instead of fixing the problem, I just added a particle effect to it and ended up making it much cooler.
The directory is correct, it worked when I used it in RenderBow. I wouldn't be using the texture for anything else either.
EDIt; Well, I guess I'll just release the mod like this.
You could try a particle effect to at least make it visible… it may not be the best for an arrow, but it at least shows the projectile's existence.
Yeah, I'll try that I guess. It doesn't seem to show any particles though, like the critical hit arrow particle thing when it's flying through the air. I had the same problem with a throwable item before, it wouldn't show it going through the air or it's particle effects, so I'm not sure if this is gonna work.
I don't know what I did to fix my other throwable item being invisible, but I'm pretty sure it's the same problem. If I can somehow make my old item invisible again, maybe I can figure out my problem.
EDIT: As expected, it didn't create any particle effect. I tried this with a regular arrow, and it worked fine:
And this is the code I used (not that it matters):
Finally someone that uploaded a Video to show what's going on, it makes things so much easier!
So let me see if I got this right, you've made a custom bow to use with your Dark Arrow, correct? And when you use these 2 Custom Items together, the Arrow is not rendered - but when you use the regular bow, the arrow is rendered?
What happens if you try to use normal arrows with your custom bow? Same thing?
Also, posting the code for your custom bow would be utmost helpful.
I didn't make a custom bow. I'm saying my custom arrow texture worked fine with the normal bow, but not with the dark arrow itself.
Hmm... this may seem strange, it may not even work, and you should certainly delete this once ModLoader has updated, but can you try replacing
public class EntityDarkArrow extends EntityArrow
with
public class EntityDarkArrow extends Entity implements IAnimals
That just crashes the game.
Minecraft has crashed!
----------------------
Minecraft has stopped running because it encountered a problem; Exception in server tick loop
This error has been saved to J:\MCP 1.3\jars\.\crash-reports\crash-2012-08-09_10.02.51-server.txt for your convenience. Please include a copy of this file if you report this crash to anyone.
--- BEGIN ERROR REPORT 4019b88 --------
Generated 8/9/12 10:03 AM
- Minecraft Version: 1.3.1
- Operating System: Windows Vista (amd64) version 6.0
- Java Version: 1.7.0_02, Oracle Corporation
- Java VM Version: Java HotSpot(TM) 64-Bit Server VM (mixed mode), Oracle Corporation
- Memory: 968694224 bytes (923 MB) / 1038876672 bytes (990 MB) up to 1038876672 bytes (990 MB)
- JVM Flags: 3 total; -Xincgc -Xmx1024M -Xms1024M
- ModLoader: Mods loaded: 3
ModLoader 1.3.1
mod_ModLoaderMp 1.3.1v1
mod_Scoaleton 1.2.5
- Type: Integrated Server
- Is Modded: Unknown (can't tell)
- Profiler Position: N/A (disabled)
- Player Count: 1 / 8; [EntityPlayerMP['Player620'/121, l='New World', x=376.17, y=12.38, z=992.51]]
- World New World Entities: 0 total; []
- World New World Players: 0 total; []
- World New World Chunk Stats: ServerChunkCache: 0 Drop: 0
java.lang.ClassCastException: net.minecraft.src.EntityDarkArrow cannot be cast to net.minecraft.src.EntityLiving
at net.minecraft.src.EntityTrackerEntry.getPacketForThisEntity(EntityTrackerEntry.java:477)
at net.minecraft.src.EntityTrackerEntry.tryStartWachingThis(EntityTrackerEntry.java:250)
at net.minecraft.src.EntityTrackerEntry.sendEventsToPlayers(EntityTrackerEntry.java:319)
at net.minecraft.src.EntityTrackerEntry.sendLocationToAllClients(EntityTrackerEntry.java:80)
at net.minecraft.src.EntityTracker.processOutstandingEntries(EntityTracker.java:185)
at net.minecraft.server.MinecraftServer.updateTimeLightAndEntities(MinecraftServer.java:628)
at net.minecraft.server.MinecraftServer.tick(MinecraftServer.java:555)
at net.minecraft.src.IntegratedServer.tick(IntegratedServer.java:122)
at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:464)
at net.minecraft.src.ThreadServerApplication.run(ThreadServerApplication.java:17)
--- END ERROR REPORT 3cd62eff ----------
And also (this has nothing to do with the arrow problem but someone can help if they want), I tried making a new bow for the dark arrows since I didn't want compatibility problems, and it didn't work at all. When you right click it just gets stuck on the last texture until you close Minecraft. Plus the player model doesn't look like it's holding a bow at all, it's just holding it in one hand. I at least made it look a little better by doing this:
public boolean isFull3D()
{
return true;
}
But it still doesn't act like a normal bow at all. Here's a video of it:
Afaik, there is nothing else that can be done to make this arrow visible. Hopefully ModLoader will update soon.
And, in case you didn't realize, you are going to want to change the line back to
public class EntityDarkArrow extends Entity
That's fine, I'll just wait for ModLoader to update and keep the arrow invisible. Although I don't really see what the next update of ModLoader could do to fix this problem.
EDIT: Before I release my mod update, could you help with the bow texture thing? Here's some code from my mod_ file:
public static Item darkBow = (new ItemDarkBow(3842).setItemName("bowDark").setTabToDisplayOn(CreativeTabs.tabMisc));
public static Item darkBow2 = (new ItemDarkBow(3842 + 1).setItemName("bowDark2"));
public static Item darkBow3 = (new ItemDarkBow(3842 + 2).setItemName("bowDark3"));
public static Item darkBow4 = (new ItemDarkBow(3842 + 3).setItemName("bowDark4"));
HOW THE HECK DID YOU FIX IT????? I have probably spent 15 - 20 hours on a problem almost identical to this (I am also making a new arrow, I did not copy your code... I started this a month ago)... How did you fix yours?
HOW THE HECK DID YOU FIX IT????? I have probably spent 15 - 20 hours on a problem almost identical to this (I am also making a new arrow, I did not copy your code... I started this a month ago)... How did you fix yours?
This was a problem with the 1.3 update, so if you started it a month ago it shouldn't be a problem for you. But I'll tell you anyways just in case.
For me, all I had to do was replace
if (!par2World.isRemote)
{
par2World.spawnEntityInWorld(var8);
}
public class ItemBow extends Item
{
public ItemBow(int par1)
{
super(par1);
this.maxStackSize = 1;
this.setMaxDamage(384);
this.setTabToDisplayOn(CreativeTabs.tabCombat);
}
/**
* called when the player releases the use item button. Args: itemstack, world, entityplayer, itemInUseCount
*/
public void onPlayerStoppedUsing(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer, int par4)
{
boolean var5 = par3EntityPlayer.capabilities.isCreativeMode || EnchantmentHelper.getEnchantmentLevel(Enchantment.infinity.effectId, par1ItemStack) > 0;
public ItemStack onFoodEaten(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer)
{
return par1ItemStack;
}
/**
* How long it takes to use or consume an item
*/
public int getMaxItemUseDuration(ItemStack par1ItemStack)
{
return 72000;
}
/**
* returns the action that specifies what animation to play when the items is being used
*/
public EnumAction getItemUseAction(ItemStack par1ItemStack)
{
return EnumAction.bow;
}
/**
* Called whenever this item is equipped and the right mouse button is pressed. Args: itemStack, world, entityPlayer
*/
public ItemStack onItemRightClick(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer)
{
if (par3EntityPlayer.capabilities.isCreativeMode || par3EntityPlayer.inventory.hasItem(Item.arrow.shiftedIndex))
{
par3EntityPlayer.setItemInUse(par1ItemStack, this.getMaxItemUseDuration(par1ItemStack));
}
return par1ItemStack;
}
/**
* Return the enchantability factor of the item, most of the time is based on material.
*/
public int getItemEnchantability()
{
return 1;
}
}
public class ItemBow extends Item
{
public ItemBow(int par1)
{
super(par1);
this.maxStackSize = 1;
this.setMaxDamage(384);
this.setTabToDisplayOn(CreativeTabs.tabCombat);
}
/**
* called when the player releases the use item button. Args: itemstack, world, entityplayer, itemInUseCount
*/
public void onPlayerStoppedUsing(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer, int par4)
{
boolean var5 = par3EntityPlayer.capabilities.isCreativeMode || EnchantmentHelper.getEnchantmentLevel(Enchantment.infinity.effectId, par1ItemStack) > 0;
public ItemStack onFoodEaten(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer)
{
return par1ItemStack;
}
/**
* How long it takes to use or consume an item
*/
public int getMaxItemUseDuration(ItemStack par1ItemStack)
{
return 72000;
}
/**
* returns the action that specifies what animation to play when the items is being used
*/
public EnumAction getItemUseAction(ItemStack par1ItemStack)
{
return EnumAction.bow;
}
/**
* Called whenever this item is equipped and the right mouse button is pressed. Args: itemStack, world, entityPlayer
*/
public ItemStack onItemRightClick(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer)
{
if (par3EntityPlayer.capabilities.isCreativeMode || par3EntityPlayer.inventory.hasItem(Item.arrow.shiftedIndex))
{
par3EntityPlayer.setItemInUse(par1ItemStack, this.getMaxItemUseDuration(par1ItemStack));
}
return par1ItemStack;
}
/**
* Return the enchantability factor of the item, most of the time is based on material.
*/
public int getItemEnchantability()
{
return 1;
}
}
That looks exactly the same as the ItemBow code except for you removed that one if statement. It worked perfectly fine for me after replacing everywhere it says "EntityArrow" with "EntityDarkArrow". Either your Entity file is somehow messed up, or you aren't using ModLoader.
RenderDarkArrow:
mod_XXXXX:
EntityDarkArrow:
/ocomo/darkarrows.png loads perfectly fine if I use it in RenderArrow. Does anyone have any idea why this isn't working? And if you need any more information, don't expect me to respond for a while since I'll be asleep.
I really hope someone can help, I'm absolutely clueless on why this is happening..
I don't know why the second one is an issue, but I had this problem with a WIP mod I'm making. I had used my texture for another item. Instead of fixing the problem, I just added a particle effect to it and ended up making it much cooler.
EDIt; Well, I guess I'll just release the mod like this.
I don't know what I did to fix my other throwable item being invisible, but I'm pretty sure it's the same problem. If I can somehow make my old item invisible again, maybe I can figure out my problem.
EDIT: As expected, it didn't create any particle effect. I tried this with a regular arrow, and it worked fine:
And this is the code I used (not that it matters):
Someone, if you have any suggestions, or if you have had this problem before, please tell me them. I have no idea what I'm doing wrong.
Whoa, that actually sorta worked. Except it doesn't have the right texture and almost every time I shoot it it ends up hitting me. Here's a video:
Here's my code even though almost nothing is different:
And also (this has nothing to do with the arrow problem but someone can help if they want), I tried making a new bow for the dark arrows since I didn't want compatibility problems, and it didn't work at all. When you right click it just gets stuck on the last texture until you close Minecraft. Plus the player model doesn't look like it's holding a bow at all, it's just holding it in one hand. I at least made it look a little better by doing this:
But it still doesn't act like a normal bow at all. Here's a video of it:
EDIT: Before I release my mod update, could you help with the bow texture thing? Here's some code from my mod_ file:
Anyways, I actually already fixed my problem, + the arrow being invisible.
For me, all I had to do was replace
in my Bow class with
I hope that works for you.
http://www.minecraftforum.net/topic/1313598-131-forge-modloadermp-scoaleton-v201-my-first-mod-smp-ssp/
public class ItemBow extends Item
{
public ItemBow(int par1)
{
super(par1);
this.maxStackSize = 1;
this.setMaxDamage(384);
this.setTabToDisplayOn(CreativeTabs.tabCombat);
}
/**
* called when the player releases the use item button. Args: itemstack, world, entityplayer, itemInUseCount
*/
public void onPlayerStoppedUsing(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer, int par4)
{
boolean var5 = par3EntityPlayer.capabilities.isCreativeMode || EnchantmentHelper.getEnchantmentLevel(Enchantment.infinity.effectId, par1ItemStack) > 0;
if (var5 || par3EntityPlayer.inventory.hasItem(Item.arrow.shiftedIndex))
{
int var6 = this.getMaxItemUseDuration(par1ItemStack) - par4;
float var7 = (float)var6 / 20.0F;
var7 = (var7 * var7 + var7 * 2.0F) / 3.0F;
if ((double)var7 < 0.1D)
{
return;
}
if (var7 > 1.0F)
{
var7 = 1.0F;
}
EntityArrow var8 = new EntityArrow(par2World, par3EntityPlayer, var7 * 2.0F);
if (var7 == 1.0F)
{
var8.func_70243_d(true);
}
int var9 = EnchantmentHelper.getEnchantmentLevel(Enchantment.power.effectId, par1ItemStack);
if (var9 > 0)
{
var8.setDamage(var8.getDamage() + (double)var9 * 0.5D + 0.5D);
}
int var10 = EnchantmentHelper.getEnchantmentLevel(Enchantment.punch.effectId, par1ItemStack);
if (var10 > 0)
{
var8.setKnockbackStrength(var10);
}
if (EnchantmentHelper.getEnchantmentLevel(Enchantment.flame.effectId, par1ItemStack) > 0)
{
var8.setFire(100);
}
par1ItemStack.damageItem(1, par3EntityPlayer);
par2World.playSoundAtEntity(par3EntityPlayer, "random.bow", 1.0F, 1.0F / (itemRand.nextFloat() * 0.4F + 1.2F) + var7 * 0.5F);
if (var5)
{
var8.canBePickedUp = 2;
}
else
{
par3EntityPlayer.inventory.consumeInventoryItem(Item.arrow.shiftedIndex);
}
par2World.spawnEntityInWorld(var8);
}
}
public ItemStack onFoodEaten(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer)
{
return par1ItemStack;
}
/**
* How long it takes to use or consume an item
*/
public int getMaxItemUseDuration(ItemStack par1ItemStack)
{
return 72000;
}
/**
* returns the action that specifies what animation to play when the items is being used
*/
public EnumAction getItemUseAction(ItemStack par1ItemStack)
{
return EnumAction.bow;
}
/**
* Called whenever this item is equipped and the right mouse button is pressed. Args: itemStack, world, entityPlayer
*/
public ItemStack onItemRightClick(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer)
{
if (par3EntityPlayer.capabilities.isCreativeMode || par3EntityPlayer.inventory.hasItem(Item.arrow.shiftedIndex))
{
par3EntityPlayer.setItemInUse(par1ItemStack, this.getMaxItemUseDuration(par1ItemStack));
}
return par1ItemStack;
}
/**
* Return the enchantability factor of the item, most of the time is based on material.
*/
public int getItemEnchantability()
{
return 1;
}
}
Are you using ModLoader?