Skip to content

Commit f1b9b0e

Browse files
committed
feat: Aether Mud Dripstone Conversion
Added functionality to convert Aether Mud into Quicksoil. Credits to AriaElidove for the idea. closes #315
1 parent 9fd2b3d commit f1b9b0e

File tree

3 files changed

+51
-1
lines changed

3 files changed

+51
-1
lines changed
Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
package io.github.razordevs.deep_aether.mixin.block;
2+
3+
import com.aetherteam.aether.block.AetherBlocks;
4+
import com.llamalad7.mixinextras.sugar.Local;
5+
import io.github.razordevs.deep_aether.init.DABlocks;
6+
import net.minecraft.core.BlockPos;
7+
import net.minecraft.server.level.ServerLevel;
8+
import net.minecraft.world.level.Level;
9+
import net.minecraft.world.level.block.Block;
10+
import net.minecraft.world.level.block.PointedDripstoneBlock;
11+
import net.minecraft.world.level.block.state.BlockState;
12+
import net.minecraft.world.level.gameevent.GameEvent;
13+
import net.minecraft.world.level.material.Fluid;
14+
import net.minecraft.world.level.material.Fluids;
15+
import org.spongepowered.asm.mixin.Mixin;
16+
import org.spongepowered.asm.mixin.injection.At;
17+
import org.spongepowered.asm.mixin.injection.Inject;
18+
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
19+
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
20+
21+
import java.util.Optional;
22+
23+
@Mixin(PointedDripstoneBlock.class)
24+
public abstract class PointedDripstoneBlockMixin {
25+
26+
@Inject(at = @At(value = "INVOKE", target = "Lnet/minecraft/world/level/block/state/BlockState;is(Lnet/minecraft/world/level/block/Block;)Z"), method = "maybeTransferFluid")
27+
private static void maybeTransferFluid(BlockState state, ServerLevel level, BlockPos pos, float p_221863_, CallbackInfo ci, @Local Optional<PointedDripstoneBlock.FluidInfo> optional, @Local Fluid fluid, @Local(ordinal = 1) BlockPos blockpos) {
28+
if (optional.get().sourceState().is(DABlocks.AETHER_MUD.get()) && fluid == Fluids.WATER) {
29+
BlockState blockstate1 = AetherBlocks.QUICKSOIL.get().defaultBlockState();
30+
level.setBlockAndUpdate(optional.get().pos(), blockstate1);
31+
Block.pushEntitiesUp(optional.get().sourceState(), blockstate1, level, optional.get().pos());
32+
level.gameEvent(GameEvent.BLOCK_CHANGE, optional.get().pos(), GameEvent.Context.of(blockstate1));
33+
level.levelEvent(1504, blockpos, 0);
34+
}
35+
}
36+
37+
@Inject(at = @At("RETURN"), method = "getFluidAboveStalactite", cancellable = true)
38+
private static void getFluidAboveStalactite(Level p_154182_, BlockPos p_154183_, BlockState p_154184_, CallbackInfoReturnable<Optional<PointedDripstoneBlock.FluidInfo>> cir) {
39+
Optional<PointedDripstoneBlock.FluidInfo> info = cir.getReturnValue();
40+
41+
if(info.isPresent()) {
42+
if(info.get().sourceState().is(DABlocks.AETHER_MUD)) {
43+
cir.setReturnValue(Optional.of(new PointedDripstoneBlock.FluidInfo(info.get().pos(), Fluids.WATER, info.get().sourceState())));
44+
}
45+
}
46+
}
47+
}

src/main/resources/META-INF/accesstransformer.cfg

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,4 +18,6 @@ public net.minecraft.world.item.SmithingTemplateItem createNetheriteUpgradeIconL
1818
public net.minecraft.world.item.SmithingTemplateItem createNetheriteUpgradeMaterialList()Ljava/util/List;
1919
public net.minecraft.client.gui.components.Button Button(Lnet/minecraft/client/gui/components/Button$Builder;)V
2020
public-f net.minecraft.world.entity.Mob getLootTable()Lnet/minecraft/resources/ResourceKey; # getLootTable
21-
public net.minecraft.world.level.block.CropBlock getGrowthSpeed(Lnet/minecraft/world/level/block/state/BlockState;Lnet/minecraft/world/level/BlockGetter;Lnet/minecraft/core/BlockPos;)F
21+
public net.minecraft.world.level.block.CropBlock getGrowthSpeed(Lnet/minecraft/world/level/block/state/BlockState;Lnet/minecraft/world/level/BlockGetter;Lnet/minecraft/core/BlockPos;)F
22+
23+
public net.minecraft.world.level.block.PointedDripstoneBlock$FluidInfo

src/main/resources/deep_aether.mixins.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
"block.AercloudMixin",
1313
"block.BlockBehaviourMixin",
1414
"block.LavaFluidMixin",
15+
"block.PointedDripstoneBlockMixin",
1516
"block.PowderedSnowMixin",
1617
"entity.AerwhaleMixin",
1718
"entity.ItemEntityMixin"

0 commit comments

Comments
 (0)