Skip to content

Commit

Permalink
feat: Bronze blocks
Browse files Browse the repository at this point in the history
  • Loading branch information
Zepalesque committed Jun 2, 2024
1 parent 5e6f57e commit df46013
Show file tree
Hide file tree
Showing 23 changed files with 457 additions and 11 deletions.
38 changes: 27 additions & 11 deletions src/main/java/net/zepalesque/redux/block/ReduxBlocks.java
Original file line number Diff line number Diff line change
@@ -1,21 +1,29 @@
package net.zepalesque.redux.block;

import com.aetherteam.aether.block.AetherBlocks;
import com.aetherteam.aether.block.dungeon.DoorwayBlock;
import com.aetherteam.aether.block.dungeon.TrappedBlock;
import com.aetherteam.aether.block.natural.LeavesWithParticlesBlock;
import com.aetherteam.aether.entity.AetherEntityTypes;
import com.google.common.base.Supplier;
import net.minecraft.world.item.BlockItem;
import net.minecraft.world.item.Item;
import net.minecraft.world.level.block.Block;
import net.minecraft.world.level.block.Blocks;
import net.minecraft.world.level.block.RotatedPillarBlock;
import net.minecraft.world.level.block.SaplingBlock;
import net.minecraft.world.level.block.state.BlockBehaviour;
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.neoforged.neoforge.registries.DeferredBlock;
import net.neoforged.neoforge.registries.DeferredRegister;
import net.zepalesque.redux.Redux;
import net.zepalesque.redux.block.dungeon.DoorwayPillarBlock;
import net.zepalesque.redux.block.dungeon.TrappedPillarBlock;
import net.zepalesque.redux.block.natural.AetherShortGrassBlock;
import net.zepalesque.redux.block.natural.leaves.FallingLeavesBlock;
import net.zepalesque.redux.block.state.ReduxBlockBuilders;
import net.zepalesque.redux.client.particle.ReduxParticles;
import net.zepalesque.redux.event.hook.ToolActionHooks;
import net.zepalesque.redux.item.ReduxItems;
Expand All @@ -24,7 +32,7 @@

import java.util.function.Function;

public class ReduxBlocks {
public class ReduxBlocks extends ReduxBlockBuilders {

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

Expand All @@ -35,23 +43,31 @@ public class ReduxBlocks {
));

public static final DeferredBlock<SaplingBlock> CLOUDROOT_SAPLING = register("cloudroot_sapling",
() -> new SaplingBlock(ReduxTreeGrowers.CLOUDROOT, Block.Properties.ofFullCopy(Blocks.OAK_SAPLING)));

() -> new SaplingBlock(ReduxTreeGrowers.CLOUDROOT, Properties.ofFullCopy(Blocks.OAK_SAPLING)));

public static DeferredBlock<FallingLeavesBlock> CLOUDROOT_LEAVES = register("cloudroot_leaves",
() -> new FallingLeavesBlock(ReduxParticles.CLOUDROOT_LEAF,
BlockBehaviour.Properties.ofFullCopy(AetherBlocks.SKYROOT_LEAVES.get()).mapColor(MapColor.QUARTZ)));

public static final DeferredBlock<Block> CARVED_STONE_PILLAR = register("carved_stone_pillar", () -> new RotatedPillarBlock(Properties.of().mapColor(MapColor.STONE).instrument(NoteBlockInstrument.BASEDRUM).strength(0.5F, 6.0F).requiresCorrectToolForDrops()));
public static final DeferredBlock<Block> SENTRY_STONE_PILLAR = register("sentry_stone_pillar", () -> new RotatedPillarBlock(Properties.ofFullCopy(CARVED_STONE_PILLAR.get()).lightLevel(state -> 11)));
public static final DeferredBlock<Block> CARVED_STONE_BASE = register("carved_stone_base", () -> new Block(Properties.of().mapColor(MapColor.STONE).instrument(NoteBlockInstrument.BASEDRUM).strength(0.5F, 6.0F).requiresCorrectToolForDrops()));
public static final DeferredBlock<Block> SENTRY_STONE_BASE = register("sentry_stone_base", () -> new Block(Properties.ofFullCopy(CARVED_STONE_BASE.get()).lightLevel(state -> 11)));

private static <T extends Block> DeferredBlock<T> register(final String name, final Supplier<? extends T> block, Function<DeferredBlock<T>, Supplier<? extends Item>> item) {
DeferredBlock<T> obj = ReduxBlocks.BLOCKS.register(name, block);
ReduxItems.ITEMS.register(name, item.apply(obj));
return obj;
}
public static final DeferredBlock<Block> LOCKED_CARVED_STONE_PILLAR = register("locked_carved_stone_pillar", () -> new RotatedPillarBlock(Properties.of().mapColor(MapColor.STONE).instrument(NoteBlockInstrument.BASEDRUM).strength(-1.0F, 3600000.0F)));
public static final DeferredBlock<Block> LOCKED_SENTRY_STONE_PILLAR = register("locked_sentry_stone_pillar", () -> new RotatedPillarBlock(Properties.ofFullCopy(LOCKED_CARVED_STONE_PILLAR.get()).lightLevel(state -> 11)));
public static final DeferredBlock<Block> LOCKED_CARVED_STONE_BASE = register("locked_carved_stone_base", () -> new Block(Properties.of().mapColor(MapColor.STONE).instrument(NoteBlockInstrument.BASEDRUM).strength(-1.0F, 3600000.0F)));
public static final DeferredBlock<Block> LOCKED_SENTRY_STONE_BASE = register("locked_sentry_stone_base", () -> new Block(Properties.ofFullCopy(LOCKED_CARVED_STONE_BASE.get()).lightLevel(state -> 11)));

public static <T extends Block> DeferredBlock<T> register(final String name, final Supplier<? extends T> block) {
return register(name, block, object -> () -> new BlockItem(object.get(), new Item.Properties()));
}
public static final DeferredBlock<Block> TRAPPED_CARVED_STONE_PILLAR = register("trapped_carved_stone_pillar", () -> new TrappedPillarBlock(AetherEntityTypes.SENTRY::get, () -> CARVED_STONE_PILLAR.get().defaultBlockState(), Properties.ofFullCopy(CARVED_STONE_PILLAR.get())));
public static final DeferredBlock<Block> TRAPPED_SENTRY_STONE_PILLAR = register("trapped_sentry_stone_pillar", () -> new TrappedPillarBlock(AetherEntityTypes.SENTRY::get, () -> SENTRY_STONE_PILLAR.get().defaultBlockState(), Properties.ofFullCopy(SENTRY_STONE_PILLAR.get())));
public static final DeferredBlock<Block> TRAPPED_CARVED_STONE_BASE = register("trapped_carved_stone_base", () -> new TrappedBlock(AetherEntityTypes.SENTRY::get, () -> CARVED_STONE_BASE.get().defaultBlockState(), Properties.ofFullCopy(CARVED_STONE_BASE.get())));
public static final DeferredBlock<Block> TRAPPED_SENTRY_STONE_BASE = register("trapped_sentry_stone_base", () -> new TrappedBlock(AetherEntityTypes.SENTRY::get, () -> SENTRY_STONE_BASE.get().defaultBlockState(), Properties.ofFullCopy(SENTRY_STONE_BASE.get())));

public static final DeferredBlock<Block> BOSS_DOORWAY_CARVED_STONE_PILLAR = register("boss_doorway_carved_stone_pillar", () -> new DoorwayPillarBlock(AetherEntityTypes.SLIDER::get, Properties.ofFullCopy(CARVED_STONE_PILLAR.get())));
public static final DeferredBlock<Block> BOSS_DOORWAY_SENTRY_STONE_PILLAR = register("boss_doorway_sentry_stone_pillar", () -> new DoorwayPillarBlock(AetherEntityTypes.SLIDER::get, Properties.ofFullCopy(SENTRY_STONE_PILLAR.get())));
public static final DeferredBlock<Block> BOSS_DOORWAY_CARVED_STONE_BASE = register("boss_doorway_carved_stone_base", () -> new DoorwayBlock(AetherEntityTypes.SLIDER::get, Properties.ofFullCopy(CARVED_STONE_BASE.get())));
public static final DeferredBlock<Block> BOSS_DOORWAY_SENTRY_STONE_BASE = register("boss_doorway_sentry_stone_base", () -> new DoorwayBlock(AetherEntityTypes.SLIDER::get, Properties.ofFullCopy(SENTRY_STONE_BASE.get())));

