Skip to content

Commit 0190ef1

Browse files
clean
1 parent cae273b commit 0190ef1

31 files changed

+297
-197
lines changed

build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ dependencies {
5555
modLocalRuntime("me.shedaniel:RoughlyEnoughItems-fabric:${rei_version}")
5656

5757
modCompileOnly "maven.modrinth:yttr:${yttr_version}"
58-
modLocalRuntime "maven.modrinth:yttr:${yttr_version}"
58+
//modLocalRuntime "maven.modrinth:yttr:${yttr_version}"
5959

6060
modImplementation("com.simibubi.create:create-fabric-1.18.2:${create_version}")
6161

src/main/java/com/github/ethanicuss/astraladditions/AstralAdditions.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ public void onInitialize() {
2727
ModEntitySpawns.registerEntitySpawn();
2828
ModEffects.registerEffects();
2929
ModParticles.registerParticles();
30-
30+
ModPotion.registerPotions();
3131
LOGGER.info("Astral Additions is active!");
3232
}
3333
}

src/main/java/com/github/ethanicuss/astraladditions/AstralAdditionsClient.java

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,7 @@
11
package com.github.ethanicuss.astraladditions;
22

3-
import com.github.ethanicuss.astraladditions.registry.ModParticles;
4-
import com.github.ethanicuss.astraladditions.registry.ModEntities;
5-
import com.github.ethanicuss.astraladditions.registry.ModFluids;
3+
import com.github.ethanicuss.astraladditions.registry.*;
64
import com.github.ethanicuss.astraladditions.playertracker.PlayerTracker;
7-
import com.github.ethanicuss.astraladditions.registry.ModBlocks;
8-
import com.github.ethanicuss.astraladditions.registry.ModItemProperties;
95
import net.fabricmc.api.ClientModInitializer;
106
import org.slf4j.Logger;
117
import org.slf4j.LoggerFactory;
@@ -22,7 +18,7 @@ public void onInitializeClient() {
2218
ModFluids.registerFluidRenderersClient();
2319
ModParticles.registerClient();
2420
ModItemProperties.registerClient();
25-
21+
ModPotion.registerClient();
2622
LOGGER.info("Astral Additions client is active!");
2723
}
2824
}

src/main/java/com/github/ethanicuss/astraladditions/blocks/MultisidedBlock.java

Lines changed: 0 additions & 19 deletions
This file was deleted.

