Skip to content

Commit

Permalink
Added feeding items for Jellyfish and Crab
Browse files Browse the repository at this point in the history
  • Loading branch information
Rozmir-Rohi committed Jan 27, 2025
1 parent adfea1b commit ad6b9fc
Show file tree
Hide file tree
Showing 6 changed files with 112 additions and 17 deletions.
12 changes: 12 additions & 0 deletions src/main/java/drzhark/mocreatures/MoCTools.java
Original file line number Diff line number Diff line change
Expand Up @@ -2087,4 +2087,16 @@ public static boolean isEntityRidingUndeadMoCreature(EntityLivingBase entityLivi
&& (entityLivingBase.getLastAttacker() != entityThatIsBeingTargetted) //don't be passive to the player if the undead mob has been hit by them
);
}

public static boolean isItemPlantMegaPackEdibleSaltWaterPlant(Item item)
{
return (
(Item.itemRegistry).getNameForObject(item).equals("plantmegapack:oceanCommonEelgrass")
|| (Item.itemRegistry).getNameForObject(item).equals("plantmegapack:waterKelpGiantGRN")
|| (Item.itemRegistry).getNameForObject(item).equals("plantmegapack:waterKelpGiantYEL")
|| (Item.itemRegistry).getNameForObject(item).equals("plantmegapack:oceanMozuku")
|| (Item.itemRegistry).getNameForObject(item).equals("plantmegapack:oceanSeaGrapes")
|| (Item.itemRegistry).getNameForObject(item).equals("plantmegapack:oceanSeaLettuce")
);
}
}
Original file line number Diff line number Diff line change
@@ -1,14 +1,21 @@
package drzhark.mocreatures.entity.ambient;


import java.util.List;

import cpw.mods.fml.common.network.NetworkRegistry.TargetPoint;
import drzhark.mocreatures.MoCTools;
import drzhark.mocreatures.MoCreatures;
import drzhark.mocreatures.entity.MoCEntityTameableAmbient;
import drzhark.mocreatures.network.MoCMessageHandler;
import drzhark.mocreatures.network.message.MoCMessageAnimation;
import net.minecraft.entity.EnumCreatureAttribute;
import net.minecraft.entity.SharedMonsterAttributes;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.init.Items;
import net.minecraft.item.Item;
import net.minecraft.item.ItemSeeds;
import net.minecraft.item.ItemStack;
import net.minecraft.util.ResourceLocation;
import net.minecraft.world.World;

Expand Down Expand Up @@ -44,6 +51,55 @@ public void selectType()
}

}

@Override
public boolean interact(EntityPlayer entityPlayer)
{
ItemStack itemStack = entityPlayer.getHeldItem();

if (itemStack != null)
{
Item item = itemStack.getItem();

List<String> oreDictionaryNameArray = MoCTools.getOreDictionaryEntries(itemStack);

if (
(item instanceof ItemSeeds) //any vanilla mc raw fish except a pufferfish
|| (Item.itemRegistry).getNameForObject(item).equals("etfuturum:beetroot_seeds")
|| (Item.itemRegistry).getNameForObject(item).equals("etfuturum:kelp")
|| (Item.itemRegistry).getNameForObject(item).equals("BiomesOPlenty:turnipSeeds")
|| (Item.itemRegistry).getNameForObject(item).equals("BiomesOPlenty:coral1") && itemStack.getItemDamage() == 11 //BOP kelp
|| (Item.itemRegistry).getNameForObject(item).equals("harvestcraft:seaweedItem")
|| MoCTools.isItemPlantMegaPackEdibleSaltWaterPlant(item)
|| (
oreDictionaryNameArray.size() > 0
&& (
oreDictionaryNameArray.contains("cropKelp")
|| oreDictionaryNameArray.contains("cropSeaweed")
|| (
MoCreatures.isGregTech6Loaded
&& (
oreDictionaryNameArray.contains("listAllseed")
|| oreDictionaryNameArray.contains("foodRaisins")
)
)
)
)
)
{
if (--itemStack.stackSize == 0)
{
entityPlayer.inventory.setInventorySlotContents(entityPlayer.inventory.currentItem, null);
}

heal(5);

return true;
}
}

return super.interact(entityPlayer);
}

@Override
public ResourceLocation getTexture()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -219,20 +219,6 @@ public void onLivingUpdate()

}


public static boolean isItemPlantMegaPackFishEdibleSaltWaterPlant(Item item)
{
return (
(Item.itemRegistry).getNameForObject(item).equals("plantmegapack:oceanCommonEelgrass")
|| (Item.itemRegistry).getNameForObject(item).equals("plantmegapack:waterKelpGiantGRN")
|| (Item.itemRegistry).getNameForObject(item).equals("plantmegapack:waterKelpGiantYEL")
|| (Item.itemRegistry).getNameForObject(item).equals("plantmegapack:oceanMozuku")
|| (Item.itemRegistry).getNameForObject(item).equals("plantmegapack:oceanSeaGrapes")
|| (Item.itemRegistry).getNameForObject(item).equals("plantmegapack:oceanSeaLettuce")
);
}


@Override
protected boolean isMyHealFood(ItemStack itemStack)
{
Expand All @@ -249,7 +235,7 @@ protected boolean isMyHealFood(ItemStack itemStack)
|| (Item.itemRegistry).getNameForObject(item).equals("BiomesOPlenty:turnipSeeds")
|| (Item.itemRegistry).getNameForObject(item).equals("BiomesOPlenty:coral1") && itemStack.getItemDamage() == 11 //BOP kelp
|| (Item.itemRegistry).getNameForObject(item).equals("harvestcraft:seaweedItem")
|| isItemPlantMegaPackFishEdibleSaltWaterPlant(item)
|| MoCTools.isItemPlantMegaPackEdibleSaltWaterPlant(item)
|| (
oreDictionaryNameArray.size() > 0
&& (
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
package drzhark.mocreatures.entity.aquatic;

import java.util.List;

import drzhark.mocreatures.MoCTools;
import drzhark.mocreatures.MoCreatures;
import drzhark.mocreatures.entity.MoCEntityTameableAquatic;
Expand All @@ -11,10 +13,13 @@
import net.minecraft.entity.item.EntityBoat;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.init.Items;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.potion.Potion;
import net.minecraft.potion.PotionEffect;
import net.minecraft.util.ResourceLocation;
import net.minecraft.world.World;
import net.minecraftforge.oredict.OreDictionary;

public class MoCEntityJellyFish extends MoCEntityTameableAquatic {
public float pulsingSize;
Expand Down Expand Up @@ -66,6 +71,36 @@ public float getMoveSpeed()
{
return 0.1F;
}

@Override
public boolean interact(EntityPlayer entityPlayer)
{
ItemStack itemStack = entityPlayer.getHeldItem();

if (itemStack != null)
{
Item item = itemStack.getItem();

List<String> oreDictionaryNameArray = MoCTools.getOreDictionaryEntries(itemStack);

if (
(item == Items.fish && itemStack.getItemDamage() != 3) //any vanilla mc raw fish except a pufferfish
|| oreDictionaryNameArray.contains("listAllfishraw")
)
{
if (--itemStack.stackSize == 0)
{
entityPlayer.inventory.setInventorySlotContents(entityPlayer.inventory.currentItem, null);
}

heal(5);

return true;
}
}

return super.interact(entityPlayer);
}

@Override
public ResourceLocation getTexture()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@ protected boolean isMyHealFood(ItemStack itemStack)
|| (
getType() == 5 && //Mandarin fish can eat saltwater plants
(
MoCEntityFishy.isItemPlantMegaPackFishEdibleSaltWaterPlant(item)
MoCTools.isItemPlantMegaPackEdibleSaltWaterPlant(item)
|| (Item.itemRegistry).getNameForObject(item).equals("BiomesOPlenty:coral1") && itemStack.getItemDamage() == 11 //BOP kelp
|| (Item.itemRegistry).getNameForObject(item).equals("etfuturum:kelp")
|| (Item.itemRegistry).getNameForObject(item).equals("harvestcraft:seaweedItem")
Expand Down
8 changes: 7 additions & 1 deletion src/main/resources/Rozmirs modifications to Mo Creatures.txt
Original file line number Diff line number Diff line change
Expand Up @@ -1561,4 +1561,10 @@ Fixed wraiths and bat horse vertical path finding.
Added zonkey achievement.


Added a fail-safe for werewolf gold and silver weapon detection. Now werewolves will detect gold and silver swords from any mod.
Added a fail-safe for werewolf gold and silver weapon detection. Now werewolves will detect gold and silver swords from any mod.


Added raw fish as healing item for jellyfish.


Added seeds as healing item for crab. Crabs also now accept seaweed from other mods as healing items.

0 comments on commit ad6b9fc

Please sign in to comment.