Guff
Members-
Posts
159 -
Joined
-
Last visited
-
Days Won
1
Everything posted by Guff
-
Did you look at RenderSnowball?
-
Someone is making a Halo mod, I think. Can you specify what you mean by glitch out?
-
Just delete it and it will ask you to implement the methods.
-
if(world.getBlockId(i, j, k) == Block.wood.blockID) { for(int x = -1; x <= 1; x++) { for(int y = 0; y <= 15; y++) { for(int z = -1; z <= 1; z++) { if(world.getBlockId(i + x, j + y, k + z) == Block.wood.blockID) { int meta = world.getBlockMetadata(i + x, j + y, k + z); ItemStack drop = new ItemStack(Block.wood, 1, meta); EntityItem item = new EntityItem(world, i + x, j + y, k + z, drop); world.setBlock(i + x, j + y, k + z, 0); world.spawnEntityInWorld(item); } } } } }
-
Nested for-loops, one for each x, y, and z range. Use -1 to <= 1 as each range for x and z, and 0 to <= 15 for y. Then check if(world.getBlockId(par4 + x, par5 + y, par6 + z) == Block.log.blockID), and then get the metadata, create a new ItemStack of Block, set the block to 0 and then spawn an EntityItem at par4 + x, par5 + y, par6 + z.
-
You're using the wrong ISidedInventory. The one you are using is from Forge and is deprecated. Use net.minecraft.inventory.ISidedInventory.
-
It'd be easiest to check an area, perhaps a 3x15x3 region to check if the blocks are logs, and then make them drop a log at that position (for-loops).
-
You're trying to make an axe that destroys an entire tree, correct? I don't see how your code there with the TileEntity actually correlates to that concept, so I don't know what it does, let alone how it would be possible to put on an item.
-
public class MyTileEntity extends TileEntity implements ISidedInventory
-
Whoops, this is what I meant: @Override public boolean onBlockDestroyed(ItemStack stack, World world, int id, int i, int j, int k, EntityLivingBase entity) { //code return true; }
-
Take a look at how the furnace does it. Aside from opening the GUI (use player.openGui()), everything should be relatively the same.
-
Look at onBlockBreak() in Item.java.
-
I mean do you want a gui like a chest or a furnace or what? Configuration type thing? You weren't super specific.
-
Like for a container like chests or furnaces?
-
Try ISidedInventory.
-
Only use parts of the API that you're going to use, delete the rest.
-
How is that possible? Are you using eclipse? Is anything showing up red? Code and crash logs would probably help.
-
How is that? You shouldn't have to "get" an interface since it's meant to be implemented, and in order to be implemented, you should have had that interface available in your project. Everything should be available to you via the API, and if it's not, you can try using reflection.
-
What did you come up with?
-
Mod creators give their APIs as .java, so just copy the package that their API's source files are in (exact package, mind you) and past it into your project. When you ship out it, your mod won't at least have any errors, but it won't actually do anything without the mod for which the API belongs installed.
-
Changing the light value of a block depending on it's metadata
Guff replied to watkins577's topic in Modder Support
In your block, override: public int getLightValue(IBlockAccess iba, int i, int j, int k) { int meta = iba.getBlockMetadata(i, j, k); if(meta == 0) { return 15; } return 0; } -
You are using static references for everything; fields, methods, etc. Most of the things you have as static should not be, such as teleporter_x, y, etc. That's why they are syncing. When you are setting the teleport_x of one, it's setting them all to that.
-
Yes, I took the liberty of just making the recipe to study, you can use it for future reference when doing this sort of thing. This is a generalized version of what you want, which is handy for in case you want to add MULTIPLE repair recipes. So the key things to note are that the constructor uses an item id for which item you want to repair, an ItemStack for which item will repair it, and an amount for the item to be repaired. I added a safety catch so the recipe doesn't try to 'over-repair' your items, namely if one repair material will finish the repair (your item has no damage after getting repaired) then adding another repair item into the grid will not yield a result since it will waste your repair material otherwise. Here's how to add the recipe to the game: CraftingManager.getInstance().getRecipeList().add(new RecipeRepair(plateOfHearts.itemID, new ItemStack(Item.redstone), 1000)); I added the itemstack sensitivity in case you wanted to do something like this: CraftingManager.getInstance().getRecipeList().add(new RecipeRepair(Item.pickaxeWood.itemID, new ItemStack(Block.planks, 1, 2), 20)); That would allow wooden pickaxes to be repaired 1/3 of the way with ONLY jungle planks. Hope this helps!
-
The way you want to do it would be best done using the IRecipe interface. Basically for getCraftingResult() you'll want to check and make sure the items are redstone and plate of dual hearts in the crafting inventory (a parameter for this method). From there you can get the damage value of the plate (plate.getItemDamage()) and subtracting 1000 (will remove 1000 damage from it) for every piece of redstone your recipe finds. Then make the method return a new plate of dual hearts with the proper damage (item.getItemDamage - 1000 * redCount). Hopefully this helps!