mirror of
https://github.com/Ellpeck/ActuallyAdditions.git
synced 2024-11-26 08:48:34 +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
|
@ -35,6 +35,8 @@ import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
|
||||||
|
|
||||||
public class ItemHairyBall extends ItemBase{
|
public class ItemHairyBall extends ItemBase{
|
||||||
|
|
||||||
|
private final UUID KittyVanCatUUID = UUID.fromString("681d4e20-10ef-40c9-a0a5-ba2f1995ef44");
|
||||||
|
|
||||||
public ItemHairyBall(String name){
|
public ItemHairyBall(String name){
|
||||||
super(name);
|
super(name);
|
||||||
|
|
||||||
|
@ -45,7 +47,7 @@ public class ItemHairyBall extends ItemBase{
|
||||||
public void livingUpdateEvent(LivingEvent.LivingUpdateEvent event){
|
public void livingUpdateEvent(LivingEvent.LivingUpdateEvent event){
|
||||||
//Ocelots dropping Hair Balls
|
//Ocelots dropping Hair Balls
|
||||||
if(ConfigBoolValues.DO_CAT_DROPS.isEnabled() && event.getEntityLiving() != null && event.getEntityLiving().world != null && !event.getEntityLiving().world.isRemote){
|
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){
|
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));
|
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);
|
event.getEntityLiving().world.spawnEntity(item);
|
||||||
|
|
Loading…
Reference in a new issue