Skip to content

Commit

Permalink
feat: replace Malignant Flesh Blob with Primordial Flesh Blob variants
Browse files Browse the repository at this point in the history
Reworks flesh blob entities and adds a separate entity for the legacy flesh blob easter egg
  • Loading branch information
Elenterius committed Aug 14, 2023
1 parent 2f2209b commit 9399a51
Show file tree
Hide file tree
Showing 41 changed files with 1,246 additions and 959 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -422,7 +422,9 @@ private void addItemTranslations() {

addItem(ModItems.HUNGRY_FLESH_BLOB_SPAWN_EGG, "Hungry Flesh Blob Spawn Egg");
addItem(ModItems.FLESH_BLOB_SPAWN_EGG, "Flesh Blob Spawn Egg");
addItem(ModItems.MALIGNANT_FLESH_BLOB_SPAWN_EGG, "Malignant Flesh Blob Spawn Egg");
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");
}

private void addBlockTranslations() {
Expand Down Expand Up @@ -495,7 +497,9 @@ private void addBlockTranslations() {
private void addEntityTranslations() {
addEntityType(ModEntityTypes.HUNGRY_FLESH_BLOB, "Hungry Flesh Blob");
addEntityType(ModEntityTypes.FLESH_BLOB, "Flesh Blob");
addEntityType(ModEntityTypes.MALIGNANT_FLESH_BLOB, "Malignant Flesh Blob");
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");
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -38,13 +38,23 @@ private static LootTable.Builder fleshBlobLootTable() {
.when(LootItemKilledByPlayerCondition.killedByPlayer()));
}

private static LootTable.Builder primordialFleshBlobLootTable() {
return LootTable.lootTable()
.withPool(LootPool.lootPool().setRolls(ConstantValue.exactly(1)).add(LootItem.lootTableItem(ModItems.CREATOR_MIX.get())
.apply(SetItemCountFunction.setCount(ConstantValue.exactly(1))).apply(LootingEnchantFunction.lootingMultiplier(UniformGenerator.between(0f, 1f)))))
.withPool(LootPool.lootPool().setRolls(ConstantValue.exactly(1))
.add(LootItem.lootTableItem(ModItems.CREATOR_MIX.get()).apply(SetItemCountFunction.setCount(UniformGenerator.between(-4f, 1f))).apply(LootingEnchantFunction.lootingMultiplier(UniformGenerator.between(0f, 1f))))
.when(LootItemKilledByPlayerCondition.killedByPlayer()));
}

private static LootTable.Builder noLoot() {
return LootTable.lootTable();
}

@Override
protected void addTables() {
add(ModEntityTypes.FLESH_BLOB.get(), fleshBlobLootTable());
add(ModEntityTypes.LEGACY_FLESH_BLOB.get(), fleshBlobLootTable());
add(ModEntityTypes.HUNGRY_FLESH_BLOB.get(), fleshBlobLootTable());
add(ModLoot.Entity.FLESH_BLOB_SIZE_2, fleshBlobLootTableBuilderWithDrop(1));
add(ModLoot.Entity.FLESH_BLOB_SIZE_3, fleshBlobLootTableBuilderWithDrop(2));
Expand All @@ -56,7 +66,8 @@ protected void addTables() {
add(ModLoot.Entity.FLESH_BLOB_SIZE_9, fleshBlobLootTableBuilderWithDrop(8));
add(ModLoot.Entity.FLESH_BLOB_SIZE_10, fleshBlobLootTableBuilderWithDrop(9));

add(ModEntityTypes.MALIGNANT_FLESH_BLOB.get(), noLoot());
add(ModEntityTypes.PRIMORDIAL_FLESH_BLOB.get(), primordialFleshBlobLootTable());
add(ModEntityTypes.PRIMORDIAL_HUNGRY_FLESH_BLOB.get(), primordialFleshBlobLootTable());

// add(ModEntityTypes.BOOMLING.get(), LootTable.lootTable()); //no item drops

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -97,8 +97,10 @@ protected void addTags() {
.add(EntityType.IRON_GOLEM, EntityType.SNOW_GOLEM)
.addOptional("strawgolem:strawgolem", "strawgolem:strawnggolem");

createTag(ModEntityTags.FLESHKIN)
.add(ModEntityTypes.FLESH_BLOB.get(), ModEntityTypes.HUNGRY_FLESH_BLOB.get(), ModEntityTypes.MALIGNANT_FLESH_BLOB.get());
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()
);

addSpecialMobLootTags();
}
Expand Down
8 changes: 6 additions & 2 deletions src/generated/resources/assets/biomancy/lang/en_us.json
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,9 @@
"item.biomancy.mascot_patterns.desc": "Biomancy Mascot",
"item.biomancy.hungry_flesh_blob_spawn_egg": "Hungry Flesh Blob Spawn Egg",
"item.biomancy.flesh_blob_spawn_egg": "Flesh Blob Spawn Egg",
"item.biomancy.malignant_flesh_blob_spawn_egg": "Malignant Flesh Blob Spawn Egg",
"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",
"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 @@ -221,7 +223,9 @@
"block.biomancy.malignant_flesh_veins.tooltip": "They look almost feral... you better not touch them.",
"entity.biomancy.hungry_flesh_blob": "Hungry Flesh Blob",
"entity.biomancy.flesh_blob": "Flesh Blob",
"entity.biomancy.malignant_flesh_blob": "Malignant Flesh Blob",
"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",
"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
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package com.github.elenterius.biomancy.client.render.entity.fleshblob;

import com.github.elenterius.biomancy.entity.fleshblob.AbstractFleshBlob;
import com.github.elenterius.biomancy.entity.fleshblob.FleshBlob;
import com.github.elenterius.biomancy.entity.fleshblob.TumorFlag;
import com.mojang.blaze3d.vertex.PoseStack;
import com.mojang.blaze3d.vertex.VertexConsumer;
Expand All @@ -13,7 +13,7 @@

import javax.annotation.Nullable;

public abstract class AbstractFleshBlobRenderer<T extends AbstractFleshBlob> extends GeoEntityRenderer<T> {
public abstract class AbstractFleshBlobRenderer<T extends FleshBlob> extends GeoEntityRenderer<T> {

protected AbstractFleshBlobRenderer(EntityRendererProvider.Context context, AnimatedGeoModel<T> modelProvider) {
super(context, modelProvider);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,21 +1,22 @@
package com.github.elenterius.biomancy.client.render.entity.fleshblob;

import com.github.elenterius.biomancy.BiomancyMod;
import com.github.elenterius.biomancy.entity.fleshblob.FleshBlob;
import com.github.elenterius.biomancy.entity.fleshblob.HungryFleshBlob;
import com.github.elenterius.biomancy.entity.fleshblob.AdulteratedHangryEaterFleshBlob;
import com.github.elenterius.biomancy.entity.fleshblob.EaterFleshBlob;
import net.minecraft.resources.ResourceLocation;
import software.bernie.geckolib3.model.AnimatedGeoModel;

import java.util.Locale;

public class FleshBlobModel<T extends FleshBlob> extends AnimatedGeoModel<T> {
public class FleshBlobModel<T extends EaterFleshBlob> extends AnimatedGeoModel<T> {

protected static final ResourceLocation BASE_TEXTURE = BiomancyMod.createRL("textures/entity/flesh_blob/flesh_blob_neutral.png");
protected static final ResourceLocation HUNGRY_TEXTURE = BiomancyMod.createRL("textures/entity/flesh_blob/flesh_blob_hostile.png");
protected static final ResourceLocation LEGACY_TEXTURE = BiomancyMod.createRL("textures/entity/flesh_blob/flesh_blob_legacy.png");
protected static final ResourceLocation CLOWN_TEXTURE = BiomancyMod.createRL("textures/entity/flesh_blob/flesh_blob_clown.png");
protected static final ResourceLocation TROLL_TEXTURE = BiomancyMod.createRL("textures/entity/flesh_blob/flesh_blob_troll.png");
protected static final ResourceLocation WATCHER_TEXTURE = BiomancyMod.createRL("textures/entity/flesh_blob/flesh_blob_watcher.png");

protected static final ResourceLocation MODEL = BiomancyMod.createRL("geo/entity/flesh_blob.geo.json");
protected static final ResourceLocation ANIMATION = BiomancyMod.createRL("animations/entity/flesh_blob.animation.json");

Expand All @@ -34,7 +35,7 @@ public ResourceLocation getTextureResource(T fleshBlob) {
if (name.contains("beholder") || name.contains("observer")) return WATCHER_TEXTURE;
}

return fleshBlob instanceof HungryFleshBlob ? HUNGRY_TEXTURE : BASE_TEXTURE;
return fleshBlob instanceof AdulteratedHangryEaterFleshBlob ? HUNGRY_TEXTURE : BASE_TEXTURE;
}

@Override
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package com.github.elenterius.biomancy.client.render.entity.fleshblob;

import com.github.elenterius.biomancy.entity.fleshblob.FleshBlob;
import com.github.elenterius.biomancy.entity.fleshblob.EaterFleshBlob;
import com.github.elenterius.biomancy.init.client.ModRenderTypes;
import com.mojang.blaze3d.vertex.PoseStack;
import com.mojang.blaze3d.vertex.VertexConsumer;
Expand All @@ -13,14 +13,14 @@
import javax.annotation.Nullable;
import java.util.Locale;

public class FleshBlobRenderer extends AbstractFleshBlobRenderer<FleshBlob> {
public class FleshBlobRenderer extends AbstractFleshBlobRenderer<EaterFleshBlob> {

public FleshBlobRenderer(EntityRendererProvider.Context context) {
super(context, new FleshBlobModel<>());
}

@Override
public RenderType getRenderType(FleshBlob fleshBlob, float partialTicks, PoseStack stack, @Nullable MultiBufferSource buffer, @Nullable VertexConsumer vertexBuilder, int packedLight, ResourceLocation textureLocation) {
public RenderType getRenderType(EaterFleshBlob fleshBlob, float partialTicks, PoseStack stack, @Nullable MultiBufferSource buffer, @Nullable VertexConsumer vertexBuilder, int packedLight, ResourceLocation textureLocation) {
if (fleshBlob.hasCustomName()) {
Component customName = fleshBlob.getCustomName();
if (customName != null) {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
package com.github.elenterius.biomancy.client.render.entity.fleshblob;

import com.github.elenterius.biomancy.entity.fleshblob.EaterFleshBlob;
import net.minecraft.resources.ResourceLocation;
import software.bernie.geckolib3.model.AnimatedGeoModel;

public class LegacyFleshBlobModel<T extends EaterFleshBlob> extends AnimatedGeoModel<T> {

@Override
public ResourceLocation getModelResource(T fleshBlob) {
return FleshBlobModel.MODEL;
}

@Override
public ResourceLocation getTextureResource(T fleshBlob) {
return FleshBlobModel.LEGACY_TEXTURE;
}

@Override
public ResourceLocation getAnimationResource(T fleshBlob) {
return FleshBlobModel.ANIMATION;
}

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

import com.github.elenterius.biomancy.entity.fleshblob.EaterFleshBlob;
import net.minecraft.client.renderer.entity.EntityRendererProvider;

public class LegacyFleshBlobRenderer<T extends EaterFleshBlob> extends AbstractFleshBlobRenderer<T> {

public LegacyFleshBlobRenderer(EntityRendererProvider.Context context) {
super(context, new LegacyFleshBlobModel<>());
}

}

This file was deleted.

This file was deleted.

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

import com.github.elenterius.biomancy.BiomancyMod;
import com.github.elenterius.biomancy.entity.PrimordialFleshkin;
import com.github.elenterius.biomancy.entity.fleshblob.EaterFleshBlob;
import com.github.elenterius.biomancy.entity.fleshblob.PrimordialHangryEaterFleshBlob;
import net.minecraft.resources.ResourceLocation;
import software.bernie.geckolib3.model.AnimatedGeoModel;

public class PrimordialFleshBlobModel<T extends EaterFleshBlob & PrimordialFleshkin> extends AnimatedGeoModel<T> {

protected static final ResourceLocation BASE_TEXTURE = BiomancyMod.createRL("textures/entity/flesh_blob/primordial_flesh_blob_neutral.png");
protected static final ResourceLocation HUNGRY_TEXTURE = BiomancyMod.createRL("textures/entity/flesh_blob/primordial_flesh_blob_hostile.png");

@Override
public ResourceLocation getModelResource(T fleshBlob) {
return FleshBlobModel.MODEL;
}

@Override
public ResourceLocation getTextureResource(T fleshBlob) {
return fleshBlob instanceof PrimordialHangryEaterFleshBlob ? HUNGRY_TEXTURE : BASE_TEXTURE;
}

@Override
public ResourceLocation getAnimationResource(T fleshBlob) {
return FleshBlobModel.ANIMATION;
}

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

import com.github.elenterius.biomancy.entity.PrimordialFleshkin;
import com.github.elenterius.biomancy.entity.fleshblob.EaterFleshBlob;
import net.minecraft.client.renderer.entity.EntityRendererProvider;

public class PrimordialFleshBlobRenderer<T extends EaterFleshBlob & PrimordialFleshkin> extends AbstractFleshBlobRenderer<T> {

public PrimordialFleshBlobRenderer(EntityRendererProvider.Context context) {
super(context, new PrimordialFleshBlobModel<>());
}

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

public interface AdulteratedFleshkin extends Fleshkin {
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
package com.github.elenterius.biomancy.entity;

public interface Fleshkin {
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
import net.minecraft.world.item.ItemStack;
import org.jetbrains.annotations.Nullable;

public interface IFoodEater {
public interface FoodEater {
void ate(@Nullable FoodProperties food);

boolean isEating();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import net.minecraft.core.BlockPos;
import org.jetbrains.annotations.Nullable;

public interface IJukeboxDancer {
public interface JukeboxDancer {

boolean isDancing();

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
package com.github.elenterius.biomancy.entity;

import com.github.elenterius.biomancy.entity.ai.goal.FindItemGoal;
import com.github.elenterius.biomancy.init.ModItems;
import net.minecraft.world.entity.item.ItemEntity;
import net.minecraft.world.food.FoodProperties;
import net.minecraft.world.item.Item;
import net.minecraft.world.item.ItemStack;
import net.minecraft.world.item.Items;

import java.util.Optional;
import java.util.Set;
import java.util.function.Predicate;

public interface PrimordialCradleUser {

Set<Item> SPECIAL_ITEMS_TO_HOLD = Set.of(ModItems.LIVING_FLESH.get(), ModItems.CREATOR_MIX.get(), Items.ROTTEN_FLESH, Items.SPIDER_EYE);
Predicate<ItemEntity> SPECIAL_ITEM_ENTITY_FILTER = itemEntity -> {
if (!FindItemGoal.ITEM_ENTITY_FILTER.test(itemEntity)) return false;

ItemStack stack = itemEntity.getItem();
if (SPECIAL_ITEMS_TO_HOLD.contains(stack.getItem())) return true;
return stack.isEdible() && Optional.ofNullable(stack.getFoodProperties(null)).map(FoodProperties::isMeat).orElse(false);
};

ItemStack getTributeItemForCradle();

boolean hasTributeForCradle();

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

public interface PrimordialFleshkin extends Fleshkin {
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package com.github.elenterius.biomancy.entity.ai.goal;

import com.github.elenterius.biomancy.entity.IJukeboxDancer;
import com.github.elenterius.biomancy.entity.JukeboxDancer;
import net.minecraft.core.BlockPos;
import net.minecraft.util.Mth;
import net.minecraft.world.entity.PathfinderMob;
Expand All @@ -11,7 +11,7 @@
import java.util.EnumSet;
import java.util.Set;

public class DanceNearJukeboxGoal<T extends PathfinderMob & IJukeboxDancer> extends Goal {
public class DanceNearJukeboxGoal<T extends PathfinderMob & JukeboxDancer> extends Goal {

protected final T mob;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
package com.github.elenterius.biomancy.entity.ai.goal;

import com.github.elenterius.biomancy.entity.IFoodEater;
import com.github.elenterius.biomancy.entity.FoodEater;
import net.minecraft.world.entity.PathfinderMob;
import net.minecraft.world.entity.ai.goal.Goal;
import net.minecraft.world.food.FoodProperties;
import net.minecraft.world.item.ItemStack;

import java.util.EnumSet;

public class EatFoodItemGoal<T extends PathfinderMob & IFoodEater> extends Goal {
public class EatFoodItemGoal<T extends PathfinderMob & FoodEater> extends Goal {

protected static final int EATING_TICKS = 20 * 2 + 4;
private final T mob;
Expand Down

0 comments on commit 9399a51

Please sign in to comment.