Skip to content

Commit

Permalink
feat: add Flesh Cow mob
Browse files Browse the repository at this point in the history
  • Loading branch information
Elenterius committed Jul 28, 2024
1 parent 0a0c074 commit 094e750
Show file tree
Hide file tree
Showing 21 changed files with 924 additions and 326 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,9 @@ public void registerSounds() {
addSimpleSounds(ModSoundEvents.FLESH_BLOB_AMBIENT, 3, 0.8f, 0.9f);
addSimpleSound(ModSoundEvents.FLESH_BLOB_MEW_PURR, 0.7f, 0.45f);
addSimpleSound(ModSoundEvents.FLESH_BLOB_GROWL, 0.9f, 0.55f);
addSimpleRedirect(ModSoundEvents.FLESH_COW_AMBIENT, SoundEvents.COW_AMBIENT, 1f, 0.25f);
addSimpleRedirect(ModSoundEvents.FLESH_COW_HURT, SoundEvents.COW_HURT, 1f, 0.25f);
addSimpleRedirect(ModSoundEvents.FLESH_COW_DEATH, SoundEvents.COW_DEATH, 1f, 0.25f);
}

public String translationKey(RegistryObject<SoundEvent> soundHolder) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -347,6 +347,9 @@ private void addSoundTranslations() {
addSound(ModSoundEvents.FLESH_BLOB_AMBIENT, "Flesh Blob Ambient");
addSound(ModSoundEvents.FLESH_BLOB_GROWL, "Flesh Blob Growls");
addSound(ModSoundEvents.FLESH_BLOB_MEW_PURR, "Flesh Blob Purrs");
addSound(ModSoundEvents.FLESH_COW_AMBIENT, "Flesh Cow moos");
addSound(ModSoundEvents.FLESH_COW_HURT, "Flesh Cow hurts");
addSound(ModSoundEvents.FLESH_COW_DEATH, "Flesh Cow dies");
}

private void addDamageTranslations() {
Expand Down Expand Up @@ -522,6 +525,7 @@ private void addItemTranslations() {
addItem(ModItems.LEGACY_FLESH_BLOB_SPAWN_EGG, "Legacy Flesh Blob Spawn Egg");
addItem(ModItems.PRIMORDIAL_FLESH_BLOB_SPAWN_EGG, "Primordial Flesh Blob Spawn Egg");
addItem(ModItems.PRIMORDIAL_HUNGRY_FLESH_BLOB_SPAWN_EGG, "Primordial Hungry Flesh Blob Spawn Egg");
addItem(ModItems.FLESH_COW_SPAWN_EGG, "Flesh Cow Spawn Egg");
}

private void addBlockTranslations() {
Expand Down Expand Up @@ -638,6 +642,7 @@ private void addEntityTranslations() {
addEntityType(ModEntityTypes.LEGACY_FLESH_BLOB, "Legacy Flesh Blob");
addEntityType(ModEntityTypes.PRIMORDIAL_FLESH_BLOB, "Primordial Flesh Blob");
addEntityType(ModEntityTypes.PRIMORDIAL_HUNGRY_FLESH_BLOB, "Primordial Hungry Flesh Blob");
addEntityType(ModEntityTypes.FLESH_COW, "Flesh Cow");
}

private void addFluidTranslations() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,16 @@
import net.minecraft.data.loot.EntityLootSubProvider;
import net.minecraft.world.entity.EntityType;
import net.minecraft.world.flag.FeatureFlags;
import net.minecraft.world.item.Items;
import net.minecraft.world.level.storage.loot.LootContext;
import net.minecraft.world.level.storage.loot.LootPool;
import net.minecraft.world.level.storage.loot.LootTable;
import net.minecraft.world.level.storage.loot.entries.LootItem;
import net.minecraft.world.level.storage.loot.entries.LootTableReference;
import net.minecraft.world.level.storage.loot.functions.LootingEnchantFunction;
import net.minecraft.world.level.storage.loot.functions.SetItemCountFunction;
import net.minecraft.world.level.storage.loot.functions.SmeltItemFunction;
import net.minecraft.world.level.storage.loot.predicates.LootItemEntityPropertyCondition;
import net.minecraft.world.level.storage.loot.predicates.LootItemKilledByPlayerCondition;
import net.minecraft.world.level.storage.loot.providers.number.ConstantValue;
import net.minecraft.world.level.storage.loot.providers.number.UniformGenerator;
Expand Down Expand Up @@ -42,6 +46,15 @@ private LootTable.Builder fleshBlobLootTable() {
.when(LootItemKilledByPlayerCondition.killedByPlayer()));
}

private LootTable.Builder cowLootTable() {
return LootTable.lootTable()
.withPool(LootPool.lootPool().setRolls(ConstantValue.exactly(1f)).add(LootItem.lootTableItem(Items.BEEF)
.apply(SetItemCountFunction.setCount(UniformGenerator.between(2f, 5f)))
.apply(SmeltItemFunction.smelted().when(LootItemEntityPropertyCondition.hasProperties(LootContext.EntityTarget.THIS, ENTITY_ON_FIRE)))
.apply(LootingEnchantFunction.lootingMultiplier(UniformGenerator.between(0, 1f))))
);
}

private LootTable.Builder noLoot() {
return LootTable.lootTable();
}
Expand All @@ -63,6 +76,7 @@ public void generate() {
add(ModEntityTypes.HUNGRY_FLESH_BLOB.get(), fleshBlobLootTable());
add(ModEntityTypes.PRIMORDIAL_FLESH_BLOB.get(), fleshBlobLootTable());
add(ModEntityTypes.PRIMORDIAL_HUNGRY_FLESH_BLOB.get(), fleshBlobLootTable());
add(ModEntityTypes.FLESH_COW.get(), cowLootTable());
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,8 @@ protected void addTags(HolderLookup.Provider provider) {

createTag(ModEntityTags.FLESHKIN).add(
ModEntityTypes.FLESH_BLOB.get(), ModEntityTypes.HUNGRY_FLESH_BLOB.get(), ModEntityTypes.LEGACY_FLESH_BLOB.get(),
ModEntityTypes.PRIMORDIAL_FLESH_BLOB.get(), ModEntityTypes.PRIMORDIAL_HUNGRY_FLESH_BLOB.get()
ModEntityTypes.PRIMORDIAL_FLESH_BLOB.get(), ModEntityTypes.PRIMORDIAL_HUNGRY_FLESH_BLOB.get(),
ModEntityTypes.FLESH_COW.get()
);
}

Expand Down
5 changes: 5 additions & 0 deletions src/generated/resources/assets/biomancy/lang/en_us.json
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,7 @@
"item.biomancy.legacy_flesh_blob_spawn_egg": "Legacy Flesh Blob Spawn Egg",
"item.biomancy.primordial_flesh_blob_spawn_egg": "Primordial Flesh Blob Spawn Egg",
"item.biomancy.primordial_hungry_flesh_blob_spawn_egg": "Primordial Hungry Flesh Blob Spawn Egg",
"item.biomancy.flesh_cow_spawn_egg": "Flesh Cow Spawn Egg",
"block.biomancy.primordial_cradle": "Primordial Cradle",
"block.biomancy.primordial_cradle.tooltip": "Offer adequate Tributes to the cradle and summon forth primordial messengers of exquisite flesh.",
"block.biomancy.decomposer": "Decomposer",
Expand Down Expand Up @@ -287,6 +288,7 @@
"entity.biomancy.legacy_flesh_blob": "Legacy Flesh Blob",
"entity.biomancy.primordial_flesh_blob": "Primordial Flesh Blob",
"entity.biomancy.primordial_hungry_flesh_blob": "Primordial Hungry Flesh Blob",
"entity.biomancy.flesh_cow": "Flesh Cow",
"enchantment.biomancy.despoil": "Despoil",
"enchantment.biomancy.despoil.desc": "When killing something with a weapon that has this enchantment, they will drop additional special loot.",
"enchantment.biomancy.anesthetic": "Anesthetic Touch",
Expand Down Expand Up @@ -456,6 +458,9 @@
"sounds.biomancy.entity.flesh_blob.ambient": "Flesh Blob Ambient",
"sounds.biomancy.entity.flesh_blob.growl": "Flesh Blob Growls",
"sounds.biomancy.entity.flesh_blob.mew_purr": "Flesh Blob Purrs",
"sounds.biomancy.entity.flesh_cow.ambient": "Flesh Cow moos",
"sounds.biomancy.entity.flesh_cow.hurt": "Flesh Cow hurts",
"sounds.biomancy.entity.flesh_cow.death": "Flesh Cow dies",
"block.minecraft.banner.biomancy.mascot_base.white": "White Mascot Base",
"block.minecraft.banner.biomancy.mascot_base.orange": "Orange Mascot Base",
"block.minecraft.banner.biomancy.mascot_base.magenta": "Magenta Mascot Base",
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"parent": "minecraft:item/template_spawn_egg"
}
30 changes: 30 additions & 0 deletions src/generated/resources/assets/biomancy/sounds.json
Original file line number Diff line number Diff line change
Expand Up @@ -320,6 +320,36 @@
],
"subtitle": "sounds.biomancy.entity.flesh_blob.mew_purr"
},
"entity.flesh_cow.ambient": {
"sounds": [
{
"type": "event",
"name": "entity.cow.ambient",
"pitch": 0.25
}
],
"subtitle": "sounds.biomancy.entity.flesh_cow.ambient"
},
"entity.flesh_cow.death": {
"sounds": [
{
"type": "event",
"name": "entity.cow.death",
"pitch": 0.25
}
],
"subtitle": "sounds.biomancy.entity.flesh_cow.death"
},
"entity.flesh_cow.hurt": {
"sounds": [
{
"type": "event",
"name": "entity.cow.hurt",
"pitch": 0.25
}
],
"subtitle": "sounds.biomancy.entity.flesh_cow.hurt"
},
"flesh_block.break": {
"sounds": [
"biomancy:flesh_block.break1",
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
{
"type": "minecraft:entity",
"pools": [
{
"bonus_rolls": 0.0,
"entries": [
{
"type": "minecraft:item",
"functions": [
{
"add": false,
"count": {
"type": "minecraft:uniform",
"max": 3.0,
"min": 1.0
},
"function": "minecraft:set_count"
},
{
"count": {
"type": "minecraft:uniform",
"max": 1.0,
"min": 0.0
},
"function": "minecraft:looting_enchant"
}
],
"name": "biomancy:mob_sinew",
"weight": 70
},
{
"type": "minecraft:item",
"functions": [
{
"add": false,
"count": {
"type": "minecraft:uniform",
"max": 1.0,
"min": -1.0
},
"function": "minecraft:set_count"
},
{
"count": {
"type": "minecraft:uniform",
"max": 1.0,
"min": 0.0
},
"function": "minecraft:looting_enchant"
}
],
"name": "biomancy:mob_gland",
"weight": 40
}
],
"rolls": 1.0
}
],
"random_sequence": "biomancy:biomancy/despoil/flesh_cow"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
{
"type": "minecraft:entity",
"pools": [
{
"bonus_rolls": 0.0,
"entries": [
{
"type": "minecraft:item",
"functions": [
{
"add": false,
"count": {
"type": "minecraft:uniform",
"max": 4.0,
"min": 2.0
},
"function": "minecraft:set_count"
},
{
"conditions": [
{
"condition": "minecraft:entity_properties",
"entity": "this",
"predicate": {
"flags": {
"is_on_fire": true
}
}
}
],
"function": "minecraft:furnace_smelt"
},
{
"count": {
"type": "minecraft:uniform",
"max": 1.0,
"min": 0.0
},
"function": "minecraft:looting_enchant"
}
],
"name": "minecraft:beef"
}
],
"rolls": 1.0
}
],
"random_sequence": "biomancy:entities/flesh_cow"
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
"biomancy:hungry_flesh_blob",
"biomancy:legacy_flesh_blob",
"biomancy:primordial_flesh_blob",
"biomancy:primordial_hungry_flesh_blob"
"biomancy:primordial_hungry_flesh_blob",
"biomancy:flesh_cow"
]
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
package com.github.elenterius.biomancy.client.render.entity.mob;

import com.github.elenterius.biomancy.BiomancyMod;
import com.github.elenterius.biomancy.entity.mob.FleshCow;
import software.bernie.geckolib.model.DefaultedEntityGeoModel;

public class FleshCowModel<T extends FleshCow> extends DefaultedEntityGeoModel<T> {

public FleshCowModel() {
super(BiomancyMod.createRL("mob/flesh_cow"), true);
}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
package com.github.elenterius.biomancy.client.render.entity.mob;

import com.github.elenterius.biomancy.entity.mob.FleshCow;
import com.mojang.blaze3d.vertex.PoseStack;
import net.minecraft.client.renderer.entity.EntityRendererProvider;
import software.bernie.geckolib.cache.object.BakedGeoModel;
import software.bernie.geckolib.renderer.GeoEntityRenderer;

public class FleshCowRenderer<T extends FleshCow> extends GeoEntityRenderer<T> {

public FleshCowRenderer(EntityRendererProvider.Context context) {
super(context, new FleshCowModel<>());
shadowRadius = 0.7f;
}

@Override
public void scaleModelForRender(float widthScale, float heightScale, PoseStack poseStack, T animatable, BakedGeoModel model, boolean isReRender, float partialTick, int packedLight, int packedOverlay) {
if (animatable.isBaby()) {
widthScale = 0.5f;
heightScale = 0.5f;
}

super.scaleModelForRender(widthScale, heightScale, poseStack, animatable, model, isReRender, partialTick, packedLight, packedOverlay);
}

}
Loading

0 comments on commit 094e750

Please sign in to comment.