DTM Integrations

DTM Integrations

34.7k Downloads

Bandages not working

knoxhack opened this issue ยท 2 comments

commented

Not sure if this has been fixed already, but some players saying that the bandages are no working as intended

commented

@knoxhack I Just took a glance at the code. Bandages do not heel, but only patch the bleeding effect.

Advanced bandages do heal and remove bleeding.

Code for bandages use event

public void onPlayerStoppedUsing(ItemStack stack, World worldIn, EntityLivingBase entityLiving, int timeLeft) {
        if (entityLiving instanceof EntityPlayer) {
            EntityPlayer entityplayer = (EntityPlayer)entityLiving;
            int dur = this.getMaxItemUseDuration(stack) - timeLeft;
            if ((float)dur <= (float)this.getMaxItemUseDuration(stack) * 0.1F) {
                if (!entityplayer.capabilities.isCreativeMode) {
                    stack.shrink(1);
                    if (stack.isEmpty()) {
                        entityplayer.inventory.deleteStack(stack);
                    }
                }

                entityplayer.removePotionEffect(Potions.bleeding);
            }
        }

    }

    public boolean itemInteractionForEntity(ItemStack stack, EntityPlayer playerIn, EntityLivingBase target, EnumHand hand) {
        if (target.getActivePotionEffect(Potions.bleeding) != null) {
            target.removePotionEffect(Potions.bleeding);
            stack.shrink(1);
        }

        return false;
    }
I'll implement some configurable changes for these.