Skip to content

Commit

Permalink
feat: Implement the Aether: Unity into Redux
Browse files Browse the repository at this point in the history
  • Loading branch information
Zepalesque committed Dec 31, 2024
1 parent 7602e77 commit 3fe3db1
Show file tree
Hide file tree
Showing 71 changed files with 214 additions and 1,079 deletions.
5 changes: 0 additions & 5 deletions src/main/java/net/zepalesque/redux/Redux.java
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
package net.zepalesque.redux;

import com.aetherteam.aether.item.AetherItems;
import com.google.common.reflect.Reflection;
import com.mojang.logging.LogUtils;
import io.github.razordevs.aeroblender.aether.AetherRuleCategory;
Expand Down Expand Up @@ -41,12 +40,10 @@
import net.zepalesque.redux.tile.ReduxTiles;
import net.zepalesque.redux.world.biome.ReduxRegion;
import net.zepalesque.redux.world.biome.ReduxSurfaceRules;
import net.zepalesque.redux.world.biome.tint.ReduxBiomeTints;
import net.zepalesque.redux.world.feature.gen.ReduxFeatures;
import net.zepalesque.redux.world.tree.decorator.ReduxTreeDecorators;
import net.zepalesque.redux.world.tree.foliage.ReduxFoliagePlacers;
import net.zepalesque.zenith.api.blockset.BlockSet;
import net.zepalesque.zenith.network.packet.BiomeTintSyncPacket;
import org.slf4j.Logger;
import terrablender.api.Regions;
import terrablender.api.SurfaceRuleManager;
Expand All @@ -70,7 +67,6 @@ public Redux(ModContainer mod, IEventBus bus, Dist dist) {
if (dist == Dist.CLIENT) {
bus.addListener(EventPriority.LOWEST, ReduxColors::blockColors);
bus.addListener(ReduxColors::itemColors);
bus.addListener(ReduxColors::resolvers);
}

Reflection.initialize(ReduxWoodSets.class, ReduxStoneSets.class, ReduxFlowerSets.class);
Expand All @@ -80,7 +76,6 @@ public Redux(ModContainer mod, IEventBus bus, Dist dist) {
ReduxItems.ITEMS,
ReduxEntities.ENTITIES,
ReduxTiles.TILES,
ReduxBiomeTints.TINTS,
ReduxFeatures.FEATURES,
ReduxFoliagePlacers.FOLIAGE_PLACERS,
ReduxParticles.PARTICLES,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,20 +4,16 @@
import com.aetherteam.nitrogen.network.packet.SyncPacket;
import com.mojang.serialization.Codec;
import com.mojang.serialization.codecs.RecordCodecBuilder;
import net.minecraft.core.particles.ParticleType;
import net.minecraft.core.particles.ParticleTypes;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.sounds.SoundSource;
import net.minecraft.util.ExtraCodecs;
import net.minecraft.util.RandomSource;
import net.minecraft.world.entity.player.Player;
import net.minecraft.world.item.alchemy.Potions;
import net.minecraft.world.level.Level;
import net.zepalesque.redux.client.audio.ReduxSounds;
import net.zepalesque.redux.client.particle.ReduxParticles;
import net.zepalesque.redux.item.ReduxItems;
import net.zepalesque.redux.network.packet.ReduxPlayerSyncPacket;
import net.zepalesque.zenith.util.codec.UnboundedHashMapCodec;
import net.zepalesque.zenith.api.serialization.codec.type.UnboundedHashMapCodec;
import org.apache.commons.lang3.tuple.Triple;
import org.jetbrains.annotations.NotNull;

Expand Down
30 changes: 8 additions & 22 deletions src/main/java/net/zepalesque/redux/block/ReduxBlocks.java
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@
import net.minecraft.world.level.block.RotatedPillarBlock;
import net.minecraft.world.level.block.SoundType;
import net.minecraft.world.level.block.state.BlockBehaviour;
import net.minecraft.world.level.block.state.BlockBehaviour.Properties;
import net.minecraft.world.level.block.state.BlockBehaviour.OffsetType;
import net.minecraft.world.level.block.state.BlockBehaviour.Properties;
import net.minecraft.world.level.block.state.properties.NoteBlockInstrument;
import net.minecraft.world.level.material.MapColor;
import net.minecraft.world.level.material.PushReaction;
Expand All @@ -26,42 +26,28 @@
import net.zepalesque.redux.block.dungeon.DoorwayPillarBlock;
import net.zepalesque.redux.block.dungeon.RunelightBlock;
import net.zepalesque.redux.block.dungeon.TrappedPillarBlock;
import net.zepalesque.redux.block.natural.AetherShortGrassBlock;
import net.zepalesque.redux.block.natural.HangingAetherVinesHead;
import net.zepalesque.redux.block.natural.HangingAetherVinesBody;
import net.zepalesque.redux.block.natural.GoldenCloversBlock;
import net.zepalesque.redux.block.natural.HangingAetherVinesBody;
import net.zepalesque.redux.block.natural.HangingAetherVinesHead;
import net.zepalesque.redux.block.natural.bush.CustomBoundsBushBlock;
import net.zepalesque.redux.block.natural.crop.WyndoatsBlock;
import net.zepalesque.redux.block.natural.leaves.FallingLeavesBlock;
import net.zepalesque.redux.block.natural.leaves.LeafPileBlock;
import net.zepalesque.redux.block.redstone.LogicatorBlock;
import net.zepalesque.redux.block.state.ReduxBlockBuilders;
import net.zepalesque.redux.client.particle.ReduxParticles;
import net.zepalesque.redux.event.hook.ToolActionHooks;
import net.zepalesque.zenith.api.blockset.AbstractWoodSet;
import net.zepalesque.zenith.block.util.CommonPlantBounds;
import net.zepalesque.unity.block.natural.leaves.LeafPileBlock;
import net.zepalesque.unity.event.hook.BlockHooks;
import net.zepalesque.zenith.api.block.CommonPlantBounds;
import net.zepalesque.zenith.api.blockset.type.AbstractWoodSet;
import net.zepalesque.zenith.mixin.mixins.common.accessor.FireAccessor;

public class ReduxBlocks extends ReduxBlockBuilders {

public static final DeferredRegister.Blocks BLOCKS = DeferredRegister.createBlocks(Redux.MODID);

public static DeferredBlock<AetherShortGrassBlock> SHORT_AETHER_GRASS = register("short_aether_grass",
() -> new AetherShortGrassBlock(
Properties.ofFullCopy(Blocks.SHORT_GRASS)
.offsetType(OffsetType.XZ)
.hasPostProcess((state, level, pos) -> true)
));

public static DeferredBlock<FallingLeavesBlock> GILDENROOT_LEAVES = register("gildenroot_leaves",
() -> new FallingLeavesBlock(ReduxParticles.GILDENROOT_LEAF, Properties.ofFullCopy(AetherBlocks.SKYROOT_LEAVES.get()).mapColor(MapColor.QUARTZ)));

public static DeferredBlock<LeafPileBlock> SKYROOT_LEAF_PILE = register("skyroot_leaf_pile",
() -> new LeafPileBlock(AetherBlocks.SKYROOT_LEAVES));

public static DeferredBlock<LeafPileBlock> GOLDEN_OAK_LEAF_PILE = register("golden_oak_leaf_pile",
() -> new LeafPileBlock(AetherBlocks.GOLDEN_OAK_LEAVES));

public static DeferredBlock<LeafPileBlock> GILDENROOT_LEAF_PILE = register("gildenroot_leaf_pile",
() -> new LeafPileBlock(GILDENROOT_LEAVES));

Expand Down Expand Up @@ -217,7 +203,7 @@ public static void registerFlammability() {
public static void registerToolConversions() {
Redux.BLOCK_SETS.forEach(set -> {
if (set instanceof AbstractWoodSet wood) {
wood.setupStrippables(ToolActionHooks.STRIPPABLES);
wood.setupStrippables(BlockHooks.ToolConversions.STRIPPABLES);
}
});
}
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@
import net.minecraft.world.phys.shapes.VoxelShape;
import net.zepalesque.redux.block.state.ReduxStates;
import net.zepalesque.redux.data.ReduxTags;
import net.zepalesque.unity.block.state.UnityStates;
import net.zepalesque.unity.data.UnityTags;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;

Expand All @@ -39,20 +41,20 @@ public static class Enchanted extends CustomBoundsBushBlock {

public Enchanted(VoxelShape shape, Properties properties) {
super(shape, properties);
this.registerDefaultState(this.defaultBlockState().setValue(ReduxStates.ENCHANTED, false));
this.registerDefaultState(this.defaultBlockState().setValue(UnityStates.ENCHANTED, false));
}

@Override
protected void createBlockStateDefinition(StateDefinition.Builder<Block, BlockState> builder) {
super.createBlockStateDefinition(builder);
builder.add(ReduxStates.ENCHANTED);
builder.add(UnityStates.ENCHANTED);
}


public BlockState setValues(Level level, BlockPos pos, BlockState state) {
BlockPos below = pos.below();
if (level.getBlockState(below).is(AetherBlocks.ENCHANTED_AETHER_GRASS_BLOCK.get())) {
return state.setValue(ReduxStates.ENCHANTED, true);
return state.setValue(UnityStates.ENCHANTED, true);
}

return state;
Expand All @@ -68,11 +70,11 @@ public BlockState getStateForPlacement(BlockPlaceContext context) {
@NotNull
public BlockState updateShape(BlockState state, Direction facing, BlockState facingState, LevelAccessor level, BlockPos currentPos, BlockPos facingPos) {
BlockState b = super.updateShape(state, facing, facingState, level, currentPos, facingPos);
if (b.hasProperty(ReduxStates.ENCHANTED) && facing == Direction.DOWN) {
if (level.getBlockState(facingPos).is(ReduxTags.Blocks.ENCHANTED_GRASS_BLOCKS)) {
return b.setValue(ReduxStates.ENCHANTED, true);
if (b.hasProperty(UnityStates.ENCHANTED) && facing == Direction.DOWN) {
if (level.getBlockState(facingPos).is(UnityTags.Blocks.SHORT_AETHER_GRASS_STATE_ENCHANTING)) {
return b.setValue(UnityStates.ENCHANTED, true);
}
return b.setValue(ReduxStates.ENCHANTED, false);
return b.setValue(UnityStates.ENCHANTED, false);
}
return b;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@
import net.minecraft.world.phys.shapes.VoxelShape;
import net.zepalesque.redux.block.state.ReduxStates;
import net.zepalesque.redux.data.ReduxTags;
import net.zepalesque.unity.block.state.UnityStates;
import net.zepalesque.unity.data.UnityTags;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;

Expand All @@ -41,19 +43,19 @@ public static class Enchanted extends CustomBoundsFlowerBlock {

public Enchanted(VoxelShape shape, Holder<MobEffect> effectSupplier, int pEffectDuration, Properties pProperties) {
super(shape, effectSupplier, pEffectDuration, pProperties);
this.registerDefaultState(this.defaultBlockState().setValue(ReduxStates.ENCHANTED, false));
this.registerDefaultState(this.defaultBlockState().setValue(UnityStates.ENCHANTED, false));
}

@Override
protected void createBlockStateDefinition(StateDefinition.Builder<Block, BlockState> builder) {
super.createBlockStateDefinition(builder);
builder.add(ReduxStates.ENCHANTED);
builder.add(UnityStates.ENCHANTED);
}

public BlockState setValues(Level level, BlockPos pos, BlockState state) {
BlockPos below = pos.below();
if (level.getBlockState(below).is(AetherBlocks.ENCHANTED_AETHER_GRASS_BLOCK.get())) {
return state.setValue(ReduxStates.ENCHANTED, true);
return state.setValue(UnityStates.ENCHANTED, true);
}

return state;
Expand All @@ -69,11 +71,11 @@ public BlockState getStateForPlacement(BlockPlaceContext context) {
@NotNull
public BlockState updateShape(BlockState state, Direction facing, BlockState facingState, LevelAccessor level, BlockPos currentPos, BlockPos facingPos) {
BlockState b = super.updateShape(state, facing, facingState, level, currentPos, facingPos);
if (b.hasProperty(ReduxStates.ENCHANTED) && facing == Direction.DOWN) {
if (level.getBlockState(facingPos).is(ReduxTags.Blocks.ENCHANTED_GRASS_BLOCKS)) {
return b.setValue(ReduxStates.ENCHANTED, true);
if (b.hasProperty(UnityStates.ENCHANTED) && facing == Direction.DOWN) {
if (level.getBlockState(facingPos).is(UnityTags.Blocks.SHORT_AETHER_GRASS_STATE_ENCHANTING)) {
return b.setValue(UnityStates.ENCHANTED, true);
}
return b.setValue(ReduxStates.ENCHANTED, false);
return b.setValue(UnityStates.ENCHANTED, false);
}
return b;
}
Expand Down
Loading

0 comments on commit 3fe3db1

Please sign in to comment.