src/main/java/com/github/ethanicuss/astraladditions/compat/rei/AstralAdditionsREIClientPlugin.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -115,8 +115,7 @@ public void registerDisplays(DisplayRegistry registry) {
115115
List<TransmuteDisplay> transmuteRecipes = recipeManager.listAllOfType(TransmuteRecipe.Type.INSTANCE).stream().map(TransmuteDisplay::of).toList();
116116
transmuteRecipes.forEach(registry::add);
117117

118-
List<VacuumDisplay> vacuumRecipes = recipeManager.listAllOfType(ChromaticVacuumRecipe.Type.INSTANCE).stream().map(VacuumDisplay::of).toList();
119-
vacuumRecipes.forEach(registry::add);
118+
registry.registerFiller(ChromaticVacuumRecipe.class, VacuumDisplay::of);
120119

121120
//* YTTR
122121
List<CentrifugeDisplay> centrifugeRecipes = recipeManager.listAllOfType(YRecipeTypes.CENTRIFUGING).stream().map(CentrifugeDisplay::of).toList();

src/main/java/com/github/ethanicuss/astraladditions/compat/rei/vacuum/VacuumDisplay.java

Lines changed: 27 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -6,49 +6,53 @@
66
import me.shedaniel.rei.api.common.display.basic.BasicDisplay;
77
import me.shedaniel.rei.api.common.entry.EntryIngredient;
88
import me.shedaniel.rei.api.common.util.EntryIngredients;
9+
import net.minecraft.item.ItemStack;
10+
import net.minecraft.recipe.Ingredient;
911
import net.minecraft.recipe.Recipe;
1012
import net.minecraft.util.Identifier;
1113

1214
import java.util.Collections;
1315
import java.util.List;
16+
import java.util.Optional;
1417

1518
public class VacuumDisplay extends BasicDisplay {
1619

17-
private final Identifier id;
18-
private final List<EntryIngredient> remainder;
20+
private final List<EntryIngredient> remainderEntries;
1921

20-
public VacuumDisplay(Identifier id, List<EntryIngredient> inputs, List<EntryIngredient> outputs, List<EntryIngredient> remainder) {
21-
super(inputs, outputs);
22-
this.id = id;
23-
this.remainder = remainder;
24-
25-
}
26-
27-
public List<EntryIngredient> getRemainderEntries() {
28-
return remainder;
22+
public VacuumDisplay(Identifier id,
23+
List<EntryIngredient> inputs,
24+
List<EntryIngredient> outputs,
25+
List<EntryIngredient> remainder) {
26+
super(inputs, outputs, Optional.ofNullable(id)); // REI 8.x ctor
27+
this.remainderEntries = (remainder == null) ? Collections.emptyList() : remainder;
2928
}
3029

3130
@Override
3231
public CategoryIdentifier<?> getCategoryIdentifier() {
3332
return AstralAdditionsREIClientPlugin.VACUUM;
3433
}
3534

36-
public static VacuumDisplay of(Recipe<?> recipe) {
35+
public List<EntryIngredient> getRemainderEntries() {
36+
return remainderEntries;
37+
}
3738

38-
ChromaticVacuumRecipe chromaticRecipe = (ChromaticVacuumRecipe) recipe;
39+
/** Return null to let REI skip invalid/unsynced recipes. */
40+
public static VacuumDisplay of(Recipe<?> recipe) {
41+
if (!(recipe instanceof ChromaticVacuumRecipe chromatic)) return null;
3942

40-
List<EntryIngredient> ingredient = Collections.singletonList(
41-
EntryIngredients.of(chromaticRecipe.getIngredient())
42-
);
43+
ItemStack ing = chromatic.getIngredient(); // if yours actually returns Ingredient, change type + EntryIngredients.of(ing)
44+
if (ing == null || ing.isEmpty()) return null;
4345

44-
List<EntryIngredient> output = Collections.singletonList(
45-
EntryIngredients.of(chromaticRecipe.getOutput())
46-
);
46+
ItemStack out = chromatic.getOutput();
47+
if (out == null || out.isEmpty()) return null;
4748

48-
List<EntryIngredient> remainder = chromaticRecipe.hasRemainder()
49-
? Collections.singletonList(EntryIngredients.of(chromaticRecipe.getRemainder()))
50-
: Collections.emptyList();
49+
List<EntryIngredient> inputs = Collections.singletonList(EntryIngredients.of(ing));
50+
List<EntryIngredient> outputs = Collections.singletonList(EntryIngredients.of(out));
51+
List<EntryIngredient> remainders =
52+
chromatic.hasRemainder() && chromatic.getRemainder() != null && !chromatic.getRemainder().isEmpty()
53+
? Collections.singletonList(EntryIngredients.of(chromatic.getRemainder()))
54+
: Collections.emptyList();
5155

52-
return new VacuumDisplay(recipe.getId(), ingredient, output, remainder);
56+
return new VacuumDisplay(recipe.getId(), inputs, outputs, remainders);
5357
}
5458
}

src/main/java/com/github/ethanicuss/astraladditions/items/PylonItem.java

Lines changed: 0 additions & 93 deletions
Original file line numberDiff line numberDiff line change
@@ -180,99 +180,6 @@ public TypedActionResult<ItemStack> use(World world, PlayerEntity user, Hand han
180180
private double getDistance(double x1, double y1, double z1, double x2, double y2, double z2){
181181
return Math.sqrt(Math.pow(x1-x2, 2) + Math.pow(y1-y2, 2) + Math.pow(z1-z2, 2));
182182
}
183-
/*
184-
@Override
185-
public TypedActionResult<ItemStack> use(World world, PlayerEntity user, Hand hand) {
186-
ItemStack itemStack = user.getStackInHand(hand);
187-
world.playSound(null, user.getX(), user.getY(), user.getZ(), SoundEvents.ENTITY_ENDERMAN_TELEPORT, SoundCategory.NEUTRAL, 0.5f, 0.3f / (world.getRandom().nextFloat() * 0.4f + 0.8f));
188-
if (world.isClient()) {
189-
} else {
190-
double i = user.getX();
191-
double j = user.getY();
192-
double k = user.getZ();
193-
float f = 128.0f;
194-
Box box = new Box((float) i - f, (float) j - f, (float) k - f, (float) (i + 1) + f, (float) (j + 1) + f, (float) (k + 1) + f);
195-
List<PylonEntity> pylons = user.world.getEntitiesByType(TypeFilter.instanceOf(PylonEntity.class), box, pylonEntity -> PylonEntity.isOwner(pylonEntity, user.getEntityName()));
196-
if (!pylons.isEmpty()) {
197-
PylonEntity pylon = pylons.get(0);
198-
if (!user.isSneaking()) {
199-
for (int amount = 0; amount < 10; amount++) {
200-
MinecraftClient.getInstance().world.addParticle(ParticleTypes.GLOW_SQUID_INK, user.getX(), user.getY(), user.getZ(), 0.0 + world.getRandom().nextFloat() * 0.2f - 0.1f, 0.3 + world.getRandom().nextFloat() * 0.7f, 0.0 + world.getRandom().nextFloat() * 0.2f - 0.1f);
201-
MinecraftClient.getInstance().world.addParticle(ParticleTypes.GLOW_SQUID_INK, pylon.getX(), pylon.getY(), pylon.getZ(), 0.0 + world.getRandom().nextFloat() * 0.2f - 0.1f, 0.3 + world.getRandom().nextFloat() * 0.7f, 0.0 + world.getRandom().nextFloat() * 0.2f - 0.1f);
202-
MinecraftClient.getInstance().world.addParticle(ParticleTypes.WITCH, user.getX(), user.getY(), user.getZ(), 0.0 + world.getRandom().nextFloat() * 0.8f - 0.4f, 0.4 + world.getRandom().nextFloat() * 0.3f, 0.0 + world.getRandom().nextFloat() * 0.8f - 0.4f);
203-
MinecraftClient.getInstance().world.addParticle(ParticleTypes.WITCH, pylon.getX(), pylon.getY(), pylon.getZ(), 0.0 + world.getRandom().nextFloat() * 0.8f - 0.4f, 0.4 + world.getRandom().nextFloat() * 0.3f, 0.0 + world.getRandom().nextFloat() * 0.8f - 0.4f);
204-
}
205-
((ServerPlayerEntity) user).networkHandler.requestTeleport(pylon.getX(), pylon.getY(), pylon.getZ(), user.getYaw(), user.getPitch(), EnumSet.noneOf(PlayerPositionLookS2CPacket.Flag.class));
206-
MinecraftClient.getInstance().player.setVelocity(0.0f, 0.5f, 0.0f);
207-
world.playSound(null, user.getX(), user.getY(), user.getZ(), SoundEvents.AMBIENT_UNDERWATER_ENTER, SoundCategory.NEUTRAL, 0.7f, 0.8f / (world.getRandom().nextFloat() * 0.4f + 0.8f));
208-
world.playSound(null, pylon.getX(), pylon.getY(), pylon.getZ(), SoundEvents.AMBIENT_UNDERWATER_ENTER, SoundCategory.NEUTRAL, 0.7f, 0.8f / (world.getRandom().nextFloat() * 0.4f + 0.8f));
209-
}
210-
else{
211-
for (int amount = 0; amount < 45; amount++) {
212-
MinecraftClient.getInstance().world.addParticle(ParticleTypes.GLOW_SQUID_INK, pylon.getX(), pylon.getY() + 0.2f, pylon.getZ(), Math.sin(amount*8.0f)*1.2f, 0, Math.cos(amount*8.0f)*1.2f);
213-
MinecraftClient.getInstance().world.addParticle(ParticleTypes.SQUID_INK, pylon.getX(), pylon.getY() + 1.2f, pylon.getZ(), Math.sin(amount*8.0f)*1.4f, 0, Math.cos(amount*8.0f)*1.4f);
214-
MinecraftClient.getInstance().world.addParticle(ParticleTypes.GLOW_SQUID_INK, pylon.getX(), pylon.getY() + 2.2f, pylon.getZ(), Math.sin(amount*8.0f)*1.2f, 0, Math.cos(amount*8.0f)*1.2f);
215-
}
216-
world.playSound(null, pylon.getX(), pylon.getY(), pylon.getZ(), SoundEvents.BLOCK_BELL_USE, SoundCategory.NEUTRAL, 0.5f, 1.5f);
217-
float strength = -0.16f;
218-
float vStrength = 0.05f;
219-
List<Entity> pl = world.getOtherEntities(pylon, new Box(pylon.getX()-16, pylon.getY()-32, pylon.getZ()-16, pylon.getX()+16, pylon.getY()+32, pylon.getZ()+16));
220-
pl.add(MinecraftClient.getInstance().player);
221-
for (Entity p : pl) {
222-
if (p instanceof LivingEntity){
223-
int strMult = 1;
224-
if (!(p instanceof PlayerEntity)) {
225-
strMult *= 2;
226-
}
227-
double xdiff = pylon.getX() - p.getX();
228-
double zdiff = pylon.getZ() - p.getZ();
229-
double dist = Math.sqrt(Math.pow(xdiff, 2) + Math.pow(zdiff, 2));
230-
if (dist < 10) {
231-
if (xdiff == 0) {
232-
xdiff = 0.01;
233-
}
234-
if (zdiff == 0) {
235-
zdiff = 0.01;
236-
}
237-
double angleX = Math.atan(Math.abs(zdiff) / xdiff);
238-
double angleZ = Math.atan(Math.abs(xdiff) / zdiff);
239-
double cosX = Math.cos(angleX);
240-
double cosZ = Math.cos(angleZ);
241-
if (cosX == 0) {
242-
cosX = 0.01;
243-
}
244-
if (cosZ == 0) {
245-
cosZ = 0.01;
246-
}
247-
dist = -dist + 10;
248-
p.addVelocity(dist * cosX * strength * strMult * (Math.abs(angleX) / angleX), Math.abs(dist * vStrength * strMult), dist * cosZ * strength * strMult * (Math.abs(angleZ) / angleZ));
249-
}
250-
}
251-
}
252-
}
253-
254-
pylon.discard();
255-
} else {
256-
world.playSound(null, user.getX(), user.getY(), user.getZ(), SoundEvents.AMBIENT_UNDERWATER_EXIT, SoundCategory.NEUTRAL, 0.7f, 0.8f / (world.getRandom().nextFloat() * 0.4f + 0.8f));
257-
for (int amount = 0; amount < 5; amount++) {
258-
MinecraftClient.getInstance().world.addParticle(ParticleTypes.WITCH, user.getX(), user.getY(), user.getZ(), 0.0 + world.getRandom().nextFloat() * 0.4f - 0.2f, 0.2 + world.getRandom().nextFloat() * 0.2f, 0.0 + world.getRandom().nextFloat() * 0.4f - 0.2f);
259-
}
260-
for (int amount = 0; amount < 45; amount++) {
261-
MinecraftClient.getInstance().world.addParticle(ParticleTypes.GLOW_SQUID_INK, user.getX(), user.getY() + 0.2f, user.getZ(), Math.sin(amount*8.0f)*1.0f, 0, Math.cos(amount*8.0f)*1.0f);
262-
}
263-
PylonEntity pylon = new PylonEntity(ModEntities.PYLON, user.world);
264-
pylon.setPlayer(user.getEntityName());
265-
pylon.setPos(user.getX(), user.getY() + 1, user.getZ());
266-
pylon.refreshPositionAndAngles(user.getX(), user.getY() + 1, user.getZ(), 0, 0);
267-
world.spawnEntity(pylon);
268-
}
269-
}
270-
user.getItemCooldownManager().set(this, 60);
271-
user.incrementStat(Stats.USED.getOrCreateStat(this));
272-
return TypedActionResult.success(itemStack, world.isClient());
273-
}
274-
275-
*/
276183

277184
@Override
278185
public void appendTooltip(ItemStack itemStack, @Nullable World world, List<Text> tooltip, TooltipContext context) {
Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
package com.github.ethanicuss.astraladditions.mixin;
2+
3+
import com.github.ethanicuss.astraladditions.AstralAdditions;
4+
import com.github.ethanicuss.astraladditions.registry.ModData;
5+
import com.mojang.blaze3d.systems.RenderSystem;
6+
import net.minecraft.client.MinecraftClient;
7+
import net.minecraft.client.gui.DrawableHelper;
8+
import net.minecraft.client.gui.hud.InGameHud;
9+
import net.minecraft.client.util.math.MatrixStack;
10+
import net.minecraft.entity.player.PlayerEntity;
11+
import net.minecraft.util.Identifier;
12+
import net.minecraft.util.math.BlockPos;
13+
import net.minecraft.util.math.Vec3d;
14+
import org.slf4j.Logger;
15+
import org.slf4j.LoggerFactory;
16+
import org.spongepowered.asm.mixin.Final;
17+
import org.spongepowered.asm.mixin.Mixin;
18+
import org.spongepowered.asm.mixin.Shadow;
19+
import org.spongepowered.asm.mixin.injection.At;
20+
import org.spongepowered.asm.mixin.injection.Redirect;
21+
22+
@Mixin(InGameHud.class)
23+
public abstract class InGameHudMixin {
24+
@Shadow @Final private MinecraftClient client;
25+
26+
private static final Identifier shimmerBubbleTexture = new Identifier(AstralAdditions.MOD_ID, "textures/gui/shimmer_air_bubbles.png");
27+
28+
private static boolean isBubbleQuad(int u, int v, int w, int h) {
29+
return w == 9 && h == 9 && v == 18 && (u == 16 || u == 25);
30+
}
31+
32+
private boolean isEyeInShimmer(PlayerEntity player) {
33+
if (player == null) return false;
34+
Vec3d eye = player.getCameraPosVec(1.0f).add(0, -0.5, 0);
35+
BlockPos pos = new BlockPos(eye.x, eye.y, eye.z);
36+
return player.world.getFluidState(pos).isIn(ModData.SHIMMER_TAG);
37+
}
38+
39+
@Redirect(method = "renderStatusBars",
40+
at = @At(value = "INVOKE",
41+
target = "Lnet/minecraft/client/gui/hud/InGameHud;drawTexture(Lnet/minecraft/client/util/math/MatrixStack;IIIIII)V"),
42+
require = 0
43+
)
44+
private void renderShimmerBubbles(InGameHud self, MatrixStack m, int x, int y, int u, int v, int w, int h) {
45+
if (isEyeInShimmer(client.player) && isBubbleQuad(u, v, w, h)) {
46+
RenderSystem.setShaderTexture(0, shimmerBubbleTexture);
47+
self.drawTexture(m, x, y, u, v, w, h);
48+
RenderSystem.setShaderTexture(0, DrawableHelper.GUI_ICONS_TEXTURE);
49+
} else {
50+
self.drawTexture(m, x, y, u, v, w, h);
51+
}
52+
}
53+
54+
}

src/main/java/com/github/ethanicuss/astraladditions/registry/ModData.java

Lines changed: 17 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,26 +2,35 @@
22

33
import com.github.ethanicuss.astraladditions.AstralAdditions;
44
import net.minecraft.block.Block;
5+
import net.minecraft.fluid.Fluid;
56
import net.minecraft.item.Item;
67
import net.minecraft.tag.TagKey;
78
import net.minecraft.util.Identifier;
89
import net.minecraft.util.registry.Registry;
910

1011
public class ModData {
11-
public static final TagKey<Block> BULBA_GROWABLE = register("bulba_growable");
12-
public static final TagKey<Block> LUNE_SHROOM_GROWABLE = register("lune_shroom_growable");
13-
public static final TagKey<Block> DESIZER_IGNORE_BLOCKS = register("desizer_ignore_blocks");
14-
public static final TagKey<Block> DESIZER_CASING_BLOCKS = register("desizer_casing_blocks");
15-
public static final TagKey<Item> INGORE_TRANSMUTATION = registerItemKey("ignore_shimmer_transmutation");
12+
public static final TagKey<Block> BULBA_GROWABLE = registerBlockTag("bulba_growable");
13+
public static final TagKey<Block> LUNE_SHROOM_GROWABLE = registerBlockTag("lune_shroom_growable");
14+
public static final TagKey<Block> DESIZER_IGNORE_BLOCKS = registerBlockTag("desizer_ignore_blocks");
15+
public static final TagKey<Block> DESIZER_CASING_BLOCKS = registerBlockTag("desizer_casing_blocks");
16+
17+
public static final TagKey<Item> INGORE_TRANSMUTATION = registerItemTag("ignore_shimmer_transmutation");
18+
19+
public static final TagKey<Fluid> SHIMMER_TAG = registerFluidTag("shimmer");
20+
public static final TagKey<Fluid> SPUTUM_TAG = registerFluidTag("sputum");
1621

1722
public static final Identifier FRAGILE_ITEM_PARTS = new Identifier(AstralAdditions.MOD_ID, "gameplay/fragile_items/fragile_item");
1823
public static final Identifier FRAGILE_ITEM_PARTS_2 = new Identifier(AstralAdditions.MOD_ID, "gameplay/fragile_items/fragile_item_2");
1924
public static final Identifier FRAGILE_ITEM_PARTS_3 = new Identifier(AstralAdditions.MOD_ID, "gameplay/fragile_items/fragile_item_3");
2025

21-
private static TagKey<Block> register(String id) {
26+
private static TagKey<Block> registerBlockTag(String id) {
2227
return TagKey.of(Registry.BLOCK_KEY, new Identifier(AstralAdditions.MOD_ID, id));
2328
}
24-
private static TagKey<Item> registerItemKey(String id) {
29+
private static TagKey<Item> registerItemTag(String id) {
2530
return TagKey.of(Registry.ITEM_KEY, new Identifier(AstralAdditions.MOD_ID, id));
2631
}
27-
}
32+
33+
private static TagKey<Fluid> registerFluidTag(String id) {
34+
return TagKey.of(Registry.FLUID_KEY, new Identifier(AstralAdditions.MOD_ID, id));
35+
}
36+
}

0 commit comments

Comments
 (0)