Mirror von
https://github.com/PaperMC/Paper.git
synchronisiert 2024-11-15 12:30:06 +01:00
e035fd7034
Upstream has released updates that appear to apply and compile correctly. This update has not been tested by PaperMC and as with ANY update, please do your own testing Bukkit Changes: cc9aa21a SPIGOT-6399, SPIGOT-7344: Clarify collidable behavior for player entities f23325b6 Add API for per-world simulation distances 26e1774e Add API for per-world view distances 0b541e60 Add PlayerLoginEvent#getRealAddress 5f027d2d PR-949: Add Vector#fromJOML() overloads for read-only vector types CraftBukkit Changes: bcf56171a PR-1321: Clean up some stuff which got missed during previous PRs 7f833a2d1 SPIGOT-7462: Players no longer drop XP after dying near a Sculk Catalyst 752aac669 Implement APIs for per world view and simulation distances 57d7ef433 Preserve empty enchantment tags for glow effect 465ec3fb4 Remove connected check on setScoreboard f90ce621e Use one PermissibleBase for all command blocks 5876cca44 SPIGOT-7550: Fix creation of Arrow instances f03fc3aa3 SPIGOT-7549: ServerTickManager#setTickRate incorrect Precondition 9d7f49b01 SPIGOT-7548: Fix wrong spawn location for experience orb and dropped item Spigot Changes: ed9ba9a4 Drop no longer required patch ignoring -o option 86b5dd6a SPIGOT-7546: Fix hardcoded check for outdated client message aa7cde7a Remove obsolete APIs for per world view and simulation distances 6dff577e Remove obsolete patch preserving empty `ench` tags a3bf95b8 Remove obsolete PlayerLoginEvent#getRealAddress 1b02f5d6 Remove obsolete connected check on setScoreboard patch acf717eb Remove obsolete command block PermissibleBase patch 053fa2a9 Remove redundant patch dealing with null tile entities
113 Zeilen
5.1 KiB
Diff
113 Zeilen
5.1 KiB
Diff
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
From: LemonCaramel <admin@caramel.moe>
|
|
Date: Fri, 16 Jul 2021 00:39:03 +0900
|
|
Subject: [PATCH] Add more Campfire API
|
|
|
|
|
|
diff --git a/src/main/java/net/minecraft/world/level/block/entity/CampfireBlockEntity.java b/src/main/java/net/minecraft/world/level/block/entity/CampfireBlockEntity.java
|
|
index 04b2697ee857e714b1202d02d093b0c60f079a6f..d80855b22dc10dbf697578d5f78664ed7b6ac572 100644
|
|
--- a/src/main/java/net/minecraft/world/level/block/entity/CampfireBlockEntity.java
|
|
+++ b/src/main/java/net/minecraft/world/level/block/entity/CampfireBlockEntity.java
|
|
@@ -42,6 +42,7 @@ public class CampfireBlockEntity extends BlockEntity implements Clearable {
|
|
public final int[] cookingProgress;
|
|
public final int[] cookingTime;
|
|
private final RecipeManager.CachedCheck<Container, CampfireCookingRecipe> quickCheck;
|
|
+ public final boolean[] stopCooking; // Paper
|
|
|
|
public CampfireBlockEntity(BlockPos pos, BlockState state) {
|
|
super(BlockEntityType.CAMPFIRE, pos, state);
|
|
@@ -49,6 +50,7 @@ public class CampfireBlockEntity extends BlockEntity implements Clearable {
|
|
this.cookingProgress = new int[4];
|
|
this.cookingTime = new int[4];
|
|
this.quickCheck = RecipeManager.createCheck(RecipeType.CAMPFIRE_COOKING);
|
|
+ this.stopCooking = new boolean[4]; // Paper
|
|
}
|
|
|
|
public static void cookTick(Level world, BlockPos pos, BlockState state, CampfireBlockEntity campfire) {
|
|
@@ -59,7 +61,9 @@ public class CampfireBlockEntity extends BlockEntity implements Clearable {
|
|
|
|
if (!itemstack.isEmpty()) {
|
|
flag = true;
|
|
+ if (!campfire.stopCooking[i]) { // Paper
|
|
int j = campfire.cookingProgress[i]++;
|
|
+ } // Paper
|
|
|
|
if (campfire.cookingProgress[i] >= campfire.cookingTime[i]) {
|
|
SimpleContainer inventorysubcontainer = new SimpleContainer(new ItemStack[]{itemstack});
|
|
@@ -168,6 +172,16 @@ public class CampfireBlockEntity extends BlockEntity implements Clearable {
|
|
System.arraycopy(aint, 0, this.cookingTime, 0, Math.min(this.cookingTime.length, aint.length));
|
|
}
|
|
|
|
+ // Paper start
|
|
+ if (nbt.contains("Paper.StopCooking", org.bukkit.craftbukkit.util.CraftMagicNumbers.NBT.TAG_BYTE_ARRAY)) {
|
|
+ byte[] abyte = nbt.getByteArray("Paper.StopCooking");
|
|
+ boolean[] cookingState = new boolean[4];
|
|
+ for (int index = 0; index < abyte.length; index++) {
|
|
+ cookingState[index] = abyte[index] == 1;
|
|
+ }
|
|
+ System.arraycopy(cookingState, 0, this.stopCooking, 0, Math.min(this.stopCooking.length, abyte.length));
|
|
+ }
|
|
+ // Paper end
|
|
}
|
|
|
|
@Override
|
|
@@ -176,6 +190,13 @@ public class CampfireBlockEntity extends BlockEntity implements Clearable {
|
|
ContainerHelper.saveAllItems(nbt, this.items, true);
|
|
nbt.putIntArray("CookingTimes", this.cookingProgress);
|
|
nbt.putIntArray("CookingTotalTimes", this.cookingTime);
|
|
+ // Paper start
|
|
+ byte[] cookingState = new byte[4];
|
|
+ for (int index = 0; index < cookingState.length; index++) {
|
|
+ cookingState[index] = (byte) (this.stopCooking[index] ? 1 : 0);
|
|
+ }
|
|
+ nbt.putByteArray("Paper.StopCooking", cookingState);
|
|
+ // Paper end
|
|
}
|
|
|
|
@Override
|
|
diff --git a/src/main/java/org/bukkit/craftbukkit/block/CraftCampfire.java b/src/main/java/org/bukkit/craftbukkit/block/CraftCampfire.java
|
|
index 07556d0961569c1be62a697414bd4ec512b04ac0..cc641dc70dc12b902bd9cad93fffded9032f1e82 100644
|
|
--- a/src/main/java/org/bukkit/craftbukkit/block/CraftCampfire.java
|
|
+++ b/src/main/java/org/bukkit/craftbukkit/block/CraftCampfire.java
|
|
@@ -56,4 +56,40 @@ public class CraftCampfire extends CraftBlockEntityState<CampfireBlockEntity> im
|
|
public CraftCampfire copy() {
|
|
return new CraftCampfire(this);
|
|
}
|
|
+
|
|
+ // Paper start
|
|
+ @Override
|
|
+ public void stopCooking() {
|
|
+ for (int i = 0; i < getSnapshot().stopCooking.length; ++i)
|
|
+ this.stopCooking(i);
|
|
+ }
|
|
+
|
|
+ @Override
|
|
+ public void startCooking() {
|
|
+ for (int i = 0; i < getSnapshot().stopCooking.length; ++i)
|
|
+ this.startCooking(i);
|
|
+ }
|
|
+
|
|
+ @Override
|
|
+ public boolean stopCooking(int index) {
|
|
+ org.apache.commons.lang.Validate.isTrue(-1 < index && index < 4, "Slot index must be between 0 (incl) to 3 (incl)");
|
|
+ boolean previous = this.isCookingDisabled(index);
|
|
+ getSnapshot().stopCooking[index] = true;
|
|
+ return previous;
|
|
+ }
|
|
+
|
|
+ @Override
|
|
+ public boolean startCooking(int index) {
|
|
+ org.apache.commons.lang.Validate.isTrue(-1 < index && index < 4, "Slot index must be between 0 (incl) to 3 (incl)");
|
|
+ boolean previous = this.isCookingDisabled(index);
|
|
+ getSnapshot().stopCooking[index] = false;
|
|
+ return previous;
|
|
+ }
|
|
+
|
|
+ @Override
|
|
+ public boolean isCookingDisabled(int index) {
|
|
+ org.apache.commons.lang.Validate.isTrue(-1 < index && index < 4, "Slot index must be between 0 (incl) to 3 (incl)");
|
|
+ return getSnapshot().stopCooking[index];
|
|
+ }
|
|
+ // Paper end
|
|
}
|