Jump to content

jordsta95

Members
  • Posts

    169
  • Joined

  • Last visited

Posts posted by jordsta95

  1. This means that

    itemRegist.ingots

    is

    null

    at the point where this code runs.

     

    THAT WOULD BE WHY! :D

    I always do that and never notice why v_v Thanks :)

    I tried registering ores before registering items... Sometimes I feel like a complete idiot :/

  2. Hey, I am getting this crash after registering ores: http://pastebin.com/SnFrfL3N

    I understand that it's an issue with damage values, but I don't get why it is doing it...

    Here's the code registering the oreDict stuff:

    	OreDictionary.registerOre("ingotCopper", new ItemStack(itemRegist.ingots));
    	OreDictionary.registerOre("ingotLead", new ItemStack(itemRegist.ingots, 1, 3));
    	OreDictionary.registerOre("ingotTin", new ItemStack(itemRegist.ingots, 2, 3));
    	OreDictionary.registerOre("ingotNickel", new ItemStack(itemRegist.ingots,3, 3));
    	OreDictionary.registerOre("ingotAluminum", new ItemStack(itemRegist.ingots, 4, 3));
    	OreDictionary.registerOre("ingotSilver", new ItemStack(itemRegist.ingots, 5, 3));
    

    And if I comment that out, everything runs just fine. And I have tried that code like that and like

    	OreDictionary.registerOre("ingotCopper", new ItemStack(itemRegist.ingots));
    	OreDictionary.registerOre("ingotLead", new ItemStack(itemRegist.ingots, 1));
    	OreDictionary.registerOre("ingotTin", new ItemStack(itemRegist.ingots, 2));
    	OreDictionary.registerOre("ingotNickel", new ItemStack(itemRegist.ingots,3));
    	OreDictionary.registerOre("ingotAluminum", new ItemStack(itemRegist.ingots, 4));
    	OreDictionary.registerOre("ingotSilver", new ItemStack(itemRegist.ingots, 5));
    

    both of which had the same outcome...

     

    Sorry for sounding like a noob on something that is probably really obvious, but I just don't know what is wrong, as that looks fine to me, and using it (this code) without the metadata item(s) works just fine...

  3. Then you're doing several things wrong.

     

    1) That code sets the block to the north, not itself

    2) That code never says "am I metadata 0?"

    3) That code uses update flag 1, not 3 (you almost always want 3)

    1) Yeah, that was just a test

    2) I have always tried to avoid meta-blocks, so I don't know how to use them, or do this (I sorta expected it defaults to :0 because when you set block to <metablock> it defaults to :0

    3) Oh, I didn't know that.

  4. Hey there,

    I am trying to do this

    public void onNeighborBlockChange(World world, int posX, int posY, int posZ, Block neighbourBlock){
     if(world.getBlock(posX, posY - 1, posZ) == blockRegist.cable && world.getBlockMetadata(posX, posY - 1, posZ)  == 1){   
       	 world.setBlock(posX, posY, posZ+1, blockRegist.cable, 1, 1);
        }
        }
    

    in a block class for metadata, but it doesn't work.

    I know it's a metadata block, so I didn't expect it to work. But how would I make it so that it works?

     

    I am trying to make it so when cable:0 detects cable:1 below it, it will set itself as cable:1 (if that makes sense)

  5. Hey there, I am looking into using meta-blocks for something I am trying to do with a few different functional blocks, however I am at a loss for how to use metadata blocks:

    	
    public void onNeighborBlockChange(World world, int posX, int posY, int posZ, Block neighbourBlock){
    	 if (world.getBlock(posX, posY + 1, posZ) == Blocks.iron_ore){
    		 world.setBlock(posX, posY + 1, posZ, blockRegist.doubled);
    	 }
    
    }
    

    Right now, this works how I want it, as doubled:1 is what should come from iron, however when I want it to be the next block along:

    	
    public void onNeighborBlockChange(World world, int posX, int posY, int posZ, Block neighbourBlock){
    	 if (world.getBlock(posX, posY + 1, posZ) == Blocks.gold_ore){
    		 world.setBlock(posX, posY + 1, posZ, blockRegist.doubled);
    	 }
    
    }
    

    Will still do the first metadata (obviously) but I need it to do doubled:2

    How would one go about doing this?

     

  6. And then you dropped

    OreDictionary.getOreIDs(neighbourBlock)

    for no apparent reason.

     

    And you're comparing a Block to a boolean.

     

    And

    Ints

    is not an object or a class.

     

    And you're missing a )

     

    It's like you're doing stuff without thinking about what that stuff you're doing means.  You're back to a point where you don't even have "code that makes sense, but contains syntax errors."

    I dropped it because this didn't work:

    public void onNeighborBlockChange(World world, int posX, int posY, int posZ, Block neighbourBlock){

    if (world.getBlock(posX, posY + 1, posZ) == contains(OreDictionary.getOreIDs((neighbourBlock),OreDictionary.getOreID("oreIron")))){

     

    And I thought you meant use the other... the issue is "getOreIDs" it says it's not applicable for Block, int

  7. You don't know what an ItemStack is or how to use it? o..O

     

    now the only issue is the getOreID

     

    OreDictionary.getOreID(...)

     

    I thought that was pretty obvious.

     

    public void onNeighborBlockChange(World world, int posX, int posY, int posZ, Block neighbourBlock){

    if (world.getBlock(posX, posY + 1, posZ) == Ints.contains(OreDictionary.getOreID("oreIron"){

     

    Still getting issues though...

    Ints is erroring, but I don't know what to do with it, as importing the only option doesn't fix anything :/

  8. Seriously?

     

    /**

        * Gets all the integer ID for the ores that the specified item stakc is registered to.

        * If the item stack is not linked to any ore, this will return an empty array and no new entry will be created.

        *

        * @param stack The item stack of the ore.

        * @return An array of ids that this ore is registerd as.

        */

     

    And "oreIron" is still not an integer.  You need

    getOreID(String name)

     

    Yes, call me an idiot all you like, but I don't know what that means!

    Getting somewhere though through my idiocy and I apologize for this:

     public void onNeighborBlockChange(World world, int posX, int posY, int posZ, Block neighbourBlock){
    	 if (world.getBlock(posX, posY + 1, posZ) == Ints.contains(OreDictionary.getOreIDs((neighbourBlock),getOreID("oreIron"))
    

    now the only issue is the getOreID... well... it doesn't work?

  9. That is not even close. If anything, you got FATHER away. Now your trying to compare a Block with an int[]

     

    Oh, and "ore:oreIron" is still wrong.

    From ore dictionary class... do I just need to do oreIron?

                registerOre("oreIron",    Blocks.iron_ore);

     

    So this?

    Ints.contains(OreDictionary.getOreIDs(null), "oreIron")

    Which still shows errors, I don't know what that Ints is supposed to be, and the null? I don't understand what it should be...

  10. Wat.

     

    1) OreDicitionary.getOreIDs(...) requires an ItemStack passed to it.  1 is an integer.

    2) ore:oreIron, even if you declared that as a string (which you didn't, so it'll just throw all kinds of errors), that's not the oreDict string for iron ore.

    3) Even if it was the correct string, it's not an integer!

     

    My bad, I saw stack as a "how many you would want" (I was replying while on my way home from work, so I didn't know what it needed...

    So let me correct that now...

    So I have:

    if (world.getBlock(posX, posY + 1, posZ) == OreDictionary.getOreIDs(, "ore:oreIron")
    [code]
    But I don't actually understand what it wants in the brackets, it suggests null (when you add unimplemented methods) but that breaks everything... I really don't know what to put in there  (Sorry for the newbie questions, but I have never used oreDict, and the code
    [code]
        public static int[] getOreIDs(ItemStack stack)
        {
            if (stack == null || stack.getItem() == null) return new int[0];
    
            Set<Integer> set = new HashSet<Integer>();
    
            int id = Item.getIdFromItem(stack.getItem());
            List<Integer> ids = stackToId.get(id);
            if (ids != null) set.addAll(ids);
            ids = stackToId.get(id | ((stack.getItemDamage() + 1) << 16));
            if (ids != null) set.addAll(ids);
    
            Integer[] tmp = set.toArray(new Integer[set.size()]);
            int[] ret = new int[tmp.length];
            for (int x = 0; x < tmp.length; x++)
                ret[x] = tmp[x];
            return ret;
        }
    

    doesn't really make sense :/

     

     

     

     

    And i didn't do 

    Ints.containts(OreDicitionary.getOreIDs(<stack>), <ironOreID>)

    because the

    Ints.containts

    didn't exist (dunno if that is needed or not)

  11. Sure. First, get the oreID for ironOre, or whatever you want to check for. Then do Ints.containts(OreDicitionary.getOreIDs(<stack>), <ironOreID>).

    When you say stack? Do you mean it'd be something like:

    Ints.containts(OreDicitionary.getOreIDs(1), ore:oreIron)

    to do 1 iron ore?

  12. Hey there, I was wondering if it is possible for onNeighbourBlock to detect the oreDict of whatever is next to it?

    For example:

     public void onNeighborBlockChange(World world, int posX, int posY, int posZ, Block neighbourBlock){
    	 if (world.getBlock(posX, posY + 1, posZ) == Blocks.iron_ore){
    

    but I wanted it to be the ore dictionary for iron ore, because that would make some amount of sense for what this does would it be possible to do that?

  13. I'm trying to update an old mod's code to work in a new 1.7 mod... but I have no idea what the new code is :/

    package assests.jordsta95;
    
    import cpw.mods.fml.relauncher.Side;
    import cpw.mods.fml.relauncher.SideOnly;
    import net.minecraft.entity.EntityLiving;
    import net.minecraft.entity.player.EntityPlayerMP;
    import net.minecraft.entity.projectile.EntityThrowable;
    import net.minecraft.util.DamageSource;
    import net.minecraft.util.MovingObjectPosition;
    import net.minecraft.world.World;
    
    public class EntitySafePearl extends EntityThrowable
    {
        public EntitySafePearl(World par1World)
        {
            super(par1World);
        }
    
        public EntitySafePearl(World par1World, EntityLiving par2EntityLiving)
        {
            super(par1World, par2EntityLiving);
        }
    
        @SideOnly(Side.CLIENT)
        public EntitySafePearl(World par1World, double par2, double par4, double par6)
        {
            super(par1World, par2, par4, par6);
        }
    
        /**
         * Called when this EntityThrowable hits a block or entity.
         */
        protected void onImpact(MovingObjectPosition par1MovingObjectPosition)
        {
            if (par1MovingObjectPosition.entityHit != null)
            {
                par1MovingObjectPosition.entityHit.attackEntityFrom(DamageSource.causeThrownDamage(this, this.getThrower()), 0);
            }
    
            for (int var2 = 0; var2 < 32; ++var2)
            {
                this.worldObj.spawnParticle("portal", this.posX, this.posY + this.rand.nextDouble() * 2.0D, this.posZ, this.rand.nextGaussian(), 0.0D, this.rand.nextGaussian());
            }
    
            if (!this.worldObj.isRemote)
            {
                if (this.getThrower() != null && this.getThrower() instanceof EntityPlayerMP)
                {
                    EntityPlayerMP var3 = (EntityPlayerMP)this.getThrower();
    
                    if (!var3.playerNetServerHandler.connectionClosed && var3.worldObj == this.worldObj)
                    {
                        this.getThrower().setPositionAndUpdate(this.posX, this.posY, this.posZ);
                        this.getThrower().fallDistance = 0.0F;
                    }
                }
    
                this.setDead();
            }
        }
    }
    

    The line which is giving me issues is:

      if (!var3.playerNetServerHandler.connectionClosed && var3.worldObj == this.worldObj)
    

    more specifically the .connectionClosed.

    I tried replacing it with everything that was recommended (in Eclipse) and none of them worked. Any ideas?

     

  14. Hey there, people are complaining that what I have at the minute is slightly over powered, so the simple solution is make it so that when the item is used, it uses durability... but how do I do that?

     

        public boolean onItemUse(ItemStack itemStack, EntityPlayer player, World world, int x, int y, int z, int side, float px, float py, float pz)
        {
            if (world.getBlock(x, y + 1, z) == Blocks.air)
            {
                  world.setBlock(x, y + 1, z, Blocks.cake);
                  
                  
                  return true;
            }
            return false;
        }
    

     

    It extends item sword, so there's no issue about it having durability, it's just I have no idea how to make it do this :/

  15. Use the BlockEvent.BreakEvent.

     

    Call me blind and/or stupid, but I don't actually know what to do with this information.

     

    Do I do

    public void onBreakEvent...

     

    @ForgeSubscribe

    BlockEvent.BreakEvent

     

     

     

    What?

    I have never used forge events before, or any event to be more precise, so I have no idea what I am doing.

    I can't find anything in the events folder (forge reference folder) that has anything to do with this, so I am really stuck :/

  16. Hey, I don't know if this would be possible, but I am looking for a nicer "crafting" recipe than just combining two items.

    I was wondering if it is possible to make it so that if a diamond sword breaks a cake it makes a "itemRegist.cakeSword" (that's the item I am crafting as it is called - don't know the correct term, like Items.coal)

  17. Hey there, I am having issues with something I never really liked - meta-data.

    I am trying to do items, and the only 1.7 tutorial I found on it was for blocks, so I tried to substitute in what I could to get it to work.

     

    I have no errors in the code, but with what I have, only 1 item spawns. and it shows as item.null.name, not anything which I would have expected.

     

    Here's the code:

    https://github.com/jordsta95/JordnElecsUtils/blob/master/src/main/java/com/jordsta/stuff/integration/tinkers/UberiumToolParts.java

    And here's how it's registered:

    https://github.com/jordsta95/JordnElecsUtils/blob/master/src/main/java/com/jordsta/stuff/integration/tinkers/ticonRegist.java

     

    Any pointers on what I am doing wrong.

    Sorry if this is something really obvious, but I have never used meta-data before, but I felt when adding ~100 items, meta-data would be best (especially when they are all crafting components)

  18. You generate too much of your ore. Try lowering the 60 passes per chunk.

     

    THANK YOU! :D

     

    I didn't know that numbers too big would be that much of a hassle, I never had issues with 200 (as a test figure) in the end... but I guess other ores genning in the same area can cause issues

  19. My comment had nothing to do with "dimension stuff" but "java stuff."

    You don't have any

    break

    s between your case statements.

    @Override
      public void generate(Random random, int chunkX, int chunkZ, World world, IChunkProvider chunkGenerator, IChunkProvider chunkProvider) { 
          switch(world.provider.dimensionId){
          case 1:
          generateNether(world, random, chunkX * 16, chunkZ * 16);
          break;
          case 0:
              generateSurface(world, random, chunkX * 16, chunkZ * 16);
              break;
          case -1:
              generateEnd(world, random, chunkX * 16, chunkZ * 16);
              break;
          case Main.dimensionID:
        	    generateDim(world, random, chunkX * 16, chunkZ * 16);
        	    break;
          }
      }
    

     

    Added in the breaks, and can now load the world, but when travelling to the dimension there is still the same crash:

    http://pastebin.com/k5enStDG

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.