@@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/world/item/ItemBoneMeal.java
|
||||
+++ b/net/minecraft/world/item/ItemBoneMeal.java
|
||||
@@ -35,6 +35,12 @@
|
||||
@@ -33,6 +33,12 @@
|
||||
|
||||
@Override
|
||||
public EnumInteractionResult useOn(ItemActionContext itemactioncontext) {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/world/item/ItemEnderEye.java
|
||||
+++ b/net/minecraft/world/item/ItemEnderEye.java
|
||||
@@ -85,7 +85,11 @@
|
||||
@@ -86,7 +86,11 @@
|
||||
|
||||
entityendersignal.setItem(itemstack);
|
||||
entityendersignal.signalTo(blockposition);
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/world/item/ItemLeash.java
|
||||
+++ b/net/minecraft/world/item/ItemLeash.java
|
||||
@@ -14,6 +14,8 @@
|
||||
@@ -13,6 +13,8 @@
|
||||
import net.minecraft.world.level.block.state.IBlockData;
|
||||
import net.minecraft.world.phys.AxisAlignedBB;
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
public class ItemLeash extends Item {
|
||||
|
||||
public ItemLeash(Item.Info item_info) {
|
||||
@@ -55,9 +57,25 @@
|
||||
@@ -54,9 +56,25 @@
|
||||
if (entityinsentient.getLeashHolder() == entityhuman) {
|
||||
if (entityleash == null) {
|
||||
entityleash = EntityLeash.getOrCreateKnot(world, blockposition);
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/world/item/ItemMinecart.java
|
||||
+++ b/net/minecraft/world/item/ItemMinecart.java
|
||||
@@ -18,6 +18,11 @@
|
||||
@@ -17,6 +17,11 @@
|
||||
import net.minecraft.world.level.block.state.properties.BlockPropertyTrackPosition;
|
||||
import net.minecraft.world.level.gameevent.GameEvent;
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
public class ItemMinecart extends Item {
|
||||
|
||||
private static final IDispenseBehavior DISPENSE_ITEM_BEHAVIOR = new DispenseBehaviorItem() {
|
||||
@@ -56,14 +61,43 @@
|
||||
@@ -55,14 +60,43 @@
|
||||
}
|
||||
}
|
||||
|
||||
@@ -59,7 +59,7 @@
|
||||
return itemstack;
|
||||
}
|
||||
|
||||
@@ -105,7 +139,12 @@
|
||||
@@ -104,7 +138,12 @@
|
||||
entityminecartabstract.setCustomName(itemstack.getHoverName());
|
||||
}
|
||||
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
--- a/net/minecraft/world/item/ItemStack.java
|
||||
+++ b/net/minecraft/world/item/ItemStack.java
|
||||
@@ -72,6 +72,40 @@
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
@@ -73,6 +73,40 @@
|
||||
import net.minecraft.world.level.block.state.pattern.ShapeDetectorBlock;
|
||||
import org.slf4j.Logger;
|
||||
|
||||
+// CraftBukkit start
|
||||
+import com.mojang.serialization.Dynamic;
|
||||
@@ -41,7 +41,7 @@
|
||||
public final class ItemStack {
|
||||
|
||||
public static final Codec<ItemStack> CODEC = RecordCodecBuilder.create((instance) -> {
|
||||
@@ -139,16 +173,30 @@
|
||||
@@ -144,16 +178,30 @@
|
||||
this.updateEmptyCacheFlag();
|
||||
}
|
||||
|
||||
@@ -74,7 +74,7 @@
|
||||
this.getItem().verifyTagAfterLoad(this.tag);
|
||||
}
|
||||
|
||||
@@ -156,6 +204,11 @@
|
||||
@@ -161,6 +209,11 @@
|
||||
this.setDamageValue(this.getDamageValue());
|
||||
}
|
||||
|
||||
@@ -86,8 +86,8 @@
|
||||
this.updateEmptyCacheFlag();
|
||||
}
|
||||
|
||||
@@ -193,7 +246,7 @@
|
||||
return this.getItem() == item;
|
||||
@@ -202,7 +255,7 @@
|
||||
return this.getItem().builtInRegistryHolder().tags();
|
||||
}
|
||||
|
||||
- public EnumInteractionResult useOn(ItemActionContext itemactioncontext) {
|
||||
@@ -95,8 +95,8 @@
|
||||
EntityHuman entityhuman = itemactioncontext.getPlayer();
|
||||
BlockPosition blockposition = itemactioncontext.getClickedPos();
|
||||
ShapeDetectorBlock shapedetectorblock = new ShapeDetectorBlock(itemactioncontext.getLevel(), blockposition, false);
|
||||
@@ -201,12 +254,157 @@
|
||||
if (entityhuman != null && !entityhuman.getAbilities().mayBuild && !this.hasAdventureModePlaceTagForBlock(itemactioncontext.getLevel().getTagManager(), shapedetectorblock)) {
|
||||
@@ -210,12 +263,157 @@
|
||||
if (entityhuman != null && !entityhuman.getAbilities().mayBuild && !this.hasAdventureModePlaceTagForBlock(itemactioncontext.getLevel().registryAccess().registryOrThrow(IRegistry.BLOCK_REGISTRY), shapedetectorblock)) {
|
||||
return EnumInteractionResult.PASS;
|
||||
} else {
|
||||
+ // CraftBukkit start - handle all block place event logic here
|
||||
@@ -254,7 +254,7 @@
|
||||
|
||||
return enuminteractionresult;
|
||||
}
|
||||
@@ -287,6 +485,21 @@
|
||||
@@ -296,6 +494,21 @@
|
||||
}
|
||||
|
||||
i -= k;
|
||||
@@ -276,7 +276,7 @@
|
||||
if (i <= 0) {
|
||||
return false;
|
||||
}
|
||||
@@ -308,6 +521,11 @@
|
||||
@@ -317,6 +530,11 @@
|
||||
if (this.hurt(i, t0.getRandom(), t0 instanceof EntityPlayer ? (EntityPlayer) t0 : null)) {
|
||||
consumer.accept(t0);
|
||||
Item item = this.getItem();
|
||||
@@ -288,7 +288,7 @@
|
||||
|
||||
this.shrink(1);
|
||||
if (t0 instanceof EntityHuman) {
|
||||
@@ -463,6 +681,17 @@
|
||||
@@ -472,6 +690,17 @@
|
||||
return this.tag;
|
||||
}
|
||||
|
||||
@@ -306,7 +306,7 @@
|
||||
public NBTTagCompound getOrCreateTag() {
|
||||
if (this.tag == null) {
|
||||
this.setTag(new NBTTagCompound());
|
||||
@@ -843,6 +1072,12 @@
|
||||
@@ -850,6 +1079,12 @@
|
||||
}
|
||||
|
||||
public void setRepairCost(int i) {
|
||||
@@ -319,7 +319,7 @@
|
||||
this.getOrCreateTag().putInt("RepairCost", i);
|
||||
}
|
||||
|
||||
@@ -892,6 +1127,13 @@
|
||||
@@ -899,6 +1134,13 @@
|
||||
nbttaglist.add(nbttagcompound);
|
||||
}
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/world/item/ItemWorldMap.java
|
||||
+++ b/net/minecraft/world/item/ItemWorldMap.java
|
||||
@@ -33,6 +33,11 @@
|
||||
@@ -32,6 +32,11 @@
|
||||
import net.minecraft.world.level.material.MaterialMapColor;
|
||||
import net.minecraft.world.level.saveddata.maps.WorldMap;
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
public class ItemWorldMap extends ItemWorldMapBase {
|
||||
|
||||
public static final int IMAGE_WIDTH = 128;
|
||||
@@ -67,7 +72,7 @@
|
||||
@@ -66,7 +71,7 @@
|
||||
public static Integer getMapId(ItemStack itemstack) {
|
||||
NBTTagCompound nbttagcompound = itemstack.getTag();
|
||||
|
||||
@@ -21,7 +21,7 @@
|
||||
}
|
||||
|
||||
public static int createNewSavedData(World world, int i, int j, int k, boolean flag, boolean flag1, ResourceKey<World> resourcekey) {
|
||||
@@ -75,6 +80,10 @@
|
||||
@@ -74,6 +79,10 @@
|
||||
int l = world.getFreeMapId();
|
||||
|
||||
world.setMapData(makeKey(l), worldmap);
|
||||
|
||||
@@ -1,21 +1,21 @@
|
||||
--- a/net/minecraft/world/item/crafting/CraftingManager.java
|
||||
+++ b/net/minecraft/world/item/crafting/CraftingManager.java
|
||||
@@ -33,11 +33,13 @@
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
@@ -32,11 +32,13 @@
|
||||
import net.minecraft.world.level.World;
|
||||
import org.slf4j.Logger;
|
||||
|
||||
+import it.unimi.dsi.fastutil.objects.Object2ObjectLinkedOpenHashMap; // CraftBukkit
|
||||
+
|
||||
public class CraftingManager extends ResourceDataJson {
|
||||
|
||||
private static final Gson GSON = (new GsonBuilder()).setPrettyPrinting().disableHtmlEscaping().create();
|
||||
private static final Logger LOGGER = LogManager.getLogger();
|
||||
private static final Logger LOGGER = LogUtils.getLogger();
|
||||
- public Map<Recipes<?>, Map<MinecraftKey, IRecipe<?>>> recipes = ImmutableMap.of();
|
||||
+ public Map<Recipes<?>, Object2ObjectLinkedOpenHashMap<MinecraftKey, IRecipe<?>>> recipes = ImmutableMap.of(); // CraftBukkit
|
||||
private Map<MinecraftKey, IRecipe<?>> byName = ImmutableMap.of();
|
||||
private boolean hasErrors;
|
||||
|
||||
@@ -47,7 +49,12 @@
|
||||
@@ -46,7 +48,12 @@
|
||||
|
||||
protected void apply(Map<MinecraftKey, JsonElement> map, IResourceManager iresourcemanager, GameProfilerFiller gameprofilerfiller) {
|
||||
this.hasErrors = false;
|
||||
@@ -29,7 +29,7 @@
|
||||
Builder<MinecraftKey, IRecipe<?>> builder = ImmutableMap.builder();
|
||||
Iterator iterator = map.entrySet().iterator();
|
||||
|
||||
@@ -58,8 +65,10 @@
|
||||
@@ -57,8 +64,10 @@
|
||||
try {
|
||||
IRecipe<?> irecipe = fromJson(minecraftkey, ChatDeserializer.convertToJsonObject((JsonElement) entry.getValue(), "top element"));
|
||||
|
||||
@@ -42,7 +42,7 @@
|
||||
})).put(minecraftkey, irecipe);
|
||||
builder.put(minecraftkey, irecipe);
|
||||
} catch (IllegalArgumentException | JsonParseException jsonparseexception) {
|
||||
@@ -68,20 +77,37 @@
|
||||
@@ -67,20 +76,37 @@
|
||||
}
|
||||
|
||||
this.recipes = (Map) map1.entrySet().stream().collect(ImmutableMap.toImmutableMap(Entry::getKey, (entry1) -> {
|
||||
@@ -75,7 +75,7 @@
|
||||
- return this.byType(recipes).values().stream().flatMap((irecipe) -> {
|
||||
+ // CraftBukkit start
|
||||
+ Optional<T> recipe = this.byType(recipes).values().stream().flatMap((irecipe) -> {
|
||||
return SystemUtils.toStream(recipes.tryMatch(irecipe, world, c0));
|
||||
return recipes.tryMatch(irecipe, world, c0).stream();
|
||||
}).findFirst();
|
||||
+ c0.setCurrentRecipe(recipe.orElse(null)); // CraftBukkit - Clear recipe when no recipe is found
|
||||
+ // CraftBukkit end
|
||||
@@ -83,7 +83,7 @@
|
||||
}
|
||||
|
||||
public <C extends IInventory, T extends IRecipe<C>> List<T> getAllRecipesFor(Recipes<T> recipes) {
|
||||
@@ -99,7 +125,7 @@
|
||||
@@ -98,7 +124,7 @@
|
||||
}
|
||||
|
||||
private <C extends IInventory, T extends IRecipe<C>> Map<MinecraftKey, IRecipe<C>> byType(Recipes<T> recipes) {
|
||||
@@ -92,7 +92,7 @@
|
||||
}
|
||||
|
||||
public <C extends IInventory, T extends IRecipe<C>> NonNullList<ItemStack> getRemainingItemsFor(Recipes<T> recipes, C c0, World world) {
|
||||
@@ -119,7 +145,7 @@
|
||||
@@ -118,7 +144,7 @@
|
||||
}
|
||||
|
||||
public Optional<? extends IRecipe<?>> byKey(MinecraftKey minecraftkey) {
|
||||
@@ -101,7 +101,7 @@
|
||||
}
|
||||
|
||||
public Collection<IRecipe<?>> getRecipes() {
|
||||
@@ -144,12 +170,12 @@
|
||||
@@ -143,12 +169,12 @@
|
||||
|
||||
public void replaceRecipes(Iterable<IRecipe<?>> iterable) {
|
||||
this.hasErrors = false;
|
||||
@@ -116,7 +116,7 @@
|
||||
});
|
||||
MinecraftKey minecraftkey = irecipe.getId();
|
||||
IRecipe<?> irecipe1 = (IRecipe) map1.put(minecraftkey, irecipe);
|
||||
@@ -160,6 +186,26 @@
|
||||
@@ -159,6 +185,26 @@
|
||||
}
|
||||
});
|
||||
this.recipes = ImmutableMap.copyOf(map);
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/world/item/enchantment/EnchantmentFrostWalker.java
|
||||
+++ b/net/minecraft/world/item/enchantment/EnchantmentFrostWalker.java
|
||||
@@ -57,8 +57,11 @@
|
||||
@@ -56,8 +56,11 @@
|
||||
IBlockData iblockdata2 = world.getBlockState(blockposition1);
|
||||
|
||||
if (iblockdata2.getMaterial() == Material.WATER && (Integer) iblockdata2.getValue(BlockFluids.LEVEL) == 0 && iblockdata.canSurvive(world, blockposition1) && world.isUnobstructed(iblockdata, blockposition1, VoxelShapeCollision.empty())) {
|
||||
|
||||
Reference in New Issue
Block a user