unify tabs (this will make the merge about 1000x easier)

This commit is contained in:
yrsegal@gmail.com 2022-11-05 21:16:22 -04:00
parent 7db77e8bc5
commit 63495a423f
25 changed files with 305 additions and 305 deletions

View file

@ -1,7 +1,7 @@
package at.petrak.hexcasting.api.misc;
public final class ManaConstants {
public static final int DUST_UNIT = 10000;
public static final int SHARD_UNIT = 5 * DUST_UNIT;
public static final int CRYSTAL_UNIT = 10 * DUST_UNIT;
public static final int DUST_UNIT = 10000;
public static final int SHARD_UNIT = 5 * DUST_UNIT;
public static final int CRYSTAL_UNIT = 10 * DUST_UNIT;
}

View file

@ -6,19 +6,19 @@ import org.jetbrains.annotations.Nullable;
import static at.petrak.hexcasting.api.HexAPI.modLoc;
public enum ScrollQuantity {
NONE(null),
FEW(modLoc("inject/scroll_loot_few")),
SOME(modLoc("inject/scroll_loot_some")),
MANY(modLoc("inject/scroll_loot_many"));
NONE(null),
FEW(modLoc("inject/scroll_loot_few")),
SOME(modLoc("inject/scroll_loot_some")),
MANY(modLoc("inject/scroll_loot_many"));
private final ResourceLocation pool;
private final ResourceLocation pool;
ScrollQuantity(ResourceLocation pool) {
this.pool = pool;
}
ScrollQuantity(ResourceLocation pool) {
this.pool = pool;
}
@Nullable
public ResourceLocation getPool() {
return pool;
}
@Nullable
public ResourceLocation getPool() {
return pool;
}
}

View file

@ -14,38 +14,38 @@ import java.util.function.Function;
@ApiStatus.Internal
public final class HexApiMessages {
private static SimpleChannel channel;
private static Function<Sentinel, Object> sentinelMessage;
private static Function<FrozenColorizer, Object> colorizerMessage;
private static BiFunction<ParticleSpray, FrozenColorizer, Object> particleSprayMessage;
private static SimpleChannel channel;
private static Function<Sentinel, Object> sentinelMessage;
private static Function<FrozenColorizer, Object> colorizerMessage;
private static BiFunction<ParticleSpray, FrozenColorizer, Object> particleSprayMessage;
public static void setSyncChannel(SimpleChannel channel,
Function<Sentinel, Object> sentinelMessage,
Function<FrozenColorizer, Object> colorizerMessage,
BiFunction<ParticleSpray, FrozenColorizer, Object> particleSprayMessage) {
if (HexApiMessages.channel != null)
throw new IllegalStateException("Already set sync channel! If you're not Hex, you shouldn't be calling this.");
HexApiMessages.channel = channel;
HexApiMessages.sentinelMessage = sentinelMessage;
HexApiMessages.colorizerMessage = colorizerMessage;
HexApiMessages.particleSprayMessage = particleSprayMessage;
}
public static void setSyncChannel(SimpleChannel channel,
Function<Sentinel, Object> sentinelMessage,
Function<FrozenColorizer, Object> colorizerMessage,
BiFunction<ParticleSpray, FrozenColorizer, Object> particleSprayMessage) {
if (HexApiMessages.channel != null)
throw new IllegalStateException("Already set sync channel! If you're not Hex, you shouldn't be calling this.");
HexApiMessages.channel = channel;
HexApiMessages.sentinelMessage = sentinelMessage;
HexApiMessages.colorizerMessage = colorizerMessage;
HexApiMessages.particleSprayMessage = particleSprayMessage;
}
public static SimpleChannel getChannel() {
return channel;
}
public static SimpleChannel getChannel() {
return channel;
}
public static Object getColorizerMessage(FrozenColorizer colorizer) {
return colorizerMessage.apply(colorizer);
}
public static Object getColorizerMessage(FrozenColorizer colorizer) {
return colorizerMessage.apply(colorizer);
}
public static Object getSentinelMessage(Sentinel colorizer) {
return sentinelMessage.apply(colorizer);
}
public static Object getSentinelMessage(Sentinel colorizer) {
return sentinelMessage.apply(colorizer);
}
public static Object getParticleSprayMessage(ParticleSpray spray, FrozenColorizer colorizer) {
return particleSprayMessage.apply(spray, colorizer);
}
public static Object getParticleSprayMessage(ParticleSpray spray, FrozenColorizer colorizer) {
return particleSprayMessage.apply(spray, colorizer);
}
}
*/

View file

@ -5,7 +5,7 @@ import net.minecraft.world.level.Level;
import net.minecraft.world.phys.Vec3;
public record FlightAbility(boolean allowed, int timeLeft, ResourceKey<Level> dimension, Vec3 origin, double radius) {
public static FlightAbility deny() {
return new FlightAbility(false, 0, Level.OVERWORLD, Vec3.ZERO, 0);
}
public static FlightAbility deny() {
return new FlightAbility(false, 0, Level.OVERWORLD, Vec3.ZERO, 0);
}
}

View file

@ -5,10 +5,10 @@ import net.minecraft.world.level.Level;
import net.minecraft.world.phys.Vec3;
public record Sentinel(boolean hasSentinel, boolean extendsRange, Vec3 position,
ResourceKey<Level> dimension) {
public static Sentinel none() {
return new Sentinel(false, false, Vec3.ZERO, Level.OVERWORLD);
}
ResourceKey<Level> dimension) {
public static Sentinel none() {
return new Sentinel(false, false, Vec3.ZERO, Level.OVERWORLD);
}
}

View file

@ -15,18 +15,18 @@ import java.util.function.Function;
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.CompositeState state = ((AccessorCompositeRenderType) renderType).hex$state();
RenderStateShard.EmptyTextureStateShard shard = state.textureState;
Optional<ResourceLocation> texture = ((AccessorEmptyTextureStateShard) shard).hex$cutoutTexture();
if (texture.isPresent()) {
return parent.getBuffer(mapper.apply(texture.get()));
}
}
return parent.getBuffer(renderType);
}
@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.CompositeState state = ((AccessorCompositeRenderType) renderType).hex$state();
RenderStateShard.EmptyTextureStateShard shard = state.textureState;
Optional<ResourceLocation> texture = ((AccessorEmptyTextureStateShard) shard).hex$cutoutTexture();
if (texture.isPresent()) {
return parent.getBuffer(mapper.apply(texture.get()));
}
}
return parent.getBuffer(renderType);
}
}

View file

@ -13,31 +13,31 @@ 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) {
super(string, vertexFormat, mode, i, bl, bl2, runnable, runnable2);
throw new UnsupportedOperationException("Should not be instantiated");
}
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) {
return AccessorRenderType.hex$create(name, format, mode, bufSize, hasCrumbling, sortOnUpload, glState);
}
private static RenderType makeLayer(String name, VertexFormat format, VertexFormat.Mode mode,
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);
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);
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) {
return GRAYSCALE_PROVIDER.apply(texture);
}
public static RenderType getGrayscaleLayer(ResourceLocation texture) {
return GRAYSCALE_PROVIDER.apply(texture);
}
}

View file

@ -10,16 +10,16 @@ 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 {
registrations.accept(Pair.of(
new ShaderInstance(resourceManager, "hexcasting__grayscale", DefaultVertexFormat.NEW_ENTITY),
inst -> grayscale = inst)
);
}
private static ShaderInstance grayscale;
public static void init(ResourceManager resourceManager,
Consumer<Pair<ShaderInstance, Consumer<ShaderInstance>>> registrations) throws IOException {
registrations.accept(Pair.of(
new ShaderInstance(resourceManager, "hexcasting__grayscale", DefaultVertexFormat.NEW_ENTITY),
inst -> grayscale = inst)
);
}
public static ShaderInstance grayscale() {
return grayscale;
}
public static ShaderInstance grayscale() {
return grayscale;
}
}

View file

@ -9,28 +9,28 @@ import java.util.Map;
import java.util.WeakHashMap;
public final class PlayerPositionRecorder {
private static final Map<Player, Vec3> LAST_SECOND_POSITION_MAP = new WeakHashMap<>();
private static final Map<Player, Vec3> LAST_POSITION_MAP = new WeakHashMap<>();
private static final Map<Player, Vec3> LAST_SECOND_POSITION_MAP = new WeakHashMap<>();
private static final Map<Player, Vec3> LAST_POSITION_MAP = new WeakHashMap<>();
public static void updateAllPlayers(ServerLevel world) {
for (ServerPlayer player : world.players()) {
var prev = LAST_POSITION_MAP.get(player);
if (prev != null)
LAST_SECOND_POSITION_MAP.put(player, prev);
LAST_POSITION_MAP.put(player, player.position());
}
}
public static void updateAllPlayers(ServerLevel world) {
for (ServerPlayer player : world.players()) {
var prev = LAST_POSITION_MAP.get(player);
if (prev != null)
LAST_SECOND_POSITION_MAP.put(player, prev);
LAST_POSITION_MAP.put(player, player.position());
}
}
public static Vec3 getMotion(ServerPlayer player) {
Vec3 vec = LAST_POSITION_MAP.get(player);
Vec3 prev = LAST_SECOND_POSITION_MAP.get(player);
public static Vec3 getMotion(ServerPlayer player) {
Vec3 vec = LAST_POSITION_MAP.get(player);
Vec3 prev = LAST_SECOND_POSITION_MAP.get(player);
if (vec == null)
return Vec3.ZERO;
if (vec == null)
return Vec3.ZERO;
if (prev == null)
return player.position().subtract(vec);
if (prev == null)
return player.position().subtract(vec);
return vec.subtract(prev);
}
return vec.subtract(prev);
}
}

View file

@ -25,7 +25,7 @@ public class ManualPatternComponent extends AbstractPatternComponent {
protected transient boolean strokeOrder;
@Override
public List<Pair<HexPattern, HexCoord>> getPatterns(UnaryOperator<IVariable> lookup) {
public List<Pair<HexPattern, HexCoord>> getPatterns(UnaryOperator<IVariable> lookup) {
this.strokeOrder = lookup.apply(IVariable.wrap(this.strokeOrderRaw)).asBoolean(true);
var patsRaw = lookup.apply(IVariable.wrap(patternsRaw)).asListOrSingleton();

View file

@ -7,9 +7,9 @@ import org.spongepowered.asm.mixin.gen.Invoker;
@Mixin(Villager.class)
public interface AccessorVillager {
@Invoker("tellWitnessesThatIWasMurdered")
void hex$tellWitnessesThatIWasMurdered(Entity murderer);
@Invoker("tellWitnessesThatIWasMurdered")
void hex$tellWitnessesThatIWasMurdered(Entity murderer);
@Invoker("releaseAllPois")
void hex$releaseAllPois();
@Invoker("releaseAllPois")
void hex$releaseAllPois();
}

View file

@ -6,6 +6,6 @@ import org.spongepowered.asm.mixin.gen.Invoker;
@Mixin(RenderType.CompositeRenderType.class)
public interface AccessorCompositeRenderType {
@Invoker("state")
RenderType.CompositeState hex$state();
@Invoker("state")
RenderType.CompositeState hex$state();
}

View file

@ -9,6 +9,6 @@ import java.util.Optional;
@Mixin(RenderStateShard.EmptyTextureStateShard.class)
public interface AccessorEmptyTextureStateShard {
@Invoker("cutoutTexture")
Optional<ResourceLocation> hex$cutoutTexture();
@Invoker("cutoutTexture")
Optional<ResourceLocation> hex$cutoutTexture();
}

View file

@ -6,9 +6,9 @@ import org.spongepowered.asm.mixin.gen.Accessor;
@Mixin(MouseHandler.class)
public interface AccessorMouseHandler {
@Accessor("accumulatedScroll")
double hex$getAccumulatedScroll();
@Accessor("accumulatedScroll")
double hex$getAccumulatedScroll();
@Accessor("accumulatedScroll")
void hex$setAccumulatedScroll(double scroll);
@Accessor("accumulatedScroll")
void hex$setAccumulatedScroll(double scroll);
}

View file

@ -6,6 +6,6 @@ import org.spongepowered.asm.mixin.gen.Accessor;
@Mixin(RenderStateShard.class)
public interface AccessorRenderStateShard {
@Accessor("name")
String hex$name();
@Accessor("name")
String hex$name();
}

View file

@ -8,10 +8,10 @@ import org.spongepowered.asm.mixin.gen.Invoker;
// https://github.com/VazkiiMods/Botania/blob/13b7bcd9cbb6b1a418b0afe455662d29b46f1a7f/Xplat/src/main/java/vazkii/botania/mixin/client/AccessorRenderType.java
@Mixin(RenderType.class)
public interface AccessorRenderType {
@Invoker("create")
static RenderType.CompositeRenderType hex$create(String string, VertexFormat vertexFormat,
VertexFormat.Mode mode, int bufSize, boolean hasCrumbling, boolean sortOnUpload,
RenderType.CompositeState compositeState) {
throw new IllegalStateException();
}
@Invoker("create")
static RenderType.CompositeRenderType hex$create(String string, VertexFormat vertexFormat,
VertexFormat.Mode mode, int bufSize, boolean hasCrumbling, boolean sortOnUpload,
RenderType.CompositeState compositeState) {
throw new IllegalStateException();
}
}

View file

@ -11,11 +11,11 @@ import net.minecraft.world.level.block.state.BlockState;
* Fabric implementation will use mixins to achieve the same effects.
*/
public interface IForgeLikeBlock {
default boolean addLandingEffects(BlockState state, ServerLevel level, BlockPos pos, LivingEntity entity, int numberOfParticles) {
return false;
}
default boolean addLandingEffects(BlockState state, ServerLevel level, BlockPos pos, LivingEntity entity, int numberOfParticles) {
return false;
}
default boolean hasEnchantPowerBonus(BlockState state, LevelReader level, BlockPos pos) {
return false;
}
default boolean hasEnchantPowerBonus(BlockState state, LevelReader level, BlockPos pos) {
return false;
}
}

View file

@ -13,49 +13,49 @@ import java.util.List;
import static at.petrak.hexcasting.api.HexAPI.modLoc;
public record EmiBrainsweepRecipe(EmiIngredient blockInput,
EmiIngredient villagerInput,
EmiStack output,
ResourceLocation id) implements EmiRecipe {
private static final ResourceLocation OVERLAY = modLoc("textures/gui/brainsweep_jei.png");
EmiIngredient villagerInput,
EmiStack output,
ResourceLocation id) implements EmiRecipe {
private static final ResourceLocation OVERLAY = modLoc("textures/gui/brainsweep_jei.png");
@Override
public EmiRecipeCategory getCategory() {
return HexEMIPlugin.BRAINSWEEP;
}
@Override
public EmiRecipeCategory getCategory() {
return HexEMIPlugin.BRAINSWEEP;
}
@Override
public @Nullable ResourceLocation getId() {
return id;
}
@Override
public @Nullable ResourceLocation getId() {
return id;
}
@Override
public List<EmiIngredient> getInputs() {
return List.of(blockInput, villagerInput);
}
@Override
public List<EmiIngredient> getInputs() {
return List.of(blockInput, villagerInput);
}
@Override
public List<EmiStack> getOutputs() {
return List.of(output);
}
@Override
public List<EmiStack> getOutputs() {
return List.of(output);
}
@Override
public int getDisplayWidth() {
return 118;
}
@Override
public int getDisplayWidth() {
return 118;
}
@Override
public int getDisplayHeight() {
return 85;
}
@Override
public int getDisplayHeight() {
return 85;
}
@Override
public void addWidgets(WidgetHolder widgets) {
widgets.addTexture(OVERLAY, 0, 0, 118, 85, 0, 0, 118, 85, 128, 128);
widgets.addSlot(blockInput, 11, 34).drawBack(false).custom(null, 0, 0, 19, 19);
@Override
public void addWidgets(WidgetHolder widgets) {
widgets.addTexture(OVERLAY, 0, 0, 118, 85, 0, 0, 118, 85, 128, 128);
widgets.addSlot(blockInput, 11, 34).drawBack(false).custom(null, 0, 0, 19, 19);
widgets.add(new TheCoolerSlotWidget(villagerInput, 37, 19, 2.75f).useOffset(false).customShift(-8.5f, 2.485f))
.drawBack(false).custom(null, 0, 0, 27, 49);
widgets.add(new TheCoolerSlotWidget(villagerInput, 37, 19, 2.75f).useOffset(false).customShift(-8.5f, 2.485f))
.drawBack(false).custom(null, 0, 0, 27, 49);
widgets.addSlot(output, 86, 34).drawBack(false).output(true).recipeContext(this).custom(null, 0, 0, 19, 19);
}
widgets.addSlot(output, 86, 34).drawBack(false).output(true).recipeContext(this).custom(null, 0, 0, 19, 19);
}
}

View file

@ -9,17 +9,17 @@ import net.minecraft.world.item.Items;
import java.util.List;
public class EmiLevelupRecipe extends EmiVillagerRecipe {
public EmiLevelupRecipe(EmiIngredient input, VillagerEmiStack result, ResourceLocation id) {
super(input, EmiStack.of(Items.EMERALD), result, id, false);
}
public EmiLevelupRecipe(EmiIngredient input, VillagerEmiStack result, ResourceLocation id) {
super(input, EmiStack.of(Items.EMERALD), result, id, false);
}
@Override
public List<EmiIngredient> getInputs() {
return List.of(input);
}
@Override
public List<EmiIngredient> getInputs() {
return List.of(input);
}
@Override
public EmiRecipeCategory getCategory() {
return HexEMIPlugin.VILLAGER_LEVELING;
}
@Override
public EmiRecipeCategory getCategory() {
return HexEMIPlugin.VILLAGER_LEVELING;
}
}

View file

@ -5,12 +5,12 @@ import dev.emi.emi.api.stack.EmiIngredient;
import net.minecraft.resources.ResourceLocation;
public class EmiProfessionRecipe extends EmiVillagerRecipe {
public EmiProfessionRecipe(EmiIngredient input, EmiIngredient catalyst, VillagerEmiStack result, ResourceLocation id) {
super(input, catalyst, result, id);
}
public EmiProfessionRecipe(EmiIngredient input, EmiIngredient catalyst, VillagerEmiStack result, ResourceLocation id) {
super(input, catalyst, result, id);
}
@Override
public EmiRecipeCategory getCategory() {
return HexEMIPlugin.VILLAGER_PROFESSION;
}
@Override
public EmiRecipeCategory getCategory() {
return HexEMIPlugin.VILLAGER_PROFESSION;
}
}

View file

@ -12,60 +12,60 @@ import java.util.List;
// Mostly copypasta from EmiWorldRecipe, to avoid depending on impl
public abstract class EmiVillagerRecipe implements EmiRecipe {
protected final boolean isCatalyst;
protected final ResourceLocation id;
protected final EmiIngredient input;
protected final EmiIngredient catalyst;
protected final EmiStack result;
protected final boolean isCatalyst;
protected final ResourceLocation id;
protected final EmiIngredient input;
protected final EmiIngredient catalyst;
protected final EmiStack result;
public EmiVillagerRecipe(EmiIngredient input, EmiIngredient catalyst, VillagerEmiStack result, ResourceLocation id) {
this(input, catalyst, result, id, true);
}
public EmiVillagerRecipe(EmiIngredient input, EmiIngredient catalyst, VillagerEmiStack result, ResourceLocation id) {
this(input, catalyst, result, id, true);
}
public EmiVillagerRecipe(EmiIngredient input, EmiIngredient catalyst, VillagerEmiStack result, ResourceLocation id, boolean isCatalyst) {
this.isCatalyst = isCatalyst;
this.input = input;
this.catalyst = catalyst;
this.result = result;
this.id = id;
if (isCatalyst) {
for (EmiStack stack : catalyst.getEmiStacks()) {
stack.setRemainder(stack);
}
}
public EmiVillagerRecipe(EmiIngredient input, EmiIngredient catalyst, VillagerEmiStack result, ResourceLocation id, boolean isCatalyst) {
this.isCatalyst = isCatalyst;
this.input = input;
this.catalyst = catalyst;
this.result = result;
this.id = id;
if (isCatalyst) {
for (EmiStack stack : catalyst.getEmiStacks()) {
stack.setRemainder(stack);
}
}
}
}
@Nullable
public ResourceLocation getId() {
return this.id;
}
@Nullable
public ResourceLocation getId() {
return this.id;
}
public List<EmiIngredient> getInputs() {
return this.isCatalyst ? List.of(this.input) : List.of(this.input, this.catalyst);
}
public List<EmiIngredient> getInputs() {
return this.isCatalyst ? List.of(this.input) : List.of(this.input, this.catalyst);
}
public List<EmiIngredient> getCatalysts() {
return this.isCatalyst ? List.of(this.catalyst) : List.of();
}
public List<EmiIngredient> getCatalysts() {
return this.isCatalyst ? List.of(this.catalyst) : List.of();
}
public List<EmiStack> getOutputs() {
return List.of(this.result);
}
public List<EmiStack> getOutputs() {
return List.of(this.result);
}
public int getDisplayWidth() {
return 125;
}
public int getDisplayWidth() {
return 125;
}
public int getDisplayHeight() {
return 18;
}
public int getDisplayHeight() {
return 18;
}
public void addWidgets(WidgetHolder widgets) {
widgets.addTexture(EmiTexture.PLUS, 27, 3);
widgets.addTexture(EmiTexture.EMPTY_ARROW, 75, 1);
widgets.addSlot(this.input, 0, 0);
widgets.addSlot(this.catalyst, 49, 0).catalyst(this.isCatalyst);
widgets.addSlot(this.result, 107, 0).recipeContext(this);
}
public void addWidgets(WidgetHolder widgets) {
widgets.addTexture(EmiTexture.PLUS, 27, 3);
widgets.addTexture(EmiTexture.EMPTY_ARROW, 75, 1);
widgets.addSlot(this.input, 0, 0);
widgets.addSlot(this.catalyst, 49, 0).catalyst(this.isCatalyst);
widgets.addSlot(this.result, 107, 0).recipeContext(this);
}
}

View file

@ -3,5 +3,5 @@ package at.petrak.hexcasting.fabric.interop.emi;
import at.petrak.hexcasting.common.recipe.ingredient.VillagerIngredient;
public record VillagerVariant(VillagerIngredient ingredient, boolean mindless) {
// NO-OP
// NO-OP
}

View file

@ -19,20 +19,20 @@ import java.util.function.Consumer;
// https://github.com/VazkiiMods/Botania/blob/b1f1cf80e10b1c739b0188171b367d9cefc4d3c7/Fabric/src/main/java/vazkii/botania/fabric/mixin/client/FabricMixinGameRenderer.java
@Mixin(GameRenderer.class)
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
)
private void loadShaders(ResourceManager resourceManager, CallbackInfo ci,
List<Program> _programsToClose,
List<Pair<ShaderInstance, Consumer<ShaderInstance>>> shadersToLoad)
throws IOException {
HexShaders.init(resourceManager, shadersToLoad::add);
}
@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
)
private void loadShaders(ResourceManager resourceManager, CallbackInfo ci,
List<Program> _programsToClose,
List<Pair<ShaderInstance, Consumer<ShaderInstance>>> shadersToLoad)
throws IOException {
HexShaders.init(resourceManager, shadersToLoad::add);
}
}

View file

@ -16,15 +16,15 @@ import java.util.List;
@Mixin(ParticleEngine.class)
public class FabricParticleEngineMixin {
@Mutable
@Final
@Shadow
private static List<ParticleRenderType> RENDER_ORDER;
@Mutable
@Final
@Shadow
private static List<ParticleRenderType> RENDER_ORDER;
@Inject(at = @At("RETURN"), method = "<clinit>")
private static void addTypes(CallbackInfo ci) {
RENDER_ORDER = ImmutableList.<ParticleRenderType>builder().addAll(RENDER_ORDER)
.add(ConjureParticle.CONJURE_RENDER_TYPE, ConjureParticle.LIGHT_RENDER_TYPE)
.build();
}
@Inject(at = @At("RETURN"), method = "<clinit>")
private static void addTypes(CallbackInfo ci) {
RENDER_ORDER = ImmutableList.<ParticleRenderType>builder().addAll(RENDER_ORDER)
.add(ConjureParticle.CONJURE_RENDER_TYPE, ConjureParticle.LIGHT_RENDER_TYPE)
.build();
}
}

View file

@ -6,48 +6,48 @@ import net.minecraftforge.items.IItemHandler;
import org.jetbrains.annotations.NotNull;
public record ForgeImpetusCapability(BlockEntityAbstractImpetus impetus) implements IItemHandler {
@Override
public int getSlots() {
return 1;
}
@Override
public int getSlots() {
return 1;
}
@NotNull
@Override
public ItemStack getStackInSlot(int slot) {
return ItemStack.EMPTY;
}
@NotNull
@Override
public ItemStack getStackInSlot(int slot) {
return ItemStack.EMPTY;
}
@NotNull
@Override
public ItemStack insertItem(int slot, @NotNull ItemStack originalStack, boolean simulate) {
if (!isItemValid(slot, originalStack)) {
return originalStack;
}
@NotNull
@Override
public ItemStack insertItem(int slot, @NotNull ItemStack originalStack, boolean simulate) {
if (!isItemValid(slot, originalStack)) {
return originalStack;
}
ItemStack stack = originalStack.copy();
ItemStack stack = originalStack.copy();
if (!simulate) {
impetus.insertMana(stack);
} else {
impetus.extractManaFromItem(stack, false); // Mana goes nowhere, since nothing is actually being done
}
if (!simulate) {
impetus.insertMana(stack);
} else {
impetus.extractManaFromItem(stack, false); // Mana goes nowhere, since nothing is actually being done
}
return stack;
}
return stack;
}
@NotNull
@Override
public ItemStack extractItem(int slot, int amount, boolean simulate) {
return ItemStack.EMPTY;
}
@NotNull
@Override
public ItemStack extractItem(int slot, int amount, boolean simulate) {
return ItemStack.EMPTY;
}
@Override
public int getSlotLimit(int slot) {
return 64;
}
@Override
public int getSlotLimit(int slot) {
return 64;
}
@Override
public boolean isItemValid(int slot, @NotNull ItemStack stack) {
return impetus.canPlaceItem(slot, stack);
}
@Override
public boolean isItemValid(int slot, @NotNull ItemStack stack) {
return impetus.canPlaceItem(slot, stack);
}
}