Skip to content

Commit

Permalink
Removed key usage to open chests + Add Unihored Ostrich regen + Updat…
Browse files Browse the repository at this point in the history
…e dchievement descs

Removed the requirement of needing to use a key to open chests on elephants, horses, ostrich, and wyverns. Now players only need to right click while sneaking to open the chest. This is also now affected by the emptyHandPickUpAndMount config setting.

Unihorn ostriches also now have passive regeneration like light essence horses.

Fixed title of Unihorned Ostrich achievement.

Updated various achievement descriptions.
  • Loading branch information
Rozmir-Rohi committed Jan 9, 2025
1 parent 2385fd4 commit af0bbb2
Show file tree
Hide file tree
Showing 6 changed files with 137 additions and 103 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -516,7 +516,6 @@ public boolean interact(EntityPlayer entityPlayer)
if (getStorage() == 0 )
{
setStorage((byte) 1);
entityPlayer.inventory.addItemStackToInventory(new ItemStack(MoCreatures.key));
entityPlayer.addStat(MoCAchievements.elephant_chest, 1);
return true;
}
Expand Down Expand Up @@ -615,13 +614,6 @@ public boolean interact(EntityPlayer entityPlayer)
}
}



if (item == MoCreatures.key && getStorage() > 0)
{
if (tryToOpenElephantChest(entityPlayer)) {return true;};

}
if (getTusks() > 0 && (item == Items.shears))
{
MoCTools.playCustomSound(this, "armoroff", worldObj);
Expand All @@ -635,21 +627,28 @@ public boolean interact(EntityPlayer entityPlayer)
|| !(MoCreatures.proxy.emptyHandMountAndPickUpOnly)
)
{
if (
if (entityPlayer.isSneaking() && getStorage() > 0)
{
if (tryToOpenElephantChest(entityPlayer)) {return true;};

}

else if
(
sitCounter != 0
&& getIsTamed()
&& getIsAdult()
&& riddenByEntity == null
&& getArmorType() >= 1 //wearing elephant harness
)
{
entityPlayer.rotationYaw = rotationYaw;
entityPlayer.rotationPitch = rotationPitch;
sitCounter = 0;
entityPlayer.mountEntity(this);
entityPlayer.addStat(MoCAchievements.mount_elephant, 1);
return true;
}
{
entityPlayer.rotationYaw = rotationYaw;
entityPlayer.rotationPitch = rotationPitch;
sitCounter = 0;
entityPlayer.mountEntity(this);
entityPlayer.addStat(MoCAchievements.mount_elephant, 1);
return true;
}
}

return false;
Expand Down
56 changes: 29 additions & 27 deletions src/main/java/drzhark/mocreatures/entity/animal/MoCEntityHorse.java
Original file line number Diff line number Diff line change
Expand Up @@ -1421,22 +1421,6 @@ public boolean interact(EntityPlayer entityPlayer)
{
if (interactIfItemstackIsAmulet(entityPlayer, horseType, item)) {return true;};

if ((item == MoCreatures.key) && getIsChestedHorse())
{
// if first time opening horse chest, we must initialize it
if (localHorseChest == null)
{
localHorseChest = new MoCAnimalChest(StatCollector.translateToLocal("container.MoCreatures.HorseChest"), getInventorySize());// , new
}
// only open this chest on server side
if (!worldObj.isRemote)
{
entityPlayer.displayGUIChest(localHorseChest);
}
return true;

}

if (interactIfItemstackIsHorseArmor(entityPlayer, itemStack, item)) {return true;};

if (interactIfItemstackIsEssenceOfDarkness(entityPlayer, horseType, itemStack, owner, item)) {return true;};
Expand All @@ -1455,7 +1439,6 @@ public boolean interact(EntityPlayer entityPlayer)
entityPlayer.inventory.setInventorySlotContents(entityPlayer.inventory.currentItem, null);
}

entityPlayer.inventory.addItemStackToInventory(new ItemStack(MoCreatures.key));
setChestedHorse(true);
return true;
}
Expand All @@ -1471,16 +1454,35 @@ public boolean interact(EntityPlayer entityPlayer)
(MoCreatures.proxy.emptyHandMountAndPickUpOnly && itemStack == null)
|| !(MoCreatures.proxy.emptyHandMountAndPickUpOnly)
)
&& !(entityPlayer.isSneaking()) && getIsRideable() && getIsAdult() && (riddenByEntity == null)
&& !(isFlyer() && entityPlayer.riddenByEntity != null) //stops players from riding a flying horse with a creature picked up or on their head. This fixes the flying speed glitch.
)
{
entityPlayer.rotationYaw = rotationYaw;
entityPlayer.rotationPitch = rotationPitch;
setEating(false);
if (MoCreatures.isServer()) {entityPlayer.mountEntity(this);}
gestationTime = 0;
return true;
)
{
if (entityPlayer.isSneaking() && getIsChestedHorse())
{
// if first time opening horse chest, we must initialize it
if (localHorseChest == null)
{
localHorseChest = new MoCAnimalChest(StatCollector.translateToLocal("container.MoCreatures.HorseChest"), getInventorySize());// , new
}
// only open this chest on server side
if (!worldObj.isRemote)
{
entityPlayer.displayGUIChest(localHorseChest);
}
return true;
}
else if
(
!(entityPlayer.isSneaking()) && getIsRideable() && getIsAdult() && (riddenByEntity == null)
&& !(isFlyer() && entityPlayer.riddenByEntity != null) //stops players from riding a flying horse with a creature picked up or on their head. This fixes the flying speed glitch.
)
{
entityPlayer.rotationYaw = rotationYaw;
entityPlayer.rotationPitch = rotationPitch;
setEating(false);
if (MoCreatures.isServer()) {entityPlayer.mountEntity(this);}
gestationTime = 0;
return true;
}
}

