Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class PotionTimestop extends PotionBase {
- public int Olddamage;
- public int Tdamage;
- public PotionTimestop(boolean isBadEffectIn, int liquidColorIn) {
- super(isBadEffectIn, liquidColorIn, "timestop");
- this.setIconIndex(1, 1);
- }
- @SubscribeEvent
- public void onHurt(LivingHurtEvent evt)
- {
- evt.setCanceled(true);
- Tdamage = (int) evt.getAmount() + Olddamage;
- Olddamage = Tdamage;
- }
- @Override
- public void performEffect(EntityLivingBase e, int amplifier) {
- super.performEffect(e, amplifier);
- if (e instanceof EntityPlayer && ((EntityPlayer)e).isSpectator()) return;
- e.setVelocity(0, 0, 0);
- if(e.posX != e.prevPosX || e.posY != e.prevPosY || e.posZ != e.prevPosZ || e.rotationYaw != e.prevRotationYaw || e.rotationPitch != e.prevRotationPitch) {
- e.setPositionAndRotation(e.prevPosX, e.prevPosY, e.prevPosZ, e.prevRotationYaw, e.prevRotationPitch);
- }
- if(e.getActivePotionEffect(PotionReference.INSTANCE.TIMESTOP).getDuration() == 1)
- {
- e.attackEntityFrom(DamageSource.FALL, Olddamage + .0F);
- }
- if(e == Minecraft.getMinecraft().player) {
- KeyBinding.setKeyBindState(Minecraft.getMinecraft().gameSettings.keyBindForward.getKeyCode(), false);
- KeyBinding.setKeyBindState(Minecraft.getMinecraft().gameSettings.keyBindBack.getKeyCode(), false);
- KeyBinding.setKeyBindState(Minecraft.getMinecraft().gameSettings.keyBindLeft.getKeyCode(), false);
- KeyBinding.setKeyBindState(Minecraft.getMinecraft().gameSettings.keyBindRight.getKeyCode(), false);
- KeyBinding.setKeyBindState(Minecraft.getMinecraft().gameSettings.keyBindJump.getKeyCode(), false);
- KeyBinding.setKeyBindState(Minecraft.getMinecraft().gameSettings.keyBindSneak.getKeyCode(), false);
- KeyBinding.setKeyBindState(Minecraft.getMinecraft().gameSettings.keyBindSwapHands.getKeyCode(), false);
- KeyBinding.setKeyBindState(Minecraft.getMinecraft().gameSettings.keyBindAttack.getKeyCode(), false);
- KeyBinding.setKeyBindState(Minecraft.getMinecraft().gameSettings.keyBindDrop.getKeyCode(), false);
- KeyBinding.setKeyBindState(Minecraft.getMinecraft().gameSettings.keyBindUseItem.getKeyCode(), false);
- KeyBinding.setKeyBindState(Minecraft.getMinecraft().gameSettings.keyBindInventory.getKeyCode(), false);
- KeyBinding.setKeyBindState(Minecraft.getMinecraft().gameSettings.keyBindPickBlock.getKeyCode(), false);
- }
- }
- public boolean isReady(int duration, int amplifier) {
- return true;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement