From 48a948bbdbffc29d7a61d3585cc14c1648cdd2aa Mon Sep 17 00:00:00 2001 From: HyperRaccoon13 Date: Sat, 16 Aug 2025 01:40:57 +0100 Subject: [PATCH 1/2] temp commit nuking local stuff --- gradle.properties | 2 +- .../astraladditions/AstralAdditions.java | 3 + .../AstralAdditionsClient.java | 2 + .../compat/create/ModFanProcessingType.java | 18 +++ .../compat/create/ShimmerTransmuteType.java | 124 ++++++++++++++++++ .../ShimmerFishingBobberEntity.java | 100 +++++++------- .../items/ShimmerBlowerItem.java | 2 +- .../particle/ModParticles.java | 2 + .../particle/ModParticlesClient.java | 2 + .../shimmer/ShimmerBubblePopParticle.java | 53 ++++++++ .../astraladditions/registry/ModData.java | 3 +- .../registry/ModItemProperties.java | 30 ++++- .../astraladditions/registry/ModRecipes.java | 2 +- .../models/item/shimmer_blower.json | 9 +- .../models/item/shimmer_blower_fuming.json | 6 + .../models/item/shimmer_blower_pin_point.json | 6 + .../models/item/shimmer_blower_zooming.json | 6 + .../particles/shimmer_bubble_pop.json | 10 ++ .../textures/item/shimmer_blower_fuming.png | Bin 0 -> 231 bytes .../item/shimmer_blower_pin_point.png | Bin 0 -> 231 bytes .../textures/item/shimmer_blower_zooming.png | Bin 0 -> 231 bytes .../textures/particle/shimmer_bubble.png | Bin 7253 -> 227 bytes .../particle/shimmer_bubble.png.mcmeta | 6 - .../textures/particle/shimmer_bubble1.png | Bin 227 -> 0 bytes .../particle/shimmer_bubble_pop_0.png | Bin 0 -> 223 bytes .../particle/shimmer_bubble_pop_1.png | Bin 0 -> 232 bytes .../particle/shimmer_bubble_pop_2.png | Bin 0 -> 228 bytes .../particle/shimmer_bubble_pop_3.png | Bin 0 -> 223 bytes .../particle/shimmer_bubble_pop_4.png | Bin 0 -> 215 bytes 29 files changed, 324 insertions(+), 62 deletions(-) create mode 100644 src/main/java/com/github/ethanicuss/astraladditions/compat/create/ModFanProcessingType.java create mode 100644 src/main/java/com/github/ethanicuss/astraladditions/compat/create/ShimmerTransmuteType.java create mode 100644 src/main/java/com/github/ethanicuss/astraladditions/particle/shimmer/ShimmerBubblePopParticle.java create mode 100644 src/main/resources/assets/astraladditions/models/item/shimmer_blower_fuming.json create mode 100644 src/main/resources/assets/astraladditions/models/item/shimmer_blower_pin_point.json create mode 100644 src/main/resources/assets/astraladditions/models/item/shimmer_blower_zooming.json create mode 100644 src/main/resources/assets/astraladditions/particles/shimmer_bubble_pop.json create mode 100644 src/main/resources/assets/astraladditions/textures/item/shimmer_blower_fuming.png create mode 100644 src/main/resources/assets/astraladditions/textures/item/shimmer_blower_pin_point.png create mode 100644 src/main/resources/assets/astraladditions/textures/item/shimmer_blower_zooming.png delete mode 100644 src/main/resources/assets/astraladditions/textures/particle/shimmer_bubble.png.mcmeta delete mode 100644 src/main/resources/assets/astraladditions/textures/particle/shimmer_bubble1.png create mode 100644 src/main/resources/assets/astraladditions/textures/particle/shimmer_bubble_pop_0.png create mode 100644 src/main/resources/assets/astraladditions/textures/particle/shimmer_bubble_pop_1.png create mode 100644 src/main/resources/assets/astraladditions/textures/particle/shimmer_bubble_pop_2.png create mode 100644 src/main/resources/assets/astraladditions/textures/particle/shimmer_bubble_pop_3.png create mode 100644 src/main/resources/assets/astraladditions/textures/particle/shimmer_bubble_pop_4.png diff --git a/gradle.properties b/gradle.properties index 3d7789b..0a4b4d5 100644 --- a/gradle.properties +++ b/gradle.properties @@ -23,7 +23,7 @@ org.gradle.jvmargs=-Xmx2G # Development QOL modmenu_version=3.2.5 - rei_version=8.3.588 + rei_version=8.3.594 # yttr yttr_version = 7.626+1.18.2 diff --git a/src/main/java/com/github/ethanicuss/astraladditions/AstralAdditions.java b/src/main/java/com/github/ethanicuss/astraladditions/AstralAdditions.java index 3165d97..5ed720d 100644 --- a/src/main/java/com/github/ethanicuss/astraladditions/AstralAdditions.java +++ b/src/main/java/com/github/ethanicuss/astraladditions/AstralAdditions.java @@ -1,5 +1,6 @@ package com.github.ethanicuss.astraladditions; +import com.github.ethanicuss.astraladditions.compat.create.ModFanProcessingType; import com.github.ethanicuss.astraladditions.entities.ModEntities; import com.github.ethanicuss.astraladditions.fluids.ModFluids; import com.github.ethanicuss.astraladditions.particle.ModParticles; @@ -29,6 +30,8 @@ public void onInitialize() { ModEffects.registerEffects(); ModParticles.registerParticles(); + ModFanProcessingType.register(); + LOGGER.info("Astral Additions is active!"); } } \ No newline at end of file diff --git a/src/main/java/com/github/ethanicuss/astraladditions/AstralAdditionsClient.java b/src/main/java/com/github/ethanicuss/astraladditions/AstralAdditionsClient.java index 27b2dcd..c1ba94d 100644 --- a/src/main/java/com/github/ethanicuss/astraladditions/AstralAdditionsClient.java +++ b/src/main/java/com/github/ethanicuss/astraladditions/AstralAdditionsClient.java @@ -46,5 +46,7 @@ public void onInitializeClient() { ModParticlesClient.registerFactories(); ModItemProperties.register(); + } + } \ No newline at end of file diff --git a/src/main/java/com/github/ethanicuss/astraladditions/compat/create/ModFanProcessingType.java b/src/main/java/com/github/ethanicuss/astraladditions/compat/create/ModFanProcessingType.java new file mode 100644 index 0000000..5f619cd --- /dev/null +++ b/src/main/java/com/github/ethanicuss/astraladditions/compat/create/ModFanProcessingType.java @@ -0,0 +1,18 @@ +package com.github.ethanicuss.astraladditions.compat.create; + +import com.github.ethanicuss.astraladditions.AstralAdditions; +import com.simibubi.create.content.kinetics.fan.processing.FanProcessingType; +import com.simibubi.create.content.kinetics.fan.processing.FanProcessingTypeRegistry; +import net.minecraft.util.Identifier; + +public class ModFanProcessingType { + public static final ShimmerTransmuteType SHIMMER_TRANSMUTE = + register("shimmer_transmute", new ShimmerTransmuteType()); + + private static T register(String name, T type) { + FanProcessingTypeRegistry.register(new Identifier(AstralAdditions.MOD_ID, name), type); + return type; + } + + public static void register() {} +} \ No newline at end of file diff --git a/src/main/java/com/github/ethanicuss/astraladditions/compat/create/ShimmerTransmuteType.java b/src/main/java/com/github/ethanicuss/astraladditions/compat/create/ShimmerTransmuteType.java new file mode 100644 index 0000000..b8a435b --- /dev/null +++ b/src/main/java/com/github/ethanicuss/astraladditions/compat/create/ShimmerTransmuteType.java @@ -0,0 +1,124 @@ +package com.github.ethanicuss.astraladditions.compat.create; + +import com.github.ethanicuss.astraladditions.fluids.ModFluids; +import com.github.ethanicuss.astraladditions.particle.ModParticles; +import com.github.ethanicuss.astraladditions.recipes.TransmuteRecipe; +import com.jozufozu.flywheel.util.Color; +import com.simibubi.create.content.kinetics.fan.processing.FanProcessingType; +import dev.architectury.platform.Mod; +import net.minecraft.entity.Entity; +import net.minecraft.entity.LivingEntity; +import net.minecraft.entity.effect.StatusEffectInstance; +import net.minecraft.entity.effect.StatusEffects; +import net.minecraft.entity.player.PlayerEntity; +import net.minecraft.fluid.FluidState; +import net.minecraft.item.ItemStack; +import net.minecraft.particle.ParticleTypes; +import net.minecraft.util.math.BlockPos; +import net.minecraft.util.math.Vec3d; +import net.minecraft.world.World; +import org.jetbrains.annotations.Nullable; + +import java.util.ArrayList; +import java.util.List; +import java.util.Optional; +import java.util.Random; + +public class ShimmerTransmuteType implements FanProcessingType { + + @Override + public int getPriority() { + return 450; + } + + @Override + public boolean isValidAt(World world, BlockPos pos) { + FluidState fluid = world.getFluidState(pos); + return fluid.isStill() && fluid.getFluid() == ModFluids.STILL_SHIMMER || fluid.getFluid() == ModFluids.FLOWING_SHIMMER; + } + + @Override + public boolean canProcess(ItemStack stack, World world) { + return world.getRecipeManager() + .listAllOfType(TransmuteRecipe.Type.INSTANCE) + .stream() + .map(r -> (TransmuteRecipe) r) + .anyMatch(r -> matchesRecipeInput(stack, r)); + } + + @Override + @Nullable + public List process(ItemStack stack, World world) { + Optional recipeOpt = world.getRecipeManager() + .listAllOfType(TransmuteRecipe.Type.INSTANCE) + .stream() + .map(r -> (TransmuteRecipe) r) + .filter(r -> matchesRecipeInput(stack, r)) + .findFirst(); + + if (recipeOpt.isEmpty()) return null; + + TransmuteRecipe recipe = recipeOpt.get(); + ItemStack required = recipe.getInputItem(); + + int multiplier = 1; + + if (!recipe.isIgnoreCount()) { + if (recipe.isSoftIgnoreCount()) { + multiplier = stack.getCount() / required.getCount(); + } else { + if (stack.getCount() != required.getCount()) return null; + } + } + + List result = new ArrayList<>(); + for (ItemStack output : recipe.getOutputItems()) { + ItemStack out = output.copy(); + out.setCount(out.getCount() * multiplier); + result.add(out); + } + + return result; + } + + private boolean matchesRecipeInput(ItemStack stack, TransmuteRecipe recipe) { + ItemStack required = recipe.getInputItem(); + + if (recipe.isIgnoreCount()) { + return stack.getItem() == required.getItem(); + } else if (recipe.isSoftIgnoreCount()) { + return stack.getItem() == required.getItem() + && stack.getCount() >= required.getCount(); + } else { + return stack.getItem() == required.getItem() + && stack.getCount() == required.getCount(); + } + } + + @Override + public void spawnProcessingParticles(World world, Vec3d pos) { + if (world.random.nextInt(6) != 0) return; + world.addParticle(ParticleTypes.ENCHANT, pos.x, pos.y + .3, pos.z, 0, .1, 0); + } + + + @Override + public void morphAirFlow(AirFlowParticleAccess particleAccess, Random random) { + particleAccess.setColor(Color.mixColors(0xf543bc, 0xf993c5, random.nextFloat())); + particleAccess.setAlpha(0.75f); + if (random.nextFloat() < 1 / 128f) + particleAccess.spawnExtraParticle(ModParticles.SHIMMER_BUBBLE, .125f); + if (random.nextFloat() < 1 / 128f) + particleAccess.spawnExtraParticle(ModParticles.SHIMMER_BUBBLE_POP, .125f); + } + + + @Override + public void affectEntity(Entity entity, World world) { + if (!(entity instanceof LivingEntity living)) return; + living.addStatusEffect(new StatusEffectInstance(StatusEffects.GLOWING, 60, 0, false, false)); + living.addStatusEffect(new StatusEffectInstance(StatusEffects.NIGHT_VISION, 330, 0, false, false)); + + + } +} \ No newline at end of file diff --git a/src/main/java/com/github/ethanicuss/astraladditions/entities/shimmerfishingrod/ShimmerFishingBobberEntity.java b/src/main/java/com/github/ethanicuss/astraladditions/entities/shimmerfishingrod/ShimmerFishingBobberEntity.java index 1a4988d..1bb10a3 100644 --- a/src/main/java/com/github/ethanicuss/astraladditions/entities/shimmerfishingrod/ShimmerFishingBobberEntity.java +++ b/src/main/java/com/github/ethanicuss/astraladditions/entities/shimmerfishingrod/ShimmerFishingBobberEntity.java @@ -45,8 +45,8 @@ public ShimmerFishingBobberEntity(PlayerEntity player, World world, int luckOfTh this.setOwner(player); - ((FishingBobberEntityAccessor)(Object)this).setLuckOfTheSeaLevel(Math.max(0, luckOfTheSeaLevel)); - ((FishingBobberEntityAccessor)(Object)this).setLureLevel(Math.max(0, lureLevel)); + ((FishingBobberEntityAccessor) this).setLuckOfTheSeaLevel(Math.max(0, luckOfTheSeaLevel)); + ((FishingBobberEntityAccessor) this).setLureLevel(Math.max(0, lureLevel)); float f = player.getPitch(); float g = player.getYaw(); @@ -58,7 +58,7 @@ public ShimmerFishingBobberEntity(PlayerEntity player, World world, int luckOfTh double e = player.getEyeY(); double l = player.getZ() - (double)h * 0.3; this.refreshPositionAndAngles(d, e, l, g, f); - Vec3d vec3d = new Vec3d((double)(-i), (double)MathHelper.clamp(-(k / j), -5.0F, 5.0F), (double)(-h)); + Vec3d vec3d = new Vec3d(-i, MathHelper.clamp(-(k / j), -5.0F, 5.0F), -h); double m = vec3d.length(); vec3d = vec3d.multiply(0.6 / m + (double)0.5F + this.random.nextGaussian() * 0.0045, 0.6 / m + (double)0.5F + this.random.nextGaussian() * 0.0045, 0.6 / m + (double)0.5F + this.random.nextGaussian() * 0.0045); this.setVelocity(vec3d); @@ -85,7 +85,7 @@ public void tick() { return; } - FishingBobberEntityAccessor accessor = (FishingBobberEntityAccessor)(Object)this; + FishingBobberEntityAccessor accessor = (FishingBobberEntityAccessor) this; Object currentState = FishingBobberStateHelper.getState(this); String stateName = ((Enum)currentState).name(); @@ -109,57 +109,61 @@ public void tick() { boolean isInWater = fluidHeight > 0.0F; - if (stateName.equals("FLYING")) { - if (accessor.getHookedEntity() != null) { - this.setVelocity(Vec3d.ZERO); - FishingBobberStateHelper.setState(this, getEnumStateByName("HOOKED_IN_ENTITY")); - return; - } - - if (isInWater) { - this.setVelocity(this.getVelocity().multiply(0.3, 0.2, 0.3)); - FishingBobberStateHelper.setState(this, getEnumStateByName("BOBBING")); - return; - } + switch (stateName) { + case "FLYING" -> { + if (accessor.getHookedEntity() != null) { + this.setVelocity(Vec3d.ZERO); + FishingBobberStateHelper.setState(this, getEnumStateByName("HOOKED_IN_ENTITY")); + return; + } - accessor.callCheckForCollision(); - } else if (stateName.equals("HOOKED_IN_ENTITY")) { - if (accessor.getHookedEntity() != null) { - if (!accessor.getHookedEntity().isRemoved() && accessor.getHookedEntity().world.getRegistryKey() == this.world.getRegistryKey()) { - this.setPosition(accessor.getHookedEntity().getX(), accessor.getHookedEntity().getBodyY(0.8), accessor.getHookedEntity().getZ()); - } else { - accessor.callUpdateHookedEntityId(null); - FishingBobberStateHelper.setState(this, getEnumStateByName("FLYING")); + if (isInWater) { + this.setVelocity(this.getVelocity().multiply(0.3, 0.2, 0.3)); + FishingBobberStateHelper.setState(this, getEnumStateByName("BOBBING")); + return; } - } - return; - } else if (stateName.equals("BOBBING")) { - Vec3d vec3d = this.getVelocity(); - double dy = this.getY() + vec3d.y - (double)blockPos.getY() - (double)fluidHeight; - if (Math.abs(dy) < 0.01) { - dy += Math.signum(dy) * 0.1; + accessor.callCheckForCollision(); } + case "HOOKED_IN_ENTITY" -> { + if (accessor.getHookedEntity() != null) { + if (!accessor.getHookedEntity().isRemoved() && accessor.getHookedEntity().world.getRegistryKey() == this.world.getRegistryKey()) { + this.setPosition(accessor.getHookedEntity().getX(), accessor.getHookedEntity().getBodyY(0.8), accessor.getHookedEntity().getZ()); + } else { + accessor.callUpdateHookedEntityId(null); + FishingBobberStateHelper.setState(this, getEnumStateByName("FLYING")); + } + } + return; + } + case "BOBBING" -> { + Vec3d vec3d = this.getVelocity(); + double dy = this.getY() + vec3d.y - (double) blockPos.getY() - (double) fluidHeight; - this.setVelocity(vec3d.x * 0.9, vec3d.y - dy * (double)this.random.nextFloat() * 0.2, vec3d.z * 0.9); + if (Math.abs(dy) < 0.01) { + dy += Math.signum(dy) * 0.1; + } - if (accessor.getHookCountdown() <= 0 && accessor.getFishTravelCountdown() <= 0) { - accessor.setInOpenWater(true); - } else { - accessor.setInOpenWater(accessor.isInOpenWater() && accessor.getOutOfOpenWaterTicks() < 10 && accessor.callIsOpenOrWaterAround(blockPos)); - } + this.setVelocity(vec3d.x * 0.9, vec3d.y - dy * (double) this.random.nextFloat() * 0.2, vec3d.z * 0.9); - if (isInWater) { - accessor.setOutOfOpenWaterTicks(Math.max(0, accessor.getOutOfOpenWaterTicks() - 1)); - if (accessor.isCaughtFish()) { - this.setVelocity(this.getVelocity().add(0.0, -0.1 * (double)this.velocityRandom.nextFloat() * (double)this.velocityRandom.nextFloat(), 0.0)); + if (accessor.getHookCountdown() <= 0 && accessor.getFishTravelCountdown() <= 0) { + accessor.setInOpenWater(true); + } else { + accessor.setInOpenWater(accessor.isInOpenWater() && accessor.getOutOfOpenWaterTicks() < 10 && accessor.callIsOpenOrWaterAround(blockPos)); } - if (!this.world.isClient) { - accessor.callTickFishingLogic(blockPos); + if (isInWater) { + accessor.setOutOfOpenWaterTicks(Math.max(0, accessor.getOutOfOpenWaterTicks() - 1)); + if (accessor.isCaughtFish()) { + this.setVelocity(this.getVelocity().add(0.0, -0.1 * (double) this.velocityRandom.nextFloat() * (double) this.velocityRandom.nextFloat(), 0.0)); + } + + if (!this.world.isClient) { + accessor.callTickFishingLogic(blockPos); + } + } else { + accessor.setOutOfOpenWaterTicks(Math.min(10, accessor.getOutOfOpenWaterTicks() + 1)); } - } else { - accessor.setOutOfOpenWaterTicks(Math.min(10, accessor.getOutOfOpenWaterTicks() + 1)); } } @@ -185,7 +189,7 @@ public int use(ItemStack usedItem) { PlayerEntity player = this.getPlayerOwner(); if (!this.world.isClient && player != null && this.isStillHoldingFishingRod(player)) { int i = 0; - FishingBobberEntityAccessor accessor = (FishingBobberEntityAccessor)(Object)this; + FishingBobberEntityAccessor accessor = (FishingBobberEntityAccessor) this; if (accessor.getHookedEntity() != null) { this.pullHookedEntity(accessor.getHookedEntity()); @@ -251,7 +255,7 @@ protected void onEntityHit(EntityHitResult entityHitResult) { super.onEntityHit(entityHitResult); if (!this.world.isClient) { - ((FishingBobberEntityAccessor)(Object)this).callUpdateHookedEntityId(entityHitResult.getEntity()); + ((FishingBobberEntityAccessor) this).callUpdateHookedEntityId(entityHitResult.getEntity()); Entity entity = entityHitResult.getEntity(); if (entity instanceof LivingEntity living) { @@ -263,7 +267,7 @@ protected void onEntityHit(EntityHitResult entityHitResult) { @Override public void remove(RemovalReason reason) { - Entity hooked = ((FishingBobberEntityAccessor)(Object)this).getHookedEntity(); + Entity hooked = ((FishingBobberEntityAccessor) this).getHookedEntity(); if (hooked instanceof LivingEntity living) { living.removeStatusEffect(StatusEffects.GLOWING); living.removeStatusEffect(StatusEffects.NIGHT_VISION); diff --git a/src/main/java/com/github/ethanicuss/astraladditions/items/ShimmerBlowerItem.java b/src/main/java/com/github/ethanicuss/astraladditions/items/ShimmerBlowerItem.java index c0e5ddc..3f376cb 100644 --- a/src/main/java/com/github/ethanicuss/astraladditions/items/ShimmerBlowerItem.java +++ b/src/main/java/com/github/ethanicuss/astraladditions/items/ShimmerBlowerItem.java @@ -204,4 +204,4 @@ public void appendTooltip(ItemStack itemStack, @Nullable World world, List } } } -} +} \ No newline at end of file diff --git a/src/main/java/com/github/ethanicuss/astraladditions/particle/ModParticles.java b/src/main/java/com/github/ethanicuss/astraladditions/particle/ModParticles.java index 9440bb4..e101ca9 100644 --- a/src/main/java/com/github/ethanicuss/astraladditions/particle/ModParticles.java +++ b/src/main/java/com/github/ethanicuss/astraladditions/particle/ModParticles.java @@ -10,9 +10,11 @@ public class ModParticles { public static final DefaultParticleType SHIMMER_BUBBLE = FabricParticleTypes.simple(); public static final DefaultParticleType SHIMMER_SPLASH = FabricParticleTypes.simple(); + public static final DefaultParticleType SHIMMER_BUBBLE_POP = FabricParticleTypes.simple(); public static void registerParticles() { Registry.register(Registry.PARTICLE_TYPE, new Identifier(AstralAdditions.MOD_ID, "shimmer_bubble"), SHIMMER_BUBBLE); Registry.register(Registry.PARTICLE_TYPE, new Identifier(AstralAdditions.MOD_ID, "shimmer_splash"), SHIMMER_SPLASH); + Registry.register(Registry.PARTICLE_TYPE, new Identifier(AstralAdditions.MOD_ID, "shimmer_bubble_pop"), SHIMMER_BUBBLE_POP); } } \ No newline at end of file diff --git a/src/main/java/com/github/ethanicuss/astraladditions/particle/ModParticlesClient.java b/src/main/java/com/github/ethanicuss/astraladditions/particle/ModParticlesClient.java index f2a38dc..f115089 100644 --- a/src/main/java/com/github/ethanicuss/astraladditions/particle/ModParticlesClient.java +++ b/src/main/java/com/github/ethanicuss/astraladditions/particle/ModParticlesClient.java @@ -1,6 +1,7 @@ package com.github.ethanicuss.astraladditions.particle; import com.github.ethanicuss.astraladditions.particle.shimmer.ShimmerBubbleParticle; +import com.github.ethanicuss.astraladditions.particle.shimmer.ShimmerBubblePopParticle; import com.github.ethanicuss.astraladditions.particle.shimmer.ShimmerSplashParticle; import net.fabricmc.fabric.api.client.particle.v1.ParticleFactoryRegistry; @@ -9,5 +10,6 @@ public class ModParticlesClient { public static void registerFactories() { ParticleFactoryRegistry.getInstance().register(ModParticles.SHIMMER_BUBBLE, ShimmerBubbleParticle.Factory::new); ParticleFactoryRegistry.getInstance().register(ModParticles.SHIMMER_SPLASH, ShimmerSplashParticle.Factory::new); + ParticleFactoryRegistry.getInstance().register(ModParticles.SHIMMER_BUBBLE_POP, ShimmerBubblePopParticle.Factory::new); } } \ No newline at end of file diff --git a/src/main/java/com/github/ethanicuss/astraladditions/particle/shimmer/ShimmerBubblePopParticle.java b/src/main/java/com/github/ethanicuss/astraladditions/particle/shimmer/ShimmerBubblePopParticle.java new file mode 100644 index 0000000..2a2ebca --- /dev/null +++ b/src/main/java/com/github/ethanicuss/astraladditions/particle/shimmer/ShimmerBubblePopParticle.java @@ -0,0 +1,53 @@ +package com.github.ethanicuss.astraladditions.particle.shimmer; + +import net.fabricmc.api.EnvType; +import net.fabricmc.api.Environment; +import net.minecraft.client.particle.*; +import net.minecraft.client.world.ClientWorld; +import net.minecraft.particle.DefaultParticleType; + +@Environment(EnvType.CLIENT) +public class ShimmerBubblePopParticle extends SpriteBillboardParticle { + private final SpriteProvider spriteProvider; + + ShimmerBubblePopParticle(ClientWorld world, double x, double y, double z, double velocityX, double velocityY, double velocityZ, SpriteProvider spriteProvider) { + super(world, x, y, z); + this.spriteProvider = spriteProvider; + this.maxAge = 5; + this.gravityStrength = 0.008F; + this.velocityX = velocityX; + this.velocityY = velocityY; + this.velocityZ = velocityZ; + this.setSpriteForAge(spriteProvider); + } + + public void tick() { + this.prevPosX = this.x; + this.prevPosY = this.y; + this.prevPosZ = this.z; + if (this.age++ >= this.maxAge) { + this.markDead(); + } else { + this.velocityY -= this.gravityStrength; + this.move(this.velocityX, this.velocityY, this.velocityZ); + this.setSpriteForAge(this.spriteProvider); + } + } + + public ParticleTextureSheet getType() { + return ParticleTextureSheet.PARTICLE_SHEET_OPAQUE; + } + + @Environment(EnvType.CLIENT) + public static class Factory implements ParticleFactory { + private final SpriteProvider spriteProvider; + + public Factory(SpriteProvider spriteProvider) { + this.spriteProvider = spriteProvider; + } + + public Particle createParticle(DefaultParticleType defaultParticleType, ClientWorld clientWorld, double d, double e, double f, double g, double h, double i) { + return new ShimmerBubblePopParticle(clientWorld, d, e, f, g, h, i, this.spriteProvider); + } + } +} \ No newline at end of file diff --git a/src/main/java/com/github/ethanicuss/astraladditions/registry/ModData.java b/src/main/java/com/github/ethanicuss/astraladditions/registry/ModData.java index 5e86e03..a9963a7 100644 --- a/src/main/java/com/github/ethanicuss/astraladditions/registry/ModData.java +++ b/src/main/java/com/github/ethanicuss/astraladditions/registry/ModData.java @@ -13,7 +13,6 @@ public class ModData { public static final TagKey DESIZER_IGNORE_BLOCKS = register("desizer_ignore_blocks"); public static final TagKey DESIZER_CASING_BLOCKS = register("desizer_casing_blocks"); public static final TagKey INGORE_TRANSMUTATION = registerItemKey("ignore_shimmer_transmutation"); - public static final Identifier FRAGILE_ITEM_PARTS = new Identifier(AstralAdditions.MOD_ID, "gameplay/fragile_items/fragile_item"); public static final Identifier FRAGILE_ITEM_PARTS_2 = new Identifier(AstralAdditions.MOD_ID, "gameplay/fragile_items/fragile_item_2"); public static final Identifier FRAGILE_ITEM_PARTS_3 = new Identifier(AstralAdditions.MOD_ID, "gameplay/fragile_items/fragile_item_3"); @@ -24,4 +23,4 @@ private static TagKey register(String id) { private static TagKey registerItemKey(String id) { return TagKey.of(Registry.ITEM_KEY, new Identifier(AstralAdditions.MOD_ID, id)); } -} +} \ No newline at end of file diff --git a/src/main/java/com/github/ethanicuss/astraladditions/registry/ModItemProperties.java b/src/main/java/com/github/ethanicuss/astraladditions/registry/ModItemProperties.java index f6fb03f..e675390 100644 --- a/src/main/java/com/github/ethanicuss/astraladditions/registry/ModItemProperties.java +++ b/src/main/java/com/github/ethanicuss/astraladditions/registry/ModItemProperties.java @@ -5,9 +5,16 @@ import net.minecraft.item.FishingRodItem; import net.minecraft.util.Identifier; + public class ModItemProperties { public static void register() { + registerFishingRodProperties(); + registerShimmerBlowerVariant(); + + } + + private static void registerFishingRodProperties() { ModelPredicateProviderRegistry.register(ModItems.SHIMMER_FISHING_ROD, new Identifier("cast"), (stack, world, entity, seed) -> { if (entity instanceof PlayerEntity player) { boolean usingMainHand = player.getMainHandStack() == stack; @@ -19,4 +26,25 @@ public static void register() { } return 0.0F; }); -}} \ No newline at end of file + } + + private static void registerShimmerBlowerVariant() { + ModelPredicateProviderRegistry.register( + ModItems.SHIMMER_BLOWER, + new Identifier("variant"), + (stack, world, entity, seed) -> { + if (stack.hasNbt() && stack.getNbt() + .contains("Variant")) { + String variant = stack.getNbt().getString("Variant").trim(); + return switch (variant) { + case "Zooming" -> 1.0f; + case "Fuming" -> 0.95f; + case "Pin point" -> 0.65f; + default -> 0.0f; + }; + } + return 0.0f; + } + ); + } +} \ No newline at end of file diff --git a/src/main/java/com/github/ethanicuss/astraladditions/registry/ModRecipes.java b/src/main/java/com/github/ethanicuss/astraladditions/registry/ModRecipes.java index b284f62..3304a52 100644 --- a/src/main/java/com/github/ethanicuss/astraladditions/registry/ModRecipes.java +++ b/src/main/java/com/github/ethanicuss/astraladditions/registry/ModRecipes.java @@ -29,4 +29,4 @@ public static void registerRecipes() { Registry.register(Registry.RECIPE_TYPE, new Identifier(AstralAdditions.MOD_ID, TransmuteRecipe.Type.ID), TransmuteRecipe.Type.INSTANCE); } -} +} \ No newline at end of file diff --git a/src/main/resources/assets/astraladditions/models/item/shimmer_blower.json b/src/main/resources/assets/astraladditions/models/item/shimmer_blower.json index b3e669f..efc435b 100644 --- a/src/main/resources/assets/astraladditions/models/item/shimmer_blower.json +++ b/src/main/resources/assets/astraladditions/models/item/shimmer_blower.json @@ -1,6 +1,11 @@ { - "parent": "minecraft:item/handheld", + "parent": "item/generated", "textures": { "layer0": "astraladditions:item/shimmer_blower" - } + }, + "overrides": [ + { "predicate": { "variant": 0.65 }, "model": "astraladditions:item/shimmer_blower_pin_point" }, + { "predicate": { "variant": 0.95 }, "model": "astraladditions:item/shimmer_blower_fuming" }, + { "predicate": { "variant": 1.0 }, "model": "astraladditions:item/shimmer_blower_zooming" } + ] } \ No newline at end of file diff --git a/src/main/resources/assets/astraladditions/models/item/shimmer_blower_fuming.json b/src/main/resources/assets/astraladditions/models/item/shimmer_blower_fuming.json new file mode 100644 index 0000000..371103c --- /dev/null +++ b/src/main/resources/assets/astraladditions/models/item/shimmer_blower_fuming.json @@ -0,0 +1,6 @@ +{ + "parent": "minecraft:item/handheld", + "textures": { + "layer0": "astraladditions:item/shimmer_blower_fuming" + } +} \ No newline at end of file diff --git a/src/main/resources/assets/astraladditions/models/item/shimmer_blower_pin_point.json b/src/main/resources/assets/astraladditions/models/item/shimmer_blower_pin_point.json new file mode 100644 index 0000000..95bd805 --- /dev/null +++ b/src/main/resources/assets/astraladditions/models/item/shimmer_blower_pin_point.json @@ -0,0 +1,6 @@ +{ + "parent": "minecraft:item/handheld", + "textures": { + "layer0": "astraladditions:item/shimmer_blower_pin_point" + } +} \ No newline at end of file diff --git a/src/main/resources/assets/astraladditions/models/item/shimmer_blower_zooming.json b/src/main/resources/assets/astraladditions/models/item/shimmer_blower_zooming.json new file mode 100644 index 0000000..ec75193 --- /dev/null +++ b/src/main/resources/assets/astraladditions/models/item/shimmer_blower_zooming.json @@ -0,0 +1,6 @@ +{ + "parent": "minecraft:item/handheld", + "textures": { + "layer0": "astraladditions:item/shimmer_blower_zooming" + } +} \ No newline at end of file diff --git a/src/main/resources/assets/astraladditions/particles/shimmer_bubble_pop.json b/src/main/resources/assets/astraladditions/particles/shimmer_bubble_pop.json new file mode 100644 index 0000000..e884615 --- /dev/null +++ b/src/main/resources/assets/astraladditions/particles/shimmer_bubble_pop.json @@ -0,0 +1,10 @@ +{ + "textures": [ + "astraladditions:shimmer_bubble_pop_0", + "astraladditions:shimmer_bubble_pop_1", + "astraladditions:shimmer_bubble_pop_2", + "astraladditions:shimmer_bubble_pop_3", + "astraladditions:shimmer_bubble_pop_4" + ], + "type": "minecraft:particle" +} \ No newline at end of file diff --git a/src/main/resources/assets/astraladditions/textures/item/shimmer_blower_fuming.png b/src/main/resources/assets/astraladditions/textures/item/shimmer_blower_fuming.png new file mode 100644 index 0000000000000000000000000000000000000000..3f49b8151844ae65f49f19411dab92b3559df98c GIT binary patch literal 231 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!63?wyl`GbKJV{wqX6T`Z5GB1G~^#Gp`S0HV_ zSyEv(yYUKX-T$R(H#}u_>N8B$sQbT=;Xe<K1S;h%3GxeO_>Tm1 zSsd2_B|<%29780gw)T089Z=w47HpDw^Y?u8?!XAs-6z}IPXq>sdS2rE?(vi5LCkfA zwx)^F7dIucoV0s)X!q~b+k3+1G@d>CvUR=u%*dN{pV+_7+w!h8)#a(U`6MRG&t;*< QfEF-#y85}Sb4q9e04TCpYXATM literal 0 HcmV?d00001 diff --git a/src/main/resources/assets/astraladditions/textures/item/shimmer_blower_pin_point.png b/src/main/resources/assets/astraladditions/textures/item/shimmer_blower_pin_point.png new file mode 100644 index 0000000000000000000000000000000000000000..fafaa6effbe08635e6f515f1d71e1e6b8a9642d2 GIT binary patch literal 231 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!63?wyl`GbKJV{wqX6T`Z5GB1G~^#Gp`SCE|K zW^VS`#?mW{bpM;H-EflGDakOkyY4?5!+#crb&3r81tc~W$j5I5D&;K+@(X78j|6mC z9M=LRLOop^LnNlQ_IZmPP~cz|Y?6BO_k8s3zzEabC)?Xk1O|tCUgG@j@ss62%yovg zris!QHzl&1w0n1G_wUr(d&1^4o;~}rb-nz|$eVSa*uT!(@~$=2<*B&&BqqzxWueD_ P7BG0a`njxgN@xNAmq1sD literal 0 HcmV?d00001 diff --git a/src/main/resources/assets/astraladditions/textures/item/shimmer_blower_zooming.png b/src/main/resources/assets/astraladditions/textures/item/shimmer_blower_zooming.png new file mode 100644 index 0000000000000000000000000000000000000000..88cc576e3babd2d1eaf3db7b67708537ca2c8663 GIT binary patch literal 231 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!63?wyl`GbKJV{wqX6T`Z5GB1G~^#Gp`S0KGv zQnG`KYlXD*e_h=hYHB-WWTrAO{I9F~&%m&bfnh%b!$tvt#IJ5*K&8ATL4Lsu|KISq~82JAH6#;!gTk^_VyEj!J(d)IKO-RWO)#C zouRF1qV&a0i7Y4W-W}TgJN5RSusMxq&%SJ3FF!N#X5Ak44ofy`glX(f`7zg--xB_Ws zsq_NL;y#)7RkD4j<#vBmxcSw2&-b`>KPMm6=5gP*?8D;Pk1hTm4{W=MWAdx^xW7fp@ zOj0Zz;h6M|2am37SU9qJ-~6E&A$wh}>#a!!|-J!J|=Y78}ylpUZa z1%Qk_0GHnNwXR(gOB6H z35XLa<7wO?fO!?{{($GRrb`P@ABgH3r9{{8VH z+jgCu?Ami}vh|UCKiGb%$j&`imdVI9Kqcfyw*a7kC3E|hR<~?FSubw@z=pp$vZ~B3q;oxiCV*%j$7H;3!=Wi<&Xtxx5s1W1jL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|n5Gbka>Eak7F*P}1f%=1#2L~Q(R{m%yVPPS8V?yW#!wrkG u78)`z7#?Ma>yMS_2P)@FjqptK^<~fkvN?bl1TFy zm0loO+$Yn%O1AH`-0qJGH@`aX`5w3K=j5Z>Jns9JeOO%kvBm%6fo+$U&E6Xwn74%G zQ36n#U`dc)FvEW|ARy|n5GbkR>Eak7F*P|sLA=1IpkP6PV*_(bP0l+XkK D6+%%t literal 0 HcmV?d00001 diff --git a/src/main/resources/assets/astraladditions/textures/particle/shimmer_bubble_pop_2.png b/src/main/resources/assets/astraladditions/textures/particle/shimmer_bubble_pop_2.png new file mode 100644 index 0000000000000000000000000000000000000000..cf24b8b2910e694dc14c5e6295ac91466e25232e GIT binary patch literal 228 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!63?wyl`GbKJV{wqX6T`Z5GB1G~;{cx!S0L>y zm0loO+$Yn%O1AH`-0qJGH@`aX`5w3K=j5Z>Jns9JeOO%kvBm%6fo+$U&E6Xwn74%G zQ36n#U`dc)FvEW|ARy|n5GbkP>Eak7F*P~i0GGuBmSqM41&;)d=ZZ-(+!Ycz(045T zaHgcS*;5Nf2J;4nxTZg4fy zm0loO+$Yn%O1AH`-0qJGH@`aX`5w3K=j5Z>Jns9JeOO%kvBm%6fo+$U&E6Xwn74%G zQ36n#U`dc)FvEW|ARy|n5Gbka>Eak7F*P}Xfss!|h`At1{1|6}gmbOKs>3%NSgiRx uS6DEpOlGie^7xzxRL++g;hE;^%b*2ha{w_2Tne5HqC8#wT-G@yGywo{TT8G2 literal 0 HcmV?d00001 diff --git a/src/main/resources/assets/astraladditions/textures/particle/shimmer_bubble_pop_4.png b/src/main/resources/assets/astraladditions/textures/particle/shimmer_bubble_pop_4.png new file mode 100644 index 0000000000000000000000000000000000000000..a1ff43b3fc07f7235f75141513440eb996a82dbb GIT binary patch literal 215 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!63?wyl`GbKJV{wqX6T`Z5GB1G~;{cx!S0L>y zm0loO+$Yn%O1AH`-0qJGH@`aX`5w3K=j5Z>Jns9JeOO%kvBm%6fo+$U&E6Xwn74%G zQ36n#U`dc)FvEW|ARy|n5GX0_>Eak7F*P~i0GCC8h8N@19z_ld&#MR86qy(#+8Hz+ lPfCadD&tFy@J#ddWzYh$Ie-`hE(K2pQJ$`TF6*2UngA=%N!S1Y literal 0 HcmV?d00001 From 6db93c7458b6f7f3a5b77b5efd2971b97de523e6 Mon Sep 17 00:00:00 2001 From: HyperRaccoon13 Date: Sat, 20 Dec 2025 19:25:23 +0000 Subject: [PATCH 2/2] REI FIX v??? --- build.gradle | 2 +- .../astraladditions/AstralAdditions.java | 2 + .../compat/create/ShimmerTransmuteType.java | 6 +- .../rei/AstralAdditionsREIClientPlugin.java | 108 +++++++----- .../rei/create/BulkShimmeringCategory.java | 155 ++++++++++++++++++ .../compat/rei/desizer/DesizerCategory.java | 4 +- .../compat/rei/vacuum/VacuumCategory.java | 23 +-- .../compat/rei/vacuum/VacuumDisplay.java | 26 ++- .../compat/rei/widgets/BlockFaceWidget.java | 2 +- .../yttr/centrifuging/CentrifugeDisplay.java | 22 +-- .../PistonSmashingCategory.java | 1 - .../pistonsmashing/PistonSmashingDisplay.java | 126 ++++++-------- .../yttr/shattering/ShatteringCategory.java | 6 +- .../yttr/shattering/ShatteringDisplay.java | 64 +++++--- .../rei/yttr/soaking/SoakingCategory.java | 1 - .../rei/yttr/soaking/SoakingDisplay.java | 71 +++----- .../voidfiltering/VoidFilteringCategory.java | 7 +- .../voidfiltering/VoidFilteringDisplay.java | 28 +++- .../mixin/yttr/MagtankScreenHandlerMixin.java | 52 ++++++ .../yttr/YttrEachRegisterableFieldMixin.java | 46 ++++++ .../recipes/ChromaticVacuumRecipe.java | 17 +- .../recipes/DesizerRecipe.java | 7 +- .../recipes/TransmuteRecipe.java | 27 ++- .../ModFanProcessingType.java | 9 +- .../registry/ModParticles.java | 2 + .../assets/astraladditions/lang/en_us.json | 2 + .../resources/astraladditions.mixins.json | 8 +- 27 files changed, 543 insertions(+), 281 deletions(-) create mode 100644 src/main/java/com/github/ethanicuss/astraladditions/compat/rei/create/BulkShimmeringCategory.java create mode 100644 src/main/java/com/github/ethanicuss/astraladditions/mixin/yttr/MagtankScreenHandlerMixin.java create mode 100644 src/main/java/com/github/ethanicuss/astraladditions/mixin/yttr/YttrEachRegisterableFieldMixin.java rename src/main/java/com/github/ethanicuss/astraladditions/{compat/create => registry}/ModFanProcessingType.java (58%) diff --git a/build.gradle b/build.gradle index 795870a..de6b5cd 100644 --- a/build.gradle +++ b/build.gradle @@ -61,7 +61,7 @@ dependencies { modLocalRuntime("me.shedaniel:RoughlyEnoughItems-fabric:${rei_version}") modCompileOnly "maven.modrinth:yttr:${yttr_version}" - //modLocalRuntime "maven.modrinth:yttr:${yttr_version}" + modLocalRuntime "maven.modrinth:yttr:${yttr_version}" modImplementation("com.simibubi.create:create-fabric-1.18.2:${create_version}") diff --git a/src/main/java/com/github/ethanicuss/astraladditions/AstralAdditions.java b/src/main/java/com/github/ethanicuss/astraladditions/AstralAdditions.java index c93efe2..afb8e82 100644 --- a/src/main/java/com/github/ethanicuss/astraladditions/AstralAdditions.java +++ b/src/main/java/com/github/ethanicuss/astraladditions/AstralAdditions.java @@ -1,5 +1,6 @@ package com.github.ethanicuss.astraladditions; +import com.github.ethanicuss.astraladditions.registry.ModFanProcessingType; import com.github.ethanicuss.astraladditions.registry.ModEntities; import com.github.ethanicuss.astraladditions.registry.ModFluids; import com.github.ethanicuss.astraladditions.registry.ModParticles; @@ -28,6 +29,7 @@ public void onInitialize() { ModEffects.registerEffects(); ModParticles.registerParticles(); ModPotion.registerPotions(); + ModFanProcessingType.registerFanProcess(); LOGGER.info("Astral Additions is active!"); } } \ No newline at end of file diff --git a/src/main/java/com/github/ethanicuss/astraladditions/compat/create/ShimmerTransmuteType.java b/src/main/java/com/github/ethanicuss/astraladditions/compat/create/ShimmerTransmuteType.java index b8a435b..f4b2299 100644 --- a/src/main/java/com/github/ethanicuss/astraladditions/compat/create/ShimmerTransmuteType.java +++ b/src/main/java/com/github/ethanicuss/astraladditions/compat/create/ShimmerTransmuteType.java @@ -1,16 +1,14 @@ package com.github.ethanicuss.astraladditions.compat.create; -import com.github.ethanicuss.astraladditions.fluids.ModFluids; -import com.github.ethanicuss.astraladditions.particle.ModParticles; +import com.github.ethanicuss.astraladditions.registry.ModFluids; +import com.github.ethanicuss.astraladditions.registry.ModParticles; import com.github.ethanicuss.astraladditions.recipes.TransmuteRecipe; import com.jozufozu.flywheel.util.Color; import com.simibubi.create.content.kinetics.fan.processing.FanProcessingType; -import dev.architectury.platform.Mod; import net.minecraft.entity.Entity; import net.minecraft.entity.LivingEntity; import net.minecraft.entity.effect.StatusEffectInstance; import net.minecraft.entity.effect.StatusEffects; -import net.minecraft.entity.player.PlayerEntity; import net.minecraft.fluid.FluidState; import net.minecraft.item.ItemStack; import net.minecraft.particle.ParticleTypes; diff --git a/src/main/java/com/github/ethanicuss/astraladditions/compat/rei/AstralAdditionsREIClientPlugin.java b/src/main/java/com/github/ethanicuss/astraladditions/compat/rei/AstralAdditionsREIClientPlugin.java index fc5de99..dc5cc71 100644 --- a/src/main/java/com/github/ethanicuss/astraladditions/compat/rei/AstralAdditionsREIClientPlugin.java +++ b/src/main/java/com/github/ethanicuss/astraladditions/compat/rei/AstralAdditionsREIClientPlugin.java @@ -1,7 +1,7 @@ package com.github.ethanicuss.astraladditions.compat.rei; - import com.github.ethanicuss.astraladditions.AstralAdditions; +import com.github.ethanicuss.astraladditions.compat.rei.create.BulkShimmeringCategory; import com.github.ethanicuss.astraladditions.compat.rei.desizer.DesizerCategory; import com.github.ethanicuss.astraladditions.compat.rei.desizer.DesizerDisplay; import com.github.ethanicuss.astraladditions.compat.rei.transmute.TransmuteCategory; @@ -24,6 +24,13 @@ import com.github.ethanicuss.astraladditions.recipes.ChromaticVacuumRecipe; import com.github.ethanicuss.astraladditions.registry.ModBlocks; import com.github.ethanicuss.astraladditions.registry.ModItems; +import com.simibubi.create.AllBlocks; +import com.simibubi.create.AllItems; +import com.simibubi.create.compat.rei.DoubleItemIcon; +import com.simibubi.create.compat.rei.EmptyBackground; +import com.simibubi.create.compat.rei.category.CreateRecipeCategory; +import com.simibubi.create.compat.rei.display.CreateDisplay; +import com.unascribed.yttr.crafting.*; import com.unascribed.yttr.init.YEnchantments; import com.unascribed.yttr.init.YItems; import com.unascribed.yttr.init.YRecipeTypes; @@ -33,24 +40,27 @@ import me.shedaniel.rei.api.client.registry.screen.ScreenRegistry; import me.shedaniel.rei.api.common.category.CategoryIdentifier; import me.shedaniel.rei.api.common.util.EntryStacks; -import net.minecraft.client.MinecraftClient; +import net.fabricmc.api.EnvType; +import net.fabricmc.api.Environment; import net.minecraft.enchantment.EnchantmentHelper; import net.minecraft.item.ItemStack; import net.minecraft.item.Items; import net.minecraft.nbt.NbtCompound; import net.minecraft.nbt.NbtList; import net.minecraft.nbt.NbtString; -import net.minecraft.recipe.RecipeManager; import net.minecraft.recipe.RecipeType; +import net.minecraft.recipe.StonecuttingRecipe; import net.minecraft.text.Style; import net.minecraft.text.Text; import net.minecraft.text.TranslatableText; import net.minecraft.util.Formatting; import net.minecraft.util.Identifier; +import java.util.Collections; import java.util.List; import java.util.Map; +@Environment(EnvType.CLIENT) public class AstralAdditionsREIClientPlugin implements REIClientPlugin { public static final CategoryIdentifier DESIZER = CategoryIdentifier.of(new Identifier(AstralAdditions.MOD_ID, "desizer")); @@ -65,6 +75,9 @@ public class AstralAdditionsREIClientPlugin implements REIClientPlugin { public static final CategoryIdentifier VOID_FILTERING = CategoryIdentifier.of(new Identifier(AstralAdditions.MOD_ID, "void_filtering")); public static final CategoryIdentifier SHATTERING = CategoryIdentifier.of(new Identifier(AstralAdditions.MOD_ID, "shattering")); + //* Create + public static final CategoryIdentifier> BULK_SHIMMERING = CategoryIdentifier.of(new Identifier(AstralAdditions.MOD_ID, "bulk_shimmering")); + @Override public void registerCategories(CategoryRegistry registry) { registry.add(new DesizerCategory()); @@ -103,53 +116,70 @@ public void registerCategories(CategoryRegistry registry) { registry.addWorkstations(SHATTERING, EntryStacks.of(shatteringBook)); + CreateRecipeCategory.Info shimmerInfo = new CreateRecipeCategory.Info<>(BULK_SHIMMERING, new TranslatableText("category.astraladditions.bulk_shimmering"), new EmptyBackground(178, 110), + new DoubleItemIcon(() -> new ItemStack(AllItems.PROPELLER.get()), () -> new ItemStack(ModFluids.SHIMMER_BUCKET)), + Collections::emptyList, + List.of(() -> new ItemStack(AllItems.PROPELLER.get()), () -> new ItemStack(ModFluids.SHIMMER_BUCKET)), + 178, 110, recipe -> new CreateDisplay<>(recipe, BULK_SHIMMERING)); + + BulkShimmeringCategory bulkShimmeringCategory = new BulkShimmeringCategory(shimmerInfo); + registry.add(bulkShimmeringCategory); + + registry.addWorkstations(BULK_SHIMMERING, EntryStacks.of(AllBlocks.ENCASED_FAN.get())); } @Override public void registerDisplays(DisplayRegistry registry) { - RecipeManager recipeManager = MinecraftClient.getInstance().world.getRecipeManager(); + registry.registerRecipeFiller(DesizerRecipe.class, DesizerRecipe.Type.INSTANCE, DesizerDisplay::of); - List desizerRecipes = recipeManager.listAllOfType(DesizerRecipe.Type.INSTANCE).stream().map(DesizerDisplay::of).toList(); - desizerRecipes.forEach(registry::add); + registry.registerRecipeFiller(TransmuteRecipe.class, TransmuteRecipe.Type.INSTANCE, TransmuteDisplay::of); - List transmuteRecipes = recipeManager.listAllOfType(TransmuteRecipe.Type.INSTANCE).stream().map(TransmuteDisplay::of).toList(); - transmuteRecipes.forEach(registry::add); - - registry.registerFiller(ChromaticVacuumRecipe.class, VacuumDisplay::of); + registry.registerRecipeFiller(ChromaticVacuumRecipe.class, ChromaticVacuumRecipe.Type.INSTANCE, VacuumDisplay::of); //* YTTR - List centrifugeRecipes = recipeManager.listAllOfType(YRecipeTypes.CENTRIFUGING).stream().map(CentrifugeDisplay::of).toList(); - centrifugeRecipes.forEach(registry::add); - - List pistonSmashingRecipes = recipeManager.listAllOfType(YRecipeTypes.PISTON_SMASHING).stream().map(PistonSmashingDisplay::of).toList(); - pistonSmashingRecipes.forEach(registry::add); - - List soakingRecipes = recipeManager.listAllOfType(YRecipeTypes.SOAKING).stream().map(SoakingDisplay::of).toList(); - soakingRecipes.forEach(registry::add); - - List voidFilteringRecipe = recipeManager.listAllOfType(YRecipeTypes.VOID_FILTERING).stream().map(VoidFilteringDisplay::of).toList(); - voidFilteringRecipe.forEach(registry::add); - - //Shattering stuff - List shatteringRecipes = recipeManager.listAllOfType(YRecipeTypes.SHATTERING).stream() - .map(ShatteringDisplay::of) - .toList(); - shatteringRecipes.forEach(registry::add); - - List shatteringstonecuttingRecipes = recipeManager.listAllOfType(RecipeType.STONECUTTING).stream() - .filter(r -> r.getOutput().getCount() == 1 && !r.getIngredients().isEmpty()) - .map(ShatteringDisplay::of) - .toList(); - shatteringstonecuttingRecipes.forEach(registry::add); - - List shatteringoneByOneCraftingRecipes = recipeManager.listAllOfType(RecipeType.CRAFTING).stream() - .filter(r -> r.fits(1, 1) && !r.getIngredients().isEmpty()) - .map(ShatteringDisplay::of) - .toList(); - shatteringoneByOneCraftingRecipes.forEach(registry::add); + registry.registerRecipeFiller(CentrifugingRecipe.class, YRecipeTypes.CENTRIFUGING, CentrifugeDisplay::of); + + registry.registerRecipeFiller(PistonSmashingRecipe.class, YRecipeTypes.PISTON_SMASHING, PistonSmashingDisplay::of); + + registry.registerRecipeFiller(SoakingRecipe.class, YRecipeTypes.SOAKING, SoakingDisplay::of); + + registry.registerRecipeFiller(VoidFilteringRecipe.class, YRecipeTypes.VOID_FILTERING, VoidFilteringDisplay::of); + + registry.registerRecipeFiller(ShatteringRecipe.class, YRecipeTypes.SHATTERING, ShatteringDisplay::of); + + registry.registerRecipeFiller(StonecuttingRecipe.class, RecipeType.STONECUTTING, ShatteringDisplay::ofStonecutting); + + registry.registerRecipeFiller( + net.minecraft.recipe.CraftingRecipe.class, + RecipeType.CRAFTING, + recipe -> { + if (recipe instanceof ShatteringRecipe) return null; + + if (recipe.getIngredients().size() != 1) return null; + if (recipe.getIngredients().get(0).isEmpty()) return null; + + ItemStack out = recipe.getOutput(); + if (out.isEmpty()) return null; + + return ShatteringDisplay.ofWrappedCrafting(recipe); + } + ); + + registry.registerRecipeFiller( + TransmuteRecipe.class, + TransmuteRecipe.Type.INSTANCE, + recipe -> { + ItemStack out = recipe.getOutput(); + if (out == null || out.isEmpty()) { + return null; + } + return new CreateDisplay<>(recipe, BULK_SHIMMERING); + } + ); } + @Override public void registerScreens(ScreenRegistry registry) { REIClientPlugin.super.registerScreens(registry); diff --git a/src/main/java/com/github/ethanicuss/astraladditions/compat/rei/create/BulkShimmeringCategory.java b/src/main/java/com/github/ethanicuss/astraladditions/compat/rei/create/BulkShimmeringCategory.java new file mode 100644 index 0000000..720cc35 --- /dev/null +++ b/src/main/java/com/github/ethanicuss/astraladditions/compat/rei/create/BulkShimmeringCategory.java @@ -0,0 +1,155 @@ +package com.github.ethanicuss.astraladditions.compat.rei.create; + +import com.github.ethanicuss.astraladditions.recipes.TransmuteRecipe; +import com.github.ethanicuss.astraladditions.registry.ModFluids; +import com.simibubi.create.compat.rei.category.ProcessingViaFanCategory; +import com.simibubi.create.compat.rei.category.animations.AnimatedKinetics; +import com.simibubi.create.compat.rei.display.CreateDisplay; +import com.simibubi.create.foundation.gui.AllGuiTextures; +import com.simibubi.create.foundation.gui.element.GuiGameElement; +import me.shedaniel.math.Point; +import me.shedaniel.math.Rectangle; +import me.shedaniel.rei.api.client.gui.widgets.Slot; +import me.shedaniel.rei.api.client.gui.widgets.Widget; +import me.shedaniel.rei.api.client.gui.widgets.Widgets; +import me.shedaniel.rei.api.common.util.EntryIngredients; +import net.minecraft.client.util.math.MatrixStack; +import net.minecraft.item.ItemStack; +import net.minecraft.text.Text; +import net.minecraft.text.TranslatableText; + +import java.util.ArrayList; +import java.util.List; + +public class BulkShimmeringCategory extends ProcessingViaFanCategory { + + public BulkShimmeringCategory(Info info) { + super(info); + } + + @Override + protected void renderAttachedBlock(MatrixStack matrices) { + GuiGameElement.of(ModFluids.STILL_SHIMMER) + .scale(SCALE) + .atLocal(0, 0, 2) + .lighting(AnimatedKinetics.DEFAULT_LIGHTING) + .render(matrices); + } + + @Override + public void addWidgets(CreateDisplay display, List widgets, Point origin) { + List outputs = display.getRecipe().getOutputItems(); + if (outputs == null || outputs.isEmpty()) { + super.addWidgets(display, widgets, origin); + return; + } + + final int pageSize = 4; + final int total = outputs.size(); + final int pageCount = (total + pageSize - 1) / pageSize; + final int[] page = {0}; + + widgets.add(Widgets.createSlot(new Point(origin.x + 21, origin.y + 48)).entries(display.getInputEntries().get(0)).markInput()); + + final int baseXLocal = 130; + final int baseYLocal = 48; + final int cell = 19; + + List pageSlots = new ArrayList<>(); + Widget[] pageLabel = new Widget[1]; + + Runnable reloadPage = () -> { + widgets.removeAll(pageSlots); + pageSlots.clear(); + + if (pageLabel[0] != null) { + widgets.remove(pageLabel[0]); + pageLabel[0] = null; + } + + int baseIndex = page[0] * pageSize; + int countOnPage = Math.min(pageSize, total - baseIndex); + + for (int index = 0; index < countOnPage; index++) { + int outIndex = baseIndex + index; + + int col = index % 2; + int row = index / 2; + + int xLocal = baseXLocal + col * cell; + int yLocal = baseYLocal + row * cell; + + Slot slot = Widgets.createSlot(new Point(origin.x + xLocal, origin.y + yLocal)) + .entries(EntryIngredients.of(outputs.get(outIndex))) + .markOutput(); + + pageSlots.add(slot); + widgets.add(slot); + } + + if (pageCount > 1) { + int labelX = origin.x + baseXLocal + cell; + int labelY = origin.y + 33; + + Text text = Text.of((page[0] + 1) + "/" + pageCount); + pageLabel[0] = Widgets.createLabel(new Point(labelX, labelY), text) + .noShadow() + .color(0xFFFFFF, 0xAAAAAA) + .centered(); + + widgets.add(pageLabel[0]); + } + }; + + reloadPage.run(); + + if (pageCount > 1) { + int labelX = origin.x + baseXLocal + cell; + int buttonY = origin.y + 30; + + Rectangle backBounds = new Rectangle(labelX - 24, buttonY, 12, 12); + Widget backButton = Widgets.createButton(backBounds, Text.of("<")).onClick(btn -> { + page[0] = (page[0] - 1 + pageCount) % pageCount; + reloadPage.run(); + }); + widgets.add(backButton); + + Rectangle nextBounds = new Rectangle(labelX + 12, buttonY, 12, 12); + Widget nextButton = Widgets.createButton(nextBounds, Text.of(">")).onClick(btn -> { + page[0] = (page[0] + 1) % pageCount; + reloadPage.run(); + }); + widgets.add(nextButton); + } + } + + @Override + public void addWidgets(CreateDisplay display, List widgets, Point origin, Rectangle bounds) { + TransmuteRecipe recipe = display.getRecipe(); + Text hint = getHintText(recipe); + + int centerX = bounds.getCenterX(); + int centerY = bounds.getCenterY(); + + widgets.add(Widgets.createLabel(new Point(centerX - 75, centerY + 42), hint).leftAligned()); + } + + + @Override + protected void renderWidgets(MatrixStack matrices, TransmuteRecipe recipe, double mouseX, double mouseY) { + AllGuiTextures.JEI_SHADOW.render(matrices, 46, 29); + getBlockShadow().render(matrices, 65, 39); + AllGuiTextures.JEI_LONG_ARROW.render(matrices, 54, 51); + } + + private Text getHintText(TransmuteRecipe recipe) { + int count = recipe.getInputItem().getCount(); + if (recipe.isIgnoreCount()) { + return new TranslatableText("label.astraladditions.transmute_hint_any"); + } else if (recipe.isSoftIgnoreCount()) { + return new TranslatableText("label.astraladditions.transmute_hint_least", count); + } else { + return new TranslatableText("label.astraladditions.transmute_hint_exactly", count); + } + } +} \ No newline at end of file diff --git a/src/main/java/com/github/ethanicuss/astraladditions/compat/rei/desizer/DesizerCategory.java b/src/main/java/com/github/ethanicuss/astraladditions/compat/rei/desizer/DesizerCategory.java index 0b9c2e8..64e962b 100644 --- a/src/main/java/com/github/ethanicuss/astraladditions/compat/rei/desizer/DesizerCategory.java +++ b/src/main/java/com/github/ethanicuss/astraladditions/compat/rei/desizer/DesizerCategory.java @@ -117,7 +117,7 @@ public List setupDisplay(DesizerDisplay display, Rectangle bounds) { private void updateLayerLabelAndGrid(int newLayer, List inputs, Widget[] layerLabel, List gridWidgets, List widgets, int startX, int startY, int buttonY) { - + widgets.remove(layerLabel[0]); layerLabel[0] = createLayerLabel(startX, buttonY, newLayer); widgets.add(layerLabel[0]); @@ -138,4 +138,4 @@ private Widget createLayerLabel(int startX, int buttonY, int layer) { public int getDisplayHeight() { return 90; } -} +} \ No newline at end of file diff --git a/src/main/java/com/github/ethanicuss/astraladditions/compat/rei/vacuum/VacuumCategory.java b/src/main/java/com/github/ethanicuss/astraladditions/compat/rei/vacuum/VacuumCategory.java index 48da339..38e087c 100644 --- a/src/main/java/com/github/ethanicuss/astraladditions/compat/rei/vacuum/VacuumCategory.java +++ b/src/main/java/com/github/ethanicuss/astraladditions/compat/rei/vacuum/VacuumCategory.java @@ -13,6 +13,7 @@ import me.shedaniel.rei.api.client.registry.display.DisplayCategory; import me.shedaniel.rei.api.common.category.CategoryIdentifier; import me.shedaniel.rei.api.common.entry.EntryIngredient; +import me.shedaniel.rei.api.common.util.EntryIngredients; import me.shedaniel.rei.api.common.util.EntryStacks; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NbtCompound; @@ -23,7 +24,6 @@ import net.minecraft.text.TranslatableText; import net.minecraft.util.Formatting; -import java.util.Collections; import java.util.List; public class VacuumCategory implements DisplayCategory { @@ -54,9 +54,8 @@ public List setupDisplay(VacuumDisplay display, Rectangle bounds) { int centerX = bounds.getCenterX(); int centerY = bounds.getCenterY(); - widgets.add(Widgets.createSlot(new Point(centerX - 8, centerY - 43)) - .entries(Collections.singletonList(EntryStacks.of(ModItems.CHROMATIC_VACUUM)))); + .entries(EntryIngredients.of(ModItems.CHROMATIC_VACUUM))); widgets.add(new RotatedArrowWidget(new Point(centerX - 11, centerY - 20), 90)); @@ -64,37 +63,29 @@ public List setupDisplay(VacuumDisplay display, Rectangle bounds) { .entries(inputs.get(0)) .markInput()); - widgets.add(CurvedArrowWidget.of(new Point(centerX + 11, centerY + 9), 90, false)); if (!display.getRemainderEntries().isEmpty()) { widgets.add(CurvedArrowWidget.of(new Point(centerX - 27, centerY + 9), -90, true)); - ItemStack outputRemainder = (ItemStack) display.getRemainderEntries().get(0).get(0).getValue(); + ItemStack outputRemainder = ((ItemStack) display.getRemainderEntries().get(0).get(0).getValue()).copy(); - if (!outputRemainder.hasNbt()) { - outputRemainder.setNbt(new NbtCompound()); - } NbtCompound displayTag = outputRemainder.getOrCreateSubNbt("display"); - NbtList lore = new NbtList(); - lore.add(NbtString.of(Text.Serializer.toJson( - new TranslatableText("category.astraladditions.vacuum.remainder_hint") - .setStyle(Style.EMPTY.withItalic(false).withColor(Formatting.YELLOW)) + lore.add(NbtString.of(Text.Serializer.toJson(new TranslatableText("category.astraladditions.vacuum.remainder_hint") + .setStyle(Style.EMPTY.withItalic(false).withColor(Formatting.YELLOW)) ))); displayTag.put("Lore", lore); widgets.add(Widgets.createSlot(new Point(centerX - 28, centerY + 28)) - .entries(Collections.singletonList(EntryStacks.of(outputRemainder))) + .entries(EntryIngredients.of(outputRemainder)) .markOutput()); - - } + widgets.add(Widgets.createSlot(new Point(centerX + 13, centerY + 28)) .entries(outputs.get(0)) .markOutput()); - return widgets; } diff --git a/src/main/java/com/github/ethanicuss/astraladditions/compat/rei/vacuum/VacuumDisplay.java b/src/main/java/com/github/ethanicuss/astraladditions/compat/rei/vacuum/VacuumDisplay.java index e40e007..97dcb11 100644 --- a/src/main/java/com/github/ethanicuss/astraladditions/compat/rei/vacuum/VacuumDisplay.java +++ b/src/main/java/com/github/ethanicuss/astraladditions/compat/rei/vacuum/VacuumDisplay.java @@ -8,7 +8,6 @@ import me.shedaniel.rei.api.common.util.EntryIngredients; import net.minecraft.item.ItemStack; import net.minecraft.recipe.Ingredient; -import net.minecraft.recipe.Recipe; import net.minecraft.util.Identifier; import java.util.Collections; @@ -23,7 +22,7 @@ public VacuumDisplay(Identifier id, List inputs, List outputs, List remainder) { - super(inputs, outputs, Optional.ofNullable(id)); // REI 8.x ctor + super(inputs, outputs, Optional.ofNullable(id)); this.remainderEntries = (remainder == null) ? Collections.emptyList() : remainder; } @@ -36,23 +35,22 @@ public List getRemainderEntries() { return remainderEntries; } - /** Return null to let REI skip invalid/unsynced recipes. */ - public static VacuumDisplay of(Recipe recipe) { - if (!(recipe instanceof ChromaticVacuumRecipe chromatic)) return null; - - ItemStack ing = chromatic.getIngredient(); // if yours actually returns Ingredient, change type + EntryIngredients.of(ing) - if (ing == null || ing.isEmpty()) return null; + public static VacuumDisplay of(ChromaticVacuumRecipe chromatic) { + Ingredient ing = chromatic.getIngredients().isEmpty() ? Ingredient.EMPTY : chromatic.getIngredients().get(0); + if (ing.isEmpty()) return null; ItemStack out = chromatic.getOutput(); - if (out == null || out.isEmpty()) return null; + if (out.isEmpty()) return null; + + List inputs = Collections.singletonList(EntryIngredients.ofIngredient(ing)); + List outputs = Collections.singletonList(EntryIngredients.of(out.copy())); - List inputs = Collections.singletonList(EntryIngredients.of(ing)); - List outputs = Collections.singletonList(EntryIngredients.of(out)); + ItemStack rem = chromatic.getRemainder(); List remainders = - chromatic.hasRemainder() && chromatic.getRemainder() != null && !chromatic.getRemainder().isEmpty() - ? Collections.singletonList(EntryIngredients.of(chromatic.getRemainder())) + chromatic.hasRemainder() && !rem.isEmpty() + ? Collections.singletonList(EntryIngredients.of(rem.copy())) : Collections.emptyList(); - return new VacuumDisplay(recipe.getId(), inputs, outputs, remainders); + return new VacuumDisplay(chromatic.getId(), inputs, outputs, remainders); } } \ No newline at end of file diff --git a/src/main/java/com/github/ethanicuss/astraladditions/compat/rei/widgets/BlockFaceWidget.java b/src/main/java/com/github/ethanicuss/astraladditions/compat/rei/widgets/BlockFaceWidget.java index 46ef135..07c85d8 100644 --- a/src/main/java/com/github/ethanicuss/astraladditions/compat/rei/widgets/BlockFaceWidget.java +++ b/src/main/java/com/github/ethanicuss/astraladditions/compat/rei/widgets/BlockFaceWidget.java @@ -23,7 +23,7 @@ public class BlockFaceWidget extends WidgetWithBounds { private final Supplier blockSupplier; private final Point position; - private final Direction side; //kinda forgot about this part + private final Direction side; private final int rotationDegrees; private final boolean showTooltip; diff --git a/src/main/java/com/github/ethanicuss/astraladditions/compat/rei/yttr/centrifuging/CentrifugeDisplay.java b/src/main/java/com/github/ethanicuss/astraladditions/compat/rei/yttr/centrifuging/CentrifugeDisplay.java index 3aa02c8..284f85d 100644 --- a/src/main/java/com/github/ethanicuss/astraladditions/compat/rei/yttr/centrifuging/CentrifugeDisplay.java +++ b/src/main/java/com/github/ethanicuss/astraladditions/compat/rei/yttr/centrifuging/CentrifugeDisplay.java @@ -6,8 +6,8 @@ import me.shedaniel.rei.api.common.display.basic.BasicDisplay; import me.shedaniel.rei.api.common.entry.EntryIngredient; import me.shedaniel.rei.api.common.util.EntryStacks; +import net.minecraft.item.ItemStack; import net.minecraft.recipe.Ingredient; -import net.minecraft.recipe.Recipe; import net.minecraft.util.Identifier; import java.util.Arrays; @@ -27,23 +27,23 @@ public CategoryIdentifier getCategoryIdentifier() { return AstralAdditionsREIClientPlugin.CENTRIFUGE; } - public static CentrifugeDisplay of(Recipe recipe) { - CentrifugingRecipe centrifugingRecipe = (CentrifugingRecipe) recipe; - - Ingredient ingredient = centrifugingRecipe.getInput(); + public static CentrifugeDisplay of(CentrifugingRecipe recipe) { + Ingredient ingredient = recipe.getInput(); + int count = recipe.getInputCount(); List inputs = Collections.singletonList( EntryIngredient.of( - Arrays.stream(ingredient.getMatchingStacks()) - .map(EntryStacks::of) - .toList() + Arrays.stream(ingredient.getMatchingStacks()).map(stack -> { + ItemStack copy = stack.copy(); + copy.setCount(count); + return EntryStacks.of(copy);}).toList() ) ); - List outputs = centrifugingRecipe.getOutputs().stream() - .map(stack -> EntryIngredient.of(EntryStacks.of(stack))) + List outputs = recipe.getOutputs().stream() + .map(stack -> EntryIngredient.of(EntryStacks.of(stack.copy()))) .toList(); return new CentrifugeDisplay(recipe.getId(), inputs, outputs); } -} +} \ No newline at end of file diff --git a/src/main/java/com/github/ethanicuss/astraladditions/compat/rei/yttr/pistonsmashing/PistonSmashingCategory.java b/src/main/java/com/github/ethanicuss/astraladditions/compat/rei/yttr/pistonsmashing/PistonSmashingCategory.java index 0843bd8..becc887 100644 --- a/src/main/java/com/github/ethanicuss/astraladditions/compat/rei/yttr/pistonsmashing/PistonSmashingCategory.java +++ b/src/main/java/com/github/ethanicuss/astraladditions/compat/rei/yttr/pistonsmashing/PistonSmashingCategory.java @@ -7,7 +7,6 @@ import me.shedaniel.math.Point; import me.shedaniel.math.Rectangle; import me.shedaniel.rei.api.client.gui.Renderer; -import me.shedaniel.rei.api.client.gui.widgets.Tooltip; import net.fabricmc.loader.api.FabricLoader; import net.minecraft.client.item.TooltipContext; import me.shedaniel.rei.api.client.gui.widgets.Widget; diff --git a/src/main/java/com/github/ethanicuss/astraladditions/compat/rei/yttr/pistonsmashing/PistonSmashingDisplay.java b/src/main/java/com/github/ethanicuss/astraladditions/compat/rei/yttr/pistonsmashing/PistonSmashingDisplay.java index 3457c55..88922ce 100644 --- a/src/main/java/com/github/ethanicuss/astraladditions/compat/rei/yttr/pistonsmashing/PistonSmashingDisplay.java +++ b/src/main/java/com/github/ethanicuss/astraladditions/compat/rei/yttr/pistonsmashing/PistonSmashingDisplay.java @@ -12,7 +12,6 @@ import net.minecraft.block.Blocks; import net.minecraft.entity.effect.StatusEffectInstance; import net.minecraft.item.ItemStack; -import net.minecraft.recipe.Recipe; import net.minecraft.util.Identifier; import net.minecraft.util.registry.Registry; @@ -20,10 +19,8 @@ import java.util.List; public class PistonSmashingDisplay extends BasicDisplay { - private final PistonSmashingRecipe recipe; - private final Identifier id; private final boolean hasCloud; private final int cloudColor; @@ -31,12 +28,10 @@ public class PistonSmashingDisplay extends BasicDisplay { private final EntryStack cloudOutput; private final List cloudEffects; - private final Block inputBlock; - private final Block catalystBlock; + private final List inputMatches; + private final List catalystMatches; - public PistonSmashingDisplay(Identifier id, List inputs, List outputs, - boolean hasCloud, int cloudColor, int cloudSize, EntryStack cloudOutput, List cloudEffects, - Block inputBlock, Block catalystBlock, PistonSmashingRecipe recipe) { + public PistonSmashingDisplay(Identifier id, List inputs, List outputs, boolean hasCloud, int cloudColor, int cloudSize, EntryStack cloudOutput, List cloudEffects, List inputMatches, List catalystMatches, PistonSmashingRecipe recipe) { super(inputs, outputs); this.id = id; this.hasCloud = hasCloud; @@ -44,92 +39,75 @@ public PistonSmashingDisplay(Identifier id, List inputs, List matching = Registry.BLOCK.stream() - .filter(block -> recipe.getInput().test(block.getDefaultState().getBlock())) - .toList(); - if (matching.isEmpty()) return Blocks.AIR; - int index = (int) ((System.currentTimeMillis() / 1000) % matching.size()); - return matching.get(index); + if (inputMatches.isEmpty()) return Blocks.AIR; + int index = (int) ((System.currentTimeMillis() / 1000) % inputMatches.size()); + return inputMatches.get(index); } public Block getCatalystBlock() { - List matching = Registry.BLOCK.stream() - .filter(block -> recipe.getCatalyst().test(block.getDefaultState().getBlock())) - .toList(); - if (matching.isEmpty()) return Blocks.AIR; - int index = (int) ((System.currentTimeMillis() / 1000) % matching.size()); - return matching.get(index); - } - - public boolean hasCloud() { - return hasCloud; + if (catalystMatches.isEmpty()) return Blocks.AIR; + int index = (int) ((System.currentTimeMillis() / 1000) % catalystMatches.size()); + return catalystMatches.get(index); } - public int getCloudColor() { - return cloudColor; - } - - public int getCloudSize() { - return cloudSize; - } - - public EntryStack getCloudOutput() { - return cloudOutput; - } - - public List getCloudEffects() { - return cloudEffects; - } + public boolean hasCloud() { return hasCloud; } + public int getCloudColor() { return cloudColor; } + public int getCloudSize() { return cloudSize; } + public EntryStack getCloudOutput() { return cloudOutput; } + public List getCloudEffects() { return cloudEffects; } @Override public CategoryIdentifier getCategoryIdentifier() { return AstralAdditionsREIClientPlugin.PISTON_SMASHING; } - public static PistonSmashingDisplay of(Recipe recipe) { - PistonSmashingRecipe pistonRecipe = (PistonSmashingRecipe) recipe; + public static PistonSmashingDisplay of(PistonSmashingRecipe recipe) { + List inputBlocks = Registry.BLOCK.stream() + .filter(block -> recipe.getInput().test(block)) + .toList(); - List input = Collections.singletonList( - EntryIngredient.of( - Registry.BLOCK.stream() - .filter(block -> pistonRecipe.getInput().test(block.getDefaultState().getBlock())) - .map(block -> EntryStacks.of(new ItemStack(block))) - .toList() - ) + List catalystBlocks = Registry.BLOCK.stream() + .filter(block -> recipe.getCatalyst().test(block)) + .toList(); + + EntryIngredient catalystIng = EntryIngredient.of( + catalystBlocks.stream() + .map(block -> EntryStacks.of(new ItemStack(block))) + .toList() + ); + + EntryIngredient inputIng = EntryIngredient.of( + inputBlocks.stream() + .map(block -> EntryStacks.of(new ItemStack(block))) + .toList() ); - List output = Collections.singletonList( - EntryIngredients.of(pistonRecipe.getOutput()) + List inputs = List.of(catalystIng, inputIng); + + List outputs = Collections.singletonList( + EntryIngredients.of(recipe.getOutput()) ); - EntryStack cloudOutput = EntryStacks.of(pistonRecipe.getCloudOutput()); - - Block inputBlock = Registry.BLOCK.stream() - .filter(block -> pistonRecipe.getInput().test(block.getDefaultState().getBlock())) - .findFirst() - .orElse(Blocks.AIR); - - Block catalystBlock = Registry.BLOCK.stream() - .filter(block -> pistonRecipe.getCatalyst().test(block.getDefaultState().getBlock())) - .findFirst() - .orElse(Blocks.AIR); - - return new PistonSmashingDisplay(recipe.getId(), input, - output, - pistonRecipe.hasCloud(), - pistonRecipe.getCloudColor(), - pistonRecipe.getCloudSize(), - cloudOutput, - pistonRecipe.getCloudEffects(), - inputBlock, - catalystBlock, - (PistonSmashingRecipe) recipe + EntryStack cloudOut = EntryStacks.of(recipe.getCloudOutput()); + + return new PistonSmashingDisplay( + recipe.getId(), + inputs, + outputs, + recipe.hasCloud(), + recipe.getCloudColor(), + recipe.getCloudSize(), + cloudOut, + recipe.getCloudEffects(), + inputBlocks, + catalystBlocks, + recipe ); } } \ No newline at end of file diff --git a/src/main/java/com/github/ethanicuss/astraladditions/compat/rei/yttr/shattering/ShatteringCategory.java b/src/main/java/com/github/ethanicuss/astraladditions/compat/rei/yttr/shattering/ShatteringCategory.java index 2ebe3b4..5bac18c 100644 --- a/src/main/java/com/github/ethanicuss/astraladditions/compat/rei/yttr/shattering/ShatteringCategory.java +++ b/src/main/java/com/github/ethanicuss/astraladditions/compat/rei/yttr/shattering/ShatteringCategory.java @@ -1,9 +1,6 @@ package com.github.ethanicuss.astraladditions.compat.rei.yttr.shattering; -import com.github.ethanicuss.astraladditions.AstralAdditions; import com.github.ethanicuss.astraladditions.compat.rei.AstralAdditionsREIClientPlugin; -import com.github.ethanicuss.astraladditions.compat.rei.transmute.TransmuteDisplay; -import com.github.ethanicuss.astraladditions.compat.rei.vacuum.VacuumDisplay; import com.google.common.collect.ImmutableMap; import com.google.common.collect.Lists; import com.mojang.blaze3d.systems.RenderSystem; @@ -31,7 +28,6 @@ public class ShatteringCategory implements DisplayCategory { - @Override public Text getTitle() { return new TranslatableText("category.astraladditions.shattering"); @@ -58,7 +54,7 @@ public List setupDisplay(ShatteringDisplay display, Rectangle bounds) { Point startPoint = new Point(bounds.getCenterX() - 40, bounds.getCenterY() - 9); if (display.isExclusive()) { widgets.add(Widgets.createDrawableWidget((helper, matrices, mouseX, mouseY, delta) -> { - int v = ConfigObject.getInstance().isUsingDarkTheme() ? 17 : 0; + int v = ConfigObject.getInstance().isUsingDarkTheme() ? 18 : 0; Identifier texture = Yttr.id("textures/gui/shattering.png"); diff --git a/src/main/java/com/github/ethanicuss/astraladditions/compat/rei/yttr/shattering/ShatteringDisplay.java b/src/main/java/com/github/ethanicuss/astraladditions/compat/rei/yttr/shattering/ShatteringDisplay.java index 98936e9..8962033 100644 --- a/src/main/java/com/github/ethanicuss/astraladditions/compat/rei/yttr/shattering/ShatteringDisplay.java +++ b/src/main/java/com/github/ethanicuss/astraladditions/compat/rei/yttr/shattering/ShatteringDisplay.java @@ -7,50 +7,68 @@ import me.shedaniel.rei.api.common.display.basic.BasicDisplay; import me.shedaniel.rei.api.common.entry.EntryIngredient; import me.shedaniel.rei.api.common.util.EntryIngredients; +import me.shedaniel.rei.api.common.util.EntryStacks; +import net.minecraft.inventory.CraftingInventory; +import net.minecraft.item.ItemStack; import net.minecraft.recipe.Recipe; +import net.minecraft.recipe.StonecuttingRecipe; import net.minecraft.util.Identifier; -import java.util.Collections; import java.util.List; public class ShatteringDisplay extends BasicDisplay { private final Identifier id; private final boolean exclusive; - public ShatteringDisplay(Identifier id, List inputs, List outputs, boolean exclusive) { - super(inputs, outputs); + private ShatteringDisplay(Identifier id, EntryIngredient input, EntryIngredient output, boolean exclusive) { + super(List.of(input), List.of(output)); this.id = id; this.exclusive = exclusive; } - public boolean isExclusive() { - return exclusive; + public static ShatteringDisplay of(ShatteringRecipe recipe) { + EntryIngredient input = EntryIngredients.ofIngredient(recipe.getIngredients().get(0)); + EntryIngredient output = EntryIngredients.of(recipe.getOutput().copy()); + return new ShatteringDisplay(recipe.getId(), input, output, true); } - @Override - public CategoryIdentifier getCategoryIdentifier() { - return AstralAdditionsREIClientPlugin.SHATTERING; + public static ShatteringDisplay ofWrappedCrafting(Recipe recipe) { + Identifier id = Yttr.id("shattering/" + recipe.getId().getNamespace() + "/" + recipe.getId().getPath()); + + if (recipe.getIngredients().isEmpty() || recipe.getIngredients().get(0).isEmpty()) return null; + + ItemStack out = recipe.getOutput(); + if (out.isEmpty()) return null; + + EntryIngredient input = EntryIngredients.ofIngredient(recipe.getIngredients().get(0)); + EntryIngredient output = EntryIngredients.of(out.copy()); + return new ShatteringDisplay(id, input, output, false); } - public static ShatteringDisplay of(Recipe recipe) { - List inputs = recipe.getIngredients().stream() - .map(EntryIngredients::ofIngredient) - .toList(); + public static ShatteringDisplay ofStonecutting(StonecuttingRecipe recipe) { + Identifier id = Yttr.id("shattering/" + recipe.getId().getNamespace() + "/" + recipe.getId().getPath()); + + if (recipe.getIngredients().isEmpty() || recipe.getIngredients().get(0).isEmpty()) return null; - List outputs = Collections.singletonList( - EntryIngredients.of(recipe.getOutput()) - ); + ItemStack stonecutOut = recipe.getOutput(); + if (stonecutOut.isEmpty()) return null; - Identifier id; - boolean exclusive = recipe instanceof ShatteringRecipe; + EntryIngredient input = EntryIngredient.of(EntryStacks.of(stonecutOut.copy())); - if (exclusive) { - id = recipe.getId(); - } else { - id = Yttr.id("shattering/" + recipe.getId().getNamespace() + "/" + recipe.getId().getPath()); - } + ItemStack[] matches = recipe.getIngredients().get(0).getMatchingStacks(); + if (matches.length == 0) return null; - return new ShatteringDisplay(id, inputs, outputs, exclusive); + EntryIngredient output = EntryIngredient.of(EntryStacks.of(matches[0].copy())); + return new ShatteringDisplay(id, input, output, true); + } + + @Override + public CategoryIdentifier getCategoryIdentifier() { + return AstralAdditionsREIClientPlugin.SHATTERING; + } + + public boolean isExclusive() { + return exclusive; } } \ No newline at end of file diff --git a/src/main/java/com/github/ethanicuss/astraladditions/compat/rei/yttr/soaking/SoakingCategory.java b/src/main/java/com/github/ethanicuss/astraladditions/compat/rei/yttr/soaking/SoakingCategory.java index 642c358..1d5704f 100644 --- a/src/main/java/com/github/ethanicuss/astraladditions/compat/rei/yttr/soaking/SoakingCategory.java +++ b/src/main/java/com/github/ethanicuss/astraladditions/compat/rei/yttr/soaking/SoakingCategory.java @@ -24,7 +24,6 @@ public class SoakingCategory implements DisplayCategory { @Override public Text getTitle() { return new TranslatableText("category.astraladditions.soaking"); - } @Override diff --git a/src/main/java/com/github/ethanicuss/astraladditions/compat/rei/yttr/soaking/SoakingDisplay.java b/src/main/java/com/github/ethanicuss/astraladditions/compat/rei/yttr/soaking/SoakingDisplay.java index f7912c5..ae1e4bf 100644 --- a/src/main/java/com/github/ethanicuss/astraladditions/compat/rei/yttr/soaking/SoakingDisplay.java +++ b/src/main/java/com/github/ethanicuss/astraladditions/compat/rei/yttr/soaking/SoakingDisplay.java @@ -1,79 +1,56 @@ package com.github.ethanicuss.astraladditions.compat.rei.yttr.soaking; import com.github.ethanicuss.astraladditions.compat.rei.AstralAdditionsREIClientPlugin; -import com.mojang.datafixers.util.Either; import com.unascribed.yttr.crafting.SoakingRecipe; -import me.shedaniel.rei.api.common.category.CategoryIdentifier; import me.shedaniel.rei.api.common.display.basic.BasicDisplay; import me.shedaniel.rei.api.common.entry.EntryIngredient; import me.shedaniel.rei.api.common.util.EntryIngredients; import me.shedaniel.rei.api.common.util.EntryStacks; import net.minecraft.item.ItemStack; import net.minecraft.recipe.Ingredient; -import net.minecraft.recipe.Recipe; import net.minecraft.util.Identifier; -import net.minecraft.util.collection.DefaultedList; +import java.util.ArrayList; +import java.util.Collections; import java.util.List; public class SoakingDisplay extends BasicDisplay { private final Identifier id; private final List catalystEntries; - public SoakingDisplay(Identifier id, List inputs, List outputs, List catalystEntries) { + private SoakingDisplay(Identifier id, List inputs, List outputs, List catalystEntries) { super(inputs, outputs); this.id = id; this.catalystEntries = catalystEntries; } + public static SoakingDisplay of(SoakingRecipe recipe) { + List inputs = new ArrayList<>(); - public List getCatalystEntries() { - return catalystEntries; - } - - @Override - public CategoryIdentifier getCategoryIdentifier() { - return AstralAdditionsREIClientPlugin.SOAKING; - } - - public static SoakingDisplay of(Recipe recipe) { - SoakingRecipe soakingRecipe = (SoakingRecipe) recipe; + recipe.getSoakingIngredients() + .ifLeft(stack -> inputs.add(EntryIngredients.of(stack))) + .ifRight(list -> { + for (Ingredient ingredient : list) { + inputs.add(EntryIngredients.ofIngredient(ingredient)); + } + }); - List inputs; - Either> soakingIngredients = soakingRecipe.getSoakingIngredients(); + ItemStack output = recipe.getOutput().copy(); + List outputs = Collections.singletonList(EntryIngredients.of(output)); - if (soakingIngredients.left().isPresent()) { - ItemStack stack = soakingIngredients.left().get(); - inputs = List.of(EntryIngredients.of(stack)); - } else { - DefaultedList ingredientList = soakingIngredients.right().orElse(DefaultedList.of()); - if (!ingredientList.isEmpty()) { - Ingredient ingredient = ingredientList.get(0); - ItemStack[] matchingStacks = ingredient.getMatchingStacks(); - if (matchingStacks.length > 0) { - ItemStack stack = matchingStacks[0].copy(); - inputs = List.of(EntryIngredients.of(stack)); - } else { - inputs = List.of(); - } - } else { - inputs = List.of(); - } - } - - ItemStack outputStack = soakingRecipe.getResult().map( - itemStack -> itemStack, - blockState -> new ItemStack(blockState.getBlock()) + List catalystEntries = Collections.singletonList( + EntryIngredient.of(recipe.getCatalyst().getMatchingFluids().stream().map(EntryStacks::of).toList()) ); - List outputs = List.of( - EntryIngredients.of(outputStack) - ); + return new SoakingDisplay(recipe.getId(), inputs, outputs, catalystEntries); + } - List catalystEntries = List.of( - EntryIngredient.of(EntryStacks.of(soakingRecipe.getCatalyst().getMatchingFluids().get(0))) - ); + @Override + public me.shedaniel.rei.api.common.category.CategoryIdentifier getCategoryIdentifier() { + return AstralAdditionsREIClientPlugin.SOAKING; + } - return new SoakingDisplay(recipe.getId(), inputs, outputs, catalystEntries); + public List getCatalystEntries() { + return catalystEntries; } } \ No newline at end of file diff --git a/src/main/java/com/github/ethanicuss/astraladditions/compat/rei/yttr/voidfiltering/VoidFilteringCategory.java b/src/main/java/com/github/ethanicuss/astraladditions/compat/rei/yttr/voidfiltering/VoidFilteringCategory.java index fd8cbfb..4964b8b 100644 --- a/src/main/java/com/github/ethanicuss/astraladditions/compat/rei/yttr/voidfiltering/VoidFilteringCategory.java +++ b/src/main/java/com/github/ethanicuss/astraladditions/compat/rei/yttr/voidfiltering/VoidFilteringCategory.java @@ -1,9 +1,6 @@ package com.github.ethanicuss.astraladditions.compat.rei.yttr.voidfiltering; import com.github.ethanicuss.astraladditions.compat.rei.AstralAdditionsREIClientPlugin; -import com.github.ethanicuss.astraladditions.compat.rei.transmute.TransmuteDisplay; -import com.github.ethanicuss.astraladditions.compat.rei.vacuum.VacuumDisplay; -import com.github.ethanicuss.astraladditions.compat.rei.yttr.soaking.SoakingDisplay; import com.unascribed.yttr.init.YBlocks; import me.shedaniel.math.Point; import me.shedaniel.math.Rectangle; @@ -50,9 +47,7 @@ public List setupDisplay(VoidFilteringDisplay display, Rectangle bounds) .entries(outputs.get(0)) .markOutput()); - widgets.add(Widgets.createLabel(new Point(bounds.x + 26, bounds.getMaxY() - 17), - new TranslatableText("category.astraladditions.void_filtering.chance", display.getChance())) - .leftAligned()); + widgets.add(Widgets.createLabel(new Point(bounds.x + 26, bounds.getMaxY() - 17), new TranslatableText("category.astraladditions.void_filtering.chance", display.getChance())).leftAligned()); return widgets; } diff --git a/src/main/java/com/github/ethanicuss/astraladditions/compat/rei/yttr/voidfiltering/VoidFilteringDisplay.java b/src/main/java/com/github/ethanicuss/astraladditions/compat/rei/yttr/voidfiltering/VoidFilteringDisplay.java index 92e42d0..e0cd472 100644 --- a/src/main/java/com/github/ethanicuss/astraladditions/compat/rei/yttr/voidfiltering/VoidFilteringDisplay.java +++ b/src/main/java/com/github/ethanicuss/astraladditions/compat/rei/yttr/voidfiltering/VoidFilteringDisplay.java @@ -5,9 +5,7 @@ import me.shedaniel.rei.api.common.category.CategoryIdentifier; import me.shedaniel.rei.api.common.display.basic.BasicDisplay; import me.shedaniel.rei.api.common.entry.EntryIngredient; -import me.shedaniel.rei.api.common.entry.EntryStack; import me.shedaniel.rei.api.common.util.EntryIngredients; -import net.minecraft.recipe.Recipe; import net.minecraft.util.Identifier; import java.util.Collections; @@ -16,24 +14,36 @@ public class VoidFilteringDisplay extends BasicDisplay { private final Identifier id; private final float chance; + private final boolean hidden; - public VoidFilteringDisplay(Identifier id, List outputs, float chance) { - super(Collections.emptyList(), outputs); + private VoidFilteringDisplay(Identifier id, List inputs, List outputs, float chance, boolean hidden) { + super(inputs, outputs); this.id = id; this.chance = chance; + this.hidden = hidden; } - public float getChance() { - return chance; + public static VoidFilteringDisplay of(VoidFilteringRecipe recipe) { + List inputs = Collections.emptyList(); + + List outputs = Collections.singletonList( + EntryIngredients.of(recipe.getOutput().copy()) + ); + + return new VoidFilteringDisplay(recipe.getId(), inputs, outputs, recipe.getChance(), recipe.isHidden()); } + @Override public CategoryIdentifier getCategoryIdentifier() { return AstralAdditionsREIClientPlugin.VOID_FILTERING; } - public static VoidFilteringDisplay of(VoidFilteringRecipe recipe) { - EntryIngredient output = EntryIngredients.of(recipe.getOutput()); - return new VoidFilteringDisplay(recipe.getId(), Collections.singletonList(output), recipe.getChance()); + public float getChance() { + return chance; + } + + public boolean isHidden() { + return hidden; } } \ No newline at end of file diff --git a/src/main/java/com/github/ethanicuss/astraladditions/mixin/yttr/MagtankScreenHandlerMixin.java b/src/main/java/com/github/ethanicuss/astraladditions/mixin/yttr/MagtankScreenHandlerMixin.java new file mode 100644 index 0000000..4a2da10 --- /dev/null +++ b/src/main/java/com/github/ethanicuss/astraladditions/mixin/yttr/MagtankScreenHandlerMixin.java @@ -0,0 +1,52 @@ +package com.github.ethanicuss.astraladditions.mixin.yttr; + +import com.unascribed.yttr.inventory.MagtankScreenHandler; +import net.minecraft.entity.player.PlayerEntity; +import net.minecraft.item.ItemStack; +import net.minecraft.screen.ScreenHandler; +import net.minecraft.screen.ScreenHandlerType; +import org.jetbrains.annotations.Nullable; +import org.spongepowered.asm.mixin.Mixin; + +@Mixin(MagtankScreenHandler.class) +public abstract class MagtankScreenHandlerMixin extends ScreenHandler { + + protected MagtankScreenHandlerMixin(@Nullable ScreenHandlerType type, int syncId) { + super(type, syncId); + } + + @Override + public ItemStack transferSlot(PlayerEntity player, int index) { + ItemStack newStack = ItemStack.EMPTY; + if (index < 0 || index >= this.slots.size()) { + return ItemStack.EMPTY; + } + + var slot = this.slots.get(index); + + if (slot != null && slot.hasStack()) { + ItemStack original = slot.getStack(); + newStack = original.copy(); + + if (index < 27) { + if (!this.insertItem(original, 27, 36, false)) { + return ItemStack.EMPTY; + } + } else if (index < 36) { + if (!this.insertItem(original, 0, 27, false)) { + return ItemStack.EMPTY; + } + } else { + return ItemStack.EMPTY; + } + + if (original.isEmpty()) { + slot.setStack(ItemStack.EMPTY); + } else { + slot.markDirty(); + } + } + + return newStack; + } +} \ No newline at end of file diff --git a/src/main/java/com/github/ethanicuss/astraladditions/mixin/yttr/YttrEachRegisterableFieldMixin.java b/src/main/java/com/github/ethanicuss/astraladditions/mixin/yttr/YttrEachRegisterableFieldMixin.java new file mode 100644 index 0000000..21bf517 --- /dev/null +++ b/src/main/java/com/github/ethanicuss/astraladditions/mixin/yttr/YttrEachRegisterableFieldMixin.java @@ -0,0 +1,46 @@ +package com.github.ethanicuss.astraladditions.mixin.yttr; + +import com.unascribed.yttr.Yttr; +import com.unascribed.yttr.init.YHandledScreens; +import net.fabricmc.api.EnvType; +import net.fabricmc.loader.api.FabricLoader; +import org.apache.logging.log4j.util.TriConsumer; +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.CallbackInfo; + +import java.lang.annotation.Annotation; +import java.lang.reflect.Field; +import java.lang.reflect.Modifier; + +@Mixin(value = Yttr.class, remap = false) +public abstract class YttrEachRegisterableFieldMixin { + + @Inject(method = "eachRegisterableField", at = @At("HEAD"), cancellable = true) + private static void skipScreenAnnotationsOnServer(Class holder, Class type, Class anno, TriConsumer callback, CallbackInfo callbackInfo) { + if (FabricLoader.getInstance().getEnvironmentType() != EnvType.SERVER) { + return; + } + + if (holder != YHandledScreens.class) { + return; + } + + for (Field field : holder.getDeclaredFields()) { + if (type.isAssignableFrom(field.getType()) && Modifier.isStatic(field.getModifiers()) && !Modifier.isTransient(field.getModifiers())) { + try { + field.setAccessible(true); + @SuppressWarnings("unchecked") + T value = (T) field.get(null); + + callback.accept(field, value, null); + } catch (Exception error) { + throw new RuntimeException(error); + } + } + } + + callbackInfo.cancel(); + } +} \ No newline at end of file diff --git a/src/main/java/com/github/ethanicuss/astraladditions/recipes/ChromaticVacuumRecipe.java b/src/main/java/com/github/ethanicuss/astraladditions/recipes/ChromaticVacuumRecipe.java index ea88736..b6580ab 100644 --- a/src/main/java/com/github/ethanicuss/astraladditions/recipes/ChromaticVacuumRecipe.java +++ b/src/main/java/com/github/ethanicuss/astraladditions/recipes/ChromaticVacuumRecipe.java @@ -17,7 +17,7 @@ public class ChromaticVacuumRecipe implements Recipe { private final ItemStack remainder; private final DefaultedList recipeItems; - public ChromaticVacuumRecipe(Identifier id, ItemStack output, ItemStack remainder, DefaultedList recipeItems){ + public ChromaticVacuumRecipe(Identifier id, ItemStack output, ItemStack remainder, DefaultedList recipeItems) { this.id = id; this.output = output; this.remainder = remainder; @@ -63,12 +63,13 @@ public RecipeType getType() { return Type.INSTANCE; } - public boolean hasRemainder() { - return !remainder.isEmpty(); + @Override + public DefaultedList getIngredients() { + return recipeItems; } - public ItemStack getIngredient() { - return recipeItems.get(0).getMatchingStacks()[0]; + public boolean hasRemainder() { + return !remainder.isEmpty(); } public static class Type implements RecipeType { @@ -80,7 +81,6 @@ private Type() { } public static class Serializer implements RecipeSerializer { public static final Serializer INSTANCE = new Serializer(); public static final String ID = "chromatic_vacuum"; - // this is the name given in the json file @Override public ChromaticVacuumRecipe read(Identifier id, JsonObject json) { @@ -89,7 +89,6 @@ public ChromaticVacuumRecipe read(Identifier id, JsonObject json) { JsonObject ingredient = JsonHelper.getObject(json, "ingredient"); DefaultedList inputs = DefaultedList.ofSize(1, Ingredient.EMPTY); - inputs.set(0, Ingredient.fromJson(ingredient)); return new ChromaticVacuumRecipe(id, output, remainder, inputs); @@ -98,13 +97,12 @@ public ChromaticVacuumRecipe read(Identifier id, JsonObject json) { @Override public ChromaticVacuumRecipe read(Identifier id, PacketByteBuf buf) { DefaultedList inputs = DefaultedList.ofSize(buf.readInt(), Ingredient.EMPTY); - ItemStack remainder = new ItemStack(Items.DIRT); - for (int i = 0; i < inputs.size(); i++) { inputs.set(i, Ingredient.fromPacket(buf)); } ItemStack output = buf.readItemStack(); + ItemStack remainder = buf.readItemStack(); return new ChromaticVacuumRecipe(id, output, remainder, inputs); } @@ -115,6 +113,7 @@ public void write(PacketByteBuf buf, ChromaticVacuumRecipe recipe) { ing.write(buf); } buf.writeItemStack(recipe.getOutput()); + buf.writeItemStack(recipe.getRemainder()); } } } \ No newline at end of file diff --git a/src/main/java/com/github/ethanicuss/astraladditions/recipes/DesizerRecipe.java b/src/main/java/com/github/ethanicuss/astraladditions/recipes/DesizerRecipe.java index ab98397..494b34b 100644 --- a/src/main/java/com/github/ethanicuss/astraladditions/recipes/DesizerRecipe.java +++ b/src/main/java/com/github/ethanicuss/astraladditions/recipes/DesizerRecipe.java @@ -16,7 +16,6 @@ import org.slf4j.LoggerFactory; public class DesizerRecipe implements Recipe { - public static final Logger LOGGER = LoggerFactory.getLogger(AstralAdditions.MOD_ID); private final Identifier id; private final ItemStack output; private final DefaultedList recipeItems; @@ -85,12 +84,10 @@ public static class Serializer implements RecipeSerializer { @Override public DesizerRecipe read(Identifier id, JsonObject json) { - // Parse output ItemStack output = ShapedRecipe.outputFromJson(JsonHelper.getObject(json, "output")); - // Parse ingredients JsonArray ingredients = JsonHelper.getArray(json, "ingredients"); - DefaultedList inputs = DefaultedList.ofSize(27, Ingredient.EMPTY); // Ensure size matches grid + DefaultedList inputs = DefaultedList.ofSize(27, Ingredient.EMPTY); for (int i = 0; i < ingredients.size(); i++) { JsonElement element = ingredients.get(i); @@ -122,4 +119,4 @@ public void write(PacketByteBuf buf, DesizerRecipe recipe) { buf.writeItemStack(recipe.getOutput()); } } -} +} \ No newline at end of file diff --git a/src/main/java/com/github/ethanicuss/astraladditions/recipes/TransmuteRecipe.java b/src/main/java/com/github/ethanicuss/astraladditions/recipes/TransmuteRecipe.java index 19f5e11..60aa696 100644 --- a/src/main/java/com/github/ethanicuss/astraladditions/recipes/TransmuteRecipe.java +++ b/src/main/java/com/github/ethanicuss/astraladditions/recipes/TransmuteRecipe.java @@ -6,11 +6,13 @@ import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.network.PacketByteBuf; +import net.minecraft.recipe.Ingredient; import net.minecraft.recipe.Recipe; import net.minecraft.recipe.RecipeSerializer; import net.minecraft.recipe.RecipeType; import net.minecraft.util.Identifier; import net.minecraft.util.JsonHelper; +import net.minecraft.util.collection.DefaultedList; import net.minecraft.world.World; import java.util.ArrayList; @@ -44,24 +46,32 @@ public boolean matches(ItemStack stack) { public List getOutputItems() { return outputItems; } + public ItemStack getInputItem() { return inputItem; } + public boolean isIgnoreCount() { return ignoreCount; } - public boolean isSoftIgnoreCount(){ + + public boolean isSoftIgnoreCount() { return softIgnoreCount; } + public ItemStack getResult() { + return outputItems.isEmpty() ? ItemStack.EMPTY : outputItems.get(0); + } + @Override public boolean matches(Inventory inv, World world) { - return false; + ItemStack stack = inv.getStack(0); + return matches(stack); } @Override public ItemStack craft(Inventory inv) { - return ItemStack.EMPTY; + return getResult().copy(); } @Override @@ -71,11 +81,14 @@ public boolean fits(int width, int height) { @Override public ItemStack getOutput() { - return null; + return getResult().copy(); } - public ItemStack getResult() { - return outputItems.isEmpty() ? ItemStack.EMPTY : outputItems.get(0); + @Override + public DefaultedList getIngredients() { + DefaultedList list = DefaultedList.of(); + list.add(Ingredient.ofStacks(inputItem)); + return list; } @Override @@ -94,7 +107,7 @@ public RecipeType getType() { } public static class Type implements RecipeType { - private Type() { } + private Type() {} public static final Type INSTANCE = new Type(); public static final String ID = "shimmer_transmute"; } diff --git a/src/main/java/com/github/ethanicuss/astraladditions/compat/create/ModFanProcessingType.java b/src/main/java/com/github/ethanicuss/astraladditions/registry/ModFanProcessingType.java similarity index 58% rename from src/main/java/com/github/ethanicuss/astraladditions/compat/create/ModFanProcessingType.java rename to src/main/java/com/github/ethanicuss/astraladditions/registry/ModFanProcessingType.java index 5f619cd..27a8f06 100644 --- a/src/main/java/com/github/ethanicuss/astraladditions/compat/create/ModFanProcessingType.java +++ b/src/main/java/com/github/ethanicuss/astraladditions/registry/ModFanProcessingType.java @@ -1,18 +1,19 @@ -package com.github.ethanicuss.astraladditions.compat.create; +package com.github.ethanicuss.astraladditions.registry; import com.github.ethanicuss.astraladditions.AstralAdditions; +import com.github.ethanicuss.astraladditions.compat.create.ShimmerTransmuteType; import com.simibubi.create.content.kinetics.fan.processing.FanProcessingType; import com.simibubi.create.content.kinetics.fan.processing.FanProcessingTypeRegistry; import net.minecraft.util.Identifier; public class ModFanProcessingType { public static final ShimmerTransmuteType SHIMMER_TRANSMUTE = - register("shimmer_transmute", new ShimmerTransmuteType()); + registerFanProcess("shimmer_transmute", new ShimmerTransmuteType()); - private static T register(String name, T type) { + private static T registerFanProcess(String name, T type) { FanProcessingTypeRegistry.register(new Identifier(AstralAdditions.MOD_ID, name), type); return type; } - public static void register() {} + public static void registerFanProcess() {} } \ No newline at end of file diff --git a/src/main/java/com/github/ethanicuss/astraladditions/registry/ModParticles.java b/src/main/java/com/github/ethanicuss/astraladditions/registry/ModParticles.java index 0252dc9..96cc2eb 100644 --- a/src/main/java/com/github/ethanicuss/astraladditions/registry/ModParticles.java +++ b/src/main/java/com/github/ethanicuss/astraladditions/registry/ModParticles.java @@ -2,6 +2,7 @@ import com.github.ethanicuss.astraladditions.AstralAdditions; import com.github.ethanicuss.astraladditions.particle.shimmer.ShimmerBubbleParticle; +import com.github.ethanicuss.astraladditions.particle.shimmer.ShimmerBubblePopParticle; import com.github.ethanicuss.astraladditions.particle.shimmer.ShimmerSplashParticle; import net.fabricmc.fabric.api.client.particle.v1.ParticleFactoryRegistry; import net.fabricmc.fabric.api.particle.v1.FabricParticleTypes; @@ -24,5 +25,6 @@ public static void registerParticles() { public static void registerClient() { ParticleFactoryRegistry.getInstance().register(ModParticles.SHIMMER_BUBBLE, ShimmerBubbleParticle.Factory::new); ParticleFactoryRegistry.getInstance().register(ModParticles.SHIMMER_SPLASH, ShimmerSplashParticle.Factory::new); + ParticleFactoryRegistry.getInstance().register(ModParticles.SHIMMER_BUBBLE_POP, ShimmerBubblePopParticle.Factory::new); } } \ No newline at end of file diff --git a/src/main/resources/assets/astraladditions/lang/en_us.json b/src/main/resources/assets/astraladditions/lang/en_us.json index 9ce4442..8f2d4a7 100644 --- a/src/main/resources/assets/astraladditions/lang/en_us.json +++ b/src/main/resources/assets/astraladditions/lang/en_us.json @@ -113,6 +113,8 @@ "category.astraladditions.shattering": "Shattering", "category.astraladditions.shattering.workstations": "Any tool with this enchantment", + "category.astraladditions.bulk_shimmering": "Bulk Shimmering", + "effect.astraladditions.sink": "Sinking", "effect.astraladditions.parry": "Parry", "effect.astraladditions.frost": "Frost", diff --git a/src/main/resources/astraladditions.mixins.json b/src/main/resources/astraladditions.mixins.json index c61d9f0..532840b 100644 --- a/src/main/resources/astraladditions.mixins.json +++ b/src/main/resources/astraladditions.mixins.json @@ -4,12 +4,15 @@ "package": "com.github.ethanicuss.astraladditions.mixin", "compatibilityLevel": "JAVA_17", "mixins": [ + "yttr.YttrEachRegisterableFieldMixin", + "yttr.MagtankScreenHandlerMixin", + "ParryEffectMixin", "ShimmerEffectMixin", "EntityAccessor", "ItemEntityMixin", "NerfedShulkers", - "ParticleRecolourMixin", + "betterdragon.AbstractPhaseAccessor", "betterdragon.DragonAccessor", "betterdragon.HoverPhaseAccessor", @@ -32,7 +35,8 @@ "client": [ "SpaceMusicMixin", "ParticleRecolourMixin", - "InGameHudMixin" + "InGameHudMixin", + "ParticleRecolourMixin" ], "injectors": { "defaultRequire": 1