return false;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -518,6 +518,15 @@ public void onLivingUpdate()
{
super.onLivingUpdate();

if (
getType() == 8 //unihorn ostrich
&& (getHealth() < getMaxHealth())
&& rand.nextInt(100) == 0
)
{
heal(1);
}

if (getIsTamed() && MoCreatures.isServer() && (rand.nextInt(300) == 0) && (getHealth() <= getMaxHealth()) && (deathTime == 0))
{
setHealth(getHealth() + 1);
Expand Down Expand Up @@ -736,26 +745,10 @@ public boolean interact(EntityPlayer entityPlayer)
entityPlayer.inventory.setInventorySlotContents(entityPlayer.inventory.currentItem, null);
}

entityPlayer.inventory.addItemStackToInventory(new ItemStack(MoCreatures.key));
setIsChested(true);
entityPlayer.addStat(MoCAchievements.ostrich_chest, 1);
return true;
}

if ((item == MoCreatures.key) && getIsChested())
{
// if first time opening horse chest, we must initialize it
if (localChest == null)
{
localChest = new MoCAnimalChest(StatCollector.translateToLocal("container.MoCreatures.OstrichChest"), 9);
}
// only open this chest on server side
if (MoCreatures.isServer())
{
entityPlayer.displayGUIChest(localChest);
}
return true;
}

if (interactIfPlayerIsHoldingWearableHelmet(entityPlayer, item)) {return true;};
}
Expand All @@ -778,18 +771,41 @@ else if (getType() == 2 && item == Items.melon_seeds) //breeding item
(MoCreatures.proxy.emptyHandMountAndPickUpOnly && itemStack == null)
|| (!(MoCreatures.proxy.emptyHandMountAndPickUpOnly))
)
&& !(entityPlayer.isSneaking()) && getIsRideable() && getIsAdult() && (riddenByEntity == null)
)
{
entityPlayer.rotationYaw = rotationYaw;
entityPlayer.rotationPitch = rotationPitch;
setHiding(false);

if (!worldObj.isRemote && (riddenByEntity == null || riddenByEntity == entityPlayer))
{
entityPlayer.mountEntity(this);
}
return true;
if (entityPlayer.isSneaking() && getIsChested())
{
// if first time opening horse chest, we must initialize it
if (localChest == null)
{
localChest = new MoCAnimalChest(StatCollector.translateToLocal("container.MoCreatures.OstrichChest"), 9);
}
// only open this chest on server side
if (MoCreatures.isServer())
{
entityPlayer.displayGUIChest(localChest);
}
return true;
}

else if
(
!(entityPlayer.isSneaking())
&& getIsRideable()
&& getIsAdult()
&& (riddenByEntity == null)
)
{
entityPlayer.rotationYaw = rotationYaw;
entityPlayer.rotationPitch = rotationPitch;
setHiding(false);

if (!worldObj.isRemote && (riddenByEntity == null || riddenByEntity == entityPlayer))
{
entityPlayer.mountEntity(this);
}
return true;
}
}
return false;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -405,27 +405,11 @@ public boolean interact(EntityPlayer entityPlayer)
entityPlayer.inventory.setInventorySlotContents(entityPlayer.inventory.currentItem, null);
}

