Advertisement
Guest User

TileEntityAlarme

a guest
Oct 21st, 2016
80
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.68 KB | None | 0 0
  1. package fr.lexmad13009.alarme.tileEntity;
  2.  
  3. import cpw.mods.fml.common.FMLCommonHandler;
  4. import fr.lexmad13009.alarme.Reference;
  5. import net.minecraft.block.Block;
  6. import net.minecraft.client.Minecraft;
  7. import net.minecraft.entity.player.EntityPlayer;
  8. import net.minecraft.nbt.NBTTagCompound;
  9. import net.minecraft.network.NetworkManager;
  10. import net.minecraft.network.Packet;
  11. import net.minecraft.network.play.server.S35PacketUpdateTileEntity;
  12. import net.minecraft.tileentity.TileEntity;
  13. import net.minecraft.world.World;
  14.  
  15. public class TileEntityAlarme extends TileEntity
  16. {
  17. @Override
  18. public void readFromNBT(NBTTagCompound compound)
  19. {
  20. super.readFromNBT(compound);
  21. }
  22.  
  23. @Override
  24. public void writeToNBT(NBTTagCompound compound)
  25. {
  26. super.writeToNBT(compound);
  27. }
  28.  
  29. public Packet getDescriptionPacket()
  30. {
  31. NBTTagCompound nbttagcompound = new NBTTagCompound();
  32. this.writeToNBT(nbttagcompound);
  33. return new S35PacketUpdateTileEntity(this.xCoord, this.yCoord, this.zCoord, 0, nbttagcompound);
  34. }
  35.  
  36. public void onDataPacket(NetworkManager net, S35PacketUpdateTileEntity pkt)
  37. {
  38. this.readFromNBT(pkt.func_148857_g());
  39. }
  40.  
  41. public void onNeighborBlockChange(World world, int i, int j, int k, Block l){
  42. EntityPlayer entity = Minecraft.getMinecraft().thePlayer;
  43. if (Block.getIdFromBlock(l) > 0 && l.canProvidePower() && world.isBlockIndirectlyGettingPowered(i, j, k)){
  44. if(true){
  45. world.playSoundEffect((double)i + 0.5D, (double)j + 0.5D, (double)k + 0.5D, Reference.MOD_ID + ":alarma", 1.0F, 1.0F);
  46. }
  47. }
  48. }
  49. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement