Compare commits
5 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 9efe6499d0 | |||
| 319946e8c1 | |||
| 28ce6ae7b1 | |||
| af4a8a8731 | |||
| 7059c6a062 |
@@ -57,7 +57,7 @@ jobs:
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: ${{ env.project_id_b }} CI Artifacts
|
||||
path: luminol-server/build/libs/*-paperclip-*-mojmap.jar
|
||||
path: lophine-server/build/libs/*-paperclip-*-mojmap.jar
|
||||
|
||||
- name: SetENV
|
||||
if: github.event_name != 'pull_request'
|
||||
|
||||
+1
-1
@@ -4,7 +4,7 @@ mcVersion=1.21.8
|
||||
release=2
|
||||
# 0 for skip release, 1 for pre-release, 2 for release
|
||||
|
||||
luminolRef=3abd05f4f668c87eddc44d719561c5ee6f88373e
|
||||
luminolRef=b9904879bdfc881766da6df63a0f43236b0bf223
|
||||
|
||||
org.gradle.configuration-cache=true
|
||||
org.gradle.caching=true
|
||||
|
||||
@@ -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 d353b15401e629c5f367786111d5227236968d4a..e660eef2508023eef87eb6cb8f2ef0d0110f5449 100644
|
||||
index aca3303a043144894ae20ddc43abc55790db44ad..55cbf9b4cc568fb9b418433f597ed6b64e4409b0 100644
|
||||
--- a/net/minecraft/world/level/block/entity/HopperBlockEntity.java
|
||||
+++ b/net/minecraft/world/level/block/entity/HopperBlockEntity.java
|
||||
@@ -163,7 +163,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);
|
||||
@@ -458,7 +458,7 @@ index d353b15401e629c5f367786111d5227236968d4a..e660eef2508023eef87eb6cb8f2ef0d0
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -788,9 +788,9 @@ public class HopperBlockEntity extends RandomizableContainerBlockEntity implemen
|
||||
@@ -770,9 +770,9 @@ public class HopperBlockEntity extends RandomizableContainerBlockEntity implemen
|
||||
if (item.isEmpty()) {
|
||||
// Spigot start - SPIGOT-6693, SimpleContainer#setItem
|
||||
ItemStack leftover = ItemStack.EMPTY; // Paper - Make hoppers respect inventory max stack size
|
||||
|
||||
@@ -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();
|
||||
|
||||
+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