Advertisement
Guest User

Untitled

a guest
Apr 20th, 2019
104
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.62 KB | None | 0 0
  1. public class PotionTimestop extends PotionBase {
  2.  
  3. public int Olddamage;
  4. public int Tdamage;
  5.  
  6. public PotionTimestop(boolean isBadEffectIn, int liquidColorIn) {
  7. super(isBadEffectIn, liquidColorIn, "timestop");
  8. this.setIconIndex(1, 1);
  9. }
  10.  
  11. @SubscribeEvent
  12. public void onHurt(LivingHurtEvent evt)
  13. {
  14. evt.setCanceled(true);
  15. Tdamage = (int) evt.getAmount() + Olddamage;
  16. Olddamage = Tdamage;
  17. }
  18.  
  19.  
  20.  
  21. @Override
  22. public void performEffect(EntityLivingBase e, int amplifier) {
  23. super.performEffect(e, amplifier);
  24. if (e instanceof EntityPlayer && ((EntityPlayer)e).isSpectator()) return;
  25.  
  26. e.setVelocity(0, 0, 0);
  27. if(e.posX != e.prevPosX || e.posY != e.prevPosY || e.posZ != e.prevPosZ || e.rotationYaw != e.prevRotationYaw || e.rotationPitch != e.prevRotationPitch) {
  28. e.setPositionAndRotation(e.prevPosX, e.prevPosY, e.prevPosZ, e.prevRotationYaw, e.prevRotationPitch);
  29.  
  30. }
  31. if(e.getActivePotionEffect(PotionReference.INSTANCE.TIMESTOP).getDuration() == 1)
  32. {
  33. e.attackEntityFrom(DamageSource.FALL, Olddamage + .0F);
  34. }
  35.  
  36. if(e == Minecraft.getMinecraft().player) {
  37.  
  38.  
  39. KeyBinding.setKeyBindState(Minecraft.getMinecraft().gameSettings.keyBindForward.getKeyCode(), false);
  40. KeyBinding.setKeyBindState(Minecraft.getMinecraft().gameSettings.keyBindBack.getKeyCode(), false);
  41. KeyBinding.setKeyBindState(Minecraft.getMinecraft().gameSettings.keyBindLeft.getKeyCode(), false);
  42. KeyBinding.setKeyBindState(Minecraft.getMinecraft().gameSettings.keyBindRight.getKeyCode(), false);
  43. KeyBinding.setKeyBindState(Minecraft.getMinecraft().gameSettings.keyBindJump.getKeyCode(), false);
  44. KeyBinding.setKeyBindState(Minecraft.getMinecraft().gameSettings.keyBindSneak.getKeyCode(), false);
  45. KeyBinding.setKeyBindState(Minecraft.getMinecraft().gameSettings.keyBindSwapHands.getKeyCode(), false);
  46. KeyBinding.setKeyBindState(Minecraft.getMinecraft().gameSettings.keyBindAttack.getKeyCode(), false);
  47. KeyBinding.setKeyBindState(Minecraft.getMinecraft().gameSettings.keyBindDrop.getKeyCode(), false);
  48. KeyBinding.setKeyBindState(Minecraft.getMinecraft().gameSettings.keyBindUseItem.getKeyCode(), false);
  49. KeyBinding.setKeyBindState(Minecraft.getMinecraft().gameSettings.keyBindInventory.getKeyCode(), false);
  50. KeyBinding.setKeyBindState(Minecraft.getMinecraft().gameSettings.keyBindPickBlock.getKeyCode(), false);
  51.  
  52.  
  53. }
  54.  
  55.  
  56.  
  57.  
  58.  
  59.  
  60.  
  61. }
  62.  
  63.  
  64.  
  65.  
  66. public boolean isReady(int duration, int amplifier) {
  67. return true;
  68. }
  69.  
  70. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement