Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Fabric 1.20.1] Adding compat for simple copper pipes - support dripping #6

Open
wants to merge 1 commit into
base: fabric-1.20.1-1.0.1
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 11 additions & 1 deletion build.gradle
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
plugins {
id 'fabric-loom' version '1.6-SNAPSHOT'
id 'fabric-loom' version '1.7-SNAPSHOT'
id 'maven-publish'
}

Expand All @@ -25,6 +25,14 @@ repositories {
name = 'ParchmentMC'
url = 'https://maven.parchmentmc.org'
}

maven {
name = 'Modrinth'
url = 'https://api.modrinth.com/maven'
content {
includeGroup 'maven.modrinth'
}
}
}

fabricApi {
Expand All @@ -42,6 +50,8 @@ dependencies {

// Fabric API. This is technically optional, but you probably want it anyway.
modImplementation "net.fabricmc.fabric-api:fabric-api:${project.fabric_version}"

modImplementation "maven.modrinth:simple-copper-pipes:RMObPif0" // 1.20.1-1.16.1
}

processResources {
Expand Down
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.7-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.8-bin.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
Expand Down
11 changes: 11 additions & 0 deletions src/main/java/net/paddedshaman/blazingbamboo/BlazingBamboo.java
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import net.fabricmc.fabric.api.biome.v1.BiomeSelectors;
import net.fabricmc.fabric.api.registry.FuelRegistry;
import net.fabricmc.fabric.api.registry.StrippableBlockRegistry;
import net.fabricmc.loader.api.FabricLoader;
import net.minecraft.core.Registry;
import net.minecraft.core.registries.BuiltInRegistries;
import net.minecraft.core.registries.Registries;
Expand All @@ -14,6 +15,7 @@
import net.minecraft.world.level.levelgen.GenerationStep;
import net.minecraft.world.level.levelgen.feature.configurations.RandomPatchConfiguration;
import net.paddedshaman.blazingbamboo.block.BBBlocks;
import net.paddedshaman.blazingbamboo.block.BlazingBambooBlock;
import net.paddedshaman.blazingbamboo.block.entity.BBBlockEntities;
import net.paddedshaman.blazingbamboo.entity.BBEntities;
import net.paddedshaman.blazingbamboo.item.BBCreativeModeTabs;
Expand Down Expand Up @@ -45,5 +47,14 @@ public void onInitialize() {
new BlazingBambooFeature(RandomPatchConfiguration.CODEC));
BiomeModifications.addFeature(BiomeSelectors.includeByKey(Biomes.CRIMSON_FOREST), GenerationStep.Decoration.VEGETAL_DECORATION,
ResourceKey.create(Registries.PLACED_FEATURE, new ResourceLocation(BlazingBamboo.MOD_ID, "blazing_bamboo_placed")));

// Add Simple Copper Pipes compatibility if it is loaded
if (FabricLoader.getInstance().isModLoaded("copper_pipe")) {
net.lunade.copper.leaking_pipes.LeakingPipeDrips.register(BBBlocks.BLAZING_BAMBOO, (lava, pLevel, pPos, pState) -> {
if (!lava && pState.getBlock() instanceof BlazingBambooBlock bambooBlock) {
bambooBlock.rainOnBamboo(pLevel, pPos);
}
});
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,12 @@ public void randomTick(BlockState pState, ServerLevel pLevel, BlockPos pPos, Ran
}
}

public void rainOnBamboo(Level pLevel, BlockPos headBlockPos) {
int i = this.getHeightBelowUpToMax(pLevel, headBlockPos) + 1;
BlockPos baseBlockPos = headBlockPos.below(i);
this.extinguishBamboo(pLevel, baseBlockPos);
}

protected void extinguishBamboo(Level pLevel, BlockPos baseBlockPos) {
BlockState deadStalk = BBBlocks.DEAD_BAMBOO.defaultBlockState();
int height = getHeightAboveUpToMax(pLevel, baseBlockPos);
Expand Down