Skip to content

Commit

Permalink
feat: Unfinished WoodSet implementation
Browse files Browse the repository at this point in the history
  • Loading branch information
Zepalesque committed May 21, 2024
1 parent b902e96 commit 4b5b07a
Show file tree
Hide file tree
Showing 2 changed files with 87 additions and 0 deletions.
30 changes: 30 additions & 0 deletions src/main/java/net/zepalesque/zenith/api/BlockSet.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
package net.zepalesque.zenith.api;

import net.neoforged.neoforge.client.model.generators.BlockStateProvider;
import net.neoforged.neoforge.client.model.generators.ItemModelProvider;
import net.neoforged.neoforge.common.data.LanguageProvider;

/**
* A set of auto-datagenned blocks. Not to be confused with {@link net.minecraft.world.level.block.state.properties.BlockSetType}!
*/
public interface BlockSet {

/**
* Generate blockstate files and block models for this BlockSet
* @param data the {@link BlockStateProvider} used
*/
void blockGen(BlockStateProvider data);

/**
* Generate item models for this BlockSet
* @param data the {@link ItemModelProvider} used
*/
void itemGen(ItemModelProvider data);

/**
* Generate language data for this BlockSet
* @param data the {@link LanguageProvider} used
*/
void langGen(LanguageProvider data);

}
57 changes: 57 additions & 0 deletions src/main/java/net/zepalesque/zenith/api/WoodSet.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
package net.zepalesque.zenith.api;

import net.minecraft.core.Direction;
import net.minecraft.world.level.block.Block;
import net.minecraft.world.level.block.Blocks;
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.RotatedPillarBlock;
import net.minecraft.world.level.block.state.properties.NoteBlockInstrument;
import net.minecraft.world.level.material.MapColor;
import net.neoforged.neoforge.client.model.generators.BlockStateProvider;
import net.neoforged.neoforge.client.model.generators.ItemModelProvider;
import net.neoforged.neoforge.common.data.LanguageProvider;
import net.neoforged.neoforge.registries.DeferredBlock;
import net.neoforged.neoforge.registries.DeferredHolder;
import net.neoforged.neoforge.registries.DeferredRegister;

public class WoodSet implements BlockSet {

public final DeferredBlock<Block> log;

public WoodSet(DeferredRegister.Blocks registry, String id, MapColor barkColor, MapColor woodColor, SoundType soundType) {

this.log = generateLog(registry, id, barkColor, woodColor, soundType);

}

protected DeferredBlock<Block> generateLog(DeferredRegister.Blocks registry, String id, MapColor barkColor, MapColor woodColor, SoundType soundType) {
return registry.register(id, () -> new RotatedPillarBlock(Properties.of()
.mapColor(p_152624_ -> p_152624_.getValue(RotatedPillarBlock.AXIS) == Direction.Axis.Y ? woodColor : barkColor)
.instrument(NoteBlockInstrument.BASS)
.strength(2.0F)
.sound(soundType)
.ignitedByLava()
));
}





@Override
public void blockGen(BlockStateProvider data) {

}

@Override
public void itemGen(ItemModelProvider data) {

}

@Override
public void langGen(LanguageProvider data) {

}
}

0 comments on commit 4b5b07a

Please sign in to comment.