Compare commits
9 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 9efe6499d0 | |||
| 319946e8c1 | |||
| 28ce6ae7b1 | |||
| af4a8a8731 | |||
| 7059c6a062 | |||
| 98a8b65665 | |||
| ac6b1e2377 | |||
| 0e964ae71c | |||
| ba6bd9f71c |
@@ -7,6 +7,20 @@ on:
|
||||
pull_request:
|
||||
branches:
|
||||
- "**"
|
||||
workflow_dispatch:
|
||||
inputs:
|
||||
force-release:
|
||||
description: "Force release if you enter 1, default release if not released else skip release"
|
||||
required: false
|
||||
default: "0"
|
||||
force-push:
|
||||
description: "Push to repo if you enter 1, default push if not released else skip push repo"
|
||||
required: false
|
||||
default: "0"
|
||||
comments:
|
||||
description: "Add comments to release"
|
||||
required: false
|
||||
default: ""
|
||||
|
||||
permissions: write-all
|
||||
|
||||
@@ -18,7 +32,7 @@ jobs:
|
||||
- name: Checkout Git Repository
|
||||
uses: actions/checkout@v5
|
||||
|
||||
- name: Set up JDK
|
||||
- name: Set Up JDK
|
||||
uses: actions/setup-java@v5
|
||||
with:
|
||||
distribution: zulu
|
||||
@@ -49,20 +63,51 @@ jobs:
|
||||
if: github.event_name != 'pull_request'
|
||||
run: sh scripts/SetENV.sh
|
||||
|
||||
- name: Check If Release Exists
|
||||
if: github.event_name != 'pull_request' && env.flag_release == 'true'
|
||||
run: |
|
||||
git fetch --tags
|
||||
if [ -n "$(git tag -l "${{ env.tag }}")" ]; then
|
||||
echo "Release already exists"
|
||||
release_exists=true
|
||||
else
|
||||
echo "Release does not exist"
|
||||
release_exists=false
|
||||
fi
|
||||
if [ "$release_exists" == "true" ]; then
|
||||
counter=1
|
||||
while [ -n "$(git tag -l "${{ env.tag }}-${counter}")" ]; do
|
||||
counter=$((counter + 1))
|
||||
done
|
||||
echo "tag=${{ env.tag }}-${counter}" >> $GITHUB_ENV
|
||||
echo "release_count= - ${counter}" >> $GITHUB_ENV
|
||||
fi
|
||||
echo "release_exists=${release_exists}" >> $GITHUB_ENV
|
||||
|
||||
- name: Publish to repo
|
||||
if: github.event_name != 'pull_request' && env.flag_release == 'true' && false # do not push to any repo
|
||||
if: (( github.event_name != 'pull_request' && env.flag_release == 'true' && env.release_exists != 'true' ) || ( env.release_exists == 'true' && inputs.force-push == '1' )) && false # do not push to any repo
|
||||
continue-on-error: true
|
||||
run: ./gradlew --refresh-dependencies generateDevelopmentBundle publish -PpublishDevBundle=true
|
||||
env:
|
||||
PRIVATE_MAVEN_REPO_PASSWORD: ${{ secrets.PRIVATE_MAVEN_REPO_PASSWORD }}
|
||||
PRIVATE_MAVEN_REPO_USERNAME: ${{ secrets.PRIVATE_MAVEN_REPO_USERNAME }}
|
||||
|
||||
- name: Create Release
|
||||
if: github.event_name != 'pull_request' && env.flag_release == 'true'
|
||||
- name: Create Release - Pre Process
|
||||
if: ( github.event_name != 'pull_request' && env.flag_release == 'true' && env.release_exists != 'true' ) || ( env.release_exists == 'true' && inputs.force-release == '1' )
|
||||
run: |
|
||||
if [ ${{ inputs.comments }} == "" ]; then
|
||||
echo "No comments provided"
|
||||
echo "flag_comment=true" >> $GITHUB_ENV
|
||||
else
|
||||
echo "flag_comment=false" >> $GITHUB_ENV
|
||||
fi
|
||||
|
||||
- name: Create Release - No Comment
|
||||
if: env.flag_comment == 'false'
|
||||
uses: ncipollo/release-action@v1
|
||||
with:
|
||||
tag: ${{ env.tag }}
|
||||
name: ${{ env.project_id_b }} ${{ env.mcversion }} - ${{ env.commit_id }}
|
||||
name: ${{ env.project_id_b }} ${{ env.mcversion }} - ${{ env.commit_id }}${{ env.release_count }}
|
||||
body: |
|
||||
📦Version: `${{ env.mcversion }}` | Commit ${{ env.commit_id }} [](https://github.com/LuminolMC/${{ env.project_id }}/releases/download/${{ env.tag }}/${{ env.jar }})
|
||||
This release is automatically compiled by GitHub Actions
|
||||
@@ -75,3 +120,24 @@ jobs:
|
||||
prerelease: ${{ env.pre }}
|
||||
makeLatest: ${{ env.make_latest }}
|
||||
token: ${{ secrets.GITHUB_TOKEN }}
|
||||
|
||||
- name: Create Release - With Comment
|
||||
if: env.flag_comment == 'true'
|
||||
uses: ncipollo/release-action@v1
|
||||
with:
|
||||
tag: ${{ env.tag }}
|
||||
name: ${{ env.project_id_b }} ${{ env.mcversion }} - ${{ env.commit_id }}${{ env.release_count }}
|
||||
body: |
|
||||
📦Version: `${{ env.mcversion }}` | Commit ${{ env.commit_id }} [](https://github.com/LuminolMC/${{ env.project_id }}/releases/download/${{ env.tag }}/${{ env.jar }})
|
||||
This release is automatically compiled by GitHub Actions
|
||||
### Comments
|
||||
> ${{ inputs.comments }}
|
||||
### Branch Info
|
||||
> ${{ github.ref_name }}
|
||||
### Commit Message
|
||||
${{ env.commit_msg }}
|
||||
artifacts: ${{ env.jar_dir }}
|
||||
generateReleaseNotes: true
|
||||
prerelease: ${{ env.pre }}
|
||||
makeLatest: ${{ env.make_latest }}
|
||||
token: ${{ secrets.GITHUB_TOKEN }}
|
||||
|
||||
+1
-1
@@ -4,7 +4,7 @@ mcVersion=1.21.8
|
||||
release=2
|
||||
# 0 for skip release, 1 for pre-release, 2 for release
|
||||
|
||||
luminolRef=a2af823b646334cdc64abb32b859f394c55ce0cc
|
||||
luminolRef=b9904879bdfc881766da6df63a0f43236b0bf223
|
||||
|
||||
org.gradle.configuration-cache=true
|
||||
org.gradle.caching=true
|
||||
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
distributionBase=GRADLE_USER_HOME
|
||||
distributionPath=wrapper/dists
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-8.14.1-bin.zip
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-9.0.0-bin.zip
|
||||
networkTimeout=10000
|
||||
validateDistributionUrl=true
|
||||
zipStoreBase=GRADLE_USER_HOME
|
||||
|
||||
@@ -446,10 +446,10 @@ index 10b2cc20bbf3b70e4e09dbbe14b90506e6366158..1535bb8cec8692e8d26eaff090288f1b
|
||||
}
|
||||
|
||||
diff --git a/net/minecraft/world/level/block/entity/HopperBlockEntity.java b/net/minecraft/world/level/block/entity/HopperBlockEntity.java
|
||||
index 4b634dbb45dfb0823e7b21cf2354f89e5a6331e9..ef32bf1351aa28953bfc625d7a7d5175181a7acc 100644
|
||||
index aca3303a043144894ae20ddc43abc55790db44ad..55cbf9b4cc568fb9b418433f597ed6b64e4409b0 100644
|
||||
--- a/net/minecraft/world/level/block/entity/HopperBlockEntity.java
|
||||
+++ b/net/minecraft/world/level/block/entity/HopperBlockEntity.java
|
||||
@@ -145,7 +145,7 @@ public class HopperBlockEntity extends RandomizableContainerBlockEntity implemen
|
||||
@@ -148,7 +148,7 @@ public class HopperBlockEntity extends RandomizableContainerBlockEntity implemen
|
||||
public void setItem(int index, ItemStack stack) {
|
||||
this.unpackLootTable(null);
|
||||
this.getItems().set(index, stack);
|
||||
|
||||
@@ -7,25 +7,6 @@ Co-authored by: violetc <58360096+s-yh-china@users.noreply.github.com>
|
||||
As a part of : Leaves (https://github.com/LeavesMC/Leaves/blob/79d9ef74c2684eb49060f07e1ab31c827326c9a5/leaves-server/minecraft-patches/features/0009-Redstone-Shears-Wrench.patch)
|
||||
Licensed under: GPL-3.0 (https://www.gnu.org/licenses/gpl-3.0.html)
|
||||
|
||||
diff --git a/net/minecraft/world/item/BlockItem.java b/net/minecraft/world/item/BlockItem.java
|
||||
index 6db566adf2d0df1d26221eda04aa01738df6d3d2..24ebfdf98e343a7892af621d032c35819156deec 100644
|
||||
--- a/net/minecraft/world/item/BlockItem.java
|
||||
+++ b/net/minecraft/world/item/BlockItem.java
|
||||
@@ -56,6 +56,14 @@ public class BlockItem extends Item {
|
||||
if (blockPlaceContext == null) {
|
||||
return InteractionResult.FAIL;
|
||||
} else {
|
||||
+ // Leaves start - shears wrench
|
||||
+ if (org.leavesmc.leaves.util.ShearsWrenchUtil.shouldSkipPlace(context)) {
|
||||
+ if (context.getPlayer() != null) {
|
||||
+ context.getPlayer().containerMenu.forceHeldSlot(blockPlaceContext.getHand());
|
||||
+ }
|
||||
+ return InteractionResult.FAIL;
|
||||
+ }
|
||||
+ // Leaves end - shears wrench
|
||||
BlockState placementState = this.getPlacementState(blockPlaceContext);
|
||||
// CraftBukkit start - special case for handling block placement with water lilies and snow buckets
|
||||
org.bukkit.block.BlockState bukkitState = null;
|
||||
diff --git a/net/minecraft/world/item/ShearsItem.java b/net/minecraft/world/item/ShearsItem.java
|
||||
index 8cf3e51e12f9cf98836657e722edb23943f9e866..5fd5e9fd4e1a79dd1a9d62a5cf0c308805979420 100644
|
||||
--- a/net/minecraft/world/item/ShearsItem.java
|
||||
|
||||
+4
@@ -1,6 +1,7 @@
|
||||
package fun.bm.lophine.config.modules.function;
|
||||
|
||||
import me.earthme.luminol.config.IConfigModule;
|
||||
import me.earthme.luminol.config.flags.CommandSuggestions;
|
||||
import me.earthme.luminol.config.flags.ConfigClassInfo;
|
||||
import me.earthme.luminol.config.flags.ConfigInfo;
|
||||
import me.earthme.luminol.config.flags.TransformedConfig;
|
||||
@@ -9,18 +10,21 @@ import me.earthme.luminol.enums.EnumConfigCategory;
|
||||
@ConfigClassInfo(configAttribution = EnumConfigCategory.FUNCTION, mainName = "container_expansion")
|
||||
public class ContainerExpansionConfig implements IConfigModule {
|
||||
@TransformedConfig(name = "barrel_rows", category = {"misc", "container_expansion"})
|
||||
@CommandSuggestions(suggest = {"1", "2", "3", "4", "5", "6"})
|
||||
@ConfigInfo(baseName = "barrel_rows", comments =
|
||||
"""
|
||||
range: 1~6""")
|
||||
public static int barrelRows = 3;
|
||||
|
||||
@TransformedConfig(name = "enderchest_rows", category = {"misc", "container_expansion"})
|
||||
@CommandSuggestions(suggest = {"1", "2", "3", "4", "5", "6"})
|
||||
@ConfigInfo(baseName = "enderchest_rows", comments =
|
||||
"""
|
||||
range: 1~6""")
|
||||
public static int enderchestRows = 3;
|
||||
|
||||
@TransformedConfig(name = "shulker_stackable_count", category = {"misc", "container_expansion"})
|
||||
@CommandSuggestions(suggest = {"1", "2", "32", "64"})
|
||||
@ConfigInfo(baseName = "shulker_stackable_count", comments =
|
||||
"""
|
||||
range: 1~64""")
|
||||
|
||||
+6
@@ -1,6 +1,7 @@
|
||||
package fun.bm.lophine.config.modules.function;
|
||||
|
||||
import me.earthme.luminol.config.IConfigModule;
|
||||
import me.earthme.luminol.config.flags.CommandSuggestions;
|
||||
import me.earthme.luminol.config.flags.ConfigClassInfo;
|
||||
import me.earthme.luminol.config.flags.ConfigInfo;
|
||||
import me.earthme.luminol.config.flags.TransformedConfig;
|
||||
@@ -43,6 +44,11 @@ public class SurvuxProtocolConfig implements IConfigModule {
|
||||
public static boolean litematicsEnabled = false;
|
||||
|
||||
@TransformedConfig(name = "litematics-max-nbt-size", category = {"misc", "survux-protocol"})
|
||||
@CommandSuggestions(suggest = {"-1", "2097152"})
|
||||
@ConfigInfo(baseName = "litematics-max-nbt-size")
|
||||
public static int litematicsMaxNbtSize = 2097152;
|
||||
|
||||
@CommandSuggestions(suggest = {"-1", "1200"})
|
||||
@ConfigInfo(baseName = "litematics-print-max-delay-ticks", comments = "The max delay ticks for printing litematics, -1 to disable")
|
||||
public static int maxDelay = 1200;
|
||||
}
|
||||
|
||||
+2
-1
@@ -13,6 +13,7 @@ public class VillagerConfig implements IConfigModule {
|
||||
@ConfigInfo(baseName = "villager-infinite-trade", comments =
|
||||
"""
|
||||
Allow villager infinite trade (limit of 524288 times)
|
||||
---- we won't edit saved data, only edit in send data to client.""")
|
||||
---- we won't edit saved data, only edit in send data to client.
|
||||
(after we fixed void trade, this config will drop to void trade)""")
|
||||
public static boolean villagerInfiniteTrade = false;
|
||||
}
|
||||
|
||||
@@ -83,8 +83,8 @@ public class ServerI18nUtil {
|
||||
logger.warn("Unsupported language: {}", LanguageConfig.lang);
|
||||
// Fallback to English
|
||||
final ConfigsInstance configsInstance = ConfigManager.configfiles.get("lophine");
|
||||
configsInstance.setConfig(new String[]{"optimizations", "lang"}, "en_us");
|
||||
configsInstance.reloadAsync();
|
||||
configsInstance.setConfig(new String[]{"function", "language", "lang"}, "en_us");
|
||||
configsInstance.reloadAsync(true);
|
||||
} catch (Exception e) {
|
||||
if (e instanceof MalformedJsonException malformedJson) {
|
||||
malformedJson.clean();
|
||||
|
||||
+16
@@ -20,6 +20,7 @@ package org.leavesmc.leaves.command.bot.subcommands;
|
||||
import com.mojang.brigadier.arguments.StringArgumentType;
|
||||
import com.mojang.brigadier.exceptions.CommandSyntaxException;
|
||||
import io.papermc.paper.adventure.PaperAdventure;
|
||||
import net.minecraft.world.entity.LivingEntity;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
@@ -50,6 +51,21 @@ public class RemoveCommand extends BotSubcommand {
|
||||
}
|
||||
|
||||
private static boolean removeBot(@NotNull ServerBot bot, @Nullable CommandSender sender) {
|
||||
return removeBot(bot, sender, true);
|
||||
}
|
||||
|
||||
private static boolean removeBot(@NotNull ServerBot bot, @Nullable CommandSender sender, boolean taskQueue) {
|
||||
if (taskQueue) {
|
||||
bot.getBukkitEntity().taskScheduler.schedule((LivingEntity nmsEntity) -> {
|
||||
removeBotOrigin(bot, sender);
|
||||
}, null, 1L);
|
||||
} else {
|
||||
return removeBotOrigin(bot, sender);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
private static boolean removeBotOrigin(@NotNull ServerBot bot, @Nullable CommandSender sender) {
|
||||
boolean success = BotList.INSTANCE.removeBot(bot, BotRemoveEvent.RemoveReason.COMMAND, sender, false);
|
||||
if (!success) {
|
||||
sender = sender == null ? Bukkit.getConsoleSender() : sender;
|
||||
|
||||
+1
-17
@@ -269,23 +269,7 @@ public class ServuxLitematicsProtocol implements LeavesProtocol {
|
||||
long timeStart = System.currentTimeMillis();
|
||||
SchematicPlacement placement = SchematicPlacement.createFromNbt(tags);
|
||||
ReplaceBehavior replaceMode = ReplaceBehavior.fromStringStatic(tags.getStringOr("ReplaceMode", ReplaceBehavior.NONE.name()));
|
||||
io.papermc.paper.threadedregions.RegionizedServer.getInstance().taskQueue.queueTickTaskQueue(
|
||||
player.level(),
|
||||
ca.spottedleaf.moonrise.common.util.CoordinateUtils.getChunkX(player.position()),
|
||||
ca.spottedleaf.moonrise.common.util.CoordinateUtils.getChunkZ(player.position()),
|
||||
() -> {
|
||||
placement.pasteTo(serverLevel, replaceMode);
|
||||
long timeElapsed = System.currentTimeMillis() - timeStart;
|
||||
player.getBukkitEntity().sendActionBar(
|
||||
Component.text("Pasted ")
|
||||
.append(Component.text(placement.getName(), NamedTextColor.AQUA))
|
||||
.append(Component.text(" to world "))
|
||||
.append(Component.text(serverLevel.serverLevelData.getLevelName(), NamedTextColor.LIGHT_PURPLE))
|
||||
.append(Component.text(" in "))
|
||||
.append(Component.text(timeElapsed, NamedTextColor.GREEN))
|
||||
.append(Component.text("ms"))
|
||||
);
|
||||
});
|
||||
placement.pasteTo(serverLevel, replaceMode, player, timeStart);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+50
-3
@@ -18,15 +18,23 @@
|
||||
package org.leavesmc.leaves.protocol.servux.litematics.placement;
|
||||
|
||||
import com.google.common.collect.ImmutableMap;
|
||||
import fun.bm.lophine.config.modules.function.SurvuxProtocolConfig;
|
||||
import io.papermc.paper.threadedregions.RegionizedServer;
|
||||
import me.earthme.luminol.utils.NullPlugin;
|
||||
import net.kyori.adventure.text.Component;
|
||||
import net.kyori.adventure.text.format.NamedTextColor;
|
||||
import net.minecraft.core.BlockBox;
|
||||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.core.SectionPos;
|
||||
import net.minecraft.nbt.CompoundTag;
|
||||
import net.minecraft.server.level.ServerLevel;
|
||||
import net.minecraft.server.level.ServerPlayer;
|
||||
import net.minecraft.world.level.ChunkPos;
|
||||
import net.minecraft.world.level.block.Mirror;
|
||||
import net.minecraft.world.level.block.Rotation;
|
||||
import net.minecraft.world.phys.AABB;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.plugin.Plugin;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.leavesmc.leaves.protocol.servux.ServuxProtocol;
|
||||
import org.leavesmc.leaves.protocol.servux.litematics.LitematicaSchematic;
|
||||
@@ -35,6 +43,7 @@ import org.leavesmc.leaves.protocol.servux.litematics.utils.*;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
import java.util.*;
|
||||
import java.util.concurrent.atomic.AtomicInteger;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
public class SchematicPlacement {
|
||||
@@ -283,14 +292,52 @@ public class SchematicPlacement {
|
||||
return ChunkPos.rangeClosed(new ChunkPos(i, j), new ChunkPos(k, l));
|
||||
}
|
||||
|
||||
public void pasteTo(ServerLevel serverWorld, ReplaceBehavior replaceBehavior) {
|
||||
public void pasteTo(ServerLevel serverWorld, ReplaceBehavior replaceBehavior, ServerPlayer player, long timeStart) {
|
||||
Box enclosingBox = this.getEnclosingBox();
|
||||
if (enclosingBox == null || enclosingBox.pos1() == null || enclosingBox.pos2() == null) {
|
||||
ServuxProtocol.LOGGER.error("receiver a null enclosing box");
|
||||
return;
|
||||
}
|
||||
streamChunkPos(Objects.requireNonNull(enclosingBox.toVanilla())).forEach(chunkPos ->
|
||||
SchematicPlacingUtils.placeToWorldWithinChunk(serverWorld, chunkPos, this, replaceBehavior, false)
|
||||
|
||||
AtomicInteger count_full = new AtomicInteger();
|
||||
AtomicInteger count = new AtomicInteger();
|
||||
|
||||
streamChunkPos(Objects.requireNonNull(enclosingBox.toVanilla())).forEach(chunkPos -> {
|
||||
RegionizedServer.getInstance().taskQueue.queueTickTaskQueue(
|
||||
serverWorld,
|
||||
chunkPos.x,
|
||||
chunkPos.z,
|
||||
() -> {
|
||||
SchematicPlacingUtils.placeToWorldWithinChunk(serverWorld, chunkPos, this, replaceBehavior, false);
|
||||
count.getAndIncrement();
|
||||
});
|
||||
count_full.getAndIncrement();
|
||||
}
|
||||
);
|
||||
|
||||
final NullPlugin nullPlugin = new NullPlugin();
|
||||
scheduleTask(nullPlugin, serverWorld, count, count_full, player, timeStart, SurvuxProtocolConfig.maxDelay);
|
||||
}
|
||||
|
||||
private void scheduleTask(Plugin plugin, ServerLevel serverWorld, AtomicInteger count1, AtomicInteger count2, ServerPlayer player, long timeStart, int retryCount) {
|
||||
Bukkit.getGlobalRegionScheduler().runDelayed(plugin,
|
||||
(unused) -> {
|
||||
if (count1.get() >= count2.get()) {
|
||||
long timeElapsed = System.currentTimeMillis() - timeStart;
|
||||
player.getBukkitEntity().sendActionBar(
|
||||
Component.text("Pasted ")
|
||||
.append(Component.text(this.getName(), NamedTextColor.AQUA))
|
||||
.append(Component.text(" to world "))
|
||||
.append(Component.text(serverWorld.serverLevelData.getLevelName(), NamedTextColor.LIGHT_PURPLE))
|
||||
.append(Component.text(" in "))
|
||||
.append(Component.text(timeElapsed, NamedTextColor.GREEN))
|
||||
.append(Component.text("ms"))
|
||||
);
|
||||
} else {
|
||||
if (retryCount >= 0 || retryCount == -1) {
|
||||
scheduleTask(plugin, serverWorld, count1, count2, player, timeStart, retryCount - 1);
|
||||
}
|
||||
}
|
||||
}, 1);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,20 +1,3 @@
|
||||
/*
|
||||
* This file is part of Leaves (https://github.com/LeavesMC/Leaves)
|
||||
*
|
||||
* Leaves is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* Leaves is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* along with Leaves. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package org.leavesmc.leaves.util;
|
||||
|
||||
import fun.bm.lophine.config.modules.function.RedStoneConfig;
|
||||
@@ -25,8 +8,6 @@ import net.minecraft.server.level.ServerPlayer;
|
||||
import net.minecraft.world.InteractionHand;
|
||||
import net.minecraft.world.InteractionResult;
|
||||
import net.minecraft.world.entity.player.Player;
|
||||
import net.minecraft.world.item.Items;
|
||||
import net.minecraft.world.item.context.BlockPlaceContext;
|
||||
import net.minecraft.world.item.context.UseOnContext;
|
||||
import net.minecraft.world.level.Level;
|
||||
import net.minecraft.world.level.block.*;
|
||||
@@ -47,6 +28,9 @@ public class ShearsWrenchUtil {
|
||||
if (!RedStoneConfig.shears || !(block instanceof ObserverBlock || block instanceof DispenserBlock || block instanceof PistonBaseBlock || block instanceof HopperBlock || block instanceof RepeaterBlock || block instanceof ComparatorBlock || block instanceof CrafterBlock || block instanceof LeverBlock || block instanceof CocoaBlock || block instanceof TrapDoorBlock || block instanceof FenceGateBlock || block instanceof LightningRodBlock || block instanceof CalibratedSculkSensorBlock || block instanceof BaseRailBlock)) {
|
||||
return null;
|
||||
}
|
||||
if (context.getPlayer() == null || !context.getPlayer().getItemInHand(invert(context.getHand())).isEmpty()) {
|
||||
return null;
|
||||
}
|
||||
StateDefinition<Block, BlockState> blockstatelist = block.getStateDefinition();
|
||||
Property<?> iblockstate;
|
||||
if (block instanceof CrafterBlock) {
|
||||
@@ -106,10 +90,8 @@ public class ShearsWrenchUtil {
|
||||
return InteractionResult.CONSUME;
|
||||
}
|
||||
|
||||
public static boolean shouldSkipPlace(BlockPlaceContext context) {
|
||||
return RedStoneConfig.shears &&
|
||||
context.getPlayer() != null &&
|
||||
context.getPlayer().getItemInHand(InteractionHand.MAIN_HAND).is(Items.SHEARS);
|
||||
private static InteractionHand invert(InteractionHand original) {
|
||||
return original == InteractionHand.MAIN_HAND ? InteractionHand.OFF_HAND : InteractionHand.MAIN_HAND;
|
||||
}
|
||||
|
||||
private static <T extends Comparable<T>> BlockState cycleState(BlockState state, Property<T> property, boolean inverse) {
|
||||
|
||||
+1
-1
@@ -8,7 +8,7 @@ pluginManagement {
|
||||
}
|
||||
|
||||
plugins {
|
||||
id("org.gradle.toolchains.foojay-resolver-convention") version "0.9.0"
|
||||
id("org.gradle.toolchains.foojay-resolver-convention") version "1.0.0"
|
||||
}
|
||||
|
||||
rootProject.name = "lophine"
|
||||
|
||||
Reference in New Issue
Block a user