public static void registerFlammability() {
FireAccessor accessor = (FireAccessor) Blocks.FIRE;
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
package net.zepalesque.redux.block.dungeon;

import com.aetherteam.aether.block.dungeon.DoorwayBlock;
import com.aetherteam.aether.block.dungeon.TrappedBlock;
import net.minecraft.core.Direction;
import net.minecraft.world.entity.EntityType;
import net.minecraft.world.item.context.BlockPlaceContext;
import net.minecraft.world.level.block.Block;
import net.minecraft.world.level.block.Rotation;
import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.level.block.state.StateDefinition;
import net.minecraft.world.level.block.state.properties.BlockStateProperties;
import net.minecraft.world.level.block.state.properties.EnumProperty;

import java.util.function.Supplier;

public class DoorwayPillarBlock extends DoorwayBlock {
public static final EnumProperty<Direction.Axis> AXIS = BlockStateProperties.AXIS;

public DoorwayPillarBlock(Supplier<EntityType<?>> blockedEntityTypeSupplier, Properties properties) {
super(blockedEntityTypeSupplier, properties);
this.registerDefaultState(this.defaultBlockState().setValue(AXIS, Direction.Axis.Y));
}

@Override
public BlockState rotate(BlockState state, Rotation rot) {
return rotatePillar(state, rot);
}

public static BlockState rotatePillar(BlockState state, Rotation rotation) {
return switch (rotation) {
case COUNTERCLOCKWISE_90, CLOCKWISE_90 -> switch (state.getValue(AXIS)) {
case X -> state.setValue(AXIS, Direction.Axis.Z);
case Z -> state.setValue(AXIS, Direction.Axis.X);
default -> state;
};
default -> state;
};
}

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

@Override
public BlockState getStateForPlacement(BlockPlaceContext context) {
return this.defaultBlockState().setValue(AXIS, context.getClickedFace().getAxis());
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
package net.zepalesque.redux.block.dungeon;

import com.aetherteam.aether.block.dungeon.TrappedBlock;
import net.minecraft.core.Direction;
import net.minecraft.world.entity.EntityType;
import net.minecraft.world.item.context.BlockPlaceContext;
import net.minecraft.world.level.block.Block;
import net.minecraft.world.level.block.Rotation;
import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.level.block.state.StateDefinition;
import net.minecraft.world.level.block.state.properties.BlockStateProperties;
import net.minecraft.world.level.block.state.properties.EnumProperty;

import java.util.function.Supplier;

public class TrappedPillarBlock extends TrappedBlock {
public static final EnumProperty<Direction.Axis> AXIS = BlockStateProperties.AXIS;

public TrappedPillarBlock(Supplier<EntityType<?>> spawnableEntityTypeSupplier, Supplier<? extends BlockState> defaultStateSupplier, Properties properties) {
super(spawnableEntityTypeSupplier, defaultStateSupplier, properties);
this.registerDefaultState(this.getStateDefinition().any().setValue(AXIS, Direction.Axis.Y));
}

@Override
public BlockState rotate(BlockState state, Rotation rot) {
return rotatePillar(state, rot);
}

public static BlockState rotatePillar(BlockState state, Rotation rotation) {
return switch (rotation) {
case COUNTERCLOCKWISE_90, CLOCKWISE_90 -> switch (state.getValue(AXIS)) {
case X -> state.setValue(AXIS, Direction.Axis.Z);
case Z -> state.setValue(AXIS, Direction.Axis.X);
default -> state;
};
default -> state;
};
}

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

@Override
public BlockState getStateForPlacement(BlockPlaceContext context) {
return this.defaultBlockState().setValue(AXIS, context.getClickedFace().getAxis());
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
package net.zepalesque.redux.block.state;

import com.google.common.base.Supplier;
import net.minecraft.world.item.BlockItem;
import net.minecraft.world.item.Item;
import net.minecraft.world.level.block.Block;
import net.neoforged.neoforge.registries.DeferredBlock;
import net.zepalesque.redux.block.ReduxBlocks;
import net.zepalesque.redux.item.ReduxItems;

import java.util.function.Function;

public class ReduxBlockBuilders {


protected static <T extends Block> DeferredBlock<T> register(final String name, final Supplier<? extends T> block, Function<DeferredBlock<T>, Supplier<? extends Item>> item) {
DeferredBlock<T> obj = ReduxBlocks.BLOCKS.register(name, block);
ReduxItems.ITEMS.register(name, item.apply(obj));
return obj;
}

public static <T extends Block> DeferredBlock<T> register(final String name, final Supplier<? extends T> block) {
return register(name, block, object -> () -> new BlockItem(object.get(), new Item.Properties()));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

import com.aetherteam.aether.block.AetherBlocks;
import net.minecraft.data.PackOutput;
import net.minecraft.world.level.block.Block;
import net.minecraft.world.level.block.RotatedPillarBlock;
import net.neoforged.neoforge.common.data.ExistingFileHelper;
import net.zepalesque.redux.Redux;
import net.zepalesque.redux.block.ReduxBlocks;
Expand All @@ -22,5 +24,26 @@ protected void registerStatesAndModels() {
this.tintableShortGrass(ReduxBlocks.SHORT_AETHER_GRASS.get(), "natural/");
this.block(ReduxBlocks.CLOUDROOT_LEAVES.get(), "natural/");
this.crossBlock(ReduxBlocks.CLOUDROOT_SAPLING.get(), "natural/");

this.pillar(ReduxBlocks.CARVED_STONE_PILLAR.get(), "dungeon/");
this.pillar(ReduxBlocks.SENTRY_STONE_PILLAR.get(), "dungeon/");
this.baseBrick(ReduxBlocks.CARVED_STONE_BASE.get(), "dungeon/");
this.baseBrick(ReduxBlocks.SENTRY_STONE_BASE.get(), "dungeon/");

this.pillar(ReduxBlocks.LOCKED_CARVED_STONE_PILLAR.get(), ReduxBlocks.CARVED_STONE_PILLAR.get(), "dungeon/");
this.pillar(ReduxBlocks.LOCKED_SENTRY_STONE_PILLAR.get(), ReduxBlocks.SENTRY_STONE_PILLAR.get(), "dungeon/");
this.baseBrick(ReduxBlocks.LOCKED_CARVED_STONE_BASE.get(), ReduxBlocks.CARVED_STONE_BASE.get(), "dungeon/");
this.baseBrick(ReduxBlocks.LOCKED_SENTRY_STONE_BASE.get(), ReduxBlocks.SENTRY_STONE_BASE.get(), "dungeon/");

this.pillar(ReduxBlocks.TRAPPED_CARVED_STONE_PILLAR.get(), ReduxBlocks.CARVED_STONE_PILLAR.get(), "dungeon/");
this.pillar(ReduxBlocks.TRAPPED_SENTRY_STONE_PILLAR.get(), ReduxBlocks.SENTRY_STONE_PILLAR.get(), "dungeon/");
this.baseBrick(ReduxBlocks.TRAPPED_CARVED_STONE_BASE.get(), ReduxBlocks.CARVED_STONE_BASE.get(), "dungeon/");
this.baseBrick(ReduxBlocks.TRAPPED_SENTRY_STONE_BASE.get(), ReduxBlocks.SENTRY_STONE_BASE.get(), "dungeon/");

this.invisiblePillar(ReduxBlocks.BOSS_DOORWAY_CARVED_STONE_PILLAR.get(), ReduxBlocks.CARVED_STONE_PILLAR.get(), "dungeon/");
this.invisiblePillar(ReduxBlocks.BOSS_DOORWAY_SENTRY_STONE_PILLAR.get(), ReduxBlocks.SENTRY_STONE_PILLAR.get(), "dungeon/");
this.invisibleBaseBrick(ReduxBlocks.BOSS_DOORWAY_CARVED_STONE_BASE.get(), ReduxBlocks.CARVED_STONE_BASE.get(), "dungeon/");
this.invisibleBaseBrick(ReduxBlocks.BOSS_DOORWAY_SENTRY_STONE_BASE.get(), ReduxBlocks.SENTRY_STONE_BASE.get(), "dungeon/");

}
}
23 changes: 23 additions & 0 deletions src/main/java/net/zepalesque/redux/data/gen/ReduxItemModelGen.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package net.zepalesque.redux.data.gen;

import com.aetherteam.aether.block.AetherBlocks;
import net.minecraft.data.PackOutput;
import net.neoforged.neoforge.common.data.ExistingFileHelper;
import net.zepalesque.redux.Redux;
Expand All @@ -20,5 +21,27 @@ protected void registerModels() {
itemBlockFlatCustomTexture(ReduxBlocks.SHORT_AETHER_GRASS, "natural/aether_medium_grass");
this.itemBlock(ReduxBlocks.CLOUDROOT_LEAVES.get());
this.itemBlockFlat(ReduxBlocks.CLOUDROOT_SAPLING.get(), "natural/");

this.itemBlock(ReduxBlocks.CARVED_STONE_BASE.get());
this.itemBlock(ReduxBlocks.CARVED_STONE_PILLAR.get());
this.itemBlock(ReduxBlocks.SENTRY_STONE_BASE.get());
this.itemBlock(ReduxBlocks.SENTRY_STONE_PILLAR.get());

this.itemLockedDungeonBlock(ReduxBlocks.LOCKED_CARVED_STONE_BASE.get(), ReduxBlocks.CARVED_STONE_BASE.get());
this.itemLockedDungeonBlock(ReduxBlocks.LOCKED_CARVED_STONE_PILLAR.get(), ReduxBlocks.CARVED_STONE_PILLAR.get());
this.itemLockedDungeonBlock(ReduxBlocks.LOCKED_SENTRY_STONE_BASE.get(), ReduxBlocks.SENTRY_STONE_BASE.get());
this.itemLockedDungeonBlock(ReduxBlocks.LOCKED_SENTRY_STONE_PILLAR.get(), ReduxBlocks.SENTRY_STONE_PILLAR.get());

this.itemTrappedDungeonBlock(ReduxBlocks.TRAPPED_CARVED_STONE_BASE.get(), ReduxBlocks.CARVED_STONE_BASE.get());
this.itemTrappedDungeonBlock(ReduxBlocks.TRAPPED_CARVED_STONE_PILLAR.get(), ReduxBlocks.CARVED_STONE_PILLAR.get());
this.itemTrappedDungeonBlock(ReduxBlocks.TRAPPED_SENTRY_STONE_BASE.get(), ReduxBlocks.SENTRY_STONE_BASE.get());
this.itemTrappedDungeonBlock(ReduxBlocks.TRAPPED_SENTRY_STONE_PILLAR.get(), ReduxBlocks.SENTRY_STONE_PILLAR.get());

this.itemBossDoorwayDungeonBlock(ReduxBlocks.BOSS_DOORWAY_CARVED_STONE_BASE.get(), ReduxBlocks.CARVED_STONE_BASE.get());
this.itemBossDoorwayDungeonBlock(ReduxBlocks.BOSS_DOORWAY_CARVED_STONE_PILLAR.get(), ReduxBlocks.CARVED_STONE_PILLAR.get());
this.itemBossDoorwayDungeonBlock(ReduxBlocks.BOSS_DOORWAY_SENTRY_STONE_BASE.get(), ReduxBlocks.SENTRY_STONE_BASE.get());
this.itemBossDoorwayDungeonBlock(ReduxBlocks.BOSS_DOORWAY_SENTRY_STONE_PILLAR.get(), ReduxBlocks.SENTRY_STONE_PILLAR.get());


}
}
24 changes: 24 additions & 0 deletions src/main/java/net/zepalesque/redux/data/gen/ReduxLanguageGen.java
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,30 @@ protected void addTranslations() {
this.add(ReduxBlocks.CLOUDROOT_SAPLING);
this.addLore(ReduxBlocks.CLOUDROOT_SAPLING, "The sapling of the Cloudroot tree. It can be grown by waiting or using Bone Meal.");

this.add(ReduxBlocks.CARVED_STONE_PILLAR);
this.addLore(ReduxBlocks.CARVED_STONE_PILLAR, "A pillar made of Carved Stone. Pillars look nice for supporting a build, along with giving it nice corners.");
this.add(ReduxBlocks.SENTRY_STONE_PILLAR);
this.addLore(ReduxBlocks.SENTRY_STONE_PILLAR, "A pillar made of Sentry Stone. Pillars look nice for supporting a build, along with giving it nice corners.");
this.add(ReduxBlocks.CARVED_STONE_BASE);
this.addLore(ReduxBlocks.CARVED_STONE_BASE, "A nice decorative base block made of Carved Stone. Looks very nice at the bottom of walls!");
this.add(ReduxBlocks.SENTRY_STONE_BASE);
this.addLore(ReduxBlocks.SENTRY_STONE_BASE, "A nice decorative base block made of Sentry Stone. Looks very nice at the bottom of walls!");

this.add(ReduxBlocks.LOCKED_CARVED_STONE_PILLAR);
this.add(ReduxBlocks.LOCKED_SENTRY_STONE_PILLAR);
this.add(ReduxBlocks.LOCKED_CARVED_STONE_BASE);
this.add(ReduxBlocks.LOCKED_SENTRY_STONE_BASE);

this.add(ReduxBlocks.TRAPPED_CARVED_STONE_PILLAR);
this.add(ReduxBlocks.TRAPPED_SENTRY_STONE_PILLAR);
this.add(ReduxBlocks.TRAPPED_CARVED_STONE_BASE);
this.add(ReduxBlocks.TRAPPED_SENTRY_STONE_BASE);

this.add(ReduxBlocks.BOSS_DOORWAY_CARVED_STONE_PILLAR);
this.add(ReduxBlocks.BOSS_DOORWAY_SENTRY_STONE_PILLAR);
this.add(ReduxBlocks.BOSS_DOORWAY_CARVED_STONE_BASE);
this.add(ReduxBlocks.BOSS_DOORWAY_SENTRY_STONE_BASE);

this.addPackDescription("mod", "The Aether: Redux Resources");
this.addPackTitle("tintable_grass", "Redux - Tintable Grass");
this.addPackDescription("tintable_grass", "Grass tint textures for the Aether: Redux");
Expand Down
Loading

0 comments on commit df46013

Please sign in to comment.