Update to Minecraft 1.19

By: md_5 <git@md-5.net>
This commit is contained in:
CraftBukkit/Spigot
2022-06-08 02:00:00 +10:00
parent 91d9aa9a89
commit 25f3b50f6b
332 changed files with 3628 additions and 2559 deletions

View File

@@ -1,6 +1,6 @@
--- a/net/minecraft/core/dispenser/DispenseBehaviorBoat.java
+++ b/net/minecraft/core/dispenser/DispenseBehaviorBoat.java
@@ -9,6 +9,11 @@
@@ -11,6 +11,11 @@
import net.minecraft.world.item.ItemStack;
import net.minecraft.world.level.block.BlockDispenser;
@@ -11,12 +11,12 @@
+
public class DispenseBehaviorBoat extends DispenseBehaviorItem {
private final DispenseBehaviorItem defaultDispenseItemBehavior = new DispenseBehaviorItem();
@@ -38,12 +43,40 @@
private final DispenseBehaviorItem defaultDispenseItemBehavior;
@@ -47,12 +52,40 @@
d3 = 0.0D;
}
- EntityBoat entityboat = new EntityBoat(worldserver, d0, d1 + d3, d2);
- Object object = this.isChestBoat ? new ChestBoat(worldserver, d0, d1 + d3, d2) : new EntityBoat(worldserver, d0, d1 + d3, d2);
+ // EntityBoat entityboat = new EntityBoat(worldserver, d0, d1 + d3, d2);
+ // CraftBukkit start
+ ItemStack itemstack1 = itemstack.split(1);
@@ -44,14 +44,14 @@
+ }
+ }
+
+ EntityBoat entityboat = new EntityBoat(worldserver, event.getVelocity().getX(), event.getVelocity().getY(), event.getVelocity().getZ());
+ Object object = this.isChestBoat ? new ChestBoat(worldserver, event.getVelocity().getX(), event.getVelocity().getY(), event.getVelocity().getZ()) : new EntityBoat(worldserver, event.getVelocity().getX(), event.getVelocity().getY(), event.getVelocity().getZ());
+ // CraftBukkit end
entityboat.setType(this.type);
entityboat.setYRot(enumdirection.toYRot());
- worldserver.addFreshEntity(entityboat);
((EntityBoat) object).setType(this.type);
((EntityBoat) object).setYRot(enumdirection.toYRot());
- worldserver.addFreshEntity((Entity) object);
- itemstack.shrink(1);
+ if (!worldserver.addFreshEntity(entityboat)) itemstack.grow(1); // CraftBukkit
+ if (!worldserver.addFreshEntity((Entity) object)) itemstack.grow(1); // CraftBukkit
+ // itemstack.shrink(1); // CraftBukkit - handled during event processing
return itemstack;
}

View File

@@ -48,7 +48,7 @@
@@ -45,7 +67,39 @@
double d3 = world.random.nextDouble() * 0.1D + 0.2D;
entityitem.setDeltaMovement(world.random.nextGaussian() * 0.007499999832361937D * (double) i + (double) enumdirection.getStepX() * d3, world.random.nextGaussian() * 0.007499999832361937D * (double) i + 0.20000000298023224D, world.random.nextGaussian() * 0.007499999832361937D * (double) i + (double) enumdirection.getStepZ() * d3);
entityitem.setDeltaMovement(world.random.triangle((double) enumdirection.getStepX() * d3, 0.0172275D * (double) i), world.random.triangle(0.2D, 0.0172275D * (double) i), world.random.triangle((double) enumdirection.getStepZ() * d3, 0.0172275D * (double) i));
+
+ // CraftBukkit start
+ org.bukkit.block.Block block = world.getWorld().getBlockAt(isourceblock.getPos().getX(), isourceblock.getPos().getY(), isourceblock.getPos().getZ());

View File

