mirror of
https://github.com/Ellpeck/ActuallyAdditions.git
synced 2024-12-22 19:39:24 +01:00
Cache KittyVanCat UUID (#1216)
Moved `UUID.fromString()` to a field as it currently runs it on every LivingUpdate which is unnecessary here. ![](https://i.imgur.com/BauHelP.jpg)
This commit is contained in:
parent
6e46026e68
commit
81a988811b
1 changed files with 3 additions and 1 deletions
|
@ -34,6 +34,8 @@ import net.minecraftforge.event.entity.living.LivingEvent;
|
|||
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
|
||||
|
||||
public class ItemHairyBall extends ItemBase{
|
||||
|
||||
private final UUID KittyVanCatUUID = UUID.fromString("681d4e20-10ef-40c9-a0a5-ba2f1995ef44");
|
||||
|
||||
public ItemHairyBall(String name){
|
||||
super(name);
|
||||
|
@ -45,7 +47,7 @@ public class ItemHairyBall extends ItemBase{
|
|||
public void livingUpdateEvent(LivingEvent.LivingUpdateEvent event){
|
||||
//Ocelots dropping Hair Balls
|
||||
if(ConfigBoolValues.DO_CAT_DROPS.isEnabled() && event.getEntityLiving() != null && event.getEntityLiving().world != null && !event.getEntityLiving().world.isRemote){
|
||||
if((event.getEntityLiving() instanceof EntityOcelot && ((EntityOcelot)event.getEntityLiving()).isTamed()) || (event.getEntityLiving() instanceof EntityPlayer && event.getEntityLiving().getUniqueID().equals(/*KittyVanCat*/ UUID.fromString("681d4e20-10ef-40c9-a0a5-ba2f1995ef44")))){
|
||||
if((event.getEntityLiving() instanceof EntityOcelot && ((EntityOcelot)event.getEntityLiving()).isTamed()) || (event.getEntityLiving() instanceof EntityPlayer && event.getEntityLiving().getUniqueID().equals(KittyVanCatUUID))){
|
||||
if(event.getEntityLiving().world.rand.nextInt(ConfigIntValues.FUR_CHANCE.getValue()) == 0){
|
||||
EntityItem item = new EntityItem(event.getEntityLiving().world, event.getEntityLiving().posX+0.5, event.getEntityLiving().posY+0.5, event.getEntityLiving().posZ+0.5, new ItemStack(InitItems.itemHairyBall));
|
||||
event.getEntityLiving().world.spawnEntity(item);
|
||||
|
|
Loading…
Reference in a new issue