• 1

    posted a message on [1.3.2] Where is onTileEntityPowered?
    I decided to look at the dispenser since that's the first block that came to mind that uses both a tile entity and uses redstone. There's nothing in its tile entity that relies on power. Instead, the block itself (BlockDispenser) checks to see if it's being indirectly powered by neighboring blocks. If it is, it dispenses the item. In a quick glance it looks like note blocks are the same way.
    Posted in: Modification Development
  • 1

    posted a message on How to kill mobs in a certain radius?
    Quote from snuffysam

    It should, yes. But it doesn't.
    I did all the changes that you mentioned and told it to print out a list of entities.
    Nothing printed out.
    I'm trying to figure out what I did wrong.

    Well, I got mine to work. Here's the code:
    public boolean onBlockActivated(World par1World, int par2, int par3, int par4, EntityPlayer par5EntityPlayer, int par6, float par7, float par8, float par9)
        {
            double var6 = 50.0D;
            List var7 = par1World.getEntitiesWithinAABB(EntityLiving.class, AxisAlignedBB.getAABBPool().addOrModifyAABBInPool(par2 - var6, par3 - var6, par4 - var6, par2 + var6, par3 + 12.0D + var6, par4 + var6));
            Iterator var4 = var7.iterator();
            while (var4.hasNext())
            {
                System.out.println("Hurting entity!");
                Entity var5 = (Entity)var4.next();
                var5.onStruckByLightning(null);
            }
            return true;
        }


    For my experiment I made it occur when the block is right-clicked. I didn't test if it really worked for a radius of 50 blocks, but I got a whole lot of "Hurting entity!" printed out and found a lot of porkchops and feathers littering the ground for at least 15 blocks in any direction.
    Posted in: Modification Development
  • 0

    posted a message on How to kill mobs in a certain radius?
    Quote from snuffysam

    I've tried messing with it, but I can't get a block to look for a list of entities.
    Help?

    You're gonna have to post more detail than that. The code I posted should be VERY close to working. The only differences I can think of is that you'd need to use the other getEntitiesWithinAABB function since it's not being called by an entity, and you would need to replace this.posX, this.posY, and this.posZ with par2, par3, and par4 respectively. And that should strike everything in a 3-block radius.
    Posted in: Modification Development
  • 0

    posted a message on How to make lightening strike
    Error messages would be nice if you have any. Overall it looks pretty good. The two things that jump to mind are 1) Is it getting to the part of the if-statement where it should be adding the entity to the world? And 2) You use theWorld.spawnEntityInWorld, but at the top of your function I only see one World variable and it's called "par1World" instead of "theWorld".
    Posted in: Modification Development
  • 0

    posted a message on Need Help with Errors on Block
    Quote from Zoropirates

    any idea what I could do to speed up the growth any more?


    I know it sounds cold, but suffering on your own is a great way to grow. As a computer science student I spent a lot of time in my university's computer lab. If I got really stuck, I would sometimes ask one of the lab assistants for help. They were always careful to give me a little advice, but never solve the problem for me. It gave me some headaches, but that's how I did my best learning. But more specifically for Minecraft, I did a few tutorials and then just started exploring the code on my own. If I found something I didn't understand, I'd spend hours figuring it out. Waste of time? Maybe, but I doubt I'd be able to make the mods I make without it.
    Posted in: Modification Development
  • 0

    posted a message on Need Help with Errors on Block
    Quote from CHEESEBOT314

    No no no, its " if (Block.blocksList[world.getBlockId(x, y, z)] instanceof BlockCrops) " that should fix your problemo


    Haha, I have to laugh at myself now. You're absolutely right. I must be tired because I somehow looked at the array of "Block"s and mistook it for the name of the array.
    Posted in: Modification Development
  • 0

    posted a message on Need Help with Errors on Block
    Nope. First, blockId (which you might have noticed cannot be found according to your error) is supposed to be the ID of the block you want to check. You still need to get that ID using world.getBlockId. I just left that part out of my if-statement because I like to use simple if-statements when helping others. I suppose I should have included the declaration of blockId though. Second, the part about Block.Block was very literal. In theory I suppose you could use mod_TerraBlock.terraBlock.Block[blockId], but I prefer to go straight to the source. Block.java is where all blocks are ultimately registered. Block.java has an array called Block which is a list of all blocks in the game, hence my code used Block.Block[blockId]. Anyway, here's my complete code. You should be able to just copy and paste this:
    int blockId = world.getBlockId(x, y, z);
    if(Block.Block[blockId] instanceof BlockCrops)
    {
        System.out.println("Success!");
    }
    Posted in: Modification Development
  • 1

    posted a message on How to kill mobs in a certain radius?
    I would begin with EntityLightningBolt. In its code it gets a list of all mobs within a certain radius (I believe it's a square rather than a proper circular radius):
    double var6 = 3.0D;
    List var7 = this.worldObj.getEntitiesWithinAABBExcludingEntity(this, AxisAlignedBB.getAABBPool().addOrModifyAABBInPool(this.posX - var6, this.posY - var6, this.posZ - var6, this.posX + var6, this.posY + 6.0D + var6, this.posZ + var6));
    Iterator var4 = var7.iterator();
    while (var4.hasNext())
    {
        Entity var5 = (Entity)var4.next();
        var5.onStruckByLightning(this);
    }


    var6 is the radius. var7 is a list of all the objects within that radius. Note that it creates a sort of bounding box using the lightning bolt's coordinates and the radius. This method excludes the lightning bolt, but World.java has other similar methods that you can easily call upon. It then begins going through the list and damaging everything in it. After looking at your options in World.java and doing a little experimenting it should be fairly easy for you to kill everything but spiders in a 100-block radius. Limiting the radius if the reactor is enclosed in lead blocks will probably require quite a bit more coding since you'll need to check every block in a wall to make sure it's sealed off, but it'll be doable.

    Focus on getting the entity list first, then experiment with testing for a lead room using world.getBlockId, and then decreasing the radius based on whether or not the room is enclosed will be a piece of cake.
    Posted in: Modification Development
  • 0

    posted a message on Need Help with Errors on Block
    Quote from Zoropirates

    public void updateAdjacentCrop(World world, int x, int y, int z)
    {
    if(Block terraStone[worldObj.getBlockId(xCoord ,yCoord ,zCoord)] instanceof BlockCrops;)
    {
    if(rand.nextInt(1) == 0);
    }
    }



    Instead of trying to create a new block (which would require you to call its contructor) in order to call its block list, you should be able to access the list directly like so:
    if(Block.Block[blockId] instanceof BlockCrops)


    That should work just fine. Also, I think all three of your errors were caused by you having a semicolon inside the parenthesis. Semicolons are ALWAYS the last thing on a line.
    Posted in: Modification Development
  • 0

    posted a message on How to make lightening strike
    Lightning is an entity, and it can be placed just like an entity. Most of the time I hate to just give away the answers, so take a look at EntityEgg and try to figure out how it places a chicken in the world. You can ignore the line about growth since lightning doesn't age, but if you look at EntityLightningBolt you'll see that lightning can be placed almost exactly the same way. All you need is the world variable, and the xyz coordinates you want it to strike. Luckily, onBlockActivated provides you with all of those. It shouldn't be very difficult from here for you to call down lightning. Just be aware that lightning damages everything within a certain radius and not just that exact spot.
    Posted in: Modification Development
  • 0

    posted a message on Need help with a mod I'm making
    When you get an error and ask for help, ALWAYS post the error. Also, if you get an error when recompiling, it means recompiling didn't work. But I'm going to make a guess as to what error you received and say it was something along the lines of a non-static something being called from a static context?

    The problem is with the ModLoader functions you're calling within your mod. In whatever tutorial(s) you were looking at, it should have discussed setting up two files. The first is your mod_something file, and this is where your item is created. The second is your FireSword file, which describes how the sword works. Here's an example of my mod_file:
    package net.minecraft.src;
    import net.minecraft.client.Minecraft;
    public class mod_testMod extends BaseMod
    {
    public static int[] blockArray = new int[27];
    public static boolean flag = false;
    
    public mod_testMod()
    {
    	 ModLoader.addName(wand, "Wand");
    	 wand.iconIndex = ModLoader.addOverride("/gui/items.png", "/wand.png");
    	 ModLoader.addRecipe(new ItemStack(wand), new Object[] {
    		 "#", Character.valueOf('#'), Block.dirt
    	 });
    }
    
    public String getVersion()
    {
    	 return "3.1.1";
    }
    
    public static final Item wand = new ItemWand(1990).setItemName("Wand");
    }


    I've edited out most of the unnecessary parts so we can focus on the item. At the very bottom is where I've declared my item. This line is identical to the ones you'll find in Item.java, so look there for other examples. I think the one possible difference is that we don't set the icon index in that line when using ModLoader. We set it in our mod_ file. Toward the top of my file you'll see three lines. The first adds the name so it appears when you hover over the item. The second adds the image the item will use. The third is a recipe so you can craft the item. So rather than put them in your FireSword file, place them in the correct spot in your mod_ file.

    And here's my basic wand:
    package net.minecraft.src;
    public class ItemWand extends ItemSword
    {
    public ItemWand(int i)
    {
    	 super(i, EnumToolMaterial.GOLD);
    	 setMaxDamage(0);
    }
    
    public ItemStack onItemRightClick(ItemStack itemstack, World world, EntityPlayer entityplayer)
    {
    	 return itemstack;
    }
    }


    Extras have once again been deleted (hopefully all of them) so you can focus on what a bare-minimum item is like. By the way, your onItemUse looks fine so you can ignore my onItemRightClick. I'm not sure why you create an instance of your sword inside of itself. If you've got a plan for it, fine, but I don't think it's necessary.

    And once you get your basic item working, take a look at ItemSword, maybe even make your item extend from ItemSword instead of directly from Item. If you look at ItemSword long enough (and maybe EnumToolMaterial as well), you should be able to figure out how a sword's stats are figured out.
    Posted in: Modification Development
  • 0

    posted a message on How to add a new key control
    Here's how to add a new key in ModLoader:



        public void keyboardEvent(KeyBinding keybinding)
        {
            Minecraft mc = ModLoader.getMinecraftInstance();
            if(keybinding == this.AbilityGui && mc.currentScreen == null)
            {
                System.out.println("Opening screen!");
                mc.displayGuiScreen(new GuiAbilities(mc.thePlayer));
            }
        }
    
        public KeyBinding AbilityGui = new KeyBinding("Open Abilities", Keyboard.KEY_T);
    
    
        public void load()
        {
            ModLoader.registerKey(this, this.AbilityGui, true);
            ModLoader.addLocalization("Abilities", "Opens abilities GUI");
        }


    The first function is what happens when the key is pressed. For me, it opens up a GUI. The second part is the creation of the key. I called mine AbilityGui. The quotations say what the key is, and the KEY_T means that it's triggered by the 'T' key. The last two parts in the load function let Minecraft know about the key and adds the option for localization respectively. Before you have your key do anything complicated, I recommend relying on a println statement like I did, which tests if the key is working.
    Posted in: Modification Development
  • 0

    posted a message on [Mods] Chronosmith's Advanced Tutorials [1.3.1]
    Quote from darklord987

    Ok I Coded It But Where Does It Show Up? How Do I Also Add More Text To The Normal GUI The First Tutorial?

    In the first tutorial there's an initGui function. Put the controlList line in that function. But it's ultimately added the same way you add any other button to a GUI, except you add a GuiBigButton instead of a GuiButton. There are already plenty of tutorials on adding buttons. And if you look at the first tutorial, it shouldn't be too hard to figure out how to add lines of text, though there are also plenty of tutorials elsewhere on it. Sorry, but I can't give away ALL the answers. :P
    Posted in: Tutorials
  • 0

    posted a message on Five buttons causes discolored pictures
    Quote from blockout22

    button id 124 shouldn't cause that to happen, can you show me your actionPerformed? of that button id?

    There's no real actionPerformed to speak of, but here's the function:
    protected void actionPerformed(GuiButton guibutton)
    {
    if(!guibutton.enabled)
    {
    	 return;
    }
    if(guibutton.id == 120)
    {
    	 System.out.println("Button pressed!");
    }
    }

    Just enough to make sure everything's working. ID 124 doesn't do anything. The tutorial is live now and you can see it here. The purpose of the tutorial is just to demonstrate a bigger button, one that doesn't get messed up if you make it bigger than 20 pixels, so I had no need to make the button do anything in the picture. The pictures are only there to show why somebody might want an obscenely big button. But that's the finished product, using a new button. Even when it uses a plain button, oversized or not, it discolors things for me. Obviously the locations of the buttons in the picture are different than the locations in the code since I've been moving them around trying to figure things out. You can also ignore the fancy background. Although the background uses GL11.glColorf, which has the potential to mess everything up, I've already tried commenting out the background, leaving it with the default background and no colorf used at all.

    EDIT: I found a fix. By adding GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F) just before it draws the images that go on top of the buttons I stopped it from changing. I'm still clueless as to how the color was getting changed the last button though. I still kinda feel like the problem is still lurking around waiting to pop up again so any input is still appreciated.
    Posted in: Modification Development
  • 0

    posted a message on Five buttons causes discolored pictures
    Quote from blockout22

    2 of your buttons don't have width? could that be the problem also you shouldn't be doing that in a tutorial you will confuse people

    Width is nice for relative placement, but I use 0 and 20 for the two buttons in question because I want them pretty much up against the side. But this is just troubleshooting anyway. The buttons may not render properly right now, but that's what the tutorial fixes. Only problem is the yellowish tinge that the last button always adds. I've fixed it now by making a sixth button that renders far off the screen (width * 2), but that's an inelegant solution that just hides the problem under the rug.
    Posted in: Modification Development
  • To post a comment, please .