Ok so I tried giving one of my custom entity a held item (like zombie pigmen have) but it didnt work. Thats not the problem though as now any entity that has a held item wont spawn or render. So I cant see endermen or zombie pigmen. Is there anyway I can fix this?
As dealman said there needs to be a bit more info however if you were to give me an idea of what you want I will be glad to help. Ive recently finished a first release big project and if you want you can get an early release of it to see some of my work.
I can code:
-Weapons, tools, armour, bows, semi-auto guns etc.
-Mobs
-Button gui (learning slots atm)
-New game mechanics
If theres anything particular you need I'll be willing to learn it.
I hope I can be of some service to your mod, just ill need some details...
First question is how do I make my gui open when I first start a new world and secondly how do I make it give me an item when I click one of the gui's buttons.
Try adding a damage source function, without doing that you are basically calling the damage source for the EntityArrow which doesn't know what your bullet is.
Here is the function I added in my EntityBullet, see if this helps.
// Declare a damage source for the bullet entity.
public static DamageSource causeBulletDamage(EntityBullet par0EntityBullet, Entity par1Entity)
{
return (new EntityDamageSourceIndirect("bullet", par0EntityBullet, par1Entity)).setProjectile();
}
Try adding a damage source function, without doing that you are basically calling the damage source for the EntityArrow which doesn't know what your bullet is.
Here is the function I added in my EntityBullet, see if this helps.
// Declare a damage source for the bullet entity.
public static DamageSource causeBulletDamage(EntityBullet par0EntityBullet, Entity par1Entity)
{
return (new EntityDamageSourceIndirect("bullet", par0EntityBullet, par1Entity)).setProjectile();
}
java.lang.NullPointerException
at net.minecraft.src.EntityLiving.attackEntityFrom(EntityLiving.java:847)
at net.minecraft.src.EntityMob.attackEntityFrom(EntityMob.java:69)
at net.minecraft.src.EntityBullet.onUpdate(EntityBullet.java:318)
at net.minecraft.src.World.updateEntityWithOptionalForce(World.java:2195)
at net.minecraft.src.World.updateEntity(World.java:2163)
at net.minecraft.src.World.updateEntities(World.java:2037)
at net.minecraft.client.Minecraft.runTick(Minecraft.java:1897)
at net.minecraft.client.Minecraft.runGameLoop(Minecraft.java:870)
at net.minecraft.client.Minecraft.run(Minecraft.java:801)
at java.lang.Thread.run(Unknown Source)
--- END ERROR REPORT fec367a0 ----------
I dont know why this is happening but here's the tile entity and the crash report Im hoping someone can help...
TileEntityCompactor
package net.minecraft.src;
public class TileEntityCompactor extends TileEntity implements IInventory{
public ItemStack compactorItemStacks[];
public TileEntityCompactor(){
compactorItemStacks = new ItemStack[4];
}
public int getSizeInventory()
{
return compactorItemStacks.length;
}
public ItemStack getStackInSlot(int i) {
return compactorItemStacks[i];
}
public ItemStack decrStackSize(int i, int j) {
if (compactorItemStacks[i] != null)
{
if (compactorItemStacks[i].stackSize <= j)
{
ItemStack itemstack = compactorItemStacks[i];
compactorItemStacks[i] = null;
return itemstack;
}
ItemStack itemstack1 = compactorItemStacks[i].splitStack(j);
if (compactorItemStacks[i].stackSize == 0)
{
compactorItemStacks[i] = null;
}
return itemstack1;
}
else
{
return null;
}
}
public void setInventorySlotContents(int i, ItemStack itemstack) {
compactorItemStacks[i] = itemstack;
if (itemstack != null && itemstack.stackSize > getInventoryStackLimit())
{
itemstack.stackSize = getInventoryStackLimit();
}
}
public String getInvName()
{
return "meh";
}
public int getInventoryStackLimit() {
// TODO Auto-generated method stub
return 64;
}
public void openChest() {
}
public void closeChest() {
// TODO Auto-generated method stub
}
public boolean copper = false;
public boolean tin = false;
public void updateEntity()
{
ItemStack itemstack = compactorItemStacks[0];
ItemStack itemstack1 = compactorItemStacks[1];
ItemStack itemstack2 = compactorItemStacks[2];
if (itemstack != null)
{
int i = itemstack.getItem().shiftedIndex;
if(i == Item.stick.shiftedIndex)
{
copper = true;
}
}
if (itemstack1 != null)
{
int i = itemstack.getItem().shiftedIndex;
if(i == Item.book.shiftedIndex)
{
tin = true;
}
}
}
public boolean isUseableByPlayer(EntityPlayer entityplayer)
{
if(worldObj.getBlockTileEntity(xCoord, yCoord, zCoord) != this)
{
return false;
}
return entityplayer.getDistanceSq((double)xCoord + 0.5D, (double)yCoord + 0.5D, (double)zCoord + 0.5D) <= 64D;
}
public ItemStack getStackInSlotOnClosing(int i) {
// TODO Auto-generated method stub
return null;
}
}
Error Report
--- BEGIN ERROR REPORT 1159a603 --------
Generated 8/05/12 7:32 PM
Minecraft: Minecraft 1.2.5
OS: Windows 7 (amd64) version 6.1
Java: 1.7.0_01, Oracle Corporation
VM: Java HotSpot(TM) 64-Bit Server VM (mixed mode), Oracle Corporation
LWJGL: 2.4.2
OpenGL: Intel(R) HD Graphics version 2.1.0 - Build 8.15.10.2086, Intel
java.lang.NullPointerException
at net.minecraft.src.TileEntityCompactor.updateEntity(TileEntityCompactor.java:107)
at net.minecraft.src.World.updateEntities(World.java:2074)
at net.minecraft.client.Minecraft.runTick(Minecraft.java:1897)
at net.minecraft.client.Minecraft.runGameLoop(Minecraft.java:870)
at net.minecraft.client.Minecraft.run(Minecraft.java:801)
at java.lang.Thread.run(Unknown Source)
--- END ERROR REPORT b47dc091 ----------
0
0
Nope, sorry I already know all this stuff, I just need to learn how to get it to start up when I start a game. (I learnt the other thing...)
0
0
I can code:
-Weapons, tools, armour, bows, semi-auto guns etc.
-Mobs
-Button gui (learning slots atm)
-New game mechanics
If theres anything particular you need I'll be willing to learn it.
I hope I can be of some service to your mod, just ill need some details...
0
0
0
0
this is the main fuction that starts on the line.
0
Im still getting the same error...
0
EntityBullet:
ERROR:
0
NOTHING. Thats my problem...
0
0
TileEntityCompactor
Error Report
0
0
Ok, thank you for the reply but im a bit new to gui so could you maybe explain that a bit more indepth?