-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
574449b
commit 9038be0
Showing
23 changed files
with
934 additions
and
244 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
33 changes: 33 additions & 0 deletions
33
src/client/java/net/rotgruengelb/forestal/client/render/entity/DeerEntityRenderer.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
package net.rotgruengelb.forestal.client.render.entity; | ||
|
||
import net.minecraft.client.render.VertexConsumerProvider; | ||
import net.minecraft.client.render.entity.EntityRendererFactory; | ||
import net.minecraft.client.util.math.MatrixStack; | ||
import net.minecraft.util.Identifier; | ||
import net.rotgruengelb.forestal.Forestal; | ||
import net.rotgruengelb.forestal.client.render.entity.model.DeerEntityModel; | ||
import net.rotgruengelb.forestal.entity.DeerEntity; | ||
import software.bernie.geckolib.renderer.GeoEntityRenderer; | ||
|
||
public class DeerEntityRenderer extends GeoEntityRenderer<DeerEntity> { | ||
|
||
public DeerEntityRenderer(EntityRendererFactory.Context renderManager) { | ||
super(renderManager, new DeerEntityModel()); | ||
} | ||
|
||
@Override | ||
public Identifier getTextureLocation(DeerEntity grizzlyBear) { | ||
return new Identifier(Forestal.MOD_ID, "textures/entity/deer.png"); | ||
} | ||
|
||
@Override | ||
public void render(DeerEntity deerEntity, float entityYaw, float partialTick, MatrixStack poseStack, VertexConsumerProvider bufferSource, int packedLight) { | ||
if (deerEntity.isBaby()) { | ||
poseStack.scale(0.6F, 0.6F, 0.6F); | ||
} | ||
if (deerEntity.isSleeping()) { | ||
poseStack.translate(0, -0.5, 0); | ||
} | ||
super.render(deerEntity, entityYaw, partialTick, poseStack, bufferSource, packedLight); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
39 changes: 39 additions & 0 deletions
39
src/client/java/net/rotgruengelb/forestal/client/render/entity/model/DeerEntityModel.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
package net.rotgruengelb.forestal.client.render.entity.model; | ||
|
||
import net.minecraft.util.Identifier; | ||
import net.minecraft.util.math.MathHelper; | ||
import net.rotgruengelb.forestal.Forestal; | ||
import net.rotgruengelb.forestal.entity.DeerEntity; | ||
import software.bernie.geckolib.constant.DataTickets; | ||
import software.bernie.geckolib.core.animatable.model.CoreGeoBone; | ||
import software.bernie.geckolib.core.animation.AnimationState; | ||
import software.bernie.geckolib.model.GeoModel; | ||
import software.bernie.geckolib.model.data.EntityModelData; | ||
|
||
public class DeerEntityModel extends GeoModel<DeerEntity> { | ||
@Override | ||
public Identifier getModelResource(DeerEntity animatable) { | ||
return new Identifier(Forestal.MOD_ID, "geo/deer.geo.json"); | ||
} | ||
|
||
@Override | ||
public Identifier getTextureResource(DeerEntity grizzlyBear) { | ||
return new Identifier(Forestal.MOD_ID, "textures/entity/deer.png"); | ||
} | ||
|
||
@Override | ||
public Identifier getAnimationResource(DeerEntity animatable) { | ||
return new Identifier(Forestal.MOD_ID, "animations/deer.animation.json"); | ||
} | ||
|
||
@Override | ||
public void setCustomAnimations(DeerEntity animatable, long instanceId, AnimationState<DeerEntity> animationState) { | ||
CoreGeoBone head = getAnimationProcessor().getBone("head"); | ||
|
||
if (head != null) { | ||
EntityModelData entityData = animationState.getData(DataTickets.ENTITY_MODEL_DATA); | ||
head.setRotX(entityData.headPitch() * MathHelper.RADIANS_PER_DEGREE); | ||
head.setRotY(entityData.netHeadYaw() * MathHelper.RADIANS_PER_DEGREE); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
34 changes: 34 additions & 0 deletions
34
src/main/java/net/rotgruengelb/forestal/block/PuffedDandelionBlock.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
package net.rotgruengelb.forestal.block; | ||
|
||
import net.fabricmc.fabric.api.object.builder.v1.block.FabricBlockSettings; | ||
import net.minecraft.block.BlockState; | ||
import net.minecraft.block.CherryLeavesBlock; | ||
import net.minecraft.block.FlowerBlock; | ||
import net.minecraft.client.util.ParticleUtil; | ||
import net.minecraft.entity.effect.StatusEffects; | ||
import net.minecraft.particle.ParticleTypes; | ||
import net.minecraft.util.math.BlockPos; | ||
import net.minecraft.util.math.Direction; | ||
import net.minecraft.util.math.random.Random; | ||
import net.minecraft.world.World; | ||
|
||
public class PuffedDandelionBlock extends FlowerBlock { | ||
|
||
public PuffedDandelionBlock(FabricBlockSettings settings) { | ||
super(StatusEffects.SATURATION, 7, settings); | ||
} | ||
|
||
@Override | ||
public void randomDisplayTick(BlockState state, World world, BlockPos pos, Random random) { | ||
super.randomDisplayTick(state, world, pos, random); | ||
if (random.nextInt(10) != 0) { | ||
return; | ||
} | ||
BlockPos blockPos = pos.down(); | ||
BlockState blockState = world.getBlockState(blockPos); | ||
if (CherryLeavesBlock.isFaceFullSquare(blockState.getCollisionShape(world, blockPos), Direction.UP)) { | ||
return; | ||
} | ||
ParticleUtil.spawnParticle(world, pos, random, ParticleTypes.CHERRY_LEAVES); | ||
} | ||
} |
Oops, something went wrong.