This repository has been archived by the owner on Jan 4, 2024. It is now read-only.
forked from ochotonida/artifacts
-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Equipping multiple of the same Trinkets is now allowed - Fully custom FeatureRenderer
- Loading branch information
Showing
9 changed files
with
58 additions
and
157 deletions.
There are no files selected for viewing
43 changes: 43 additions & 0 deletions
43
src/main/java/artifacts/client/render/ArtifactFeatureRenderer.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,43 @@ | ||
package artifacts.client.render; | ||
|
||
import artifacts.item.trinket.TrinketArtifactItem; | ||
import dev.emi.trinkets.api.TrinketComponent; | ||
import dev.emi.trinkets.api.TrinketSlots; | ||
import dev.emi.trinkets.api.TrinketsApi; | ||
import net.minecraft.client.network.AbstractClientPlayerEntity; | ||
import net.minecraft.client.render.VertexConsumerProvider; | ||
import net.minecraft.client.render.entity.feature.FeatureRenderer; | ||
import net.minecraft.client.render.entity.feature.FeatureRendererContext; | ||
import net.minecraft.client.render.entity.model.PlayerEntityModel; | ||
import net.minecraft.client.util.math.MatrixStack; | ||
import net.minecraft.item.ItemStack; | ||
|
||
import java.util.List; | ||
|
||
/** | ||
* Custom trinkets feature renderer, {@link dev.emi.trinkets.TrinketFeatureRenderer} is missing parameters | ||
*/ | ||
public class ArtifactFeatureRenderer extends FeatureRenderer<AbstractClientPlayerEntity, PlayerEntityModel<AbstractClientPlayerEntity>> { | ||
private final FeatureRendererContext<AbstractClientPlayerEntity, PlayerEntityModel<AbstractClientPlayerEntity>> context; | ||
|
||
public ArtifactFeatureRenderer( | ||
FeatureRendererContext<AbstractClientPlayerEntity, PlayerEntityModel<AbstractClientPlayerEntity>> context) { | ||
super(context); | ||
this.context = context; | ||
} | ||
|
||
@Override | ||
public void render(MatrixStack matrices, VertexConsumerProvider vertexConsumers, int light, AbstractClientPlayerEntity player, float limbAngle, float limbDistance, float tickDelta, float animationProgress, float headYaw, float headPitch) { | ||
TrinketComponent comp = TrinketsApi.getTrinketComponent(player); | ||
List<String> names = TrinketSlots.getAllSlotNames(); | ||
|
||
for (int i = 0; i < comp.getInventory().size(); i++) { | ||
matrices.push(); | ||
ItemStack stack = comp.getInventory().getStack(i); | ||
if (stack.getItem() instanceof TrinketArtifactItem) { | ||
((TrinketArtifactItem) stack.getItem()).render(names.get(i), matrices, vertexConsumers, light, context.getModel(), player, limbAngle, limbDistance, tickDelta, animationProgress, headYaw, headPitch); | ||
} | ||
matrices.pop(); | ||
} | ||
} | ||
} |
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
31 changes: 0 additions & 31 deletions
31
src/main/java/artifacts/mixin/mixins/trinkets/PlayerEntityMixin.java
This file was deleted.
Oops, something went wrong.
38 changes: 0 additions & 38 deletions
38
src/main/java/artifacts/mixin/mixins/trinkets/PlayerTrinketComponentMixin.java
This file was deleted.
Oops, something went wrong.
40 changes: 0 additions & 40 deletions
40
src/main/java/artifacts/mixin/mixins/trinkets/TrinketFeatureRendererMixin.java
This file was deleted.
Oops, something went wrong.
41 changes: 0 additions & 41 deletions
41
src/main/java/artifacts/mixin/mixins/trinkets/TrinketSlotMixin.java
This file was deleted.
Oops, something went wrong.
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