Jump to content
View in the app

A better way to browse. Learn more.

Forge Forums

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

zeldem

Members
  • Joined

  • Last visited

  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

Important Information

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

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.