Skip to content

Commit

Permalink
EveryCompat support, item descriptions, more connection fixes, misc. …
Browse files Browse the repository at this point in the history
…tweaks
  • Loading branch information
crispytwig committed Sep 20, 2024
1 parent d1cbe4c commit ca2c4e9
Show file tree
Hide file tree
Showing 16 changed files with 480 additions and 27 deletions.
9 changes: 8 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
# CHANGELOG
- ### Updated Fabric Loader to 0.16.5.
- ### Added native EveryCompat support.
- ### There's a config now !!
- ### Urns can now be interacted with Dirt -- when they are filled in this way, plants can be placed atop them.
- To remove the Dirt, simply right-click the Urn with any Shovel -- this uses the #minecraft:shovels tag, so any item tagged as a Shovel will work.
Expand All @@ -15,4 +17,9 @@
- ### Added Balustrades
- Balustrades replace the functionality of placing Trapdoors on top of Lecterns, but in all wood types.
- Balustrades can be interacted with a Hammer on either their top or bottom half to toggle the top and bottom respectively. Their center beam cannot be toggled, and uses the texture of Wooden Walls / Beams so they can better connect with them.
- Balustrades can be **SHIFT** + right-clicked with a Hammer to tilt the top cube to represent a slightly taller Lectern. Doing so will give them a custom hitbox, but they will act the same otherwise.
- Balustrades can be **SHIFT** + right-clicked with a Hammer to tilt the top cube to represent a slightly taller Lectern. Doing so will give them a custom hitbox, but they will act the same otherwise.
- ### Added Lattices
- Can connect horizontally and vertically, but do not connect via corners.
- Plants like Leaves and certain other plants like Glow Berries and Vines can be placed on them.
- Glow Berries placed on them can be Bone Mealed to grow.
- They can be climbed.
5 changes: 4 additions & 1 deletion build.gradle
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
plugins {
id 'fabric-loom' version '1.2-SNAPSHOT'
id 'fabric-loom' version '1.6-SNAPSHOT'
id 'maven-publish'
}

