mirror of
https://github.com/SquidDev-CC/CC-Tweaked
synced 2025-08-31 09:37:56 +00:00
Merge branch 'mc-1.20.x' into mc-1.21.x
As part of this, we also rewrite some of the turtle placing code, and how it uses the turtle_can_use tag: Minecraft 1.21 cleaned up the item/block clicking code a little bit, splitting Block.use into Block.useItemOn and Block.useWithoutItem. The first of these is pretty much exactly what we wanted in the first place, so the tag was kinda redundant and we commented it out in the 1.21 update. This was never meant to be a long-term fix, but time has gone by anyway. We now check that tag, and call useWithoutItem() if present — effectively restoring the previous behaviour. Fixes #2011
This commit is contained in:
@@ -61,6 +61,16 @@ configurations {
|
||||
include { extendsFrom(includeRuntimeOnly.get(), includeImplementation.get()) }
|
||||
runtimeOnly { extendsFrom(includeRuntimeOnly.get()) }
|
||||
implementation { extendsFrom(includeImplementation.get()) }
|
||||
|
||||
// Declare a configuration for projects which are on the compile and runtime classpath, but not treated as
|
||||
// dependencies. This is used for our local projects.
|
||||
val localImplementation by registering {
|
||||
isCanBeResolved = false
|
||||
isCanBeConsumed = false
|
||||
isVisible = false
|
||||
}
|
||||
compileClasspath { extendsFrom(localImplementation.get()) }
|
||||
runtimeClasspath { extendsFrom(localImplementation.get()) }
|
||||
}
|
||||
|
||||
dependencies {
|
||||
@@ -90,9 +100,9 @@ dependencies {
|
||||
"includeImplementation"(libs.nightConfig.toml)
|
||||
|
||||
// Pull in our other projects. See comments in MinecraftConfigurations on this nastiness.
|
||||
api(commonClasses(project(":fabric-api"))) { cct.exclude(this) }
|
||||
clientApi(clientClasses(project(":fabric-api"))) { cct.exclude(this) }
|
||||
implementation(project(":core")) { cct.exclude(this) }
|
||||
"localImplementation"(project(":core"))
|
||||
"localImplementation"(commonClasses(project(":fabric-api")))
|
||||
clientImplementation(clientClasses(project(":fabric-api")))
|
||||
|
||||
annotationProcessorEverywhere(libs.autoService)
|
||||
|
||||
@@ -211,11 +221,9 @@ loom {
|
||||
}
|
||||
|
||||
tasks.processResources {
|
||||
inputs.property("version", modVersion)
|
||||
var props = mapOf("version" to modVersion)
|
||||
|
||||
filesMatching("fabric.mod.json") {
|
||||
expand(mapOf("version" to modVersion))
|
||||
}
|
||||
filesMatching("fabric.mod.json") { expand(props) }
|
||||
}
|
||||
|
||||
tasks.jar {
|
||||
@@ -281,17 +289,6 @@ modPublishing {
|
||||
output = tasks.remapJar
|
||||
}
|
||||
|
||||
tasks.withType(GenerateModuleMetadata::class).configureEach { isEnabled = false }
|
||||
publishing {
|
||||
publications {
|
||||
named("maven", MavenPublication::class) {
|
||||
mavenDependencies {
|
||||
cct.configureExcludes(this)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
modrinth {
|
||||
required.project("fabric-api")
|
||||
}
|
||||
|
@@ -54,7 +54,6 @@ import net.minecraft.world.entity.player.Player;
|
||||
import net.minecraft.world.inventory.AbstractContainerMenu;
|
||||
import net.minecraft.world.inventory.MenuType;
|
||||
import net.minecraft.world.item.*;
|
||||
import net.minecraft.world.item.context.UseOnContext;
|
||||
import net.minecraft.world.item.crafting.Ingredient;
|
||||
import net.minecraft.world.level.Level;
|
||||
import net.minecraft.world.level.block.entity.BlockEntity;
|
||||
@@ -68,7 +67,6 @@ import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
import java.util.function.Consumer;
|
||||
import java.util.function.Predicate;
|
||||
import java.util.function.Supplier;
|
||||
|
||||
@AutoService(PlatformHelper.class)
|
||||
@@ -225,20 +223,10 @@ public class PlatformHelperImpl implements PlatformHelper {
|
||||
}
|
||||
|
||||
@Override
|
||||
public InteractionResult useOn(ServerPlayer player, ItemStack stack, BlockHitResult hit, Predicate<BlockState> canUseBlock) {
|
||||
public UseOnResult useOn(ServerPlayer player, ItemStack stack, BlockHitResult hit) {
|
||||
var result = UseBlockCallback.EVENT.invoker().interact(player, player.level(), InteractionHand.MAIN_HAND, hit);
|
||||
if (result != InteractionResult.PASS) return result;
|
||||
|
||||
var block = player.level().getBlockState(hit.getBlockPos());
|
||||
if (!block.isAir() && canUseBlock.test(block)) {
|
||||
var useResult = block.useItemOn(stack, player.level(), player, InteractionHand.MAIN_HAND, hit);
|
||||
if (useResult.consumesAction()) return useResult.result();
|
||||
|
||||
// TODO(1.20.5): Should we do this unconditionally now? Or at least a better way of configuring it.
|
||||
// TODO(1.20.5: What to do with useWithoutItem
|
||||
}
|
||||
|
||||
return stack.useOn(new UseOnContext(player, InteractionHand.MAIN_HAND, hit));
|
||||
if (result != InteractionResult.PASS) return new UseOnResult.Handled(result);
|
||||
return new UseOnResult.Continue(true, true);
|
||||
}
|
||||
|
||||
private static final class RegistrationHelperImpl<T> implements RegistrationHelper<T> {
|
||||
|
Reference in New Issue
Block a user