-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
e9bb0b3
commit fe440b0
Showing
26 changed files
with
883 additions
and
45 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
50 changes: 50 additions & 0 deletions
50
src/main/java/net/zepalesque/redux/block/natural/ReduxDoubleDropsWall.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
package net.zepalesque.redux.block.natural; | ||
|
||
import com.aetherteam.aether.block.AetherBlockStateProperties; | ||
import com.google.common.collect.ImmutableMap; | ||
import net.minecraft.world.level.block.Block; | ||
import net.minecraft.world.level.block.WallBlock; | ||
import net.minecraft.world.level.block.state.BlockState; | ||
import net.minecraft.world.level.block.state.StateDefinition; | ||
import net.minecraft.world.phys.shapes.VoxelShape; | ||
import net.zepalesque.redux.mixin.mixins.common.accessor.WallBlockAccessor; | ||
|
||
import java.util.Map; | ||
|
||
// TODO: Replace with Nitrogen version | ||
public class ReduxDoubleDropsWall extends WallBlock { | ||
public ReduxDoubleDropsWall(Properties properties) { | ||
super(properties); | ||
this.registerDefaultState(this.defaultBlockState().setValue(AetherBlockStateProperties.DOUBLE_DROPS, false)); | ||
this.fixShapeMaps(); | ||
} | ||
|
||
@Override | ||
protected void createBlockStateDefinition(StateDefinition.Builder<Block, BlockState> builder) { | ||
super.createBlockStateDefinition(builder); | ||
builder.add(AetherBlockStateProperties.DOUBLE_DROPS); | ||
} | ||
|
||
/** | ||
* Based on the Framed Blocks mod's shape map fix for implementing a wall with additional block properties. | ||
*/ | ||
protected void fixShapeMaps() { | ||
WallBlockAccessor wallBlockAccessor = (WallBlockAccessor) this; | ||
Map<BlockState, VoxelShape> shapeByIndex = wallBlockAccessor.redux$getShapeByIndex(); | ||
shapeByIndex = fixShapeMap(shapeByIndex).build(); | ||
wallBlockAccessor.redux$setShapeByIndex(shapeByIndex); | ||
|
||
Map<BlockState, VoxelShape> collisionShapeByIndex = wallBlockAccessor.redux$getCollisionShapeByIndex(); | ||
collisionShapeByIndex = fixShapeMap(collisionShapeByIndex).build(); | ||
wallBlockAccessor.redux$setCollisionShapeByIndex(collisionShapeByIndex); | ||
} | ||
|
||
protected ImmutableMap.Builder<BlockState, VoxelShape> fixShapeMap(Map<BlockState, VoxelShape> map) { | ||
ImmutableMap.Builder<BlockState, VoxelShape> builder = ImmutableMap.builder(); | ||
builder.putAll(map); | ||
for (BlockState state : map.keySet()) { | ||
builder.put(state.cycle(AetherBlockStateProperties.DOUBLE_DROPS), map.get(state)); | ||
} | ||
return builder; | ||
} | ||
} |
33 changes: 33 additions & 0 deletions
33
src/main/java/net/zepalesque/redux/block/natural/ReduxNaturalWall.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
package net.zepalesque.redux.block.natural; | ||
|
||
import com.google.common.collect.ImmutableMap; | ||
import net.minecraft.world.level.block.Block; | ||
import net.minecraft.world.level.block.state.BlockState; | ||
import net.minecraft.world.level.block.state.StateDefinition; | ||
import net.minecraft.world.phys.shapes.VoxelShape; | ||
import net.zepalesque.redux.block.state.ReduxStates; | ||
|
||
import java.util.Map; | ||
|
||
public class ReduxNaturalWall extends ReduxDoubleDropsWall { | ||
public ReduxNaturalWall(Properties properties) { | ||
super(properties); | ||
this.registerDefaultState(this.defaultBlockState().setValue(ReduxStates.NATURAL_GEN, false)); | ||
this.fixShapeMaps(); | ||
} | ||
|
||
@Override | ||
protected void createBlockStateDefinition(StateDefinition.Builder<Block, BlockState> builder) { | ||
super.createBlockStateDefinition(builder); | ||
builder.add(ReduxStates.NATURAL_GEN); | ||
} | ||
|
||
@Override | ||
protected ImmutableMap.Builder<BlockState, VoxelShape> fixShapeMap(Map<BlockState, VoxelShape> map) { | ||
ImmutableMap.Builder<BlockState, VoxelShape> builder = super.fixShapeMap(map); | ||
for (BlockState state : map.keySet()) { | ||
builder.put(state.cycle(ReduxStates.NATURAL_GEN), map.get(state)); | ||
} | ||
return builder; | ||
} | ||
} |
219 changes: 219 additions & 0 deletions
219
src/main/java/net/zepalesque/redux/blockset/AetherWoodSet.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,219 @@ | ||
package net.zepalesque.redux.blockset; | ||
|
||
import com.aetherteam.aether.mixin.mixins.common.accessor.FireBlockAccessor; | ||
import net.minecraft.data.recipes.RecipeCategory; | ||
import net.minecraft.data.recipes.RecipeOutput; | ||
import net.minecraft.tags.BlockTags; | ||
import net.minecraft.world.item.BlockItem; | ||
import net.minecraft.world.item.Item; | ||
import net.minecraft.world.level.block.Blocks; | ||
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; | ||
import net.minecraft.world.level.material.MapColor; | ||
import net.neoforged.neoforge.client.model.generators.ModelBuilder; | ||
import net.neoforged.neoforge.client.model.generators.ModelFile; | ||
import net.neoforged.neoforge.registries.DeferredBlock; | ||
import net.neoforged.neoforge.registries.DeferredRegister; | ||
import net.zepalesque.redux.Redux; | ||
import net.zepalesque.redux.block.ReduxBlocks; | ||
import net.zepalesque.redux.block.natural.ReduxNaturalWall; | ||
import net.zepalesque.redux.data.prov.ReduxBlockStateProvider; | ||
import net.zepalesque.redux.data.prov.ReduxItemModelProvider; | ||
import net.zepalesque.redux.data.prov.ReduxLanguageProvider; | ||
import net.zepalesque.redux.data.prov.ReduxRecipeProvider; | ||
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.zenith.util.DatagenUtil; | ||
|
||
public class AetherWoodSet extends BaseWoodSet { | ||
|
||
protected final DeferredBlock<ReduxNaturalWall> log_wall; | ||
protected final DeferredBlock<ReduxNaturalWall> wood_wall; | ||
protected final DeferredBlock<ReduxNaturalWall> stripped_log_wall; | ||
protected final DeferredBlock<ReduxNaturalWall> stripped_wood_wall; | ||
|
||
public AetherWoodSet(String id, MapColor woodColor, MapColor barkColor, SoundType sound) { | ||
super(id, woodColor, barkColor, sound); | ||
DeferredRegister.Blocks blocks = ReduxBlocks.BLOCKS; | ||
DeferredRegister.Items items = ReduxItems.ITEMS; | ||
|
||
this.log_wall = this.logWall(blocks, items, id, woodColor, sound); | ||
this.wood_wall = this.woodWall(blocks, items, id, woodColor, sound); | ||
this.stripped_log_wall = this.strippedLogWall(blocks, items, id, woodColor, sound); | ||
this.stripped_wood_wall = this.strippedWoodWall(blocks, items, id, woodColor, sound); | ||
} | ||
|
||
protected DeferredBlock<ReduxNaturalWall> logWall(DeferredRegister.Blocks registry, DeferredRegister.Items items, String id, MapColor color, SoundType soundType) { | ||
var block = registry.register(id + this.logSuffix(LangType.ID) + "_wall", () -> new ReduxNaturalWall(Properties.of() | ||
.mapColor(MapColor.WOOD) | ||
.instrument(NoteBlockInstrument.BASS) | ||
.ignitedByLava() | ||
.strength(2.0F) | ||
.sound(SoundType.WOOD) | ||
)); | ||
items.register(block.getId().getPath(), () -> new BlockItem(block.get(), new Item.Properties())); | ||
return block; | ||
} | ||
|
||
public DeferredBlock<ReduxNaturalWall> logWall() { | ||
return this.log_wall; | ||
} | ||
|
||
protected DeferredBlock<ReduxNaturalWall> woodWall(DeferredRegister.Blocks registry, DeferredRegister.Items items, String id, MapColor color, SoundType soundType) { | ||
var block = registry.register(id + this.woodSuffix(LangType.ID) + "_wall", () -> new ReduxNaturalWall(Properties.of() | ||
.mapColor(MapColor.WOOD) | ||
.instrument(NoteBlockInstrument.BASS) | ||
.ignitedByLava() | ||
.strength(2.0F) | ||
.sound(SoundType.WOOD) | ||
)); | ||
items.register(block.getId().getPath(), () -> new BlockItem(block.get(), new Item.Properties())); | ||
return block; | ||
} | ||
|
||
public DeferredBlock<ReduxNaturalWall> woodWall() { | ||
return this.wood_wall; | ||
} | ||
|
||
protected DeferredBlock<ReduxNaturalWall> strippedLogWall(DeferredRegister.Blocks registry, DeferredRegister.Items items, String id, MapColor color, SoundType soundType) { | ||
var block = registry.register(id + this.logSuffix(LangType.ID) + "_wall", () -> new ReduxNaturalWall(Properties.of() | ||
.mapColor(MapColor.WOOD) | ||
.instrument(NoteBlockInstrument.BASS) | ||
.ignitedByLava() | ||
.strength(2.0F) | ||
.sound(SoundType.WOOD) | ||
)); | ||
items.register(block.getId().getPath(), () -> new BlockItem(block.get(), new Item.Properties())); | ||
return block; | ||
} | ||
|
||
public DeferredBlock<ReduxNaturalWall> strippedLogWall() { | ||
return this.stripped_log_wall; | ||
} | ||
|
||
protected DeferredBlock<ReduxNaturalWall> strippedWoodWall(DeferredRegister.Blocks registry, DeferredRegister.Items items, String id, MapColor color, SoundType soundType) { | ||
var block = registry.register(id + this.logSuffix(LangType.ID) + "_wall", () -> new ReduxNaturalWall(Properties.of() | ||
.mapColor(MapColor.WOOD) | ||
.instrument(NoteBlockInstrument.BASS) | ||
.ignitedByLava() | ||
.strength(2.0F) | ||
.sound(SoundType.WOOD) | ||
)); | ||
items.register(block.getId().getPath(), () -> new BlockItem(block.get(), new Item.Properties())); | ||
return block; | ||
} | ||
|
||
public DeferredBlock<ReduxNaturalWall> strippedWoodWall() { | ||
return this.stripped_wood_wall; | ||
} | ||
|
||
|
||
@Override | ||
protected 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"); | ||
ModelFile postTall = data.makeWallPostModel(3, 16, "wooden_post_tall"); | ||
ModelFile side = data.makeWallSideModel(5, 14, "wooden_side", ModelBuilder.FaceRotation.CLOCKWISE_90, 0, 5); | ||
ModelFile sideAlt = data.makeWallSideModel(5, 14, "wooden_side_alt", ModelBuilder.FaceRotation.COUNTERCLOCKWISE_90, 11, 16); | ||
ModelFile sideTall = data.makeWallSideModel(5, 16, "wooden_side_tall", ModelBuilder.FaceRotation.CLOCKWISE_90, 0, 5); | ||
ModelFile sideTallAlt = data.makeWallSideModel(5, 16, "wooden_side_tall_alt", ModelBuilder.FaceRotation.COUNTERCLOCKWISE_90, 11, 16); | ||
ModelFile sideShort = data.makeWallSideModel(4, 14, "wooden_side_short", ModelBuilder.FaceRotation.CLOCKWISE_90, 0, 4); | ||
ModelFile sideAltShort = data.makeWallSideModel(4, 14, "wooden_side_alt_short", ModelBuilder.FaceRotation.COUNTERCLOCKWISE_90, 12, 16); | ||
ModelFile sideTallShort = data.makeWallSideModel(4, 16, "wooden_side_tall_short", ModelBuilder.FaceRotation.CLOCKWISE_90, 0, 4); | ||
ModelFile sideTallAltShort = data.makeWallSideModel(4, 16, "wooden_side_tall_alt_short", ModelBuilder.FaceRotation.COUNTERCLOCKWISE_90, 12, 16); | ||
|
||
data.logWallBlock(this.logWall().get(), this.log().get(), "natural/", | ||
Redux.MODID, true, postBig, postShort, postTall, side, sideAlt, sideTall, sideTallAlt, sideShort, sideAltShort, sideTallShort, sideTallAltShort); | ||
|
||
data.logWallBlock(this.strippedLogWall().get(), this.strippedLog().get(), "natural/", | ||
Redux.MODID, true, postBig, postShort, postTall, side, sideAlt, sideTall, sideTallAlt, sideShort, sideAltShort, sideTallShort, sideTallAltShort); | ||
|
||
data.logWallBlock(this.woodWall().get(), this.log().get(), "natural/", | ||
Redux.MODID, false, postBig, postShort, postTall, side, sideAlt, sideTall, sideTallAlt, sideShort, sideAltShort, sideTallShort, sideTallAltShort); | ||
|
||
data.logWallBlock(this.strippedWoodWall().get(), this.strippedLog().get(), "natural/", | ||
Redux.MODID, false, postBig, postShort, postTall, side, sideAlt, sideTall, sideTallAlt, sideShort, sideAltShort, sideTallShort, sideTallAltShort); | ||
|
||
} | ||
|
||
@Override | ||
protected 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); | ||
data.itemWoodWallBlock(this.woodWall().get(), this.log().get(), "natural/", Redux.MODID); | ||
data.itemWoodWallBlock(this.strippedWoodWall().get(), this.strippedLog().get(), "natural/", Redux.MODID); | ||
} | ||
|
||
@Override | ||
protected void langData(ReduxLanguageProvider data) { | ||
super.langData(data); | ||
String name = DatagenUtil.getNameLocalized(this.id); | ||
|
||
data.add(this.logWall()); | ||
data.addLore(this.logWall(), "Crafted from " + name + " " + this.logSuffix(LangType.LANG_PLURAL) + ". Can be used for decorative enclosures and defences. Great for keeping nasty intruders away!"); | ||
|
||
data.add(this.strippedLogWall()); | ||
data.addLore(this.strippedLogWall(), "Crafted from Stripped " + name + " " + this.logSuffix(LangType.LANG_PLURAL) + ". Can be used for decorative enclosures and defences. Great for keeping nasty intruders away!"); | ||
|
||
data.add(this.woodWall()); | ||
data.addLore(this.woodWall(), "Crafted from " + name + " " + this.woodSuffix(LangType.LANG_PLURAL) + ". Can be used for decorative enclosures and defences. Great for keeping nasty intruders away!"); | ||
|
||
data.add(this.strippedWoodWall()); | ||
data.addLore(this.strippedWoodWall(), "Crafted from Stripped " + name + " " + this.woodSuffix(LangType.LANG_PLURAL) + ". Can be used for decorative enclosures and defences. Great for keeping nasty intruders away!"); | ||
} | ||
|
||
@Override | ||
protected 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()); | ||
ReduxRecipeProvider.wall(consumer, RecipeCategory.BUILDING_BLOCKS, this.woodWall().get(), this.wood().get()); | ||
ReduxRecipeProvider.wall(consumer, RecipeCategory.BUILDING_BLOCKS, this.strippedWoodWall().get(), this.strippedWood().get()); | ||
} | ||
|
||
@Override | ||
protected void blockTagData(ReduxBlockTagsProvider data) { | ||
super.blockTagData(data); | ||
data.tag(BlockTags.MINEABLE_WITH_AXE).add( | ||
this.logWall().get(), | ||
this.strippedLogWall().get(), | ||
this.woodWall().get(), | ||
this.strippedWoodWall().get() | ||
); | ||
data.tag(BlockTags.LOGS).add( | ||
this.logWall().get(), | ||
this.strippedLogWall().get(), | ||
this.woodWall().get(), | ||
this.strippedWoodWall().get() | ||
); | ||
data.tag(BlockTags.WALLS).add( | ||
this.logWall().get(), | ||
this.strippedLogWall().get(), | ||
this.woodWall().get(), | ||
this.strippedWoodWall().get() | ||
); | ||
} | ||
|
||
@Override | ||
protected void lootData(ReduxBlockLootProvider data) { | ||
super.lootData(data); | ||
data.naturalDrop(this.logWall().get(), this.log().get()); | ||
data.naturalDrop(this.woodWall().get(), this.log().get()); | ||
data.naturalDrop(this.strippedLogWall().get(), this.strippedLog().get()); | ||
data.naturalDrop(this.strippedWoodWall().get(), this.strippedLog().get()); | ||
} | ||
|
||
@Override | ||
public void flammables() { | ||
super.flammables(); | ||
FireBlockAccessor accessor = (FireBlockAccessor) Blocks.FIRE; | ||
accessor.callSetFlammable(this.logWall().get(), 5, 5); | ||
accessor.callSetFlammable(this.woodWall().get(), 5, 5); | ||
accessor.callSetFlammable(this.strippedLogWall().get(), 5, 5); | ||
accessor.callSetFlammable(this.strippedWoodWall().get(), 5, 5); | ||
} | ||
} |
Oops, something went wrong.