Skip to content

Commit

Permalink
Remove earthslimes and buff terracubes
Browse files Browse the repository at this point in the history
Earthslimes only existed as I was unable to change spawn behavior for vanilla slimes. A new forge feature lets me or in additional spawn options which is now used instead
Earthslimes had one unique feature, spawning with vanilla armor. That ability is now bestowed upon terracubes, which just required minor changes to their renderer. They also jump a bit higher now
  • Loading branch information
KnightMiner committed Mar 17, 2024
1 parent 8d83c97 commit e23b9c8
Show file tree
Hide file tree
Showing 18 changed files with 77 additions and 106 deletions.
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
{
"values": [
"minecraft:slime",
"tconstruct:earth_slime",
"tconstruct:sky_slime",
"tconstruct:ender_slime",
"tconstruct:terracube"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,18 +1,10 @@
{
"type": "forge:add_spawns",
"biomes": "#minecraft:is_overworld",
"spawners": [
{
"type": "tconstruct:earth_slime",
"maxCount": 4,
"minCount": 2,
"weight": 100
},
{
"type": "tconstruct:sky_slime",
"maxCount": 4,
"minCount": 2,
"weight": 100
}
]
"spawners": {
"type": "tconstruct:sky_slime",
"maxCount": 4,
"minCount": 2,
"weight": 100
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,7 @@
"type": "tconstruct:entity_melting",
"damage": 2,
"entity": {
"types": [
"minecraft:slime",
"tconstruct:earth_slime"
]
"type": "minecraft:slime"
},
"result": {
"amount": 25,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,7 @@
{
"type": "tconstruct:severing",
"entity": {
"types": [
"minecraft:slime",
"tconstruct:earth_slime"
]
"type": "minecraft:slime"
},
"result": "minecraft:slime_ball"
}
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
"bounding_box": "full",
"spawns": [
{
"type": "tconstruct:earth_slime",
"type": "minecraft:slime",
"maxCount": 4,
"minCount": 4,
"weight": 1
Expand Down
4 changes: 4 additions & 0 deletions src/main/java/slimeknights/tconstruct/TConstruct.java
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
import net.minecraft.network.chat.Component;
import net.minecraft.network.chat.MutableComponent;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.world.entity.EntityType;
import net.minecraft.world.item.Items;
import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.common.data.ExistingFileHelper;
Expand Down Expand Up @@ -156,8 +158,10 @@ private static void missingMappings(MissingMappingsEvent event) {
case "sky_slime_sling" -> TinkerTools.skyStaff.get();
case "ichor_slime_sling" -> TinkerTools.ichorStaff.get();
case "ender_slime_sling" -> TinkerTools.enderStaff.get();
case "earth_slime_spawn_egg" -> Items.SLIME_SPAWN_EGG;
default -> null;
});
RegistrationHelper.handleMissingMappings(event, MOD_ID, Registry.ENTITY_TYPE_REGISTRY, name -> name.equals("earth_slime") ? EntityType.SLIME : null);
}


Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
package slimeknights.tconstruct.common.data.loot;

import net.minecraft.core.Registry;
import net.minecraft.data.loot.EntityLoot;
import net.minecraft.world.entity.EntityType;
import net.minecraft.world.item.Items;
Expand All @@ -20,17 +19,17 @@
import slimeknights.tconstruct.shared.block.SlimeType;
import slimeknights.tconstruct.world.TinkerWorld;

import java.util.stream.Collectors;
import java.util.Map.Entry;

public class EntityLootTableProvider extends EntityLoot {

@Override
protected Iterable<EntityType<?>> getKnownEntities() {
return ForgeRegistries.ENTITY_TYPES.getValues().stream()
return ForgeRegistries.ENTITY_TYPES.getEntries().stream()
// remove earth slime entity, we redirect to the vanilla loot table
.filter((entity) -> TConstruct.MOD_ID.equals(Registry.ENTITY_TYPE.getKey(entity).getNamespace())
&& entity != TinkerWorld.earthSlimeEntity.get())
.collect(Collectors.toList());
.filter(entry -> TConstruct.MOD_ID.equals(entry.getKey().location().getNamespace()))
.<EntityType<?>>map(Entry::getValue)
.toList();
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ public EntityTypeTagProvider(DataGenerator generatorIn, ExistingFileHelper exist
@Override
public void addTags() {
this.tag(TinkerTags.EntityTypes.SLIMES)
.add(EntityType.SLIME, TinkerWorld.earthSlimeEntity.get(), TinkerWorld.skySlimeEntity.get(), TinkerWorld.enderSlimeEntity.get(), TinkerWorld.terracubeEntity.get());
.add(EntityType.SLIME, TinkerWorld.skySlimeEntity.get(), TinkerWorld.enderSlimeEntity.get(), TinkerWorld.terracubeEntity.get());
this.tag(TinkerTags.EntityTypes.BACON_PRODUCER).add(EntityType.PIG, EntityType.PIGLIN, EntityType.HOGLIN);

this.tag(TinkerTags.EntityTypes.MELTING_SHOW).add(EntityType.IRON_GOLEM, EntityType.SNOW_GOLEM, EntityType.VILLAGER, EntityType.PLAYER);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1934,7 +1934,7 @@ private void addEntityMeltingRecipes(Consumer<FinishedRecipe> consumer) {
.save(consumer, location(headFolder + "skeleton"));

// slimes melt into slime, shocker
EntityMeltingRecipeBuilder.melting(EntityIngredient.of(EntityType.SLIME, TinkerWorld.earthSlimeEntity.get()), new FluidStack(TinkerFluids.earthSlime.get(), FluidValues.SLIMEBALL / 10))
EntityMeltingRecipeBuilder.melting(EntityIngredient.of(EntityType.SLIME), new FluidStack(TinkerFluids.earthSlime.get(), FluidValues.SLIMEBALL / 10))
.save(consumer, location(folder + "slime"));
EntityMeltingRecipeBuilder.melting(EntityIngredient.of(TinkerWorld.skySlimeEntity.get()), new FluidStack(TinkerFluids.skySlime.get(), FluidValues.SLIMEBALL / 10))
.save(consumer, prefix(TinkerWorld.skySlimeEntity, folder));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1696,7 +1696,7 @@ private void addHeadRecipes(Consumer<FinishedRecipe> consumer) {
SeveringRecipeBuilder.severing(EntityIngredient.of(EntityType.BLAZE), ItemOutput.fromStack(new ItemStack(Items.BLAZE_ROD, 2)))
.save(consumer, location(folder + "blaze_rod"));
// desliming (you cut off a chunk of slime)
SeveringRecipeBuilder.severing(EntityIngredient.of(EntityType.SLIME, TinkerWorld.earthSlimeEntity.get()), Items.SLIME_BALL)
SeveringRecipeBuilder.severing(EntityIngredient.of(EntityType.SLIME), Items.SLIME_BALL)
.save(consumer, location(folder + "earthslime_ball"));
SeveringRecipeBuilder.severing(EntityIngredient.of(TinkerWorld.skySlimeEntity.get()), TinkerCommons.slimeball.get(SlimeType.SKY))
.save(consumer, location(folder + "skyslime_ball"));
Expand Down
11 changes: 1 addition & 10 deletions src/main/java/slimeknights/tconstruct/world/TinkerWorld.java
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,6 @@
import slimeknights.tconstruct.world.block.SlimeWartBlock;
import slimeknights.tconstruct.world.block.StickySlimeBlock;
import slimeknights.tconstruct.world.data.WorldRecipeProvider;
import slimeknights.tconstruct.world.entity.EarthSlimeEntity;
import slimeknights.tconstruct.world.entity.EnderSlimeEntity;
import slimeknights.tconstruct.world.entity.SkySlimeEntity;
import slimeknights.tconstruct.world.entity.SlimePlacementPredicate;
Expand Down Expand Up @@ -277,12 +276,6 @@ private static Function<WoodVariant,BlockBehaviour.Properties> createSlimewood(M
* Entities
*/
// our own copy of the slime to make spawning a bit easier
public static final RegistryObject<EntityType<EarthSlimeEntity>> earthSlimeEntity = ENTITIES.registerWithEgg("earth_slime", () ->
EntityType.Builder.of(EarthSlimeEntity::new, MobCategory.MONSTER)
.setShouldReceiveVelocityUpdates(true)
.setTrackingRange(10)
.sized(2.04F, 2.04F)
.setCustomClientFactory((spawnEntity, world) -> TinkerWorld.earthSlimeEntity.get().create(world)), 0x51a03e, 0x7ebf6e);
public static final RegistryObject<EntityType<SkySlimeEntity>> skySlimeEntity = ENTITIES.registerWithEgg("sky_slime", () ->
EntityType.Builder.of(SkySlimeEntity::new, MobCategory.MONSTER)
.setShouldReceiveVelocityUpdates(true)
Expand Down Expand Up @@ -326,7 +319,6 @@ private static Function<WoodVariant,BlockBehaviour.Properties> createSlimewood(M

@SubscribeEvent
void entityAttributes(EntityAttributeCreationEvent event) {
event.put(earthSlimeEntity.get(), Monster.createMonsterAttributes().build());
event.put(skySlimeEntity.get(), Monster.createMonsterAttributes().build());
event.put(enderSlimeEntity.get(), Monster.createMonsterAttributes().build());
event.put(terracubeEntity.get(), Monster.createMonsterAttributes().build());
Expand All @@ -349,8 +341,7 @@ private static void setWoodFireInfo(FireBlock fireBlock, WoodBlockObject wood) {

@SubscribeEvent
void registerSpawnPlacement(SpawnPlacementRegisterEvent event) {
// TODO: seems we can add to vanilla predicates now, can we ditch earth slimes?
event.register(earthSlimeEntity.get(), SpawnPlacements.Type.ON_GROUND, Heightmap.Types.MOTION_BLOCKING_NO_LEAVES, new SlimePlacementPredicate<>(TinkerTags.Blocks.EARTH_SLIME_SPAWN), Operation.OR);
event.register(EntityType.SLIME, null, null, new SlimePlacementPredicate<>(TinkerTags.Blocks.EARTH_SLIME_SPAWN), Operation.OR);
event.register(skySlimeEntity.get(), SpawnPlacements.Type.ON_GROUND, Heightmap.Types.MOTION_BLOCKING_NO_LEAVES, new SlimePlacementPredicate<>(TinkerTags.Blocks.SKY_SLIME_SPAWN), Operation.OR);
event.register(enderSlimeEntity.get(), SpawnPlacements.Type.ON_GROUND, Heightmap.Types.MOTION_BLOCKING_NO_LEAVES, new SlimePlacementPredicate<>(TinkerTags.Blocks.ENDER_SLIME_SPAWN), Operation.OR);
event.register(terracubeEntity.get(), SpawnPlacements.Type.ON_GROUND, Heightmap.Types.MOTION_BLOCKING_NO_LEAVES, TerracubeEntity::canSpawnHere, Operation.OR);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,10 @@
import net.minecraft.resources.ResourceLocation;
import net.minecraft.world.item.Items;
import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.client.event.RegisterColorHandlersEvent;
import net.minecraftforge.client.event.EntityRenderersEvent;
import net.minecraftforge.client.event.RegisterParticleProvidersEvent;
import net.minecraftforge.client.event.RegisterClientReloadListenersEvent;
import net.minecraftforge.client.event.RegisterColorHandlersEvent;
import net.minecraftforge.client.event.RegisterParticleProvidersEvent;
import net.minecraftforge.common.util.Lazy;
import net.minecraftforge.eventbus.api.SubscribeEvent;
import net.minecraftforge.fml.common.Mod.EventBusSubscriber;
Expand Down Expand Up @@ -92,7 +92,6 @@ static void registerSkullModels(EntityRenderersEvent.CreateSkullModels event) {

@SubscribeEvent
static void registerRenderers(EntityRenderersEvent.RegisterRenderers event) {
event.registerEntityRenderer(TinkerWorld.earthSlimeEntity.get(), TinkerSlimeRenderer.EARTH_SLIME_FACTORY);
event.registerEntityRenderer(TinkerWorld.skySlimeEntity.get(), TinkerSlimeRenderer.SKY_SLIME_FACTORY);
event.registerEntityRenderer(TinkerWorld.enderSlimeEntity.get(), TinkerSlimeRenderer.ENDER_SLIME_FACTORY);
event.registerEntityRenderer(TinkerWorld.terracubeEntity.get(), TerracubeRenderer::new);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
import net.minecraft.nbt.NbtUtils;
import net.minecraft.nbt.Tag;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.util.Mth;
import net.minecraft.world.entity.Entity;
import net.minecraft.world.entity.EquipmentSlot;
import net.minecraft.world.entity.monster.Slime;
Expand All @@ -42,18 +43,28 @@
public class SlimeArmorLayer<T extends Slime, M extends HierarchicalModel<T>, A extends HumanoidModel<T>> extends RenderLayer<T,M> {
private final A armorModel;
public final Map<Type,SkullModelBase> skullModels;
public SlimeArmorLayer(RenderLayerParent<T,M> pRenderer, A armorModel, EntityModelSet modelSet) {
private final boolean lavaSlime;
public SlimeArmorLayer(RenderLayerParent<T,M> pRenderer, A armorModel, EntityModelSet modelSet, boolean lavaSlime) {
super(pRenderer);
this.armorModel = armorModel;
this.skullModels = SkullBlockRenderer.createSkullRenderers(modelSet);
this.lavaSlime = lavaSlime;
}

@Override
public void render(PoseStack matrices, MultiBufferSource buffer, int packedLight, T entity, float pLimbSwing, float swing, float partialTicks, float age, float headYaw, float headPitch) {
ItemStack helmet = entity.getItemBySlot(EquipmentSlot.HEAD);
if (!helmet.isEmpty()) {
matrices.pushPose();
matrices.translate(0, 1.5, 0);
if (lavaSlime) {
float squish = Mth.lerp(partialTicks, entity.oSquish, entity.squish);
if (squish < 0) {
squish = 0;
}
matrices.translate(0, 1.5 - 0.425 * squish, 0);
} else {
matrices.translate(0, 1.5, 0);
}
matrices.scale(0.9f, 0.9f, 0.9f);

Item item = helmet.getItem();
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package slimeknights.tconstruct.world.client;

import com.mojang.blaze3d.vertex.PoseStack;
import net.minecraft.client.model.HumanoidModel;
import net.minecraft.client.model.LavaSlimeModel;
import net.minecraft.client.model.geom.ModelLayers;
import net.minecraft.client.renderer.entity.EntityRendererProvider;
Expand All @@ -14,6 +15,7 @@ public class TerracubeRenderer extends MobRenderer<Slime,LavaSlimeModel<Slime>>
private static final ResourceLocation TEXTURE = TConstruct.getResource("textures/entity/terracube.png");
public TerracubeRenderer(EntityRendererProvider.Context context) {
super(context, new LavaSlimeModel<>(context.bakeLayer(ModelLayers.MAGMA_CUBE)), 0.25F);
addLayer(new SlimeArmorLayer<>(this, new HumanoidModel<>(context.bakeLayer(ModelLayers.PLAYER_OUTER_ARMOR)), context.getModelSet(), true));
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,14 @@
import slimeknights.tconstruct.TConstruct;

public class TinkerSlimeRenderer extends SlimeRenderer {
public static final Factory EARTH_SLIME_FACTORY = new Factory(new ResourceLocation("textures/entity/slime/slime.png"));
public static final Factory SKY_SLIME_FACTORY = new Factory(TConstruct.getResource("textures/entity/sky_slime.png"));
public static final Factory ENDER_SLIME_FACTORY = new Factory(TConstruct.getResource("textures/entity/ender_slime.png"));

private final ResourceLocation texture;
public TinkerSlimeRenderer(EntityRendererProvider.Context context, ResourceLocation texture) {
super(context);
this.texture = texture;
addLayer(new SlimeArmorLayer<>(this, new HumanoidModel<>(context.bakeLayer(ModelLayers.PLAYER_OUTER_ARMOR)), context.getModelSet()));
addLayer(new SlimeArmorLayer<>(this, new HumanoidModel<>(context.bakeLayer(ModelLayers.PLAYER_OUTER_ARMOR)), context.getModelSet(), false));
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ public void run(CachedOutput cache) throws IOException {
.addDefaultTemplates(getResource("islands/earth/"))
.addTree(reference(earthSlimeIslandTree), 1)
.addSlimyGrass(SlimeType.EARTH)
.build(new StructureSettings(tag(TinkerTags.Biomes.EARTHSLIME_ISLANDS), monsterOverride(TinkerWorld.earthSlimeEntity.get(), 4, 4), Decoration.SURFACE_STRUCTURES, TerrainAdjustment.NONE)));
.build(new StructureSettings(tag(TinkerTags.Biomes.EARTHSLIME_ISLANDS), monsterOverride(EntityType.SLIME, 4, 4), Decoration.SURFACE_STRUCTURES, TerrainAdjustment.NONE)));
// skyslime island
structures.put(skySlimeIsland, IslandStructure.skyBuilder()
.addDefaultTemplates(getResource("islands/sky/"))
Expand Down Expand Up @@ -138,7 +138,7 @@ public void run(CachedOutput cache) throws IOException {
biomeModifiers.put("ichor_geode", new AddFeaturesBiomeModifier(nether, direct(reference(TinkerWorld.placedIchorGeode)), Decoration.LOCAL_MODIFICATIONS));
biomeModifiers.put("ender_geode", new AddFeaturesBiomeModifier(and(end, not(Registry.BIOME_REGISTRY, direct(reference(Biomes.THE_END)))), direct(reference(TinkerWorld.placedEnderGeode)), Decoration.LOCAL_MODIFICATIONS));
// spawns
biomeModifiers.put("spawn_overworld_slime", new AddSpawnsBiomeModifier(overworld, List.of(new SpawnerData(TinkerWorld.earthSlimeEntity.get(), 100, 2, 4), new SpawnerData(TinkerWorld.skySlimeEntity.get(), 100, 2, 4))));
biomeModifiers.put("spawn_overworld_slime", new AddSpawnsBiomeModifier(overworld, List.of(new SpawnerData(TinkerWorld.skySlimeEntity.get(), 100, 2, 4))));
biomeModifiers.put("spawn_end_slime", new AddSpawnsBiomeModifier(end, List.of(new SpawnerData(TinkerWorld.enderSlimeEntity.get(), 10, 2, 4))));

// run final loading
Expand Down

This file was deleted.

0 comments on commit e23b9c8

Please sign in to comment.