-
Notifications
You must be signed in to change notification settings - Fork 101
Cheese slime #528
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Cheese slime #528
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| 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" | ||
| } |
| 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) { | ||||||
| this.shadowRadius = 0.25F * cheeseSlime.getSize(); | ||||||
| super.render(cheeseSlime, f, g, poseStack, multiBufferSource, i); | ||||||
| } | ||||||
|
|
||||||
| @Override | ||||||
| protected void scale(CheeseSlimeEntity cheeseSlime, PoseStack poseStack, float f) { | ||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think the |
||||||
| 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); | ||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
| } | ||||||
|
|
||||||
| @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) { | ||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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. Line 92 in 624d9bd
|
||||
| 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)); | ||||
| } | ||||
| } | ||||
| } | ||||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think
tickDelta,partialTickandpartialTicksare 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.Galacticraft/src/main/java/dev/galacticraft/mod/client/render/entity/BubbleEntityRenderer.java
Line 52 in 624d9bd
Galacticraft/src/main/java/dev/galacticraft/mod/client/render/entity/rocket/RocketEntityRenderer.java
Line 48 in 624d9bd