Java Code Examples for net.minecraft.potion.PotionEffect.setPotionDurationMax()

The following are Jave code examples for showing how to use setPotionDurationMax() of the net.minecraft.potion.PotionEffect class. You can vote up the examples you like. Your votes will be used in our system to get more good examples.
Example 1
Project: Zombe-Modpack   File: NetHandlerPlayClient.java   Source Code and License Vote up 6 votes
public void handleEntityEffect(SPacketEntityEffect packetIn)
{
    PacketThreadUtil.checkThreadAndEnqueue(packetIn, this, this.gameController);
    Entity entity = this.clientWorldController.getEntityByID(packetIn.getEntityId());

    if (entity instanceof EntityLivingBase)
    {
        Potion potion = Potion.getPotionById(packetIn.getEffectId());

        if (potion != null)
        {
            PotionEffect potioneffect = new PotionEffect(potion, packetIn.getDuration(), packetIn.getAmplifier(), packetIn.getIsAmbient(), packetIn.doesShowParticles());
            potioneffect.setPotionDurationMax(packetIn.isMaxDuration());
            ((EntityLivingBase)entity).addPotionEffect(potioneffect);
        }
    }
}
 
Example 2
Project: Backmemed   File: NetHandlerPlayClient.java   Source Code and License Vote up 6 votes
public void handleEntityEffect(SPacketEntityEffect packetIn)
{
    PacketThreadUtil.checkThreadAndEnqueue(packetIn, this, this.gameController);
    Entity entity = this.clientWorldController.getEntityByID(packetIn.getEntityId());

    if (entity instanceof EntityLivingBase)
    {
        Potion potion = Potion.getPotionById(packetIn.getEffectId());

        if (potion != null)
        {
            PotionEffect potioneffect = new PotionEffect(potion, packetIn.getDuration(), packetIn.getAmplifier(), packetIn.getIsAmbient(), packetIn.doesShowParticles());
            potioneffect.setPotionDurationMax(packetIn.isMaxDuration());
            ((EntityLivingBase)entity).addPotionEffect(potioneffect);
        }
    }
}
 
Example 3
Project: CustomWorldGen   File: NetHandlerPlayClient.java   Source Code and License Vote up 6 votes
public void handleEntityEffect(SPacketEntityEffect packetIn)
{
    PacketThreadUtil.checkThreadAndEnqueue(packetIn, this, this.gameController);
    Entity entity = this.clientWorldController.getEntityByID(packetIn.getEntityId());

    if (entity instanceof EntityLivingBase)
    {
        Potion potion = Potion.getPotionById(packetIn.getEffectId() & 0xFF);

        if (potion != null)
        {
            PotionEffect potioneffect = new PotionEffect(potion, packetIn.getDuration(), packetIn.getAmplifier(), packetIn.getIsAmbient(), packetIn.doesShowParticles());
            potioneffect.setPotionDurationMax(packetIn.isMaxDuration());
            ((EntityLivingBase)entity).addPotionEffect(potioneffect);
        }
    }
}
 
Example 4
Project: DecompiledMinecraft   File: NetHandlerPlayClient.java   Source Code and License Vote up 5 votes
public void handleEntityEffect(S1DPacketEntityEffect packetIn)
{
    PacketThreadUtil.checkThreadAndEnqueue(packetIn, this, this.gameController);
    Entity entity = this.clientWorldController.getEntityByID(packetIn.getEntityId());

    if (entity instanceof EntityLivingBase)
    {
        PotionEffect potioneffect = new PotionEffect(packetIn.getEffectId(), packetIn.getDuration(), packetIn.getAmplifier(), false, packetIn.func_179707_f());
        potioneffect.setPotionDurationMax(packetIn.func_149429_c());
        ((EntityLivingBase)entity).addPotionEffect(potioneffect);
    }
}
 
Example 5
Project: BaseClient   File: NetHandlerPlayClient.java   Source Code and License Vote up 5 votes
public void handleEntityEffect(S1DPacketEntityEffect packetIn)
{
    PacketThreadUtil.checkThreadAndEnqueue(packetIn, this, this.gameController);
    Entity entity = this.clientWorldController.getEntityByID(packetIn.getEntityId());

    if (entity instanceof EntityLivingBase)
    {
        PotionEffect potioneffect = new PotionEffect(packetIn.getEffectId(), packetIn.getDuration(), packetIn.getAmplifier(), false, packetIn.func_179707_f());
        potioneffect.setPotionDurationMax(packetIn.func_149429_c());
        ((EntityLivingBase)entity).addPotionEffect(potioneffect);
    }
}
 
Example 6
Project: BaseClient   File: NetHandlerPlayClient.java   Source Code and License Vote up 5 votes
public void handleEntityEffect(S1DPacketEntityEffect packetIn) {
	PacketThreadUtil.checkThreadAndEnqueue(packetIn, this, this.gameController);
	Entity entity = this.clientWorldController.getEntityByID(packetIn.getEntityId());

	if (entity instanceof EntityLivingBase) {
		PotionEffect potioneffect = new PotionEffect(packetIn.getEffectId(), packetIn.getDuration(),
				packetIn.getAmplifier(), false, packetIn.func_179707_f());
		potioneffect.setPotionDurationMax(packetIn.func_149429_c());
		((EntityLivingBase) entity).addPotionEffect(potioneffect);
	}
}
 
Example 7
Project: Backmemed   File: Fullbright.java   Source Code and License Vote up 5 votes
@Override
public void onUpdate(EntityPlayerSP player) {
	if(isEnabled()) {
		if(player != null && !player.isPotionActive(Potion.getPotionById(16))) {
			PotionEffect nightVision = new PotionEffect(Potion.getPotionById(16), Integer.MAX_VALUE, 0);
			nightVision.setPotionDurationMax(true);
			player.addPotionEffect(nightVision);
		}
	}
}