Skip to content

Commit

Permalink
feat: Golden Clovers
Browse files Browse the repository at this point in the history
  • Loading branch information
Zepalesque committed Jun 22, 2024
1 parent 6d1ac7f commit a7ad98b
Show file tree
Hide file tree
Showing 17 changed files with 149 additions and 33 deletions.
14 changes: 11 additions & 3 deletions src/main/java/net/zepalesque/redux/block/ReduxBlocks.java
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
import net.minecraft.world.level.block.ChainBlock;
import net.minecraft.world.level.block.FlowerPotBlock;
import net.minecraft.world.level.block.LanternBlock;
import net.minecraft.world.level.block.PinkPetalsBlock;
import net.minecraft.world.level.block.RotatedPillarBlock;
import net.minecraft.world.level.block.SaplingBlock;
import net.minecraft.world.level.block.SoundType;
Expand All @@ -20,13 +21,15 @@
import net.minecraft.world.level.block.state.BlockBehaviour.OffsetType;
import net.minecraft.world.level.block.state.properties.NoteBlockInstrument;
import net.minecraft.world.level.material.MapColor;
import net.minecraft.world.level.material.PushReaction;
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.RunelightBlock;
import net.zepalesque.redux.block.dungeon.TrappedPillarBlock;
import net.zepalesque.redux.block.natural.AetherShortGrassBlock;
import net.zepalesque.redux.block.natural.GoldenCloversBlock;
import net.zepalesque.redux.block.natural.crop.WyndoatsBlock;
import net.zepalesque.redux.block.natural.leaves.FallingLeavesBlock;
import net.zepalesque.redux.block.state.ReduxBlockBuilders;
Expand All @@ -47,12 +50,17 @@ public class ReduxBlocks extends ReduxBlockBuilders {
.hasPostProcess((state, level, pos) -> true)
));

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

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

public static DeferredBlock<GoldenCloversBlock> GOLDEN_CLOVERS = register("golden_clovers",
() -> new GoldenCloversBlock(BlockBehaviour.Properties.of()
.mapColor(MapColor.GOLD)
.noCollission()
.sound(SoundType.PINK_PETALS)
.pushReaction(PushReaction.DESTROY)
));

public static final DeferredBlock<Block> CARVED_PILLAR = register("carved_pillar", () -> new RotatedPillarBlock(Properties.of().mapColor(MapColor.STONE).instrument(NoteBlockInstrument.BASEDRUM).strength(0.5F, 6.0F).requiresCorrectToolForDrops()));
public static final DeferredBlock<Block> SENTRY_PILLAR = register("sentry_pillar", () -> new RotatedPillarBlock(Properties.ofFullCopy(CARVED_PILLAR.get()).lightLevel(state -> 11)));
public static final DeferredBlock<Block> CARVED_BASE = register("carved_base", () -> new Block(Properties.of().mapColor(MapColor.STONE).instrument(NoteBlockInstrument.BASEDRUM).strength(0.5F, 6.0F).requiresCorrectToolForDrops()));
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,20 @@
package net.zepalesque.redux.block.natural;

import com.aetherteam.aether.block.AetherBlockStateProperties;
import net.minecraft.world.level.block.Block;
import net.minecraft.world.level.block.PinkPetalsBlock;
import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.level.block.state.StateDefinition;

