CraftTweaker

CraftTweaker

151M Downloads

[1.12.2] IEntityLiving.setDropChance only takes 1 float for min chance, none for max chance

pjc21 opened this issue ยท 2 comments

commented

Issue Description:

Not able to set HandDropChances for entities like zombie/pigman/skeleton as IEntityLiving.setDropChance only takes 1 float arg for a min/max drop chance - HandDropChances:[0.085f,0.085f],

What happens:

I can change the first float (min) but not the second (max)
setDropChance(equitmentSlot, 0.0); = HandDropChances:[0.0f,0.085f],

What you expected to happen:

To change both the min & max chance.

Script used:

events.onEntityLivingDeath(function (event as EntityLivingDeathEvent) {

	if event.entity instanceof IEntityLiving {
		if (event.entity.definition.id).matches("minecraft:zombie_pigman") {
			val entityLiving as IEntityLiving = event.entity;
			val equitmentSlot = crafttweaker.entity.IEntityEquipmentSlot.mainHand();
			entityLiving.setDropChance(equitmentSlot, 0.0);
		}
	}
});

Environment:

  • Minecraft Version: 1.12.2
  • Forge Version: 14.23.5.2854
  • CraftTweaker Version: 1.12-4.1.20.618
  • Are you using a server: No
commented

What you mean? 8.5% chance to drop the entity's item on main hand. Is there a min/max chance?

commented

What you mean? 8.5% chance to drop the entity's item on main hand. Is there a min/max chance?

If the entity has an item in a hand slot at the onDeath event then it will use the HandDropChances to determine the chance of that item dropping.

If you have a look at the nbt data of any minecraft entity/mob they have a HandDropChances:[0.085f,0.085f] tag

I was assuming the 1st was min chance and the 2nd was max chance but after more testing have realized my mistake it's a left/right hand chance, had some bad luck 1st time testing with pigman spawning with sword in right hand only.
Have now accounted for offhand also & all good so closing