this isn't working

This commit is contained in:
petrak@ 2023-02-17 20:56:39 -06:00
parent 74690580f6
commit e44892389c
30 changed files with 191 additions and 74 deletions

View file

@ -1,4 +0,0 @@
package at.petrak.hexcasting.client;
public class PatternShapeMatcher {
}

View file

@ -1,7 +1,7 @@
package at.petrak.hexcasting.client.be;
import at.petrak.hexcasting.api.casting.math.HexPattern;
import at.petrak.hexcasting.client.RenderLib;
import at.petrak.hexcasting.client.render.RenderLib;
import at.petrak.hexcasting.common.blocks.akashic.BlockAkashicBookshelf;
import at.petrak.hexcasting.common.blocks.akashic.BlockEntityAkashicBookshelf;
import com.mojang.blaze3d.systems.RenderSystem;
@ -22,7 +22,7 @@ public class BlockEntityAkashicBookshelfRenderer implements BlockEntityRenderer<
@Override
public void render(BlockEntityAkashicBookshelf tile, float pPartialTick, PoseStack ps,
MultiBufferSource buffer, int light, int overlay) {
MultiBufferSource buffer, int light, int overlay) {
HexPattern pattern = tile.getPattern();
if (pattern == null) {
return;

View file

@ -1,6 +1,6 @@
package at.petrak.hexcasting.client.be;
import at.petrak.hexcasting.client.RenderLib;
import at.petrak.hexcasting.client.render.RenderLib;
import at.petrak.hexcasting.common.blocks.circles.BlockEntitySlate;
import at.petrak.hexcasting.common.blocks.circles.BlockSlate;
import com.mojang.blaze3d.systems.RenderSystem;
@ -22,7 +22,7 @@ public class BlockEntitySlateRenderer implements BlockEntityRenderer<BlockEntity
@Override
public void render(BlockEntitySlate tile, float pPartialTick, PoseStack ps,
MultiBufferSource buffer, int light, int overlay) {
MultiBufferSource buffer, int light, int overlay) {
if (tile.pattern == null) {
return;
}

View file

@ -1,6 +1,6 @@
package at.petrak.hexcasting.client.entity;
import at.petrak.hexcasting.client.RenderLib;
import at.petrak.hexcasting.client.render.RenderLib;
import at.petrak.hexcasting.common.entities.EntityWallScroll;
import com.mojang.blaze3d.systems.RenderSystem;
import com.mojang.blaze3d.vertex.PoseStack;
@ -39,7 +39,7 @@ public class WallScrollRenderer extends EntityRenderer<EntityWallScroll> {
// I do as the PaintingRenderer guides
@Override
public void render(EntityWallScroll wallScroll, float yaw, float partialTicks, PoseStack ps,
MultiBufferSource bufSource, int packedLight) {
MultiBufferSource bufSource, int packedLight) {
RenderSystem.setShader(GameRenderer::getPositionTexShader);
@ -158,8 +158,8 @@ public class WallScrollRenderer extends EntityRenderer<EntityWallScroll> {
}
private static void vertex(Matrix4f mat, Matrix3f normal, int light, VertexConsumer verts, float x, float y,
float z, float u,
float v, float nx, float ny, float nz) {
float z, float u,
float v, float nx, float ny, float nz) {
verts.vertex(mat, x, y, z)
.color(0xffffffff)
.uv(u, v).overlayCoords(OverlayTexture.NO_OVERLAY).uv2(light)
@ -176,7 +176,7 @@ public class WallScrollRenderer extends EntityRenderer<EntityWallScroll> {
}
private static void theCoolerDrawLineSeq(Matrix4f mat, Matrix3f normalMat, int light, VertexConsumer verts,
List<Vec2> points, float width, int color
List<Vec2> points, float width, int color
) {
if (points.size() <= 1) {
return;
@ -285,7 +285,7 @@ public class WallScrollRenderer extends EntityRenderer<EntityWallScroll> {
}
private static void theCoolerDrawSpot(Matrix4f mat, Matrix3f normal, int light, VertexConsumer verts,
Vec2 point, float radius, int color) {
Vec2 point, float radius, int color) {
var fracOfCircle = 6;
for (int i = 0; i < fracOfCircle; i++) {
// We do need rects, irritatingly

View file

@ -1,8 +1,5 @@
package at.petrak.hexcasting.client.gui
import at.petrak.hexcasting.api.misc.DiscoveryHandlers
import at.petrak.hexcasting.api.mod.HexConfig
import at.petrak.hexcasting.api.mod.HexTags
import at.petrak.hexcasting.api.casting.eval.ControllerInfo
import at.petrak.hexcasting.api.casting.eval.ResolvedPattern
import at.petrak.hexcasting.api.casting.eval.ResolvedPatternType
@ -10,9 +7,14 @@ import at.petrak.hexcasting.api.casting.math.HexAngle
import at.petrak.hexcasting.api.casting.math.HexCoord
import at.petrak.hexcasting.api.casting.math.HexDir
import at.petrak.hexcasting.api.casting.math.HexPattern
import at.petrak.hexcasting.api.misc.DiscoveryHandlers
import at.petrak.hexcasting.api.mod.HexConfig
import at.petrak.hexcasting.api.mod.HexTags
import at.petrak.hexcasting.api.utils.asTranslatedComponent
import at.petrak.hexcasting.client.*
import at.petrak.hexcasting.client.ClientTickCounter
import at.petrak.hexcasting.client.ShiftScrollListener
import at.petrak.hexcasting.client.ktxt.accumulatedScroll
import at.petrak.hexcasting.client.render.*
import at.petrak.hexcasting.client.sound.GridSoundInstance
import at.petrak.hexcasting.common.lib.HexSounds
import at.petrak.hexcasting.common.lib.hex.HexIotaTypes

View file

@ -1,7 +1,7 @@
package at.petrak.hexcasting.client.gui;
import at.petrak.hexcasting.api.casting.math.HexPattern;
import at.petrak.hexcasting.client.RenderLib;
import at.petrak.hexcasting.client.render.RenderLib;
import at.petrak.hexcasting.common.misc.PatternTooltip;
import com.mojang.blaze3d.platform.GlStateManager;
import com.mojang.blaze3d.systems.RenderSystem;
@ -64,7 +64,7 @@ public class PatternTooltipComponent implements ClientTooltipComponent {
@Override
public void renderImage(Font font, int mouseX, int mouseY, PoseStack ps, ItemRenderer pItemRenderer,
int pBlitOffset) {
int pBlitOffset) {
var width = this.getWidth(font);
var height = this.getHeight();

View file

@ -1,8 +1,9 @@
package at.petrak.hexcasting.client;
package at.petrak.hexcasting.client.render;
import at.petrak.hexcasting.api.client.ScryingLensOverlayRegistry;
import at.petrak.hexcasting.api.misc.DiscoveryHandlers;
import at.petrak.hexcasting.api.player.Sentinel;
import at.petrak.hexcasting.client.ClientTickCounter;
import at.petrak.hexcasting.xplat.IXplatAbstractions;
import com.google.common.collect.Lists;
import com.mojang.blaze3d.platform.GlStateManager;

View file

@ -0,0 +1,4 @@
package at.petrak.hexcasting.client.render;
public class PatternShapeMatcher {
}

View file

@ -1,10 +1,11 @@
@file:JvmName("RenderLib")
package at.petrak.hexcasting.client
package at.petrak.hexcasting.client.render
import at.petrak.hexcasting.api.casting.math.HexPattern
import at.petrak.hexcasting.api.mod.HexConfig
import at.petrak.hexcasting.api.utils.TAU
import at.petrak.hexcasting.client.ClientTickCounter
import com.mojang.blaze3d.systems.RenderSystem
import com.mojang.blaze3d.vertex.DefaultVertexFormat
import com.mojang.blaze3d.vertex.PoseStack

View file

@ -1,4 +1,4 @@
package at.petrak.hexcasting.client.shader;
package at.petrak.hexcasting.client.render.shader;
import at.petrak.hexcasting.mixin.accessor.client.AccessorCompositeRenderType;
import at.petrak.hexcasting.mixin.accessor.client.AccessorEmptyTextureStateShard;
@ -13,13 +13,14 @@ import org.jetbrains.annotations.NotNull;
import java.util.Optional;
import java.util.function.Function;
public record FakeBufferSource(MultiBufferSource parent, Function<ResourceLocation, RenderType> mapper) implements MultiBufferSource {
public record FakeBufferSource(MultiBufferSource parent,
Function<ResourceLocation, RenderType> mapper) implements MultiBufferSource {
@Override
@SuppressWarnings("ConstantConditions")
public @NotNull VertexConsumer getBuffer(@NotNull RenderType renderType) {
if (((AccessorRenderStateShard) renderType).hex$name().equals("entity_cutout_no_cull")
&& renderType instanceof RenderType.CompositeRenderType) {
&& renderType instanceof RenderType.CompositeRenderType) {
RenderType.CompositeState state = ((AccessorCompositeRenderType) renderType).hex$state();
RenderStateShard.EmptyTextureStateShard shard = state.textureState;
Optional<ResourceLocation> texture = ((AccessorEmptyTextureStateShard) shard).hex$cutoutTexture();

View file

@ -1,4 +1,4 @@
package at.petrak.hexcasting.client.shader;
package at.petrak.hexcasting.client.render.shader;
import at.petrak.hexcasting.api.HexAPI;
import at.petrak.hexcasting.mixin.accessor.client.AccessorRenderType;
@ -13,27 +13,29 @@ import java.util.function.Function;
// https://github.com/VazkiiMods/Botania/blob/3a43accc2fbc439c9f2f00a698f8f8ad017503db/Common/src/main/java/vazkii/botania/client/core/helper/RenderHelper.java
public final class HexRenderTypes extends RenderType {
private HexRenderTypes(String string, VertexFormat vertexFormat, VertexFormat.Mode mode, int i, boolean bl, boolean bl2, Runnable runnable, Runnable runnable2) {
private HexRenderTypes(String string, VertexFormat vertexFormat, VertexFormat.Mode mode, int i, boolean bl,
boolean bl2, Runnable runnable, Runnable runnable2) {
super(string, vertexFormat, mode, i, bl, bl2, runnable, runnable2);
throw new UnsupportedOperationException("Should not be instantiated");
}
private static RenderType makeLayer(String name, VertexFormat format, VertexFormat.Mode mode,
int bufSize, boolean hasCrumbling, boolean sortOnUpload, RenderType.CompositeState glState) {
int bufSize, boolean hasCrumbling, boolean sortOnUpload, RenderType.CompositeState glState) {
return AccessorRenderType.hex$create(name, format, mode, bufSize, hasCrumbling, sortOnUpload, glState);
}
private static final Function<ResourceLocation, RenderType> GRAYSCALE_PROVIDER = Util.memoize(texture -> {
CompositeState glState = RenderType.CompositeState.builder()
.setShaderState(new ShaderStateShard(HexShaders::grayscale))
.setTextureState(new TextureStateShard(texture, false, false))
.setTransparencyState(NO_TRANSPARENCY)
.setCullState(NO_CULL)
.setLightmapState(LIGHTMAP)
.setOverlayState(OVERLAY)
.createCompositeState(true);
.setShaderState(new ShaderStateShard(HexShaders::grayscale))
.setTextureState(new TextureStateShard(texture, false, false))
.setTransparencyState(NO_TRANSPARENCY)
.setCullState(NO_CULL)
.setLightmapState(LIGHTMAP)
.setOverlayState(OVERLAY)
.createCompositeState(true);
return makeLayer(HexAPI.MOD_ID + ":grayscale", DefaultVertexFormat.NEW_ENTITY, VertexFormat.Mode.QUADS, 256, true, false, glState);
return makeLayer(HexAPI.MOD_ID + ":grayscale", DefaultVertexFormat.NEW_ENTITY, VertexFormat.Mode.QUADS, 256,
true, false, glState);
});
public static RenderType getGrayscaleLayer(ResourceLocation texture) {

View file

@ -1,4 +1,4 @@
package at.petrak.hexcasting.client.shader;
package at.petrak.hexcasting.client.render.shader;
import com.mojang.blaze3d.vertex.DefaultVertexFormat;
import com.mojang.datafixers.util.Pair;
@ -11,11 +11,12 @@ import java.util.function.Consumer;
// https://github.com/VazkiiMods/Botania/blob/3a43accc2fbc439c9f2f00a698f8f8ad017503db/Common/src/main/java/vazkii/botania/client/core/helper/CoreShaders.java
public class HexShaders {
private static ShaderInstance grayscale;
public static void init(ResourceManager resourceManager,
Consumer<Pair<ShaderInstance, Consumer<ShaderInstance>>> registrations) throws IOException {
Consumer<Pair<ShaderInstance, Consumer<ShaderInstance>>> registrations) throws IOException {
registrations.accept(Pair.of(
new ShaderInstance(resourceManager, "hexcasting__grayscale", DefaultVertexFormat.NEW_ENTITY),
inst -> grayscale = inst)
new ShaderInstance(resourceManager, "hexcasting__grayscale", DefaultVertexFormat.NEW_ENTITY),
inst -> grayscale = inst)
);
}

View file

@ -3,7 +3,7 @@ package at.petrak.hexcasting.common.entities;
import at.petrak.hexcasting.api.casting.math.HexPattern;
import at.petrak.hexcasting.api.utils.HexUtils;
import at.petrak.hexcasting.api.utils.NBTHelper;
import at.petrak.hexcasting.client.RenderLib;
import at.petrak.hexcasting.client.render.RenderLib;
import at.petrak.hexcasting.common.items.storage.ItemScroll;
import at.petrak.hexcasting.common.lib.HexItems;
import at.petrak.hexcasting.common.lib.HexSounds;

View file

@ -2,7 +2,7 @@ package at.petrak.hexcasting.interop.patchouli;
import at.petrak.hexcasting.api.casting.math.HexCoord;
import at.petrak.hexcasting.api.casting.math.HexPattern;
import at.petrak.hexcasting.client.RenderLib;
import at.petrak.hexcasting.client.render.RenderLib;
import at.petrak.hexcasting.interop.utils.PatternDrawingUtil;
import at.petrak.hexcasting.interop.utils.PatternEntry;
import com.mojang.blaze3d.vertex.PoseStack;

View file

@ -3,7 +3,7 @@ package at.petrak.hexcasting.interop.utils;
import at.petrak.hexcasting.api.casting.math.HexCoord;
import at.petrak.hexcasting.api.casting.math.HexPattern;
import at.petrak.hexcasting.api.utils.HexUtils;
import at.petrak.hexcasting.client.RenderLib;
import at.petrak.hexcasting.client.render.RenderLib;
import com.mojang.blaze3d.platform.GlStateManager;
import com.mojang.blaze3d.systems.RenderSystem;
import com.mojang.blaze3d.vertex.PoseStack;
@ -19,8 +19,8 @@ import java.util.List;
public final class PatternDrawingUtil {
public static void drawPattern(PoseStack poseStack, int x, int y, List<PatternEntry> patterns, List<Vec2> dots,
boolean strokeOrder, int outer, int innerLight, int innerDark,
int dotColor) {
boolean strokeOrder, int outer, int innerLight, int innerDark,
int dotColor) {
poseStack.pushPose();
poseStack.translate(x, y, 1);
var mat = poseStack.last().pose();
@ -61,7 +61,7 @@ public final class PatternDrawingUtil {
}
public static PatternRenderingData loadPatterns(List<Pair<HexPattern, HexCoord>> patterns,
float readabilityOffset, float lastLineLenProp) {
float readabilityOffset, float lastLineLenProp) {
var patternEntries = new ArrayList<PatternEntry>(patterns.size());
var fakeScale = 1;

View file

@ -0,0 +1,41 @@
package at.petrak.hexcasting.mixin.client;
import at.petrak.hexcasting.xplat.IXplatAbstractions;
import com.mojang.blaze3d.vertex.PoseStack;
import net.minecraft.client.renderer.MultiBufferSource;
import net.minecraft.client.renderer.entity.layers.ElytraLayer;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.world.entity.LivingEntity;
import net.minecraft.world.entity.player.Player;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.ModifyVariable;
import static at.petrak.hexcasting.api.HexAPI.modLoc;
// Do this with a mixin instead of a model like you're supposed to because
// 1. cause it's easier
// 2. players wearing normal elytra and altiora won't get z fighting
@Mixin(ElytraLayer.class)
public class MixinElytraLayer {
private static final ResourceLocation ALTIORA_LOC = modLoc("textures/misc/altiora.png");
// The "do i draw" check is one of the thing forge clobbers, so we do that in side-specific mixins
@ModifyVariable(
method = "render(Lcom/mojang/blaze3d/vertex/PoseStack;Lnet/minecraft/client/renderer/MultiBufferSource;" +
"ILnet/minecraft/world/entity/LivingEntity;FFFFFF)V",
at = @At(value = "INVOKE", target = "Lcom/mojang/blaze3d/vertex/PoseStack;pushPose()V", ordinal = 0),
ordinal = 0
)
private ResourceLocation injectAltioraLocation(ResourceLocation texLoc, PoseStack ps, MultiBufferSource mbs,
int packedLight, LivingEntity e) {
if (e instanceof Player player) {
if (IXplatAbstractions.INSTANCE.getAltiora(player) != null) {
return ALTIORA_LOC;
}
}
return texLoc;
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 419 B

View file

@ -25,6 +25,7 @@
"accessor.client.AccessorMouseHandler",
"accessor.client.AccessorRenderStateShard",
"accessor.client.AccessorRenderType",
"client.MixinClientLevel"
"client.MixinClientLevel",
"client.MixinElytraLayer"
]
}

View file

@ -1,10 +1,10 @@
package at.petrak.hexcasting.fabric
import at.petrak.hexcasting.client.ClientTickCounter
import at.petrak.hexcasting.client.HexAdditionalRenderers
import at.petrak.hexcasting.client.RegisterClientStuff
import at.petrak.hexcasting.client.ShiftScrollListener
import at.petrak.hexcasting.client.gui.PatternTooltipComponent
import at.petrak.hexcasting.client.render.HexAdditionalRenderers
import at.petrak.hexcasting.common.casting.PatternRegistryManifest
import at.petrak.hexcasting.common.lib.HexParticles
import at.petrak.hexcasting.fabric.event.MouseScrollCallback

View file

@ -64,13 +64,12 @@ public class HexCardinalComponents implements EntityComponentInitializer, ItemCo
registry.registerFor(Mob.class, BRAINSWEPT, CCBrainswept::new);
registry.registerForPlayers(FAVORED_COLORIZER, CCFavoredColorizer::new, RespawnCopyStrategy.ALWAYS_COPY);
registry.registerForPlayers(SENTINEL, CCSentinel::new, RespawnCopyStrategy.ALWAYS_COPY);
registry.registerForPlayers(ALTIORA, CCAltiora::new, RespawnCopyStrategy.LOSSLESS_ONLY);
// Fortunately these are all both only needed on the server and don't want to be copied across death
registry.registerFor(ServerPlayer.class, FLIGHT, CCFlight::new);
registry.registerFor(ServerPlayer.class, HARNESS, CCHarness::new);
registry.registerFor(ServerPlayer.class, PATTERNS, CCPatterns::new);
// On Fabric, this is needed on the client because the c/s need to agree on when wings are being deployed
registry.registerForPlayers(ALTIORA, CCAltiora::new, RespawnCopyStrategy.LOSSLESS_ONLY);
registry.registerFor(ItemEntity.class, IOTA_HOLDER, wrapItemEntityDelegate(
ItemDelegatingEntityIotaHolder.ToItemEntity::new));

View file

@ -16,7 +16,7 @@ import java.util.List;
import java.util.stream.Collectors;
import static at.petrak.hexcasting.api.HexAPI.modLoc;
import static at.petrak.hexcasting.client.RenderLib.renderEntity;
import static at.petrak.hexcasting.client.render.RenderLib.renderEntity;
public class BrainsweepeeEmiStack extends EmiStack {
public final BrainsweepeeIngredient ingredient;

View file

@ -0,0 +1,35 @@
package at.petrak.hexcasting.fabric.mixin.client;
import at.petrak.hexcasting.xplat.IXplatAbstractions;
import com.mojang.blaze3d.vertex.PoseStack;
import net.minecraft.client.renderer.MultiBufferSource;
import net.minecraft.client.renderer.entity.layers.ElytraLayer;
import net.minecraft.world.entity.LivingEntity;
import net.minecraft.world.entity.player.Player;
import net.minecraft.world.item.Item;
import net.minecraft.world.item.ItemStack;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Redirect;
@Mixin(ElytraLayer.class)
public class FabricMixinElytraLayer {
@Redirect(
method = "render(Lcom/mojang/blaze3d/vertex/PoseStack;Lnet/minecraft/client/renderer/MultiBufferSource;" +
"ILnet/minecraft/world/entity/LivingEntity;FFFFFF)V",
at = @At(value = "INVOKE", ordinal = 0, target = "Lnet/minecraft/world/item/ItemStack;is" +
"(Lnet/minecraft/world/item/Item;)Z")
)
private boolean renderIfAltiora(ItemStack stack, Item elytraItem, PoseStack ps, MultiBufferSource mbs, int light,
LivingEntity entity) {
if (entity instanceof Player player) {
var altiora = IXplatAbstractions.INSTANCE.getAltiora(player);
if (altiora != null) {
return true;
}
}
return stack.is(elytraItem);
}
}

View file

@ -1,6 +1,6 @@
package at.petrak.hexcasting.fabric.mixin.client;
import at.petrak.hexcasting.client.shader.HexShaders;
import at.petrak.hexcasting.client.render.shader.HexShaders;
import com.mojang.blaze3d.shaders.Program;
import com.mojang.datafixers.util.Pair;
import net.minecraft.client.renderer.GameRenderer;
@ -21,18 +21,18 @@ import java.util.function.Consumer;
public class FabricMixinGameRenderer {
@SuppressWarnings("InvalidInjectorMethodSignature")
@Inject(
method = "reloadShaders",
at = @At(
value = "INVOKE_ASSIGN",
target = "Lcom/google/common/collect/Lists;newArrayListWithCapacity(I)Ljava/util/ArrayList;",
remap = false
),
locals = LocalCapture.CAPTURE_FAILHARD
method = "reloadShaders",
at = @At(
value = "INVOKE_ASSIGN",
target = "Lcom/google/common/collect/Lists;newArrayListWithCapacity(I)Ljava/util/ArrayList;",
remap = false
),
locals = LocalCapture.CAPTURE_FAILHARD
)
private void loadShaders(ResourceManager resourceManager, CallbackInfo ci,
List<Program> _programsToClose,
List<Pair<ShaderInstance, Consumer<ShaderInstance>>> shadersToLoad)
throws IOException {
List<Program> _programsToClose,
List<Pair<ShaderInstance, Consumer<ShaderInstance>>> shadersToLoad)
throws IOException {
HexShaders.init(resourceManager, shadersToLoad::add);
}
}

View file

@ -17,6 +17,7 @@
"client": [
"client.FabricAbstractTextureMixin",
"client.FabricLevelRendererMixin",
"client.FabricMixinElytraLayer",
"client.FabricMixinGameRenderer",
"client.FabricModelManagerMixin",
"client.FabricMouseHandlerMixin",

View file

@ -1,11 +1,11 @@
package at.petrak.hexcasting.forge;
import at.petrak.hexcasting.client.ClientTickCounter;
import at.petrak.hexcasting.client.HexAdditionalRenderers;
import at.petrak.hexcasting.client.RegisterClientStuff;
import at.petrak.hexcasting.client.ShiftScrollListener;
import at.petrak.hexcasting.client.gui.PatternTooltipComponent;
import at.petrak.hexcasting.client.shader.HexShaders;
import at.petrak.hexcasting.client.render.HexAdditionalRenderers;
import at.petrak.hexcasting.client.render.shader.HexShaders;
import at.petrak.hexcasting.common.casting.PatternRegistryManifest;
import at.petrak.hexcasting.common.lib.HexParticles;
import at.petrak.hexcasting.common.misc.PatternTooltip;

View file

@ -25,6 +25,7 @@ public class CapSyncers {
// Copy data from this to new player
var x = IXplatAbstractions.INSTANCE;
x.setFlight(player, x.getFlight(proto));
x.setAltiora(player, x.getAltiora(proto));
x.setSentinel(player, x.getSentinel(proto));
x.setColorizer(player, x.getColorizer(proto));
x.setHarness(player, x.getHarness(proto, InteractionHand.MAIN_HAND));

View file

@ -26,7 +26,7 @@ import java.util.Collections;
import java.util.List;
import static at.petrak.hexcasting.api.HexAPI.modLoc;
import static at.petrak.hexcasting.client.RenderLib.renderEntity;
import static at.petrak.hexcasting.client.render.RenderLib.renderEntity;
public class BrainsweepRecipeCategory implements IRecipeCategory<BrainsweepRecipe> {
public static final ResourceLocation UID = modLoc("brainsweep");

View file

@ -0,0 +1,30 @@
package at.petrak.hexcasting.forge.mixin.client;
import at.petrak.hexcasting.api.HexAPI;
import at.petrak.hexcasting.xplat.IXplatAbstractions;
import net.minecraft.client.renderer.entity.layers.ElytraLayer;
import net.minecraft.world.entity.LivingEntity;
import net.minecraft.world.entity.player.Player;
import net.minecraft.world.item.ItemStack;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
@Mixin(ElytraLayer.class)
public class ForgeMixinElytraLayer {
@Inject(
method = "shouldRender", at = @At("RETURN"),
cancellable = true,
remap = false
)
private void renderIfAltiora(ItemStack stack, LivingEntity entity, CallbackInfoReturnable<Boolean> cir) {
if (entity instanceof Player player) {
var altiora = IXplatAbstractions.INSTANCE.getAltiora(player);
HexAPI.LOGGER.warn(altiora);
if (altiora != null) {
cir.setReturnValue(true);
}
}
}
}

View file

@ -244,12 +244,7 @@ public class ForgeXplatImpl implements IXplatAbstractions {
}
@Override
public AltioraAbility getAltiora(Player anyPlayer) {
if (!(anyPlayer instanceof ServerPlayer player)) {
// the check only needs to happen client-side on fabric
// which is great, cause it's not even synced on forge
return null;
}
public AltioraAbility getAltiora(Player player) {
CompoundTag tag = player.getPersistentData();
boolean allowed = tag.getBoolean(TAG_ALTIORA_ALLOWED);
if (allowed) {

View file

@ -4,7 +4,13 @@
"compatibilityLevel": "JAVA_17",
"refmap": "hexcasting.mixins.refmap.json",
"package": "at.petrak.hexcasting.forge.mixin",
"mixins": ["ForgeAccessorRegistry", "ForgeMixinCursedRecipeSerializerBase"], "client": [
"ForgeMixinBlockColors", "ForgeMixinItemColors"
]
"mixins": [
"ForgeAccessorRegistry",
"ForgeMixinCursedRecipeSerializerBase"
],
"client": [
"ForgeMixinBlockColors",
"ForgeMixinItemColors",
"client.ForgeMixinElytraLayer"
]
}