Jump to content

NinjaEllie

Members
  • Posts

    2
  • Joined

  • Last visited

Everything posted by NinjaEllie

  1. Hello, thank you for the answers, but I am still having trouble. I have managed to use the getPos for the block. But struggling with the spawn. I find no spawn function to use. Ive tried going into the Entity class and I do not see anything there either. Could you please show me how this would be used.
  2. Hello, I am going through a minecraft mod course, and I have been tasked with creating an event, but struggling to complete this. I have only started the course the past few days so I am not familiar with a lot of the code needed. I am wanting to spawn a sheep when a specific modded block is hit with a specific item, but I can not figure out how to spawn the sheep. I originally wanted the sheep to spawn at the blocks location, but I have read that blocks do not keep their position data, so i had to change it to the players location, but I just can't figure out the spawning part. From the code, you can see that I am trying to use addEntity, I am not sure if this is the correct way, as I have also seen spawn being used. But I am lost at what the arguments should be for SheepEntity(). Also if anyone could point me in the direction to be able to read about these functions etc, it would be appreciated. I have used the docs here, but found not many things are covered (maybe I am using it wrong) @SubscribeEvent public void onCopperBlockAppleHit(BlockEvent.BreakEvent event) { Block block = event.getState().getBlock(); PlayerEntity player = event.getPlayer(); World world = player.getEntityWorld(); if(event.getPlayer().getHeldItemMainhand().getItem() == ModItems.COPPER_APPLE.get()) { if(block == ModBlocks.COPPER_BLOCK.get()) { //world.addEntity(new SheepEntity(world, player.getPosX(), player.getPosY(), player.getPosZ() // new SheepEntity()) String msg = TextFormatting.YELLOW + "Spawned entity!"; player.sendMessage(new StringTextComponent(msg), player.getUniqueID()); } } }
×
×
  • Create New...

Important Information

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