Skip to content

Commit

Permalink
add item render display for pedestal
Browse files Browse the repository at this point in the history
  • Loading branch information
Cheaterpaul committed Jan 26, 2025
1 parent ab82e0d commit 639c02b
Show file tree
Hide file tree
Showing 5 changed files with 22 additions and 1 deletion.
3 changes: 3 additions & 0 deletions src/api/java/de/teamlapen/vampirism/api/VEnums.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import net.minecraft.world.entity.MobCategory;
import net.minecraft.world.entity.vehicle.Boat;
import net.minecraft.world.item.Item;
import net.minecraft.world.item.ItemDisplayContext;
import net.minecraft.world.item.Items;
import net.neoforged.fml.common.asm.enumextension.EnumProxy;

Expand All @@ -17,4 +18,6 @@ public class VEnums {
* Vampire creatures are of this creature type. But when they are counted for spawning they belong to {@link net.minecraft.world.entity.MobCategory#MONSTER}
*/
public static final EnumProxy<MobCategory> VAMPIRE_CATEGORY = new EnumProxy<>(MobCategory.class, "vampirism:vampire", 30, false, false, 128);

public static final EnumProxy<ItemDisplayContext> PEDESTAL = new EnumProxy<>(ItemDisplayContext.class, 9, "vampirism:pedestal", "GROUND");
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import com.mojang.blaze3d.vertex.PoseStack;
import com.mojang.math.Axis;
import de.teamlapen.vampirism.api.VEnums;
import de.teamlapen.vampirism.blockentity.PedestalBlockEntity;
import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.MultiBufferSource;
Expand All @@ -23,7 +24,7 @@ public void render(@NotNull PedestalBlockEntity te, float partialTicks, @NotNull
matrixStack.translate(0.5, 0.8, 0.5);
float rotation = (te.getTickForRender() % 512 + partialTicks) / 512f;
matrixStack.mulPose(Axis.YP.rotationDegrees(rotation * 360));
Minecraft.getInstance().getItemRenderer().renderStatic(stack, ItemDisplayContext.GROUND, i, i1, matrixStack, iRenderTypeBuffer, te.getLevel(), 0);
Minecraft.getInstance().getItemRenderer().renderStatic(stack, VEnums.PEDESTAL.getValue(), i, i1, matrixStack, iRenderTypeBuffer, te.getLevel(), 0);
matrixStack.popPose();
}

Expand Down
9 changes: 9 additions & 0 deletions src/main/resources/META-INF/enumextensions.json
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,15 @@
"class": "de/teamlapen/vampirism/client/ModClientEnums",
"field": "DOUBLE_CROSSBOW_HOLD"
}
},
{
"enum": "net/minecraft/world/item/ItemDisplayContext",
"name": "VAMPIRISM_PEDESTAL",
"constructor": "(ILjava/lang/String;Ljava/lang/String;)V",
"parameters": {
"class": "de/teamlapen/vampirism/api/VEnums",
"field": "PEDESTAL"
}
}
]
}
Original file line number Diff line number Diff line change
Expand Up @@ -2008,6 +2008,10 @@
-2.5,
-0.75
]
},
"vampirism:pedestal": {
"translation": [-0.25, 4, -0.25],
"scale": [0.75, 0.75, 0.75]
}
},
"groups": [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2175,6 +2175,10 @@
0.6543,
-1
]
},
"vampirism:pedestal": {
"translation": [0.5, 11, 0.5],
"scale": [0.75, 0.75, 0.75]
}
},
"groups": [
Expand Down

0 comments on commit 639c02b

Please sign in to comment.