Skip to content

Commit

Permalink
feat: Stuff
Browse files Browse the repository at this point in the history
  • Loading branch information
Zepalesque committed May 27, 2024
1 parent 3194eb4 commit 4e083d7
Show file tree
Hide file tree
Showing 21 changed files with 133 additions and 56 deletions.
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ aether_version=1.20.4-1.4.1-neoforge
nitrogen_version=1.20.4-1.1.4-neoforge
cumulus_version=1.20.4-1.0.1-neoforge
curios_version=7.3.4
zenith_version=1.0.29
zenith_version=1.0.30
aeroblender_version=5271794
terrablender_version=1.20.4-3.3.0.12
terrablender_version_minimum=1.20.4-3.3.0.0
Expand Down
4 changes: 4 additions & 0 deletions src/main/java/net/zepalesque/redux/Redux.java
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
import net.zepalesque.redux.entity.ReduxEntities;
import net.zepalesque.redux.item.ReduxItems;
import net.zepalesque.redux.tile.ReduxTiles;
import net.zepalesque.zenith.api.blockset.AbstractStoneSet;
import net.zepalesque.zenith.api.blockset.AbstractWoodSet;
import net.zepalesque.zenith.api.condition.ConfigCondition;
import net.zepalesque.zenith.api.condition.config.ConfigSerializer;
Expand All @@ -48,6 +49,8 @@ public class Redux {

public static final Collection<AbstractWoodSet> WOOD_SETS = new ArrayList<>();

public static final Collection<AbstractStoneSet> STONE_SETS = new ArrayList<>();

public Redux(IEventBus bus) {
bus.addListener(this::commonSetup);
bus.addListener(this::dataSetup);
Expand All @@ -66,6 +69,7 @@ public Redux(IEventBus bus) {
private void commonSetup(final FMLCommonSetupEvent event) {
event.enqueueWork(() -> {
ReduxBlocks.registerFlammability();
ReduxBlocks.registerToolConversions();
});
}

Expand Down
7 changes: 5 additions & 2 deletions src/main/java/net/zepalesque/redux/block/ReduxBlocks.java
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
package net.zepalesque.redux.block;

import com.aetherteam.aether.mixin.mixins.common.accessor.FireBlockAccessor;
import com.google.common.base.Supplier;
import net.minecraft.core.registries.BuiltInRegistries;
import net.minecraft.world.item.BlockItem;
import net.minecraft.world.item.Item;
import net.minecraft.world.level.block.Block;
Expand All @@ -12,6 +10,7 @@
import net.neoforged.neoforge.registries.DeferredRegister;
import net.zepalesque.redux.Redux;
import net.zepalesque.redux.block.natural.AetherShortGrassBlock;
import net.zepalesque.redux.event.hook.ToolModifyHooks;
import net.zepalesque.redux.item.ReduxItems;
import net.zepalesque.zenith.mixin.mixins.common.accessor.FireAccessor;

Expand Down Expand Up @@ -42,4 +41,8 @@ public static void registerFlammability() {

Redux.WOOD_SETS.forEach(set -> set.flammables(accessor));
}

public static void registerToolConversions() {
Redux.WOOD_SETS.forEach(set -> set.setupStrippables(ToolModifyHooks.STRIPPABLES));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -346,6 +346,7 @@ public void registerRenderers(EntityRenderersEvent.RegisterRenderers event) {

}

// Ignore the prev value, implementation is different here
@Override
public Supplier<? extends ItemLike> addToCreativeTab(BuildCreativeModeTabContentsEvent event, Supplier<? extends ItemLike> prev) {
for (Triple<Supplier<CreativeModeTab>, Supplier<? extends ItemLike>, Boolean> triple : this.creativeTabOrdering) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,9 @@
import net.zepalesque.redux.data.prov.loot.ReduxBlockLootProvider;
import net.zepalesque.redux.data.prov.tags.ReduxBlockTagsProvider;
import net.zepalesque.redux.item.ReduxItems;
import net.zepalesque.redux.item.TabUtil;
import net.zepalesque.zenith.mixin.mixins.common.accessor.FireAccessor;
import net.zepalesque.zenith.util.DatagenUtil;
import net.zepalesque.zenith.util.TabUtil;

import java.util.function.Supplier;

Expand All @@ -45,13 +45,13 @@ public DeferredBlock<B> bookshelf() {
}

@Override
protected void itemData(ReduxItemModelProvider data) {
public void itemData(ReduxItemModelProvider data) {
super.itemData(data);
data.itemBlock(this.bookshelf().get());
}

@Override
protected void langData(ReduxLanguageProvider data) {
public void langData(ReduxLanguageProvider data) {
super.langData(data);
String name = DatagenUtil.getNameLocalized(this.id);

Expand All @@ -60,19 +60,19 @@ protected void langData(ReduxLanguageProvider data) {
}

@Override
protected void recipeData(ReduxRecipeProvider data, RecipeOutput consumer) {
public void recipeData(ReduxRecipeProvider data, RecipeOutput consumer) {
super.recipeData(data, consumer);
ReduxRecipeProvider.bookshelf(consumer, this.planks(), this.bookshelf());
}

@Override
protected void lootData(ReduxBlockLootProvider data) {
public void lootData(ReduxBlockLootProvider data) {
super.lootData(data);
data.add(this.bookshelf().get(), (bookshelf) -> data.createSingleItemTableWithSilkTouch(bookshelf, Items.BOOK, ConstantValue.exactly(3.0F)));
}

@Override
protected void blockTagData(ReduxBlockTagsProvider data) {
public void blockTagData(ReduxBlockTagsProvider data) {
super.blockTagData(data);
data.tag(BlockTags.MINEABLE_WITH_AXE).add(this.bookshelf().get());
data.tag(Tags.Blocks.BOOKSHELVES).add(this.bookshelf().get());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,13 @@
import com.aetherteam.aether.block.AetherBlocks;
import com.aetherteam.aether.block.natural.AetherLogBlock;
import com.aetherteam.aether.item.AetherCreativeTabs;
import com.aetherteam.aether.item.AetherItems;
import net.minecraft.client.renderer.blockentity.HangingSignRenderer;
import net.minecraft.client.renderer.blockentity.SignRenderer;
import net.minecraft.core.Direction;
import net.minecraft.data.loot.BlockLootSubProvider;
import net.minecraft.data.recipes.RecipeCategory;
import net.minecraft.data.recipes.RecipeOutput;
import net.minecraft.data.recipes.RecipeProvider;
import net.minecraft.data.recipes.ShapedRecipeBuilder;
import net.minecraft.data.tags.ItemTagsProvider;
import net.minecraft.sounds.SoundEvents;
import net.minecraft.tags.BlockTags;
import net.minecraft.tags.ItemTags;
Expand Down Expand Up @@ -47,12 +45,8 @@
import net.minecraft.world.level.material.MapColor;
import net.minecraft.world.level.material.PushReaction;
import net.neoforged.neoforge.client.event.EntityRenderersEvent;
import net.neoforged.neoforge.client.model.generators.BlockStateProvider;
import net.neoforged.neoforge.client.model.generators.ItemModelProvider;
import net.neoforged.neoforge.common.Tags;
import net.neoforged.neoforge.common.data.BlockTagsProvider;
import net.neoforged.neoforge.common.data.DataMapProvider;
import net.neoforged.neoforge.common.data.LanguageProvider;
import net.neoforged.neoforge.event.BuildCreativeModeTabContentsEvent;
import net.neoforged.neoforge.registries.DeferredBlock;
import net.neoforged.neoforge.registries.DeferredHolder;
Expand All @@ -72,7 +66,6 @@
import net.zepalesque.redux.data.prov.tags.ReduxItemTagsProvider;
import net.zepalesque.redux.entity.ReduxEntities;
import net.zepalesque.redux.item.ReduxItems;
import net.zepalesque.redux.item.TabUtil;
import net.zepalesque.redux.tile.ReduxTiles;
import net.zepalesque.zenith.api.blockset.AbstractWoodSet;
import net.zepalesque.zenith.block.ZenithCeilingHangingSignBlock;
Expand All @@ -87,9 +80,10 @@
import net.zepalesque.zenith.tile.ZenithHangingSignBlockEntity;
import net.zepalesque.zenith.tile.ZenithSignBlockEntity;
import net.zepalesque.zenith.util.DatagenUtil;
import org.apache.commons.lang3.tuple.Triple;
import net.zepalesque.zenith.util.TabUtil;

import javax.annotation.Nullable;
import java.util.Map;
import java.util.function.Supplier;

public class BaseWoodSet extends AbstractWoodSet implements ReduxGeneration {
Expand Down Expand Up @@ -851,6 +845,12 @@ public void flammables(FireAccessor accessor) {
accessor.callSetFlammable(this.slab().get(), 5, 20);
}

@Override
public void setupStrippables(Map<Block, Block> strippingMap) {
strippingMap.put(this.log().get(), this.strippedLog().get());
strippingMap.put(this.wood().get(), this.strippedWood().get());
}

@Override
public void registerRenderers(EntityRenderersEvent.RegisterRenderers event) {
event.registerBlockEntityRenderer(this.signEntity().get(), SignRenderer::new);
Expand Down Expand Up @@ -927,4 +927,9 @@ protected Supplier<? extends ItemLike> functionalBlocks(BuildCreativeModeTabCont
TabUtil.putAfter(this.sign(), this.hangingSign(), event);
return this.hangingSign();
}

@Override
public Supplier<Item> getStick() {
return AetherItems.SKYROOT_STICK;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ protected DeferredBlock<LayeredBookshelfBlock> bookshelf(DeferredRegister.Blocks
}

@Override
protected void blockData(ReduxBlockStateProvider data) {
public void blockData(ReduxBlockStateProvider data) {
super.blockData(data);
data.layeredBookshelf(this.bookshelf().get(), this.planks().get());
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
import net.minecraft.world.item.BlockItem;
import net.minecraft.world.item.Item;
import net.minecraft.world.level.ItemLike;
import net.minecraft.world.level.block.Block;
import net.minecraft.world.level.block.SoundType;
import net.minecraft.world.level.block.state.BlockBehaviour.Properties;
import net.minecraft.world.level.block.state.properties.NoteBlockInstrument;
Expand All @@ -25,10 +26,11 @@
import net.zepalesque.redux.data.prov.loot.ReduxBlockLootProvider;
import net.zepalesque.redux.data.prov.tags.ReduxBlockTagsProvider;
import net.zepalesque.redux.item.ReduxItems;
import net.zepalesque.redux.item.TabUtil;
import net.zepalesque.zenith.mixin.mixins.common.accessor.FireAccessor;
import net.zepalesque.zenith.util.DatagenUtil;
import net.zepalesque.zenith.util.TabUtil;

import java.util.Map;
import java.util.function.Supplier;

public class LogWallWoodSet extends BaseWoodSet {
Expand Down Expand Up @@ -116,7 +118,7 @@ public DeferredBlock<ReduxNaturalWall> strippedWoodWall() {


@Override
protected void blockData(ReduxBlockStateProvider data) {
public void blockData(ReduxBlockStateProvider data) {
super.blockData(data);
ModelFile postBig = data.makeWallPostModel(4, 16, "wooden_post_big");
ModelFile postShort = data.makeWallPostModel(3, 14, "wooden_post_short");
Expand Down Expand Up @@ -145,7 +147,7 @@ protected void blockData(ReduxBlockStateProvider data) {
}

@Override
protected void itemData(ReduxItemModelProvider data) {
public void itemData(ReduxItemModelProvider data) {
super.itemData(data);
data.itemLogWallBlock(this.logWall().get(), this.log().get(), "natural/", Redux.MODID);
data.itemLogWallBlock(this.strippedLogWall().get(), this.strippedLog().get(), "natural/", Redux.MODID);
Expand All @@ -154,7 +156,7 @@ protected void itemData(ReduxItemModelProvider data) {
}

@Override
protected void langData(ReduxLanguageProvider data) {
public void langData(ReduxLanguageProvider data) {
super.langData(data);
String name = DatagenUtil.getNameLocalized(this.id);

Expand All @@ -172,7 +174,7 @@ protected void langData(ReduxLanguageProvider data) {
}

@Override
protected void recipeData(ReduxRecipeProvider data, RecipeOutput consumer) {
public void recipeData(ReduxRecipeProvider data, RecipeOutput consumer) {
super.recipeData(data, consumer);
ReduxRecipeProvider.wall(consumer, RecipeCategory.BUILDING_BLOCKS, this.logWall().get(), this.log().get());
ReduxRecipeProvider.wall(consumer, RecipeCategory.BUILDING_BLOCKS, this.strippedLogWall().get(), this.strippedLog().get());
Expand All @@ -181,7 +183,7 @@ protected void recipeData(ReduxRecipeProvider data, RecipeOutput consumer) {
}

@Override
protected void blockTagData(ReduxBlockTagsProvider data) {
public void blockTagData(ReduxBlockTagsProvider data) {
super.blockTagData(data);
data.tag(BlockTags.MINEABLE_WITH_AXE).add(
this.logWall().get(),
Expand All @@ -204,7 +206,7 @@ protected void blockTagData(ReduxBlockTagsProvider data) {
}

@Override
protected void lootData(ReduxBlockLootProvider data) {
public void lootData(ReduxBlockLootProvider data) {
super.lootData(data);
data.naturalDrop(this.logWall().get(), this.log().get());
data.naturalDrop(this.woodWall().get(), this.log().get());
Expand Down Expand Up @@ -237,4 +239,11 @@ protected Supplier<? extends ItemLike> naturalBlocks(BuildCreativeModeTabContent
TabUtil.putAfter(superPrev, this.logWall(), event);
return this.logWall();
}

@Override
public void setupStrippables(Map<Block, Block> strippingMap) {
super.setupStrippables(strippingMap);
strippingMap.put(this.logWall().get(), this.strippedLogWall().get());
strippingMap.put(this.woodWall().get(), this.strippedWoodWall().get());
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ protected DeferredBlock<BookshelfBlock> bookshelf(DeferredRegister.Blocks regist
}

@Override
protected void blockData(ReduxBlockStateProvider data) {
public void blockData(ReduxBlockStateProvider data) {
super.blockData(data);
data.bookshelf(this.bookshelf().get(), this.planks().get());
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ public ReduxBlockStateGen(PackOutput output, ExistingFileHelper helper) {
protected void registerStatesAndModels() {

Redux.WOOD_SETS.forEach(set -> set.blockData(this));
Redux.STONE_SETS.forEach(set -> set.blockData(this));

this.tintableShortGrass(ReduxBlocks.SHORT_AETHER_GRASS.get(), "natural/");
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ protected ReduxDataMapGen(PackOutput packOutput, CompletableFuture<HolderLookup.

@Override
protected void gather() {

Redux.WOOD_SETS.forEach(set -> set.mapData(this));
Redux.STONE_SETS.forEach(set -> set.mapData(this));

}
}
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ public ReduxItemModelGen(PackOutput output, ExistingFileHelper helper) {
@Override
protected void registerModels() {
Redux.WOOD_SETS.forEach(set -> set.itemData(this));
Redux.STONE_SETS.forEach(set -> set.itemData(this));

itemBlockFlatCustomTexture(ReduxBlocks.SHORT_AETHER_GRASS, "natural/aether_medium_grass");
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ public ReduxLanguageGen(PackOutput output) {
@Override
protected void addTranslations() {
Redux.WOOD_SETS.forEach(set -> set.langData(this));
Redux.STONE_SETS.forEach(set -> set.langData(this));

this.add(ReduxBlocks.SHORT_AETHER_GRASS);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ public ReduxRecipeGen(PackOutput output, CompletableFuture<HolderLookup.Provider
@Override
protected void buildRecipes(RecipeOutput output) {
Redux.WOOD_SETS.forEach(set -> set.recipeData(this, output));
Redux.STONE_SETS.forEach(set -> set.recipeData(this, output));

}
}
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ public ReduxBlockLoot() {
@Override
protected void generate() {
Redux.WOOD_SETS.forEach(set -> set.lootData(this));
Redux.STONE_SETS.forEach(set -> set.lootData(this));
// TODO
this.dropNone(ReduxBlocks.SHORT_AETHER_GRASS.get());
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ public ReduxBlockTagsGen(PackOutput output, CompletableFuture<HolderLookup.Provi
@Override
protected void addTags(HolderLookup.Provider provider) {
Redux.WOOD_SETS.forEach(set -> set.blockTagData(this));
Redux.STONE_SETS.forEach(set -> set.blockTagData(this));

}
}
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ public ReduxItemTagsGen(PackOutput output, CompletableFuture<HolderLookup.Provid
@Override
protected void addTags(HolderLookup.Provider provider) {
Redux.WOOD_SETS.forEach(set -> set.itemTagData(this));
Redux.STONE_SETS.forEach(set -> set.itemTagData(this));

}
}
Loading

0 comments on commit 4e083d7

Please sign in to comment.