Ok so. I'm making a mod that isn't detailed on here, but i think you would be able to help me. When i compile the code, it gives me an error in the block class, under
public final static Block nuke
Or something like that, too lazy to check.
And it gives me the error: Block nuke might of not been initialized properly or something like that. Any help?
how do you make a blue tinge on a block?
what do you need to make it.
i'm using one of the builtin sprites and want to turn it blue for my block.
what do i need to do that
add this to your constructor
MakeRecipes();
you didn't add the recipes pocket runner
THANK YOU TANK YOU THANK YOU!!!!!!!!!!!!!
i was stumped on that for like EVER
10 diamonds 4 u
First off, these are amazing tutorials. I have learned more in the hour I spent looking at them then the days I've spent on other threads with tutorials.
Second, I have a problem I hope you can help fix. My mod is running perfectly fine in Eclipse, I recompile it without errors, but putting it back into Minecraft crashes the game as soon as it reaches the Mojang splash.
The mod consists of a block that is bouncy and spawns a wolf when you right click on it. Nothing else.
This is the error code as it appears in the ModLoader log file.
Nov 12, 2011 9:59:47 PM ModLoader init
FINE: ModLoader Beta 1.8.1 Initializing...
Nov 12, 2011 9:59:47 PM ModLoader readFromClassPath
FINER: Adding mods from C:\Users\Sean\AppData\Roaming\.minecraft\bin\minecraft.jar
Nov 12, 2011 9:59:47 PM ModLoader readFromClassPath
FINER: Zip found.
Nov 12, 2011 9:59:47 PM ModLoader addMod
FINE: Failed to load mod from "mod_MossMod.class"
Nov 12, 2011 9:59:47 PM ModLoader addMod
FINER: THROW
java.lang.NoClassDefFoundError: mod_MossMod (wrong name: net/minecraft/src/mod_MossMod)
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClass(Unknown Source)
at java.security.SecureClassLoader.defineClass(Unknown Source)
at java.net.URLClassLoader.defineClass(Unknown Source)
at java.net.URLClassLoader.access$100(Unknown Source)
at java.net.URLClassLoader$1.run(Unknown Source)
at java.net.URLClassLoader$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at ModLoader.addMod(ModLoader.java:270)
at ModLoader.readFromClassPath(ModLoader.java:1114)
at ModLoader.init(ModLoader.java:825)
at ModLoader.AddAllRenderers(ModLoader.java:186)
at aam.<init>(aam.java:61)
at aam.<clinit>(aam.java:10)
at net.minecraft.client.Minecraft.a(SourceFile:259)
at net.minecraft.client.Minecraft.run(SourceFile:629)
at java.lang.Thread.run(Unknown Source)
Nov 12, 2011 9:59:58 PM ModLoader AddAllRenderers
FINE: Initialized
I've tried looking around but I cant find anything. Any help would be great.
Actually I've never compiled any of my tutorials (well my first time using MCP, wanted to make sure I wasn't wasting time).
In any case, the first thing that comes to mind is if you have tried any of the 1.9 pre-releases. If so, you may have to delete the .minecraft in your appdata, and re-load minecraft.
After I am done my next tutorial, I will try my next bit in the actual minecraft (and write a tutorial on that if need be)
Ok so. I'm making a mod that isn't detailed on here, but i think you would be able to help me. When i compile the code, it gives me an error in the block class, under
public final static Block nuke
Or something like that, too lazy to check.
And it gives me the error: Block nuke might of not been initialized properly or something like that. Any help?
In eclipse, what does it mark off as an error?
(Hint: I don't do compile errors with out a report from Eclipse)
EDIT: Really? I can't add a new post until someone else posts?!?!?! FTW! was about to start posting my next tutorial....
:angry.gif: :angry.gif: :angry.gif: :angry.gif: :angry.gif: :angry.gif: :angry.gif: :angry.gif: :angry.gif: :angry.gif:
Then, for the sake of a new tutorial, I will ask a stupid question I can probably figure out on my own: where and how should I situate my custom sounds for my 70-80% complete mob? Where in the Minecraft folder will it start looking for said sounds?
Thanks thisguyisjoe... Sorry I don't have an answer to that (have yet to poke at the audio stuff), but I will begin my next tutorial:
FIXED!
Mob with Inventory for 1.8.
I will start off by saying that there are a few subtle changes that I had to work out from 1.7, and in doing so I have added a bit more (and now understand a bit more), which will be passed along. Because it's most likely this will be used in your own way, I'm going to start with a superclass to use to extend your own entity class. So let's get started. I called my entity class, ILN_EntityWithInventory :
package net.minecraft.src;
import java.util.Random;
import net.minecraft.client.Minecraft;
// Referenced classes of package net.minecraft.src:
// EntityAnimal, Item, EntityPlayer, InventoryPlayer,
// ItemStack, World, NBTTagCompound
public class ILN_EntityWithInventory extends EntityLiving
{
public ILN_EntityWithInventory(World world)
{
super(world);
}
//START:Inventory code-----------------------------------------------------------
public int slotCount = 9; //default the number of slots in the inventory to 3x3 or 9
public ILN_InventoryMob inventory = new ILN_InventoryMob(this, slotCount);
public void setInvSize(int i)
{
//should be set in multiples of 9, no greater than 27
slotCount = i;
inventory = new ILN_InventoryMob(this, slotCount); //re-initialize the inventory obj
}
public void openInventory(EntityPlayer theplayer)
{
/*GUI call here.
*Should be created/overridden in the entity sub class
*/
ModLoader.OpenGUI(theplayer, new ILN_GuiMobInv(theplayer, this));
}
public void onDeath(DamageSource damagesource) //when mob dies
{
inventory.dropAllItems(); // when dead drop all inventory! **
super.onDeath(damagesource);
}
//END:Inventory code-----------------------------------------------------------
//START:Read/Write code--------------------------------------------------------
public void writeEntityToNBT(NBTTagCompound nbttagcompound)
{
super.writeEntityToNBT(nbttagcompound);
nbttagcompound.setTag("Inventory", inventory.writeToNBT(new NBTTagList())); // write the inventory
}
public void readEntityFromNBT(NBTTagCompound nbttagcompound)
{
super.readEntityFromNBT(nbttagcompound);
NBTTagList nbttaglist = nbttagcompound.getTagList("Inventory"); // must read inventory
inventory.readFromNBT(nbttaglist);
}
//END:Read/Write code--------------------------------------------------------
protected boolean canDespawn()
{
return false;
}
}
Let's take a look at this. I extend EntityLiving, because it seems to cover all I need. I add (in my Inventory pocket) 2 vars. An INT to cover the size of the inventory, and an inventory object (which class will be defined soon). I add a method to set the Inventory size (which could instead be part of the constructor) and I create an invetory call as well as a death to drop items. Afte that I do some NBTTag stuff to have the game store it's inventory. Last I make sure that it doesn't auto de-spawn by overriding an EntityLiving method. Mostly simple stuff. Next the Inventory class:
package net.minecraft.src;
import java.util.List;
// Referenced classes of package net.minecraft.src:
// IInventory, ItemStack, IInvBasic, EntityPlayer
public class ILN_InventoryMob implements IInventory
{
public ItemStack inventory[];
public ILN_EntityWithInventory ent;
public boolean inventoryChanged;
public int slotCount;
public ILN_InventoryMob(ILN_EntityWithInventory entity, int i)
{
slotCount = i;
inventory = new ItemStack[i]; //how many items it can hold
inventoryChanged = false;
ent = entity; //pass the entity class
}
private int getInventorySlotContainItem(int i)
{
for(int j = 0; j < inventory.length; j++)
{
if(inventory[j] != null && inventory[j].itemID == i)
{
return j;
}
}
return -1;
}
public int storeItemStack(ItemStack itemstack)
{
for(int i = 0; i < inventory.length; i++)
{
if(inventory[i] != null && inventory[i].itemID == itemstack.itemID && inventory[i].isStackable() && inventory[i].stackSize < inventory[i].getMaxStackSize() && inventory[i].stackSize < getInventoryStackLimit() && (!inventory[i].getHasSubtypes() || inventory[i].getItemDamage() == itemstack.getItemDamage()))
{
return i;
}
}
return -1;
}
public int getFirstEmptyStack()
{
for(int i = 0; i < inventory.length; i++)
{
if(inventory[i] == null)
{
return i;
}
}
return -1;
}
private int storePartialItemStack(ItemStack itemstack)
{
int i = itemstack.itemID;
int j = itemstack.stackSize;
int k = storeItemStack(itemstack);
if(k < 0)
{
k = getFirstEmptyStack();
}
if(k < 0)
{
return j;
}
if(inventory[k] == null)
{
inventory[k] = new ItemStack(i, 0, itemstack.getItemDamage());
}
int l = j;
if(l > inventory[k].getMaxStackSize() - inventory[k].stackSize)
{
l = inventory[k].getMaxStackSize() - inventory[k].stackSize;
}
if(l > getInventoryStackLimit() - inventory[k].stackSize)
{
l = getInventoryStackLimit() - inventory[k].stackSize;
}
if(l == 0)
{
return j;
} else
{
j -= l;
inventory[k].stackSize += l;
inventory[k].animationsToGo = 5;
return j;
}
}
public boolean consumeInventoryItem(int i)
{
int j = getInventorySlotContainItem(i);
if(j < 0)
{
return false;
}
if(--inventory[j].stackSize <= 0)
{
inventory[j] = null;
}
return true;
}
public boolean addItemStackToInventory(ItemStack itemstack)
{
if(!itemstack.isItemDamaged())
{
int i;
do
{
i = itemstack.stackSize;
itemstack.stackSize = storePartialItemStack(itemstack);
} while(itemstack.stackSize > 0 && itemstack.stackSize < i);
return itemstack.stackSize < i;
}
int j = getFirstEmptyStack();
if(j >= 0)
{
inventory[j] = ItemStack.copyItemStack(itemstack);
itemstack.stackSize = 0;
return true;
} else
{
return false;
}
}
public ItemStack decrStackSize(int i, int j)
{
ItemStack aitemstack[] = inventory;
if(aitemstack[i] != null)
{
if(aitemstack[i].stackSize <= j)
{
ItemStack itemstack = aitemstack[i];
aitemstack[i] = null;
return itemstack;
}
ItemStack itemstack1 = aitemstack[i].splitStack(j);
if(aitemstack[i].stackSize == 0)
{
aitemstack[i] = null;
}
return itemstack1;
} else
{
return null;
}
}
public void setInventorySlotContents(int i, ItemStack itemstack)
{
ItemStack aitemstack[] = inventory;
aitemstack[i] = itemstack;
}
public NBTTagList writeToNBT(NBTTagList nbttaglist)
{
for(int i = 0; i < inventory.length; i++)
{
if(inventory[i] != null)
{
NBTTagCompound nbttagcompound = new NBTTagCompound();
nbttagcompound.setByte("Slot", (byte)i);
inventory[i].writeToNBT(nbttagcompound);
nbttaglist.setTag(nbttagcompound);
}
}
return nbttaglist;
}
public void readFromNBT(NBTTagList nbttaglist)
{
inventory = new ItemStack[9];
for(int i = 0; i < nbttaglist.tagCount(); i++)
{
NBTTagCompound nbttagcompound = (NBTTagCompound)nbttaglist.tagAt(i);
int j = nbttagcompound.getByte("Slot") & 0xff;
ItemStack itemstack = ItemStack.func_35864_a(nbttagcompound);
if(itemstack.getItem() == null)
{
continue;
}
if(j >= 0 && j < inventory.length)
{
inventory[j] = itemstack;
}
}
}
public int getSizeInventory()
{
return inventory.length + 1;
}
public ItemStack getStackInSlot(int i)
{
ItemStack aitemstack[] = inventory;
return aitemstack[i];
}
public String getInvName()
{
return "Inventory";
}
public int getInventoryStackLimit()
{
return 64;
}
public void onInventoryChanged()
{
inventoryChanged = true;
}
public boolean canInteractWith(EntityPlayer entityplayer)
{
if(ent.isDead)
{
return false;
} else
{
return entityplayer.getDistanceSqToEntity(ent) <= 64D;
}
}
public boolean func_28018_c(ItemStack itemstack)
{
for(int j = 0; j < inventory.length; j++)
{
if(inventory[j] != null && inventory[j].isStackEqual(itemstack))
{
return true;
}
}
return false;
}
public void dropAllItems()
{
for(int i = 0; i < inventory.length; i++)
{
if(inventory[i] != null)
{
ent.entityDropItem(inventory[i], 0.0F);
inventory[i] = null;
}
}
}
public void func_35142_x_()
{
}
public void func_35141_y_()
{
}
}
OK, so let's go over some of this code. Again, I moved my var declarations to the top of the code. I like it better this way, but it's my preference. So we define an ItemStack, my new entityclass a boolean and a slotcounter. The ItemStack is the array that stores all your inventory items. slotCount is kind of redundant (since you can reference inventory.length), but this makes it more visible, which will be used later. Not much is changed here from your standard Inventory object, though one this I will point to is at around line 193 in the readFromNBT method:
This line has changed from 1.7, but as you can see the method in ItemStack has yet to be named. Watch out for this if you update your MCP later down the line. I don't think more on this needs to be explained, but I will if it's requested. Your not really doing much here, so I would leave it be. Next will be the container, which I'll talk about more.
package net.minecraft.src;
import java.util.List;
// Referenced classes of package net.minecraft.src:
// Container, IInventory, Slot, ItemStack,
// EntityPlayer
public class ILN_ContainerForEntity extends Container
{
private ILN_InventoryMob mobInv;
public ILN_ContainerForEntity(IInventory iinventory, ILN_InventoryMob iinventory1)
{
mobInv = iinventory1;
//creating the inventory slots for the mob. Should look to make this more modular. Right now it's 3x3
int rows = (int)Math.floor(mobInv.slotCount / 9); //should return a value from 1 to 3 as long as inventory no larger than 27
System.out.println("rows are "+rows);
for(int j = 0; j < rows; j++) //row
{ //by
for(int i1 = 0; i1 < 9; i1++) //column
{
addSlot(new Slot(mobInv, i1 + j * 9, 8 + i1 * 18, 17 + j * 18));
} // , x-dislplay, y-display
}
//making the slots for the interacting player's inventory
for(int k = 0; k < 3; k++)
{
for(int j1 = 0; j1 < 9; j1++)
{
addSlot(new Slot(iinventory, j1 + k * 9 + 9, 8 + j1 * 18, 84 + k * 18));
}
}
//Hot slots for player's inventory
for(int l = 0; l < 9; l++)
{
addSlot(new Slot(iinventory, l, 8 + l * 18, 142));
}
}
public boolean isUsableByPlayer(EntityPlayer entityplayer)
{
return mobInv.canInteractWith(entityplayer);
}
public ItemStack getStackInSlot(int i)
{
ItemStack itemstack = null;
Slot slot = (Slot)inventorySlots.get(i);
if(slot != null && slot.getHasStack())
{
ItemStack itemstack1 = slot.getStack();
itemstack = itemstack1.copy();
if(i >= 10 && i < 46)
{
func_28125_a(itemstack1, 1, 10, false);
} else
{
func_28125_a(itemstack1, 10, 46, false);
}
if(itemstack1.stackSize == 0)
{
slot.putStack(null);
} else
{
slot.onSlotChanged();
}
if(itemstack1.stackSize != itemstack.stackSize)
{
slot.onPickupFromSlot(itemstack1);
} else
{
return null;
}
}
return itemstack;
}
public boolean canInteractWith(EntityPlayer entityplayer)
{
return true;
}
}
So, here we are doing something similar to what is done with chest containers. We need to see the player and the mob inventorys, so they are passed (player first). What I have noticed, looking at the code, is that this is what places the "slot boxes" on the GUI. I changed things a bit here, and closer matched it to the GUI background I created. What I defined (for now) is that it creates rows of 9, starting at the top. Each new row will appear below the previous. This is important for how I define the GUI. I should also put in a check to prevent the slot count being more than 27, but this is just a sample on how to get it working. The comments should explain what for loop does what. Most is straight from the regular container stuff, but be sure to have the last method, canInteractWith(), there. I'm pretty sure this allows the player to intereact with the inventory.
So we have the Entity, Inventory and the Container, now for some fun with the gui. For my example you will need these 2 image files:
I have put these in a folder called ILN, which will be reflected in my next bit of script, but also remember to put it in the same folder inside your minecraft.jar file! So here is my GUI code:
package net.minecraft.src;
import net.minecraft.client.Minecraft;
import org.lwjgl.opengl.GL11;
// Referenced classes of package net.minecraft.src:
// GuiContainer, ContainerChest, IInventory, FontRenderer,
// RenderEngine
public class ILN_GuiMobInv extends GuiContainer
{
private EntityPlayer theplayer;
private ILN_EntityWithInventory themob;
private int inventoryRows;
public ILN_GuiMobInv(EntityPlayer p, ILN_EntityWithInventory m)
{
super(new ILN_ContainerForEntity(p.inventory, m.inventory));
theplayer = p;
themob = m;
inventoryRows = m.inventory.slotCount / 9; //how many rows of 9 in the inventory
}
protected void drawGuiContainerForegroundLayer()
{
fontRenderer.drawString("Mob Inventory", 52, 6, 0x404040); // name of inventory displaced on top
fontRenderer.drawString(theplayer.username + "'s Inventory", 8, (ySize - 96) + 2, 0x404040);
String s = "Press 'E' to close";
fontRenderer.drawString(s, 39, ySize + 1, 0x555555);
fontRenderer.drawString(s, 40, ySize + 2, 0xffffff);
}
protected void drawGuiContainerBackgroundLayer(float f)
{
int back = mc.renderEngine.getTexture("/ILN/InvPlayerAndBlank.png"); //place for inventory backdrop texture
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
mc.renderEngine.bindTexture(back);
int j = (width - xSize) / 2;
int k = (height - ySize) / 2;
drawTexturedModalRect(j, k, 0, 0, xSize, ySize + 24); //draws in the background image
int mobslots = mc.renderEngine.getTexture("/ILN/3x9InvBoxes.png"); //display Mob's slots at the top
mc.renderEngine.bindTexture(mobslots);
j = (width - xSize) / 2;
k = (height - ySize) / 2;
drawTexturedModalRect(j, k, 0, 0, xSize, (inventoryRows) * 18 + 17); //crop overlay to match number of rows (1-3)
}
public boolean doesGuiPauseGame()
{
return true;
}
}
So here we bring in (in the constructor) the player and the mob. We create our container object and track how many rows (of 9) there are. I re-layed out the text forground to match the background images, but this should all be straight forward.
The interesting stuff is done in drawGuiContainerBackgroundLayer(). First I load in the background image (InvPlayerAndBlack.png). Using drawTexturedModalRect() we then draw in the area of the image. After that we do some neat stuff (for those that have not done masking of any type). I next load the 3x9 slots, but instead of drawing the full size, I start at the top, and draw down based on the number of rows defined. So basically the areas not used are masked!
NOTE: if you intend on testing this out, please follow a few rules:
1. This is set up to use 1-3 rows of 9. So your inventory should be 9, 18, or 27.
2. If you change the slot count, create a new saved game, or it will crash.
Lastly, to lead into my next tutorial, I will share my sub class Entity to show it in use:
package net.minecraft.src;
import java.util.Random;
// Referenced classes of package net.minecraft.src:
// EntityAnimal, Item, EntityPlayer, InventoryPlayer,
// ItemStack, World, NBTTagCompound
public class ILN_EntityRoboMiner extends ILN_EntityWithInventory
{
public ILN_EntityRoboMiner(World world)
{
super(world);
texture = "/ILN/char-blue.png";
health = 8;
setSize(0.9F, 1.3F);
setInvSize(18); //Setting Inventory size in multiples of 9 Changing this means creating a new world!
}
protected boolean canDespawn()
{
return false;
}
public void writeEntityToNBT(NBTTagCompound nbttagcompound)
{
super.writeEntityToNBT(nbttagcompound);
}
public void readEntityFromNBT(NBTTagCompound nbttagcompound)
{
super.readEntityFromNBT(nbttagcompound);
}
protected String getLivingSound()
{
return "mob.cow";
}
protected String getHurtSound()
{
return "mob.cowhurt";
}
protected String getDeathSound()
{
return "mob.cowhurt";
}
protected float getSoundVolume()
{
return 0.4F;
}
protected int getDropItemId()
{
return Item.leather.shiftedIndex;
}
public boolean interact(EntityPlayer entityplayer)
{
//need GUI for control and Inventory access
openInventory(entityplayer);
return true;
}
public ItemStack getHeldItem()
{
return defaultHeldItem;
}
private static final ItemStack defaultHeldItem;
static
{
defaultHeldItem = new ItemStack(Item.pickaxeSteel, 1); //what's built with the robominer
}
//override of methods
protected Entity findPlayerToAttack()
{
/*could use this to find Monsters to attack
*
EntityPlayer entityplayer = worldObj.getClosestPlayerToEntity(this, 16D);
if(entityplayer != null && canEntityBeSeen(entityplayer))
{
return entityplayer;
} else
{
return null;
}
*/
return null;
}
}
Again, this is a sample, feel free to see how I used my superclass, but remeber to match it (such as the texturemap) to your own mob.
Well. Now there are no actual errors i can see. BUT. When i try and run it through Eclipse, the actual minecraft app, it gives me this in the console.:
Exception in thread "main" java.lang.ExceptionInInitializerError
at net.minecraft.src.TextureWaterFX.<init>(TextureWaterFX.java:16)
at net.minecraft.client.Minecraft.<init>(Minecraft.java:41)
at net.minecraft.src.MinecraftImpl.<init>(MinecraftImpl.java:19)
at net.minecraft.client.Minecraft.startMainThread(Minecraft.java:1557)
at net.minecraft.client.Minecraft.startMainThread1(Minecraft.java:1543)
at net.minecraft.client.Minecraft.main(Minecraft.java:1603)
at StartEclipse.main(StartEclipse.java:26)
Caused by: java.lang.NullPointerException
at net.minecraft.src.Block.<init>(Block.java:425)
at net.minecraft.src.Block.<init>(Block.java:414)
at net.minecraft.src.BlockBed.<init>(BlockBed.java:19)
at net.minecraft.src.Block.<clinit>(Block.java:41)
... 7 more
Is there a way to know how the .class files are renamed in a later version of mc? I mean in MCP for Beta 1.7.3 EntityMinecart.java was yl.class but in 1.8.1 it was ads.class, but how can i know about this?
I either did something wrong or I found a bug in your mob inventory tutorial. I placed a block of dirt in my horse's inventory and then removed it. Now when I place the dirt in its inventory it duplicates in a separate slot. A little hard to explain but I could post a screenshot if you'd like.
I either did something wrong or I found a bug in your mob inventory tutorial. I placed a block of dirt in my horse's inventory and then removed it. Now when I place the dirt in its inventory it duplicates in a separate slot. A little hard to explain but I could post a screenshot if you'd like.
I see it. It seems that I must have messed up switching from a 3x3 area to a 1x9 to 3x9 modular area. I say this becuase the dup happens if you put something in a slot after slot 4... Ok, going back to fix that. Thanks for the heads up.
EDIT: FIXED! here is the code (in the container file) that was the problem:
src\minecraft\net\minecraft\src\SmartEntity.java:35: cannot find symbol
symbol : constructor SmartEntityGui(net.minecraft.src.EntityPlayer,net.minecraf
t.src.SmartEntity)
location: class net.minecraft.src.SmartEntityGui
ModLoader.OpenGUI(theplayer, new SmartEntityGui(theplayer, this));
^
src\minecraft\net\minecraft\src\SmartEntityGui.java:18: cannot find symbol
symbol : constructor SmartEntityContainer(net.minecraft.src.InventoryPlayer,net
.minecraft.src.ItemStack[])
location: class net.minecraft.src.SmartEntityContainer
super(new SmartEntityContainer(p.inventory, m.inventory));
^
src\minecraft\net\minecraft\src\SmartEntityGui.java:21: cannot find symbol
symbol : variable slotCount
location: class net.minecraft.src.ItemStack[]
inventoryRows = m.inventory.slotCount / 9; //how many rows of 9 in the
inventory
^
3 errors
==================
> Done in 13.89 seconds
> Recompiling server...
!! Can not find server sources !!
Press any key to continue . . .
Here is the code
[code] public void openInventory(EntityPlayer theplayer)
{
/*GUI call here.
*Should be created/overridden in the entity sub class
*/
ModLoader.OpenGUI(theplayer, new SmartEntityGui(theplayer, this)); ///// Here is the first line of error///
}
[code/]
[code]
public SmartEntityGui(EntityPlayer p, SmartEntityInventory m)
{
super(new SmartEntityContainer(p.inventory, m.inventory)); //////Here is the second error/////
theplayer = p;
themob = m;
inventoryRows = m.inventory.slotCount / 9; //how many rows of 9 in the inventory ///////Here is the third error/////
}
[code/]
so should i DL eclipse classic? because im looking at the eclipse.org site and there are about a gazillion different (actually there are only like ten diff DL links) versions and since i am a complete and utter noob and none of the DLs say DL for minecraft im guessing i only need classic...? i just dont want to DL the wrong one. Thanks
Eclipse classic:
Eclipse Classic 3.7.1 is what I use.You also need the Java SDK (jdk-6u26-windows-i586.exe)
Just lost my HDD, so rebuilt with 64 bit, about to do the full set up again. Will hopefully have the next part of the tutorial done soon.
thanks for the link...now i have a bigger problem...im on a mac. yes a mac and apple provides its own java software so i was wondering if anyone could tell me how to set up everything so that i can start modding?? And don't tell me to get a PC, had one...and now i'll never go back
Each to his own on home computing. Sorry, I can't help you there...
Or something like that, too lazy to check.
And it gives me the error: Block nuke might of not been initialized properly or something like that. Any help?
THANK YOU TANK YOU THANK YOU!!!!!!!!!!!!!
i was stumped on that for like EVER
10 diamonds 4 u
Actually I've never compiled any of my tutorials (well my first time using MCP, wanted to make sure I wasn't wasting time).
In any case, the first thing that comes to mind is if you have tried any of the 1.9 pre-releases. If so, you may have to delete the .minecraft in your appdata, and re-load minecraft.
After I am done my next tutorial, I will try my next bit in the actual minecraft (and write a tutorial on that if need be)
OLD 1.7: http://www.minecraftforum.net/topic/529327-modloader173-adding-custom-mobs-and-more/ ---inLanoche says : USE ECLIPSE
In eclipse, what does it mark off as an error?
(Hint: I don't do compile errors with out a report from Eclipse)
EDIT: Really? I can't add a new post until someone else posts?!?!?! FTW! was about to start posting my next tutorial....
:angry.gif: :angry.gif: :angry.gif: :angry.gif: :angry.gif: :angry.gif: :angry.gif: :angry.gif: :angry.gif: :angry.gif:
OLD 1.7: http://www.minecraftforum.net/topic/529327-modloader173-adding-custom-mobs-and-more/ ---inLanoche says : USE ECLIPSE
Then, for the sake of a new tutorial, I will ask a stupid question I can probably figure out on my own: where and how should I situate my custom sounds for my 70-80% complete mob? Where in the Minecraft folder will it start looking for said sounds?
FIXED!
Mob with Inventory for 1.8.
I will start off by saying that there are a few subtle changes that I had to work out from 1.7, and in doing so I have added a bit more (and now understand a bit more), which will be passed along. Because it's most likely this will be used in your own way, I'm going to start with a superclass to use to extend your own entity class. So let's get started. I called my entity class, ILN_EntityWithInventory :
Let's take a look at this. I extend EntityLiving, because it seems to cover all I need. I add (in my Inventory pocket) 2 vars. An INT to cover the size of the inventory, and an inventory object (which class will be defined soon). I add a method to set the Inventory size (which could instead be part of the constructor) and I create an invetory call as well as a death to drop items. Afte that I do some NBTTag stuff to have the game store it's inventory. Last I make sure that it doesn't auto de-spawn by overriding an EntityLiving method. Mostly simple stuff. Next the Inventory class:
OK, so let's go over some of this code. Again, I moved my var declarations to the top of the code. I like it better this way, but it's my preference. So we define an ItemStack, my new entityclass a boolean and a slotcounter. The ItemStack is the array that stores all your inventory items. slotCount is kind of redundant (since you can reference inventory.length), but this makes it more visible, which will be used later. Not much is changed here from your standard Inventory object, though one this I will point to is at around line 193 in the readFromNBT method:
This line has changed from 1.7, but as you can see the method in ItemStack has yet to be named. Watch out for this if you update your MCP later down the line. I don't think more on this needs to be explained, but I will if it's requested. Your not really doing much here, so I would leave it be. Next will be the container, which I'll talk about more.
So we have the Entity, Inventory and the Container, now for some fun with the gui. For my example you will need these 2 image files:
I have put these in a folder called ILN, which will be reflected in my next bit of script, but also remember to put it in the same folder inside your minecraft.jar file! So here is my GUI code:
The interesting stuff is done in drawGuiContainerBackgroundLayer(). First I load in the background image (InvPlayerAndBlack.png). Using drawTexturedModalRect() we then draw in the area of the image. After that we do some neat stuff (for those that have not done masking of any type). I next load the 3x9 slots, but instead of drawing the full size, I start at the top, and draw down based on the number of rows defined. So basically the areas not used are masked!
NOTE: if you intend on testing this out, please follow a few rules:
1. This is set up to use 1-3 rows of 9. So your inventory should be 9, 18, or 27.
2. If you change the slot count, create a new saved game, or it will crash.
Lastly, to lead into my next tutorial, I will share my sub class Entity to show it in use:
Again, this is a sample, feel free to see how I used my superclass, but remeber to match it (such as the texturemap) to your own mob.
OLD 1.7: http://www.minecraftforum.net/topic/529327-modloader173-adding-custom-mobs-and-more/ ---inLanoche says : USE ECLIPSE
now it lets me post again...
OLD 1.7: http://www.minecraftforum.net/topic/529327-modloader173-adding-custom-mobs-and-more/ ---inLanoche says : USE ECLIPSE
Gah!
Far as I know you can't without MCP.
I see it. It seems that I must have messed up switching from a 3x3 area to a 1x9 to 3x9 modular area. I say this becuase the dup happens if you put something in a slot after slot 4... Ok, going back to fix that. Thanks for the heads up.
EDIT: FIXED! here is the code (in the container file) that was the problem:
Should be:
To follow this, the length of each row is 9, my old code was 3.
OLD 1.7: http://www.minecraftforum.net/topic/529327-modloader173-adding-custom-mobs-and-more/ ---inLanoche says : USE ECLIPSE
If this is for a block, I would look at my tutorial on the subject.
If it's for a model, I don't understand the question since models already have multiple-sided textures lol.
D'you need to decompile audiomod? Or does it jsut need to be in the .jar?
== MCP v4.4 ==
> Recompiling client...
javac.exe -g -source 1.6 -target 1.6 -classpath "lib/;lib/*;jars/bin/minecraft.j
ar;jars/bin/jinput.jar;jars/bin/lwjgl.jar;jars/bin/lwjgl_util.jar" -sourcepath s
rc/minecraft -d bin/minecraft src/minecraft\net\minecraft\client\*.java src/mine
craft\net\minecraft\isom\*.java src/minecraft\net\minecraft\src\*.java conf/pat
ches/*.java failed.
Return code : 1
== ERRORS FOUND ==
src\minecraft\net\minecraft\src\SmartEntity.java:35: cannot find symbol
symbol : constructor SmartEntityGui(net.minecraft.src.EntityPlayer,net.minecraf
t.src.SmartEntity)
location: class net.minecraft.src.SmartEntityGui
ModLoader.OpenGUI(theplayer, new SmartEntityGui(theplayer, this));
^
src\minecraft\net\minecraft\src\SmartEntityGui.java:18: cannot find symbol
symbol : constructor SmartEntityContainer(net.minecraft.src.InventoryPlayer,net
.minecraft.src.ItemStack[])
location: class net.minecraft.src.SmartEntityContainer
super(new SmartEntityContainer(p.inventory, m.inventory));
^
src\minecraft\net\minecraft\src\SmartEntityGui.java:21: cannot find symbol
symbol : variable slotCount
location: class net.minecraft.src.ItemStack[]
inventoryRows = m.inventory.slotCount / 9; //how many rows of 9 in the
inventory
^
3 errors
==================
> Done in 13.89 seconds
> Recompiling server...
!! Can not find server sources !!
Press any key to continue . . .
Here is the code
[code] public void openInventory(EntityPlayer theplayer)
{
/*GUI call here.
*Should be created/overridden in the entity sub class
*/
ModLoader.OpenGUI(theplayer, new SmartEntityGui(theplayer, this)); ///// Here is the first line of error///
}
[code/]
[code]
public SmartEntityGui(EntityPlayer p, SmartEntityInventory m)
{
super(new SmartEntityContainer(p.inventory, m.inventory)); //////Here is the second error/////
theplayer = p;
themob = m;
inventoryRows = m.inventory.slotCount / 9; //how many rows of 9 in the inventory ///////Here is the third error/////
}
[code/]
Eclipse classic:
Eclipse Classic 3.7.1 is what I use.You also need the Java SDK (jdk-6u26-windows-i586.exe)
Just lost my HDD, so rebuilt with 64 bit, about to do the full set up again. Will hopefully have the next part of the tutorial done soon.
OLD 1.7: http://www.minecraftforum.net/topic/529327-modloader173-adding-custom-mobs-and-more/ ---inLanoche says : USE ECLIPSE
Each to his own on home computing. Sorry, I can't help you there...
OLD 1.7: http://www.minecraftforum.net/topic/529327-modloader173-adding-custom-mobs-and-more/ ---inLanoche says : USE ECLIPSE
- Strengthowns