Jump to content

heyitsmenobodyy

Members
  • Posts

    11
  • Joined

  • Last visited

Everything posted by heyitsmenobodyy

  1. Updatetick and scheduleupdate aren't a thing apparently.
  2. What the title says. @Override public void onBlockPlacedBy(World worldIn, BlockPos pos, IBlockState state, EntityLivingBase placer, ItemStack stack) { if (!worldIn.isRemote) { worldIn.scheduleUpdate(pos, this, 20 * ModConfig.seconds); } } @Override public void updateTick(World worldIn, BlockPos pos, IBlockState state, Random rand) { if (!worldIn.isRemote) { worldIn.setBlockToAir(pos); worldIn.playSound(null, pos, SoundEvents.BLOCK_WOOD_BREAK, SoundCategory.BLOCKS, 0.6f, 1.2f); } } Will this not work anymore?
  3. Okay, I'm quite new to modding.. But i can't figure this one out, I want to listen for the EntityInteract event.. So far i've tried this: public class EntityInteract extends PlayerInteractEvent.EntityInteract { public EntityInteract(EntityPlayer player, EnumHand hand, Entity target) { super(player, hand, target); Main.logger.info("test"); } }
  4. How would i implement this in a block? Let's say i wanted to remove the block 10 seconds after it was placed.
  5. I need to interact with the game, Mind showing an example?
  6. How would you go about waiting? I thought about using Thread.sleep but that doesn't sound like the best idea.
  7. This is probably the simplest thing ever.. But how do edit a blocks breaking sound? Like glass.
  8. Thanks all of you for the help, I got it working now. package com.shoshonerp.shoshonerp.blocks; import com.shoshonerp.shoshonerp.Main; import com.shoshonerp.shoshonerp.init.ModBlocks; import com.shoshonerp.shoshonerp.init.ModItems; import com.shoshonerp.shoshonerp.util.Reference; import net.minecraft.block.Block; import net.minecraft.block.material.Material; import net.minecraft.block.state.IBlockState; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.Item; import net.minecraft.item.ItemBlock; import net.minecraft.item.ItemStack; import net.minecraft.util.EnumFacing; import net.minecraft.util.EnumHand; import net.minecraft.util.math.BlockPos; import net.minecraft.util.text.TextComponentString; import net.minecraft.world.World; public class BlockBase extends Block { public BlockBase(String name, Material material) { super(material); this.setCreativeTab(Main.firsttab); this.setRegistryName(Reference.MOD_ID, name); this.setUnlocalizedName(this.getRegistryName().toString()); ModBlocks.BLOCKS.add(this); ModItems.ITEMS.add(new ItemBlock(this).setRegistryName(this.getRegistryName())); } @Override public boolean onBlockActivated(World worldIn, BlockPos pos, IBlockState state, EntityPlayer playerIn, EnumHand hand, EnumFacing facing, float hitX, float hitY, float hitZ) { Main.logger.info("onBlockActivated called"); return true; } }
  9. I'm trying to get into minecraft modding.. But onBlockActivated just will not do anything. public class BlockBase extends Block implements IHasModel { public BlockBase(String name, Material material) { super(material); setUnlocalizedName(name); setRegistryName(name); setCreativeTab(Main.firsttab); ModBlocks.BLOCKS.add(this); ModItems.ITEMS.add(new ItemBlock(this).setRegistryName(this.getRegistryName())); } @Override public void registerModels() { Main.proxy.registerItemRenderer(Item.getItemFromBlock(this), 0, "inventory"); } public boolean onBlockActivated(World worldIn, BlockPos pos, IBlockState state, EntityPlayer playerIn, EnumHand hand, ItemStack heldItem, EnumFacing side, float hitX, float hitY, float hitZ) { if (!worldIn.isRemote) { return false; } playerIn.sendMessage(new TextComponentString("test: " + playerIn.getDisplayNameString())); Main.logger.warn("Right click"); return true; } }
×
×
  • Create New...

Important Information

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