Update to Minecraft 1.18-pre5

By: md_5 <git@md-5.net>
This commit is contained in:
CraftBukkit/Spigot
2021-11-22 09:00:00 +11:00
parent a852b81a69
commit 43702a9e10
700 changed files with 10286 additions and 10098 deletions

View File

@@ -1,6 +1,6 @@
--- a/net/minecraft/world/entity/animal/EntitySheep.java
+++ b/net/minecraft/world/entity/animal/EntitySheep.java
@@ -64,11 +64,19 @@
@@ -63,6 +63,14 @@
import net.minecraft.world.level.gameevent.GameEvent;
import net.minecraft.world.level.storage.loot.LootTables;
@@ -15,38 +15,32 @@
public class EntitySheep extends EntityAnimal implements IShearable {
private static final int EAT_ANIMATION_TICKS = 40;
private static final DataWatcherObject<Byte> DATA_WOOL_ID = DataWatcher.a(EntitySheep.class, DataWatcherRegistry.BYTE);
- private static final Map<EnumColor, IMaterial> ITEM_BY_DYE = (Map) SystemUtils.a((Object) Maps.newEnumMap(EnumColor.class), (enummap) -> {
+ private static final Map<EnumColor, IMaterial> ITEM_BY_DYE = (Map) SystemUtils.a(Maps.newEnumMap(EnumColor.class), (enummap) -> { // CraftBukkit - decompile error
enummap.put(EnumColor.WHITE, Blocks.WHITE_WOOL);
enummap.put(EnumColor.ORANGE, Blocks.ORANGE_WOOL);
enummap.put(EnumColor.MAGENTA, Blocks.MAGENTA_WOOL);
@@ -223,6 +231,11 @@
@@ -222,6 +230,11 @@
if (itemstack.a(Items.SHEARS)) {
if (!this.level.isClientSide && this.canShear()) {
if (itemstack.is(Items.SHEARS)) {
if (!this.level.isClientSide && this.readyForShearing()) {
+ // CraftBukkit start
+ if (!CraftEventFactory.handlePlayerShearEntityEvent(entityhuman, this, itemstack, enumhand)) {
+ return EnumInteractionResult.PASS;
+ }
+ // CraftBukkit end
this.shear(SoundCategory.PLAYERS);
this.a(GameEvent.SHEAR, (Entity) entityhuman);
itemstack.damage(1, entityhuman, (entityhuman1) -> {
@@ -244,7 +257,9 @@
this.gameEvent(GameEvent.SHEAR, (Entity) entityhuman);
itemstack.hurtAndBreak(1, entityhuman, (entityhuman1) -> {
@@ -243,7 +256,9 @@
int i = 1 + this.random.nextInt(3);
for (int j = 0; j < i; ++j) {
+ this.forceDrops = true; // CraftBukkit
EntityItem entityitem = this.a((IMaterial) EntitySheep.ITEM_BY_DYE.get(this.getColor()), 1);
EntityItem entityitem = this.spawnAtLocation((IMaterial) EntitySheep.ITEM_BY_DYE.get(this.getColor()), 1);
+ this.forceDrops = false; // CraftBukkit
if (entityitem != null) {
entityitem.setMot(entityitem.getMot().add((double) ((this.random.nextFloat() - this.random.nextFloat()) * 0.1F), (double) (this.random.nextFloat() * 0.05F), (double) ((this.random.nextFloat() - this.random.nextFloat()) * 0.1F)));
@@ -334,6 +349,12 @@
entityitem.setDeltaMovement(entityitem.getDeltaMovement().add((double) ((this.random.nextFloat() - this.random.nextFloat()) * 0.1F), (double) (this.random.nextFloat() * 0.05F), (double) ((this.random.nextFloat() - this.random.nextFloat()) * 0.1F)));
@@ -333,6 +348,12 @@
@Override
public void blockEaten() {
public void ate() {
+ // CraftBukkit start
+ SheepRegrowWoolEvent event = new SheepRegrowWoolEvent((org.bukkit.entity.Sheep) this.getBukkitEntity());
+ this.level.getCraftServer().getPluginManager().callEvent(event);
@@ -55,20 +49,18 @@
+ // CraftBukkit end
this.setSheared(false);
if (this.isBaby()) {
this.setAge(60);
@@ -352,8 +373,8 @@
this.ageUp(60);
@@ -351,7 +372,7 @@
EnumColor enumcolor = ((EntitySheep) entityanimal).getColor();
EnumColor enumcolor1 = ((EntitySheep) entityanimal1).getColor();
InventoryCrafting inventorycrafting = a(enumcolor, enumcolor1);
- Optional optional = this.level.getCraftingManager().craft(Recipes.CRAFTING, inventorycrafting, this.level).map((recipecrafting) -> {
- return recipecrafting.a((IInventory) inventorycrafting);
+ Optional<Item> optional = this.level.getCraftingManager().craft(Recipes.CRAFTING, inventorycrafting, this.level).map((recipecrafting) -> { // Eclipse fail
+ return recipecrafting.a(inventorycrafting); // CraftBukkit - decompile error
InventoryCrafting inventorycrafting = makeContainer(enumcolor, enumcolor1);
- Optional optional = this.level.getRecipeManager().getRecipeFor(Recipes.CRAFTING, inventorycrafting, this.level).map((recipecrafting) -> {
+ Optional<Item> optional = this.level.getRecipeManager().getRecipeFor(Recipes.CRAFTING, inventorycrafting, this.level).map((recipecrafting) -> { // CraftBukkit - decompile error
return recipecrafting.assemble(inventorycrafting);
}).map(ItemStack::getItem);
Objects.requireNonNull(ItemDye.class);
@@ -370,10 +391,18 @@
public boolean canUse(EntityHuman entityhuman) {
@@ -369,10 +390,18 @@
public boolean stillValid(EntityHuman entityhuman) {
return false;
}
+
@@ -80,8 +72,8 @@
+ // CraftBukkit end
}, 2, 1);
inventorycrafting.setItem(0, new ItemStack(ItemDye.a(enumcolor)));
inventorycrafting.setItem(1, new ItemStack(ItemDye.a(enumcolor1)));
inventorycrafting.setItem(0, new ItemStack(ItemDye.byColor(enumcolor)));
inventorycrafting.setItem(1, new ItemStack(ItemDye.byColor(enumcolor1)));
+ inventorycrafting.resultInventory = new InventoryCraftResult(); // CraftBukkit - add result slot for event
return inventorycrafting;
}