• 0

    posted a message on inLanoche's Tutorials [1.8] [ModLoader]
    Quote from copyyou

    inlanoche, i have trouble porting my mod to smp, i already posted on jamioflans smp tut but i think it wouldent hurt to show it to you too.
    can someone offer me help? i want to port my mod to smp but i cant get my gui to work: mc error(test mode):
    Minecraft: Minecraft 1.0.0
    OS: Windows 7 (x86) version 6.1
    Java: 1.7.0_01, Oracle Corporation
    VM: Java HotSpot(TM) Client VM (mixed mode), Oracle Corporation
    LWJGL: 2.4.2
    OpenGL: Intel(R) HD Graphics Family version 3.0.0 - Build 8.15.10.2291, Intel
    
    java.lang.NullPointerException
    	at net.minecraft.src.ModLoaderMp.HandleGUI(ModLoaderMp.java:157)
    	at net.minecraft.src.NetClientHandler.handleOpenWindow(NetClientHandler.java:824)
    	at net.minecraft.src.Packet100OpenWindow.processPacket(Packet100OpenWindow.java:26)
    	at net.minecraft.src.NetworkManager.processReadPackets(NetworkManager.java:229)
    	at net.minecraft.src.NetClientHandler.processReadPackets(NetClientHandler.java:81)
    	at net.minecraft.src.WorldClient.tick(WorldClient.java:50)
    	at net.minecraft.client.Minecraft.runTick(Minecraft.java:1528)
    	at net.minecraft.client.Minecraft.func_40001_x(Minecraft.java:686)
    	at net.minecraft.client.Minecraft.run(Minecraft.java:627)
    	at java.lang.Thread.run(Unknown Source)
    --- END ERROR REPORT 9a8295bc ----------

    and on the server i get this:
    java.lang.NullPointerException
    	at net.minecraft.src.ModLoader.OpenGUI(ModLoader.java:1312)
    	at net.minecraft.src.Blockenchanter.blockActivated(Blockenchanter.java:108)
    	at net.minecraft.src.ItemInWorldManager.activeBlockOrUseItem(ItemInWorldManager.java:218)
    	at net.minecraft.src.NetServerHandler.handlePlace(NetServerHandler.java:378)
    	at net.minecraft.src.Packet15Place.processPacket(Packet15Place.java:47)
    	at net.minecraft.src.NetworkManager.processReadPackets(NetworkManager.java:234)
    	at net.minecraft.src.NetServerHandler.handlePackets(NetServerHandler.java:64)
    	at net.minecraft.src.NetworkListenThread.handleNetworkListenThread(NetworkListenThread.java:99)
    	at net.minecraft.server.MinecraftServer.doTick(MinecraftServer.java:465)
    	at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:353)
    	at net.minecraft.src.ThreadServerApplication.run(ThreadServerApplication.java:22)


    source code(it refers to, client):
     public GuiScreen HandleGUI(int inventoryType, TileEntityenchanter tileentityenchanter) 
         {
                 if(inventoryType == 9)
                         return new Guienchanter(EntityClientPlayerMP.inventory, tileentityenchanter);
                 else return null;
         }

    and in the server
    ModLoader.OpenGUI(entityplayer, 9, tileentityenchanter, containerenchanter);

    if you guys need more i will post


    I haven't done anything with smp, but Null pointer errors usually mean that a variable the is trying to be accessed has not been intitialized. I'm no expert on this error, as I usually ask around for assistance with this.

    To give an example of where it bogged me down when I first started, was with player interactions with other mobs. When you put an item stack into a variable, you need to check if that itemstack is null before you test against it's value :

    if(itemStack != null && itemStack == ....

    if you just test itemStack ==... you may get errors when the stack is empty. hope this helps.

    FYI, I will be in and out less frequently here. Gearing up for an office move. Will try and squeeze in some more MineCrafting if possible.
    Posted in: Tutorials
  • 0

    posted a message on inLanoche's Tutorials [1.8] [ModLoader]
    Quote from SmurfChisholm

    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...
    Posted in: Tutorials
  • 0

    posted a message on inLanoche's Tutorials [1.8] [ModLoader]
    Quote from SmurfChisholm

    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.
    Posted in: Tutorials
  • 0

    posted a message on I need help
    Quote from DrkNnj2462

    Do yo know any specifc ones?


    Not exactly a tutorial on this, I think I go over this a bit in my tree tutorial. You are looking for this:

        public int getBlockTextureFromSideAndMetadata(int i, int j) 
        {    
            //i defines the side of the block.  1 being the top, 0 being the bottom.  Sides should be from 2-5. 
            if(i == 1) 
            { 
                return 21; 
            } 
            if(i == 0) 
            { 
                return 21; 
            } 
            //j checks the type of tree (metadata), we are not using this 
            return blockIndexInTexture;             //return the set wood texture 
        } 



    You wnat something like the furnace, then look at the furnace block code. It will at least show you what the side metadata values are.
    Posted in: Modification Development
  • 0

    posted a message on inLanoche's Tutorials [1.8] [ModLoader]
    Quote from TWell

    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:

    addSlot(new Slot(mobInv, i1 + j * 3, 8 + i1 * 18, 17 + j * 18));

    Should be:

    addSlot(new Slot(mobInv, i1 + j * 9, 8 + i1 * 18, 17 + j * 18));

    To follow this, the length of each row is 9, my old code was 3.
    Posted in: Tutorials
  • 0

    posted a message on inLanoche's Tutorials [1.8] [ModLoader]
    <next tutorial>

    now it lets me post again...
    Posted in: Tutorials
  • 2

    posted a message on inLanoche's Tutorials [1.8] [ModLoader]
    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:
    ItemStack itemstack = ItemStack.func_35864_a(nbttagcompound); 

    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.
    Posted in: Tutorials
  • 0

    posted a message on inLanoche's Tutorials [1.8] [ModLoader]
    Quote from Virgoth098

    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:
    Posted in: Tutorials
  • 0

    posted a message on inLanoche's Tutorials [1.8] [ModLoader]
    Quote from defiant810

    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)
    Posted in: Tutorials
  • 0

    posted a message on inLanoche's Tutorials [1.8] [ModLoader]
    Quote from DrkNnj2462

    When i craft a block from 1 dirt block nothing happens. Idk what a :Diamond: is.


    When you say nothing happens, do you mean that you put dirt in the crafting space and the craft output slot is empty? Did you try mousing over the spot? Is the block there but without a texture? Try changing what is being crafted to something like wood or cobblestone. If those to show nothing I'll take a closer look, but right now I'm about to post another tutorial on mobs and inventory.

    Quote from gf11221

    SUBSCRIBED! Also good luck in your YouTube Channel!


    Should have a new vid up in the next week. Retouch on using Techne as I make...


    a dwarf-tech robominer... or what ever you want to call it...
    Posted in: Tutorials
  • 0

    posted a message on inLanoche's Tutorials [1.8] [ModLoader]
    Quote from DrkNnj2462

    I tried running the client and i tried crafting my block , but it wont craft.
    I didnt add a generation or smelting code, just crafting.
    My main mod_.java file is mod_PumpkinCarve.java and my 1st block is Pumpkin_Blank.java
    My mod_PumpkinCarve...
    package net.minecraft.src;
    
    
    import java.util.Iterator;
    import java.util.Map;
    import java.util.Random;
    
    import java.awt.List;
    import java.lang.reflect.Constructor;
    import java.util.*;
    import net.minecraft.client.Minecraft;
    import net.minecraft.src.Gui;
    import org.lwjgl.opengl.GL11;
    import java.awt.Color;
    
    
    public class mod_PumpkinCarve extends BaseMod
    {
    	//Must set the String Version string below for all modloader Mods
    	public String Version()
    	{
    		return "PumpkinCarve v0.1 for Minecraft 1.8.1 w/ ModLoader";
    	}
    	
    	//constructor
    	public mod_PumpkinCarve()
    	{
    		//Calls to methods for various setups:
    		MakeBlocks();		
    	}
    	//***RECP101:START Recipes/Smelting definition code---------------------------
    	private void MakeRecipes()
    	{
    		ModLoader.AddRecipe(new ItemStack(Pumpkin_Blank, 1), new Object[]{
    			"#", Character.valueOf('#'), Block.dirt});			
    	}
    	//***RECP101:END Recipes/Smelting definition code-----------------------------	
    	//***BLCK101:START Block definition code--------------------------------------
    			//first define the global object for the new block
    			/*HINTS:
    			 * ex:
    			 *               public static Block aBlock = (new aBlockClass(BlockID, Index for image on Terrain.png)).setBlockName("aBlock");
    			 * look at Block.java to see .set methods available.  .setBlockName("") is required
    			 * can replace image by adding this line
    			 * aBlock.blockIndexInTexture = ModLoader.addOverride("/terrain.png", "/16x16Image.png");
    			 */
    			
    			public static Block Pumpkin_Blank = (new Pumpkin_Blank(200, 16)).setHardness(0.2F).setStepSound(Block.soundStoneFootstep).setBlockName("Pumpkin_Blank");
    			//register the new blocks and add their names to the game
    			private void MakeBlocks()
    			{
    				ModLoader.RegisterBlock(Pumpkin_Blank);
    				ModLoader.AddName(Pumpkin_Blank, "Blank Pumpkin");                      //the name that shows in the game
    			}		
    	//***END Block definition code------------------------------------------------
    }
    My 1st block (Pumpkin_Blank.java)
    // Decompiled by Jad v1.5.8g. Copyright 2001 Pavel Kouznetsov.
    // Jad home page: http://www.kpdus.com/jad.html
    // Decompiler options: packimports(3) braces deadcode 
    
    package net.minecraft.src;
    
    import java.util.Random;
    
    // Referenced classes of package net.minecraft.src:
    //            Block, Material
    
    public class Pumpkin_Blank extends Block
    {
    
        public Pumpkin_Blank(int i, int j)
        {
            super(i, j, Material.rock);
        }
    
        public int idDropped(int i, Random random)
        {
            return mod_PumpkinCarve.Pumpkin_Blank.blockID;
        }
        
        public int getRenderColor(int i)
        {
        	//color when it's in your inventory
        	//Assuming i is the metadata being passed...
        	
        	return 0xaa33aa;                        //purple color
        }
        
        
        public int colorMultiplier(IBlockAccess iblockaccess, int i, int j, int k)
        {
        	//color when it is in the world
        	int l = iblockaccess.getBlockMetadata(i, j, k);
        	return 0xaa33aa;                        //purple color
        	
        }
        
        public void updateTick(World world, int i, int j, int k, Random random)
        {
        }
            
    }
    I followed all of your steps...
    im not sure if i put the block defination code in the right place
    or the recepie code. :unsure.gif:
    If you help me ill give u credit in my mod (i was going to do that anyway)
    and ill give u four diamonds :Diamond: :Diamond: :Diamond: :Diamond:
    Plz help me. :unsure.gif:
    -DrkNnj2462



    What actually happens when you attempt to craft a dirt block? It looks fine at a glance, but you should give the symptoms as well as the problem. Also, I keep getting people offering me :Diamonds:. Not to be out of the loop, but what does that actually mean?
    Posted in: Tutorials
  • 0

    posted a message on inLanoche's Tutorials [1.8] [ModLoader]
    Quote from The Snoo

    Loving the tutorials, inlanoche. They're hugely helpful. I don't suppose you could do one on how to make a functioning stone sign? :biggrin.gif:



    Could you be more specific?
    Posted in: Tutorials
  • 0

    posted a message on Trouble with ModLoader
    Ok, so I've been away from modding for a while, played some mods, tried 1.9r5, messed around a bit. Now going back in and trying to get back in the grove, I try my current work and get this:

    java.lang.ClassNotFoundException: net.minecraft.src.mod_HeroesGuild
    	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 sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
    	at java.lang.ClassLoader.loadClass(Unknown Source)
    .
    .
    .


    Now, I've never had mod_HeroesGuild in my mod. I did play with the kingdom mod a bit (but not in my eclipse test area), which I think where this is getting referenced. Is there an easy fix for this? I have delete the kingdom mod files from my %appdata% location (all files), but I'm still getting this. Any help would be great.
    Posted in: Modification Development
  • 0

    posted a message on inLanoche's Tutorials [1.8] [ModLoader]
    Quote from PhonixTroll

    Hey Ilanoche,

    Can you please make a tutorial on how to make a tameable mob?
    On that attacks for you.

    Thanks.

    ~DrRedstoner



    This is not that easy. Unfortunately the code for attacked what has attacked you is in EntityPlayer. What you can do is to create a mob that will attack Moster mob types if they are in range. I think I did that in 1.7, but I will do that again in 1.8
    Posted in: Tutorials
  • 0

    posted a message on inLanoche's Tutorials [1.8] [ModLoader]
    Quote from charlie50000

    I have been trying to start your totarial but when i tried to make a block, on the "constructor" it came up with an error. Here is my code:
    //constructor
    public mod_CDSS()
    {
    //Calls to methods for various setups:
    MakeBlocks();
    }
    It came up with the error on the line: MakeBlocks();
    Can you help me.



    Do you have a function called MakeBlocks yet? If not you are calling a non-existing function. This is not wrong, just not complete. Read through the tutorial first, then go through it doing the steps.
    Posted in: Tutorials
  • To post a comment, please .