Skip to content
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
71 changes: 51 additions & 20 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
plugins {
id 'fabric-loom' version '1.1.2'
id 'fabric-loom' version '1.6-SNAPSHOT'
id 'maven-publish'
}

Expand All @@ -8,6 +8,19 @@ group = project.maven_group as String

repositories {
maven { url 'https://jitpack.io' }
mavenCentral()
}

loom {
splitEnvironmentSourceSets()

mods {
"modid" {
sourceSet sourceSets.main
sourceSet sourceSets.client
}
}

}

dependencies {
Expand All @@ -19,33 +32,51 @@ dependencies {
// Fabric API. This is technically optional, but you probably want it anyway.
modImplementation "net.fabricmc.fabric-api:fabric-api:${project.fabric_version}"

include(implementation(annotationProcessor("com.github.llamalad7.mixinextras:mixinextras-fabric:0.2.0-beta.9")))
include(implementation(annotationProcessor("io.github.llamalad7:mixinextras-fabric:0.5.0")))
}

processResources {
inputs.property "version", project.version
filteringCharset "UTF-8"
inputs.property "version", project.version

filesMatching("fabric.mod.json") {
expand "version": project.version
}
}

filesMatching("fabric.mod.json") {
expand "version": project.version
}
tasks.withType(JavaCompile).configureEach {
it.options.release = 21
}

def targetJavaVersion = 17
java {
def javaVersion = JavaVersion.toVersion(targetJavaVersion)
if (JavaVersion.current() < javaVersion) {
toolchain.languageVersion = JavaLanguageVersion.of(targetJavaVersion as String)
}
archivesBaseName = project.archives_base_name
// Loom will automatically attach sourcesJar to a RemapSourcesJar task and to the "build" task
// if it is present.
// If you remove this line, sources will not be generated.
withSourcesJar()
// Loom will automatically attach sourcesJar to a RemapSourcesJar task and to the "build" task
// if it is present.
// If you remove this line, sources will not be generated.
withSourcesJar()

sourceCompatibility = JavaVersion.VERSION_21
targetCompatibility = JavaVersion.VERSION_21
}

jar {
from("LICENSE") {
rename { "${it}_${project.archivesBaseName}" }
}
from("LICENSE") {
rename { "${it}_${project.base.archivesName.get()}"}
}
}

// configure the maven publication
publishing {
publications {
create("mavenJava", MavenPublication) {
artifactId = project.archives_base_name
from components.java
}
}

// See https://docs.gradle.org/current/userguide/publishing_maven.html for information on how to set up publishing.
repositories {
// Add repositories to publish to here.
// Notice: This block does NOT have the same function as the block in the top level.
// The repositories here will be used for publishing your artifact, not for
// retrieving dependencies.
}
}
11 changes: 7 additions & 4 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,16 @@
org.gradle.jvmargs=-Xmx1G
# Fabric Properties
# check these on https://modmuss50.me/fabric.html
minecraft_version=1.20.1
yarn_mappings=1.20.1+build.9
loader_version=0.14.21
minecraft_version=1.21.1
yarn_mappings=1.21.1+build.3
loader_version=0.17.3
loom_version=1.11-SNAPSHOT

# Fabric API
fabric_version=0.116.7+1.21.1
# Mod Properties
mod_version=1.0.2
maven_group=me.iru
archives_base_name=bedoverhaul
# Dependencies
# check this on https://modmuss50.me/fabric.html
fabric_version=0.86.0+1.20.1
6 changes: 4 additions & 2 deletions gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-7.4.2-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.7-bin.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
zipStorePath=wrapper/dists
Empty file modified gradlew
100644 → 100755
Empty file.
10 changes: 5 additions & 5 deletions src/main/java/me/iru/bedoverhaul/mixin/BedBlockMixin.java
Original file line number Diff line number Diff line change
Expand Up @@ -33,19 +33,19 @@ protected BedBlockMixin(Settings settings) {
}

@Inject(method = "onUse", at = @At("HEAD"), cancellable = true)
public void bedoverhaul$applyBedUpgradeHandler(BlockState state, World world, BlockPos pos, PlayerEntity player, Hand hand, BlockHitResult hit, CallbackInfoReturnable<ActionResult> cir) {
public void bedoverhaul$applyBedUpgradeHandler(BlockState state, World world, BlockPos pos, PlayerEntity player, BlockHitResult hit, CallbackInfoReturnable<ActionResult> cir) {
ModifiedBedBlockEntity bed = (ModifiedBedBlockEntity) world.getBlockEntity(pos);
if(bed != null) {
boolean shouldUpgradeCompass = player.getStackInHand(hand).isOf(Items.COMPASS) && !bed.bedOverhaul$getCanSetSpawnPoint();
boolean shouldUpgradeClock = player.getStackInHand(hand).isOf(Items.CLOCK) && !bed.bedOverhaul$getCanResetTime();
boolean shouldUpgradeCompass = player.getStackInHand(player.preferredHand).isOf(Items.COMPASS) && !bed.bedOverhaul$getCanSetSpawnPoint();
boolean shouldUpgradeClock = player.getStackInHand(player.preferredHand).isOf(Items.CLOCK) && !bed.bedOverhaul$getCanResetTime();
boolean success = false;
if(shouldUpgradeCompass) success = BedUpgradeHelper.upgradeFullBed(world, pos, BedUpgradeHelper.BedUpgrade.SpawnPointUpgrade);
else if(shouldUpgradeClock) success = BedUpgradeHelper.upgradeFullBed(world, pos, BedUpgradeHelper.BedUpgrade.TimeResetUpgrade);
if(success) {
if(!player.getAbilities().creativeMode) {
player.getStackInHand(hand).decrement(1);
player.getStackInHand(player.preferredHand).decrement(1);
}
player.playSound(SoundEvents.ENTITY_EXPERIENCE_ORB_PICKUP, SoundCategory.BLOCKS, 1.0f, 1.0f);
player.playSound(SoundEvents.ENTITY_EXPERIENCE_ORB_PICKUP,1.0f,1.0f);
for (int i = 0; i < 5; ++i) {
double d = this.random.nextGaussian() * 0.02;
double e = this.random.nextGaussian() * 0.02;
Expand Down