1.21.6 dev
Co-authored-by: Bjarne Koll <git@lynxplay.dev> Co-authored-by: Jake Potrebic <jake.m.potrebic@gmail.com> Co-authored-by: Jason Penilla <11360596+jpenilla@users.noreply.github.com> Co-authored-by: Lulu13022002 <41980282+Lulu13022002@users.noreply.github.com> Co-authored-by: Noah van der Aa <ndvdaa@gmail.com> Co-authored-by: Owen1212055 <23108066+Owen1212055@users.noreply.github.com> Co-authored-by: Spottedleaf <Spottedleaf@users.noreply.github.com>
This commit is contained in:
committed by
Nassim Jahnke
parent
39203a65e0
commit
a24f9b204c
@@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/world/item/EnderEyeItem.java
|
||||
+++ b/net/minecraft/world/item/EnderEyeItem.java
|
||||
@@ -42,6 +_,11 @@
|
||||
@@ -43,6 +_,11 @@
|
||||
return InteractionResult.SUCCESS;
|
||||
} else {
|
||||
BlockState blockState1 = blockState.setValue(EndPortalFrameBlock.HAS_EYE, true);
|
||||
@@ -12,7 +12,7 @@
|
||||
Block.pushEntitiesUp(blockState, blockState1, level, clickedPos);
|
||||
level.setBlock(clickedPos, blockState1, 2);
|
||||
level.updateNeighbourForOutputSignal(clickedPos, Blocks.END_PORTAL_FRAME);
|
||||
@@ -59,7 +_,27 @@
|
||||
@@ -60,7 +_,27 @@
|
||||
}
|
||||
}
|
||||
|
||||
@@ -41,9 +41,9 @@
|
||||
}
|
||||
|
||||
return InteractionResult.SUCCESS;
|
||||
@@ -89,7 +_,11 @@
|
||||
@@ -90,7 +_,11 @@
|
||||
eyeOfEnder.setItem(itemInHand);
|
||||
eyeOfEnder.signalTo(blockPos);
|
||||
eyeOfEnder.signalTo(Vec3.atLowerCornerOf(blockPos));
|
||||
level.gameEvent(GameEvent.PROJECTILE_SHOOT, eyeOfEnder.position(), GameEvent.Context.of(player));
|
||||
- level.addFreshEntity(eyeOfEnder);
|
||||
+ // CraftBukkit start
|
||||
|
||||
@@ -1,43 +1,45 @@
|
||||
--- a/net/minecraft/world/item/FireworkRocketItem.java
|
||||
+++ b/net/minecraft/world/item/FireworkRocketItem.java
|
||||
@@ -29,7 +_,7 @@
|
||||
ItemStack itemInHand = context.getItemInHand();
|
||||
Vec3 clickLocation = context.getClickLocation();
|
||||
Direction clickedFace = context.getClickedFace();
|
||||
- Projectile.spawnProjectile(
|
||||
+ final Projectile.Delayed<FireworkRocketEntity> fireworkRocketEntity = Projectile.spawnProjectileDelayed( // Paper - PlayerLaunchProjectileEvent
|
||||
new FireworkRocketEntity(
|
||||
level,
|
||||
context.getPlayer(),
|
||||
@@ -39,9 +_,14 @@
|
||||
itemInHand
|
||||
),
|
||||
serverLevel,
|
||||
- itemInHand
|
||||
+ itemInHand, f -> f.spawningEntity = context.getPlayer() == null ? null : context.getPlayer().getUUID() // Paper - firework api - assign spawning entity uuid
|
||||
);
|
||||
- itemInHand.shrink(1);
|
||||
+ // Paper start - PlayerLaunchProjectileEvent
|
||||
+ com.destroystokyo.paper.event.player.PlayerLaunchProjectileEvent event = new com.destroystokyo.paper.event.player.PlayerLaunchProjectileEvent((org.bukkit.entity.Player) context.getPlayer().getBukkitEntity(), org.bukkit.craftbukkit.inventory.CraftItemStack.asCraftMirror(itemInHand), (org.bukkit.entity.Firework) fireworkRocketEntity.projectile().getBukkitEntity());
|
||||
+ if (!event.callEvent() || !fireworkRocketEntity.attemptSpawn()) return InteractionResult.PASS;
|
||||
+ if (event.shouldConsume() && !context.getPlayer().hasInfiniteMaterials()) itemInHand.shrink(1);
|
||||
+ else context.getPlayer().containerMenu.sendAllDataToRemote();
|
||||
+ // Paper end - PlayerLaunchProjectileEvent
|
||||
}
|
||||
@@ -35,7 +_,7 @@
|
||||
ItemStack itemInHand = context.getItemInHand();
|
||||
Vec3 clickLocation = context.getClickLocation();
|
||||
Direction clickedFace = context.getClickedFace();
|
||||
- Projectile.spawnProjectile(
|
||||
+ final Projectile.Delayed<FireworkRocketEntity> fireworkRocketEntity = Projectile.spawnProjectileDelayed( // Paper - PlayerLaunchProjectileEvent
|
||||
new FireworkRocketEntity(
|
||||
level,
|
||||
context.getPlayer(),
|
||||
@@ -45,9 +_,14 @@
|
||||
itemInHand
|
||||
),
|
||||
serverLevel,
|
||||
- itemInHand
|
||||
+ itemInHand, f -> f.spawningEntity = context.getPlayer() == null ? null : context.getPlayer().getUUID() // Paper - firework api - assign spawning entity uuid
|
||||
);
|
||||
- itemInHand.shrink(1);
|
||||
+ // Paper start - PlayerLaunchProjectileEvent
|
||||
+ com.destroystokyo.paper.event.player.PlayerLaunchProjectileEvent event = new com.destroystokyo.paper.event.player.PlayerLaunchProjectileEvent((org.bukkit.entity.Player) context.getPlayer().getBukkitEntity(), org.bukkit.craftbukkit.inventory.CraftItemStack.asCraftMirror(itemInHand), (org.bukkit.entity.Firework) fireworkRocketEntity.projectile().getBukkitEntity());
|
||||
+ if (!event.callEvent() || !fireworkRocketEntity.attemptSpawn()) return InteractionResult.PASS;
|
||||
+ if (event.shouldConsume() && !context.getPlayer().hasInfiniteMaterials()) itemInHand.shrink(1);
|
||||
+ else context.getPlayer().containerMenu.sendAllDataToRemote();
|
||||
+ // Paper end - PlayerLaunchProjectileEvent
|
||||
}
|
||||
|
||||
return InteractionResult.SUCCESS;
|
||||
@@ -52,9 +_,21 @@
|
||||
return InteractionResult.SUCCESS;
|
||||
@@ -59,13 +_,24 @@
|
||||
if (player.isFallFlying()) {
|
||||
ItemStack itemInHand = player.getItemInHand(hand);
|
||||
if (level instanceof ServerLevel serverLevel) {
|
||||
- Projectile.spawnProjectile(new FireworkRocketEntity(level, itemInHand, player), serverLevel, itemInHand);
|
||||
- itemInHand.consume(1, player);
|
||||
- player.awardStat(Stats.ITEM_USED.get(this));
|
||||
- if (player.dropAllLeashConnections(null)) {
|
||||
- level.playSound(null, player, SoundEvents.LEAD_BREAK, SoundSource.NEUTRAL, 1.0F, 1.0F);
|
||||
+ // Paper start - PlayerElytraBoostEvent
|
||||
+ final Projectile.Delayed<FireworkRocketEntity> delayed = Projectile.spawnProjectileDelayed(new FireworkRocketEntity(level, itemInHand, player), serverLevel, itemInHand, f -> f.spawningEntity = player.getUUID()); // Paper - firework api - assign spawning entity uuid
|
||||
+ com.destroystokyo.paper.event.player.PlayerElytraBoostEvent event = new com.destroystokyo.paper.event.player.PlayerElytraBoostEvent((org.bukkit.entity.Player) player.getBukkitEntity(), org.bukkit.craftbukkit.inventory.CraftItemStack.asCraftMirror(itemInHand), (org.bukkit.entity.Firework) delayed.projectile().getBukkitEntity(), org.bukkit.craftbukkit.CraftEquipmentSlot.getHand(hand));
|
||||
+ if (event.callEvent() && delayed.attemptSpawn()) {
|
||||
+ player.awardStat(Stats.ITEM_USED.get(this)); // Moved up from below
|
||||
+ if (player.dropAllLeashConnections(null)) {
|
||||
+ level.playSound(null, player, SoundEvents.LEAD_BREAK, SoundSource.NEUTRAL, 1.0F, 1.0F);
|
||||
+ }
|
||||
+ if (event.shouldConsume() && !player.hasInfiniteMaterials()) {
|
||||
+ itemInHand.shrink(1); // Moved up from below
|
||||
+ } else {
|
||||
@@ -45,7 +47,11 @@
|
||||
+ }
|
||||
+ } else {
|
||||
+ player.containerMenu.sendAllDataToRemote();
|
||||
+ }
|
||||
}
|
||||
-
|
||||
- Projectile.spawnProjectile(new FireworkRocketEntity(level, itemInHand, player), serverLevel, itemInHand);
|
||||
- itemInHand.consume(1, player);
|
||||
- player.awardStat(Stats.ITEM_USED.get(this));
|
||||
+ // Moved up consume and changed consume to shrink
|
||||
+ // Paper end - PlayerElytraBoostEvent
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/world/item/ItemStack.java
|
||||
+++ b/net/minecraft/world/item/ItemStack.java
|
||||
@@ -198,12 +_,20 @@
|
||||
@@ -195,12 +_,20 @@
|
||||
|
||||
@Override
|
||||
public void encode(RegistryFriendlyByteBuf buffer, ItemStack value) {
|
||||
@@ -23,7 +23,7 @@
|
||||
}
|
||||
}
|
||||
};
|
||||
@@ -373,10 +_,166 @@
|
||||
@@ -365,10 +_,166 @@
|
||||
return InteractionResult.PASS;
|
||||
} else {
|
||||
Item item = this.getItem();
|
||||
@@ -192,7 +192,7 @@
|
||||
|
||||
return interactionResult;
|
||||
}
|
||||
@@ -473,31 +_,71 @@
|
||||
@@ -449,31 +_,71 @@
|
||||
return this.isDamageableItem() && this.getDamageValue() >= this.getMaxDamage() - 1;
|
||||
}
|
||||
|
||||
@@ -272,7 +272,7 @@
|
||||
this.shrink(1);
|
||||
onBreak.accept(item);
|
||||
}
|
||||
@@ -510,15 +_,39 @@
|
||||
@@ -486,7 +_,26 @@
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -300,6 +300,8 @@
|
||||
this.applyDamage(min, serverPlayer, item -> {});
|
||||
}
|
||||
}
|
||||
@@ -496,9 +_,14 @@
|
||||
}
|
||||
|
||||
public void hurtAndBreak(int amount, LivingEntity entity, EquipmentSlot slot) {
|
||||
+ // Paper start - add param to skip infinite mats check
|
||||
@@ -314,7 +316,7 @@
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -732,6 +_,12 @@
|
||||
@@ -712,6 +_,12 @@
|
||||
return this.getItem().useOnRelease(this);
|
||||
}
|
||||
|
||||
@@ -327,7 +329,7 @@
|
||||
@Nullable
|
||||
public <T> T set(DataComponentType<T> component, @Nullable T value) {
|
||||
return this.components.set(component, value);
|
||||
@@ -779,6 +_,28 @@
|
||||
@@ -759,6 +_,28 @@
|
||||
this.getItem().verifyComponentsAfterLoad(this);
|
||||
}
|
||||
|
||||
@@ -356,7 +358,7 @@
|
||||
public Component getHoverName() {
|
||||
Component customName = this.getCustomName();
|
||||
return customName != null ? customName : this.getItemName();
|
||||
@@ -1054,6 +_,19 @@
|
||||
@@ -986,6 +_,19 @@
|
||||
EnchantmentHelper.forEachModifier(this, equipmentSLot, action);
|
||||
}
|
||||
|
||||
@@ -376,7 +378,7 @@
|
||||
public Component getDisplayName() {
|
||||
MutableComponent mutableComponent = Component.empty().append(this.getHoverName());
|
||||
if (this.has(DataComponents.CUSTOM_NAME)) {
|
||||
@@ -1109,7 +_,7 @@
|
||||
@@ -1041,7 +_,7 @@
|
||||
}
|
||||
|
||||
public void consume(int amount, @Nullable LivingEntity entity) {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/world/item/LeadItem.java
|
||||
+++ b/net/minecraft/world/item/LeadItem.java
|
||||
@@ -28,23 +_,43 @@
|
||||
@@ -26,24 +_,43 @@
|
||||
if (blockState.is(BlockTags.FENCES)) {
|
||||
Player player = context.getPlayer();
|
||||
if (!level.isClientSide && player != null) {
|
||||
@@ -15,7 +15,8 @@
|
||||
- public static InteractionResult bindPlayerMobs(Player player, Level level, BlockPos pos) {
|
||||
+ public static InteractionResult bindPlayerMobs(Player player, Level level, BlockPos pos, net.minecraft.world.InteractionHand interactionHand) { // CraftBukkit - Add InteractionHand
|
||||
LeashFenceKnotEntity leashFenceKnotEntity = null;
|
||||
List<Leashable> list = leashableInArea(level, pos, leashable1 -> leashable1.getLeashHolder() == player);
|
||||
List<Leashable> list = Leashable.leashableInArea(level, Vec3.atCenterOf(pos), leashable1 -> leashable1.getLeashHolder() == player);
|
||||
boolean flag = false;
|
||||
|
||||
- for (Leashable leashable : list) {
|
||||
+ for (java.util.Iterator<Leashable> iterator = list.iterator(); iterator.hasNext();) { // Paper - use iterator to remove
|
||||
@@ -36,18 +37,17 @@
|
||||
}
|
||||
|
||||
+ // CraftBukkit start
|
||||
+ if (leashable instanceof Entity leashed) {
|
||||
+ if (leashable instanceof net.minecraft.world.entity.Entity leashed) {
|
||||
+ if (org.bukkit.craftbukkit.event.CraftEventFactory.callPlayerLeashEntityEvent(leashed, leashFenceKnotEntity, player, interactionHand).isCancelled()) {
|
||||
+ iterator.remove();
|
||||
+ continue;
|
||||
+ }
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
+
|
||||
leashable.setLeashedTo(leashFenceKnotEntity, true);
|
||||
}
|
||||
|
||||
@@ -52,9 +_,20 @@
|
||||
if (leashable.canHaveALeashAttachedTo(leashFenceKnotEntity)) {
|
||||
leashable.setLeashedTo(leashFenceKnotEntity, true);
|
||||
flag = true;
|
||||
@@ -54,7 +_,18 @@
|
||||
level.gameEvent(GameEvent.BLOCK_ATTACH, pos, GameEvent.Context.of(player));
|
||||
return InteractionResult.SUCCESS_SERVER;
|
||||
} else {
|
||||
@@ -65,6 +65,4 @@
|
||||
+ return LeadItem.bindPlayerMobs(player, world, pos, net.minecraft.world.InteractionHand.MAIN_HAND);
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
|
||||
public static List<Leashable> leashableInArea(Level level, BlockPos pos, Predicate<Leashable> predicate) {
|
||||
double d = 7.0;
|
||||
}
|
||||
|
||||
@@ -30,7 +30,7 @@
|
||||
+ stack.getAllOfType(ConsumableListener.class).forEach(listener -> {
|
||||
+ listener.cancelUsingItem(player, stack, packets); // Paper - properly resend entities - collect packets for bundle
|
||||
+ });
|
||||
+ player.server.getPlayerList().sendActiveEffects(player, packets::add); // Paper - properly resend entities - collect packets for bundle
|
||||
+ player.getServer().getPlayerList().sendActiveEffects(player, packets::add); // Paper - properly resend entities - collect packets for bundle
|
||||
+ player.connection.send(new net.minecraft.network.protocol.game.ClientboundBundlePacket(packets));
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/world/item/component/CustomData.java
|
||||
+++ b/net/minecraft/world/item/component/CustomData.java
|
||||
@@ -33,7 +_,17 @@
|
||||
@@ -36,7 +_,17 @@
|
||||
private static final Logger LOGGER = LogUtils.getLogger();
|
||||
public static final CustomData EMPTY = new CustomData(new CompoundTag());
|
||||
private static final String TYPE_TAG = "id";
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/world/item/component/ResolvableProfile.java
|
||||
+++ b/net/minecraft/world/item/component/ResolvableProfile.java
|
||||
@@ -20,9 +_,10 @@
|
||||
@@ -21,9 +_,10 @@
|
||||
instance -> instance.group(
|
||||
ExtraCodecs.PLAYER_NAME.optionalFieldOf("name").forGetter(ResolvableProfile::name),
|
||||
UUIDUtil.CODEC.optionalFieldOf("id").forGetter(ResolvableProfile::id),
|
||||
@@ -12,12 +12,21 @@
|
||||
);
|
||||
public static final Codec<ResolvableProfile> CODEC = Codec.withAlternative(
|
||||
FULL_CODEC, ExtraCodecs.PLAYER_NAME, name -> new ResolvableProfile(Optional.of(name), Optional.empty(), new PropertyMap())
|
||||
@@ -49,7 +_,7 @@
|
||||
if (this.isResolved()) {
|
||||
@@ -53,7 +_,7 @@
|
||||
} else {
|
||||
Optional<GameProfile> optional;
|
||||
if (this.id.isPresent()) {
|
||||
- optional = SkullBlockEntity.fetchGameProfile(this.id.get()).getNow(null);
|
||||
+ optional = SkullBlockEntity.fetchGameProfile(this.id.get(), this.name.orElse(null)).getNow(null); // Paper - player profile events - pass name
|
||||
} else {
|
||||
optional = SkullBlockEntity.fetchGameProfile(this.name.orElseThrow()).getNow(null);
|
||||
}
|
||||
@@ -67,7 +_,7 @@
|
||||
return CompletableFuture.completedFuture(this);
|
||||
} else {
|
||||
- return this.id.isPresent() ? SkullBlockEntity.fetchGameProfile(this.id.get()).thenApply(optional -> {
|
||||
+ return this.id.isPresent() ? SkullBlockEntity.fetchGameProfile(this.id.get(), this.name.orElse(null)).thenApply(optional -> { // Paper - player profile events
|
||||
GameProfile gameProfile = optional.orElseGet(() -> new GameProfile(this.id.get(), this.name.orElse("")));
|
||||
return new ResolvableProfile(gameProfile);
|
||||
}) : SkullBlockEntity.fetchGameProfile(this.name.orElseThrow()).thenApply(optional -> {
|
||||
return this.id.isPresent()
|
||||
- ? SkullBlockEntity.fetchGameProfile(this.id.get()).thenApply(this::createProfile)
|
||||
+ ? SkullBlockEntity.fetchGameProfile(this.id.get(), this.name.orElse(null)).thenApply(this::createProfile) // Paper - player profile events - pass name
|
||||
: SkullBlockEntity.fetchGameProfile(this.name.orElseThrow()).thenApply(this::createProfile);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
+ if (this.featureflagset != null) {
|
||||
+ this.finalizeRecipeLoading(this.featureflagset);
|
||||
+
|
||||
+ net.minecraft.server.MinecraftServer.getServer().getPlayerList().reloadRecipes();
|
||||
+ net.minecraft.server.MinecraftServer.getServer().getPlayerList().reloadResources();
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
@@ -39,15 +39,7 @@
|
||||
}
|
||||
|
||||
public Optional<RecipeHolder<?>> byKey(ResourceKey<Recipe<?>> key) {
|
||||
@@ -184,6 +_,7 @@
|
||||
|
||||
@Nullable
|
||||
public RecipeManager.ServerDisplayInfo getRecipeFromDisplay(RecipeDisplayId display) {
|
||||
+ if (display.index() < 0 || display.index() >= this.allDisplays.size()) return null; // Paper
|
||||
return this.allDisplays.get(display.index());
|
||||
}
|
||||
|
||||
@@ -199,6 +_,22 @@
|
||||
@@ -200,6 +_,22 @@
|
||||
Recipe<?> recipe1 = Recipe.CODEC.parse(registries.createSerializationContext(JsonOps.INSTANCE), json).getOrThrow(JsonParseException::new);
|
||||
return new RecipeHolder<>(recipe, recipe1);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user