stonnecutter
This commit is contained in:
32
build.gradle
32
build.gradle
@@ -16,6 +16,10 @@ repositories {
|
||||
// Loom adds the essential maven repositories to download Minecraft and libraries from automatically.
|
||||
// See https://docs.gradle.org/current/userguide/declaring_repositories.html
|
||||
// for more information about repositories.
|
||||
maven {
|
||||
name = "TerraformersMC"
|
||||
url = "https://maven.terraformersmc.com/releases/"
|
||||
}
|
||||
}
|
||||
|
||||
loom {
|
||||
@@ -38,6 +42,7 @@ dependencies {
|
||||
|
||||
// Fabric API. This is technically optional, but you probably want it anyway.
|
||||
modImplementation "net.fabricmc.fabric-api:fabric-api:${project.fabric_api_version}"
|
||||
modImplementation "com.terraformersmc:modmenu:${project.modmenu_version}"
|
||||
|
||||
}
|
||||
|
||||
@@ -50,7 +55,7 @@ processResources {
|
||||
}
|
||||
|
||||
tasks.withType(JavaCompile).configureEach {
|
||||
it.options.release = 21
|
||||
it.options.release = 17
|
||||
}
|
||||
|
||||
java {
|
||||
@@ -59,8 +64,8 @@ java {
|
||||
// If you remove this line, sources will not be generated.
|
||||
withSourcesJar()
|
||||
|
||||
sourceCompatibility = JavaVersion.VERSION_21
|
||||
targetCompatibility = JavaVersion.VERSION_21
|
||||
sourceCompatibility = JavaVersion.VERSION_17
|
||||
targetCompatibility = JavaVersion.VERSION_17
|
||||
}
|
||||
|
||||
jar {
|
||||
@@ -71,6 +76,25 @@ jar {
|
||||
}
|
||||
}
|
||||
|
||||
def modrinthModsDir = providers.environmentVariable("APPDATA")
|
||||
.map { new File(it, "ModrinthApp/profiles/${project.minecraft_version}/mods") }
|
||||
|
||||
tasks.register("copyRemappedJarToModrinth", Copy) {
|
||||
dependsOn tasks.named("remapJar")
|
||||
from(tasks.named("remapJar").flatMap { it.archiveFile })
|
||||
into(modrinthModsDir)
|
||||
|
||||
doFirst {
|
||||
if (!modrinthModsDir.isPresent()) {
|
||||
throw new GradleException("APPDATA no esta disponible; no se puede resolver la ruta de Modrinth.")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
tasks.named("remapJar") {
|
||||
finalizedBy(tasks.named("copyRemappedJarToModrinth"))
|
||||
}
|
||||
|
||||
// configure the maven publication
|
||||
publishing {
|
||||
publications {
|
||||
@@ -87,4 +111,4 @@ publishing {
|
||||
// The repositories here will be used for publishing your artifact, not for
|
||||
// retrieving dependencies.
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -7,7 +7,7 @@ org.gradle.configuration-cache=false
|
||||
|
||||
# Fabric Properties
|
||||
# check these on https://fabricmc.net/develop
|
||||
minecraft_version=1.21.11
|
||||
minecraft_version=1.20
|
||||
loader_version=0.18.4
|
||||
loom_version=1.14-SNAPSHOT
|
||||
|
||||
@@ -17,4 +17,5 @@ maven_group=com.straice
|
||||
archives_base_name=template-mod
|
||||
|
||||
# Dependencies
|
||||
fabric_api_version=0.141.1+1.21.11
|
||||
fabric_api_version=0.83.0+1.20
|
||||
modmenu_version=7.0.1
|
||||
|
||||
@@ -4,7 +4,23 @@ pluginManagement {
|
||||
name = 'Fabric'
|
||||
url = 'https://maven.fabricmc.net/'
|
||||
}
|
||||
maven {
|
||||
name = 'KikuGie'
|
||||
url = 'https://maven.kikugie.dev/releases'
|
||||
}
|
||||
mavenCentral()
|
||||
gradlePluginPortal()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
plugins {
|
||||
id 'dev.kikugie.stonecutter' version '0.8.3'
|
||||
}
|
||||
|
||||
stonecutter {
|
||||
shared {
|
||||
versions '1.20'
|
||||
}
|
||||
|
||||
create rootProject
|
||||
}
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
{
|
||||
"required": true,
|
||||
"package": "com.straice.mixin.client",
|
||||
"compatibilityLevel": "JAVA_21",
|
||||
"compatibilityLevel": "JAVA_17",
|
||||
"client": [
|
||||
"ExampleClientMixin"
|
||||
],
|
||||
"injectors": {
|
||||
"defaultRequire": 1
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
73
src/main/java/com/straice/mixin/DoorBlockMixin.java
Normal file
73
src/main/java/com/straice/mixin/DoorBlockMixin.java
Normal file
@@ -0,0 +1,73 @@
|
||||
package com.straice.mixin;
|
||||
|
||||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.core.Direction;
|
||||
import net.minecraft.world.InteractionHand;
|
||||
import net.minecraft.world.InteractionResult;
|
||||
import net.minecraft.world.entity.player.Player;
|
||||
import net.minecraft.world.level.Level;
|
||||
import net.minecraft.world.level.block.DoorBlock;
|
||||
import net.minecraft.world.level.block.state.BlockState;
|
||||
import net.minecraft.world.level.block.state.properties.DoubleBlockHalf;
|
||||
import net.minecraft.world.phys.BlockHitResult;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.injection.At;
|
||||
import org.spongepowered.asm.mixin.injection.Inject;
|
||||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
|
||||
|
||||
@Mixin(DoorBlock.class)
|
||||
public class DoorBlockMixin {
|
||||
@Inject(method = "use", at = @At("RETURN"))
|
||||
private void smoothdoors$openAdjacentDoor(
|
||||
BlockState state,
|
||||
Level level,
|
||||
BlockPos pos,
|
||||
Player player,
|
||||
InteractionHand hand,
|
||||
BlockHitResult hit,
|
||||
CallbackInfoReturnable<InteractionResult> cir
|
||||
) {
|
||||
if (level.isClientSide) {
|
||||
return;
|
||||
}
|
||||
if (!cir.getReturnValue().consumesAction()) {
|
||||
return;
|
||||
}
|
||||
|
||||
BlockPos basePos = state.getValue(DoorBlock.HALF) == DoubleBlockHalf.LOWER ? pos : pos.below();
|
||||
BlockState baseState = level.getBlockState(basePos);
|
||||
if (!(baseState.getBlock() instanceof DoorBlock)) {
|
||||
return;
|
||||
}
|
||||
|
||||
boolean open = baseState.getValue(DoorBlock.OPEN);
|
||||
Direction facing = baseState.getValue(DoorBlock.FACING);
|
||||
|
||||
openNeighborDoor(level, basePos.relative(facing.getCounterClockWise()), baseState, open, player);
|
||||
openNeighborDoor(level, basePos.relative(facing.getClockWise()), baseState, open, player);
|
||||
}
|
||||
|
||||
private static void openNeighborDoor(
|
||||
Level level,
|
||||
BlockPos neighborPos,
|
||||
BlockState baseState,
|
||||
boolean open,
|
||||
Player player
|
||||
) {
|
||||
BlockState neighborState = level.getBlockState(neighborPos);
|
||||
if (neighborState.getBlock() != baseState.getBlock()) {
|
||||
return;
|
||||
}
|
||||
if (neighborState.getValue(DoorBlock.HALF) != DoubleBlockHalf.LOWER) {
|
||||
return;
|
||||
}
|
||||
if (neighborState.getValue(DoorBlock.FACING) != baseState.getValue(DoorBlock.FACING)) {
|
||||
return;
|
||||
}
|
||||
if (neighborState.getValue(DoorBlock.OPEN) == open) {
|
||||
return;
|
||||
}
|
||||
|
||||
((DoorBlock) neighborState.getBlock()).setOpen(player, level, neighborState, neighborPos, open);
|
||||
}
|
||||
}
|
||||
@@ -31,8 +31,9 @@
|
||||
],
|
||||
"depends": {
|
||||
"fabricloader": ">=0.18.4",
|
||||
"minecraft": "~1.21.11",
|
||||
"java": ">=21",
|
||||
"fabric-api": "*"
|
||||
"minecraft": "~1.20",
|
||||
"java": ">=17",
|
||||
"fabric-api": "*",
|
||||
"modmenu": ">=7.0.1"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,8 +1,9 @@
|
||||
{
|
||||
"required": true,
|
||||
"package": "com.straice.mixin",
|
||||
"compatibilityLevel": "JAVA_21",
|
||||
"compatibilityLevel": "JAVA_17",
|
||||
"mixins": [
|
||||
"DoorBlockMixin",
|
||||
"ExampleMixin"
|
||||
],
|
||||
"injectors": {
|
||||
@@ -11,4 +12,4 @@
|
||||
"overwrites": {
|
||||
"requireAnnotations": true
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
4
stonecutter.gradle.kts
Normal file
4
stonecutter.gradle.kts
Normal file
@@ -0,0 +1,4 @@
|
||||
plugins {
|
||||
id("dev.kikugie.stonecutter")
|
||||
}
|
||||
stonecutter active "1.20"
|
||||
2
versions/1.20/gradle.properties
Normal file
2
versions/1.20/gradle.properties
Normal file
@@ -0,0 +1,2 @@
|
||||
minecraft_version=1.20
|
||||
fabric_api_version=0.83.0+1.20
|
||||
Reference in New Issue
Block a user