Jump to content

Zephan

Members
  • Posts

    2
  • Joined

  • Last visited

Everything posted by Zephan

  1. Where would I put a method that ticks during every world tick? I have a tile entity if that helps.
  2. I am trying to make a mod that has a block that affects the movement of a player when they are within a radius of the block. I have found some methods in the forge api, but I can't seem to get anything to work. My code accesses the net.minecraft.world.World methods as well as the net.minecraft.entity.player.EntityPlayer package to access nearby players. My code doesn't do anything, my guess is it just grabs null references for the player/world. I also think the block might not be affecting the player because the code might only run through one time when it is first instantiated into the world. Any thoughts would be helpful, here is the code. protected CustomBlock(Material p_i45394_1_) { super(p_i45394_1_); this.setBlockName("CustomBlock"); this.setCreativeTab(CreativeTabs.tabBlock); this.setHardness(50); this.setResistance(2000); this.setBlockTextureName(StringLibrary.MODID + ":dense_block"); this.setPlayerMovement(1.0D,1.0D,1.0D, 5.0D); } private void setPlayerMovement(double moveX, double moveY, double moveZ, double distance) { World world = Minecraft.getMinecraft().theWorld; TileEntityCamp camp = new TileEntityCamp(); if(world != null){ EntityPlayer player = world.getClosestPlayer(camp.xCoord,camp.yCoord,camp.zCoord,distance); if(player != null) { player.isDead = true; } }
×
×
  • Create New...

Important Information

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