@@ -1,6 +1,6 @@
--- a/net/minecraft/core/dispenser/IDispenseBehavior.java
+++ b/net/minecraft/core/dispenser/IDispenseBehavior.java
@@ -75,6 +75,21 @@
@@ -76,6 +76,21 @@
import net.minecraft.world.phys.MovingObjectPositionBlock;
import org.slf4j.Logger;
@@ -22,7 +22,7 @@
public interface IDispenseBehavior {
Logger LOGGER = LogUtils.getLogger();
@@ -199,14 +214,42 @@
@@ -200,14 +215,42 @@
EnumDirection enumdirection = (EnumDirection) isourceblock.getBlockState().getValue(BlockDispenser.FACING);
EntityTypes entitytypes = ((ItemMonsterEgg) itemstack.getItem()).getType(itemstack.getTag());
@@ -64,10 +64,10 @@
- itemstack.shrink(1);
+ // itemstack.shrink(1); // Handled during event processing
+ // CraftBukkit end
isourceblock.getLevel().gameEvent(GameEvent.ENTITY_PLACE, isourceblock.getPos());
isourceblock.getLevel().gameEvent((Entity) null, GameEvent.ENTITY_PLACE, isourceblock.getPos());
return itemstack;
}
@@ -225,12 +268,40 @@
@@ -226,12 +269,40 @@
EnumDirection enumdirection = (EnumDirection) isourceblock.getBlockState().getValue(BlockDispenser.FACING);
BlockPosition blockposition = isourceblock.getPos().relative(enumdirection);
WorldServer worldserver = isourceblock.getLevel();
@@ -109,7 +109,7 @@
return itemstack;
}
});
@@ -249,8 +320,35 @@
@@ -250,8 +321,35 @@
});
if (!list.isEmpty()) {
@@ -146,7 +146,7 @@
this.setSuccess(true);
return itemstack;
} else {
@@ -277,7 +375,35 @@
@@ -278,7 +376,35 @@
entityhorseabstract = (EntityHorseAbstract) iterator1.next();
} while (!entityhorseabstract.isArmor(itemstack) || entityhorseabstract.isWearingArmor() || !entityhorseabstract.isTamed());
@@ -183,7 +183,7 @@
this.setSuccess(true);
return itemstack;
}
@@ -320,9 +446,35 @@
@@ -321,9 +447,35 @@
}
entityhorsechestedabstract = (EntityHorseChestedAbstract) iterator1.next();
@@ -221,7 +221,7 @@
this.setSuccess(true);
return itemstack;
}
@@ -331,12 +483,41 @@
@@ -332,12 +484,41 @@
@Override
public ItemStack execute(ISourceBlock isourceblock, ItemStack itemstack) {
EnumDirection enumdirection = (EnumDirection) isourceblock.getBlockState().getValue(BlockDispenser.FACING);
@@ -264,10 +264,10 @@
return itemstack;
}
@@ -358,12 +539,40 @@
double d3 = random.nextGaussian() * 0.05D + (double) enumdirection.getStepX();
double d4 = random.nextGaussian() * 0.05D + (double) enumdirection.getStepY();
double d5 = random.nextGaussian() * 0.05D + (double) enumdirection.getStepZ();
@@ -359,12 +540,40 @@
double d3 = randomsource.triangle((double) enumdirection.getStepX(), 0.11485000000000001D);
double d4 = randomsource.triangle((double) enumdirection.getStepY(), 0.11485000000000001D);
double d5 = randomsource.triangle((double) enumdirection.getStepZ(), 0.11485000000000001D);
- EntitySmallFireball entitysmallfireball = new EntitySmallFireball(worldserver, d0, d1, d2, d3, d4, d5);
- worldserver.addFreshEntity((Entity) SystemUtils.make(entitysmallfireball, (entitysmallfireball1) -> {
@@ -310,7 +310,7 @@
return itemstack;
}
@@ -387,9 +596,52 @@
@@ -396,9 +605,52 @@
BlockPosition blockposition = isourceblock.getPos().relative((EnumDirection) isourceblock.getBlockState().getValue(BlockDispenser.FACING));
WorldServer worldserver = isourceblock.getLevel();
@@ -364,7 +364,7 @@
} else {
return this.defaultDispenseItemBehavior.dispense(isourceblock, itemstack);
}
@@ -415,7 +667,7 @@
@@ -425,7 +677,7 @@
Block block = iblockdata.getBlock();
if (block instanceof IFluidSource) {
@@ -373,7 +373,7 @@
if (itemstack1.isEmpty()) {
return super.execute(isourceblock, itemstack);
@@ -423,6 +675,32 @@
@@ -433,6 +685,32 @@
worldserver.gameEvent((Entity) null, GameEvent.FLUID_PICKUP, blockposition);
Item item = itemstack1.getItem();
@@ -406,7 +406,7 @@
itemstack.shrink(1);
if (itemstack.isEmpty()) {
return new ItemStack(item);
@@ -444,14 +722,42 @@
@@ -454,14 +732,42 @@
protected ItemStack execute(ISourceBlock isourceblock, ItemStack itemstack) {
WorldServer worldserver = isourceblock.getLevel();
@@ -451,7 +451,7 @@
} else if (!BlockCampfire.canLight(iblockdata) && !CandleBlock.canLight(iblockdata) && !CandleCakeBlock.canLight(iblockdata)) {
if (iblockdata.getBlock() instanceof BlockTNT) {
BlockTNT.explode(worldserver, blockposition);
@@ -477,12 +783,62 @@
@@ -487,12 +793,62 @@
this.setSuccess(true);
WorldServer worldserver = isourceblock.getLevel();
BlockPosition blockposition = isourceblock.getPos().relative((EnumDirection) isourceblock.getBlockState().getValue(BlockDispenser.FACING));
@@ -514,7 +514,7 @@
return itemstack;
}
@@ -492,12 +848,41 @@
@@ -502,12 +858,41 @@
protected ItemStack execute(ISourceBlock isourceblock, ItemStack itemstack) {
WorldServer worldserver = isourceblock.getLevel();
BlockPosition blockposition = isourceblock.getPos().relative((EnumDirection) isourceblock.getBlockState().getValue(BlockDispenser.FACING));
@@ -558,7 +558,7 @@
return itemstack;
}
});
@@ -521,6 +906,30 @@
@@ -531,6 +916,30 @@
EnumDirection enumdirection = (EnumDirection) isourceblock.getBlockState().getValue(BlockDispenser.FACING);
BlockPosition blockposition = isourceblock.getPos().relative(enumdirection);
@@ -589,7 +589,7 @@
if (worldserver.isEmptyBlock(blockposition) && BlockWitherSkull.canSpawnMob(worldserver, blockposition, itemstack)) {
worldserver.setBlock(blockposition, (IBlockData) Blocks.WITHER_SKELETON_SKULL.defaultBlockState().setValue(BlockSkull.ROTATION, enumdirection.getAxis() == EnumDirection.EnumAxis.Y ? 0 : enumdirection.getOpposite().get2DDataValue() * 4), 3);
worldserver.gameEvent((Entity) null, GameEvent.BLOCK_PLACE, blockposition);
@@ -546,6 +955,30 @@
@@ -556,6 +965,30 @@
BlockPosition blockposition = isourceblock.getPos().relative((EnumDirection) isourceblock.getBlockState().getValue(BlockDispenser.FACING));
BlockPumpkinCarved blockpumpkincarved = (BlockPumpkinCarved) Blocks.CARVED_PUMPKIN;
@@ -620,7 +620,7 @@
if (worldserver.isEmptyBlock(blockposition) && blockpumpkincarved.canSpawnGolem(worldserver, blockposition)) {
if (!worldserver.isClientSide) {
worldserver.setBlock(blockposition, blockpumpkincarved.defaultBlockState(), 3);
@@ -595,6 +1028,30 @@
@@ -605,6 +1038,30 @@
BlockPosition blockposition = isourceblock.getPos().relative((EnumDirection) isourceblock.getBlockState().getValue(BlockDispenser.FACING));
IBlockData iblockdata = worldserver.getBlockState(blockposition);