Started by
diniboy
on
Topic category: Help with Minecraft modding (Java Edition)
Hi!
I tried to create some flowers with mcreator. I created a flower which can "eat" the player, but I Can't find any action to check the nearest player distance smaller than nine or something...
Is there a way to check this?
Thanks!
So best results i got with this code. But you should propably change the tickrate to bigger.
static{
block = (BlockTestBlockish)(new BlockTestBlockish().setHardness(2.0F)
.setResistance(10.0F)
.setUnlocalizedName("TestBlockish")
.setLightOpacity(0)
.setStepSound(Block.soundTypeStone)
.setCreativeTab(CreativeTabs.tabBlock)
);block.setBlockBounds(0.0F,0.0F,0.0F,1.0F,1.0F,1.0F);
block.setHarvestLevel("pickaxe", 0);
}
public void generateSurface(World world, Random random, int chunkX, int chunkZ){}
public void generateNether(World world, Random random, int chunkX, int chunkZ){}
static class BlockTestBlockish extends Block
{
int a1 = 0,a2 = 0,a3 = 0,a4 = 0,a5 = 0,a6 = 0;
boolean red = false;
private World worldion = null;
private BlockPos position = null;
protected BlockTestBlockish()
{
super(Material.ground);
GameRegistry.registerBlock(this, "TestBlockish");
}
public void onBlockAdded(World world, BlockPos pos, IBlockState state){
int i = pos.getX();int j = pos.getY();int k = pos.getZ();world.scheduleUpdate(new BlockPos(i, j, k), this, this.tickRate(world));
}
@Override
public int tickRate(World world)
{
return 40;
}
public void updateTick(World world, BlockPos pos, IBlockState state, Random random){
this.worldion = world;
this.position = pos;
if(!world.isRemote){
getLightValue();}
world.scheduleUpdate(pos, this, this.tickRate(world));
}
@Override
public int getLightValue() {
int value = 0;
World world = this.worldion;
BlockPos pos = this.position;
if(world != null) {
if(!world.isDaytime()){
AxisAlignedBB box = new AxisAlignedBB(pos.getX() - 3, pos.getY() -3, pos.getZ() -3, pos.getX() + 3, pos.getY() + 3, pos.getZ() + 3);
List list = world.getEntitiesWithinAABB(EntityPlayer.class,box);
if(!list.isEmpty()){
value = 15;
}
else{
value = 8;
}
}
if(world.isDaytime()){
value = 0;
}
}
else{
value = 8;
}
return value;
}
}
Hi!
I tried it, but it says something like this:
\Mcreator\forge\build\sources\main\java\mod\mcreator\mcreator_testBlockish.java:294: error: reached end of file while parsing
}
@#11 Ohh, sorry that was my mistake... I missed the closing } of public class mcreator_TestBlockish { ...
Thanks. I tried it. It works if I place it and a Player go in 3 block radius. But if the player exit from the area the flower not change the lightlevel...
What's wrong?
Hi!
I wanted to try it, with the latest, 1.7.0 MCreator. But it says a symbol error:
C:\Pylo\MCreator170\forge\build\sources\main\java\mod\mcreator\mcreator_nightFlower.java:115: error: cannot find symbol
this.worldion = world;
^
So, what Can I do?
Many thanks!
Do you have defined the varible worldion of type World?
Hey, I'm trying to create a creature that explodes, if there are 3 blocks from the player, can you help me?