// TODO: Make these different somehow
public class GoldenCloversBlock extends PinkPetalsBlock {
public GoldenCloversBlock(Properties properties) {
super(properties);
this.registerDefaultState(this.defaultBlockState().setValue(AetherBlockStateProperties.DOUBLE_DROPS, false));
}

@Override
protected void createBlockStateDefinition(StateDefinition.Builder<Block, BlockState> builder) {
super.createBlockStateDefinition(builder);
builder.add(AetherBlockStateProperties.DOUBLE_DROPS);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,30 +3,40 @@
import com.aetherteam.aether.block.AetherBlocks;
import com.aetherteam.aether.item.AetherCreativeTabs;
import net.minecraft.data.recipes.RecipeCategory;
import net.minecraft.tags.BlockTags;
import net.minecraft.world.effect.MobEffects;
import net.minecraft.world.item.Items;
import net.minecraft.world.level.block.Block;
import net.minecraft.world.level.block.Blocks;
import net.minecraft.world.level.block.SaplingBlock;
import net.minecraft.world.level.block.state.BlockBehaviour.Properties;
import net.minecraft.world.phys.shapes.VoxelShape;
import net.minecraft.world.level.material.MapColor;
import net.zepalesque.redux.Redux;
import net.zepalesque.redux.block.natural.bush.CustomBoundsFlowerBlock;
import net.zepalesque.redux.blockset.flower.type.AetherFlowerSet;
import net.zepalesque.redux.blockset.flower.type.BaseFlowerSet;
import net.zepalesque.redux.blockset.flower.type.EnchantedFlowerSet;
import net.zepalesque.redux.blockset.stone.ReduxStoneSets;
import net.zepalesque.redux.blockset.flower.type.UntintedFlowerSet;
import net.zepalesque.redux.world.tree.ReduxTreeGrowers;
import net.zepalesque.zenith.api.blockset.AbstractFlowerSet;
import net.zepalesque.zenith.api.blockset.AbstractStoneSet;
import net.zepalesque.zenith.block.util.CommonPlantBounds;

public class ReduxFlowerSets {

public static final BaseFlowerSet<CustomBoundsFlowerBlock.Enchanted> AURUM = register(new EnchantedFlowerSet<>("aurum", "natural/",
() -> new CustomBoundsFlowerBlock.Enchanted(CommonPlantBounds.FLOWER,
() -> MobEffects.LUCK, 60, Properties.ofFullCopy(Blocks.DANDELION).hasPostProcess((s, l, p) -> true)), 1, null))
() -> MobEffects.LUCK, 60, Properties.ofFullCopy(Blocks.DANDELION).hasPostProcess((s, l, p) -> true)), 1, 0xFFFFFF)
.creativeTab(AetherCreativeTabs.AETHER_NATURAL_BLOCKS, AetherBlocks.WHITE_FLOWER)
.craftsIntoShapeless(1, () -> Items.YELLOW_DYE, 1, RecipeCategory.MISC)
.withLore("A golden flower found in the Gilded Groves. Some say it brings good luck!");
.withFlowerTag(BlockTags.FLOWERS)
.withPotTag(BlockTags.FLOWER_POTS)
.withLore("A golden flower found in the Gilded Groves. Some say it brings good luck!"));

public static final BaseFlowerSet<SaplingBlock> CLOUDROOT_SAPLING = register(new UntintedFlowerSet<>("cloudroot_sapling", "natural/",
() -> new SaplingBlock(ReduxTreeGrowers.CLOUDROOT, Properties.ofFullCopy(Blocks.OAK_SAPLING).mapColor(MapColor.QUARTZ)))
.creativeTab(AetherCreativeTabs.AETHER_NATURAL_BLOCKS, AetherBlocks.SKYROOT_SAPLING)
.withFlowerTag(BlockTags.SAPLINGS)
.withPotTag(BlockTags.FLOWER_POTS)
.compost(0.3F)
.withLore("The sapling of the Cloudroot tree. It can be grown by waiting or using Bone Meal."));

