Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions src/main/generated/assets/galacticraft/lang/en_us.json
Original file line number Diff line number Diff line change
Expand Up @@ -492,6 +492,7 @@
"entity.galacticraft.arch_grey": "Arch Grey",
"entity.galacticraft.bubble": "Bubble",
"entity.galacticraft.buggy": "Buggy",
"entity.galacticraft.cheese_slime": "Cheese Slime",
"entity.galacticraft.comet_cube": "Comet Cube",
"entity.galacticraft.evolved_creeper": "Evolved Creeper",
"entity.galacticraft.evolved_enderman": "Evolved Enderman",
Expand Down Expand Up @@ -568,6 +569,7 @@
"item.galacticraft.carbon_fragments": "Carbon Fragments",
"item.galacticraft.cargo_rocket_schematic": "Cargo Rocket Schematic",
"item.galacticraft.cheese_cracker": "Cracker with Moon Cheese",
"item.galacticraft.cheese_slime_spawn_egg": "Cheese Slime Spawn Egg",
"item.galacticraft.cheeseburger": "Cheeseburger",
"item.galacticraft.comet_cube_spawn_egg": "Comet Cube Spawn Egg",
"item.galacticraft.compressed_aluminum": "Compressed Aluminum",
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"parent": "minecraft:item/template_spawn_egg"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
{
"type": "minecraft:entity",
"pools": [
{
"bonus_rolls": 0.0,
"entries": [
{
"type": "minecraft:item",
"functions": [
{
"add": false,
"count": {
"type": "minecraft:uniform",
"max": 2.0,
"min": 1.0
},
"function": "minecraft:set_count"
},
{
"count": {
"type": "minecraft:uniform",
"max": 1.0,
"min": 0.0
},
"enchantment": "minecraft:looting",
"function": "minecraft:enchanted_count_increase"
}
],
"name": "galacticraft:moon_cheese_curd"
}
],
"rolls": 1.0
}
],
"random_sequence": "galacticraft:entities/cheese_slime"
}
3 changes: 3 additions & 0 deletions src/main/java/dev/galacticraft/mod/Constant.java
Original file line number Diff line number Diff line change
Expand Up @@ -935,6 +935,7 @@ interface Entity {
String GAZER = "gazer";
String FALLING_METEOR = "falling_meteor";
String EVOLVED_SKELETON_BOSS = "evolved_skeleton_boss";
String CHEESE_SLIME = "cheese_slime";
}

interface SpawnEgg {
Expand All @@ -954,6 +955,7 @@ interface SpawnEgg {
String OLI_GRUB = "oli_grub_spawn_egg";
String COMET_CUBE = "comet_cube_spawn_egg";
String GAZER = "gazer_spawn_egg";
String CHEESE_SLIME = "cheese_slime_spawn_egg";
}

interface EntityTexture {
Expand All @@ -968,6 +970,7 @@ interface EntityTexture {
String GAZER = "textures/entity/gazer.png";
String LANDER = "textures/entity/lander.png";
String SKELETON_BOSS = "textures/entity/skeletonboss.png";
String CHEESE_SLIME = "textures/entity/cheese_slime.png";
}

interface GearTexture {
Expand Down
1 change: 1 addition & 0 deletions src/main/java/dev/galacticraft/mod/GalacticraftClient.java
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,7 @@ public void onInitializeClient() {
EntityRendererRegistry.register(GCEntityTypes.PARACHEST, ParachestRenderer::new);
EntityRendererRegistry.register(GCEntityTypes.THROWABLE_METEOR_CHUNK, ThrownItemRenderer::new);
EntityRendererRegistry.register(GCEntityTypes.SKELETON_BOSS, EvolvedSkeletonBossRenderer::new);
EntityRendererRegistry.register(GCEntityTypes.CHEESE_SLIME, CheeseSlimeEntityRenderer::new);

GCBlockEntityRenderer.register();
GCClientPacketReceiver.register();
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
/*
* Copyright (c) 2019-2025 Team Galacticraft
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/

package dev.galacticraft.mod.client.model.entity;

import com.mojang.blaze3d.vertex.PoseStack;
import com.mojang.blaze3d.vertex.VertexConsumer;
import net.minecraft.client.model.HierarchicalModel;
import net.minecraft.client.model.geom.ModelPart;
import net.minecraft.client.model.geom.PartPose;
import net.minecraft.client.model.geom.builders.*;
import net.minecraft.world.entity.Entity;

public class CheeseSlimeEntityModel<T extends Entity> extends HierarchicalModel<T> {
private final ModelPart root;

public CheeseSlimeEntityModel(ModelPart root) {
this.root = root;
}

public static LayerDefinition createOuterBodyLayer() {
MeshDefinition meshDefinition = new MeshDefinition();
PartDefinition partDefinition = meshDefinition.getRoot();
partDefinition.addOrReplaceChild("cube", CubeListBuilder.create().texOffs(0, 0).addBox(-4.0F, 16.0F, -4.0F, 8.0F, 8.0F, 8.0F), PartPose.ZERO);
return LayerDefinition.create(meshDefinition, 64, 32);
}

public static LayerDefinition createInnerBodyLayer() {
MeshDefinition meshDefinition = new MeshDefinition();
PartDefinition partDefinition = meshDefinition.getRoot();
partDefinition.addOrReplaceChild("cube", CubeListBuilder.create().texOffs(0, 16).addBox(-3.0F, 17.0F, -3.0F, 6.0F, 6.0F, 6.0F), PartPose.ZERO);
partDefinition.addOrReplaceChild("right_eye", CubeListBuilder.create().texOffs(32, 0).addBox(-3.25F, 18.0F, -3.5F, 2.0F, 2.0F, 2.0F), PartPose.ZERO);
partDefinition.addOrReplaceChild("left_eye", CubeListBuilder.create().texOffs(32, 4).addBox(1.25F, 18.0F, -3.5F, 2.0F, 2.0F, 2.0F), PartPose.ZERO);
partDefinition.addOrReplaceChild("mouth", CubeListBuilder.create().texOffs(32, 8).addBox(0.0F, 21.0F, -3.5F, 1.0F, 1.0F, 1.0F), PartPose.ZERO);
return LayerDefinition.create(meshDefinition, 64, 32);
}

@Override
public void setupAnim(T entity, float limbSwing, float limbSwingAmount, float ageInTicks, float netHeadYaw, float headPitch) {
}

@Override
public ModelPart root() {
return this.root;
}

@Override
public void renderToBuffer(PoseStack poseStack, VertexConsumer vertices, int light, int overlay, int color) {
this.root.render(poseStack, vertices, light, overlay);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
/*
* Copyright (c) 2019-2025 Team Galacticraft
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/

package dev.galacticraft.mod.client.render.entity;

import com.mojang.blaze3d.vertex.PoseStack;
import dev.galacticraft.mod.Constant;
import dev.galacticraft.mod.client.model.entity.CheeseSlimeEntityModel;
import dev.galacticraft.mod.client.render.entity.feature.CheeseSlimeOuterLayer;
import dev.galacticraft.mod.client.render.entity.model.GCEntityModelLayer;
import dev.galacticraft.mod.content.entity.CheeseSlimeEntity;
import net.minecraft.client.renderer.MultiBufferSource;
import net.minecraft.client.renderer.entity.EntityRendererProvider;
import net.minecraft.client.renderer.entity.MobRenderer;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.util.Mth;

public class CheeseSlimeEntityRenderer extends MobRenderer<CheeseSlimeEntity, CheeseSlimeEntityModel<CheeseSlimeEntity>>{
private static final ResourceLocation TEXTURE = Constant.id(Constant.EntityTexture.CHEESE_SLIME);

public CheeseSlimeEntityRenderer(EntityRendererProvider.Context context) {
super(context, new CheeseSlimeEntityModel<>(context.bakeLayer(GCEntityModelLayer.CHEESE_SLIME)), 0.25f);
this.addLayer(new CheeseSlimeOuterLayer<>(this, context.getModelSet()));
}

@Override
public void render(CheeseSlimeEntity cheeseSlime, float f, float g, PoseStack poseStack, MultiBufferSource multiBufferSource, int i) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think tickDelta, partialTick and partialTicks are used fairly interchangeably (which I might standardise at some point), but any of these should give people reading the code a better idea of what these numbers represent than just single letters.

public void render(BubbleEntity entity, float yaw, float tickDelta, PoseStack matrices, MultiBufferSource vertexConsumers, int light) {

public void render(RocketEntity entity, float yaw, float partialTick, PoseStack matrices, MultiBufferSource vertexConsumers, int light) {

this.shadowRadius = 0.25F * cheeseSlime.getSize();
super.render(cheeseSlime, f, g, poseStack, multiBufferSource, i);
}

@Override
protected void scale(CheeseSlimeEntity cheeseSlime, PoseStack poseStack, float f) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the float f here is also the tickDelta/partialTick/partialTicks.

poseStack.scale(0.999F, 0.999F, 0.999F);
poseStack.translate(0.0F, 0.001F, 0.0F);
float h = cheeseSlime.getSize();
float i = Mth.lerp(f, cheeseSlime.oSquish, cheeseSlime.squish) / (h * 0.5F + 1.0F);
float j = 1.0F / (i + 1.0F);
poseStack.scale(j * h, 1.0F / j * h, j * h);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

h divided by j would be much clearer, if indeed that is what you intended.

Suggested change
poseStack.scale(j * h, 1.0F / j * h, j * h);
poseStack.scale(j * h, h / j, j * h);

}

@Override
public ResourceLocation getTextureLocation(CheeseSlimeEntity entity) {
return TEXTURE;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
/*
* Copyright (c) 2019-2025 Team Galacticraft
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/

package dev.galacticraft.mod.client.render.entity.feature;

import com.mojang.blaze3d.vertex.PoseStack;
import com.mojang.blaze3d.vertex.VertexConsumer;
import dev.galacticraft.mod.client.model.entity.CheeseSlimeEntityModel;
import net.minecraft.client.Minecraft;
import net.minecraft.client.model.EntityModel;
import net.minecraft.client.model.SlimeModel;
import net.minecraft.client.model.geom.EntityModelSet;
import net.minecraft.client.model.geom.ModelLayers;
import net.minecraft.client.renderer.MultiBufferSource;
import net.minecraft.client.renderer.RenderType;
import net.minecraft.client.renderer.entity.LivingEntityRenderer;
import net.minecraft.client.renderer.entity.RenderLayerParent;
import net.minecraft.client.renderer.entity.layers.RenderLayer;
import net.minecraft.world.entity.LivingEntity;

public class CheeseSlimeOuterLayer<T extends LivingEntity> extends RenderLayer<T, CheeseSlimeEntityModel<T>> {
private final EntityModel<T> model;

public CheeseSlimeOuterLayer(RenderLayerParent<T, CheeseSlimeEntityModel<T>> parent, EntityModelSet set) {
super(parent);
this.model = new SlimeModel<>(set.bakeLayer(ModelLayers.SLIME_OUTER));
}

public void render(PoseStack poseStack, MultiBufferSource multiBufferSource, int i, T livingEntity, float f, float g, float h, float j, float k, float l) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is better to use more descriptive names rather than single characters, but I do appreciate that it can be hard to find what variables represent/should be called sometimes.

public void render(PoseStack matrices, MultiBufferSource vertexConsumers, int light, T entity, float limbAngle, float limbDistance, float tickDelta, float animationProgress, float headYaw, float headPitch) {

Minecraft minecraft = Minecraft.getInstance();
boolean bl = minecraft.shouldEntityAppearGlowing(livingEntity) && livingEntity.isInvisible();
if (!livingEntity.isInvisible() || bl) {
VertexConsumer vertexConsumer;
if (bl) {
vertexConsumer = multiBufferSource.getBuffer(RenderType.outline(this.getTextureLocation(livingEntity)));
} else {
vertexConsumer = multiBufferSource.getBuffer(RenderType.entityTranslucent(this.getTextureLocation(livingEntity)));
}

this.getParentModel().copyPropertiesTo(this.model);
this.model.prepareMobModel(livingEntity, f, g, h);
this.model.setupAnim(livingEntity, f, g, j, k, l);
this.model.renderToBuffer(poseStack, vertexConsumer, i, LivingEntityRenderer.getOverlayCoords(livingEntity, 0.0F));
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,8 @@ public class GCEntityModelLayer {
public static final ModelLayerLocation RUMBLER = registerModelLayer("rumbler");
public static final ModelLayerLocation COMET_CUBE = registerModelLayer("comet_cube");
public static final ModelLayerLocation OLI_GRUB = registerModelLayer("oli_grub");
public static final ModelLayerLocation CHEESE_SLIME = registerModelLayer("cheese_slime");
public static final ModelLayerLocation CHEESE_SLIME_OUTER = registerModelLayer("cheese_slime", "outer");
public static final ModelLayerLocation GREY = registerModelLayer("grey");
public static final ModelLayerLocation ARCH_GREY = registerModelLayer("arch_grey");
public static final ModelLayerLocation LANDER = registerModelLayer("lander");
Expand All @@ -50,14 +52,20 @@ public class GCEntityModelLayer {
public static final ModelLayerLocation ROCKET_WORKBENCH = registerModelLayer("rocket_workbench");

private static ModelLayerLocation registerModelLayer(String id) {
return new ModelLayerLocation(Constant.id(id), DEFAULT_LAYER);
return registerModelLayer(id, DEFAULT_LAYER);
}

private static ModelLayerLocation registerModelLayer(String id, String layer) {
return new ModelLayerLocation(Constant.id(id), layer);
}

public static void register() {
EntityModelLayerRegistry.registerModelLayer(GAZER, GazerEntityModel::createBodyLayer);
EntityModelLayerRegistry.registerModelLayer(RUMBLER, RumblerEntityModel::createBodyLayer);
EntityModelLayerRegistry.registerModelLayer(COMET_CUBE, CometCubeEntityModel::createBodyLayer);
EntityModelLayerRegistry.registerModelLayer(OLI_GRUB, OliGrubEntityModel::createBodyLayer);
EntityModelLayerRegistry.registerModelLayer(CHEESE_SLIME, CheeseSlimeEntityModel::createInnerBodyLayer);
EntityModelLayerRegistry.registerModelLayer(CHEESE_SLIME_OUTER, CheeseSlimeEntityModel::createOuterBodyLayer);
EntityModelLayerRegistry.registerModelLayer(GREY, GreyEntityModel::createBodyLayer);
EntityModelLayerRegistry.registerModelLayer(ARCH_GREY, ArchGreyEntityModel::createBodyLayer);
EntityModelLayerRegistry.registerModelLayer(LANDER, LanderModel::createBodyLayer);
Expand Down
5 changes: 5 additions & 0 deletions src/main/java/dev/galacticraft/mod/content/GCEntityTypes.java
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,10 @@ public class GCEntityTypes {
.sized(0.75F, 0.375F)
.clientTrackingRange(8)
.build());
public static final EntityType<CheeseSlimeEntity> CHEESE_SLIME = ENTITIES.register(Entity.CHEESE_SLIME, EntityType.Builder.of(CheeseSlimeEntity::new, MobCategory.MONSTER)
.sized(0.75F, 0.375F)
.clientTrackingRange(8)
.build());
public static final EntityType<GreyEntity> GREY = ENTITIES.register(Entity.GREY, EntityType.Builder.of(GreyEntity::new, MobCategory.CREATURE)
.sized(0.6F, 1.55F)
.eyeHeight(1.25F)
Expand Down Expand Up @@ -196,5 +200,6 @@ public static void register() {
FabricDefaultAttributeRegistry.register(GREY, GreyEntity.createAttributes());
FabricDefaultAttributeRegistry.register(ARCH_GREY, ArchGreyEntity.createAttributes());
FabricDefaultAttributeRegistry.register(SKELETON_BOSS, SkeletonBoss.createAttributes().add(GcApiEntityAttributes.CAN_BREATHE_IN_SPACE, 1.0D));
FabricDefaultAttributeRegistry.register(CHEESE_SLIME, CheeseSlimeEntity.createAttributes());
}
}
Loading