I'm almost done with a mod and I had it with an array. I never declared how many where in the array and do not want to because it changes. Is there a way to create an array without saying how many are in it?
The best way to learn things is to look at Entity classes which have similar characteristics to your mob that you want, so for your mob I looked into the EntityWolf class. I found the code where it attacks a random mob around it.
thank you, but for changing the speed, I already changed the
motionX *= 0.99000000953674316D;
motionY *= 0.94999998807907104D;
motionZ *= 0.99000000953674316D;
code, but it dosn't make the boat any faster? any other ideas?
I am working on having large structures generate around the players spawn point but the code that is required to make the structures i know how to do but it is a pain and there is a lot of it. Does anyone know if there are any programs that are similar to "MCEdit" but that can export the code that is required to generate the building. The code that I want to know if it can out put is set up like this:
world.setBlockWithNotify(i , j, k , Block.Here);
Below in the spoiler is a example of a class file that spawns a small building with a door 2 torches and a single chest. You can probably see why i want a program like that.
package net.minecraft.src;
public class WorldGenSpawn
{
private World world;
private int i; // -> X
private int j; // -> Y
private int k; // -> Z
public WorldGenSpawn(World world1, int i1, int j1, int k1)
{
world = world1;
i = i1;
j = j1;
k = k1;
}
public void Create()
{
//floor
world.setBlockWithNotify(i - 1, j - 1, k, Block.blockDiamond.blockID);
world.setBlockWithNotify(i - 1, j - 1, k - 1, Block.blockDiamond.blockID);
world.setBlockWithNotify(i - 1, j - 1, k + 1, Block.blockDiamond.blockID);
world.setBlockWithNotify(i, j - 1, k + 1, Block.blockDiamond.blockID);
world.setBlockWithNotify(i, j - 1, k - 1, Block.blockDiamond.blockID);
world.setBlockWithNotify(i + 1, j - 1, k + 1, Block.blockDiamond.blockID);
world.setBlockWithNotify(i + 1, j - 1, k - 1, Block.blockDiamond.blockID);
world.setBlockWithNotify(i + 1, j - 1, k, Block.blockDiamond.blockID);
world.setBlockWithNotify(i, j - 1, k, Block.blockDiamond.blockID);
world.setBlockWithNotify(i, j - 1, k + 2, Block.blockDiamond.blockID);
//walls L1
world.setBlockWithNotify(i - 2, j, k + 2, Block.blockDiamond.blockID);
world.setBlockWithNotify(i - 2, j, k + 1, Block.blockDiamond.blockID);
world.setBlockWithNotify(i - 2, j, k, Block.blockDiamond.blockID);
world.setBlockWithNotify(i - 2, j, k - 1, Block.blockDiamond.blockID);
world.setBlockWithNotify(i - 2, j, k - 2, Block.blockDiamond.blockID);
world.setBlockWithNotify(i + 2, j, k + 2, Block.blockDiamond.blockID);
world.setBlockWithNotify(i + 2, j, k + 1, Block.blockDiamond.blockID);
world.setBlockWithNotify(i + 2, j, k, Block.blockDiamond.blockID);
world.setBlockWithNotify(i + 2, j, k - 1, Block.blockDiamond.blockID);
world.setBlockWithNotify(i + 2, j, k - 2, Block.blockDiamond.blockID);
world.setBlockWithNotify(i - 1, j, k + 2, Block.blockDiamond.blockID);
world.setBlockWithNotify(i - 1, j, k - 2, Block.blockDiamond.blockID);
world.setBlockWithNotify(i + 1, j, k + 2, Block.blockDiamond.blockID);
world.setBlockWithNotify(i + 1, j, k - 2, Block.blockDiamond.blockID);
world.setBlockWithNotify(i, j, k + 2, Block.doorWood.blockID);
world.setBlockWithNotify(i, j, k - 2, Block.blockDiamond.blockID);
//walls L2
world.setBlockWithNotify(i - 1, j + 1, k + 1, Block.torchWood.blockID);
world.setBlockWithNotify(i + 1, j + 1, k + 1, Block.torchWood.blockID);
world.setBlockWithNotify(i - 2, j + 1, k + 2, Block.blockDiamond.blockID);
world.setBlockWithNotify(i - 2, j + 1, k + 1, Block.blockDiamond.blockID);
world.setBlockWithNotify(i - 2, j + 1, k, Block.blockDiamond.blockID);
world.setBlockWithNotify(i - 2, j + 1, k - 1, Block.blockDiamond.blockID);
world.setBlockWithNotify(i - 2, j + 1, k - 2, Block.blockDiamond.blockID);
world.setBlockWithNotify(i + 2, j + 1, k + 2, Block.blockDiamond.blockID);
world.setBlockWithNotify(i + 2, j + 1, k + 1, Block.blockDiamond.blockID);
world.setBlockWithNotify(i + 2, j + 1, k, Block.blockDiamond.blockID);
world.setBlockWithNotify(i + 2, j + 1, k - 1, Block.blockDiamond.blockID);
world.setBlockWithNotify(i + 2, j + 1, k - 2, Block.blockDiamond.blockID);
world.setBlockWithNotify(i - 1, j + 1, k + 2, Block.blockDiamond.blockID);
world.setBlockWithNotify(i - 1, j + 1, k - 2, Block.blockDiamond.blockID);
world.setBlockWithNotify(i + 1, j + 1, k + 2, Block.blockDiamond.blockID);
world.setBlockWithNotify(i + 1, j + 1, k - 2, Block.blockDiamond.blockID);
//world.setBlockWithNotify(i, j + 1, k + 2, Block.doorWood.blockID);
world.setBlockWithNotify(i, j + 1, k - 2, Block.blockDiamond.blockID);
//walls L3
world.setBlockWithNotify(i - 2, j + 2, k + 2, Block.blockDiamond.blockID);
world.setBlockWithNotify(i - 2, j + 2, k + 1, Block.blockDiamond.blockID);
world.setBlockWithNotify(i - 2, j + 2, k, Block.blockDiamond.blockID);
world.setBlockWithNotify(i - 2, j + 2, k - 1, Block.blockDiamond.blockID);
world.setBlockWithNotify(i - 2, j + 2, k - 2, Block.blockDiamond.blockID);
world.setBlockWithNotify(i + 2, j + 2, k + 2, Block.blockDiamond.blockID);
world.setBlockWithNotify(i + 2, j + 2, k + 1, Block.blockDiamond.blockID);
world.setBlockWithNotify(i + 2, j + 2, k, Block.blockDiamond.blockID);
world.setBlockWithNotify(i + 2, j + 2, k - 1, Block.blockDiamond.blockID);
world.setBlockWithNotify(i + 2, j + 2, k - 2, Block.blockDiamond.blockID);
world.setBlockWithNotify(i - 1, j + 2, k + 2, Block.blockDiamond.blockID);
world.setBlockWithNotify(i - 1, j + 2, k - 2, Block.blockDiamond.blockID);
world.setBlockWithNotify(i + 1, j + 2, k + 2, Block.blockDiamond.blockID);
world.setBlockWithNotify(i + 1, j + 2, k - 2, Block.blockDiamond.blockID);
world.setBlockWithNotify(i, j + 2, k + 2, Block.blockDiamond.blockID);
world.setBlockWithNotify(i, j + 2, k - 2, Block.blockDiamond.blockID);
//ceiling
world.setBlockWithNotify(i - 1, j + 3, k, Block.blockDiamond.blockID);
world.setBlockWithNotify(i - 1, j + 3, k - 1, Block.blockDiamond.blockID);
world.setBlockWithNotify(i - 1, j + 3, k + 1, Block.blockDiamond.blockID);
world.setBlockWithNotify(i, j + 3, k + 1, Block.blockDiamond.blockID);
world.setBlockWithNotify(i, j + 3, k - 1, Block.blockDiamond.blockID);
world.setBlockWithNotify(i + 1, j + 3, k + 1, Block.blockDiamond.blockID);
world.setBlockWithNotify(i + 1, j + 3, k - 1, Block.blockDiamond.blockID);
world.setBlockWithNotify(i + 1, j + 3, k, Block.blockDiamond.blockID);
world.setBlockWithNotify(i, j + 3, k, Block.blockDiamond.blockID);
//chest
world.setBlockWithNotify(i + 1, j, k, Block.chest.blockID);
TileEntityChest tileentitychest = (TileEntityChest)world.getBlockTileEntity(i + 1, j, k);
if(tileentitychest != null && tileentitychest.getSizeInventory() > 0)
{
ItemStack itemstack = new ItemStack(Item.axeWood, 1);
tileentitychest.setInventorySlotContents(0, itemstack);
ItemStack itemstack1 = new ItemStack(Item.pickaxeWood, 1);
tileentitychest.setInventorySlotContents(1, itemstack1);
ItemStack itemstack2 = new ItemStack(Block.wood, 64);
tileentitychest.setInventorySlotContents(2, itemstack2);
}
}
}
If what i said makes any sense please tell me if there are any programs that do what i want. Or if you know an easier way to code this please tell me.
The best and more efficient way to do this (but alot harder), is the method Jeb uses which is called Procedural generation. You should take a look at how Dungeons and strongholds are generated.
Build path specifies execution environment JavaSE-1.6. There are no JREs installed in the workspace that are strictly compatible with this environment.
Alright, I've been hard at work to finish a mod update I've been working on recently. I've come across a problem though, which is preventing me from finishing it. I managed to make the NPC I'm working with stop moving, but I can't seem to make it togglable. I apologize if my code is sloppy, I'm new to java. What's the problem with it?
0
You should be to just declare
0
Try this:
0
Sweet, glad to help.
0
find
and change the end value.
0
Use something similar to this, but adapt it to your code.
But the basic method you want to use is
Hope this helps.
0
Find this
and change the value, see if that works.
0
But mainly this part of that code:
'
hope this helps.
0
Why are you making a mob using the Entity (Player) class?
0
Sweet :smile.gif:
0
It looks like the way MCP has setup the eclipse files it requires JRE version 1.6 (Same as JRE6) As showen here.
idk what it would do, but you could try changing 1.6 to 1.7 and see if ti allows you to use your 7.1 version.
0
Ahh ok, yea. It's best to keep updated with the latest version.
0
The best and more efficient way to do this (but alot harder), is the method Jeb uses which is called Procedural generation. You should take a look at how Dungeons and strongholds are generated.
1
Have you downloaded and installed the latest Java SE JRE (Java runtime environment) ? if not go here http://www.oracle.com/technetwork/java/javase/downloads/index.html and download Java SE 7u1.
0
Try this:
1
Wouldnt you do structure it like this?
Im not a expert Java programmer so I might be wrong.