public static <T extends AbstractFlowerSet> T register(T set) {
Redux.BLOCK_SETS.add(set);
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
package net.zepalesque.redux.blockset.flower.type;

import net.minecraft.world.level.block.Block;
import net.zepalesque.redux.data.prov.ReduxBlockStateProvider;
import net.zepalesque.redux.data.prov.ReduxItemModelProvider;
import net.zepalesque.zenith.util.lambda.Consumers;

import java.util.function.Supplier;

public class UntintedFlowerSet<B extends Block> extends BaseFlowerSet<B>{
public UntintedFlowerSet(String id, String textureFolder, Supplier<B> constructor) {
super(id, textureFolder, constructor);
}

@Override
public void blockData(ReduxBlockStateProvider data) {
data.crossBlock(this.flower().get(), this.textureFolder);
Consumers.C3<Block, Block, String> pot = this.usePottedPrefix ? data::potAlt : data::pottedPlant;
pot.accept(this.pot().get(), this.flower().get(), this.textureFolder);
}

@Override
public void itemData(ReduxItemModelProvider data) {
data.itemBlockFlat(this.flower().get(), this.textureFolder);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ 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_PILLAR.get(), "dungeon/");
this.pillar(ReduxBlocks.SENTRY_PILLAR.get(), "dungeon/");
Expand Down Expand Up @@ -59,5 +58,7 @@ protected void registerStatesAndModels() {
this.block(ReduxBlocks.VERIDIUM_BLOCK.get(), "construction/");
this.block(ReduxBlocks.REFINED_SENTRITE_BLOCK.get(), "construction/");

this.flowerbed(ReduxBlocks.GOLDEN_CLOVERS.get(), "natural/");

}
}
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ protected void registerModels() {

itemBlockFlatCustomTexture(ReduxBlocks.SHORT_AETHER_GRASS.get(), "natural/aether_medium_grass");
this.itemBlock(ReduxBlocks.CLOUDROOT_LEAVES.get());
this.itemBlockFlat(ReduxBlocks.CLOUDROOT_SAPLING.get(), "natural/");

this.itemBlock(ReduxBlocks.CARVED_BASE.get());
this.itemBlock(ReduxBlocks.CARVED_PILLAR.get());
Expand Down Expand Up @@ -76,6 +75,8 @@ protected void registerModels() {
this.itemBlock(ReduxBlocks.VERIDIUM_BLOCK.get());
this.itemBlock(ReduxBlocks.REFINED_SENTRITE_BLOCK.get());

item(ReduxBlocks.GOLDEN_CLOVERS.get().asItem(), "misc/");

}


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@ protected void addTranslations() {
addBlock(ReduxBlocks.CLOUDROOT_LEAVES);
addLore(ReduxBlocks.CLOUDROOT_LEAVES, "Leaves of the Cloudroot tree, a variation of Skyroot that has been touched by Ambrosium but has not fully adapted as Golden Oaks have. These sometimes will drop Cloudroot Saplings");

addBlock(ReduxBlocks.CLOUDROOT_SAPLING);
addLore(ReduxBlocks.CLOUDROOT_SAPLING, "The sapling of the Cloudroot tree. It can be grown by waiting or using Bone Meal.");
addBlock(ReduxBlocks.GOLDEN_CLOVERS);
addLore(ReduxBlocks.GOLDEN_CLOVERS, "A nice patch of clovers that can be found in the Gilded Groves.");

addBlock(ReduxBlocks.CARVED_PILLAR);
addLore(ReduxBlocks.CARVED_PILLAR, "A pillar made of Carved Stone. Pillars look nice for supporting a build, along with giving it nice corners.");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ protected void gather() {

var compostables = this.builder(NeoForgeDataMaps.COMPOSTABLES);
this.addCompost(compostables, ReduxBlocks.CLOUDROOT_LEAVES, 0.3F);
this.addCompost(compostables, ReduxBlocks.CLOUDROOT_SAPLING, 0.3F);
this.addCompost(compostables, ReduxBlocks.SHORT_AETHER_GRASS, 0.3F);
this.addCompost(compostables, ReduxItems.WYND_OATS, 0.3F);
this.addCompost(compostables, ReduxBlocks.WYNDSPROUTS, 0.3F);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
import net.minecraft.sounds.SoundEvents;
import net.zepalesque.redux.Redux;
import net.zepalesque.redux.block.ReduxBlocks;
import net.zepalesque.redux.blockset.flower.ReduxFlowerSets;
import net.zepalesque.redux.blockset.stone.ReduxStoneSets;
import net.zepalesque.redux.client.audio.ReduxSounds;
import net.zepalesque.redux.data.prov.ReduxRecipeProvider;
Expand Down Expand Up @@ -42,7 +43,7 @@ protected void buildRecipes(@NotNull RecipeOutput output) {
smeltingOreRecipe(ReduxItems.REFINED_SENTRITE.get(), ReduxStoneSets.SENTRITE.block().get(), 0.8F, 300).save(output, name("refine_sentrite_smelt"));
blastingOreRecipe(ReduxItems.REFINED_SENTRITE.get(), ReduxStoneSets.SENTRITE.block().get(), 0.8F, 150).save(output, name("refine_sentrite_blast"));

enchantingRecipe(RecipeCategory.DECORATIONS, ReduxBlocks.CLOUDROOT_SAPLING.get(), AetherBlocks.SKYROOT_SAPLING.get(), 0.1F, 1000).save(output);
enchantingRecipe(RecipeCategory.DECORATIONS, ReduxFlowerSets.CLOUDROOT_SAPLING.flower().get(), AetherBlocks.SKYROOT_SAPLING.get(), 0.1F, 1000).save(output);
ambrosiumEnchanting(ReduxBlocks.CLOUDROOT_LEAVES.get(), AetherBlocks.SKYROOT_LEAVES.get()).save(output);

stonecuttingRecipe(output, RecipeCategory.BUILDING_BLOCKS, ReduxBlocks.CARVED_BASE.get(), AetherBlocks.CARVED_STONE.get());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
import net.zepalesque.redux.Redux;
import net.zepalesque.redux.block.ReduxBlocks;
import net.zepalesque.redux.block.natural.crop.WyndoatsBlock;
import net.zepalesque.redux.blockset.flower.ReduxFlowerSets;
import net.zepalesque.redux.data.prov.loot.ReduxBlockLootProvider;
import net.zepalesque.redux.item.ReduxItems;

Expand All @@ -33,9 +34,8 @@ protected void generate() {

this.add(ReduxBlocks.SHORT_AETHER_GRASS.get(), shears());

this.dropSelf(ReduxBlocks.CLOUDROOT_SAPLING.get());
this.add(ReduxBlocks.CLOUDROOT_LEAVES.get(),
(leaves) -> droppingWithChancesAndSkyrootSticks(leaves, ReduxBlocks.CLOUDROOT_SAPLING.get(), BlockLootAccessor.aether$getNormalLeavesSaplingChances()));
(leaves) -> droppingWithChancesAndSkyrootSticks(leaves, ReduxFlowerSets.CLOUDROOT_SAPLING.flower().get(), BlockLootAccessor.aether$getNormalLeavesSaplingChances()));

this.dropSelf(ReduxBlocks.CARVED_PILLAR.get());
this.dropSelf(ReduxBlocks.SENTRY_PILLAR.get());
Expand Down Expand Up @@ -80,6 +80,8 @@ protected void generate() {
this.dropSelf(ReduxBlocks.VERIDIUM_BLOCK.get());
this.dropSelf(ReduxBlocks.RAW_VERIDIUM_BLOCK.get());
this.dropSelf(ReduxBlocks.REFINED_SENTRITE_BLOCK.get());

this.createPetalsDrops(ReduxBlocks.GOLDEN_CLOVERS.get());
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,16 @@ protected void addTags(HolderLookup.Provider provider) {
ReduxBlocks.CLOUDROOT_LEAVES.get()
);
this.tag(BlockTags.MINEABLE_WITH_HOE).add(
ReduxBlocks.CLOUDROOT_LEAVES.get()
ReduxBlocks.CLOUDROOT_LEAVES.get(),
ReduxBlocks.GOLDEN_CLOVERS.get()
);

this.tag(BlockTags.INSIDE_STEP_SOUND_BLOCKS).add(
ReduxBlocks.GOLDEN_CLOVERS.get()
);

this.tag(BlockTags.SWORD_EFFICIENT).add(
ReduxBlocks.GOLDEN_CLOVERS.get()
);

this.tag(AetherTags.Blocks.SENTRY_BLOCKS).add(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,15 @@
import net.minecraft.world.level.block.Block;
import net.minecraft.world.level.block.ChainBlock;
import net.minecraft.world.level.block.LanternBlock;
import net.minecraft.world.level.block.PinkPetalsBlock;
import net.minecraft.world.level.block.state.properties.BlockStateProperties;
import net.minecraft.world.level.block.state.properties.IntegerProperty;
import net.neoforged.neoforge.client.model.generators.BlockModelBuilder;
import net.neoforged.neoforge.client.model.generators.ConfiguredModel;
import net.neoforged.neoforge.client.model.generators.ModelBuilder;
import net.neoforged.neoforge.client.model.generators.ModelFile;
import net.neoforged.neoforge.client.model.generators.ModelProvider;
import net.neoforged.neoforge.client.model.generators.MultiPartBlockStateBuilder;
import net.neoforged.neoforge.common.data.ExistingFileHelper;
import net.zepalesque.redux.Redux;
import net.zepalesque.redux.block.construction.LayeredBookshelfBlock;
Expand Down Expand Up @@ -292,4 +294,32 @@ public void tintedPotOverlayAlt(Block block, Block flower, String location) {
.texture("overlay", this.modLoc("block/" + location + "potted_" + this.name(flower) + "_overlay")).renderType("cutout");
this.getVariantBuilder(block).partialState().addModels(new ConfiguredModel(pot));
}

// Other

public void flowerbed(Block block, String location) {
ModelFile flowerbed1 = this.models().withExistingParent(this.name(block) + "_1", mcLoc("flowerbed_1"))
.texture("flowerbed", this.texture(this.name(block), location))
.texture("stem", this.extend(this.texture(this.name(block), location), "_stem"))
.renderType("cutout");
ModelFile flowerbed2 = this.models().withExistingParent(this.name(block) + "_2", mcLoc("flowerbed_2"))
.texture("flowerbed", this.texture(this.name(block), location))
.texture("stem", this.extend(this.texture(this.name(block), location), "_stem"))
.renderType("cutout");
ModelFile flowerbed3 = this.models().withExistingParent(this.name(block) + "_3", mcLoc("flowerbed_3"))
.texture("flowerbed", this.texture(this.name(block), location))
.texture("stem", this.extend(this.texture(this.name(block), location), "_stem"))
.renderType("cutout");
ModelFile flowerbed4 = this.models().withExistingParent(this.name(block) + "_4", mcLoc("flowerbed_4"))
.texture("flowerbed", this.texture(this.name(block), location))
.texture("stem", this.extend(this.texture(this.name(block), location), "_stem"))
.renderType("cutout");
MultiPartBlockStateBuilder builder = this.getMultipartBuilder(block);
for (Direction d : new Direction[] {Direction.NORTH, Direction.EAST, Direction.SOUTH, Direction.WEST}) {
builder.part().modelFile(flowerbed1).rotationY(d.getOpposite().get2DDataValue() * 90).addModel().condition(PinkPetalsBlock.AMOUNT, 1, 2, 3, 4).condition(PinkPetalsBlock.FACING, d).end();
builder.part().modelFile(flowerbed2).rotationY(d.getOpposite().get2DDataValue() * 90).addModel().condition(PinkPetalsBlock.AMOUNT, 2, 3, 4).condition(PinkPetalsBlock.FACING, d).end();
builder.part().modelFile(flowerbed3).rotationY(d.getOpposite().get2DDataValue() * 90).addModel().condition(PinkPetalsBlock.AMOUNT, 3, 4).condition(PinkPetalsBlock.FACING, d).end();
builder.part().modelFile(flowerbed4).rotationY(d.getOpposite().get2DDataValue() * 90).addModel().condition(PinkPetalsBlock.AMOUNT, 4).condition(PinkPetalsBlock.FACING, d).end();
}
}
}
Original file line number Diff line number Diff line change
@@ -1,13 +1,16 @@
package net.zepalesque.redux.data.resource.builders;

import com.aetherteam.aether.block.AetherBlockStateProperties;
import net.minecraft.core.Direction;
import net.minecraft.core.Vec3i;
import net.minecraft.core.registries.Registries;
import net.minecraft.data.worldgen.BootstapContext;
import net.minecraft.data.worldgen.placement.PlacementUtils;
import net.minecraft.resources.ResourceKey;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.util.random.SimpleWeightedRandomList;
import net.minecraft.world.level.block.Block;
import net.minecraft.world.level.block.PinkPetalsBlock;
import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.level.levelgen.blockpredicates.BlockPredicate;
import net.minecraft.world.level.levelgen.feature.ConfiguredFeature;
Expand All @@ -16,6 +19,7 @@
import net.minecraft.world.level.levelgen.feature.configurations.RandomPatchConfiguration;
import net.minecraft.world.level.levelgen.feature.configurations.SimpleBlockConfiguration;
import net.minecraft.world.level.levelgen.feature.stateproviders.BlockStateProvider;
import net.minecraft.world.level.levelgen.feature.stateproviders.WeightedStateProvider;
import net.neoforged.neoforge.registries.DeferredHolder;
import net.zepalesque.redux.Redux;
import net.zepalesque.redux.block.state.ReduxStates;
Expand Down Expand Up @@ -71,4 +75,16 @@ protected static BlockState naturalDrops(Supplier<? extends Block> block) {
BlockState b = block.get().defaultBlockState();
return b.hasProperty(ReduxStates.NATURAL_GEN) ? drops(b.setValue(ReduxStates.NATURAL_GEN, true)) : drops(b);
}


protected static BlockStateProvider petals(BlockState state) {
SimpleWeightedRandomList.Builder<BlockState> builder = SimpleWeightedRandomList.builder();
for (Direction d : PinkPetalsBlock.FACING.getPossibleValues()) {
BlockState temp = state.setValue(PinkPetalsBlock.FACING, d);
for (int i : PinkPetalsBlock.AMOUNT.getPossibleValues()) {
builder.add(temp.setValue(PinkPetalsBlock.AMOUNT, i), i);
}
}
return new WeightedStateProvider(builder);
}
}
Loading

0 comments on commit a7ad98b

Please sign in to comment.