Skip to content

Commit

Permalink
fix: crushers do not show the ore they are crushing
Browse files Browse the repository at this point in the history
  • Loading branch information
klikli-dev committed Jan 23, 2024
1 parent 5bb7e15 commit d7f8b03
Show file tree
Hide file tree
Showing 4 changed files with 121 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -24,15 +24,44 @@

import com.klikli_dev.occultism.client.model.entity.AfritModel;
import com.klikli_dev.occultism.common.entity.spirit.AfritEntity;
import com.klikli_dev.occultism.common.entity.spirit.MaridEntity;
import com.mojang.blaze3d.vertex.PoseStack;
import net.minecraft.client.renderer.MultiBufferSource;
import net.minecraft.client.renderer.entity.EntityRendererProvider;
import net.minecraft.world.InteractionHand;
import net.minecraft.world.item.ItemDisplayContext;
import net.minecraft.world.item.ItemStack;
import software.bernie.geckolib.cache.object.GeoBone;
import software.bernie.geckolib.renderer.GeoEntityRenderer;
import software.bernie.geckolib.renderer.layer.AutoGlowingGeoLayer;
import software.bernie.geckolib.renderer.layer.BlockAndItemGeoLayer;

import java.util.Objects;

public class AfritRenderer extends GeoEntityRenderer<AfritEntity> {

public AfritRenderer(EntityRendererProvider.Context renderManager) {
super(renderManager, new AfritModel());

this.addRenderLayer(new AutoGlowingGeoLayer<>(this));
this.addRenderLayer(new BlockAndItemGeoLayer<>(this, (bone, animatable) -> {
if (Objects.equals(bone.getName(), "bone")) //left hand
return animatable.getItemInHand(InteractionHand.MAIN_HAND);
return null;
}, (bone, animatable) -> null) {
@Override
protected ItemDisplayContext getTransformTypeForStack(GeoBone bone, ItemStack stack, AfritEntity animatable) {
return ItemDisplayContext.THIRD_PERSON_LEFT_HAND;
}

@Override
protected void renderStackForBone(PoseStack poseStack, GeoBone bone, ItemStack stack, AfritEntity animatable, MultiBufferSource bufferSource, float partialTick, int packedLight, int packedOverlay) {
poseStack.pushPose();
poseStack.translate(0, -0.4, 0);

super.renderStackForBone(poseStack, bone, stack, animatable, bufferSource, partialTick, packedLight, packedOverlay);
poseStack.popPose();
}
});
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -24,13 +24,43 @@

import com.klikli_dev.occultism.client.model.entity.DjinniModel;
import com.klikli_dev.occultism.common.entity.spirit.DjinniEntity;
import com.klikli_dev.occultism.common.entity.spirit.MaridEntity;
import com.mojang.blaze3d.vertex.PoseStack;
import net.minecraft.client.renderer.MultiBufferSource;
import net.minecraft.client.renderer.entity.EntityRendererProvider;
import net.minecraft.world.InteractionHand;
import net.minecraft.world.item.ItemDisplayContext;
import net.minecraft.world.item.ItemStack;
import software.bernie.geckolib.cache.object.GeoBone;
import software.bernie.geckolib.renderer.GeoEntityRenderer;
import software.bernie.geckolib.renderer.layer.BlockAndItemGeoLayer;

import java.util.Objects;

public class DjinniRenderer extends GeoEntityRenderer<DjinniEntity> {

public DjinniRenderer(EntityRendererProvider.Context context) {
super(context, new DjinniModel());

this.addRenderLayer(new BlockAndItemGeoLayer<>(this, (bone, animatable) -> {
if (Objects.equals(bone.getName(), "bone2")) //right hand
return animatable.getItemInHand(InteractionHand.MAIN_HAND);
return null;
}, (bone, animatable) -> null) {
@Override
protected ItemDisplayContext getTransformTypeForStack(GeoBone bone, ItemStack stack, DjinniEntity animatable) {
return ItemDisplayContext.THIRD_PERSON_RIGHT_HAND;
}

@Override
protected void renderStackForBone(PoseStack poseStack, GeoBone bone, ItemStack stack, DjinniEntity animatable, MultiBufferSource bufferSource, float partialTick, int packedLight, int packedOverlay) {
poseStack.pushPose();
poseStack.translate(0, -0.4, 0);

super.renderStackForBone(poseStack, bone, stack, animatable, bufferSource, partialTick, packedLight, packedOverlay);
poseStack.popPose();
}
});
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -24,17 +24,50 @@

import com.klikli_dev.occultism.Occultism;
import com.klikli_dev.occultism.client.model.entity.FoliotModel;
import com.klikli_dev.occultism.common.entity.spirit.DjinniEntity;
import com.klikli_dev.occultism.common.entity.spirit.FoliotEntity;
import com.klikli_dev.occultism.registry.OccultismModelLayers;
import com.mojang.blaze3d.vertex.PoseStack;
import net.minecraft.client.renderer.MultiBufferSource;
import net.minecraft.client.renderer.entity.EntityRendererProvider;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.world.InteractionHand;
import net.minecraft.world.item.ItemDisplayContext;
import net.minecraft.world.item.ItemStack;
import software.bernie.geckolib.cache.object.GeoBone;
import software.bernie.geckolib.renderer.GeoEntityRenderer;
import software.bernie.geckolib.renderer.layer.BlockAndItemGeoLayer;

import java.util.Objects;

public class FoliotRenderer extends GeoEntityRenderer<FoliotEntity> {

public FoliotRenderer(EntityRendererProvider.Context context) {
super(context, new FoliotModel());

this.addRenderLayer(new BlockAndItemGeoLayer<>(this, (bone, animatable) -> {
if (Objects.equals(bone.getName(), "RARM")) //right hand
return animatable.getItemInHand(InteractionHand.MAIN_HAND);
return null;
}, (bone, animatable) -> null) {
@Override
protected ItemDisplayContext getTransformTypeForStack(GeoBone bone, ItemStack stack, FoliotEntity animatable) {
return ItemDisplayContext.THIRD_PERSON_RIGHT_HAND;
}

@Override
protected void renderStackForBone(PoseStack poseStack, GeoBone bone, ItemStack stack, FoliotEntity animatable, MultiBufferSource bufferSource, float partialTick, int packedLight, int packedOverlay) {
poseStack.pushPose();

poseStack.translate(-0.1, -0.3, 0);

final float scale = 0.4f;
poseStack.scale(scale, scale, scale);

super.renderStackForBone(poseStack, bone, stack, animatable, bufferSource, partialTick, packedLight, packedOverlay);
poseStack.popPose();
}
});
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -24,13 +24,41 @@

import com.klikli_dev.occultism.client.model.entity.MaridModel;
import com.klikli_dev.occultism.common.entity.spirit.MaridEntity;
import com.mojang.blaze3d.vertex.PoseStack;
import net.minecraft.client.renderer.MultiBufferSource;
import net.minecraft.client.renderer.entity.EntityRendererProvider;
import net.minecraft.world.InteractionHand;
import net.minecraft.world.item.ItemDisplayContext;
import net.minecraft.world.item.ItemStack;
import software.bernie.geckolib.cache.object.GeoBone;
import software.bernie.geckolib.renderer.GeoEntityRenderer;
import software.bernie.geckolib.renderer.layer.AutoGlowingGeoLayer;
import software.bernie.geckolib.renderer.layer.BlockAndItemGeoLayer;

import java.util.Objects;

public class MaridRenderer extends GeoEntityRenderer<MaridEntity> {

public MaridRenderer(EntityRendererProvider.Context renderManager) {
super(renderManager, new MaridModel());

this.addRenderLayer(new BlockAndItemGeoLayer<>(this, (bone, animatable) -> {
if (Objects.equals(bone.getName(), "bone")) //left hand
return animatable.getItemInHand(InteractionHand.MAIN_HAND);
return null;
}, (bone, animatable) -> null) {
@Override
protected ItemDisplayContext getTransformTypeForStack(GeoBone bone, ItemStack stack, MaridEntity animatable) {
return ItemDisplayContext.THIRD_PERSON_LEFT_HAND;
}

@Override
protected void renderStackForBone(PoseStack poseStack, GeoBone bone, ItemStack stack, MaridEntity animatable, MultiBufferSource bufferSource, float partialTick, int packedLight, int packedOverlay) {
poseStack.pushPose();
poseStack.translate(0, -0.4, 0);

super.renderStackForBone(poseStack, bone, stack, animatable, bufferSource, partialTick, packedLight, packedOverlay);
poseStack.popPose();
}
});
}
}

0 comments on commit d7f8b03

Please sign in to comment.