Jump to content

zeldem

Members
  • Posts

    3
  • Joined

  • Last visited

Everything posted by zeldem

  1. this makes perfect sense, and it is exactly what was happening, using: BlockPos another_pos= ....; mundo.setBlockState(another_pos, Blocks.COBBLESTONE.getDefaultState(), 3); succed in creating the block
  2. Okay, I understand, the count variable is just a dummy, let's assume the OnBlockDestroyed is empty, can I ask you what is the way to place a block using this method? or should I use an event listener on the player instead on the item?
  3. Hello people, I have a really easy question, I have read some other post but somehow this piece of code doesn't work. I just want to place a block when some simple conditions happens, the entity part is okay , but the block is not placed, what am I doing wrong? Here is the code: package com.zeldem.pobladosmod.objects.items; import com.zeldem.pobladosmod.PobladosMod; import net.minecraft.block.Block; import net.minecraft.block.BlockState; import net.minecraft.block.Blocks; import net.minecraft.entity.EntityType; import net.minecraft.entity.LivingEntity; import net.minecraft.entity.passive.TurtleEntity; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.util.math.BlockPos; import net.minecraft.world.World; public class House_generator extends Item{ public static int count=0; public House_generator(Properties properties) { super(properties); } @Override public boolean onBlockDestroyed(ItemStack stack, World mundo, BlockState state, BlockPos pos,LivingEntity entityLiving) { PobladosMod.LOGGER.debug("Item has destroyed "+(++count)+" blocks"); if(count%6==0) { if(!mundo.isRemote) { // entity spawning example PobladosMod.LOGGER.debug("creando tortuga"); TurtleEntity t= new TurtleEntity( EntityType.TURTLE,mundo); t.setPosition(pos.getX(),pos.getY()+2,pos.getZ() ); mundo.addEntity(t);//entity is created succesfully :D //block placement example, BLOCK IS NOT PLACED :( mundo.setBlockState(pos, Blocks.COBBLESTONE.getDefaultState(), 0); } } return true; } } Thanks in advice
×
×
  • Create New...

Important Information

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