entityPlayer.inventory.addItemStackToInventory(new ItemStack(MoCreatures.key));
setIsChested(true);
playSound("mob.chicken.plop", 1.0F, ((rand.nextFloat() - rand.nextFloat()) * 0.2F) + 1.0F);
return true;
}

if ((item == MoCreatures.key) && getIsChested())
{
// if first time opening horse chest, we must initialize it
if (localchest == null)
{
localchest = new MoCAnimalChest(StatCollector.translateToLocal("container.MoCreatures.WyvernChest"), 14);//
}
// only open this chest on server side
if (MoCreatures.isServer())
{
entityPlayer.displayGUIChest(localchest);
}
return true;
}

if ((item == MoCreatures.essenceLight) && getMoCAge() > 90 && getType() < 5) // wyvern types below 5: Jungle, Swamp, Savanna, Sand
{
if (--itemStack.stackSize == 0)
Expand Down Expand Up @@ -516,11 +500,32 @@ public boolean interact(EntityPlayer entityPlayer)
(MoCreatures.proxy.emptyHandMountAndPickUpOnly && itemStack == null)
|| (!(MoCreatures.proxy.emptyHandMountAndPickUpOnly))
)
&& !(entityPlayer.isSneaking()) && getIsRideable() && getMoCAge() > 90 && (riddenByEntity == null)
&& entityPlayer.riddenByEntity == null //stops players from riding a wyvern with a creature picked up or on their head. This fixes the flying speed glitch.
)
{
if (MoCreatures.isServer())
if (entityPlayer.isSneaking() && getIsChested())
{
// if first time opening horse chest, we must initialize it
if (localchest == null)
{
localchest = new MoCAnimalChest(StatCollector.translateToLocal("container.MoCreatures.WyvernChest"), 14);//
}
// only open this chest on server side
if (MoCreatures.isServer())
{
entityPlayer.displayGUIChest(localchest);
}
return true;
}

else if
(
!(entityPlayer.isSneaking())
&& getIsRideable()
&& getMoCAge() > 90
&& (riddenByEntity == null)
&& entityPlayer.riddenByEntity == null //stops players from riding a wyvern with a creature picked up or on their head. This fixes the flying speed glitch.
&& MoCreatures.isServer()
)
{
entityPlayer.rotationYaw = rotationYaw;
entityPlayer.rotationPitch = rotationPitch;
Expand Down
14 changes: 13 additions & 1 deletion src/main/resources/Rozmirs modifications to Mo Creatures.txt
Original file line number Diff line number Diff line change
Expand Up @@ -1501,4 +1501,16 @@ Added kitty breeder, dolphin tamer, and goat milker achievements.
Changed icon of ostrich helmet achievement.


Horses that are purely made from essences of light (pegasus, unicorn, and fairy horse) now have slow passive regeneration to make up for them only able to be healed using essences of light which is expensive.
Horses that are purely made from essences of light (pegasus, unicorn, and fairy horse) now have slow passive regeneration to make up for them only able to be healed using essences of light which is expensive.


Removed the requirement of needing to use a key to open chests on elephants, horses, ostrich, and wyverns. Now players only need to right click while sneaking to open the chest. This is also now affected by the emptyHandPickUpAndMount config setting.


Unihorn ostriches also now have passive regeneration like light essence horses.


Fixed title of Unihorned Ostrich achievement.


Updated various achievement descriptions.
Loading

0 comments on commit af0bbb2

Please sign in to comment.