generated from NeoForgeMDKs/MDK-1.21-NeoGradle
-
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.
aquatic catalyst and curios rendering
- Loading branch information
1 parent
fa1b2d4
commit 7e95a8d
Showing
12 changed files
with
124 additions
and
29 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
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
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
63 changes: 63 additions & 0 deletions
63
...in/java/com/portingdeadmods/modjam/client/renderer/curios/PrismMonocleCuriosRenderer.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,63 @@ | ||
package com.portingdeadmods.modjam.client.renderer.curios; | ||
|
||
import com.mojang.blaze3d.vertex.PoseStack; | ||
import com.mojang.blaze3d.vertex.VertexConsumer; | ||
import com.mojang.math.Axis; | ||
import com.portingdeadmods.modjam.tiers.MJArmorMaterials; | ||
import net.minecraft.client.Minecraft; | ||
import net.minecraft.client.model.*; | ||
import net.minecraft.client.model.geom.EntityModelSet; | ||
import net.minecraft.client.model.geom.ModelLayerLocation; | ||
import net.minecraft.client.model.geom.ModelLayers; | ||
import net.minecraft.client.model.geom.ModelPart; | ||
import net.minecraft.client.renderer.MultiBufferSource; | ||
import net.minecraft.client.renderer.RenderType; | ||
import net.minecraft.client.renderer.entity.RenderLayerParent; | ||
import net.minecraft.client.renderer.entity.layers.HumanoidArmorLayer; | ||
import net.minecraft.client.renderer.entity.player.PlayerRenderer; | ||
import net.minecraft.client.renderer.texture.OverlayTexture; | ||
import net.minecraft.core.component.DataComponents; | ||
import net.minecraft.resources.ResourceLocation; | ||
import net.minecraft.world.entity.EquipmentSlot; | ||
import net.minecraft.world.entity.LivingEntity; | ||
import net.minecraft.world.entity.player.Player; | ||
import net.minecraft.world.item.ArmorItem; | ||
import net.minecraft.world.item.ArmorMaterial; | ||
import net.minecraft.world.item.ItemStack; | ||
import net.minecraft.world.item.armortrim.ArmorTrim; | ||
import net.neoforged.neoforge.client.ClientHooks; | ||
import net.neoforged.neoforge.client.extensions.common.IClientItemExtensions; | ||
import top.theillusivec4.curios.api.SlotContext; | ||
import top.theillusivec4.curios.api.client.ICurioRenderer; | ||
import top.theillusivec4.curios.api.type.capability.ICurio; | ||
|
||
import java.util.List; | ||
|
||
public class PrismMonocleCuriosRenderer implements ICurioRenderer { | ||
|
||
@Override | ||
public <T extends LivingEntity, M extends EntityModel<T>> void render(ItemStack itemStack, | ||
SlotContext slotContext, | ||
PoseStack poseStack, | ||
RenderLayerParent<T, M> renderLayerParent, | ||
MultiBufferSource multiBufferSource, | ||
int light, float v, float v1, float v2, float v3, float v4, float v5) { | ||
LivingEntity entity = slotContext.entity(); | ||
Minecraft mc = Minecraft.getInstance(); | ||
EntityModelSet entityModels = mc.getEntityModels(); | ||
ModelPart part = entityModels.bakeLayer(ModelLayers.PLAYER_OUTER_ARMOR); | ||
HumanoidModel<LivingEntity> playerHumanoidModel = new HumanoidModel<>(part); | ||
Model armorModel = ClientHooks.getArmorModel(entity, itemStack, EquipmentSlot.HEAD, playerHumanoidModel); | ||
List<ArmorMaterial.Layer> layers = MJArmorMaterials.PRISMARINE.value().layers(); | ||
for (int i = 0; i < layers.size(); i++) { | ||
ArmorMaterial.Layer layer = layers.get(i); | ||
ResourceLocation armorTexture = ClientHooks.getArmorTexture(entity, itemStack, layer, false, EquipmentSlot.HEAD); | ||
IClientItemExtensions iClientItemExtensions = IClientItemExtensions.of(itemStack); | ||
int color = iClientItemExtensions.getArmorLayerTintColor(itemStack, entity, layer, i, iClientItemExtensions.getDefaultDyeColor(itemStack)); | ||
VertexConsumer vertexconsumer = multiBufferSource.getBuffer(RenderType.armorCutoutNoCull(armorTexture)); | ||
ICurioRenderer.followBodyRotations(entity, playerHumanoidModel); | ||
armorModel.renderToBuffer(poseStack, vertexconsumer, light, OverlayTexture.NO_OVERLAY, color); | ||
|
||
} | ||
} | ||
} |
34 changes: 34 additions & 0 deletions
34
src/main/java/com/portingdeadmods/modjam/content/blocks/AquaticCatalaystBlock.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 com.portingdeadmods.modjam.content.blocks; | ||
|
||
import com.portingdeadmods.modjam.utils.MJBlockStateProperties; | ||
import net.minecraft.core.BlockPos; | ||
import net.minecraft.world.InteractionHand; | ||
import net.minecraft.world.ItemInteractionResult; | ||
import net.minecraft.world.entity.player.Player; | ||
import net.minecraft.world.item.ItemStack; | ||
import net.minecraft.world.item.Items; | ||
import net.minecraft.world.level.Level; | ||
import net.minecraft.world.level.block.Block; | ||
import net.minecraft.world.level.block.state.BlockState; | ||
import net.minecraft.world.level.block.state.StateDefinition; | ||
import net.minecraft.world.phys.BlockHitResult; | ||
|
||
public class AquaticCatalaystBlock extends Block { | ||
public AquaticCatalaystBlock(Properties properties) { | ||
super(properties); | ||
} | ||
|
||
@Override | ||
protected void createBlockStateDefinition(StateDefinition.Builder<Block, BlockState> builder) { | ||
super.createBlockStateDefinition(builder.add(MJBlockStateProperties.HOS_ACTIVE)); | ||
} | ||
|
||
@Override | ||
protected ItemInteractionResult useItemOn(ItemStack stack, BlockState state, Level level, BlockPos pos, Player player, InteractionHand hand, BlockHitResult hitResult) { | ||
// TODO: Use a tag for this | ||
if (stack.is(Items.HEART_OF_THE_SEA)) { | ||
level.setBlockAndUpdate(pos, state.setValue(MJBlockStateProperties.HOS_ACTIVE, player.getDirection().getOpposite())); | ||
} | ||
return super.useItemOn(stack, state, level, pos, player, hand, hitResult); | ||
} | ||
} |
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
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
19 changes: 0 additions & 19 deletions
19
src/main/java/com/portingdeadmods/modjam/render/curios/PrismMonocleCuriosRenderer.java
This file was deleted.
Oops, something went wrong.
7 changes: 7 additions & 0 deletions
7
src/main/java/com/portingdeadmods/modjam/utils/MJBlockStateProperties.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,7 @@ | ||
package com.portingdeadmods.modjam.utils; | ||
|
||
import net.minecraft.world.level.block.state.properties.DirectionProperty; | ||
|
||
public final class MJBlockStateProperties { | ||
public static final DirectionProperty HOS_ACTIVE = DirectionProperty.create("hos_active"); | ||
} |
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 @@ | ||
public net.minecraft.client.model.PlayerModel slim |
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
Binary file added
BIN
+296 Bytes
src/main/resources/assets/modjam/textures/block/aquatic_catalyst.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.