├── .github └── ISSUE_TEMPLATE │ ├── config.yml │ └── SUGGEST_FROM.yml ├── bclib_banner.png ├── src └── main │ ├── resources │ ├── data │ │ └── bclib │ │ │ └── config │ │ │ └── recipes.json │ ├── assets │ │ └── bclib │ │ │ ├── patterns │ │ │ ├── item │ │ │ │ ├── pattern_item_spawn_egg.json │ │ │ │ ├── pattern_wall.json │ │ │ │ ├── pattern_block_item.json │ │ │ │ ├── pattern_button.json │ │ │ │ ├── pattern_item_handheld.json │ │ │ │ ├── pattern_fence.json │ │ │ │ ├── pattern_item_generated.json │ │ │ │ └── pattern_chest.json │ │ │ └── block │ │ │ │ ├── empty.json │ │ │ │ ├── block.json │ │ │ │ ├── button.json │ │ │ │ ├── cross.json │ │ │ │ ├── fence_post.json │ │ │ │ ├── fence_side.json │ │ │ │ ├── ladder.json │ │ │ │ ├── wall_inventory.json │ │ │ │ ├── wall_post.json │ │ │ │ ├── wall_side.json │ │ │ │ ├── block_colored.json │ │ │ │ ├── button_pressed.json │ │ │ │ ├── pressure_plate_up.json │ │ │ │ ├── wall_side_tall.json │ │ │ │ ├── pressure_plate_down.json │ │ │ │ ├── fence_gate_closed.json │ │ │ │ ├── fence_gate_open.json │ │ │ │ ├── wall_gate_closed.json │ │ │ │ ├── wall_gate_open.json │ │ │ │ ├── chain.json │ │ │ │ ├── pillar.json │ │ │ │ ├── top_side_bottom.json │ │ │ │ ├── trapdoor.json │ │ │ │ ├── bookshelf.json │ │ │ │ ├── door_top.json │ │ │ │ ├── path.json │ │ │ │ ├── door_bottom.json │ │ │ │ ├── door_top_hinge.json │ │ │ │ ├── slab.json │ │ │ │ ├── vanilla_wood_bookshelf.json │ │ │ │ ├── stairs.json │ │ │ │ ├── door_bottom_hinge.json │ │ │ │ ├── stairs_inner.json │ │ │ │ ├── stairs_outer.json │ │ │ │ ├── barrel_open.json │ │ │ │ ├── block_bottom_top.json │ │ │ │ ├── furnace.json │ │ │ │ └── block_sided.json │ │ │ ├── icon.png │ │ │ ├── materialmaps │ │ │ └── block │ │ │ │ └── alpha_emission.json │ │ │ ├── betterx.png │ │ │ ├── header.png │ │ │ ├── icon_bright.png │ │ │ ├── icon_updater.png │ │ │ ├── iconpixelated.png │ │ │ ├── models │ │ │ ├── block │ │ │ │ ├── empty_test.json │ │ │ │ ├── empty_hanging_test.json │ │ │ │ ├── sided_door_top.json │ │ │ │ ├── sided_door_top_rh.json │ │ │ │ ├── sided_door_bottom.json │ │ │ │ └── sided_door_bottom_rh.json │ │ │ └── item │ │ │ │ ├── test_sign.json │ │ │ │ └── test_hanging_sign.json │ │ │ ├── icon_betterend.png │ │ │ ├── icon_betternether.png │ │ │ ├── blockstates │ │ │ ├── test_sign.json │ │ │ ├── test_wall_sign.json │ │ │ ├── test_hanging_sign.json │ │ │ └── test_wall_hanging_sign.json │ │ │ ├── textures │ │ │ ├── gui │ │ │ │ └── widgets.png │ │ │ ├── item │ │ │ │ ├── test_sign.png │ │ │ │ └── test_hanging_sign.png │ │ │ ├── block │ │ │ │ └── test_planks.png │ │ │ └── entity │ │ │ │ └── signs │ │ │ │ ├── test_wood.png │ │ │ │ └── hanging │ │ │ │ └── test_wood.png │ │ │ └── materials │ │ │ └── alpha_emission.json │ ├── ui.mixins.client.json │ ├── bclib.mixins.client.json │ └── bclib.mixins.common.json │ ├── generated │ └── data │ │ └── bclib │ │ └── tags │ │ └── block │ │ └── bonemeal │ │ ├── target │ │ ├── obsidian.json │ │ ├── end_stone.json │ │ └── netherrack.json │ │ └── source │ │ └── netherrack.json │ └── java │ └── org │ ├── betterx │ ├── bclib │ │ ├── interfaces │ │ │ ├── Fuel.java │ │ │ ├── tools │ │ │ │ ├── PreventMineableAdd.java │ │ │ │ ├── AddMineableAxe.java │ │ │ │ ├── AddMineableHoe.java │ │ │ │ ├── AddMineableSword.java │ │ │ │ ├── AddMineableHammer.java │ │ │ │ ├── AddMineablePickaxe.java │ │ │ │ ├── AddMineableShears.java │ │ │ │ ├── AddMineableShovel.java │ │ │ │ ├── HasMinableBehaviour.java │ │ │ │ └── AxeCanStrip.java │ │ │ ├── PostInitable.java │ │ │ ├── UnknownReceipBookCategory.java │ │ │ ├── TriConsumer.java │ │ │ ├── RenderLayerProvider.java │ │ │ ├── SurvivesOn.java │ │ │ ├── CustomColorProvider.java │ │ │ ├── PatchBiFunction.java │ │ │ ├── PatchFunction.java │ │ │ ├── LootPoolAccessor.java │ │ │ ├── BCLPlacementContext.java │ │ │ ├── CustomItemProvider.java │ │ │ ├── ItemModelProvider.java │ │ │ ├── LevelRendererAccess.java │ │ │ ├── SpawnRule.java │ │ │ ├── ClientLevelAccess.java │ │ │ ├── SurvivesOnWater.java │ │ │ ├── AlloyingRecipeWorkstation.java │ │ │ ├── AnvilScreenHandlerExtended.java │ │ │ └── SurvivesOnBlocks.java │ │ ├── behaviours │ │ │ └── interfaces │ │ │ │ ├── BlockBehaviour.java │ │ │ │ ├── BehaviourImmobile.java │ │ │ │ ├── BehaviourSeedLike.java │ │ │ │ ├── BehaviourPortalFrame.java │ │ │ │ ├── BehaviourSaplingLike.java │ │ │ │ ├── BehaviourWaterPlantLike.java │ │ │ │ ├── BehaviourExplosionResistant.java │ │ │ │ ├── BehaviourObsidianPortalFrame.java │ │ │ │ ├── BehaviourWood.java │ │ │ │ ├── BehaviourIce.java │ │ │ │ ├── BehaviourOre.java │ │ │ │ ├── BehaviourSand.java │ │ │ │ ├── BehaviourSnow.java │ │ │ │ ├── BehaviourGlass.java │ │ │ │ ├── BehaviourMetal.java │ │ │ │ ├── BehaviourStone.java │ │ │ │ ├── BehaviourObsidian.java │ │ │ │ ├── BehaviourPlant.java │ │ │ │ ├── BehaviourWaterPlant.java │ │ │ │ ├── BehaviourSeed.java │ │ │ │ ├── BehaviourSapling.java │ │ │ │ ├── BehaviourShearablePlant.java │ │ │ │ ├── BehaviourWaterPlantSeed.java │ │ │ │ ├── BehaviourWaterPlantSapling.java │ │ │ │ ├── BehaviourClimableVine.java │ │ │ │ ├── BehaviourClimable.java │ │ │ │ ├── BehaviourPlantLike.java │ │ │ │ ├── BehaviourLeaves.java │ │ │ │ ├── BehaviourVine.java │ │ │ │ └── BehaviourCompostable.java │ │ ├── client │ │ │ ├── render │ │ │ │ └── BCLRenderLayer.java │ │ │ ├── gui │ │ │ │ ├── screens │ │ │ │ │ └── AtomicProgressListener.java │ │ │ │ └── modmenu │ │ │ │ │ ├── EntryPoint.java │ │ │ │ │ └── MainScreen.java │ │ │ ├── textures │ │ │ │ ├── SpriteLister.java │ │ │ │ └── AtlasSetManager.java │ │ │ ├── sound │ │ │ │ └── BlockSounds.java │ │ │ └── models │ │ │ │ └── CustomModelData.java │ │ ├── util │ │ │ ├── TriFunction.java │ │ │ ├── BackgroundInfo.java │ │ │ ├── RecipeHelper.java │ │ │ ├── BCLDataComponents.java │ │ │ ├── Triple.java │ │ │ ├── CollectionsUtil.java │ │ │ ├── Pair.java │ │ │ └── RomanNumeral.java │ │ ├── items │ │ │ ├── boat │ │ │ │ ├── CustomBoatTypeOverride.java │ │ │ │ └── BaseBoatItem.java │ │ │ ├── BaseAttribute.java │ │ │ ├── BaseDiscItem.java │ │ │ ├── BaseBucketItem.java │ │ │ ├── elytra │ │ │ │ ├── BCLElytraUtils.java │ │ │ │ └── BCLElytraItem.java │ │ │ ├── ModelProviderItem.java │ │ │ ├── tool │ │ │ │ ├── BaseAxeItem.java │ │ │ │ ├── BaseHoeItem.java │ │ │ │ ├── BaseSwordItem.java │ │ │ │ ├── BaseShovelItem.java │ │ │ │ ├── BasePickaxeItem.java │ │ │ │ └── BaseShearsItem.java │ │ │ ├── BaseSpawnEggItem.java │ │ │ └── BaseArmorItem.java │ │ ├── sdf │ │ │ ├── primitive │ │ │ │ ├── SDFFlatland.java │ │ │ │ ├── SDFSphere.java │ │ │ │ ├── SDFCapsule.java │ │ │ │ ├── SDFTorus.java │ │ │ │ ├── SDFHexPrism.java │ │ │ │ ├── SDFPie.java │ │ │ │ ├── SDFPrimitive.java │ │ │ │ ├── SDFLine.java │ │ │ │ └── SDFCappedCone.java │ │ │ └── operator │ │ │ │ ├── SDFInvert.java │ │ │ │ ├── SDFRound.java │ │ │ │ ├── SDFScale.java │ │ │ │ ├── SDFUnion.java │ │ │ │ ├── SDFIntersection.java │ │ │ │ ├── SDFSubtraction.java │ │ │ │ ├── SDFTranslate.java │ │ │ │ ├── SDFScale3D.java │ │ │ │ ├── SDFUnary.java │ │ │ │ ├── SDFCopyRotate.java │ │ │ │ ├── SDFDisplacement.java │ │ │ │ ├── SDFCoordModify.java │ │ │ │ ├── SDFSmoothUnion.java │ │ │ │ ├── SDFSmoothSubtraction.java │ │ │ │ ├── SDFSmoothIntersection.java │ │ │ │ ├── SDFFlatWave.java │ │ │ │ ├── SDFRotation.java │ │ │ │ └── SDFBinary.java │ │ ├── mixin │ │ │ ├── common │ │ │ │ ├── BiomeMixin.java │ │ │ │ ├── ComposterBlockAccessor.java │ │ │ │ ├── ShovelItemAccessor.java │ │ │ │ ├── MobSpawnSettingsAccessor.java │ │ │ │ ├── AnvilBlockMixin.java │ │ │ │ ├── boat │ │ │ │ │ ├── BoatItemMixin.java │ │ │ │ │ └── ChestBoatMixin.java │ │ │ │ ├── axe │ │ │ │ │ └── AxeItemMixin.java │ │ │ │ ├── shears │ │ │ │ │ ├── SheepMixin.java │ │ │ │ │ ├── SnowGolemMixin.java │ │ │ │ │ ├── BeehiveBlockMixin.java │ │ │ │ │ ├── MushroomCowMixin.java │ │ │ │ │ ├── PumpkinBlockMixin.java │ │ │ │ │ └── TripWireBlockMixin.java │ │ │ │ ├── PlacementContextMixin.java │ │ │ │ ├── WorldGenRegionMixin.java │ │ │ │ ├── PistonBaseBlockMixin.java │ │ │ │ ├── CraftingMenuMixin.java │ │ │ │ ├── ChunkGeneratorMixin.java │ │ │ │ ├── EnchantingTableBlockMixin.java │ │ │ │ ├── SurfaceRulesContextAccessor.java │ │ │ │ └── LayerLightSectionStorageMixin.java │ │ │ └── client │ │ │ │ ├── ClientPacketListenerMixin.java │ │ │ │ ├── LevelRendererAccessor.java │ │ │ │ ├── ClientRecipeBookMixin.java │ │ │ │ ├── AtlasSetMixin.java │ │ │ │ ├── BlockMixin.java │ │ │ │ └── ModelManagerMixin.java │ │ ├── api │ │ │ ├── v3 │ │ │ │ ├── datagen │ │ │ │ │ ├── LootDropProvider.java │ │ │ │ │ ├── DatapackRecipeBuilder.java │ │ │ │ │ └── AdvancementDataProvider.java │ │ │ │ ├── bonemeal │ │ │ │ │ ├── EndStoneSpreader.java │ │ │ │ │ ├── NetherrackSpreader.java │ │ │ │ │ ├── BonemealBlockSpreader.java │ │ │ │ │ ├── TaggedBonemealBlockSpreader.java │ │ │ │ │ └── FeatureSpreader.java │ │ │ │ └── tag │ │ │ │ │ └── BCLBlockTags.java │ │ │ └── v2 │ │ │ │ ├── datafixer │ │ │ │ └── PatchDidiFailException.java │ │ │ │ ├── dataexchange │ │ │ │ ├── Connector.java │ │ │ │ └── DataExchangeAPI.java │ │ │ │ ├── levelgen │ │ │ │ └── structures │ │ │ │ │ └── StructurePlacementType.java │ │ │ │ ├── ComposterAPI.java │ │ │ │ ├── ShovelAPI.java │ │ │ │ ├── spawning │ │ │ │ └── SpawnRuleEntry.java │ │ │ │ └── advancement │ │ │ │ └── AdvancementBuilderElements.java │ │ ├── entity │ │ │ ├── BCLEntityWrapper.java │ │ │ └── DespawnableAnimal.java │ │ ├── config │ │ │ ├── EntryConfig.java │ │ │ ├── CategoryConfig.java │ │ │ ├── Configs.java │ │ │ ├── MainConfig.java │ │ │ └── ConfigUI.java │ │ ├── recipes │ │ │ ├── BCLRecipeBuilder.java │ │ │ └── AlloyingRecipeInput.java │ │ ├── blockentities │ │ │ ├── BaseChestBlockEntity.java │ │ │ ├── BaseFurnaceBlockEntity.java │ │ │ └── DynamicBlockEntityType.java │ │ ├── server │ │ │ └── BCLibServer.java │ │ ├── BCLibPatch.java │ │ ├── complexmaterials │ │ │ ├── entry │ │ │ │ ├── MaterialSlot.java │ │ │ │ ├── RecipeEntry.java │ │ │ │ ├── ComplexMaterialEntry.java │ │ │ │ ├── ItemEntry.java │ │ │ │ └── SlotMap.java │ │ │ └── set │ │ │ │ ├── stone │ │ │ │ ├── Source.java │ │ │ │ ├── StoneSlots.java │ │ │ │ └── CrackedBlock.java │ │ │ │ ├── wood │ │ │ │ ├── Slab.java │ │ │ │ └── Stairs.java │ │ │ │ └── common │ │ │ │ ├── AbstractSlab.java │ │ │ │ ├── AbstractWall.java │ │ │ │ └── AbstractStairs.java │ │ ├── commands │ │ │ └── arguments │ │ │ │ ├── TemplatePlacementArgument.java │ │ │ │ └── BCLibArguments.java │ │ ├── furniture │ │ │ └── renderer │ │ │ │ └── RenderChair.java │ │ ├── integration │ │ │ ├── emi │ │ │ │ └── EMIAlloyingRecipe.java │ │ │ └── modmenu │ │ │ │ ├── ModMenu.java │ │ │ │ └── ModMenuEntryPoint.java │ │ └── blocks │ │ │ ├── signs │ │ │ └── BaseWallSignBlock.java │ │ │ ├── SimpleLeavesBlock.java │ │ │ ├── WallMushroomBlock.java │ │ │ └── BaseBlockWithEntity.java │ └── datagen │ │ └── bclib │ │ ├── worldgen │ │ ├── BlockTagProvider.java │ │ └── BoneMealBlockTagProvider.java │ │ ├── advancement │ │ └── BCLAdvancementDataProvider.java │ │ └── BCLibDatagen.java │ └── anti_ad │ └── mc │ └── ipn │ └── api │ └── IPNIgnore.java ├── gradle └── wrapper │ ├── gradle-wrapper.jar │ └── gradle-wrapper.properties ├── bclib-composit.gradle ├── jitpack.yml ├── .gitignore ├── wover-include.gradle ├── LICENSE.ASSETS ├── gradle.properties └── LICENSE /.github/ISSUE_TEMPLATE/config.yml: -------------------------------------------------------------------------------- 1 | blank_issues_enabled: true -------------------------------------------------------------------------------- /bclib_banner.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/quiqueck/BCLib/HEAD/bclib_banner.png -------------------------------------------------------------------------------- /src/main/resources/data/bclib/config/recipes.json: -------------------------------------------------------------------------------- 1 | { 2 | "disable": [ 3 | "bclib:test_star" 4 | ] 5 | } -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/quiqueck/BCLib/HEAD/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /src/main/resources/assets/bclib/patterns/item/pattern_item_spawn_egg.json: -------------------------------------------------------------------------------- 1 | { 2 | "parent": "item/template_spawn_egg" 3 | } 4 | -------------------------------------------------------------------------------- /src/main/generated/data/bclib/tags/block/bonemeal/target/obsidian.json: -------------------------------------------------------------------------------- 1 | { 2 | "values": [ 3 | "minecraft:obsidian" 4 | ] 5 | } -------------------------------------------------------------------------------- /src/main/resources/assets/bclib/icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/quiqueck/BCLib/HEAD/src/main/resources/assets/bclib/icon.png -------------------------------------------------------------------------------- /src/main/resources/assets/bclib/materialmaps/block/alpha_emission.json: -------------------------------------------------------------------------------- 1 | { 2 | "defaultMaterial": "bclib:alpha_emission" 3 | } 4 | -------------------------------------------------------------------------------- /src/main/generated/data/bclib/tags/block/bonemeal/target/end_stone.json: -------------------------------------------------------------------------------- 1 | { 2 | "values": [ 3 | "minecraft:end_stone" 4 | ] 5 | } -------------------------------------------------------------------------------- /src/main/generated/data/bclib/tags/block/bonemeal/target/netherrack.json: -------------------------------------------------------------------------------- 1 | { 2 | "values": [ 3 | "minecraft:netherrack" 4 | ] 5 | } -------------------------------------------------------------------------------- /src/main/resources/assets/bclib/betterx.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/quiqueck/BCLib/HEAD/src/main/resources/assets/bclib/betterx.png -------------------------------------------------------------------------------- /src/main/resources/assets/bclib/header.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/quiqueck/BCLib/HEAD/src/main/resources/assets/bclib/header.png -------------------------------------------------------------------------------- /src/main/resources/assets/bclib/patterns/block/empty.json: -------------------------------------------------------------------------------- 1 | { 2 | "textures": { 3 | "particle": "%modid%:block/%texture%" 4 | } 5 | } 6 | -------------------------------------------------------------------------------- /src/main/resources/assets/bclib/icon_bright.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/quiqueck/BCLib/HEAD/src/main/resources/assets/bclib/icon_bright.png -------------------------------------------------------------------------------- /src/main/resources/assets/bclib/icon_updater.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/quiqueck/BCLib/HEAD/src/main/resources/assets/bclib/icon_updater.png -------------------------------------------------------------------------------- /src/main/resources/assets/bclib/iconpixelated.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/quiqueck/BCLib/HEAD/src/main/resources/assets/bclib/iconpixelated.png -------------------------------------------------------------------------------- /src/main/resources/assets/bclib/models/block/empty_test.json: -------------------------------------------------------------------------------- 1 | { 2 | "textures": { 3 | "particle": "bclib:block/test_planks" 4 | } 5 | } 6 | -------------------------------------------------------------------------------- /bclib-composit.gradle: -------------------------------------------------------------------------------- 1 | plugins { 2 | id 'idea' 3 | id 'eclipse' 4 | id 'fabric-loom' 5 | id 'maven-publish' 6 | } 7 | 8 | apply from: "bclib.gradle" -------------------------------------------------------------------------------- /src/main/resources/assets/bclib/icon_betterend.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/quiqueck/BCLib/HEAD/src/main/resources/assets/bclib/icon_betterend.png -------------------------------------------------------------------------------- /src/main/resources/assets/bclib/icon_betternether.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/quiqueck/BCLib/HEAD/src/main/resources/assets/bclib/icon_betternether.png -------------------------------------------------------------------------------- /src/main/resources/assets/bclib/models/block/empty_hanging_test.json: -------------------------------------------------------------------------------- 1 | { 2 | "textures": { 3 | "particle": "bclib:block/test_planks" 4 | } 5 | } 6 | -------------------------------------------------------------------------------- /src/main/java/org/betterx/bclib/interfaces/Fuel.java: -------------------------------------------------------------------------------- 1 | package org.betterx.bclib.interfaces; 2 | 3 | public interface Fuel { 4 | int getFuelTime(); 5 | } 6 | -------------------------------------------------------------------------------- /src/main/resources/assets/bclib/blockstates/test_sign.json: -------------------------------------------------------------------------------- 1 | { 2 | "variants": { 3 | "": { 4 | "model": "bclib:block/empty_test" 5 | } 6 | } 7 | } -------------------------------------------------------------------------------- /src/main/resources/assets/bclib/textures/gui/widgets.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/quiqueck/BCLib/HEAD/src/main/resources/assets/bclib/textures/gui/widgets.png -------------------------------------------------------------------------------- /src/main/resources/assets/bclib/blockstates/test_wall_sign.json: -------------------------------------------------------------------------------- 1 | { 2 | "variants": { 3 | "": { 4 | "model": "bclib:block/empty_test" 5 | } 6 | } 7 | } -------------------------------------------------------------------------------- /src/main/resources/assets/bclib/patterns/block/block.json: -------------------------------------------------------------------------------- 1 | { 2 | "parent": "block/cube_all", 3 | "textures": { 4 | "all": "%modid%:block/%texture%" 5 | } 6 | } -------------------------------------------------------------------------------- /src/main/resources/assets/bclib/textures/item/test_sign.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/quiqueck/BCLib/HEAD/src/main/resources/assets/bclib/textures/item/test_sign.png -------------------------------------------------------------------------------- /src/main/java/org/betterx/bclib/interfaces/tools/PreventMineableAdd.java: -------------------------------------------------------------------------------- 1 | package org.betterx.bclib.interfaces.tools; 2 | 3 | public interface PreventMineableAdd { 4 | } 5 | -------------------------------------------------------------------------------- /src/main/resources/assets/bclib/models/item/test_sign.json: -------------------------------------------------------------------------------- 1 | { 2 | "parent": "item/generated", 3 | "textures": { 4 | "layer0": "bclib:item/test_sign" 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /src/main/resources/assets/bclib/patterns/block/button.json: -------------------------------------------------------------------------------- 1 | { 2 | "parent": "block/button", 3 | "textures": { 4 | "texture": "%modid%:block/%texture%" 5 | } 6 | } -------------------------------------------------------------------------------- /src/main/resources/assets/bclib/patterns/block/cross.json: -------------------------------------------------------------------------------- 1 | { 2 | "parent": "block/cross", 3 | "textures": { 4 | "cross": "%modid%:block/%texture%" 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /src/main/generated/data/bclib/tags/block/bonemeal/source/netherrack.json: -------------------------------------------------------------------------------- 1 | { 2 | "values": [ 3 | "minecraft:crimson_nylium", 4 | "minecraft:warped_nylium" 5 | ] 6 | } -------------------------------------------------------------------------------- /src/main/java/org/betterx/bclib/behaviours/interfaces/BlockBehaviour.java: -------------------------------------------------------------------------------- 1 | package org.betterx.bclib.behaviours.interfaces; 2 | 3 | public interface BlockBehaviour { 4 | } 5 | -------------------------------------------------------------------------------- /src/main/java/org/betterx/bclib/interfaces/PostInitable.java: -------------------------------------------------------------------------------- 1 | package org.betterx.bclib.interfaces; 2 | 3 | public interface PostInitable { 4 | void postInit(); 5 | } 6 | -------------------------------------------------------------------------------- /src/main/java/org/betterx/bclib/interfaces/UnknownReceipBookCategory.java: -------------------------------------------------------------------------------- 1 | package org.betterx.bclib.interfaces; 2 | 3 | public interface UnknownReceipBookCategory { 4 | } 5 | -------------------------------------------------------------------------------- /src/main/resources/assets/bclib/blockstates/test_hanging_sign.json: -------------------------------------------------------------------------------- 1 | { 2 | "variants": { 3 | "": { 4 | "model": "bclib:block/empty_hanging_test" 5 | } 6 | } 7 | } -------------------------------------------------------------------------------- /src/main/resources/assets/bclib/textures/block/test_planks.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/quiqueck/BCLib/HEAD/src/main/resources/assets/bclib/textures/block/test_planks.png -------------------------------------------------------------------------------- /src/main/java/org/betterx/bclib/client/render/BCLRenderLayer.java: -------------------------------------------------------------------------------- 1 | package org.betterx.bclib.client.render; 2 | 3 | public enum BCLRenderLayer { 4 | CUTOUT, TRANSLUCENT 5 | } 6 | -------------------------------------------------------------------------------- /src/main/resources/assets/bclib/blockstates/test_wall_hanging_sign.json: -------------------------------------------------------------------------------- 1 | { 2 | "variants": { 3 | "": { 4 | "model": "bclib:block/empty_hanging_test" 5 | } 6 | } 7 | } -------------------------------------------------------------------------------- /src/main/resources/assets/bclib/patterns/block/fence_post.json: -------------------------------------------------------------------------------- 1 | { 2 | "parent": "block/fence_post", 3 | "textures": { 4 | "texture": "%modid%:block/%texture%" 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /src/main/resources/assets/bclib/patterns/block/fence_side.json: -------------------------------------------------------------------------------- 1 | { 2 | "parent": "block/fence_side", 3 | "textures": { 4 | "texture": "%modid%:block/%texture%" 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /src/main/resources/assets/bclib/patterns/block/ladder.json: -------------------------------------------------------------------------------- 1 | { 2 | "parent": "bclib:block/ladder", 3 | "textures": { 4 | "texture": "%modid%:block/%texture%" 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /src/main/resources/assets/bclib/patterns/block/wall_inventory.json: -------------------------------------------------------------------------------- 1 | { 2 | "parent": "block/wall_inventory", 3 | "textures": { 4 | "wall": "%modid%:block/%texture%" 5 | } 6 | } -------------------------------------------------------------------------------- /src/main/resources/assets/bclib/patterns/block/wall_post.json: -------------------------------------------------------------------------------- 1 | { 2 | "parent": "block/template_wall_post", 3 | "textures": { 4 | "wall": "%modid%:block/%texture%" 5 | } 6 | } -------------------------------------------------------------------------------- /src/main/resources/assets/bclib/patterns/block/wall_side.json: -------------------------------------------------------------------------------- 1 | { 2 | "parent": "block/template_wall_side", 3 | "textures": { 4 | "wall": "%modid%:block/%texture%" 5 | } 6 | } -------------------------------------------------------------------------------- /src/main/resources/assets/bclib/patterns/item/pattern_wall.json: -------------------------------------------------------------------------------- 1 | { 2 | "parent": "block/wall_inventory", 3 | "textures": { 4 | "wall": "%modid%:block/%texture%" 5 | } 6 | } -------------------------------------------------------------------------------- /src/main/resources/assets/bclib/patterns/block/block_colored.json: -------------------------------------------------------------------------------- 1 | { 2 | "parent": "bclib:block/tint_cube", 3 | "textures": { 4 | "texture": "%modid%:block/%texture%" 5 | } 6 | } -------------------------------------------------------------------------------- /src/main/resources/assets/bclib/patterns/block/button_pressed.json: -------------------------------------------------------------------------------- 1 | { 2 | "parent": "block/button_pressed", 3 | "textures": { 4 | "texture": "%modid%:block/%texture%" 5 | } 6 | } -------------------------------------------------------------------------------- /src/main/resources/assets/bclib/patterns/item/pattern_block_item.json: -------------------------------------------------------------------------------- 1 | { 2 | "parent": "item/generated", 3 | "textures": { 4 | "layer0": "%modid%:block/%texture%" 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /src/main/resources/assets/bclib/patterns/item/pattern_button.json: -------------------------------------------------------------------------------- 1 | { 2 | "parent": "block/button_inventory", 3 | "textures": { 4 | "texture": "%modid%:block/%texture%" 5 | } 6 | } -------------------------------------------------------------------------------- /src/main/resources/assets/bclib/patterns/item/pattern_item_handheld.json: -------------------------------------------------------------------------------- 1 | { 2 | "parent": "item/handheld", 3 | "textures": { 4 | "layer0": "%modid%:item/%texture%" 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /src/main/resources/assets/bclib/textures/entity/signs/test_wood.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/quiqueck/BCLib/HEAD/src/main/resources/assets/bclib/textures/entity/signs/test_wood.png -------------------------------------------------------------------------------- /src/main/resources/assets/bclib/textures/item/test_hanging_sign.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/quiqueck/BCLib/HEAD/src/main/resources/assets/bclib/textures/item/test_hanging_sign.png -------------------------------------------------------------------------------- /src/main/java/org/betterx/bclib/interfaces/tools/AddMineableAxe.java: -------------------------------------------------------------------------------- 1 | package org.betterx.bclib.interfaces.tools; 2 | 3 | public interface AddMineableAxe extends HasMinableBehaviour { 4 | } 5 | -------------------------------------------------------------------------------- /src/main/java/org/betterx/bclib/interfaces/tools/AddMineableHoe.java: -------------------------------------------------------------------------------- 1 | package org.betterx.bclib.interfaces.tools; 2 | 3 | public interface AddMineableHoe extends HasMinableBehaviour { 4 | } 5 | -------------------------------------------------------------------------------- /src/main/resources/assets/bclib/models/item/test_hanging_sign.json: -------------------------------------------------------------------------------- 1 | { 2 | "parent": "item/generated", 3 | "textures": { 4 | "layer0": "bclib:item/test_hanging_sign" 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /src/main/resources/assets/bclib/patterns/block/pressure_plate_up.json: -------------------------------------------------------------------------------- 1 | { 2 | "parent": "block/pressure_plate_up", 3 | "textures": { 4 | "texture": "%modid%:block/%texture%" 5 | } 6 | } -------------------------------------------------------------------------------- /src/main/resources/assets/bclib/patterns/block/wall_side_tall.json: -------------------------------------------------------------------------------- 1 | { 2 | "parent": "block/template_wall_side_tall", 3 | "textures": { 4 | "wall": "%modid%:block/%texture%" 5 | } 6 | } -------------------------------------------------------------------------------- /src/main/resources/assets/bclib/patterns/item/pattern_fence.json: -------------------------------------------------------------------------------- 1 | { 2 | "parent": "block/fence_inventory", 3 | "textures": { 4 | "texture": "%modid%:block/%texture%" 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /src/main/resources/assets/bclib/patterns/item/pattern_item_generated.json: -------------------------------------------------------------------------------- 1 | { 2 | "parent": "item/generated", 3 | "textures": { 4 | "layer0": "%modid%:item/%texture%" 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /src/main/java/org/betterx/bclib/interfaces/tools/AddMineableSword.java: -------------------------------------------------------------------------------- 1 | package org.betterx.bclib.interfaces.tools; 2 | 3 | public interface AddMineableSword extends HasMinableBehaviour { 4 | } 5 | -------------------------------------------------------------------------------- /src/main/resources/assets/bclib/patterns/block/pressure_plate_down.json: -------------------------------------------------------------------------------- 1 | { 2 | "parent": "block/pressure_plate_down", 3 | "textures": { 4 | "texture": "%modid%:block/%texture%" 5 | } 6 | } -------------------------------------------------------------------------------- /src/main/resources/assets/bclib/patterns/item/pattern_chest.json: -------------------------------------------------------------------------------- 1 | { 2 | "parent": "bclib:block/chest_item", 3 | "textures": { 4 | "texture": "%modid%:entity/chest/%texture%" 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /src/main/java/org/betterx/bclib/interfaces/tools/AddMineableHammer.java: -------------------------------------------------------------------------------- 1 | package org.betterx.bclib.interfaces.tools; 2 | 3 | public interface AddMineableHammer extends HasMinableBehaviour { 4 | } 5 | -------------------------------------------------------------------------------- /src/main/java/org/betterx/bclib/interfaces/tools/AddMineablePickaxe.java: -------------------------------------------------------------------------------- 1 | package org.betterx.bclib.interfaces.tools; 2 | 3 | public interface AddMineablePickaxe extends HasMinableBehaviour { 4 | } 5 | -------------------------------------------------------------------------------- /src/main/java/org/betterx/bclib/interfaces/tools/AddMineableShears.java: -------------------------------------------------------------------------------- 1 | package org.betterx.bclib.interfaces.tools; 2 | 3 | public interface AddMineableShears extends HasMinableBehaviour { 4 | } 5 | -------------------------------------------------------------------------------- /src/main/java/org/betterx/bclib/interfaces/tools/AddMineableShovel.java: -------------------------------------------------------------------------------- 1 | package org.betterx.bclib.interfaces.tools; 2 | 3 | public interface AddMineableShovel extends HasMinableBehaviour { 4 | } 5 | -------------------------------------------------------------------------------- /src/main/resources/assets/bclib/patterns/block/fence_gate_closed.json: -------------------------------------------------------------------------------- 1 | { 2 | "parent": "block/template_fence_gate", 3 | "textures": { 4 | "texture": "%modid%:block/%texture%" 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /src/main/resources/assets/bclib/patterns/block/fence_gate_open.json: -------------------------------------------------------------------------------- 1 | { 2 | "parent": "block/template_fence_gate_open", 3 | "textures": { 4 | "texture": "%modid%:block/%texture%" 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /src/main/resources/assets/bclib/patterns/block/wall_gate_closed.json: -------------------------------------------------------------------------------- 1 | { 2 | "parent": "block/template_fence_gate_wall", 3 | "textures": { 4 | "texture": "%modid%:block/%texture%" 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /src/main/resources/assets/bclib/textures/entity/signs/hanging/test_wood.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/quiqueck/BCLib/HEAD/src/main/resources/assets/bclib/textures/entity/signs/hanging/test_wood.png -------------------------------------------------------------------------------- /src/main/java/org/betterx/bclib/behaviours/interfaces/BehaviourImmobile.java: -------------------------------------------------------------------------------- 1 | package org.betterx.bclib.behaviours.interfaces; 2 | 3 | public interface BehaviourImmobile extends BlockBehaviour { 4 | } 5 | -------------------------------------------------------------------------------- /src/main/java/org/betterx/bclib/behaviours/interfaces/BehaviourSeedLike.java: -------------------------------------------------------------------------------- 1 | package org.betterx.bclib.behaviours.interfaces; 2 | 3 | public interface BehaviourSeedLike extends BlockBehaviour { 4 | } 5 | -------------------------------------------------------------------------------- /src/main/java/org/betterx/bclib/util/TriFunction.java: -------------------------------------------------------------------------------- 1 | package org.betterx.bclib.util; 2 | 3 | @FunctionalInterface 4 | public interface TriFunction { 5 | R apply(A a, B b, C c); 6 | } 7 | -------------------------------------------------------------------------------- /src/main/resources/assets/bclib/patterns/block/wall_gate_open.json: -------------------------------------------------------------------------------- 1 | { 2 | "parent": "block/template_fence_gate_wall_open", 3 | "textures": { 4 | "texture": "%modid%:block/%texture%" 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /src/main/java/org/betterx/bclib/behaviours/interfaces/BehaviourPortalFrame.java: -------------------------------------------------------------------------------- 1 | package org.betterx.bclib.behaviours.interfaces; 2 | 3 | public interface BehaviourPortalFrame extends BlockBehaviour { 4 | } 5 | -------------------------------------------------------------------------------- /src/main/java/org/betterx/bclib/behaviours/interfaces/BehaviourSaplingLike.java: -------------------------------------------------------------------------------- 1 | package org.betterx.bclib.behaviours.interfaces; 2 | 3 | public interface BehaviourSaplingLike extends BlockBehaviour { 4 | } 5 | -------------------------------------------------------------------------------- /src/main/resources/assets/bclib/patterns/block/chain.json: -------------------------------------------------------------------------------- 1 | { 2 | "parent": "block/chain", 3 | "textures": { 4 | "particle": "%modid%:block/%texture%", 5 | "all": "%modid%:block/%texture%" 6 | } 7 | } -------------------------------------------------------------------------------- /src/main/java/org/betterx/bclib/interfaces/TriConsumer.java: -------------------------------------------------------------------------------- 1 | package org.betterx.bclib.interfaces; 2 | 3 | @FunctionalInterface 4 | public interface TriConsumer { 5 | void accept(A a, B b, C c); 6 | } 7 | -------------------------------------------------------------------------------- /src/main/java/org/betterx/bclib/behaviours/interfaces/BehaviourWaterPlantLike.java: -------------------------------------------------------------------------------- 1 | package org.betterx.bclib.behaviours.interfaces; 2 | 3 | public interface BehaviourWaterPlantLike extends BehaviourPlantLike { 4 | } 5 | -------------------------------------------------------------------------------- /src/main/resources/assets/bclib/patterns/block/pillar.json: -------------------------------------------------------------------------------- 1 | { 2 | "parent": "block/cube_column", 3 | "textures": { 4 | "end": "%modid%:block/%texture%_top", 5 | "side": "%modid%:block/%texture%_side" 6 | } 7 | } -------------------------------------------------------------------------------- /src/main/java/org/betterx/bclib/behaviours/interfaces/BehaviourExplosionResistant.java: -------------------------------------------------------------------------------- 1 | package org.betterx.bclib.behaviours.interfaces; 2 | 3 | public interface BehaviourExplosionResistant extends BlockBehaviour { 4 | } 5 | -------------------------------------------------------------------------------- /src/main/resources/assets/bclib/patterns/block/top_side_bottom.json: -------------------------------------------------------------------------------- 1 | { 2 | "parent": "block/cube_bottom_top", 3 | "textures": { 4 | "bottom": "%bottom%", 5 | "side": "%side%", 6 | "top": "%top%" 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /src/main/resources/assets/bclib/patterns/block/trapdoor.json: -------------------------------------------------------------------------------- 1 | { 2 | "parent": "bclib:block/sided_trapdoor", 3 | "textures": { 4 | "texture": "%modid%:block/%texture%", 5 | "side": "%modid%:block/%side%" 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /src/main/resources/assets/bclib/patterns/block/bookshelf.json: -------------------------------------------------------------------------------- 1 | { 2 | "parent": "block/cube_column", 3 | "textures": { 4 | "end": "%modid%:block/%texture%_planks", 5 | "side": "%modid%:block/%texture%_bookshelf" 6 | } 7 | } -------------------------------------------------------------------------------- /src/main/resources/assets/bclib/patterns/block/door_top.json: -------------------------------------------------------------------------------- 1 | { 2 | "parent": "bclib:block/sided_door_top", 3 | "textures": { 4 | "facade": "%modid%:block/%texture%_top", 5 | "side": "%modid%:block/%texture%_side" 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /src/main/resources/assets/bclib/patterns/block/path.json: -------------------------------------------------------------------------------- 1 | { 2 | "parent": "bclib:block/path", 3 | "textures": { 4 | "top": "%modid%:block/%top%", 5 | "side": "%modid%:block/%side%", 6 | "bottom": "%bottom%" 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /jitpack.yml: -------------------------------------------------------------------------------- 1 | # From https://github.com/jitpack/jitpack.io/issues/4506#issuecomment-864562270 2 | before_install: 3 | - source "$HOME/.sdkman/bin/sdkman-init.sh" 4 | - sdk update 5 | - sdk install java 17.0.1-tem 6 | - sdk use java 17.0.1-tem -------------------------------------------------------------------------------- /src/main/resources/assets/bclib/patterns/block/door_bottom.json: -------------------------------------------------------------------------------- 1 | { 2 | "parent": "bclib:block/sided_door_bottom", 3 | "textures": { 4 | "facade": "%modid%:block/%texture%_bottom", 5 | "side": "%modid%:block/%texture%_side" 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /src/main/resources/assets/bclib/patterns/block/door_top_hinge.json: -------------------------------------------------------------------------------- 1 | { 2 | "parent": "bclib:block/sided_door_top_rh", 3 | "textures": { 4 | "facade": "%modid%:block/%texture%_top", 5 | "side": "%modid%:block/%texture%_side" 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /src/main/resources/assets/bclib/patterns/block/slab.json: -------------------------------------------------------------------------------- 1 | { 2 | "parent": "block/slab", 3 | "textures": { 4 | "bottom": "%modid%:block/%texture%", 5 | "side": "%modid%:block/%texture%", 6 | "top": "%modid%:block/%texture%" 7 | } 8 | } -------------------------------------------------------------------------------- /src/main/resources/assets/bclib/patterns/block/vanilla_wood_bookshelf.json: -------------------------------------------------------------------------------- 1 | { 2 | "parent": "block/cube_column", 3 | "textures": { 4 | "end": "minecraft:block/%texture%_planks", 5 | "side": "%modid%:block/%texture%_bookshelf" 6 | } 7 | } -------------------------------------------------------------------------------- /src/main/java/org/betterx/bclib/behaviours/interfaces/BehaviourObsidianPortalFrame.java: -------------------------------------------------------------------------------- 1 | package org.betterx.bclib.behaviours.interfaces; 2 | 3 | public interface BehaviourObsidianPortalFrame extends BehaviourObsidian, BehaviourPortalFrame { 4 | 5 | } 6 | -------------------------------------------------------------------------------- /src/main/java/org/betterx/bclib/interfaces/tools/HasMinableBehaviour.java: -------------------------------------------------------------------------------- 1 | package org.betterx.bclib.interfaces.tools; 2 | 3 | 4 | import org.jetbrains.annotations.ApiStatus; 5 | 6 | @ApiStatus.Internal 7 | public interface HasMinableBehaviour { 8 | } 9 | -------------------------------------------------------------------------------- /src/main/resources/assets/bclib/materials/alpha_emission.json: -------------------------------------------------------------------------------- 1 | { 2 | "layers": [ 3 | { 4 | "vertexSource": "canvas:shaders/material/default.vert", 5 | "fragmentSource": "bclib:shaders/material/alpha_emission.frag" 6 | } 7 | ] 8 | } 9 | -------------------------------------------------------------------------------- /src/main/resources/assets/bclib/patterns/block/stairs.json: -------------------------------------------------------------------------------- 1 | { 2 | "parent": "block/stairs", 3 | "textures": { 4 | "bottom": "%modid%:block/%texture%", 5 | "side": "%modid%:block/%texture%", 6 | "top": "%modid%:block/%texture%" 7 | } 8 | } -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | distributionBase=GRADLE_USER_HOME 2 | distributionPath=wrapper/dists 3 | distributionUrl=https\://services.gradle.org/distributions/gradle-8.8-bin.zip 4 | zipStoreBase=GRADLE_USER_HOME 5 | zipStorePath=wrapper/dists 6 | -------------------------------------------------------------------------------- /src/main/resources/assets/bclib/patterns/block/door_bottom_hinge.json: -------------------------------------------------------------------------------- 1 | { 2 | "parent": "bclib:block/sided_door_bottom_rh", 3 | "textures": { 4 | "facade": "%modid%:block/%texture%_bottom", 5 | "side": "%modid%:block/%texture%_side" 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /src/main/java/org/betterx/bclib/interfaces/RenderLayerProvider.java: -------------------------------------------------------------------------------- 1 | package org.betterx.bclib.interfaces; 2 | 3 | import org.betterx.bclib.client.render.BCLRenderLayer; 4 | 5 | public interface RenderLayerProvider { 6 | BCLRenderLayer getRenderLayer(); 7 | } 8 | -------------------------------------------------------------------------------- /src/main/resources/assets/bclib/patterns/block/stairs_inner.json: -------------------------------------------------------------------------------- 1 | { 2 | "parent": "block/inner_stairs", 3 | "textures": { 4 | "bottom": "%modid%:block/%texture%", 5 | "side": "%modid%:block/%texture%", 6 | "top": "%modid%:block/%texture%" 7 | } 8 | } -------------------------------------------------------------------------------- /src/main/resources/assets/bclib/patterns/block/stairs_outer.json: -------------------------------------------------------------------------------- 1 | { 2 | "parent": "block/outer_stairs", 3 | "textures": { 4 | "bottom": "%modid%:block/%texture%", 5 | "side": "%modid%:block/%texture%", 6 | "top": "%modid%:block/%texture%" 7 | } 8 | } -------------------------------------------------------------------------------- /src/main/java/org/betterx/bclib/items/boat/CustomBoatTypeOverride.java: -------------------------------------------------------------------------------- 1 | package org.betterx.bclib.items.boat; 2 | 3 | public interface CustomBoatTypeOverride { 4 | void bcl_setCustomType(BoatTypeOverride type); 5 | BoatTypeOverride bcl_getCustomType(); 6 | } 7 | -------------------------------------------------------------------------------- /src/main/java/org/betterx/bclib/interfaces/tools/AxeCanStrip.java: -------------------------------------------------------------------------------- 1 | package org.betterx.bclib.interfaces.tools; 2 | 3 | import net.minecraft.world.level.block.state.BlockState; 4 | 5 | public interface AxeCanStrip { 6 | BlockState strippedState(BlockState state); 7 | } 8 | -------------------------------------------------------------------------------- /src/main/resources/ui.mixins.client.json: -------------------------------------------------------------------------------- 1 | { 2 | "required": true, 3 | "minVersion": "0.8", 4 | "package": "org.betterx.ui.mixin.client", 5 | "compatibilityLevel": "JAVA_21", 6 | "client": [], 7 | "injectors": { 8 | "defaultRequire": 1 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /src/main/java/org/betterx/bclib/behaviours/interfaces/BehaviourWood.java: -------------------------------------------------------------------------------- 1 | package org.betterx.bclib.behaviours.interfaces; 2 | 3 | import org.betterx.bclib.interfaces.tools.AddMineableAxe; 4 | 5 | public interface BehaviourWood extends AddMineableAxe, BlockBehaviour { 6 | } 7 | -------------------------------------------------------------------------------- /src/main/java/org/betterx/bclib/sdf/primitive/SDFFlatland.java: -------------------------------------------------------------------------------- 1 | package org.betterx.bclib.sdf.primitive; 2 | 3 | public class SDFFlatland extends SDFPrimitive { 4 | @Override 5 | public float getDistance(float x, float y, float z) { 6 | return y; 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /src/main/java/org/betterx/bclib/behaviours/interfaces/BehaviourIce.java: -------------------------------------------------------------------------------- 1 | package org.betterx.bclib.behaviours.interfaces; 2 | 3 | import org.betterx.bclib.interfaces.tools.AddMineablePickaxe; 4 | 5 | public interface BehaviourIce extends AddMineablePickaxe, BlockBehaviour { 6 | } 7 | -------------------------------------------------------------------------------- /src/main/java/org/betterx/bclib/behaviours/interfaces/BehaviourOre.java: -------------------------------------------------------------------------------- 1 | package org.betterx.bclib.behaviours.interfaces; 2 | 3 | import org.betterx.bclib.interfaces.tools.AddMineablePickaxe; 4 | 5 | public interface BehaviourOre extends AddMineablePickaxe, BlockBehaviour { 6 | } 7 | -------------------------------------------------------------------------------- /src/main/java/org/betterx/bclib/behaviours/interfaces/BehaviourSand.java: -------------------------------------------------------------------------------- 1 | package org.betterx.bclib.behaviours.interfaces; 2 | 3 | import org.betterx.bclib.interfaces.tools.AddMineableShovel; 4 | 5 | public interface BehaviourSand extends AddMineableShovel, BlockBehaviour { 6 | } 7 | -------------------------------------------------------------------------------- /src/main/java/org/betterx/bclib/behaviours/interfaces/BehaviourSnow.java: -------------------------------------------------------------------------------- 1 | package org.betterx.bclib.behaviours.interfaces; 2 | 3 | import org.betterx.bclib.interfaces.tools.AddMineableShovel; 4 | 5 | public interface BehaviourSnow extends AddMineableShovel, BlockBehaviour { 6 | } 7 | -------------------------------------------------------------------------------- /src/main/java/org/betterx/bclib/mixin/common/BiomeMixin.java: -------------------------------------------------------------------------------- 1 | package org.betterx.bclib.mixin.common; 2 | 3 | import net.minecraft.world.level.biome.Biome; 4 | 5 | import org.spongepowered.asm.mixin.Mixin; 6 | 7 | @Mixin(Biome.class) 8 | public class BiomeMixin { 9 | } 10 | -------------------------------------------------------------------------------- /src/main/java/org/betterx/bclib/api/v3/datagen/LootDropProvider.java: -------------------------------------------------------------------------------- 1 | package org.betterx.bclib.api.v3.datagen; 2 | 3 | import net.minecraft.world.level.storage.loot.LootTable; 4 | 5 | public interface LootDropProvider { 6 | void getDroppedItemsBCL(LootTable.Builder builder); 7 | } 8 | -------------------------------------------------------------------------------- /src/main/java/org/betterx/bclib/behaviours/interfaces/BehaviourGlass.java: -------------------------------------------------------------------------------- 1 | package org.betterx.bclib.behaviours.interfaces; 2 | 3 | import org.betterx.bclib.interfaces.tools.AddMineablePickaxe; 4 | 5 | public interface BehaviourGlass extends AddMineablePickaxe, BlockBehaviour { 6 | } 7 | -------------------------------------------------------------------------------- /src/main/java/org/betterx/bclib/behaviours/interfaces/BehaviourMetal.java: -------------------------------------------------------------------------------- 1 | package org.betterx.bclib.behaviours.interfaces; 2 | 3 | import org.betterx.bclib.interfaces.tools.AddMineablePickaxe; 4 | 5 | public interface BehaviourMetal extends AddMineablePickaxe, BlockBehaviour { 6 | } 7 | -------------------------------------------------------------------------------- /src/main/java/org/betterx/bclib/behaviours/interfaces/BehaviourStone.java: -------------------------------------------------------------------------------- 1 | package org.betterx.bclib.behaviours.interfaces; 2 | 3 | import org.betterx.bclib.interfaces.tools.AddMineablePickaxe; 4 | 5 | public interface BehaviourStone extends AddMineablePickaxe, BlockBehaviour { 6 | } 7 | -------------------------------------------------------------------------------- /src/main/java/org/betterx/bclib/behaviours/interfaces/BehaviourObsidian.java: -------------------------------------------------------------------------------- 1 | package org.betterx.bclib.behaviours.interfaces; 2 | 3 | import org.betterx.bclib.interfaces.tools.AddMineablePickaxe; 4 | 5 | public interface BehaviourObsidian extends AddMineablePickaxe, BehaviourImmobile { 6 | } 7 | -------------------------------------------------------------------------------- /src/main/resources/assets/bclib/patterns/block/barrel_open.json: -------------------------------------------------------------------------------- 1 | { 2 | "parent": "block/cube_bottom_top", 3 | "textures": { 4 | "bottom": "%modid%:block/%texture%_bottom", 5 | "side": "%modid%:block/%texture%_side", 6 | "top": "%modid%:block/%texture%_top_open" 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /src/main/resources/assets/bclib/patterns/block/block_bottom_top.json: -------------------------------------------------------------------------------- 1 | { 2 | "parent": "block/cube_bottom_top", 3 | "textures": { 4 | "bottom": "%modid%:block/%texture%_bottom", 5 | "side": "%modid%:block/%texture%_side", 6 | "top": "%modid%:block/%texture%_top" 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /src/main/java/org/betterx/bclib/entity/BCLEntityWrapper.java: -------------------------------------------------------------------------------- 1 | package org.betterx.bclib.entity; 2 | 3 | import net.minecraft.world.entity.Entity; 4 | import net.minecraft.world.entity.EntityType; 5 | 6 | public record BCLEntityWrapper(EntityType type, boolean canSpawn) { 7 | } 8 | -------------------------------------------------------------------------------- /src/main/java/org/betterx/bclib/behaviours/interfaces/BehaviourPlant.java: -------------------------------------------------------------------------------- 1 | package org.betterx.bclib.behaviours.interfaces; 2 | 3 | import org.betterx.bclib.interfaces.tools.AddMineableHoe; 4 | 5 | public interface BehaviourPlant extends AddMineableHoe, BehaviourCompostable, BehaviourPlantLike { 6 | } 7 | -------------------------------------------------------------------------------- /src/main/java/org/betterx/bclib/sdf/operator/SDFInvert.java: -------------------------------------------------------------------------------- 1 | package org.betterx.bclib.sdf.operator; 2 | 3 | public class SDFInvert extends SDFUnary { 4 | @Override 5 | public float getDistance(float x, float y, float z) { 6 | return -this.source.getDistance(x, y, z); 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /src/main/resources/assets/bclib/patterns/block/furnace.json: -------------------------------------------------------------------------------- 1 | { 2 | "parent": "block/orientable_with_bottom", 3 | "textures": { 4 | "top": "%modid%:block/%top%", 5 | "front": "%modid%:block/%front%", 6 | "side": "%modid%:block/%side%", 7 | "bottom": "%modid%:block/%top%" 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /src/main/java/org/betterx/bclib/behaviours/interfaces/BehaviourWaterPlant.java: -------------------------------------------------------------------------------- 1 | package org.betterx.bclib.behaviours.interfaces; 2 | 3 | import org.betterx.bclib.interfaces.tools.AddMineableHoe; 4 | 5 | public interface BehaviourWaterPlant extends AddMineableHoe, BehaviourWaterPlantLike, BehaviourCompostable { 6 | } 7 | -------------------------------------------------------------------------------- /src/main/java/org/betterx/bclib/behaviours/interfaces/BehaviourSeed.java: -------------------------------------------------------------------------------- 1 | package org.betterx.bclib.behaviours.interfaces; 2 | 3 | import org.betterx.bclib.interfaces.tools.AddMineableHoe; 4 | 5 | public interface BehaviourSeed extends AddMineableHoe, BehaviourCompostable, BehaviourPlantLike, BehaviourSeedLike { 6 | } 7 | -------------------------------------------------------------------------------- /src/main/java/org/betterx/bclib/behaviours/interfaces/BehaviourSapling.java: -------------------------------------------------------------------------------- 1 | package org.betterx.bclib.behaviours.interfaces; 2 | 3 | import org.betterx.bclib.interfaces.tools.AddMineableHoe; 4 | 5 | public interface BehaviourSapling extends AddMineableHoe, BehaviourCompostable, BehaviourPlantLike, BehaviourSaplingLike { 6 | } 7 | -------------------------------------------------------------------------------- /src/main/java/org/betterx/bclib/behaviours/interfaces/BehaviourShearablePlant.java: -------------------------------------------------------------------------------- 1 | package org.betterx.bclib.behaviours.interfaces; 2 | 3 | import org.betterx.bclib.interfaces.tools.AddMineableShears; 4 | 5 | public interface BehaviourShearablePlant extends AddMineableShears, BehaviourPlantLike, BehaviourCompostable { 6 | } 7 | -------------------------------------------------------------------------------- /src/main/java/org/betterx/bclib/config/EntryConfig.java: -------------------------------------------------------------------------------- 1 | package org.betterx.bclib.config; 2 | 3 | public class EntryConfig extends IdConfig { 4 | public EntryConfig(String modID, String group) { 5 | super(modID, group, (id, entry) -> { 6 | return new ConfigKey(entry, id); 7 | }); 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /src/main/java/org/betterx/bclib/interfaces/SurvivesOn.java: -------------------------------------------------------------------------------- 1 | package org.betterx.bclib.interfaces; 2 | 3 | import net.minecraft.world.level.block.state.BlockState; 4 | 5 | import org.jetbrains.annotations.ApiStatus; 6 | 7 | @ApiStatus.Internal 8 | public interface SurvivesOn { 9 | boolean isSurvivable(BlockState state); 10 | } 11 | -------------------------------------------------------------------------------- /src/main/java/org/betterx/bclib/items/BaseAttribute.java: -------------------------------------------------------------------------------- 1 | package org.betterx.bclib.items; 2 | 3 | import net.minecraft.world.entity.ai.attributes.Attribute; 4 | 5 | public class BaseAttribute extends Attribute { 6 | public BaseAttribute(String description, double value) { 7 | super(description, value); 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /src/main/java/org/betterx/bclib/behaviours/interfaces/BehaviourWaterPlantSeed.java: -------------------------------------------------------------------------------- 1 | package org.betterx.bclib.behaviours.interfaces; 2 | 3 | import org.betterx.bclib.interfaces.tools.AddMineableHoe; 4 | 5 | public interface BehaviourWaterPlantSeed extends AddMineableHoe, BehaviourCompostable, BehaviourWaterPlantLike, BehaviourSeedLike { 6 | } 7 | -------------------------------------------------------------------------------- /src/main/java/org/betterx/bclib/behaviours/interfaces/BehaviourWaterPlantSapling.java: -------------------------------------------------------------------------------- 1 | package org.betterx.bclib.behaviours.interfaces; 2 | 3 | import org.betterx.bclib.interfaces.tools.AddMineableHoe; 4 | 5 | public interface BehaviourWaterPlantSapling extends AddMineableHoe, BehaviourCompostable, BehaviourWaterPlantLike, BehaviourSaplingLike { 6 | } 7 | -------------------------------------------------------------------------------- /src/main/java/org/betterx/bclib/util/BackgroundInfo.java: -------------------------------------------------------------------------------- 1 | package org.betterx.bclib.util; 2 | 3 | public class BackgroundInfo { 4 | public static float fogColorRed; 5 | public static float fogColorGreen; 6 | public static float fogColorBlue; 7 | public static float fogDensity = 1; 8 | public static float blindness; 9 | } 10 | -------------------------------------------------------------------------------- /src/main/java/org/betterx/bclib/interfaces/CustomColorProvider.java: -------------------------------------------------------------------------------- 1 | package org.betterx.bclib.interfaces; 2 | 3 | import net.minecraft.client.color.block.BlockColor; 4 | import net.minecraft.client.color.item.ItemColor; 5 | 6 | public interface CustomColorProvider { 7 | BlockColor getProvider(); 8 | 9 | ItemColor getItemProvider(); 10 | } 11 | -------------------------------------------------------------------------------- /src/main/java/org/betterx/bclib/api/v2/datafixer/PatchDidiFailException.java: -------------------------------------------------------------------------------- 1 | package org.betterx.bclib.api.v2.datafixer; 2 | 3 | public class PatchDidiFailException extends Exception { 4 | public PatchDidiFailException() { 5 | super(); 6 | } 7 | 8 | public PatchDidiFailException(Exception e) { 9 | super(e); 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /src/main/java/org/betterx/bclib/client/gui/screens/AtomicProgressListener.java: -------------------------------------------------------------------------------- 1 | package org.betterx.bclib.client.gui.screens; 2 | 3 | import net.minecraft.network.chat.Component; 4 | 5 | public interface AtomicProgressListener { 6 | void incAtomic(int maxProgress); 7 | void resetAtomic(); 8 | void stop(); 9 | void progressStage(Component component); 10 | } 11 | -------------------------------------------------------------------------------- /src/main/java/org/betterx/bclib/config/CategoryConfig.java: -------------------------------------------------------------------------------- 1 | package org.betterx.bclib.config; 2 | 3 | public class CategoryConfig extends IdConfig { 4 | 5 | public CategoryConfig(String modID, String group) { 6 | super(modID, group, (id, category) -> { 7 | return new ConfigKey(id.getPath(), id.getNamespace(), category); 8 | }); 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /src/main/java/org/betterx/bclib/interfaces/PatchBiFunction.java: -------------------------------------------------------------------------------- 1 | package org.betterx.bclib.interfaces; 2 | 3 | import org.betterx.bclib.api.v2.datafixer.MigrationProfile; 4 | import org.betterx.bclib.api.v2.datafixer.PatchDidiFailException; 5 | 6 | @FunctionalInterface 7 | public interface PatchBiFunction { 8 | R apply(U t, V v, MigrationProfile profile) throws PatchDidiFailException; 9 | } -------------------------------------------------------------------------------- /src/main/java/org/betterx/bclib/interfaces/PatchFunction.java: -------------------------------------------------------------------------------- 1 | package org.betterx.bclib.interfaces; 2 | 3 | import org.betterx.bclib.api.v2.datafixer.MigrationProfile; 4 | import org.betterx.bclib.api.v2.datafixer.PatchDidiFailException; 5 | 6 | @FunctionalInterface 7 | public interface PatchFunction { 8 | R apply(T t, MigrationProfile profile) throws PatchDidiFailException; 9 | } 10 | -------------------------------------------------------------------------------- /src/main/java/org/betterx/bclib/interfaces/LootPoolAccessor.java: -------------------------------------------------------------------------------- 1 | package org.betterx.bclib.interfaces; 2 | 3 | import net.minecraft.world.level.storage.loot.LootPool; 4 | import net.minecraft.world.level.storage.loot.entries.LootPoolEntryContainer; 5 | 6 | import java.util.List; 7 | 8 | public interface LootPoolAccessor { 9 | LootPool bcl_mergeEntries(List newEntries); 10 | } 11 | -------------------------------------------------------------------------------- /src/main/resources/assets/bclib/patterns/block/block_sided.json: -------------------------------------------------------------------------------- 1 | { 2 | "parent": "block/cube", 3 | "textures": { 4 | "particle": "%modid%:block/%particle%", 5 | "down": "%modid%:block/%down%", 6 | "up": "%modid%:block/%up%", 7 | "north": "%modid%:block/%north%", 8 | "south": "%modid%:block/%south%", 9 | "west": "%modid%:block/%west%", 10 | "east": "%modid%:block/%east%" 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /src/main/java/org/betterx/bclib/behaviours/interfaces/BehaviourClimableVine.java: -------------------------------------------------------------------------------- 1 | package org.betterx.bclib.behaviours.interfaces; 2 | 3 | /** 4 | * Interface for blocks that can be climbed and are vines. 5 | *

6 | * This will combine the {@link BehaviourClimable} behaviours with all {@link BehaviourVine} behaviours. 7 | */ 8 | public interface BehaviourClimableVine extends BehaviourClimable, BehaviourVine { 9 | } 10 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # gradle 2 | 3 | .gradle/ 4 | build/ 5 | out/ 6 | classes/ 7 | 8 | # eclipse 9 | 10 | *.launch 11 | 12 | # idea 13 | 14 | .idea/ 15 | *.iml 16 | *.ipr 17 | *.iws 18 | 19 | # vscode 20 | 21 | .settings/ 22 | .vscode/ 23 | bin/ 24 | .classpath 25 | .project 26 | 27 | # fabric 28 | 29 | run/ 30 | run-client/ 31 | run-server/ 32 | output/ 33 | *.log 34 | /CHANGES.md 35 | /src/main/generated/.cache/ 36 | /modrinth.json 37 | -------------------------------------------------------------------------------- /src/main/java/org/betterx/bclib/interfaces/BCLPlacementContext.java: -------------------------------------------------------------------------------- 1 | package org.betterx.bclib.interfaces; 2 | 3 | import net.minecraft.world.level.block.Mirror; 4 | import net.minecraft.world.level.block.Rotation; 5 | 6 | public interface BCLPlacementContext { 7 | Rotation bcl_getRotation(); 8 | void bcl_setRotation(Rotation bcl_rotation); 9 | Mirror bcl_getMirror(); 10 | void bcl_setMirror(Mirror bcl_mirror); 11 | } 12 | -------------------------------------------------------------------------------- /src/main/java/org/betterx/bclib/api/v3/bonemeal/EndStoneSpreader.java: -------------------------------------------------------------------------------- 1 | package org.betterx.bclib.api.v3.bonemeal; 2 | 3 | import org.betterx.bclib.api.v3.tag.BCLBlockTags; 4 | 5 | public class EndStoneSpreader extends TaggedBonemealBlockSpreader { 6 | static final EndStoneSpreader INSTANCE = new EndStoneSpreader(); 7 | 8 | protected EndStoneSpreader() { 9 | super(BCLBlockTags.BONEMEAL_SOURCE_END_STONE); 10 | } 11 | 12 | } 13 | -------------------------------------------------------------------------------- /src/main/java/org/betterx/bclib/behaviours/interfaces/BehaviourClimable.java: -------------------------------------------------------------------------------- 1 | package org.betterx.bclib.behaviours.interfaces; 2 | 3 | /** 4 | * Interface for blocks that can be climbed. 5 | *

6 | * {@link org.betterx.bclib.api.v2.PostInitAPI} will add the {@link net.minecraft.tags.BlockTags#CLIMBABLE} tag to all blocks that 7 | * implement this interface. 8 | */ 9 | public interface BehaviourClimable extends BlockBehaviour { 10 | } 11 | -------------------------------------------------------------------------------- /src/main/java/org/betterx/bclib/api/v3/datagen/DatapackRecipeBuilder.java: -------------------------------------------------------------------------------- 1 | package org.betterx.bclib.api.v3.datagen; 2 | 3 | import net.minecraft.data.recipes.RecipeOutput; 4 | import net.minecraft.resources.ResourceLocation; 5 | 6 | public interface DatapackRecipeBuilder { 7 | ResourceLocation getId(); 8 | 9 | default String getNamespace() { 10 | return this.getId().getNamespace(); 11 | } 12 | void build(RecipeOutput cc); 13 | } 14 | -------------------------------------------------------------------------------- /src/main/java/org/betterx/bclib/client/gui/modmenu/EntryPoint.java: -------------------------------------------------------------------------------- 1 | package org.betterx.bclib.client.gui.modmenu; 2 | 3 | //import org.betterx.bclib.integration.modmenu.ModMenuIntegration; 4 | // 5 | //@Deprecated() 6 | //public class EntryPoint extends ModMenuIntegration { 7 | // //public static final Object entrypointObject = createEntrypoint(new EntryPoint()); 8 | // 9 | // public EntryPoint() { 10 | // super(MainScreen::new); 11 | // } 12 | //} 13 | -------------------------------------------------------------------------------- /src/main/java/org/anti_ad/mc/ipn/api/IPNIgnore.java: -------------------------------------------------------------------------------- 1 | package org.anti_ad.mc.ipn.api; 2 | 3 | import java.lang.annotation.ElementType; 4 | import java.lang.annotation.Retention; 5 | import java.lang.annotation.RetentionPolicy; 6 | import java.lang.annotation.Target; 7 | 8 | // Included from "Inventory Profiles Next" (https://github.com/blackd/Inventory-Profiles) 9 | @Retention(RetentionPolicy.RUNTIME) 10 | @Target(ElementType.TYPE) 11 | public @interface IPNIgnore { 12 | } -------------------------------------------------------------------------------- /src/main/java/org/betterx/bclib/sdf/operator/SDFRound.java: -------------------------------------------------------------------------------- 1 | package org.betterx.bclib.sdf.operator; 2 | 3 | public class SDFRound extends SDFUnary { 4 | private float radius; 5 | 6 | public SDFRound setRadius(float radius) { 7 | this.radius = radius; 8 | return this; 9 | } 10 | 11 | @Override 12 | public float getDistance(float x, float y, float z) { 13 | return this.source.getDistance(x, y, z) - radius; 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /src/main/java/org/betterx/bclib/client/textures/SpriteLister.java: -------------------------------------------------------------------------------- 1 | package org.betterx.bclib.client.textures; 2 | 3 | import net.minecraft.client.renderer.texture.atlas.sources.DirectoryLister; 4 | 5 | import net.fabricmc.api.EnvType; 6 | import net.fabricmc.api.Environment; 7 | 8 | @Environment(value = EnvType.CLIENT) 9 | public class SpriteLister extends DirectoryLister { 10 | public SpriteLister(String string) { 11 | super(string, string + "/"); 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /src/main/java/org/betterx/bclib/sdf/operator/SDFScale.java: -------------------------------------------------------------------------------- 1 | package org.betterx.bclib.sdf.operator; 2 | 3 | public class SDFScale extends SDFUnary { 4 | private float scale; 5 | 6 | public SDFScale setScale(float scale) { 7 | this.scale = scale; 8 | return this; 9 | } 10 | 11 | @Override 12 | public float getDistance(float x, float y, float z) { 13 | return source.getDistance(x / scale, y / scale, z / scale) * scale; 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /src/main/java/org/betterx/bclib/sdf/operator/SDFUnion.java: -------------------------------------------------------------------------------- 1 | package org.betterx.bclib.sdf.operator; 2 | 3 | import org.betterx.bclib.util.MHelper; 4 | 5 | public class SDFUnion extends SDFBinary { 6 | @Override 7 | public float getDistance(float x, float y, float z) { 8 | float a = this.sourceA.getDistance(x, y, z); 9 | float b = this.sourceB.getDistance(x, y, z); 10 | this.selectValue(a, b); 11 | return MHelper.min(a, b); 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /src/main/java/org/betterx/bclib/sdf/operator/SDFIntersection.java: -------------------------------------------------------------------------------- 1 | package org.betterx.bclib.sdf.operator; 2 | 3 | import org.betterx.bclib.util.MHelper; 4 | 5 | public class SDFIntersection extends SDFBinary { 6 | @Override 7 | public float getDistance(float x, float y, float z) { 8 | float a = this.sourceA.getDistance(x, y, z); 9 | float b = this.sourceB.getDistance(x, y, z); 10 | this.selectValue(a, b); 11 | return MHelper.max(a, b); 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /src/main/java/org/betterx/bclib/sdf/operator/SDFSubtraction.java: -------------------------------------------------------------------------------- 1 | package org.betterx.bclib.sdf.operator; 2 | 3 | import org.betterx.bclib.util.MHelper; 4 | 5 | public class SDFSubtraction extends SDFBinary { 6 | @Override 7 | public float getDistance(float x, float y, float z) { 8 | float a = this.sourceA.getDistance(x, y, z); 9 | float b = this.sourceB.getDistance(x, y, z); 10 | this.selectValue(a, b); 11 | return MHelper.max(a, -b); 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /src/main/java/org/betterx/bclib/sdf/primitive/SDFSphere.java: -------------------------------------------------------------------------------- 1 | package org.betterx.bclib.sdf.primitive; 2 | 3 | import org.betterx.bclib.util.MHelper; 4 | 5 | public class SDFSphere extends SDFPrimitive { 6 | private float radius; 7 | 8 | public SDFSphere setRadius(float radius) { 9 | this.radius = radius; 10 | return this; 11 | } 12 | 13 | @Override 14 | public float getDistance(float x, float y, float z) { 15 | return MHelper.length(x, y, z) - radius; 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /src/main/java/org/betterx/bclib/behaviours/interfaces/BehaviourPlantLike.java: -------------------------------------------------------------------------------- 1 | package org.betterx.bclib.behaviours.interfaces; 2 | 3 | import org.betterx.wover.tabs.api.interfaces.CreativeTabPredicate; 4 | 5 | import net.minecraft.world.item.BlockItem; 6 | 7 | public interface BehaviourPlantLike extends BlockBehaviour { 8 | CreativeTabPredicate TAB_PREDICATE = item -> item instanceof BlockItem bi 9 | && (bi.getBlock() instanceof BehaviourPlantLike 10 | || bi.getBlock() instanceof BehaviourLeaves); 11 | } 12 | -------------------------------------------------------------------------------- /src/main/java/org/betterx/bclib/api/v2/dataexchange/Connector.java: -------------------------------------------------------------------------------- 1 | package org.betterx.bclib.api.v2.dataexchange; 2 | 3 | import org.betterx.bclib.api.v2.dataexchange.handler.DataExchange; 4 | 5 | import java.util.Set; 6 | 7 | abstract class Connector { 8 | protected final DataExchange api; 9 | 10 | Connector(DataExchange api) { 11 | this.api = api; 12 | } 13 | 14 | public abstract boolean onClient(); 15 | 16 | protected Set getDescriptors() { 17 | return api.getDescriptors(); 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /src/main/java/org/betterx/bclib/config/Configs.java: -------------------------------------------------------------------------------- 1 | package org.betterx.bclib.config; 2 | 3 | public class Configs { 4 | public static final String MAIN_PATCH_CATEGORY = "patches"; 5 | 6 | public static final ClientConfig CLIENT_CONFIG = org.betterx.wover.config.api.Configs.register(ClientConfig::new); 7 | public static final MainConfig MAIN_CONFIG = org.betterx.wover.config.api.Configs.register(MainConfig::new); 8 | 9 | 10 | public static void save() { 11 | org.betterx.wover.config.api.Configs.saveConfigs(); 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /src/main/java/org/betterx/bclib/interfaces/CustomItemProvider.java: -------------------------------------------------------------------------------- 1 | package org.betterx.bclib.interfaces; 2 | 3 | import net.minecraft.resources.ResourceLocation; 4 | import net.minecraft.world.item.BlockItem; 5 | import net.minecraft.world.item.Item; 6 | 7 | @Deprecated(forRemoval = true) 8 | public interface CustomItemProvider { 9 | /** 10 | * Used to replace default Block Item when block is registered. 11 | * 12 | * @return {@link BlockItem} 13 | */ 14 | BlockItem getCustomItem(ResourceLocation blockID, Item.Properties settings); 15 | } 16 | -------------------------------------------------------------------------------- /src/main/java/org/betterx/bclib/recipes/BCLRecipeBuilder.java: -------------------------------------------------------------------------------- 1 | package org.betterx.bclib.recipes; 2 | 3 | import net.minecraft.resources.ResourceLocation; 4 | import net.minecraft.world.level.ItemLike; 5 | 6 | public class BCLRecipeBuilder { 7 | public static AlloyingRecipe.Builder alloying(ResourceLocation id, ItemLike output) { 8 | return AlloyingRecipe.Builder.create(id, output); 9 | } 10 | 11 | public static AnvilRecipe.Builder anvil(ResourceLocation id, ItemLike output) { 12 | return AnvilRecipe.create(id, output); 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /src/main/java/org/betterx/bclib/items/BaseDiscItem.java: -------------------------------------------------------------------------------- 1 | package org.betterx.bclib.items; 2 | 3 | import net.minecraft.resources.ResourceKey; 4 | import net.minecraft.world.item.Item; 5 | import net.minecraft.world.item.JukeboxSong; 6 | 7 | public class BaseDiscItem { 8 | public static Item create( 9 | ResourceKey sound, 10 | Item.Properties settings 11 | ) { 12 | return new Item(settings.jukeboxPlayable(sound)); 13 | //return new RecordItem(comparatorOutput, sound, settings, lengthInSeconds); 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /src/main/java/org/betterx/bclib/sdf/operator/SDFTranslate.java: -------------------------------------------------------------------------------- 1 | package org.betterx.bclib.sdf.operator; 2 | 3 | public class SDFTranslate extends SDFUnary { 4 | float x; 5 | float y; 6 | float z; 7 | 8 | public SDFTranslate setTranslate(float x, float y, float z) { 9 | this.x = x; 10 | this.y = y; 11 | this.z = z; 12 | return this; 13 | } 14 | 15 | @Override 16 | public float getDistance(float x, float y, float z) { 17 | return source.getDistance(x - this.x, y - this.y, z - this.z); 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /src/main/java/org/betterx/bclib/blockentities/BaseChestBlockEntity.java: -------------------------------------------------------------------------------- 1 | package org.betterx.bclib.blockentities; 2 | 3 | import org.betterx.bclib.registry.BaseBlockEntities; 4 | 5 | import net.minecraft.core.BlockPos; 6 | import net.minecraft.world.level.block.entity.ChestBlockEntity; 7 | import net.minecraft.world.level.block.state.BlockState; 8 | 9 | public class BaseChestBlockEntity extends ChestBlockEntity { 10 | public BaseChestBlockEntity(BlockPos blockPos, BlockState blockState) { 11 | super(BaseBlockEntities.CHEST, blockPos, blockState); 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /src/main/java/org/betterx/bclib/client/sound/BlockSounds.java: -------------------------------------------------------------------------------- 1 | package org.betterx.bclib.client.sound; 2 | 3 | import net.minecraft.sounds.SoundEvents; 4 | import net.minecraft.world.level.block.SoundType; 5 | 6 | public class BlockSounds { 7 | public static final SoundType TERRAIN_SOUND = new SoundType( 8 | 1.0F, 9 | 1.0F, 10 | SoundEvents.STONE_BREAK, 11 | SoundEvents.WART_BLOCK_STEP, 12 | SoundEvents.STONE_PLACE, 13 | SoundEvents.STONE_HIT, 14 | SoundEvents.STONE_FALL 15 | ); 16 | } 17 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/SUGGEST_FROM.yml: -------------------------------------------------------------------------------- 1 | name: Suggest a Feature or Change 2 | description: Have a new Idea, then suggest a Feature here. 3 | title: "[Suggestion] " 4 | labels: ["suggestion"] 5 | body: 6 | - type: markdown 7 | attributes: 8 | value: | 9 | Thanks for taking the time to suggest a new Feature for BCLib. We appreciate your time! 10 | - type: textarea 11 | id: describe 12 | attributes: 13 | label: Description 14 | description: Tell us your idea 15 | placeholder: 16 | value: 17 | validations: 18 | required: true -------------------------------------------------------------------------------- /src/main/java/org/betterx/bclib/mixin/common/ComposterBlockAccessor.java: -------------------------------------------------------------------------------- 1 | package org.betterx.bclib.mixin.common; 2 | 3 | import net.minecraft.world.level.ItemLike; 4 | import net.minecraft.world.level.block.ComposterBlock; 5 | 6 | import org.spongepowered.asm.mixin.Mixin; 7 | import org.spongepowered.asm.mixin.gen.Invoker; 8 | 9 | @Mixin(ComposterBlock.class) 10 | public interface ComposterBlockAccessor { 11 | @Invoker 12 | static void callAdd(float levelIncreaseChance, ItemLike item) { 13 | throw new AssertionError("@Invoker dummy body called"); 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /src/main/java/org/betterx/bclib/sdf/operator/SDFScale3D.java: -------------------------------------------------------------------------------- 1 | package org.betterx.bclib.sdf.operator; 2 | 3 | public class SDFScale3D extends SDFUnary { 4 | private float x; 5 | private float y; 6 | private float z; 7 | 8 | public SDFScale3D setScale(float x, float y, float z) { 9 | this.x = x; 10 | this.y = y; 11 | this.z = z; 12 | return this; 13 | } 14 | 15 | @Override 16 | public float getDistance(float x, float y, float z) { 17 | return source.getDistance(x / this.x, y / this.y, z / this.z); 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /src/main/java/org/betterx/bclib/entity/DespawnableAnimal.java: -------------------------------------------------------------------------------- 1 | package org.betterx.bclib.entity; 2 | 3 | import net.minecraft.world.entity.EntityType; 4 | import net.minecraft.world.entity.animal.Animal; 5 | import net.minecraft.world.level.Level; 6 | 7 | public abstract class DespawnableAnimal extends Animal { 8 | protected DespawnableAnimal(EntityType entityType, Level level) { 9 | super(entityType, level); 10 | } 11 | 12 | @Override 13 | public boolean removeWhenFarAway(double d) { 14 | return !this.hasCustomName(); 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /wover-include.gradle: -------------------------------------------------------------------------------- 1 | ext.knownWoverModules = [ 2 | 'wover-common-api', 3 | 'wover-core-api', 4 | 'wover-math-api', 5 | 'wover-event-api', 6 | 'wover-surface-api', 7 | 'wover-ui-api', 8 | 'wover-datagen-api', 9 | 'wover-tag-api', 10 | 'wover-preset-api', 11 | 'wover-block-api', 12 | 'wover-item-api', 13 | 'wover-recipe-api', 14 | 'wover-feature-api', 15 | 'wover-structure-api', 16 | 'wover-biome-api', 17 | 'wover-generator-api', 18 | 'wunderlib' 19 | ] 20 | -------------------------------------------------------------------------------- /src/main/java/org/betterx/bclib/behaviours/interfaces/BehaviourLeaves.java: -------------------------------------------------------------------------------- 1 | package org.betterx.bclib.behaviours.interfaces; 2 | 3 | import org.betterx.bclib.interfaces.tools.AddMineableHoe; 4 | import org.betterx.bclib.interfaces.tools.AddMineableShears; 5 | 6 | /** 7 | * Interface for leaves blocks. 8 | *

9 | * Adds composting chance, mineable with shears and hoe. 10 | */ 11 | public interface BehaviourLeaves extends AddMineableShears, AddMineableHoe, BehaviourCompostable { 12 | @Override 13 | default float compostingChance() { 14 | return 0.3f; 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /src/main/java/org/betterx/bclib/behaviours/interfaces/BehaviourVine.java: -------------------------------------------------------------------------------- 1 | package org.betterx.bclib.behaviours.interfaces; 2 | 3 | import org.betterx.bclib.interfaces.tools.AddMineableHoe; 4 | import org.betterx.bclib.interfaces.tools.AddMineableShears; 5 | 6 | /** 7 | * Interface for blocks that are vines. 8 | *

9 | * This will add the {@link AddMineableShears}, {@link AddMineableHoe} and {@link BehaviourCompostable} behaviours. 10 | */ 11 | public interface BehaviourVine extends AddMineableShears, AddMineableHoe, BehaviourPlantLike, BehaviourCompostable, BehaviourClimable { 12 | } 13 | -------------------------------------------------------------------------------- /src/main/java/org/betterx/bclib/sdf/operator/SDFUnary.java: -------------------------------------------------------------------------------- 1 | package org.betterx.bclib.sdf.operator; 2 | 3 | import org.betterx.bclib.sdf.SDF; 4 | 5 | import net.minecraft.core.BlockPos; 6 | import net.minecraft.world.level.block.state.BlockState; 7 | 8 | public abstract class SDFUnary extends SDF { 9 | protected SDF source; 10 | 11 | public SDFUnary setSource(SDF source) { 12 | this.source = source; 13 | return this; 14 | } 15 | 16 | @Override 17 | public BlockState getBlockState(BlockPos pos) { 18 | return source.getBlockState(pos); 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /src/main/java/org/betterx/bclib/sdf/operator/SDFCopyRotate.java: -------------------------------------------------------------------------------- 1 | package org.betterx.bclib.sdf.operator; 2 | 3 | import org.betterx.bclib.util.MHelper; 4 | 5 | public class SDFCopyRotate extends SDFUnary { 6 | int count = 1; 7 | 8 | public SDFCopyRotate setCount(int count) { 9 | this.count = count; 10 | return this; 11 | } 12 | 13 | @Override 14 | public float getDistance(float x, float y, float z) { 15 | float px = (float) Math.atan2(x, z); 16 | float pz = MHelper.length(x, z); 17 | return this.source.getDistance(px, y, pz); 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /src/main/java/org/betterx/bclib/interfaces/ItemModelProvider.java: -------------------------------------------------------------------------------- 1 | package org.betterx.bclib.interfaces; 2 | 3 | import org.betterx.bclib.client.models.ModelsHelper; 4 | 5 | import net.minecraft.client.renderer.block.model.BlockModel; 6 | import net.minecraft.resources.ResourceLocation; 7 | 8 | import net.fabricmc.api.EnvType; 9 | import net.fabricmc.api.Environment; 10 | 11 | public interface ItemModelProvider { 12 | @Environment(EnvType.CLIENT) 13 | default BlockModel getItemModel(ResourceLocation resourceLocation) { 14 | return ModelsHelper.createItemModel(resourceLocation); 15 | } 16 | } -------------------------------------------------------------------------------- /src/main/java/org/betterx/bclib/server/BCLibServer.java: -------------------------------------------------------------------------------- 1 | package org.betterx.bclib.server; 2 | 3 | import org.betterx.bclib.api.v2.ModIntegrationAPI; 4 | import org.betterx.bclib.api.v2.PostInitAPI; 5 | import org.betterx.bclib.api.v2.dataexchange.DataExchangeAPI; 6 | 7 | import net.fabricmc.api.DedicatedServerModInitializer; 8 | 9 | public class BCLibServer implements DedicatedServerModInitializer { 10 | @Override 11 | public void onInitializeServer() { 12 | ModIntegrationAPI.registerAll(); 13 | DataExchangeAPI.prepareServerside(); 14 | 15 | PostInitAPI.postInit(false); 16 | } 17 | 18 | } 19 | -------------------------------------------------------------------------------- /src/main/java/org/betterx/datagen/bclib/worldgen/BlockTagProvider.java: -------------------------------------------------------------------------------- 1 | package org.betterx.datagen.bclib.worldgen; 2 | 3 | import org.betterx.wover.core.api.ModCore; 4 | import org.betterx.wover.datagen.api.WoverTagProvider; 5 | import org.betterx.wover.tag.api.event.context.TagBootstrapContext; 6 | 7 | import net.minecraft.world.level.block.Block; 8 | 9 | public class BlockTagProvider extends WoverTagProvider.ForBlocks { 10 | public BlockTagProvider(ModCore modCore) { 11 | super(modCore); 12 | } 13 | 14 | @Override 15 | public void prepareTags(TagBootstrapContext context) { 16 | 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /src/main/java/org/betterx/bclib/interfaces/LevelRendererAccess.java: -------------------------------------------------------------------------------- 1 | package org.betterx.bclib.interfaces; 2 | 3 | 4 | import net.minecraft.client.particle.Particle; 5 | import net.minecraft.core.particles.ParticleOptions; 6 | 7 | import net.fabricmc.api.EnvType; 8 | import net.fabricmc.api.Environment; 9 | 10 | import org.jetbrains.annotations.Nullable; 11 | 12 | @Environment(EnvType.CLIENT) 13 | public interface LevelRendererAccess { 14 | @Nullable Particle bcl_addParticle( 15 | ParticleOptions particleOptions, 16 | double x, double y, double z, 17 | double vx, double vy, double vz 18 | ); 19 | } 20 | -------------------------------------------------------------------------------- /src/main/java/org/betterx/bclib/mixin/common/ShovelItemAccessor.java: -------------------------------------------------------------------------------- 1 | package org.betterx.bclib.mixin.common; 2 | 3 | import net.minecraft.world.item.ShovelItem; 4 | import net.minecraft.world.level.block.Block; 5 | import net.minecraft.world.level.block.state.BlockState; 6 | 7 | import org.spongepowered.asm.mixin.Mixin; 8 | import org.spongepowered.asm.mixin.gen.Accessor; 9 | 10 | import java.util.Map; 11 | 12 | @Mixin(ShovelItem.class) 13 | public interface ShovelItemAccessor { 14 | @Accessor("FLATTENABLES") 15 | static Map bclib_getFlattenables() { 16 | throw new AssertionError("@Accessor dummy body called"); 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /src/main/java/org/betterx/bclib/items/BaseBucketItem.java: -------------------------------------------------------------------------------- 1 | package org.betterx.bclib.items; 2 | 3 | import org.betterx.bclib.interfaces.ItemModelProvider; 4 | 5 | import net.minecraft.sounds.SoundEvents; 6 | import net.minecraft.world.entity.EntityType; 7 | import net.minecraft.world.item.Item; 8 | import net.minecraft.world.item.MobBucketItem; 9 | import net.minecraft.world.level.material.Fluids; 10 | 11 | public class BaseBucketItem extends MobBucketItem implements ItemModelProvider { 12 | public BaseBucketItem(EntityType type, Item.Properties settings) { 13 | super(type, Fluids.WATER, SoundEvents.BUCKET_EMPTY_FISH, settings.stacksTo(1)); 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /src/main/java/org/betterx/bclib/interfaces/SpawnRule.java: -------------------------------------------------------------------------------- 1 | package org.betterx.bclib.interfaces; 2 | 3 | import net.minecraft.core.BlockPos; 4 | import net.minecraft.util.RandomSource; 5 | import net.minecraft.world.entity.EntityType; 6 | import net.minecraft.world.entity.Mob; 7 | import net.minecraft.world.entity.MobSpawnType; 8 | import net.minecraft.world.level.LevelAccessor; 9 | 10 | @FunctionalInterface 11 | public interface SpawnRule { 12 | boolean canSpawn( 13 | EntityType type, 14 | LevelAccessor world, 15 | MobSpawnType spawnReason, 16 | BlockPos pos, 17 | RandomSource random 18 | ); 19 | } 20 | -------------------------------------------------------------------------------- /src/main/resources/bclib.mixins.client.json: -------------------------------------------------------------------------------- 1 | { 2 | "required": true, 3 | "minVersion": "0.8", 4 | "package": "org.betterx.bclib.mixin.client", 5 | "compatibilityLevel": "JAVA_21", 6 | "client": [ 7 | "AnvilScreenMixin", 8 | "AtlasSetMixin", 9 | "BlockMixin", 10 | "ClientLevelMixin", 11 | "ClientPacketListenerMixin", 12 | "ClientRecipeBookMixin", 13 | "DebugRendererMixin", 14 | "FogRendererMixin", 15 | "LevelRendererAccessor", 16 | "LevelRendererMixin", 17 | "MinecraftMixin", 18 | "ModelManagerMixin", 19 | "boat.BoatRendererMixin" 20 | ], 21 | "injectors": { 22 | "defaultRequire": 1 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /LICENSE.ASSETS: -------------------------------------------------------------------------------- 1 | Some of our Assets (see List below) is licensed under CC BY-NC-SA 4.0 2 | See https://creativecommons.org/licenses/by-nc-sa/4.0/ for Details. 3 | 4 | Please use the Attribution "Team BetterX". 5 | 6 | The following Files are distributed under this License: 7 | * src/main/resources/assets/bclib/lang/de_de.json 8 | * src/main/resources/assets/bclib/textures/* 9 | * src/main/resources/assets/bclib/betterx.png 10 | * src/main/resources/assets/bclib/header.jpg 11 | * src/main/resources/assets/bclib/icon_betterend.png 12 | * src/main/resources/assets/bclib/icon_betternether.png 13 | * src/main/resources/assets/bclib/icon_bright.png 14 | * src/main/resources/assets/bclib/icon_updater.png -------------------------------------------------------------------------------- /src/main/java/org/betterx/bclib/interfaces/ClientLevelAccess.java: -------------------------------------------------------------------------------- 1 | package org.betterx.bclib.interfaces; 2 | 3 | import net.minecraft.client.particle.Particle; 4 | import net.minecraft.core.particles.ParticleOptions; 5 | 6 | import net.fabricmc.api.EnvType; 7 | import net.fabricmc.api.Environment; 8 | 9 | import org.jetbrains.annotations.Nullable; 10 | 11 | @Environment(EnvType.CLIENT) 12 | public interface ClientLevelAccess { 13 | @Nullable 14 | LevelRendererAccess bcl_getLevelRenderer(); 15 | @Nullable 16 | Particle bcl_addParticle( 17 | ParticleOptions particleOptions, 18 | double x, double y, double z, 19 | double vx, double vy, double vz 20 | ); 21 | } 22 | -------------------------------------------------------------------------------- /src/main/java/org/betterx/bclib/sdf/operator/SDFDisplacement.java: -------------------------------------------------------------------------------- 1 | package org.betterx.bclib.sdf.operator; 2 | 3 | 4 | import org.joml.Vector3f; 5 | 6 | import java.util.function.Function; 7 | 8 | public class SDFDisplacement extends SDFUnary { 9 | private final Vector3f pos = new Vector3f(); 10 | private Function displace; 11 | 12 | public SDFDisplacement setFunction(Function displace) { 13 | this.displace = displace; 14 | return this; 15 | } 16 | 17 | @Override 18 | public float getDistance(float x, float y, float z) { 19 | pos.set(x, y, z); 20 | return this.source.getDistance(x, y, z) + displace.apply(pos); 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /src/main/java/org/betterx/bclib/sdf/operator/SDFCoordModify.java: -------------------------------------------------------------------------------- 1 | package org.betterx.bclib.sdf.operator; 2 | 3 | 4 | import org.joml.Vector3f; 5 | 6 | import java.util.function.Consumer; 7 | 8 | public class SDFCoordModify extends SDFUnary { 9 | private final Vector3f pos = new Vector3f(); 10 | private Consumer function; 11 | 12 | public SDFCoordModify setFunction(Consumer function) { 13 | this.function = function; 14 | return this; 15 | } 16 | 17 | @Override 18 | public float getDistance(float x, float y, float z) { 19 | pos.set(x, y, z); 20 | function.accept(pos); 21 | return this.source.getDistance(pos.x(), pos.y(), pos.z()); 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /src/main/java/org/betterx/bclib/config/MainConfig.java: -------------------------------------------------------------------------------- 1 | package org.betterx.bclib.config; 2 | 3 | import de.ambertation.wunderlib.configs.ConfigFile; 4 | import org.betterx.bclib.BCLib; 5 | 6 | public class MainConfig extends ConfigFile { 7 | public final static Group PATCH_GROUP = new Group(BCLib.C.namespace, Configs.MAIN_PATCH_CATEGORY, 0); 8 | 9 | public final BooleanValue applyPatches = new BooleanValue( 10 | PATCH_GROUP.title(), 11 | "apply_patches", 12 | true 13 | ).setGroup(PATCH_GROUP); 14 | 15 | 16 | public MainConfig() { 17 | super(BCLib.C, "main"); 18 | } 19 | 20 | public boolean applyPatches() { 21 | return applyPatches.get(); 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /src/main/java/org/betterx/bclib/api/v3/bonemeal/NetherrackSpreader.java: -------------------------------------------------------------------------------- 1 | package org.betterx.bclib.api.v3.bonemeal; 2 | 3 | import org.betterx.bclib.api.v3.tag.BCLBlockTags; 4 | 5 | import net.minecraft.world.level.block.Blocks; 6 | import net.minecraft.world.level.block.state.BlockState; 7 | 8 | public class NetherrackSpreader extends TaggedBonemealBlockSpreader { 9 | public static final NetherrackSpreader INSTANCE = new NetherrackSpreader(); 10 | 11 | protected NetherrackSpreader() { 12 | super(BCLBlockTags.BONEMEAL_SOURCE_NETHERRACK); 13 | } 14 | 15 | protected boolean hasCustomBehaviour(BlockState state) { 16 | return !state.is(Blocks.WARPED_NYLIUM) && !state.is(Blocks.CRIMSON_NYLIUM); 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /src/main/java/org/betterx/bclib/sdf/primitive/SDFCapsule.java: -------------------------------------------------------------------------------- 1 | package org.betterx.bclib.sdf.primitive; 2 | 3 | import org.betterx.bclib.util.MHelper; 4 | 5 | import net.minecraft.util.Mth; 6 | 7 | public class SDFCapsule extends SDFPrimitive { 8 | private float radius; 9 | private float height; 10 | 11 | public SDFCapsule setRadius(float radius) { 12 | this.radius = radius; 13 | return this; 14 | } 15 | 16 | public SDFCapsule setHeight(float height) { 17 | this.height = height; 18 | return this; 19 | } 20 | 21 | @Override 22 | public float getDistance(float x, float y, float z) { 23 | return MHelper.length(x, y - Mth.clamp(y, 0, height), z) - radius; 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /src/main/java/org/betterx/bclib/sdf/operator/SDFSmoothUnion.java: -------------------------------------------------------------------------------- 1 | package org.betterx.bclib.sdf.operator; 2 | 3 | import net.minecraft.util.Mth; 4 | 5 | public class SDFSmoothUnion extends SDFBinary { 6 | private float radius; 7 | 8 | public SDFSmoothUnion setRadius(float radius) { 9 | this.radius = radius; 10 | return this; 11 | } 12 | 13 | @Override 14 | public float getDistance(float x, float y, float z) { 15 | float a = this.sourceA.getDistance(x, y, z); 16 | float b = this.sourceB.getDistance(x, y, z); 17 | this.selectValue(a, b); 18 | float h = Mth.clamp(0.5F + 0.5F * (b - a) / radius, 0F, 1F); 19 | return Mth.lerp(h, b, a) - radius * h * (1F - h); 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /src/main/java/org/betterx/bclib/sdf/primitive/SDFTorus.java: -------------------------------------------------------------------------------- 1 | package org.betterx.bclib.sdf.primitive; 2 | 3 | import org.betterx.bclib.util.MHelper; 4 | 5 | public class SDFTorus extends SDFPrimitive { 6 | private float radiusSmall; 7 | private float radiusBig; 8 | 9 | public SDFTorus setBigRadius(float radius) { 10 | this.radiusBig = radius; 11 | return this; 12 | } 13 | 14 | public SDFTorus setSmallRadius(float radius) { 15 | this.radiusSmall = radius; 16 | return this; 17 | } 18 | 19 | @Override 20 | public float getDistance(float x, float y, float z) { 21 | float nx = MHelper.length(x, z) - radiusBig; 22 | return MHelper.length(nx, y) - radiusSmall; 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /src/main/java/org/betterx/bclib/sdf/operator/SDFSmoothSubtraction.java: -------------------------------------------------------------------------------- 1 | package org.betterx.bclib.sdf.operator; 2 | 3 | import net.minecraft.util.Mth; 4 | 5 | public class SDFSmoothSubtraction extends SDFBinary { 6 | private float radius; 7 | 8 | public SDFSmoothSubtraction setRadius(float radius) { 9 | this.radius = radius; 10 | return this; 11 | } 12 | 13 | @Override 14 | public float getDistance(float x, float y, float z) { 15 | float a = this.sourceA.getDistance(x, y, z); 16 | float b = this.sourceB.getDistance(x, y, z); 17 | this.selectValue(a, b); 18 | float h = Mth.clamp(0.5F - 0.5F * (b + a) / radius, 0F, 1F); 19 | return Mth.lerp(h, b, -a) + radius * h * (1F - h); 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /src/main/java/org/betterx/bclib/api/v2/levelgen/structures/StructurePlacementType.java: -------------------------------------------------------------------------------- 1 | package org.betterx.bclib.api.v2.levelgen.structures; 2 | 3 | import com.mojang.serialization.Codec; 4 | import net.minecraft.util.StringRepresentable; 5 | 6 | import org.jetbrains.annotations.NotNull; 7 | 8 | public enum StructurePlacementType implements StringRepresentable { 9 | FLOOR, WALL, CEIL, LAVA, UNDER; 10 | 11 | public static final Codec CODEC = StringRepresentable.fromEnum(StructurePlacementType::values); 12 | 13 | public String getName() { 14 | return this.getSerializedName(); 15 | } 16 | 17 | @Override 18 | public @NotNull String getSerializedName() { 19 | return this.name().toLowerCase(); 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /src/main/java/org/betterx/bclib/sdf/operator/SDFSmoothIntersection.java: -------------------------------------------------------------------------------- 1 | package org.betterx.bclib.sdf.operator; 2 | 3 | import net.minecraft.util.Mth; 4 | 5 | public class SDFSmoothIntersection extends SDFBinary { 6 | private float radius; 7 | 8 | public SDFSmoothIntersection setRadius(float radius) { 9 | this.radius = radius; 10 | return this; 11 | } 12 | 13 | @Override 14 | public float getDistance(float x, float y, float z) { 15 | float a = this.sourceA.getDistance(x, y, z); 16 | float b = this.sourceB.getDistance(x, y, z); 17 | this.selectValue(a, b); 18 | float h = Mth.clamp(0.5F - 0.5F * (b - a) / radius, 0F, 1F); 19 | return Mth.lerp(h, b, a) + radius * h * (1F - h); 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /src/main/java/org/betterx/bclib/BCLibPatch.java: -------------------------------------------------------------------------------- 1 | package org.betterx.bclib; 2 | 3 | import de.ambertation.wunderlib.utils.Version; 4 | import org.betterx.bclib.api.v2.datafixer.DataFixerAPI; 5 | import org.betterx.bclib.api.v2.datafixer.Patch; 6 | 7 | import java.util.Map; 8 | 9 | public final class BCLibPatch { 10 | public static void register() { 11 | DataFixerAPI.registerPatch(SignPatch::new); 12 | } 13 | } 14 | 15 | class SignPatch extends Patch { 16 | public SignPatch() { 17 | super(BCLib.C, new Version(3, 0, 11)); 18 | } 19 | 20 | @Override 21 | public Map getIDReplacements() { 22 | return Map.ofEntries( 23 | Map.entry("bclib:sign", "minecraft:sign") 24 | ); 25 | } 26 | } 27 | 28 | 29 | -------------------------------------------------------------------------------- /src/main/java/org/betterx/bclib/api/v2/ComposterAPI.java: -------------------------------------------------------------------------------- 1 | package org.betterx.bclib.api.v2; 2 | 3 | import org.betterx.bclib.mixin.common.ComposterBlockAccessor; 4 | 5 | import net.minecraft.world.item.Item; 6 | import net.minecraft.world.item.Items; 7 | import net.minecraft.world.level.block.Block; 8 | 9 | public class ComposterAPI { 10 | public static Block allowCompost(float chance, Block block) { 11 | if (block != null) { 12 | allowCompost(chance, block.asItem()); 13 | } 14 | return block; 15 | } 16 | 17 | public static Item allowCompost(float chance, Item item) { 18 | if (item != null && item != Items.AIR) { 19 | ComposterBlockAccessor.callAdd(chance, item); 20 | } 21 | return item; 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /gradle.properties: -------------------------------------------------------------------------------- 1 | # Done to increase the memory available to gradle. 2 | org.gradle.jvmargs=-Xmx8G 3 | #Modrinth 4 | modrinth_versions=["1.21", "1.21.1"] 5 | #CurseForge 6 | curseforge_id=495191 7 | #Dependencies 8 | required_dependencies=["fabric-api", "worldweaver"] 9 | optional_dependencies=["modmenu"] 10 | #`release`, `beta` or `alpha` 11 | release_channel=beta 12 | #Loom 13 | loom_version=1.7-SNAPSHOT 14 | # Fabric Properties 15 | # check these on https://fabricmc.net/versions.html 16 | minecraft_version=1.21.1 17 | loader_version=0.16.0 18 | fabric_version=0.102.0+1.21.1 19 | # Mod Properties 20 | mod_version=21.0.14 21 | maven_group=org.betterx 22 | archives_base_name=bclib 23 | # Dependencies 24 | modmenu_version=11.0.1 25 | emi_version=1.1.8+1.21 26 | wover_version=21.0.13 27 | wunderlib_version=21.0.8 -------------------------------------------------------------------------------- /src/main/java/org/betterx/bclib/api/v2/dataexchange/DataExchangeAPI.java: -------------------------------------------------------------------------------- 1 | package org.betterx.bclib.api.v2.dataexchange; 2 | 3 | import org.betterx.bclib.api.v2.dataexchange.handler.DataExchange; 4 | 5 | import net.fabricmc.api.EnvType; 6 | import net.fabricmc.api.Environment; 7 | 8 | public class DataExchangeAPI extends DataExchange { 9 | /** 10 | * You should never need to create a custom instance of this Object. 11 | */ 12 | public DataExchangeAPI() { 13 | super(); 14 | } 15 | 16 | @Environment(EnvType.CLIENT) 17 | protected ConnectorClientside clientSupplier(DataExchange api) { 18 | return new ConnectorClientside(api); 19 | } 20 | 21 | protected ConnectorServerside serverSupplier(DataExchange api) { 22 | return new ConnectorServerside(api); 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /src/main/java/org/betterx/bclib/api/v3/bonemeal/BonemealBlockSpreader.java: -------------------------------------------------------------------------------- 1 | package org.betterx.bclib.api.v3.bonemeal; 2 | 3 | import net.minecraft.core.BlockPos; 4 | import net.minecraft.server.level.ServerLevel; 5 | import net.minecraft.util.RandomSource; 6 | import net.minecraft.world.level.BlockGetter; 7 | import net.minecraft.world.level.block.state.BlockState; 8 | 9 | public interface BonemealBlockSpreader { 10 | boolean isValidBonemealSpreadTarget(BlockGetter blockGetter, BlockPos blockPos, BlockState blockState, boolean bl); 11 | boolean canSpreadAt(BlockGetter blockGetter, BlockPos blockPos); 12 | 13 | boolean performBonemealSpread( 14 | ServerLevel serverLevel, 15 | RandomSource randomSource, 16 | BlockPos blockPos, 17 | BlockState blockState 18 | ); 19 | 20 | } 21 | -------------------------------------------------------------------------------- /src/main/java/org/betterx/bclib/interfaces/SurvivesOnWater.java: -------------------------------------------------------------------------------- 1 | package org.betterx.bclib.interfaces; 2 | 3 | import net.minecraft.core.BlockPos; 4 | import net.minecraft.world.level.LevelReader; 5 | import net.minecraft.world.level.block.Block; 6 | import net.minecraft.world.level.block.Blocks; 7 | import net.minecraft.world.level.block.state.BlockState; 8 | 9 | import java.util.List; 10 | 11 | public interface SurvivesOnWater extends SurvivesOnBlocks { 12 | List BLOCKS = List.of(Blocks.WATER); 13 | 14 | @Override 15 | default List getSurvivableBlocks() { 16 | return BLOCKS; 17 | } 18 | 19 | default boolean canSurvive(BlockState state, LevelReader world, BlockPos pos) { 20 | return world.getBlockState(pos).isAir() && isTerrain(world.getBlockState(pos.below())); 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /src/main/java/org/betterx/bclib/sdf/primitive/SDFHexPrism.java: -------------------------------------------------------------------------------- 1 | package org.betterx.bclib.sdf.primitive; 2 | 3 | import org.betterx.bclib.util.MHelper; 4 | 5 | public class SDFHexPrism extends SDFPrimitive { 6 | private float radius; 7 | private float height; 8 | 9 | public SDFHexPrism setRadius(float radius) { 10 | this.radius = radius; 11 | return this; 12 | } 13 | 14 | public SDFHexPrism setHeight(float height) { 15 | this.height = height; 16 | return this; 17 | } 18 | 19 | @Override 20 | public float getDistance(float x, float y, float z) { 21 | float px = Math.abs(x); 22 | float py = Math.abs(y); 23 | float pz = Math.abs(z); 24 | return MHelper.max(py - height, MHelper.max((px * 0.866025F + pz * 0.5F), pz) - radius); 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /src/main/java/org/betterx/bclib/items/elytra/BCLElytraUtils.java: -------------------------------------------------------------------------------- 1 | package org.betterx.bclib.items.elytra; 2 | 3 | import net.minecraft.world.entity.EquipmentSlot; 4 | import net.minecraft.world.entity.LivingEntity; 5 | import net.minecraft.world.item.ItemStack; 6 | 7 | import java.util.function.BiConsumer; 8 | import java.util.function.Function; 9 | 10 | public class BCLElytraUtils { 11 | @FunctionalInterface 12 | public interface SlotProvider { 13 | ItemStack getElytra(LivingEntity entity, Function slotGetter); 14 | } 15 | 16 | public static SlotProvider slotProvider = null; 17 | public static BiConsumer onBreak = 18 | (entity, chestStack) -> { 19 | chestStack.hurtAndBreak(1, entity, EquipmentSlot.CHEST); 20 | }; 21 | } 22 | -------------------------------------------------------------------------------- /src/main/java/org/betterx/bclib/items/boat/BaseBoatItem.java: -------------------------------------------------------------------------------- 1 | package org.betterx.bclib.items.boat; 2 | 3 | import org.betterx.bclib.interfaces.ItemModelProvider; 4 | 5 | import net.minecraft.world.entity.vehicle.Boat; 6 | import net.minecraft.world.item.BoatItem; 7 | 8 | public class BaseBoatItem extends BoatItem implements CustomBoatTypeOverride, ItemModelProvider { 9 | BoatTypeOverride customType; 10 | 11 | public BaseBoatItem(boolean bl, BoatTypeOverride type, Properties properties) { 12 | super(bl, Boat.Type.OAK, properties); 13 | bcl_setCustomType(type); 14 | } 15 | 16 | @Override 17 | public void bcl_setCustomType(BoatTypeOverride type) { 18 | customType = type; 19 | } 20 | 21 | @Override 22 | public BoatTypeOverride bcl_getCustomType() { 23 | return customType; 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /src/main/java/org/betterx/bclib/items/ModelProviderItem.java: -------------------------------------------------------------------------------- 1 | package org.betterx.bclib.items; 2 | 3 | import org.betterx.bclib.client.models.ModelsHelper; 4 | import org.betterx.bclib.interfaces.ItemModelProvider; 5 | 6 | import net.minecraft.client.renderer.block.model.BlockModel; 7 | import net.minecraft.resources.ResourceLocation; 8 | import net.minecraft.world.item.Item; 9 | 10 | import net.fabricmc.api.EnvType; 11 | import net.fabricmc.api.Environment; 12 | 13 | public class ModelProviderItem extends Item implements ItemModelProvider { 14 | public ModelProviderItem(Properties settings) { 15 | super(settings); 16 | } 17 | 18 | @Override 19 | @Environment(EnvType.CLIENT) 20 | public BlockModel getItemModel(ResourceLocation resourceLocation) { 21 | return ModelsHelper.createItemModel(resourceLocation); 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /src/main/java/org/betterx/bclib/sdf/operator/SDFFlatWave.java: -------------------------------------------------------------------------------- 1 | package org.betterx.bclib.sdf.operator; 2 | 3 | public class SDFFlatWave extends SDFDisplacement { 4 | private int rayCount = 1; 5 | private float intensity; 6 | private float angle; 7 | 8 | public SDFFlatWave() { 9 | setFunction((pos) -> { 10 | return (float) Math.cos(Math.atan2(pos.x(), pos.z()) * rayCount + angle) * intensity; 11 | }); 12 | } 13 | 14 | public SDFFlatWave setRaysCount(int count) { 15 | this.rayCount = count; 16 | return this; 17 | } 18 | 19 | public SDFFlatWave setAngle(float angle) { 20 | this.angle = angle; 21 | return this; 22 | } 23 | 24 | public SDFFlatWave setIntensity(float intensity) { 25 | this.intensity = intensity; 26 | return this; 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /src/main/java/org/betterx/bclib/complexmaterials/entry/MaterialSlot.java: -------------------------------------------------------------------------------- 1 | package org.betterx.bclib.complexmaterials.entry; 2 | 3 | import org.betterx.bclib.complexmaterials.ComplexMaterial; 4 | 5 | import java.util.function.Consumer; 6 | import org.jetbrains.annotations.NotNull; 7 | 8 | public abstract class MaterialSlot { 9 | @NotNull 10 | public final String suffix; 11 | 12 | public MaterialSlot(@NotNull String suffix) { 13 | this.suffix = suffix; 14 | } 15 | 16 | public abstract void addBlockEntry(M parentMaterial, Consumer adder); 17 | public abstract void addRecipeEntry(M parentMaterial, Consumer adder); 18 | 19 | public void addItemEntry(M parentMaterial, Consumer adder) { 20 | } 21 | 22 | 23 | public void onInit(M parentMaterial) { 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /src/main/java/org/betterx/bclib/behaviours/interfaces/BehaviourCompostable.java: -------------------------------------------------------------------------------- 1 | package org.betterx.bclib.behaviours.interfaces; 2 | 3 | /** 4 | * Interface for blocks that can be composted. 5 | *

6 | * {@link org.betterx.bclib.api.v2.PostInitAPI} will add the 7 | * {@link org.betterx.wover.tag.api.predefined.CommonItemTags#COMPOSTABLE} tag to the items of all blocks that 8 | * implement this interface. It will also register the Block with the {@link org.betterx.bclib.api.v2.ComposterAPI} 9 | */ 10 | public interface BehaviourCompostable extends BlockBehaviour { 11 | 12 | /** 13 | * The chance that this block will be composted. 14 | *

15 | * The default value is 0.1f. 16 | * 17 | * @return The chance that this block will be composted. 18 | */ 19 | default float compostingChance() { 20 | return 0.1f; 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /src/main/java/org/betterx/bclib/mixin/common/MobSpawnSettingsAccessor.java: -------------------------------------------------------------------------------- 1 | package org.betterx.bclib.mixin.common; 2 | 3 | import net.minecraft.util.random.WeightedRandomList; 4 | import net.minecraft.world.entity.MobCategory; 5 | import net.minecraft.world.level.biome.MobSpawnSettings; 6 | import net.minecraft.world.level.biome.MobSpawnSettings.SpawnerData; 7 | 8 | import org.spongepowered.asm.mixin.Mixin; 9 | import org.spongepowered.asm.mixin.Mutable; 10 | import org.spongepowered.asm.mixin.gen.Accessor; 11 | 12 | import java.util.Map; 13 | 14 | @Mixin(MobSpawnSettings.class) 15 | public interface MobSpawnSettingsAccessor { 16 | @Accessor("spawners") 17 | Map> bcl_getSpawners(); 18 | 19 | @Accessor("spawners") 20 | @Mutable 21 | void bcl_setSpawners(Map> spawners); 22 | } 23 | -------------------------------------------------------------------------------- /src/main/java/org/betterx/datagen/bclib/advancement/BCLAdvancementDataProvider.java: -------------------------------------------------------------------------------- 1 | package org.betterx.datagen.bclib.advancement; 2 | 3 | import org.betterx.bclib.BCLib; 4 | import org.betterx.bclib.api.v3.datagen.AdvancementDataProvider; 5 | 6 | import net.minecraft.core.HolderLookup; 7 | 8 | import net.fabricmc.fabric.api.datagen.v1.FabricDataOutput; 9 | 10 | import java.util.List; 11 | import java.util.concurrent.CompletableFuture; 12 | 13 | public class BCLAdvancementDataProvider extends AdvancementDataProvider { 14 | public BCLAdvancementDataProvider( 15 | FabricDataOutput output, 16 | CompletableFuture registryLookup 17 | ) { 18 | super(List.of(BCLib.MOD_ID), output, registryLookup); 19 | } 20 | 21 | @Override 22 | protected void bootstrap(HolderLookup.Provider registryLookup) { 23 | 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /src/main/java/org/betterx/bclib/mixin/client/ClientPacketListenerMixin.java: -------------------------------------------------------------------------------- 1 | package org.betterx.bclib.mixin.client; 2 | 3 | import org.betterx.bclib.api.v2.dataexchange.DataExchangeAPI; 4 | 5 | import net.minecraft.client.multiplayer.ClientPacketListener; 6 | 7 | import org.spongepowered.asm.mixin.Mixin; 8 | import org.spongepowered.asm.mixin.injection.At; 9 | import org.spongepowered.asm.mixin.injection.Inject; 10 | import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; 11 | 12 | @Mixin(ClientPacketListener.class) 13 | public class ClientPacketListenerMixin { 14 | 15 | @Inject(method = "handleLogin", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/telemetry/WorldSessionTelemetryManager;onPlayerInfoReceived(Lnet/minecraft/world/level/GameType;Z)V")) 16 | public void bclib_onStart(CallbackInfo ci) { 17 | DataExchangeAPI.sendOnEnter(); 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /src/main/java/org/betterx/bclib/util/RecipeHelper.java: -------------------------------------------------------------------------------- 1 | package org.betterx.bclib.util; 2 | 3 | import net.minecraft.core.registries.BuiltInRegistries; 4 | import net.minecraft.world.level.ItemLike; 5 | import net.minecraft.world.level.block.Block; 6 | 7 | public class RecipeHelper { 8 | public static boolean exists(ItemLike item) { 9 | if (item instanceof Block) { 10 | return BuiltInRegistries.BLOCK.getKey((Block) item) != BuiltInRegistries.BLOCK.getDefaultKey(); 11 | } else { 12 | return BuiltInRegistries.ITEM.getKey(item.asItem()) != BuiltInRegistries.ITEM.getDefaultKey(); 13 | } 14 | } 15 | 16 | public static boolean exists(ItemLike... items) { 17 | for (ItemLike item : items) { 18 | if (!exists(item)) { 19 | return false; 20 | } 21 | } 22 | return true; 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /src/main/java/org/betterx/bclib/util/BCLDataComponents.java: -------------------------------------------------------------------------------- 1 | package org.betterx.bclib.util; 2 | 3 | import org.betterx.bclib.BCLib; 4 | import org.betterx.wover.data_components.DataComponentManager; 5 | 6 | import net.minecraft.core.component.DataComponentType; 7 | import net.minecraft.world.item.component.CustomData; 8 | 9 | import org.jetbrains.annotations.ApiStatus; 10 | 11 | public class BCLDataComponents { 12 | public static final DataComponentType ANVIL_ENTITY_DATA = DataComponentManager.registerDataComponent( 13 | BCLib.makeID("anvil_entity_data"), 14 | (DataComponentType.Builder builder) -> builder 15 | .persistent(CustomData.CODEC) 16 | .networkSynchronized(CustomData.STREAM_CODEC) 17 | ); 18 | 19 | @ApiStatus.Internal 20 | public static void ensureStaticInitialization() { 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /src/main/java/org/betterx/bclib/api/v2/ShovelAPI.java: -------------------------------------------------------------------------------- 1 | package org.betterx.bclib.api.v2; 2 | 3 | import org.betterx.bclib.mixin.common.ShovelItemAccessor; 4 | 5 | import net.minecraft.world.level.block.Block; 6 | import net.minecraft.world.level.block.state.BlockState; 7 | 8 | import java.util.Map; 9 | 10 | public class ShovelAPI { 11 | /** 12 | * Will add left-click behaviour to shovel: when it is targeting cetrain {@link Block} it will be converting to new 13 | * {@link BlockState} on usage. Example: grass converting to path. 14 | * 15 | * @param target {@link Block} that will be converted. 16 | * @param convert {@link BlockState} to convert block into. 17 | */ 18 | public static void addShovelBehaviour(Block target, BlockState convert) { 19 | Map map = ShovelItemAccessor.bclib_getFlattenables(); 20 | map.put(target, convert); 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /src/main/java/org/betterx/bclib/commands/arguments/TemplatePlacementArgument.java: -------------------------------------------------------------------------------- 1 | package org.betterx.bclib.commands.arguments; 2 | 3 | import com.mojang.brigadier.context.CommandContext; 4 | import net.minecraft.commands.CommandSourceStack; 5 | import net.minecraft.commands.arguments.StringRepresentableArgument; 6 | 7 | public class TemplatePlacementArgument 8 | extends StringRepresentableArgument { 9 | private TemplatePlacementArgument() { 10 | super(PlacementDirections.CODEC, PlacementDirections::values); 11 | } 12 | 13 | public static TemplatePlacementArgument templatePlacement() { 14 | return new TemplatePlacementArgument(); 15 | } 16 | 17 | public static PlacementDirections getPlacement(CommandContext commandContext, String string) { 18 | return commandContext.getArgument(string, PlacementDirections.class); 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /src/main/java/org/betterx/bclib/interfaces/AlloyingRecipeWorkstation.java: -------------------------------------------------------------------------------- 1 | package org.betterx.bclib.interfaces; 2 | 3 | import net.minecraft.core.registries.BuiltInRegistries; 4 | import net.minecraft.world.item.ItemStack; 5 | import net.minecraft.world.level.block.Block; 6 | import net.minecraft.world.level.block.Blocks; 7 | 8 | import java.util.List; 9 | 10 | public interface AlloyingRecipeWorkstation { 11 | static List getWorkstations() { 12 | return BuiltInRegistries.BLOCK 13 | .stream() 14 | .filter(b -> b instanceof AlloyingRecipeWorkstation) 15 | .toList(); 16 | } 17 | 18 | static ItemStack getWorkstationIcon() { 19 | var workstations = AlloyingRecipeWorkstation.getWorkstations(); 20 | if (workstations.isEmpty()) return new ItemStack(Blocks.BARRIER); 21 | return new ItemStack(workstations.get(0)); 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /src/main/java/org/betterx/bclib/mixin/common/AnvilBlockMixin.java: -------------------------------------------------------------------------------- 1 | package org.betterx.bclib.mixin.common; 2 | 3 | import org.betterx.bclib.blocks.BaseAnvilBlock; 4 | 5 | import net.minecraft.world.level.block.AnvilBlock; 6 | import net.minecraft.world.level.block.state.BlockState; 7 | 8 | import org.spongepowered.asm.mixin.Mixin; 9 | import org.spongepowered.asm.mixin.injection.At; 10 | import org.spongepowered.asm.mixin.injection.Inject; 11 | import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; 12 | 13 | @Mixin(AnvilBlock.class) 14 | public class AnvilBlockMixin { 15 | @Inject(method = "damage", at = @At("HEAD"), cancellable = true) 16 | private static void bclib_anvilDamage(BlockState state, CallbackInfoReturnable info) { 17 | if (state.getBlock() instanceof BaseAnvilBlock anvil) { 18 | info.setReturnValue(anvil.damageAnvilFall(state)); 19 | } 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /src/main/java/org/betterx/bclib/complexmaterials/entry/RecipeEntry.java: -------------------------------------------------------------------------------- 1 | package org.betterx.bclib.complexmaterials.entry; 2 | 3 | import org.betterx.bclib.complexmaterials.ComplexMaterial; 4 | import org.betterx.bclib.interfaces.TriConsumer; 5 | 6 | import net.minecraft.data.recipes.RecipeOutput; 7 | import net.minecraft.resources.ResourceLocation; 8 | 9 | public class RecipeEntry extends ComplexMaterialEntry { 10 | public interface RecipeConsumer extends TriConsumer { 11 | } 12 | 13 | final RecipeConsumer initFunction; 14 | 15 | public RecipeEntry(String suffix, RecipeConsumer initFunction) { 16 | super(suffix); 17 | this.initFunction = initFunction; 18 | } 19 | 20 | public void init(RecipeOutput context, ComplexMaterial material) { 21 | initFunction.accept(context, material, material.C.mk(getName(material.getBaseName()))); 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /src/main/java/org/betterx/bclib/furniture/renderer/RenderChair.java: -------------------------------------------------------------------------------- 1 | package org.betterx.bclib.furniture.renderer; 2 | 3 | import org.betterx.bclib.furniture.entity.EntityChair; 4 | 5 | import net.minecraft.client.renderer.entity.EntityRenderer; 6 | import net.minecraft.client.renderer.entity.EntityRendererProvider; 7 | import net.minecraft.resources.ResourceLocation; 8 | 9 | import net.fabricmc.api.EnvType; 10 | import net.fabricmc.api.Environment; 11 | 12 | @Environment(value = EnvType.CLIENT) 13 | public class RenderChair extends EntityRenderer { 14 | private static final ResourceLocation TEXTURE = ResourceLocation.withDefaultNamespace("textures/block/stone.png"); 15 | 16 | public RenderChair(EntityRendererProvider.Context context) { 17 | super(context); 18 | } 19 | 20 | @Override 21 | public ResourceLocation getTextureLocation(EntityChair entity) { 22 | return TEXTURE; 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /src/main/java/org/betterx/bclib/client/models/CustomModelData.java: -------------------------------------------------------------------------------- 1 | package org.betterx.bclib.client.models; 2 | 3 | import net.minecraft.resources.ResourceLocation; 4 | 5 | import com.google.common.collect.Sets; 6 | 7 | import java.util.Set; 8 | 9 | public class CustomModelData { 10 | private static final Set TRANSPARENT_EMISSION = Sets.newConcurrentHashSet(); 11 | 12 | public static void clear() { 13 | TRANSPARENT_EMISSION.clear(); 14 | } 15 | 16 | public static void addTransparent(ResourceLocation blockID) { 17 | TRANSPARENT_EMISSION.add(blockID); 18 | } 19 | 20 | public static boolean isTransparentEmissive(ResourceLocation rawLocation) { 21 | String name = rawLocation.getPath().replace("materialmaps/block/", "").replace(".json", ""); 22 | return TRANSPARENT_EMISSION.contains(ResourceLocation.fromNamespaceAndPath(rawLocation.getNamespace(), name)); 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /src/main/java/org/betterx/bclib/complexmaterials/set/stone/Source.java: -------------------------------------------------------------------------------- 1 | package org.betterx.bclib.complexmaterials.set.stone; 2 | 3 | import org.betterx.bclib.complexmaterials.StoneComplexMaterial; 4 | import org.betterx.bclib.complexmaterials.entry.BlockEntry; 5 | import org.betterx.bclib.complexmaterials.entry.MaterialSlot; 6 | import org.betterx.bclib.complexmaterials.entry.RecipeEntry; 7 | 8 | import java.util.function.Consumer; 9 | 10 | public class Source extends MaterialSlot { 11 | public Source() { 12 | super("source"); 13 | } 14 | 15 | 16 | @Override 17 | public void addBlockEntry(StoneComplexMaterial parentMaterial, Consumer adder) { 18 | adder.accept(new BlockEntry(suffix, true, true, (c, p) -> parentMaterial.sourceBlock)); 19 | } 20 | 21 | @Override 22 | public void addRecipeEntry(StoneComplexMaterial parentMaterial, Consumer adder) { 23 | 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /src/main/java/org/betterx/bclib/sdf/operator/SDFRotation.java: -------------------------------------------------------------------------------- 1 | package org.betterx.bclib.sdf.operator; 2 | 3 | 4 | import com.mojang.math.Axis; 5 | 6 | import org.joml.Quaternionf; 7 | import org.joml.Vector3f; 8 | 9 | public class SDFRotation extends SDFUnary { 10 | private final Vector3f pos = new Vector3f(); 11 | private Quaternionf rotation; 12 | 13 | public SDFRotation setRotation(Axis axis, float rotationAngle) { 14 | rotation = axis.rotation(rotationAngle); 15 | return this; 16 | } 17 | 18 | public SDFRotation setRotation(Vector3f axis, float rotationAngle) { 19 | rotation = new Quaternionf().setAngleAxis(rotationAngle, axis.x, axis.y, axis.z); 20 | return this; 21 | } 22 | 23 | @Override 24 | public float getDistance(float x, float y, float z) { 25 | pos.set(x, y, z); 26 | pos.rotate(rotation); 27 | return source.getDistance(pos.x(), pos.y(), pos.z()); 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /src/main/java/org/betterx/bclib/util/Triple.java: -------------------------------------------------------------------------------- 1 | package org.betterx.bclib.util; 2 | 3 | import java.util.Objects; 4 | 5 | public class Triple extends Pair { 6 | public final C third; 7 | 8 | public Triple(A first, B second, C third) { 9 | super(first, second); 10 | this.third = third; 11 | } 12 | 13 | @Override 14 | public String toString() { 15 | return "Triple{" + "first=" + first + ", second=" + second + ", third=" + third + '}'; 16 | } 17 | 18 | @Override 19 | public boolean equals(Object o) { 20 | if (this == o) return true; 21 | if (!(o instanceof Triple)) return false; 22 | if (!super.equals(o)) return false; 23 | Triple triple = (Triple) o; 24 | return Objects.equals(third, triple.third); 25 | } 26 | 27 | @Override 28 | public int hashCode() { 29 | return Objects.hash(super.hashCode(), third); 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /src/main/java/org/betterx/bclib/mixin/common/boat/BoatItemMixin.java: -------------------------------------------------------------------------------- 1 | package org.betterx.bclib.mixin.common.boat; 2 | 3 | import org.betterx.bclib.items.boat.CustomBoatTypeOverride; 4 | 5 | import net.minecraft.world.entity.Entity; 6 | import net.minecraft.world.item.BoatItem; 7 | 8 | import org.spongepowered.asm.mixin.Mixin; 9 | import org.spongepowered.asm.mixin.injection.At; 10 | import org.spongepowered.asm.mixin.injection.ModifyArg; 11 | 12 | @Mixin(BoatItem.class) 13 | public class BoatItemMixin { 14 | @ModifyArg(method = "use", at = @At(value = "INVOKE", target = "Lnet/minecraft/world/level/Level;noCollision(Lnet/minecraft/world/entity/Entity;Lnet/minecraft/world/phys/AABB;)Z")) 15 | Entity bcl_suse(Entity boat) { 16 | if (this instanceof CustomBoatTypeOverride self) { 17 | if (boat instanceof CustomBoatTypeOverride newBoat) { 18 | newBoat.bcl_setCustomType(self.bcl_getCustomType()); 19 | } 20 | } 21 | return boat; 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /src/main/java/org/betterx/bclib/client/gui/modmenu/MainScreen.java: -------------------------------------------------------------------------------- 1 | package org.betterx.bclib.client.gui.modmenu; 2 | 3 | import de.ambertation.wunderlib.ui.vanilla.ConfigScreen; 4 | import org.betterx.bclib.BCLib; 5 | import org.betterx.bclib.config.Configs; 6 | 7 | import net.minecraft.client.gui.screens.Screen; 8 | import net.minecraft.network.chat.Component; 9 | import net.minecraft.resources.ResourceLocation; 10 | 11 | import java.util.List; 12 | import org.jetbrains.annotations.Nullable; 13 | 14 | public class MainScreen extends ConfigScreen { 15 | static final ResourceLocation BCLIB_LOGO_LOCATION = ResourceLocation.fromNamespaceAndPath(BCLib.MOD_ID, "icon.png"); 16 | 17 | public MainScreen(@Nullable Screen parent) { 18 | super(parent, BCLIB_LOGO_LOCATION, Component.translatable("title.bclib.modmenu.main"), List.of(Configs.MAIN_CONFIG, Configs.CLIENT_CONFIG)); 19 | } 20 | 21 | @Override 22 | public void onClose() { 23 | super.onClose(); 24 | Configs.save(); 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /src/main/java/org/betterx/bclib/sdf/operator/SDFBinary.java: -------------------------------------------------------------------------------- 1 | package org.betterx.bclib.sdf.operator; 2 | 3 | import org.betterx.bclib.sdf.SDF; 4 | 5 | import net.minecraft.core.BlockPos; 6 | import net.minecraft.world.level.block.state.BlockState; 7 | 8 | public abstract class SDFBinary extends SDF { 9 | protected SDF sourceA; 10 | protected SDF sourceB; 11 | protected boolean firstValue; 12 | 13 | public SDFBinary setSourceA(SDF sourceA) { 14 | this.sourceA = sourceA; 15 | return this; 16 | } 17 | 18 | public SDFBinary setSourceB(SDF sourceB) { 19 | this.sourceB = sourceB; 20 | return this; 21 | } 22 | 23 | protected void selectValue(float a, float b) { 24 | firstValue = a < b; 25 | } 26 | 27 | @Override 28 | public BlockState getBlockState(BlockPos pos) { 29 | if (firstValue) { 30 | return sourceA.getBlockState(pos); 31 | } else { 32 | return sourceB.getBlockState(pos); 33 | } 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /src/main/java/org/betterx/bclib/sdf/primitive/SDFPie.java: -------------------------------------------------------------------------------- 1 | package org.betterx.bclib.sdf.primitive; 2 | 3 | import org.betterx.bclib.util.MHelper; 4 | 5 | import net.minecraft.util.Mth; 6 | 7 | public class SDFPie extends SDFPrimitive { 8 | private float sin; 9 | private float cos; 10 | private float radius; 11 | 12 | public SDFPie setAngle(float angle) { 13 | this.sin = (float) Math.sin(angle); 14 | this.cos = (float) Math.cos(angle); 15 | return this; 16 | } 17 | 18 | public SDFPie setRadius(float radius) { 19 | this.radius = radius; 20 | return this; 21 | } 22 | 23 | @Override 24 | public float getDistance(float x, float y, float z) { 25 | float px = Math.abs(x); 26 | float l = MHelper.length(px, y, z) - radius; 27 | float m = MHelper.dot(px, z, sin, cos); 28 | m = Mth.clamp(m, 0, radius); 29 | m = MHelper.length(px - sin * m, z - cos * m); 30 | return MHelper.max(l, m * Math.signum(cos * px - sin * z)); 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /src/main/java/org/betterx/bclib/mixin/client/LevelRendererAccessor.java: -------------------------------------------------------------------------------- 1 | package org.betterx.bclib.mixin.client; 2 | 3 | import com.mojang.blaze3d.vertex.PoseStack; 4 | import com.mojang.blaze3d.vertex.VertexConsumer; 5 | import net.minecraft.client.renderer.LevelRenderer; 6 | import net.minecraft.world.phys.shapes.VoxelShape; 7 | 8 | import net.fabricmc.api.EnvType; 9 | import net.fabricmc.api.Environment; 10 | 11 | import org.spongepowered.asm.mixin.Mixin; 12 | import org.spongepowered.asm.mixin.gen.Invoker; 13 | 14 | @Mixin(LevelRenderer.class) 15 | @Environment(EnvType.CLIENT) 16 | public interface LevelRendererAccessor { 17 | @Invoker("renderShape") 18 | public static void bclib_renderShape( 19 | PoseStack poseStack, 20 | VertexConsumer vertexConsumer, 21 | VoxelShape voxelShape, 22 | double d, 23 | double e, 24 | double f, 25 | float g, 26 | float h, 27 | float i, 28 | float j 29 | ) { 30 | throw new AssertionError(); 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /src/main/java/org/betterx/bclib/mixin/common/axe/AxeItemMixin.java: -------------------------------------------------------------------------------- 1 | package org.betterx.bclib.mixin.common.axe; 2 | 3 | import org.betterx.bclib.interfaces.tools.AxeCanStrip; 4 | 5 | import net.minecraft.world.item.AxeItem; 6 | import net.minecraft.world.level.block.Block; 7 | import net.minecraft.world.level.block.state.BlockState; 8 | 9 | import org.spongepowered.asm.mixin.Mixin; 10 | import org.spongepowered.asm.mixin.injection.At; 11 | import org.spongepowered.asm.mixin.injection.Inject; 12 | import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; 13 | 14 | import java.util.Optional; 15 | 16 | @Mixin(AxeItem.class) 17 | public class AxeItemMixin { 18 | @Inject(method = "getStripped", at = @At("HEAD"), cancellable = true) 19 | void bclib_getStripped(BlockState blockState, CallbackInfoReturnable> cir) { 20 | final Block block = blockState.getBlock(); 21 | if (block instanceof AxeCanStrip stripable) { 22 | cir.setReturnValue(Optional.of(stripable.strippedState(blockState))); 23 | } 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /src/main/java/org/betterx/bclib/mixin/client/ClientRecipeBookMixin.java: -------------------------------------------------------------------------------- 1 | package org.betterx.bclib.mixin.client; 2 | 3 | import org.betterx.bclib.interfaces.UnknownReceipBookCategory; 4 | 5 | import net.minecraft.client.ClientRecipeBook; 6 | import net.minecraft.client.RecipeBookCategories; 7 | import net.minecraft.world.item.crafting.RecipeHolder; 8 | 9 | import org.spongepowered.asm.mixin.Mixin; 10 | import org.spongepowered.asm.mixin.injection.At; 11 | import org.spongepowered.asm.mixin.injection.Inject; 12 | import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; 13 | 14 | @Mixin(ClientRecipeBook.class) 15 | public abstract class ClientRecipeBookMixin { 16 | @Inject(method = "getCategory", at = @At("HEAD"), cancellable = true) 17 | private static void be_getGroupForRecipe( 18 | RecipeHolder recipe, 19 | CallbackInfoReturnable cir 20 | ) { 21 | if (recipe.value() instanceof UnknownReceipBookCategory) { 22 | cir.setReturnValue(RecipeBookCategories.UNKNOWN); 23 | } 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /src/main/java/org/betterx/bclib/config/ConfigUI.java: -------------------------------------------------------------------------------- 1 | package org.betterx.bclib.config; 2 | 3 | import java.lang.annotation.ElementType; 4 | import java.lang.annotation.Retention; 5 | import java.lang.annotation.RetentionPolicy; 6 | import java.lang.annotation.Target; 7 | 8 | @Retention(RetentionPolicy.RUNTIME) 9 | @Target({ElementType.FIELD}) 10 | public @interface ConfigUI { 11 | /** 12 | * When {@code true}, this option will not generate UI-Elements. 13 | */ 14 | boolean hide() default false; 15 | 16 | /** 17 | * When a Widget is generated for this option, it will be indented by this Value 18 | */ 19 | int leftPadding() default 0; 20 | 21 | /** 22 | * When a Widget is generated for this option, it will be indented by this Value 23 | */ 24 | int topPadding() default 0; 25 | 26 | /** 27 | * When a Slider is generated, this will be the minimum Value 28 | */ 29 | int minValue() default 0; 30 | 31 | /** 32 | * When a Slider is generated, this will be the maximu Value 33 | */ 34 | int maxValue() default 0; 35 | } 36 | -------------------------------------------------------------------------------- /src/main/java/org/betterx/datagen/bclib/worldgen/BoneMealBlockTagProvider.java: -------------------------------------------------------------------------------- 1 | package org.betterx.datagen.bclib.worldgen; 2 | 3 | import org.betterx.bclib.api.v3.tag.BCLBlockTags; 4 | import org.betterx.wover.core.api.ModCore; 5 | import org.betterx.wover.datagen.api.WoverTagProvider; 6 | import org.betterx.wover.tag.api.event.context.TagBootstrapContext; 7 | 8 | import net.minecraft.world.level.block.Block; 9 | import net.minecraft.world.level.block.Blocks; 10 | 11 | public class BoneMealBlockTagProvider extends WoverTagProvider.ForBlocks { 12 | public BoneMealBlockTagProvider(ModCore modCore) { 13 | super(modCore); 14 | } 15 | 16 | 17 | @Override 18 | public void prepareTags(TagBootstrapContext context) { 19 | context.add(BCLBlockTags.BONEMEAL_SOURCE_NETHERRACK, Blocks.WARPED_NYLIUM, Blocks.CRIMSON_NYLIUM); 20 | context.add(BCLBlockTags.BONEMEAL_TARGET_NETHERRACK, Blocks.NETHERRACK); 21 | context.add(BCLBlockTags.BONEMEAL_TARGET_END_STONE, Blocks.END_STONE); 22 | context.add(BCLBlockTags.BONEMEAL_TARGET_OBSIDIAN, Blocks.OBSIDIAN); 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /src/main/java/org/betterx/bclib/commands/arguments/BCLibArguments.java: -------------------------------------------------------------------------------- 1 | package org.betterx.bclib.commands.arguments; 2 | 3 | import org.betterx.bclib.BCLib; 4 | 5 | import net.minecraft.commands.synchronization.SingletonArgumentInfo; 6 | 7 | import net.fabricmc.fabric.api.command.v2.ArgumentTypeRegistry; 8 | 9 | public class BCLibArguments { 10 | public static void register() { 11 | ArgumentTypeRegistry.registerArgumentType( 12 | BCLib.makeID("template_placement"), 13 | TemplatePlacementArgument.class, 14 | SingletonArgumentInfo.contextFree(TemplatePlacementArgument::templatePlacement) 15 | ); 16 | 17 | ArgumentTypeRegistry.registerArgumentType( 18 | BCLib.makeID("float3"), 19 | Float3ArgumentType.class, 20 | new Float3ArgumentInfo() 21 | ); 22 | 23 | ArgumentTypeRegistry.registerArgumentType( 24 | BCLib.makeID("connector"), 25 | ConnectorArgument.class, 26 | SingletonArgumentInfo.contextFree(ConnectorArgument::id) 27 | ); 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /src/main/java/org/betterx/bclib/complexmaterials/set/wood/Slab.java: -------------------------------------------------------------------------------- 1 | package org.betterx.bclib.complexmaterials.set.wood; 2 | 3 | import org.betterx.bclib.blocks.BaseSlabBlock; 4 | import org.betterx.bclib.complexmaterials.WoodenComplexMaterial; 5 | import org.betterx.bclib.complexmaterials.entry.MaterialSlot; 6 | import org.betterx.bclib.complexmaterials.set.common.AbstractSlab; 7 | 8 | import net.minecraft.world.level.block.Block; 9 | import net.minecraft.world.level.block.state.BlockBehaviour; 10 | 11 | import org.jetbrains.annotations.NotNull; 12 | import org.jetbrains.annotations.Nullable; 13 | 14 | public class Slab extends AbstractSlab { 15 | 16 | @Override 17 | protected @NotNull Block createBlock( 18 | WoodenComplexMaterial parentMaterial, BlockBehaviour.Properties settings 19 | ) { 20 | return new BaseSlabBlock.Wood(parentMaterial.getBlock(WoodSlots.PLANKS), !parentMaterial.woodType.flammable); 21 | } 22 | 23 | 24 | @Override 25 | protected @Nullable MaterialSlot getSourceBlockSlot() { 26 | return WoodSlots.PLANKS; 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /src/main/java/org/betterx/bclib/complexmaterials/set/wood/Stairs.java: -------------------------------------------------------------------------------- 1 | package org.betterx.bclib.complexmaterials.set.wood; 2 | 3 | import org.betterx.bclib.blocks.BaseStairsBlock; 4 | import org.betterx.bclib.complexmaterials.WoodenComplexMaterial; 5 | import org.betterx.bclib.complexmaterials.entry.MaterialSlot; 6 | import org.betterx.bclib.complexmaterials.set.common.AbstractStairs; 7 | 8 | import net.minecraft.world.level.block.Block; 9 | import net.minecraft.world.level.block.state.BlockBehaviour; 10 | 11 | import org.jetbrains.annotations.NotNull; 12 | import org.jetbrains.annotations.Nullable; 13 | 14 | public class Stairs extends AbstractStairs { 15 | 16 | @Override 17 | protected @NotNull Block createBlock( 18 | WoodenComplexMaterial parentMaterial, BlockBehaviour.Properties settings 19 | ) { 20 | return new BaseStairsBlock.Wood(parentMaterial.getBlock(WoodSlots.PLANKS), !parentMaterial.woodType.flammable); 21 | } 22 | 23 | @Override 24 | protected @Nullable MaterialSlot getSourceBlockSlot() { 25 | return WoodSlots.PLANKS; 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /src/main/java/org/betterx/bclib/items/tool/BaseAxeItem.java: -------------------------------------------------------------------------------- 1 | package org.betterx.bclib.items.tool; 2 | 3 | import org.betterx.bclib.client.models.ModelsHelper; 4 | import org.betterx.bclib.interfaces.ItemModelProvider; 5 | 6 | import net.minecraft.client.renderer.block.model.BlockModel; 7 | import net.minecraft.resources.ResourceLocation; 8 | import net.minecraft.world.item.AxeItem; 9 | import net.minecraft.world.item.Tier; 10 | 11 | import net.fabricmc.api.EnvType; 12 | import net.fabricmc.api.Environment; 13 | 14 | public class BaseAxeItem extends AxeItem implements ItemModelProvider { 15 | public BaseAxeItem(Tier material, float attackDamage, float attackSpeed, Properties settings) { 16 | this(material, settings.attributes(AxeItem.createAttributes(material, attackDamage, attackSpeed))); 17 | } 18 | 19 | public BaseAxeItem(Tier material, Properties settings) { 20 | super(material, settings); 21 | } 22 | 23 | @Override 24 | @Environment(EnvType.CLIENT) 25 | public BlockModel getItemModel(ResourceLocation resourceLocation) { 26 | return ModelsHelper.createHandheldItem(resourceLocation); 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /src/main/java/org/betterx/bclib/items/tool/BaseHoeItem.java: -------------------------------------------------------------------------------- 1 | package org.betterx.bclib.items.tool; 2 | 3 | import org.betterx.bclib.client.models.ModelsHelper; 4 | import org.betterx.bclib.interfaces.ItemModelProvider; 5 | 6 | import net.minecraft.client.renderer.block.model.BlockModel; 7 | import net.minecraft.resources.ResourceLocation; 8 | import net.minecraft.world.item.HoeItem; 9 | import net.minecraft.world.item.Tier; 10 | 11 | import net.fabricmc.api.EnvType; 12 | import net.fabricmc.api.Environment; 13 | 14 | public class BaseHoeItem extends HoeItem implements ItemModelProvider { 15 | public BaseHoeItem(Tier material, int attackDamage, float attackSpeed, Properties settings) { 16 | this(material, settings.attributes(HoeItem.createAttributes(material, attackDamage, attackSpeed))); 17 | } 18 | 19 | public BaseHoeItem(Tier material, Properties settings) { 20 | super(material, settings); 21 | } 22 | 23 | @Override 24 | @Environment(EnvType.CLIENT) 25 | public BlockModel getItemModel(ResourceLocation resourceLocation) { 26 | return ModelsHelper.createHandheldItem(resourceLocation); 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /src/main/java/org/betterx/bclib/api/v3/bonemeal/TaggedBonemealBlockSpreader.java: -------------------------------------------------------------------------------- 1 | package org.betterx.bclib.api.v3.bonemeal; 2 | 3 | import net.minecraft.core.BlockPos; 4 | import net.minecraft.tags.TagKey; 5 | import net.minecraft.world.level.BlockGetter; 6 | import net.minecraft.world.level.block.Block; 7 | import net.minecraft.world.level.block.state.BlockState; 8 | 9 | class TaggedBonemealBlockSpreader extends BlockSpreader { 10 | public final TagKey blockTag; 11 | 12 | public TaggedBonemealBlockSpreader(TagKey blockTag) { 13 | this.blockTag = blockTag; 14 | } 15 | 16 | @Override 17 | public boolean canSpreadAt(BlockGetter blockGetter, BlockPos blockPos) { 18 | final BlockState aboveState = blockGetter.getBlockState(blockPos.above()); 19 | return aboveState.isAir() && aboveState.propagatesSkylightDown(blockGetter, blockPos); 20 | } 21 | 22 | @Override 23 | protected boolean isValidSource(BlockState state) { 24 | return state.is(blockTag); 25 | } 26 | 27 | @Override 28 | protected boolean hasCustomBehaviour(BlockState state) { 29 | return true; 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /src/main/java/org/betterx/bclib/mixin/client/AtlasSetMixin.java: -------------------------------------------------------------------------------- 1 | package org.betterx.bclib.mixin.client; 2 | 3 | import org.betterx.bclib.client.textures.AtlasSetManager; 4 | 5 | import net.minecraft.client.renderer.texture.atlas.SpriteSource; 6 | import net.minecraft.client.renderer.texture.atlas.SpriteSourceList; 7 | import net.minecraft.resources.ResourceLocation; 8 | import net.minecraft.server.packs.resources.ResourceManager; 9 | 10 | import org.spongepowered.asm.mixin.Mixin; 11 | import org.spongepowered.asm.mixin.injection.At; 12 | import org.spongepowered.asm.mixin.injection.ModifyVariable; 13 | 14 | import java.util.List; 15 | 16 | @Mixin(SpriteSourceList.class) 17 | public class AtlasSetMixin { 18 | @ModifyVariable(method = "load", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/renderer/texture/atlas/SpriteSourceList;(Ljava/util/List;)V")) 19 | private static List bcl_load( 20 | List list, 21 | ResourceManager resourceManager, 22 | ResourceLocation type 23 | ) { 24 | AtlasSetManager.onLoadResources(type, list); 25 | return list; 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /src/main/java/org/betterx/bclib/mixin/common/shears/SheepMixin.java: -------------------------------------------------------------------------------- 1 | package org.betterx.bclib.mixin.common.shears; 2 | 3 | import org.betterx.bclib.items.tool.BaseShearsItem; 4 | 5 | import net.minecraft.world.entity.animal.Sheep; 6 | import net.minecraft.world.item.Item; 7 | import net.minecraft.world.item.ItemStack; 8 | import net.minecraft.world.item.Items; 9 | 10 | import com.llamalad7.mixinextras.injector.wrapoperation.Operation; 11 | import com.llamalad7.mixinextras.injector.wrapoperation.WrapOperation; 12 | import org.spongepowered.asm.mixin.Mixin; 13 | import org.spongepowered.asm.mixin.injection.At; 14 | 15 | @Mixin(Sheep.class) 16 | public class SheepMixin { 17 | @WrapOperation( 18 | method = "mobInteract", 19 | at = @At( 20 | value = "INVOKE", 21 | target = "Lnet/minecraft/world/item/ItemStack;is(Lnet/minecraft/world/item/Item;)Z" 22 | ) 23 | ) 24 | private boolean bclib_isShears(ItemStack instance, Item item, Operation original) { 25 | return original.call(instance, item) || (item == Items.SHEARS && BaseShearsItem.isShear(instance)); 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /src/main/java/org/betterx/bclib/items/tool/BaseSwordItem.java: -------------------------------------------------------------------------------- 1 | package org.betterx.bclib.items.tool; 2 | 3 | import org.betterx.bclib.client.models.ModelsHelper; 4 | import org.betterx.bclib.interfaces.ItemModelProvider; 5 | 6 | import net.minecraft.client.renderer.block.model.BlockModel; 7 | import net.minecraft.resources.ResourceLocation; 8 | import net.minecraft.world.item.SwordItem; 9 | import net.minecraft.world.item.Tier; 10 | 11 | import net.fabricmc.api.EnvType; 12 | import net.fabricmc.api.Environment; 13 | 14 | public class BaseSwordItem extends SwordItem implements ItemModelProvider { 15 | public BaseSwordItem(Tier material, Properties settings) { 16 | super(material, settings); 17 | } 18 | 19 | public BaseSwordItem(Tier material, int attackDamage, float attackSpeed, Properties settings) { 20 | this(material, settings.attributes(SwordItem.createAttributes(material, attackDamage, attackSpeed))); 21 | } 22 | 23 | @Override 24 | @Environment(EnvType.CLIENT) 25 | public BlockModel getItemModel(ResourceLocation resourceLocation) { 26 | return ModelsHelper.createHandheldItem(resourceLocation); 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /src/main/java/org/betterx/bclib/mixin/common/PlacementContextMixin.java: -------------------------------------------------------------------------------- 1 | package org.betterx.bclib.mixin.common; 2 | 3 | import net.minecraft.world.level.block.Mirror; 4 | import net.minecraft.world.level.block.Rotation; 5 | import net.minecraft.world.level.levelgen.placement.PlacementContext; 6 | 7 | import org.spongepowered.asm.mixin.Mixin; 8 | import org.spongepowered.asm.mixin.Unique; 9 | 10 | @Mixin(PlacementContext.class) 11 | public class PlacementContextMixin implements org.betterx.bclib.interfaces.BCLPlacementContext { 12 | @Unique 13 | private Rotation bcl_rotation = Rotation.NONE; 14 | @Unique 15 | private Mirror bcl_mirror = Mirror.NONE; 16 | 17 | 18 | @Override 19 | public Rotation bcl_getRotation() { 20 | return bcl_rotation; 21 | } 22 | 23 | @Override 24 | public void bcl_setRotation(Rotation bcl_rotation) { 25 | this.bcl_rotation = bcl_rotation; 26 | } 27 | 28 | @Override 29 | public Mirror bcl_getMirror() { 30 | return bcl_mirror; 31 | } 32 | 33 | @Override 34 | public void bcl_setMirror(Mirror bcl_mirror) { 35 | this.bcl_mirror = bcl_mirror; 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /src/main/java/org/betterx/bclib/items/tool/BaseShovelItem.java: -------------------------------------------------------------------------------- 1 | package org.betterx.bclib.items.tool; 2 | 3 | import org.betterx.bclib.client.models.ModelsHelper; 4 | import org.betterx.bclib.interfaces.ItemModelProvider; 5 | 6 | import net.minecraft.client.renderer.block.model.BlockModel; 7 | import net.minecraft.resources.ResourceLocation; 8 | import net.minecraft.world.item.ShovelItem; 9 | import net.minecraft.world.item.Tier; 10 | 11 | import net.fabricmc.api.EnvType; 12 | import net.fabricmc.api.Environment; 13 | 14 | public class BaseShovelItem extends ShovelItem implements ItemModelProvider { 15 | public BaseShovelItem(Tier material, float attackDamage, float attackSpeed, Properties settings) { 16 | this(material, settings.attributes(ShovelItem.createAttributes(material, attackDamage, attackSpeed))); 17 | } 18 | 19 | public BaseShovelItem(Tier material, Properties settings) { 20 | super(material, settings); 21 | } 22 | 23 | @Override 24 | @Environment(EnvType.CLIENT) 25 | public BlockModel getItemModel(ResourceLocation resourceLocation) { 26 | return ModelsHelper.createHandheldItem(resourceLocation); 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /src/main/java/org/betterx/bclib/items/tool/BasePickaxeItem.java: -------------------------------------------------------------------------------- 1 | package org.betterx.bclib.items.tool; 2 | 3 | import org.betterx.bclib.client.models.ModelsHelper; 4 | import org.betterx.bclib.interfaces.ItemModelProvider; 5 | 6 | import net.minecraft.client.renderer.block.model.BlockModel; 7 | import net.minecraft.resources.ResourceLocation; 8 | import net.minecraft.world.item.PickaxeItem; 9 | import net.minecraft.world.item.Tier; 10 | 11 | import net.fabricmc.api.EnvType; 12 | import net.fabricmc.api.Environment; 13 | 14 | public class BasePickaxeItem extends PickaxeItem implements ItemModelProvider { 15 | public BasePickaxeItem(Tier material, int attackDamage, float attackSpeed, Properties settings) { 16 | this(material, settings.attributes(PickaxeItem.createAttributes(material, attackDamage, attackSpeed))); 17 | } 18 | 19 | public BasePickaxeItem(Tier material, Properties settings) { 20 | super(material, settings); 21 | } 22 | 23 | @Override 24 | @Environment(EnvType.CLIENT) 25 | public BlockModel getItemModel(ResourceLocation resourceLocation) { 26 | return ModelsHelper.createHandheldItem(resourceLocation); 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /src/main/java/org/betterx/bclib/items/tool/BaseShearsItem.java: -------------------------------------------------------------------------------- 1 | package org.betterx.bclib.items.tool; 2 | 3 | 4 | import org.betterx.wover.tag.api.TagManager; 5 | import org.betterx.wover.tag.api.predefined.CommonItemTags; 6 | import org.betterx.wover.tag.api.predefined.MineableTags; 7 | 8 | import net.minecraft.world.item.Item; 9 | import net.minecraft.world.item.ItemStack; 10 | import net.minecraft.world.item.Items; 11 | import net.minecraft.world.item.ShearsItem; 12 | 13 | public class BaseShearsItem extends ShearsItem { 14 | public BaseShearsItem(Properties properties) { 15 | super(properties); 16 | } 17 | 18 | public static boolean isShear(ItemStack tool) { 19 | return tool.is(Items.SHEARS) | tool.is(CommonItemTags.SHEARS) || TagManager.isToolWithMineableTag( 20 | tool, 21 | MineableTags.SHEARS 22 | ); 23 | } 24 | 25 | public static boolean isShear(ItemStack itemStack, Item item) { 26 | if (item == Items.SHEARS) { 27 | return itemStack.is(item) | itemStack.is(CommonItemTags.SHEARS); 28 | } else { 29 | return itemStack.is(item); 30 | } 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /src/main/java/org/betterx/bclib/mixin/common/shears/SnowGolemMixin.java: -------------------------------------------------------------------------------- 1 | package org.betterx.bclib.mixin.common.shears; 2 | 3 | import org.betterx.bclib.items.tool.BaseShearsItem; 4 | 5 | import net.minecraft.world.entity.animal.SnowGolem; 6 | import net.minecraft.world.item.Item; 7 | import net.minecraft.world.item.ItemStack; 8 | import net.minecraft.world.item.Items; 9 | 10 | import com.llamalad7.mixinextras.injector.wrapoperation.Operation; 11 | import com.llamalad7.mixinextras.injector.wrapoperation.WrapOperation; 12 | import org.spongepowered.asm.mixin.Mixin; 13 | import org.spongepowered.asm.mixin.injection.At; 14 | 15 | @Mixin(SnowGolem.class) 16 | public class SnowGolemMixin { 17 | @WrapOperation( 18 | method = "mobInteract", 19 | at = @At( 20 | value = "INVOKE", 21 | target = "Lnet/minecraft/world/item/ItemStack;is(Lnet/minecraft/world/item/Item;)Z" 22 | ) 23 | ) 24 | private boolean bclib_isShears(ItemStack instance, Item item, Operation original) { 25 | return original.call(instance, item) || (item == Items.SHEARS && BaseShearsItem.isShear(instance)); 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /src/main/java/org/betterx/bclib/integration/emi/EMIAlloyingRecipe.java: -------------------------------------------------------------------------------- 1 | package org.betterx.bclib.integration.emi; 2 | 3 | import org.betterx.bclib.BCLib; 4 | import org.betterx.bclib.recipes.AlloyingRecipe; 5 | import org.betterx.bclib.recipes.AlloyingRecipeInput; 6 | 7 | import net.minecraft.world.item.crafting.RecipeHolder; 8 | import net.minecraft.world.item.crafting.RecipeManager; 9 | 10 | import dev.emi.emi.api.EmiRegistry; 11 | 12 | public class EMIAlloyingRecipe extends EMIAbstractAlloyingRecipe { 13 | public EMIAlloyingRecipe(RecipeHolder recipe) { 14 | super(recipe, recipe.id(), 1, false); 15 | } 16 | 17 | @Override 18 | protected int getSmeltTime() { 19 | return recipe.getSmeltTime(); 20 | } 21 | 22 | @Override 23 | protected float getExperience() { 24 | return recipe.getExperience(); 25 | } 26 | 27 | static void addAllRecipes(EmiRegistry emiRegistry, RecipeManager manager) { 28 | EMIPlugin.addAllRecipes( 29 | emiRegistry, manager, BCLib.LOGGER, 30 | AlloyingRecipe.TYPE, EMIAlloyingRecipe::new 31 | ); 32 | } 33 | } -------------------------------------------------------------------------------- /src/main/java/org/betterx/bclib/items/elytra/BCLElytraItem.java: -------------------------------------------------------------------------------- 1 | package org.betterx.bclib.items.elytra; 2 | 3 | import net.minecraft.resources.ResourceLocation; 4 | import net.minecraft.world.entity.LivingEntity; 5 | import net.minecraft.world.item.ItemStack; 6 | import net.minecraft.world.level.gameevent.GameEvent; 7 | 8 | import net.fabricmc.fabric.api.entity.event.v1.FabricElytraItem; 9 | 10 | public interface BCLElytraItem extends FabricElytraItem { 11 | ResourceLocation getModelTexture(); 12 | 13 | double getMovementFactor(); 14 | 15 | 16 | default void doVanillaElytraTick(LivingEntity entity, ItemStack chestStack) { 17 | vanillaElytraTick(entity, chestStack); 18 | } 19 | 20 | static void vanillaElytraTick(LivingEntity entity, ItemStack chestStack) { 21 | int nextRoll = entity.getFallFlyingTicks() + 1; 22 | 23 | if (!entity.level().isClientSide && nextRoll % 10 == 0) { 24 | if ((nextRoll / 10) % 2 == 0) { 25 | BCLElytraUtils.onBreak.accept(entity, chestStack); 26 | return; 27 | } 28 | 29 | entity.gameEvent(GameEvent.ELYTRA_GLIDE); 30 | } 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /src/main/java/org/betterx/bclib/mixin/common/shears/BeehiveBlockMixin.java: -------------------------------------------------------------------------------- 1 | package org.betterx.bclib.mixin.common.shears; 2 | 3 | import org.betterx.bclib.items.tool.BaseShearsItem; 4 | 5 | import net.minecraft.world.item.Item; 6 | import net.minecraft.world.item.ItemStack; 7 | import net.minecraft.world.item.Items; 8 | import net.minecraft.world.level.block.BeehiveBlock; 9 | 10 | import com.llamalad7.mixinextras.injector.wrapoperation.Operation; 11 | import com.llamalad7.mixinextras.injector.wrapoperation.WrapOperation; 12 | import org.spongepowered.asm.mixin.Mixin; 13 | import org.spongepowered.asm.mixin.injection.At; 14 | 15 | @Mixin(BeehiveBlock.class) 16 | public class BeehiveBlockMixin { 17 | @WrapOperation( 18 | method = "useItemOn", 19 | at = @At( 20 | value = "INVOKE", 21 | target = "Lnet/minecraft/world/item/ItemStack;is(Lnet/minecraft/world/item/Item;)Z" 22 | ) 23 | ) 24 | private boolean bclib_isShears(ItemStack instance, Item item, Operation original) { 25 | return original.call(instance, item) || (item == Items.SHEARS && BaseShearsItem.isShear(instance)); 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /src/main/java/org/betterx/bclib/mixin/common/shears/MushroomCowMixin.java: -------------------------------------------------------------------------------- 1 | package org.betterx.bclib.mixin.common.shears; 2 | 3 | import org.betterx.bclib.items.tool.BaseShearsItem; 4 | 5 | import net.minecraft.world.entity.animal.MushroomCow; 6 | import net.minecraft.world.item.Item; 7 | import net.minecraft.world.item.ItemStack; 8 | import net.minecraft.world.item.Items; 9 | 10 | import com.llamalad7.mixinextras.injector.wrapoperation.Operation; 11 | import com.llamalad7.mixinextras.injector.wrapoperation.WrapOperation; 12 | import org.spongepowered.asm.mixin.Mixin; 13 | import org.spongepowered.asm.mixin.injection.At; 14 | 15 | @Mixin(MushroomCow.class) 16 | public class MushroomCowMixin { 17 | @WrapOperation( 18 | method = "mobInteract", 19 | at = @At( 20 | value = "INVOKE", 21 | target = "Lnet/minecraft/world/item/ItemStack;is(Lnet/minecraft/world/item/Item;)Z" 22 | ) 23 | ) 24 | private boolean bclib_isShears(ItemStack instance, Item item, Operation original) { 25 | return original.call(instance, item) || (item == Items.SHEARS && BaseShearsItem.isShear(instance)); 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /src/main/java/org/betterx/bclib/mixin/common/WorldGenRegionMixin.java: -------------------------------------------------------------------------------- 1 | package org.betterx.bclib.mixin.common; 2 | 3 | import net.minecraft.core.BlockPos; 4 | import net.minecraft.server.level.WorldGenRegion; 5 | import net.minecraft.world.level.chunk.ChunkAccess; 6 | 7 | import org.spongepowered.asm.mixin.Final; 8 | import org.spongepowered.asm.mixin.Mixin; 9 | import org.spongepowered.asm.mixin.Shadow; 10 | import org.spongepowered.asm.mixin.injection.At; 11 | import org.spongepowered.asm.mixin.injection.Inject; 12 | import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; 13 | 14 | @Mixin(WorldGenRegion.class) 15 | public class WorldGenRegionMixin { 16 | @Final 17 | @Shadow 18 | private ChunkAccess center; 19 | 20 | @Inject(method = "ensureCanWrite", at = @At("HEAD"), cancellable = true) 21 | private void be_alterBlockCheck(BlockPos blockPos, CallbackInfoReturnable info) { 22 | int x = blockPos.getX() >> 4; 23 | int z = blockPos.getZ() >> 4; 24 | WorldGenRegion region = (WorldGenRegion) (Object) this; 25 | info.setReturnValue(Math.abs(x - center.getPos().x) < 2 && Math.abs(z - center.getPos().z) < 2); 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /src/main/java/org/betterx/bclib/mixin/common/shears/PumpkinBlockMixin.java: -------------------------------------------------------------------------------- 1 | package org.betterx.bclib.mixin.common.shears; 2 | 3 | import org.betterx.bclib.items.tool.BaseShearsItem; 4 | 5 | import net.minecraft.world.item.Item; 6 | import net.minecraft.world.item.ItemStack; 7 | import net.minecraft.world.item.Items; 8 | import net.minecraft.world.level.block.PumpkinBlock; 9 | 10 | import com.llamalad7.mixinextras.injector.wrapoperation.Operation; 11 | import com.llamalad7.mixinextras.injector.wrapoperation.WrapOperation; 12 | import org.spongepowered.asm.mixin.Mixin; 13 | import org.spongepowered.asm.mixin.injection.At; 14 | 15 | @Mixin(PumpkinBlock.class) 16 | public abstract class PumpkinBlockMixin { 17 | @WrapOperation( 18 | method = "useItemOn", 19 | at = @At( 20 | value = "INVOKE", 21 | target = "Lnet/minecraft/world/item/ItemStack;is(Lnet/minecraft/world/item/Item;)Z" 22 | ) 23 | ) 24 | private boolean bclib_isShears(ItemStack instance, Item item, Operation original) { 25 | return original.call(instance, item) || (item == Items.SHEARS && BaseShearsItem.isShear(instance)); 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /src/main/java/org/betterx/bclib/mixin/common/shears/TripWireBlockMixin.java: -------------------------------------------------------------------------------- 1 | package org.betterx.bclib.mixin.common.shears; 2 | 3 | import org.betterx.bclib.items.tool.BaseShearsItem; 4 | 5 | import net.minecraft.world.item.Item; 6 | import net.minecraft.world.item.ItemStack; 7 | import net.minecraft.world.item.Items; 8 | import net.minecraft.world.level.block.TripWireBlock; 9 | 10 | import com.llamalad7.mixinextras.injector.wrapoperation.Operation; 11 | import com.llamalad7.mixinextras.injector.wrapoperation.WrapOperation; 12 | import org.spongepowered.asm.mixin.Mixin; 13 | import org.spongepowered.asm.mixin.injection.At; 14 | 15 | @Mixin(TripWireBlock.class) 16 | public class TripWireBlockMixin { 17 | @WrapOperation( 18 | method = "playerWillDestroy", 19 | at = @At( 20 | value = "INVOKE", 21 | target = "Lnet/minecraft/world/item/ItemStack;is(Lnet/minecraft/world/item/Item;)Z" 22 | ) 23 | ) 24 | private boolean bclib_isShears(ItemStack instance, Item item, Operation original) { 25 | return original.call(instance, item) || (item == Items.SHEARS && BaseShearsItem.isShear(instance)); 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /src/main/java/org/betterx/bclib/complexmaterials/entry/ComplexMaterialEntry.java: -------------------------------------------------------------------------------- 1 | package org.betterx.bclib.complexmaterials.entry; 2 | 3 | import java.util.Objects; 4 | import org.jetbrains.annotations.NotNull; 5 | 6 | public abstract class ComplexMaterialEntry { 7 | @NotNull 8 | private final String suffix; 9 | 10 | protected ComplexMaterialEntry(String suffix) { 11 | this.suffix = suffix; 12 | } 13 | 14 | public String getName(String baseName) { 15 | return baseName + "_" + suffix; 16 | } 17 | 18 | // public ResourceLocation getLocation(String modID, String baseName) { 19 | // return ResourceLocation.fromNamespaceAndPath(modID, getName(baseName)); 20 | // } 21 | 22 | public String getSuffix() { 23 | return suffix; 24 | } 25 | 26 | @Override 27 | public boolean equals(Object o) { 28 | if (this == o) return true; 29 | if (o == null || getClass() != o.getClass()) return false; 30 | ComplexMaterialEntry that = (ComplexMaterialEntry) o; 31 | return suffix.equals(that.suffix); 32 | } 33 | 34 | @Override 35 | public int hashCode() { 36 | return Objects.hash(suffix); 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /src/main/java/org/betterx/bclib/recipes/AlloyingRecipeInput.java: -------------------------------------------------------------------------------- 1 | package org.betterx.bclib.recipes; 2 | 3 | import net.minecraft.world.item.ItemStack; 4 | import net.minecraft.world.item.crafting.RecipeInput; 5 | 6 | import org.jetbrains.annotations.NotNull; 7 | 8 | public record AlloyingRecipeInput(ItemStack first, ItemStack second) implements RecipeInput { 9 | public AlloyingRecipeInput(ItemStack first) { 10 | this(first, ItemStack.EMPTY); 11 | } 12 | 13 | public AlloyingRecipeInput(ItemStack first, ItemStack second) { 14 | this.first = first == null ? ItemStack.EMPTY : first; 15 | this.second = second == null ? ItemStack.EMPTY : second; 16 | } 17 | 18 | public ItemStack any() { 19 | return first.isEmpty() ? second : first; 20 | } 21 | 22 | public void shrinkBoth() { 23 | this.first.shrink(1); 24 | this.second.shrink(1); 25 | } 26 | 27 | @Override 28 | public @NotNull ItemStack getItem(int i) { 29 | if (i == 0) return first; 30 | if (i == 1) return second; 31 | 32 | return ItemStack.EMPTY; 33 | } 34 | 35 | @Override 36 | public int size() { 37 | return 2; 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /src/main/java/org/betterx/bclib/mixin/client/BlockMixin.java: -------------------------------------------------------------------------------- 1 | package org.betterx.bclib.mixin.client; 2 | 3 | import org.betterx.bclib.interfaces.SurvivesOnSpecialGround; 4 | 5 | import net.minecraft.network.chat.Component; 6 | import net.minecraft.world.item.Item; 7 | import net.minecraft.world.item.ItemStack; 8 | import net.minecraft.world.item.TooltipFlag; 9 | import net.minecraft.world.level.block.Block; 10 | 11 | import org.spongepowered.asm.mixin.Mixin; 12 | import org.spongepowered.asm.mixin.injection.At; 13 | import org.spongepowered.asm.mixin.injection.Inject; 14 | import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; 15 | 16 | import java.util.List; 17 | 18 | @Mixin(Block.class) 19 | public class BlockMixin { 20 | @Inject(method = "appendHoverText", at = @At("HEAD")) 21 | void bclib_appendSurvivalBlock( 22 | ItemStack itemStack, 23 | Item.TooltipContext tooltipContext, 24 | List list, 25 | TooltipFlag tooltipFlag, 26 | CallbackInfo ci 27 | ) { 28 | if (this instanceof SurvivesOnSpecialGround surv) { 29 | SurvivesOnSpecialGround.appendHoverText(surv, list); 30 | } 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /src/main/java/org/betterx/bclib/blockentities/BaseFurnaceBlockEntity.java: -------------------------------------------------------------------------------- 1 | package org.betterx.bclib.blockentities; 2 | 3 | import org.betterx.bclib.registry.BaseBlockEntities; 4 | 5 | import net.minecraft.core.BlockPos; 6 | import net.minecraft.network.chat.Component; 7 | import net.minecraft.world.entity.player.Inventory; 8 | import net.minecraft.world.inventory.AbstractContainerMenu; 9 | import net.minecraft.world.inventory.FurnaceMenu; 10 | import net.minecraft.world.item.crafting.RecipeType; 11 | import net.minecraft.world.level.block.entity.AbstractFurnaceBlockEntity; 12 | import net.minecraft.world.level.block.state.BlockState; 13 | 14 | public class BaseFurnaceBlockEntity extends AbstractFurnaceBlockEntity { 15 | public BaseFurnaceBlockEntity(BlockPos blockPos, BlockState blockState) { 16 | super(BaseBlockEntities.FURNACE, blockPos, blockState, RecipeType.SMELTING); 17 | } 18 | 19 | protected Component getDefaultName() { 20 | return Component.translatable("container.furnace"); 21 | } 22 | 23 | protected AbstractContainerMenu createMenu(int syncId, Inventory playerInventory) { 24 | return new FurnaceMenu(syncId, playerInventory, this, this.dataAccess); 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /src/main/java/org/betterx/bclib/client/textures/AtlasSetManager.java: -------------------------------------------------------------------------------- 1 | package org.betterx.bclib.client.textures; 2 | 3 | import net.minecraft.client.renderer.texture.atlas.SpriteSource; 4 | import net.minecraft.resources.ResourceLocation; 5 | 6 | import net.fabricmc.api.EnvType; 7 | import net.fabricmc.api.Environment; 8 | 9 | import java.util.HashMap; 10 | import java.util.LinkedList; 11 | import java.util.List; 12 | import java.util.Map; 13 | 14 | @Environment(value = EnvType.CLIENT) 15 | public class AtlasSetManager { 16 | public static final ResourceLocation VANILLA_BLOCKS = ResourceLocation.withDefaultNamespace("blocks"); 17 | private static Map> additionalSets = new HashMap<>(); 18 | 19 | public static void addSource(ResourceLocation type, SpriteSource source) { 20 | additionalSets.computeIfAbsent(type, (t) -> new LinkedList<>()).add(source); 21 | } 22 | 23 | public static void onLoadResources(ResourceLocation type, List sources) { 24 | List additionalSources = additionalSets.get(type); 25 | if (additionalSources != null) { 26 | sources.addAll(additionalSources); 27 | } 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /src/main/java/org/betterx/bclib/blocks/signs/BaseWallSignBlock.java: -------------------------------------------------------------------------------- 1 | package org.betterx.bclib.blocks.signs; 2 | 3 | import org.betterx.bclib.behaviours.interfaces.BehaviourWood; 4 | import org.betterx.wover.block.api.BlockTagProvider; 5 | import org.betterx.wover.tag.api.event.context.TagBootstrapContext; 6 | 7 | import net.minecraft.resources.ResourceLocation; 8 | import net.minecraft.tags.BlockTags; 9 | import net.minecraft.world.level.block.Block; 10 | import net.minecraft.world.level.block.WallSignBlock; 11 | import net.minecraft.world.level.block.state.properties.WoodType; 12 | 13 | public abstract class BaseWallSignBlock extends WallSignBlock implements BlockTagProvider { 14 | protected BaseWallSignBlock(Properties properties, WoodType woodType) { 15 | super(woodType, properties); 16 | } 17 | 18 | @Override 19 | public void registerBlockTags(ResourceLocation location, TagBootstrapContext context) { 20 | context.add(this, BlockTags.WALL_SIGNS); 21 | 22 | } 23 | 24 | public static class Wood extends BaseWallSignBlock implements BehaviourWood { 25 | public Wood(Properties properties, WoodType woodType) { 26 | super(properties, woodType); 27 | } 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /src/main/java/org/betterx/bclib/mixin/common/boat/ChestBoatMixin.java: -------------------------------------------------------------------------------- 1 | package org.betterx.bclib.mixin.common.boat; 2 | 3 | import org.betterx.bclib.items.boat.BoatTypeOverride; 4 | import org.betterx.bclib.items.boat.CustomBoatTypeOverride; 5 | 6 | import net.minecraft.world.entity.vehicle.ChestBoat; 7 | import net.minecraft.world.item.BoatItem; 8 | import net.minecraft.world.item.Item; 9 | 10 | import org.spongepowered.asm.mixin.Mixin; 11 | import org.spongepowered.asm.mixin.injection.At; 12 | import org.spongepowered.asm.mixin.injection.Inject; 13 | import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; 14 | 15 | @Mixin(ChestBoat.class) 16 | public abstract class ChestBoatMixin { 17 | 18 | @Inject(method = "getDropItem", at = @At("HEAD"), cancellable = true) 19 | void bcl_getDropItem(CallbackInfoReturnable cir) { 20 | if (this instanceof CustomBoatTypeOverride cbto) { 21 | BoatTypeOverride type = cbto.bcl_getCustomType(); 22 | if (type != null) { 23 | BoatItem boat = type.getChestBoatItem(); 24 | if (boat != null) { 25 | cir.setReturnValue(boat); 26 | } 27 | } 28 | } 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /src/main/java/org/betterx/bclib/integration/modmenu/ModMenu.java: -------------------------------------------------------------------------------- 1 | package org.betterx.bclib.integration.modmenu; 2 | 3 | import net.minecraft.client.gui.screens.Screen; 4 | 5 | import java.util.HashMap; 6 | import java.util.Map; 7 | import java.util.function.Function; 8 | 9 | /** 10 | * Integration, to provide a custom Screen for ModMenu. 11 | *

12 | * This integration allows you to use ModMenu without adding a dependency to your project. If the 13 | * Mod is installed on the Client. 14 | *

15 | * You can add a screen for your mod by calling {@link #addModMenuScreen(String, Function)} 16 | */ 17 | public class ModMenu { 18 | static final Map> screen = new HashMap<>(); 19 | 20 | /** 21 | * registers a ModMenu entrypoint for another Mod. For Example {@code addModMenuScreen("myMod", (parent)->new Screen(parent));} 22 | * 23 | * @param modID The ID of your Mod 24 | * @param scr a function that takes a parent {@link Screen} and provides the main Screen you want 25 | * to show with ModMenu for your Mod. 26 | */ 27 | public static void addModMenuScreen(String modID, Function scr) { 28 | screen.put(modID, scr); 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /src/main/java/org/betterx/bclib/integration/modmenu/ModMenuEntryPoint.java: -------------------------------------------------------------------------------- 1 | package org.betterx.bclib.integration.modmenu; 2 | 3 | import org.betterx.bclib.client.gui.modmenu.MainScreen; 4 | 5 | import com.terraformersmc.modmenu.api.ConfigScreenFactory; 6 | import com.terraformersmc.modmenu.api.ModMenuApi; 7 | 8 | import java.util.HashMap; 9 | import java.util.Map; 10 | import java.util.function.Function; 11 | 12 | 13 | /** 14 | * Internal class to hook into ModMenu, you should not need to use this class. If you want to register a 15 | * ModMenu Screen for a Mod using BCLib, use {@link ModMenu#addModMenuScreen(String, Function)} 16 | */ 17 | public class ModMenuEntryPoint implements ModMenuApi { 18 | @Override 19 | public Map> getProvidedConfigScreenFactories() { 20 | Map> copy = new HashMap<>(); 21 | for (var entry : ModMenu.screen.entrySet()) { 22 | copy.put(entry.getKey(), (parent) -> entry.getValue().apply(parent)); 23 | } 24 | return copy; 25 | } 26 | 27 | @Override 28 | public ConfigScreenFactory getModConfigScreenFactory() { 29 | return (parent) -> new MainScreen(parent); 30 | } 31 | 32 | 33 | } 34 | -------------------------------------------------------------------------------- /src/main/java/org/betterx/bclib/sdf/primitive/SDFPrimitive.java: -------------------------------------------------------------------------------- 1 | package org.betterx.bclib.sdf.primitive; 2 | 3 | import org.betterx.bclib.sdf.SDF; 4 | 5 | import net.minecraft.core.BlockPos; 6 | import net.minecraft.world.level.block.Block; 7 | import net.minecraft.world.level.block.state.BlockState; 8 | 9 | import java.util.function.Function; 10 | 11 | public abstract class SDFPrimitive extends SDF { 12 | protected Function placerFunction; 13 | 14 | public SDFPrimitive setBlock(Function placerFunction) { 15 | this.placerFunction = placerFunction; 16 | return this; 17 | } 18 | 19 | public SDFPrimitive setBlock(BlockState state) { 20 | this.placerFunction = (pos) -> { 21 | return state; 22 | }; 23 | return this; 24 | } 25 | 26 | public SDFPrimitive setBlock(Block block) { 27 | this.placerFunction = (pos) -> { 28 | return block.defaultBlockState(); 29 | }; 30 | return this; 31 | } 32 | 33 | public BlockState getBlockState(BlockPos pos) { 34 | return placerFunction.apply(pos); 35 | } 36 | 37 | /*public abstract CompoundTag toNBT(CompoundTag root) { 38 | 39 | }*/ 40 | } 41 | -------------------------------------------------------------------------------- /src/main/java/org/betterx/bclib/mixin/common/PistonBaseBlockMixin.java: -------------------------------------------------------------------------------- 1 | package org.betterx.bclib.mixin.common; 2 | 3 | import org.betterx.wover.tag.api.predefined.CommonBlockTags; 4 | 5 | import net.minecraft.core.BlockPos; 6 | import net.minecraft.core.Direction; 7 | import net.minecraft.world.level.Level; 8 | import net.minecraft.world.level.block.piston.PistonBaseBlock; 9 | import net.minecraft.world.level.block.state.BlockState; 10 | 11 | import org.spongepowered.asm.mixin.Mixin; 12 | import org.spongepowered.asm.mixin.injection.At; 13 | import org.spongepowered.asm.mixin.injection.Inject; 14 | import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; 15 | 16 | @Mixin(PistonBaseBlock.class) 17 | public class PistonBaseBlockMixin { 18 | @Inject(method = "isPushable", at = @At("HEAD"), cancellable = true) 19 | private static void bclib_isPushable( 20 | BlockState blockState, 21 | Level level, 22 | BlockPos blockPos, 23 | Direction direction, 24 | boolean bl, 25 | Direction direction2, 26 | CallbackInfoReturnable cir 27 | ) { 28 | if (blockState.is(CommonBlockTags.IMMOBILE)) { 29 | cir.setReturnValue(false); 30 | cir.cancel(); 31 | } 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /src/main/java/org/betterx/bclib/items/BaseSpawnEggItem.java: -------------------------------------------------------------------------------- 1 | package org.betterx.bclib.items; 2 | 3 | import org.betterx.bclib.client.models.BasePatterns; 4 | import org.betterx.bclib.client.models.ModelsHelper; 5 | import org.betterx.bclib.client.models.PatternsHelper; 6 | import org.betterx.bclib.interfaces.ItemModelProvider; 7 | 8 | import net.minecraft.client.renderer.block.model.BlockModel; 9 | import net.minecraft.resources.ResourceLocation; 10 | import net.minecraft.world.entity.EntityType; 11 | import net.minecraft.world.entity.Mob; 12 | import net.minecraft.world.item.SpawnEggItem; 13 | 14 | import net.fabricmc.api.EnvType; 15 | import net.fabricmc.api.Environment; 16 | 17 | import java.util.Optional; 18 | 19 | public class BaseSpawnEggItem extends SpawnEggItem implements ItemModelProvider { 20 | public BaseSpawnEggItem(EntityType type, int primaryColor, int secondaryColor, Properties settings) { 21 | super(type, primaryColor, secondaryColor, settings); 22 | } 23 | 24 | @Override 25 | @Environment(EnvType.CLIENT) 26 | public BlockModel getItemModel(ResourceLocation resourceLocation) { 27 | Optional pattern = PatternsHelper.createJson(BasePatterns.ITEM_SPAWN_EGG, resourceLocation); 28 | return ModelsHelper.fromPattern(pattern); 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /src/main/java/org/betterx/bclib/complexmaterials/entry/ItemEntry.java: -------------------------------------------------------------------------------- 1 | package org.betterx.bclib.complexmaterials.entry; 2 | 3 | import org.betterx.bclib.complexmaterials.ComplexMaterial; 4 | import org.betterx.wover.item.api.ItemRegistry; 5 | 6 | import net.minecraft.tags.TagKey; 7 | import net.minecraft.world.item.Item; 8 | 9 | import java.util.function.BiFunction; 10 | 11 | public class ItemEntry extends ComplexMaterialEntry { 12 | final BiFunction initFunction; 13 | 14 | TagKey[] itemTags; 15 | 16 | public ItemEntry(String suffix, BiFunction initFunction) { 17 | super(suffix); 18 | this.initFunction = initFunction; 19 | } 20 | 21 | public ItemEntry setItemTags(TagKey[] itemTags) { 22 | this.itemTags = itemTags; 23 | return this; 24 | } 25 | 26 | public Item init(ComplexMaterial material, Item.Properties itemSettings, ItemRegistry registry) { 27 | String location = getName(material.getBaseName()); 28 | Item item = initFunction.apply(material, itemSettings); 29 | if (itemTags == null) 30 | registry.register(location, item); 31 | else 32 | registry.register(location, item, itemTags); 33 | 34 | return item; 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /src/main/java/org/betterx/bclib/api/v3/datagen/AdvancementDataProvider.java: -------------------------------------------------------------------------------- 1 | package org.betterx.bclib.api.v3.datagen; 2 | 3 | import org.betterx.bclib.api.v2.advancement.AdvancementManager; 4 | 5 | import net.minecraft.advancements.AdvancementHolder; 6 | import net.minecraft.core.HolderLookup; 7 | 8 | import net.fabricmc.fabric.api.datagen.v1.FabricDataOutput; 9 | import net.fabricmc.fabric.api.datagen.v1.provider.FabricAdvancementProvider; 10 | 11 | import java.util.List; 12 | import java.util.concurrent.CompletableFuture; 13 | import java.util.function.Consumer; 14 | 15 | public abstract class AdvancementDataProvider extends FabricAdvancementProvider { 16 | protected final List modIDs; 17 | 18 | protected AdvancementDataProvider( 19 | List modIDs, 20 | FabricDataOutput output, 21 | CompletableFuture registryLookup 22 | ) { 23 | super(output, registryLookup); 24 | this.modIDs = modIDs; 25 | } 26 | 27 | protected abstract void bootstrap(HolderLookup.Provider registryLookup); 28 | 29 | @Override 30 | public void generateAdvancement(HolderLookup.Provider registryLookup, Consumer consumer) { 31 | bootstrap(registryLookup); 32 | AdvancementManager.registerAllDataGen(modIDs, consumer); 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2020 paulevsGitch 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | 23 | ___________________________ 24 | Some of our Assets (see LICENSE.ASSETS for a Listing) is licensed under CC BY-NC-SA 4.0 25 | See https://creativecommons.org/licenses/by-nc-sa/4.0/ for Details. 26 | -------------------------------------------------------------------------------- /src/main/java/org/betterx/bclib/interfaces/AnvilScreenHandlerExtended.java: -------------------------------------------------------------------------------- 1 | package org.betterx.bclib.interfaces; 2 | 3 | 4 | import org.betterx.bclib.recipes.AnvilRecipe; 5 | 6 | import net.minecraft.world.item.crafting.RecipeHolder; 7 | 8 | import java.util.List; 9 | 10 | public interface AnvilScreenHandlerExtended { 11 | void bcl_updateCurrentRecipe(RecipeHolder recipe); 12 | 13 | RecipeHolder bcl_getCurrentRecipe(); 14 | 15 | List> bcl_getRecipes(); 16 | 17 | default void be_nextRecipe() { 18 | List> recipes = bcl_getRecipes(); 19 | if (recipes.size() < 2) return; 20 | RecipeHolder current = bcl_getCurrentRecipe(); 21 | int i = recipes.indexOf(current) + 1; 22 | if (i >= recipes.size()) { 23 | i = 0; 24 | } 25 | bcl_updateCurrentRecipe(recipes.get(i)); 26 | } 27 | 28 | default void be_previousRecipe() { 29 | List> recipes = bcl_getRecipes(); 30 | if (recipes.size() < 2) return; 31 | RecipeHolder current = bcl_getCurrentRecipe(); 32 | int i = recipes.indexOf(current) - 1; 33 | if (i <= 0) { 34 | i = recipes.size() - 1; 35 | } 36 | bcl_updateCurrentRecipe(recipes.get(i)); 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /src/main/java/org/betterx/bclib/interfaces/SurvivesOnBlocks.java: -------------------------------------------------------------------------------- 1 | package org.betterx.bclib.interfaces; 2 | 3 | import net.minecraft.core.component.DataComponents; 4 | import net.minecraft.world.item.ItemStack; 5 | import net.minecraft.world.level.block.Block; 6 | import net.minecraft.world.level.block.Blocks; 7 | import net.minecraft.world.level.block.state.BlockState; 8 | 9 | import java.util.Comparator; 10 | import java.util.List; 11 | import java.util.stream.Collectors; 12 | 13 | public interface SurvivesOnBlocks extends SurvivesOnSpecialGround { 14 | List getSurvivableBlocks(); 15 | 16 | @Override 17 | default String getSurvivableBlocksString() { 18 | return getSurvivableBlocks() 19 | .stream() 20 | .filter(block -> block != Blocks.AIR && block != null) 21 | .map(block -> { 22 | ItemStack stack = new ItemStack(block); 23 | if (stack.has(DataComponents.CUSTOM_NAME)) return stack.getHoverName().getString(); 24 | else return block.getName().getString(); 25 | }) 26 | .sorted(Comparator.naturalOrder()) 27 | .collect(Collectors.joining(", ")); 28 | } 29 | 30 | @Override 31 | default boolean isSurvivable(BlockState state) { 32 | return getSurvivableBlocks().contains(state.getBlock()); 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /src/main/java/org/betterx/bclib/util/CollectionsUtil.java: -------------------------------------------------------------------------------- 1 | package org.betterx.bclib.util; 2 | 3 | import java.util.*; 4 | 5 | public class CollectionsUtil { 6 | /** 7 | * Will return mutable copy of list. 8 | * 9 | * @param list {@link List} to make mutable. 10 | * @return {@link ArrayList} or original {@link List} if it is mutable. 11 | */ 12 | public static List getMutable(List list) { 13 | if (list instanceof ArrayList) { 14 | return list; 15 | } 16 | return new ArrayList<>(list); 17 | } 18 | 19 | /** 20 | * Will return mutable copy of set. 21 | * 22 | * @param set {@link Set} to make mutable. 23 | * @return {@link HashSet} or original {@link Set} if it is mutable. 24 | */ 25 | public static Set getMutable(Set set) { 26 | if (set instanceof HashSet) { 27 | return set; 28 | } 29 | return new HashSet<>(set); 30 | } 31 | 32 | /** 33 | * Will return mutable copy of map. 34 | * 35 | * @param map {@link Map} to make mutable. 36 | * @return {@link HashMap} or original {@link Map} if it is mutable. 37 | */ 38 | public static Map getMutable(Map map) { 39 | if (map instanceof HashMap) { 40 | return map; 41 | } 42 | return new HashMap<>(map); 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /src/main/java/org/betterx/bclib/api/v2/spawning/SpawnRuleEntry.java: -------------------------------------------------------------------------------- 1 | package org.betterx.bclib.api.v2.spawning; 2 | 3 | import org.betterx.bclib.interfaces.SpawnRule; 4 | 5 | import net.minecraft.core.BlockPos; 6 | import net.minecraft.util.RandomSource; 7 | import net.minecraft.world.entity.EntityType; 8 | import net.minecraft.world.entity.Mob; 9 | import net.minecraft.world.entity.MobSpawnType; 10 | import net.minecraft.world.level.LevelAccessor; 11 | 12 | import org.jetbrains.annotations.NotNull; 13 | 14 | public class SpawnRuleEntry implements Comparable { 15 | private final SpawnRule rule; 16 | private final byte priority; 17 | //public final String debugName; 18 | 19 | public SpawnRuleEntry(int priority, SpawnRule rule, String debugName) { 20 | this.priority = (byte) priority; 21 | this.rule = rule; 22 | //this.debugName = debugName; 23 | } 24 | 25 | protected boolean canSpawn( 26 | EntityType type, 27 | LevelAccessor world, 28 | MobSpawnType spawnReason, 29 | BlockPos pos, 30 | RandomSource random 31 | ) { 32 | return rule.canSpawn(type, world, spawnReason, pos, random); 33 | } 34 | 35 | @Override 36 | public int compareTo(@NotNull SpawnRuleEntry entry) { 37 | return Integer.compare(priority, entry.priority); 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /src/main/resources/bclib.mixins.common.json: -------------------------------------------------------------------------------- 1 | { 2 | "required": true, 3 | "minVersion": "0.8", 4 | "package": "org.betterx.bclib.mixin.common", 5 | "compatibilityLevel": "JAVA_21", 6 | "mixins": [ 7 | "AnvilBlockMixin", 8 | "AnvilMenuMixin", 9 | "BiomeGenerationSettingsAccessor", 10 | "BiomeMixin", 11 | "BoneMealItemMixin", 12 | "ChunkGeneratorMixin", 13 | "ComposterBlockAccessor", 14 | "CraftingMenuMixin", 15 | "EnchantingTableBlockMixin", 16 | "LayerLightSectionStorageMixin", 17 | "LootPoolMixin", 18 | "MobSpawnSettingsAccessor", 19 | "PistonBaseBlockMixin", 20 | "PortalShapeMixin", 21 | "RecipeManagerMixin", 22 | "RecipeMixin", 23 | "RegistryDataLoaderMixin", 24 | "ServerLevelMixin", 25 | "ShovelItemAccessor", 26 | "SurfaceRulesContextAccessor", 27 | "WorldGenRegionMixin", 28 | "axe.AxeItemMixin", 29 | "boat.BoatItemMixin", 30 | "boat.BoatMixin", 31 | "boat.ChestBoatMixin", 32 | "elytra.LivingEntityMixin", 33 | "shears.BeehiveBlockMixin", 34 | "shears.MatchToolMixin", 35 | "shears.MushroomCowMixin", 36 | "shears.PumpkinBlockMixin", 37 | "shears.SheepMixin", 38 | "shears.SnowGolemMixin", 39 | "shears.TripWireBlockMixin", 40 | "signs.BlockEntityTypeMixin" 41 | ], 42 | "injectors": { 43 | "defaultRequire": 1 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /src/main/java/org/betterx/bclib/api/v2/advancement/AdvancementBuilderElements.java: -------------------------------------------------------------------------------- 1 | package org.betterx.bclib.api.v2.advancement; 2 | 3 | import net.minecraft.advancements.AdvancementType; 4 | import net.minecraft.advancements.DisplayInfo; 5 | import net.minecraft.network.chat.Component; 6 | import net.minecraft.resources.ResourceLocation; 7 | import net.minecraft.world.item.ItemStack; 8 | 9 | import java.util.Optional; 10 | import org.jetbrains.annotations.Nullable; 11 | 12 | class Display { 13 | ItemStack icon; 14 | Component title; 15 | net.minecraft.network.chat.Component description; 16 | @Nullable ResourceLocation background; 17 | AdvancementType frame; 18 | boolean showToast; 19 | boolean announceChat; 20 | boolean hidden; 21 | 22 | Display() { 23 | } 24 | 25 | Display reset() { 26 | this.icon = null; 27 | this.title = null; 28 | this.description = null; 29 | frame = AdvancementType.TASK; 30 | background = null; 31 | showToast = true; 32 | announceChat = true; 33 | hidden = false; 34 | return this; 35 | } 36 | 37 | DisplayInfo build() { 38 | return new DisplayInfo( 39 | icon, title, description, 40 | background == null ? Optional.empty() : Optional.of(background), 41 | frame, showToast, announceChat, hidden 42 | ); 43 | } 44 | } 45 | 46 | -------------------------------------------------------------------------------- /src/main/java/org/betterx/bclib/complexmaterials/set/stone/StoneSlots.java: -------------------------------------------------------------------------------- 1 | package org.betterx.bclib.complexmaterials.set.stone; 2 | 3 | import org.betterx.bclib.complexmaterials.StoneComplexMaterial; 4 | import org.betterx.bclib.complexmaterials.entry.MaterialSlot; 5 | 6 | public class StoneSlots { 7 | public static final MaterialSlot SOURCE = new Source(); 8 | public static final MaterialSlot SLAB = new Slab(); 9 | public static final MaterialSlot STAIRS = new Stairs(); 10 | public static final MaterialSlot WALL = new Wall(); 11 | 12 | public static final MaterialSlot CRACKED = new CrackedBlock(); 13 | public static final MaterialSlot CRACKED_SLAB = new Slab(CRACKED); 14 | public static final MaterialSlot CRACKED_STAIRS = new Stairs(CRACKED); 15 | public static final MaterialSlot CRACKED_WALL = new Wall(CRACKED); 16 | 17 | public static final MaterialSlot WEATHERED = new WeatheredBlock(); 18 | public static final MaterialSlot WEATHERED_SLAB = new Slab(WEATHERED); 19 | public static final MaterialSlot WEATHERED_STAIRS = new Stairs(WEATHERED); 20 | public static final MaterialSlot WEATHERED_WALL = new Wall(WEATHERED); 21 | } 22 | -------------------------------------------------------------------------------- /src/main/java/org/betterx/datagen/bclib/BCLibDatagen.java: -------------------------------------------------------------------------------- 1 | package org.betterx.datagen.bclib; 2 | 3 | import org.betterx.bclib.BCLib; 4 | import org.betterx.datagen.bclib.advancement.BCLAdvancementDataProvider; 5 | import org.betterx.datagen.bclib.worldgen.BlockTagProvider; 6 | import org.betterx.datagen.bclib.worldgen.BoneMealBlockTagProvider; 7 | import org.betterx.wover.core.api.ModCore; 8 | import org.betterx.wover.datagen.api.PackBuilder; 9 | import org.betterx.wover.datagen.api.WoverDataGenEntryPoint; 10 | 11 | import net.minecraft.core.RegistrySetBuilder; 12 | 13 | public class BCLibDatagen extends WoverDataGenEntryPoint { 14 | @Override 15 | protected void onInitializeProviders(PackBuilder globalPack) { 16 | BCLib.LOGGER.info("Bootstrap onInitializeDataGenerator"); 17 | globalPack.addProvider(BoneMealBlockTagProvider::new); 18 | globalPack.addProvider(BlockTagProvider::new); 19 | 20 | globalPack.callOnInitializeDatapack((generator, pack, location) -> { 21 | if (location == null) { 22 | pack.addProvider(BCLAdvancementDataProvider::new); 23 | } 24 | }); 25 | } 26 | 27 | @Override 28 | protected ModCore modCore() { 29 | return BCLib.C; 30 | } 31 | 32 | @Override 33 | protected void onBuildRegistry(RegistrySetBuilder registryBuilder) { 34 | super.onBuildRegistry(registryBuilder); 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /src/main/java/org/betterx/bclib/util/Pair.java: -------------------------------------------------------------------------------- 1 | package org.betterx.bclib.util; 2 | 3 | import com.mojang.serialization.Codec; 4 | import com.mojang.serialization.codecs.RecordCodecBuilder; 5 | 6 | import java.util.Objects; 7 | 8 | public class Pair { 9 | public static Codec> pairCodec(Codec a, Codec b, String first, String second) { 10 | return RecordCodecBuilder.create(instance -> instance 11 | .group( 12 | a.fieldOf(first).forGetter(o -> o.first), 13 | b.fieldOf(second).forGetter(o -> o.second) 14 | ) 15 | .apply(instance, Pair::new)); 16 | } 17 | 18 | public final A first; 19 | public final B second; 20 | 21 | public Pair(A first, B second) { 22 | this.first = first; 23 | this.second = second; 24 | } 25 | 26 | @Override 27 | public String toString() { 28 | return "Pair{" + "first=" + first + ", second=" + second + '}'; 29 | } 30 | 31 | @Override 32 | public boolean equals(Object o) { 33 | if (this == o) return true; 34 | if (!(o instanceof Pair)) return false; 35 | Pair pair = (Pair) o; 36 | return Objects.equals(first, pair.first) && Objects.equals(second, pair.second); 37 | } 38 | 39 | @Override 40 | public int hashCode() { 41 | return Objects.hash(first, second); 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /src/main/java/org/betterx/bclib/items/BaseArmorItem.java: -------------------------------------------------------------------------------- 1 | package org.betterx.bclib.items; 2 | 3 | import org.betterx.bclib.interfaces.ItemModelProvider; 4 | import org.betterx.wover.item.api.ItemTagProvider; 5 | import org.betterx.wover.tag.api.event.context.ItemTagBootstrapContext; 6 | 7 | import net.minecraft.core.Holder; 8 | import net.minecraft.resources.ResourceLocation; 9 | import net.minecraft.tags.ItemTags; 10 | import net.minecraft.world.entity.EquipmentSlot; 11 | import net.minecraft.world.item.ArmorItem; 12 | import net.minecraft.world.item.ArmorMaterial; 13 | 14 | public class BaseArmorItem extends ArmorItem implements ItemModelProvider, ItemTagProvider { 15 | public BaseArmorItem(Holder material, Type type, Properties settings) { 16 | super(material, type, settings); 17 | } 18 | 19 | @Override 20 | public void registerItemTags(ResourceLocation location, ItemTagBootstrapContext context) { 21 | if (this.type.getSlot() == EquipmentSlot.HEAD) { 22 | context.add(this, ItemTags.HEAD_ARMOR); 23 | } else if (this.type.getSlot() == EquipmentSlot.CHEST) { 24 | context.add(this, ItemTags.CHEST_ARMOR); 25 | } else if (this.type.getSlot() == EquipmentSlot.LEGS) { 26 | context.add(this, ItemTags.LEG_ARMOR); 27 | } else if (this.type.getSlot() == EquipmentSlot.FEET) { 28 | context.add(this, ItemTags.FOOT_ARMOR); 29 | } 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /src/main/java/org/betterx/bclib/mixin/common/CraftingMenuMixin.java: -------------------------------------------------------------------------------- 1 | package org.betterx.bclib.mixin.common; 2 | 3 | import org.betterx.wover.tag.api.predefined.CommonBlockTags; 4 | 5 | import net.minecraft.world.entity.player.Player; 6 | import net.minecraft.world.inventory.ContainerLevelAccess; 7 | import net.minecraft.world.inventory.CraftingMenu; 8 | import net.minecraft.world.level.block.CraftingTableBlock; 9 | import net.minecraft.world.level.block.state.BlockState; 10 | 11 | import org.spongepowered.asm.mixin.Final; 12 | import org.spongepowered.asm.mixin.Mixin; 13 | import org.spongepowered.asm.mixin.Shadow; 14 | import org.spongepowered.asm.mixin.injection.At; 15 | import org.spongepowered.asm.mixin.injection.Inject; 16 | import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; 17 | 18 | @Mixin(CraftingMenu.class) 19 | public abstract class CraftingMenuMixin { 20 | @Final 21 | @Shadow 22 | private ContainerLevelAccess access; 23 | 24 | @Inject(method = "stillValid", at = @At("HEAD"), cancellable = true) 25 | private void bclib_stillValid(Player player, CallbackInfoReturnable info) { 26 | if (access.evaluate((world, pos) -> { 27 | BlockState state = world.getBlockState(pos); 28 | return state.getBlock() instanceof CraftingTableBlock || state.is(CommonBlockTags.WORKBENCHES); 29 | }, true)) { 30 | info.setReturnValue(true); 31 | } 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /src/main/java/org/betterx/bclib/complexmaterials/set/stone/CrackedBlock.java: -------------------------------------------------------------------------------- 1 | package org.betterx.bclib.complexmaterials.set.stone; 2 | 3 | import org.betterx.bclib.blocks.BaseBlock; 4 | import org.betterx.bclib.complexmaterials.ComplexMaterial; 5 | import org.betterx.bclib.complexmaterials.StoneComplexMaterial; 6 | import org.betterx.bclib.complexmaterials.entry.SimpleMaterialSlot; 7 | import org.betterx.wover.recipe.api.RecipeBuilder; 8 | 9 | import net.minecraft.data.recipes.RecipeOutput; 10 | import net.minecraft.resources.ResourceLocation; 11 | import net.minecraft.world.level.block.Block; 12 | import net.minecraft.world.level.block.state.BlockBehaviour; 13 | 14 | import org.jetbrains.annotations.NotNull; 15 | import org.jetbrains.annotations.Nullable; 16 | 17 | public class CrackedBlock extends SimpleMaterialSlot { 18 | public CrackedBlock() { 19 | super("cracked"); 20 | } 21 | 22 | @Override 23 | protected @NotNull Block createBlock(StoneComplexMaterial parentMaterial, BlockBehaviour.Properties settings) { 24 | return new BaseBlock.Stone(settings); 25 | } 26 | 27 | @Override 28 | protected @Nullable void makeRecipe(RecipeOutput context, ComplexMaterial parentMaterial, ResourceLocation id) { 29 | RecipeBuilder.smelting(id, parentMaterial.getBlock(suffix)) 30 | .input(parentMaterial.getBlock(StoneSlots.SOURCE)) 31 | .build(context); 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /src/main/java/org/betterx/bclib/mixin/common/ChunkGeneratorMixin.java: -------------------------------------------------------------------------------- 1 | package org.betterx.bclib.mixin.common; 2 | 3 | import net.minecraft.world.level.StructureManager; 4 | import net.minecraft.world.level.WorldGenLevel; 5 | import net.minecraft.world.level.chunk.ChunkAccess; 6 | import net.minecraft.world.level.chunk.ChunkGenerator; 7 | 8 | import org.spongepowered.asm.mixin.Mixin; 9 | import org.spongepowered.asm.mixin.Unique; 10 | import org.spongepowered.asm.mixin.injection.At; 11 | import org.spongepowered.asm.mixin.injection.Inject; 12 | import org.spongepowered.asm.mixin.injection.ModifyArg; 13 | import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; 14 | 15 | @Mixin(ChunkGenerator.class) 16 | public class ChunkGeneratorMixin { 17 | @Unique 18 | private int bclib_featureIteratorSeed; 19 | 20 | 21 | @ModifyArg(method = "applyBiomeDecoration", at = @At(value = "INVOKE", target = "Lnet/minecraft/world/level/levelgen/WorldgenRandom;setFeatureSeed(JII)V")) 22 | private long bclib_updateFeatureSeed(long seed) { 23 | return Long.rotateRight(seed, bclib_featureIteratorSeed++); 24 | } 25 | 26 | @Inject(method = "applyBiomeDecoration", at = @At("HEAD")) 27 | private void bclib_obBiomeGenerate( 28 | WorldGenLevel worldGenLevel, 29 | ChunkAccess chunkAccess, 30 | StructureManager structureFeatureManager, 31 | CallbackInfo ci 32 | ) { 33 | bclib_featureIteratorSeed = 0; 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /src/main/java/org/betterx/bclib/sdf/primitive/SDFLine.java: -------------------------------------------------------------------------------- 1 | package org.betterx.bclib.sdf.primitive; 2 | 3 | import org.betterx.bclib.util.MHelper; 4 | 5 | import net.minecraft.util.Mth; 6 | 7 | public class SDFLine extends SDFPrimitive { 8 | private float radius; 9 | private float x1; 10 | private float y1; 11 | private float z1; 12 | private float x2; 13 | private float y2; 14 | private float z2; 15 | 16 | public SDFLine setRadius(float radius) { 17 | this.radius = radius; 18 | return this; 19 | } 20 | 21 | public SDFLine setStart(float x, float y, float z) { 22 | this.x1 = x; 23 | this.y1 = y; 24 | this.z1 = z; 25 | return this; 26 | } 27 | 28 | public SDFLine setEnd(float x, float y, float z) { 29 | this.x2 = x; 30 | this.y2 = y; 31 | this.z2 = z; 32 | return this; 33 | } 34 | 35 | @Override 36 | public float getDistance(float x, float y, float z) { 37 | float pax = x - x1; 38 | float pay = y - y1; 39 | float paz = z - z1; 40 | 41 | float bax = x2 - x1; 42 | float bay = y2 - y1; 43 | float baz = z2 - z1; 44 | 45 | float dpb = MHelper.dot(pax, pay, paz, bax, bay, baz); 46 | float dbb = MHelper.dot(bax, bay, baz, bax, bay, baz); 47 | float h = Mth.clamp(dpb / dbb, 0F, 1F); 48 | return MHelper.length(pax - bax * h, pay - bay * h, paz - baz * h) - radius; 49 | } 50 | } 51 | -------------------------------------------------------------------------------- /src/main/java/org/betterx/bclib/api/v3/bonemeal/FeatureSpreader.java: -------------------------------------------------------------------------------- 1 | package org.betterx.bclib.api.v3.bonemeal; 2 | 3 | import net.minecraft.core.BlockPos; 4 | import net.minecraft.core.Holder; 5 | import net.minecraft.world.level.LevelReader; 6 | import net.minecraft.world.level.block.Block; 7 | import net.minecraft.world.level.block.state.BlockState; 8 | import net.minecraft.world.level.levelgen.feature.ConfiguredFeature; 9 | 10 | import org.jetbrains.annotations.Nullable; 11 | 12 | public class FeatureSpreader implements BonemealNyliumLike { 13 | public final BonemealAPI.FeatureProvider spreadableFeature; 14 | public final Block hostBlock; 15 | 16 | public FeatureSpreader(Block hostBlock, BonemealAPI.FeatureProvider spreadableFeature) { 17 | this.spreadableFeature = spreadableFeature; 18 | this.hostBlock = hostBlock; 19 | } 20 | 21 | @Override 22 | public boolean isValidBonemealTarget( 23 | LevelReader blockGetter, 24 | BlockPos blockPos, 25 | BlockState blockState 26 | ) { 27 | return spreadableFeature != null 28 | && BonemealNyliumLike.super.isValidBonemealTarget(blockGetter, blockPos, blockState); 29 | } 30 | 31 | @Override 32 | public Block getHostBlock() { 33 | return hostBlock; 34 | } 35 | 36 | @Override 37 | public @Nullable Holder> getCoverFeature() { 38 | return spreadableFeature.getFeature(); 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /src/main/resources/assets/bclib/models/block/sided_door_top.json: -------------------------------------------------------------------------------- 1 | { 2 | "ambientocclusion": false, 3 | "textures": { 4 | "particle": "#facade" 5 | }, 6 | "elements": [ 7 | { 8 | "from": [ 9 | 0, 10 | 0, 11 | 0 12 | ], 13 | "to": [ 14 | 3, 15 | 16, 16 | 16 17 | ], 18 | "faces": { 19 | "up": { 20 | "uv": [ 21 | 13, 22 | 0, 23 | 16, 24 | 16 25 | ], 26 | "texture": "#side", 27 | "cullface": "up" 28 | }, 29 | "north": { 30 | "uv": [ 31 | 3, 32 | 0, 33 | 0, 34 | 16 35 | ], 36 | "texture": "#side", 37 | "cullface": "north" 38 | }, 39 | "south": { 40 | "uv": [ 41 | 0, 42 | 0, 43 | 3, 44 | 16 45 | ], 46 | "texture": "#side", 47 | "cullface": "south" 48 | }, 49 | "west": { 50 | "uv": [ 51 | 0, 52 | 0, 53 | 16, 54 | 16 55 | ], 56 | "texture": "#facade", 57 | "cullface": "west" 58 | }, 59 | "east": { 60 | "uv": [ 61 | 16, 62 | 0, 63 | 0, 64 | 16 65 | ], 66 | "texture": "#facade" 67 | } 68 | } 69 | } 70 | ] 71 | } 72 | -------------------------------------------------------------------------------- /src/main/java/org/betterx/bclib/api/v3/tag/BCLBlockTags.java: -------------------------------------------------------------------------------- 1 | package org.betterx.bclib.api.v3.tag; 2 | 3 | 4 | import org.betterx.bclib.BCLib; 5 | import org.betterx.wover.tag.api.TagManager; 6 | 7 | import net.minecraft.tags.TagKey; 8 | import net.minecraft.world.level.block.Block; 9 | 10 | import org.jetbrains.annotations.ApiStatus; 11 | 12 | public class BCLBlockTags { 13 | public static final TagKey BONEMEAL_SOURCE_NETHERRACK = TagManager.BLOCKS.makeTag(BCLib.C, "bonemeal/source/netherrack"); 14 | public static final TagKey BONEMEAL_TARGET_NETHERRACK = TagManager.BLOCKS.makeTag( 15 | BCLib.C, 16 | "bonemeal/target/netherrack" 17 | ); 18 | public static final TagKey BONEMEAL_SOURCE_END_STONE = TagManager.BLOCKS.makeTag( 19 | BCLib.C, 20 | "bonemeal/source/end_stone" 21 | ); 22 | public static final TagKey BONEMEAL_TARGET_END_STONE = TagManager.BLOCKS.makeTag( 23 | BCLib.C, 24 | "bonemeal/target/end_stone" 25 | ); 26 | public static final TagKey BONEMEAL_SOURCE_OBSIDIAN = TagManager.BLOCKS.makeTag( 27 | BCLib.C, 28 | "bonemeal/source/obsidian" 29 | ); 30 | public static final TagKey BONEMEAL_TARGET_OBSIDIAN = TagManager.BLOCKS.makeTag( 31 | BCLib.C, 32 | "bonemeal/target/obsidian" 33 | ); 34 | 35 | @ApiStatus.Internal 36 | public static void ensureStaticallyLoaded() { 37 | 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /src/main/java/org/betterx/bclib/mixin/client/ModelManagerMixin.java: -------------------------------------------------------------------------------- 1 | package org.betterx.bclib.mixin.client; 2 | 3 | import org.betterx.bclib.client.BCLibClient; 4 | 5 | import net.minecraft.client.resources.model.ModelManager; 6 | import net.minecraft.server.packs.resources.PreparableReloadListener; 7 | import net.minecraft.server.packs.resources.ResourceManager; 8 | import net.minecraft.util.profiling.ProfilerFiller; 9 | 10 | import org.spongepowered.asm.mixin.Mixin; 11 | import org.spongepowered.asm.mixin.injection.At; 12 | import org.spongepowered.asm.mixin.injection.Inject; 13 | import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; 14 | 15 | import java.util.concurrent.CompletableFuture; 16 | import java.util.concurrent.Executor; 17 | 18 | @Mixin(ModelManager.class) 19 | public class ModelManagerMixin { 20 | @Inject(method = "reload", at = @At(value = "INVOKE", shift = At.Shift.AFTER, target = "Lnet/minecraft/util/profiling/ProfilerFiller;startTick()V")) 21 | private void bclib_loadCustomModels( 22 | PreparableReloadListener.PreparationBarrier preparationBarrier, 23 | ResourceManager resourceManager, 24 | ProfilerFiller profilerFiller, 25 | ProfilerFiller profilerFiller2, 26 | Executor executor, 27 | Executor executor2, 28 | CallbackInfoReturnable> cir 29 | ) { 30 | BCLibClient.lazyModelbakery().loadCustomModels(resourceManager); 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /src/main/resources/assets/bclib/models/block/sided_door_top_rh.json: -------------------------------------------------------------------------------- 1 | { 2 | "ambientocclusion": false, 3 | "textures": { 4 | "particle": "#facade" 5 | }, 6 | "elements": [ 7 | { 8 | "from": [ 9 | 0, 10 | 0, 11 | 0 12 | ], 13 | "to": [ 14 | 3, 15 | 16, 16 | 16 17 | ], 18 | "faces": { 19 | "up": { 20 | "uv": [ 21 | 13, 22 | 0, 23 | 16, 24 | 16 25 | ], 26 | "texture": "#side", 27 | "cullface": "up" 28 | }, 29 | "north": { 30 | "uv": [ 31 | 3, 32 | 0, 33 | 0, 34 | 16 35 | ], 36 | "texture": "#side", 37 | "cullface": "north" 38 | }, 39 | "south": { 40 | "uv": [ 41 | 0, 42 | 0, 43 | 3, 44 | 16 45 | ], 46 | "texture": "#side", 47 | "cullface": "south" 48 | }, 49 | "west": { 50 | "uv": [ 51 | 16, 52 | 0, 53 | 0, 54 | 16 55 | ], 56 | "texture": "#facade", 57 | "cullface": "west" 58 | }, 59 | "east": { 60 | "uv": [ 61 | 0, 62 | 0, 63 | 16, 64 | 16 65 | ], 66 | "texture": "#facade" 67 | } 68 | } 69 | } 70 | ] 71 | } 72 | -------------------------------------------------------------------------------- /src/main/resources/assets/bclib/models/block/sided_door_bottom.json: -------------------------------------------------------------------------------- 1 | { 2 | "ambientocclusion": false, 3 | "textures": { 4 | "particle": "#facade" 5 | }, 6 | "elements": [ 7 | { 8 | "from": [ 9 | 0, 10 | 0, 11 | 0 12 | ], 13 | "to": [ 14 | 3, 15 | 16, 16 | 16 17 | ], 18 | "faces": { 19 | "down": { 20 | "uv": [ 21 | 13, 22 | 0, 23 | 16, 24 | 16 25 | ], 26 | "texture": "#side", 27 | "cullface": "down" 28 | }, 29 | "north": { 30 | "uv": [ 31 | 3, 32 | 0, 33 | 0, 34 | 16 35 | ], 36 | "texture": "#side", 37 | "cullface": "north" 38 | }, 39 | "south": { 40 | "uv": [ 41 | 0, 42 | 0, 43 | 3, 44 | 16 45 | ], 46 | "texture": "#side", 47 | "cullface": "south" 48 | }, 49 | "west": { 50 | "uv": [ 51 | 0, 52 | 0, 53 | 16, 54 | 16 55 | ], 56 | "texture": "#facade", 57 | "cullface": "west" 58 | }, 59 | "east": { 60 | "uv": [ 61 | 16, 62 | 0, 63 | 0, 64 | 16 65 | ], 66 | "texture": "#facade" 67 | } 68 | } 69 | } 70 | ] 71 | } 72 | -------------------------------------------------------------------------------- /src/main/resources/assets/bclib/models/block/sided_door_bottom_rh.json: -------------------------------------------------------------------------------- 1 | { 2 | "ambientocclusion": false, 3 | "textures": { 4 | "particle": "#facade" 5 | }, 6 | "elements": [ 7 | { 8 | "from": [ 9 | 0, 10 | 0, 11 | 0 12 | ], 13 | "to": [ 14 | 3, 15 | 16, 16 | 16 17 | ], 18 | "faces": { 19 | "down": { 20 | "uv": [ 21 | 13, 22 | 0, 23 | 16, 24 | 16 25 | ], 26 | "texture": "#side", 27 | "cullface": "down" 28 | }, 29 | "north": { 30 | "uv": [ 31 | 3, 32 | 0, 33 | 0, 34 | 16 35 | ], 36 | "texture": "#side", 37 | "cullface": "north" 38 | }, 39 | "south": { 40 | "uv": [ 41 | 0, 42 | 0, 43 | 3, 44 | 16 45 | ], 46 | "texture": "#side", 47 | "cullface": "south" 48 | }, 49 | "west": { 50 | "uv": [ 51 | 16, 52 | 0, 53 | 0, 54 | 16 55 | ], 56 | "texture": "#facade", 57 | "cullface": "west" 58 | }, 59 | "east": { 60 | "uv": [ 61 | 0, 62 | 0, 63 | 16, 64 | 16 65 | ], 66 | "texture": "#facade" 67 | } 68 | } 69 | } 70 | ] 71 | } 72 | -------------------------------------------------------------------------------- /src/main/java/org/betterx/bclib/complexmaterials/set/common/AbstractSlab.java: -------------------------------------------------------------------------------- 1 | package org.betterx.bclib.complexmaterials.set.common; 2 | 3 | import org.betterx.bclib.complexmaterials.ComplexMaterial; 4 | import org.betterx.bclib.complexmaterials.entry.MaterialSlot; 5 | import org.betterx.bclib.complexmaterials.entry.SimpleMaterialSlot; 6 | import org.betterx.wover.recipe.api.RecipeBuilder; 7 | 8 | import net.minecraft.data.recipes.RecipeCategory; 9 | import net.minecraft.data.recipes.RecipeOutput; 10 | import net.minecraft.resources.ResourceLocation; 11 | 12 | import org.jetbrains.annotations.Nullable; 13 | 14 | public abstract class AbstractSlab extends SimpleMaterialSlot { 15 | public AbstractSlab() { 16 | super("slab"); 17 | } 18 | 19 | protected AbstractSlab(String prefix) { 20 | super(prefix + "_slab"); 21 | } 22 | 23 | 24 | @Override 25 | protected @Nullable void makeRecipe(RecipeOutput context, ComplexMaterial parentMaterial, ResourceLocation id) { 26 | RecipeBuilder 27 | .crafting(id, parentMaterial.getBlock(suffix)) 28 | .outputCount(6) 29 | .shape("###") 30 | .addMaterial('#', parentMaterial.getBlock(getSourceBlockSlot())) 31 | .group("slab") 32 | .category(RecipeCategory.BUILDING_BLOCKS) 33 | .build(context); 34 | } 35 | 36 | @Nullable 37 | protected abstract MaterialSlot getSourceBlockSlot(); 38 | } 39 | -------------------------------------------------------------------------------- /src/main/java/org/betterx/bclib/mixin/common/EnchantingTableBlockMixin.java: -------------------------------------------------------------------------------- 1 | package org.betterx.bclib.mixin.common; 2 | 3 | import net.minecraft.core.BlockPos; 4 | import net.minecraft.world.level.Level; 5 | import net.minecraft.world.level.block.Block; 6 | import net.minecraft.world.level.block.EnchantingTableBlock; 7 | 8 | import org.spongepowered.asm.mixin.Mixin; 9 | import org.spongepowered.asm.mixin.injection.At; 10 | import org.spongepowered.asm.mixin.injection.Inject; 11 | import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; 12 | 13 | @Mixin(EnchantingTableBlock.class) 14 | public abstract class EnchantingTableBlockMixin extends Block { 15 | public EnchantingTableBlockMixin(Properties settings) { 16 | super(settings); 17 | } 18 | 19 | @Inject(method = "isValidBookShelf(Lnet/minecraft/world/level/Level;Lnet/minecraft/core/BlockPos;Lnet/minecraft/core/BlockPos;)Z", at = @At("HEAD"), cancellable = true) 20 | private static void bclib_isBookshelf( 21 | Level level, 22 | BlockPos tablePos, 23 | BlockPos delta, 24 | CallbackInfoReturnable info 25 | ) { 26 | if (level 27 | .getBlockState(tablePos.offset(delta)) 28 | .is(org.betterx.wover.tag.api.predefined.CommonBlockTags.BOOKSHELVES) 29 | && level.isEmptyBlock(tablePos.offset(delta.getX() / 2, delta.getY(), delta.getZ() / 2))) { 30 | info.setReturnValue(true); 31 | } 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /src/main/java/org/betterx/bclib/util/RomanNumeral.java: -------------------------------------------------------------------------------- 1 | package org.betterx.bclib.util; 2 | 3 | import java.util.TreeMap; 4 | 5 | /** 6 | * base on ... 7 | */ 8 | 9 | public class RomanNumeral { 10 | private final static TreeMap LITERALS = new TreeMap<>(); 11 | 12 | private static void lazyInit() { 13 | if (LITERALS.isEmpty()) { 14 | LITERALS.put(1000, "M"); 15 | LITERALS.put(900, "CM"); 16 | LITERALS.put(500, "D"); 17 | LITERALS.put(400, "CD"); 18 | LITERALS.put(100, "C"); 19 | LITERALS.put(90, "XC"); 20 | LITERALS.put(50, "L"); 21 | LITERALS.put(40, "XL"); 22 | LITERALS.put(10, "X"); 23 | LITERALS.put(9, "IX"); 24 | LITERALS.put(5, "V"); 25 | LITERALS.put(4, "IV"); 26 | LITERALS.put(1, "I"); 27 | } 28 | } 29 | 30 | public static String toRoman(int number) { 31 | lazyInit(); 32 | return _toRoman(number); 33 | } 34 | 35 | private static String _toRoman(int number) { 36 | //there is no 0 in roman, but we need it anyway ;) 37 | if (number == 0) return "0"; 38 | 39 | int l = LITERALS.floorKey(number); 40 | if (number == l) { 41 | return LITERALS.get(number); 42 | } 43 | return LITERALS.get(l) + _toRoman(number - l); 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /src/main/java/org/betterx/bclib/complexmaterials/set/common/AbstractWall.java: -------------------------------------------------------------------------------- 1 | package org.betterx.bclib.complexmaterials.set.common; 2 | 3 | import org.betterx.bclib.complexmaterials.ComplexMaterial; 4 | import org.betterx.bclib.complexmaterials.entry.MaterialSlot; 5 | import org.betterx.bclib.complexmaterials.entry.SimpleMaterialSlot; 6 | import org.betterx.bclib.complexmaterials.set.stone.StoneSlots; 7 | import org.betterx.wover.recipe.api.RecipeBuilder; 8 | 9 | import net.minecraft.data.recipes.RecipeOutput; 10 | import net.minecraft.resources.ResourceLocation; 11 | 12 | import org.jetbrains.annotations.NotNull; 13 | import org.jetbrains.annotations.Nullable; 14 | 15 | public abstract class AbstractWall extends SimpleMaterialSlot { 16 | public AbstractWall() { 17 | super("wall"); 18 | } 19 | 20 | protected AbstractWall(@NotNull String postfix) { 21 | super(postfix + "_wall"); 22 | } 23 | 24 | @Override 25 | protected @Nullable void makeRecipe(RecipeOutput context, ComplexMaterial parentMaterial, ResourceLocation id) { 26 | RecipeBuilder.crafting(id, parentMaterial.getBlock(suffix)) 27 | .outputCount(6) 28 | .shape("###", "###") 29 | .addMaterial('#', parentMaterial.getBlock(StoneSlots.SOURCE)) 30 | .group("wall") 31 | .build(context); 32 | } 33 | 34 | @Nullable 35 | protected abstract MaterialSlot getSourceBlockSlot(); 36 | } 37 | -------------------------------------------------------------------------------- /src/main/java/org/betterx/bclib/mixin/common/SurfaceRulesContextAccessor.java: -------------------------------------------------------------------------------- 1 | package org.betterx.bclib.mixin.common; 2 | 3 | import net.minecraft.core.Holder; 4 | import net.minecraft.world.level.biome.Biome; 5 | import net.minecraft.world.level.chunk.ChunkAccess; 6 | import net.minecraft.world.level.levelgen.NoiseChunk; 7 | import net.minecraft.world.level.levelgen.RandomState; 8 | import net.minecraft.world.level.levelgen.SurfaceRules; 9 | 10 | import org.spongepowered.asm.mixin.Mixin; 11 | import org.spongepowered.asm.mixin.gen.Accessor; 12 | 13 | import java.util.function.Supplier; 14 | 15 | @Mixin(SurfaceRules.Context.class) 16 | public interface SurfaceRulesContextAccessor { 17 | @Accessor("blockX") 18 | int getBlockX(); 19 | 20 | @Accessor("blockY") 21 | int getBlockY(); 22 | 23 | @Accessor("blockZ") 24 | int getBlockZ(); 25 | 26 | @Accessor("surfaceDepth") 27 | int getSurfaceDepth(); 28 | 29 | @Accessor("biome") 30 | Supplier> getBiome(); 31 | 32 | @Accessor("chunk") 33 | ChunkAccess getChunk(); 34 | 35 | @Accessor("noiseChunk") 36 | NoiseChunk getNoiseChunk(); 37 | 38 | @Accessor("stoneDepthAbove") 39 | int getStoneDepthAbove(); 40 | 41 | @Accessor("stoneDepthBelow") 42 | int getStoneDepthBelow(); 43 | 44 | @Accessor("lastUpdateY") 45 | long getLastUpdateY(); 46 | 47 | @Accessor("lastUpdateXZ") 48 | long getLastUpdateXZ(); 49 | 50 | @Accessor("randomState") 51 | RandomState getRandomState(); 52 | } 53 | -------------------------------------------------------------------------------- /src/main/java/org/betterx/bclib/complexmaterials/set/common/AbstractStairs.java: -------------------------------------------------------------------------------- 1 | package org.betterx.bclib.complexmaterials.set.common; 2 | 3 | import org.betterx.bclib.complexmaterials.ComplexMaterial; 4 | import org.betterx.bclib.complexmaterials.entry.MaterialSlot; 5 | import org.betterx.bclib.complexmaterials.entry.SimpleMaterialSlot; 6 | import org.betterx.wover.recipe.api.RecipeBuilder; 7 | 8 | import net.minecraft.data.recipes.RecipeCategory; 9 | import net.minecraft.data.recipes.RecipeOutput; 10 | import net.minecraft.resources.ResourceLocation; 11 | 12 | import org.jetbrains.annotations.Nullable; 13 | 14 | public abstract class AbstractStairs extends SimpleMaterialSlot { 15 | public AbstractStairs() { 16 | super("stairs"); 17 | } 18 | 19 | protected AbstractStairs(String prefix) { 20 | super(prefix + "_stairs"); 21 | } 22 | 23 | 24 | @Override 25 | protected @Nullable void makeRecipe(RecipeOutput context, ComplexMaterial parentMaterial, ResourceLocation id) { 26 | RecipeBuilder 27 | .crafting(id, parentMaterial.getBlock(suffix)) 28 | .outputCount(4) 29 | .shape("# ", "## ", "###") 30 | .addMaterial('#', parentMaterial.getBlock(getSourceBlockSlot())) 31 | .group("stairs") 32 | .category(RecipeCategory.BUILDING_BLOCKS) 33 | .build(context); 34 | } 35 | 36 | @Nullable 37 | protected abstract MaterialSlot getSourceBlockSlot(); 38 | } 39 | -------------------------------------------------------------------------------- /src/main/java/org/betterx/bclib/blocks/SimpleLeavesBlock.java: -------------------------------------------------------------------------------- 1 | package org.betterx.bclib.blocks; 2 | 3 | import org.betterx.bclib.behaviours.BehaviourBuilders; 4 | import org.betterx.bclib.behaviours.interfaces.BehaviourLeaves; 5 | import org.betterx.bclib.client.render.BCLRenderLayer; 6 | import org.betterx.bclib.interfaces.RenderLayerProvider; 7 | 8 | import net.minecraft.world.level.block.SoundType; 9 | import net.minecraft.world.level.block.state.BlockBehaviour; 10 | import net.minecraft.world.level.material.MapColor; 11 | 12 | public class SimpleLeavesBlock extends BaseBlockNotFull implements RenderLayerProvider, BehaviourLeaves { 13 | public SimpleLeavesBlock(MapColor color) { 14 | this( 15 | BehaviourBuilders 16 | .createStaticLeaves(color, true) 17 | .sound(SoundType.GRASS) 18 | ); 19 | } 20 | 21 | public SimpleLeavesBlock(MapColor color, int light) { 22 | this( 23 | BehaviourBuilders 24 | .createStaticLeaves(color, true) 25 | .lightLevel(ignored -> light) 26 | .sound(SoundType.GRASS) 27 | ); 28 | } 29 | 30 | public SimpleLeavesBlock(BlockBehaviour.Properties properties) { 31 | super(properties); 32 | } 33 | 34 | @Override 35 | public BCLRenderLayer getRenderLayer() { 36 | return BCLRenderLayer.CUTOUT; 37 | } 38 | 39 | 40 | @Override 41 | public float compostingChance() { 42 | return 0.3f; 43 | } 44 | } -------------------------------------------------------------------------------- /src/main/java/org/betterx/bclib/sdf/primitive/SDFCappedCone.java: -------------------------------------------------------------------------------- 1 | package org.betterx.bclib.sdf.primitive; 2 | 3 | import org.betterx.bclib.util.MHelper; 4 | 5 | import net.minecraft.util.Mth; 6 | 7 | public class SDFCappedCone extends SDFPrimitive { 8 | private float radius1; 9 | private float radius2; 10 | private float height; 11 | 12 | public SDFCappedCone setRadius1(float radius) { 13 | this.radius1 = radius; 14 | return this; 15 | } 16 | 17 | public SDFCappedCone setRadius2(float radius) { 18 | this.radius2 = radius; 19 | return this; 20 | } 21 | 22 | public SDFCappedCone setHeight(float height) { 23 | this.height = height; 24 | return this; 25 | } 26 | 27 | @Override 28 | public float getDistance(float x, float y, float z) { 29 | float qx = MHelper.length(x, z); 30 | float k2x = radius2 - radius1; 31 | float k2y = 2 * height; 32 | float cax = qx - MHelper.min(qx, (y < 0F) ? radius1 : radius2); 33 | float cay = Math.abs(y) - height; 34 | float mlt = Mth.clamp( 35 | MHelper.dot(radius2 - qx, height - y, k2x, k2y) / MHelper.dot(k2x, k2y, k2x, k2y), 36 | 0F, 37 | 1F 38 | ); 39 | float cbx = qx - radius2 + k2x * mlt; 40 | float cby = y - height + k2y * mlt; 41 | float s = (cbx < 0F && cay < 0F) ? -1F : 1F; 42 | return s * (float) Math.sqrt(MHelper.min(MHelper.dot(cax, cay, cax, cay), MHelper.dot(cbx, cby, cbx, cby))); 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /src/main/java/org/betterx/bclib/complexmaterials/entry/SlotMap.java: -------------------------------------------------------------------------------- 1 | package org.betterx.bclib.complexmaterials.entry; 2 | 3 | import org.betterx.bclib.complexmaterials.ComplexMaterialSet; 4 | 5 | import java.util.Iterator; 6 | import java.util.LinkedHashMap; 7 | import java.util.Map; 8 | import org.jetbrains.annotations.NotNull; 9 | 10 | public class SlotMap>> implements Iterable> { 11 | private final Map> map; 12 | 13 | public SlotMap() { 14 | this.map = new LinkedHashMap<>(); 15 | } 16 | 17 | public static >> SlotMap of(MaterialSlot... slots) { 18 | final SlotMap map = new SlotMap<>(); 19 | for (MaterialSlot slot : slots) { 20 | map.add(slot); 21 | } 22 | return map; 23 | } 24 | 25 | public SlotMap replace(MaterialSlot slot) { 26 | return add(slot); 27 | } 28 | 29 | public SlotMap add(MaterialSlot slot) { 30 | map.put(slot.suffix, slot); 31 | return this; 32 | } 33 | 34 | public SlotMap remove(MaterialSlot slot) { 35 | map.remove(slot.suffix); 36 | return this; 37 | } 38 | 39 | public SlotMap remove(String slot) { 40 | map.remove(slot); 41 | return this; 42 | } 43 | 44 | @NotNull 45 | @Override 46 | public Iterator> iterator() { 47 | return map.values().iterator(); 48 | } 49 | } 50 | -------------------------------------------------------------------------------- /src/main/java/org/betterx/bclib/mixin/common/LayerLightSectionStorageMixin.java: -------------------------------------------------------------------------------- 1 | package org.betterx.bclib.mixin.common; 2 | 3 | import net.minecraft.core.BlockPos; 4 | import net.minecraft.core.SectionPos; 5 | import net.minecraft.world.level.chunk.DataLayer; 6 | import net.minecraft.world.level.lighting.LayerLightSectionStorage; 7 | 8 | import org.spongepowered.asm.mixin.Mixin; 9 | import org.spongepowered.asm.mixin.Shadow; 10 | import org.spongepowered.asm.mixin.injection.At; 11 | import org.spongepowered.asm.mixin.injection.Inject; 12 | import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; 13 | 14 | @Mixin(LayerLightSectionStorage.class) 15 | public class LayerLightSectionStorageMixin { 16 | @Shadow 17 | protected DataLayer getDataLayer(long sectionPos, boolean cached) { 18 | return null; 19 | } 20 | 21 | @Inject(method = "getStoredLevel", at = @At(value = "HEAD"), cancellable = true) 22 | private void bclib_lightFix(long blockPos, CallbackInfoReturnable info) { 23 | try { 24 | long pos = SectionPos.blockToSection(blockPos); 25 | DataLayer dataLayer = this.getDataLayer(pos, true); 26 | info.setReturnValue(dataLayer.get( 27 | SectionPos.sectionRelative(BlockPos.getX(blockPos)), 28 | SectionPos.sectionRelative(BlockPos.getY(blockPos)), 29 | SectionPos.sectionRelative(BlockPos.getZ(blockPos)) 30 | )); 31 | } catch (Exception e) { 32 | info.setReturnValue(0); 33 | } 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /src/main/java/org/betterx/bclib/blocks/WallMushroomBlock.java: -------------------------------------------------------------------------------- 1 | package org.betterx.bclib.blocks; 2 | 3 | import org.betterx.bclib.behaviours.BehaviourBuilders; 4 | 5 | import net.minecraft.core.BlockPos; 6 | import net.minecraft.core.Direction; 7 | import net.minecraft.world.item.ItemStack; 8 | import net.minecraft.world.level.LevelReader; 9 | import net.minecraft.world.level.block.SoundType; 10 | import net.minecraft.world.level.block.state.BlockBehaviour; 11 | import net.minecraft.world.level.block.state.BlockState; 12 | import net.minecraft.world.level.storage.loot.LootParams; 13 | 14 | import com.google.common.collect.Lists; 15 | 16 | import java.util.List; 17 | 18 | public abstract class WallMushroomBlock extends BaseWallPlantBlock { 19 | public WallMushroomBlock(int light) { 20 | super(BehaviourBuilders.createPlant() 21 | .destroyTime(0.2F) 22 | .lightLevel(state -> light) 23 | .sound(SoundType.WOOD) 24 | ); 25 | } 26 | 27 | protected WallMushroomBlock(BlockBehaviour.Properties properties) { 28 | super(properties); 29 | } 30 | 31 | @Override 32 | public List getDrops(BlockState state, LootParams.Builder builder) { 33 | return Lists.newArrayList(new ItemStack(this)); 34 | } 35 | 36 | @Override 37 | public boolean isSupport(LevelReader world, BlockPos pos, BlockState blockState, Direction direction) { 38 | return blockState.isSolid() && blockState.isFaceSturdy(world, pos, direction); 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /src/main/java/org/betterx/bclib/blockentities/DynamicBlockEntityType.java: -------------------------------------------------------------------------------- 1 | package org.betterx.bclib.blockentities; 2 | 3 | import net.minecraft.core.BlockPos; 4 | import net.minecraft.world.level.block.Block; 5 | import net.minecraft.world.level.block.entity.BlockEntity; 6 | import net.minecraft.world.level.block.entity.BlockEntityType; 7 | import net.minecraft.world.level.block.state.BlockState; 8 | 9 | import com.google.common.collect.Sets; 10 | 11 | import java.util.Collections; 12 | import java.util.Set; 13 | import org.jetbrains.annotations.Nullable; 14 | 15 | public class DynamicBlockEntityType extends BlockEntityType { 16 | 17 | private final Set validBlocks = Sets.newHashSet(); 18 | private final BlockEntitySupplier factory; 19 | 20 | public DynamicBlockEntityType(BlockEntitySupplier supplier) { 21 | super(null, Collections.emptySet(), null); 22 | this.factory = supplier; 23 | } 24 | 25 | @Override 26 | @Nullable 27 | public T create(BlockPos blockPos, BlockState blockState) { 28 | return factory.create(blockPos, blockState); 29 | } 30 | 31 | @Override 32 | public boolean isValid(BlockState blockState) { 33 | return validBlocks.contains(blockState.getBlock()); 34 | } 35 | 36 | public void registerBlock(Block block) { 37 | validBlocks.add(block); 38 | } 39 | 40 | @FunctionalInterface 41 | public interface BlockEntitySupplier { 42 | T create(BlockPos blockPos, BlockState blockState); 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /src/main/java/org/betterx/bclib/blocks/BaseBlockWithEntity.java: -------------------------------------------------------------------------------- 1 | package org.betterx.bclib.blocks; 2 | 3 | import org.betterx.bclib.behaviours.interfaces.BehaviourStone; 4 | 5 | import com.mojang.serialization.MapCodec; 6 | import net.minecraft.core.BlockPos; 7 | import net.minecraft.world.item.ItemStack; 8 | import net.minecraft.world.level.block.BaseEntityBlock; 9 | import net.minecraft.world.level.block.entity.BlockEntity; 10 | import net.minecraft.world.level.block.state.BlockState; 11 | import net.minecraft.world.level.storage.loot.LootParams; 12 | 13 | import java.util.Collections; 14 | import java.util.List; 15 | 16 | public abstract class BaseBlockWithEntity extends BaseEntityBlock { 17 | 18 | protected BaseBlockWithEntity(Properties settings) { 19 | super(settings); 20 | } 21 | 22 | @Override 23 | public BlockEntity newBlockEntity(BlockPos blockPos, BlockState blockState) { 24 | return null; 25 | } 26 | 27 | @Override 28 | @SuppressWarnings("deprecation") 29 | public List getDrops(BlockState state, LootParams.Builder builder) { 30 | return Collections.singletonList(new ItemStack(this)); 31 | } 32 | 33 | public static class Stone extends BaseBlockWithEntity implements BehaviourStone { 34 | public static final MapCodec CODEC = simpleCodec(Stone::new); 35 | 36 | public Stone(Properties settings) { 37 | super(settings); 38 | } 39 | 40 | @Override 41 | protected MapCodec codec() { 42 | return Stone.CODEC; 43 | } 44 | } 45 | } 46 | --------------------------------------------------------------------------------