Expand Down Expand Up @@ -54,6 +54,9 @@ dependencies {

modImplementation("com.simibubi.create:create-fabric-${minecraft_version}:${fabric_create_version}") // Create Fabric

modImplementation ("curse.maven:every-compat-628539:5670282") // WoodGood + its dependency, Selene
modImplementation ("curse.maven:selene-499980:5666908")

// Fabric API. This is technically optional, but you probably want it anyway.
modImplementation "net.fabricmc.fabric-api:fabric-api:${project.fabric_version}"
modImplementation "maven.modrinth:midnightlib:${project.midnightlib_version}"
Expand Down
5 changes: 3 additions & 2 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,16 @@ org.gradle.parallel=true
# check these on https://fabricmc.net/develop
minecraft_version=1.20.1
yarn_mappings=1.20.1+build.10
loader_version=0.14.24
loader_version=0.16.5
mod_menu_version=7.2.2

# Mod Properties
mod_version=1.20.1-fabric-1.0.1
mod_version=1.20.1-fabric-2.0.0
maven_group=com.starfish_studios
archives_base_name=bbb

# Dependencies

fabric_version=0.90.4+1.20.1
fabric_registrate_version = 1.3.62-MC1.20.1
fabric_flywheel_version = 0.6.9-1
Expand Down
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.3-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.6-bin.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
Expand Down
302 changes: 302 additions & 0 deletions src/main/java/com/starfish_studios/bbb/BBBModule.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,302 @@
package com.starfish_studios.bbb;

import com.starfish_studios.bbb.block.*;
import com.starfish_studios.bbb.item.DescriptionBlockItem;
import com.starfish_studios.bbb.registry.BBBBlocks;
import com.starfish_studios.bbb.registry.BBBItems;
import io.github.fabricators_of_create.porting_lib.common.util.PlantType;
import net.fabricmc.fabric.api.client.rendering.v1.ColorProviderRegistry;
import net.mehvahdjukaar.every_compat.api.*;
import net.mehvahdjukaar.moonlight.api.platform.ClientHelper;
import net.mehvahdjukaar.moonlight.api.set.leaves.LeavesType;
import net.mehvahdjukaar.moonlight.api.set.wood.WoodType;
import net.mehvahdjukaar.moonlight.api.set.wood.WoodTypeRegistry;
import net.mehvahdjukaar.moonlight.api.util.Utils;
import net.minecraft.client.color.block.BlockColor;
import net.minecraft.client.renderer.BiomeColors;
import net.minecraft.client.renderer.RenderType;
import net.minecraft.core.registries.Registries;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.world.item.BlockItem;
import net.minecraft.world.level.FoliageColor;
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.StairBlock;
import net.minecraft.world.level.block.state.BlockState;

import java.util.Map;

import static com.starfish_studios.bbb.BuildingButBetter.MOD_ID;

public class BBBModule extends SimpleModule {

// Trim, Beam, Beam Stairs, Beam Slab, Pallets, Supports, Balustrades, Walls, Frames, Lanterns, Ladders, Lattices

public final SimpleEntrySet<WoodType, Block> trims;
public final SimpleEntrySet<WoodType, Block> beams;
public final SimpleEntrySet<WoodType, Block> beamStairs;
public final SimpleEntrySet<WoodType, Block> beamSlabs;
public final SimpleEntrySet<WoodType, Block> pallets;
public final SimpleEntrySet<WoodType, Block> supports;
public final SimpleEntrySet<WoodType, Block> balustrades;
public final SimpleEntrySet<WoodType, Block> walls;
public final SimpleEntrySet<WoodType, Block> frames;
public final SimpleEntrySet<WoodType, Block> lanterns;
// public final SimpleEntrySet<WoodType, Block> ladders;
public final SimpleEntrySet<WoodType, Block> lattices;

public static void init(String modId) {
new BBBModule(MOD_ID);
}

@Override
public void registerBlockColors(ClientHelper.BlockColorEvent event) {
super.registerBlockColors(event);
ColorProviderRegistry<Block, BlockColor> blockColor = ColorProviderRegistry.BLOCK;
// blockColor.register((state, world, pos, tintIndex) -> {
// if (world == null || pos == null) {
// return FoliageColor.getDefaultColor();
// }
// return BiomeColors.getAverageFoliageColor(world, pos);
// }
// );
for (Map.Entry<WoodType, Block> entry : lattices.blocks.entrySet()) {
blockColor.register((state, world, pos, tintIndex) -> {
if (world == null || pos == null) {
return FoliageColor.getDefaultColor();
}
return BiomeColors.getAverageFoliageColor(world, pos);
}, entry.getValue());
}
}

public BBBModule(String modId) {
super(modId, "bbb");

SimpleModule bbb = new SimpleModule("bbb", "bbb");



trims = SimpleEntrySet.builder(WoodType.class, "trim",
getModBlock("oak_trim"), () -> WoodTypeRegistry.OAK_TYPE,
w -> new FacingConnectingBlock(Utils.copyPropertySafe(BBBBlocks.OAK_TRIM)))
.addTag(modRes("trims"), Registries.BLOCK)
.addTag(modRes("trims"), Registries.ITEM)
.copyParentDrop()
.defaultRecipe()
.setTab(getModTab(MOD_ID))
.setTabMode(TabAddMode.AFTER_SAME_TYPE)
.setRenderType(() -> RenderType::cutout)
.useMergedPalette()
.addTexture(modRes("block/trim/oak_bottom"))
.addTexture(modRes("block/trim/oak_middle"))
.addTexture(modRes("block/trim/oak_none"))
.addTexture(modRes("block/trim/oak_top"))
.addTexture(modRes("block/trim/oak_top_face"))
.build();

this.addEntry(trims);

beams = SimpleEntrySet.builder(WoodType.class, "beam",
getModBlock("oak_beam"), () -> WoodTypeRegistry.OAK_TYPE,
w -> new RotatedPillarBlock(Utils.copyPropertySafe(BBBBlocks.OAK_BEAM)))
.addTag(modRes("beams"), Registries.BLOCK)
.addTag(modRes("beams"), Registries.ITEM)
.copyParentDrop()
.defaultRecipe()
.setTab(getModTab(MOD_ID))
.setTabMode(TabAddMode.AFTER_SAME_TYPE)
.setRenderType(() -> RenderType::cutout)
.useMergedPalette()
.addTexture(modRes("block/beam/oak"))
.addTexture(modRes("block/beam/oak_top"))
.build();

this.addEntry(beams);

beamStairs = SimpleEntrySet.builder(WoodType.class, "beam_stairs",
getModBlock("oak_beam_stairs"), () -> WoodTypeRegistry.OAK_TYPE,
w -> new StairBlock((Blocks.OAK_PLANKS.defaultBlockState()), Utils.copyPropertySafe(BBBBlocks.OAK_BEAM_STAIRS)))
.addTag(modRes("beams"), Registries.BLOCK)
.addTag(modRes("beams"), Registries.ITEM)
.copyParentDrop()
.defaultRecipe()
.setTab(getModTab(MOD_ID))
.setTabMode(TabAddMode.AFTER_SAME_TYPE)
.setRenderType(() -> RenderType::cutout)
.useMergedPalette()
.addTexture(modRes("block/beam/oak"))
.addTexture(modRes("block/beam/oak_top"))
.build();

this.addEntry(beamStairs);

beamSlabs = SimpleEntrySet.builder(WoodType.class, "beam_slab",
getModBlock("oak_beam_slab"), () -> WoodTypeRegistry.OAK_TYPE,
w -> new FacingSlabBlock(Utils.copyPropertySafe(BBBBlocks.OAK_BEAM_SLAB)))
.addTag(modRes("beams"), Registries.BLOCK)
.addTag(modRes("beams"), Registries.ITEM)
.copyParentDrop()
.defaultRecipe()
.setTab(getModTab(MOD_ID))
.setTabMode(TabAddMode.AFTER_SAME_TYPE)
.setRenderType(() -> RenderType::cutout)
.useMergedPalette()
.addTexture(modRes("block/beam/oak"))
.addTexture(modRes("block/beam/oak_top"))
.build();

this.addEntry(beamSlabs);

pallets = SimpleEntrySet.builder(WoodType.class, "pallet",
getModBlock("oak_pallet"), () -> WoodTypeRegistry.OAK_TYPE,
w -> new PalletBlock(Utils.copyPropertySafe(BBBBlocks.OAK_PALLET)))
.addTag(modRes("pallets"), Registries.BLOCK)
.addTag(modRes("pallets"), Registries.ITEM)
.addCustomItem((wood, block, properties) -> new DescriptionBlockItem(block, properties))
.copyParentDrop()
.defaultRecipe()
.setTab(getModTab(MOD_ID))
.setTabMode(TabAddMode.AFTER_SAME_TYPE)
.setRenderType(() -> RenderType::cutout)
.useMergedPalette()
.addTexture(modRes("block/pallet/oak_pallet"))
.build();

this.addEntry(pallets);

supports = SimpleEntrySet.builder(WoodType.class, "support",
getModBlock("oak_support"), () -> WoodTypeRegistry.OAK_TYPE,
w -> new SupportBlock(Utils.copyPropertySafe(BBBBlocks.OAK_SUPPORT)))
.addTag(modRes("supports"), Registries.BLOCK)
.addTag(modRes("supports"), Registries.ITEM)
.addCustomItem((wood, block, properties) -> new DescriptionBlockItem(block, properties))
.copyParentDrop()
.defaultRecipe()
.setTab(getModTab(MOD_ID))
.setTabMode(TabAddMode.AFTER_SAME_TYPE)
.setRenderType(() -> RenderType::cutout)
.useMergedPalette()
.addTexture(modRes("block/beam/oak"))
.addTexture(modRes("block/beam/oak_top"))
.build();

this.addEntry(supports);

balustrades = SimpleEntrySet.builder(WoodType.class, "balustrade",
getModBlock("oak_balustrade"), () -> WoodTypeRegistry.OAK_TYPE,
w -> new BalustradeBlock(Utils.copyPropertySafe(BBBBlocks.OAK_BALUSTRADE)))
.addTag(modRes("balustrades"), Registries.BLOCK)
.addTag(modRes("balustrades"), Registries.ITEM)
.addCustomItem((wood, block, properties) -> new DescriptionBlockItem(block, properties))
.copyParentDrop()
.defaultRecipe()
.setTab(getModTab(MOD_ID))
.setTabMode(TabAddMode.AFTER_SAME_TYPE)
.setRenderType(() -> RenderType::cutout)
.useMergedPalette()
.addTexture(modRes("block/balustrade/oak_top"))
.addTexture(modRes("block/balustrade/oak_sides"))
.build();

this.addEntry(balustrades);

walls = SimpleEntrySet.builder(WoodType.class, "wall",
getModBlock("oak_wall"), () -> WoodTypeRegistry.OAK_TYPE,
w -> new WoodenWallBlock(Utils.copyPropertySafe(BBBBlocks.OAK_WALL)))
.addTag(modRes("wooden_walls"), Registries.BLOCK)
// .addTag(modRes("wooden_walls"), Registries.ITEM)
.copyParentDrop()
.defaultRecipe()
.setTab(getModTab(MOD_ID))
.setTabMode(TabAddMode.AFTER_SAME_TYPE)
.setRenderType(() -> RenderType::cutout)
.useMergedPalette()
.addTexture(modRes("block/beam/oak"))
.addTexture(modRes("block/beam/oak_top"))
.build();

this.addEntry(walls);

frames = SimpleEntrySet.builder(WoodType.class, "frame",
getModBlock("oak_frame"), () -> WoodTypeRegistry.OAK_TYPE,
w -> new FrameBlock(Utils.copyPropertySafe(BBBBlocks.OAK_FRAME)))
.addTag(modRes("frames"), Registries.BLOCK)
.addTag(modRes("frames"), Registries.ITEM)
.addCustomItem((wood, block, properties) -> new DescriptionBlockItem(block, properties))
.copyParentDrop()
.defaultRecipe()
.setTab(getModTab(MOD_ID))
.setTabMode(TabAddMode.AFTER_SAME_TYPE)
.setRenderType(() -> RenderType::cutout)
.useMergedPalette()
.addTexture(modRes("block/frame/oak"))
.addTexture(modRes("block/frame/oak_sticks"))
.build();

this.addEntry(frames);

lanterns = SimpleEntrySet.builder(WoodType.class, "lantern",
getModBlock("oak_lantern"), () -> WoodTypeRegistry.OAK_TYPE,
w -> new WoodenLanternBlock(Utils.copyPropertySafe(BBBBlocks.OAK_LANTERN)))
.addTag(modRes("lanterns"), Registries.BLOCK)
.addTag(modRes("lanterns"), Registries.ITEM)
.addCustomItem((wood, block, properties) -> new DescriptionBlockItem(block, properties))
.copyParentDrop()
.defaultRecipe()
.setTab(getModTab(MOD_ID))
.setTabMode(TabAddMode.AFTER_SAME_TYPE)
.setRenderType(() -> RenderType::cutout)
.useMergedPalette()
.addTextureM(modRes("block/lantern/oak"), modRes("block/lantern/lantern_mask"))
.build();

this.addEntry(lanterns);

// ladders = SimpleEntrySet.builder(WoodType.class, "ladder",
// getModBlock("oak_ladder"), () -> WoodTypeRegistry.OAK_TYPE,
// w -> new BBBLadderBlock(1, Utils.copyPropertySafe(BBBBlocks.OAK_LADDER)))
// .addTag(modRes("ladders"), Registries.BLOCK)
// .addTag(modRes("ladders"), Registries.ITEM)
// .copyParentDrop()
// .defaultRecipe()
// .setTab(getModTab(MOD_ID))
// .setTabMode(TabAddMode.AFTER_SAME_TYPE)
// .setRenderType(() -> RenderType::cutout)
// .useMergedPalette()
// .addTexture(modRes("block/ladder/oak/oak"))
// .addTexture(modRes("block/ladder/spruce/spruce"))
// .addTexture(modRes("block/ladder/birch/birch"))
// .addTexture(modRes("block/ladder/jungle/jungle"))
// .addTexture(modRes("block/ladder/acacia/acacia"))
// .addTexture(modRes("block/ladder/dark_oak/dark_oak"))
// .addTexture(modRes("block/ladder/mangrove/mangrove"))
// .addTexture(modRes("block/ladder/cherry/cherry"))
// .build();
//
// this.addEntry(ladders);

lattices = SimpleEntrySet.builder(WoodType.class, "lattice",
getModBlock("oak_lattice"), () -> WoodTypeRegistry.OAK_TYPE,
w -> new LatticeBlock(Utils.copyPropertySafe(BBBBlocks.OAK_LATTICE)))
.addTag(modRes("lattices"), Registries.BLOCK)
.addTag(modRes("lattices"), Registries.ITEM)
.addCustomItem((wood, block, properties) -> new DescriptionBlockItem(block, properties))
.copyParentDrop()
.defaultRecipe()
.setTab(getModTab(MOD_ID))
.setTabMode(TabAddMode.AFTER_SAME_TYPE)
.setRenderType(() -> RenderType::cutout)
.useMergedPalette()
.addTexture(modRes("block/lattice/oak"))
.addTexture(ResourceLocation.tryParse("minecraft:block/oak_log"))
.addTexture(ResourceLocation.tryParse("minecraft:block/oak_log_top"))
.build();

this.addEntry(lattices);


EveryCompatAPI.registerModule(bbb);
}
}
10 changes: 10 additions & 0 deletions src/main/java/com/starfish_studios/bbb/BuildingButBetter.java
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@
import net.fabricmc.api.ModInitializer;
import net.fabricmc.fabric.api.itemgroup.v1.ItemGroupEvents;
import net.fabricmc.fabric.api.registry.OxidizableBlocksRegistry;
import net.fabricmc.loader.api.FabricLoader;
import net.mehvahdjukaar.every_compat.EveryCompat;
import net.minecraft.Util;
import net.minecraft.world.item.CreativeModeTabs;
import net.minecraft.world.item.Items;
Expand All @@ -24,14 +26,22 @@ public class BuildingButBetter implements ModInitializer {
@Override
public void onInitialize() {
MidnightConfig.init(MOD_ID, BBBConfig.class);


if(FabricLoader.getInstance().isModLoaded("everycomp")){
EveryCompat.ACTIVE_MODULES.put(MOD_ID, new BBBModule(MOD_ID));
}

BlockUseEvent.EVENT.register(new BlockUseEvent());

Reflection.initialize(
BBBCreativeModeTab.class,
BBBSoundEvents.class,
BBBItems.class,
BBBBlocks.class
);


// region CREATIVE TAB INJECTIONS

ItemGroupEvents.modifyEntriesEvent(CreativeModeTabs.FUNCTIONAL_BLOCKS).register(entries -> {
Expand Down
Loading

0 comments on commit ca2c4e9

Please sign in to comment.