aboutsummaryrefslogtreecommitdiffhomepage
path: root/patch-remap/mache-spigotflower/net/minecraft/world/item/BoatItem.java.patch
diff options
context:
space:
mode:
authorMiniDigger | Martin <[email protected]>2024-01-14 11:04:49 +0100
committerMiniDigger | Martin <[email protected]>2024-01-14 11:04:49 +0100
commitbee74680e607c2e29b038329f62181238911cd83 (patch)
tree708fd1a4a0227d9071243adf2a42d5e9e96cde4a /patch-remap/mache-spigotflower/net/minecraft/world/item/BoatItem.java.patch
parent0a44692ef6ff6e255d48eb3ba1bb114166eafda9 (diff)
downloadPaper-softspoon.tar.gz
Paper-softspoon.zip
add remapped patches as a testsoftspoon
Diffstat (limited to 'patch-remap/mache-spigotflower/net/minecraft/world/item/BoatItem.java.patch')
-rw-r--r--patch-remap/mache-spigotflower/net/minecraft/world/item/BoatItem.java.patch118
1 files changed, 118 insertions, 0 deletions
diff --git a/patch-remap/mache-spigotflower/net/minecraft/world/item/BoatItem.java.patch b/patch-remap/mache-spigotflower/net/minecraft/world/item/BoatItem.java.patch
new file mode 100644
index 0000000000..e85cb14fde
--- /dev/null
+++ b/patch-remap/mache-spigotflower/net/minecraft/world/item/BoatItem.java.patch
@@ -0,0 +1,118 @@
+--- a/net/minecraft/world/item/BoatItem.java
++++ b/net/minecraft/world/item/BoatItem.java
+@@ -5,7 +5,7 @@
+ import java.util.function.Predicate;
+ import net.minecraft.server.level.ServerLevel;
+ import net.minecraft.stats.Stats;
+-import net.minecraft.world.InteractionHand;
++import net.minecraft.world.EnumHand;
+ import net.minecraft.world.InteractionResultHolder;
+ import net.minecraft.world.entity.Entity;
+ import net.minecraft.world.entity.EntitySelector;
+@@ -27,50 +27,64 @@
+ private final Boat.Type type;
+ private final boolean hasChest;
+
+- public BoatItem(boolean flag, Boat.Type boat_type, Item.Properties item_properties) {
+- super(item_properties);
+- this.hasChest = flag;
+- this.type = boat_type;
++ public BoatItem(boolean hasChest, Boat.Type type, Item.Properties properties) {
++ super(properties);
++ this.hasChest = hasChest;
++ this.type = type;
+ }
+
+ @Override
+- @Override
+- public InteractionResultHolder<ItemStack> use(Level level, Player player, InteractionHand interactionhand) {
+- ItemStack itemstack = player.getItemInHand(interactionhand);
+- BlockHitResult blockhitresult = getPlayerPOVHitResult(level, player, ClipContext.Fluid.ANY);
++ public InteractionResultHolder<ItemStack> use(Level level, Player player, EnumHand hand) {
++ ItemStack itemstack = player.getItemInHand(hand);
++ BlockHitResult movingobjectpositionblock = getPlayerPOVHitResult(level, player, ClipContext.Fluid.ANY);
+
+- if (blockhitresult.getType() == HitResult.Type.MISS) {
++ if (movingobjectpositionblock.getType() == HitResult.EnumMovingObjectType.MISS) {
+ return InteractionResultHolder.pass(itemstack);
+ } else {
+- Vec3 vec3 = player.getViewVector(1.0F);
++ Vec3 vec3d = player.getViewVector(1.0F);
+ double d0 = 5.0D;
+- List<Entity> list = level.getEntities((Entity) player, player.getBoundingBox().expandTowards(vec3.scale(5.0D)).inflate(1.0D), BoatItem.ENTITY_PREDICATE);
++ List<Entity> list = level.getEntities((Entity) player, player.getBoundingBox().expandTowards(vec3d.scale(5.0D)).inflate(1.0D), BoatItem.ENTITY_PREDICATE);
+
+ if (!list.isEmpty()) {
+- Vec3 vec31 = player.getEyePosition();
++ Vec3 vec3d1 = player.getEyePosition();
+ Iterator iterator = list.iterator();
+
+ while (iterator.hasNext()) {
+ Entity entity = (Entity) iterator.next();
+- AABB aabb = entity.getBoundingBox().inflate((double) entity.getPickRadius());
++ AABB axisalignedbb = entity.getBoundingBox().inflate((double) entity.getPickRadius());
+
+- if (aabb.contains(vec31)) {
++ if (axisalignedbb.contains(vec3d1)) {
+ return InteractionResultHolder.pass(itemstack);
+ }
+ }
+ }
+
+- if (blockhitresult.getType() == HitResult.Type.BLOCK) {
+- Boat boat = this.getBoat(level, blockhitresult, itemstack, player);
++ if (movingobjectpositionblock.getType() == HitResult.EnumMovingObjectType.BLOCK) {
++ // CraftBukkit start - Boat placement
++ org.bukkit.event.player.PlayerInteractEvent event = org.bukkit.craftbukkit.event.CraftEventFactory.callPlayerInteractEvent(player, org.bukkit.event.block.Action.RIGHT_CLICK_BLOCK, movingobjectpositionblock.getBlockPos(), movingobjectpositionblock.getDirection(), itemstack, false, hand, movingobjectpositionblock.getLocation());
+
+- boat.setVariant(this.type);
+- boat.setYRot(player.getYRot());
+- if (!level.noCollision(boat, boat.getBoundingBox())) {
++ if (event.isCancelled()) {
++ return InteractionResultHolder.pass(itemstack);
++ }
++ // CraftBukkit end
++ Boat entityboat = this.getBoat(level, movingobjectpositionblock, itemstack, player);
++
++ entityboat.setVariant(this.type);
++ entityboat.setYRot(player.getYRot());
++ if (!level.noCollision(entityboat, entityboat.getBoundingBox())) {
+ return InteractionResultHolder.fail(itemstack);
+ } else {
+ if (!level.isClientSide) {
+- level.addFreshEntity(boat);
+- level.gameEvent((Entity) player, GameEvent.ENTITY_PLACE, blockhitresult.getLocation());
++ // CraftBukkit start
++ if (org.bukkit.craftbukkit.event.CraftEventFactory.callEntityPlaceEvent(level, movingobjectpositionblock.getBlockPos(), movingobjectpositionblock.getDirection(), player, entityboat, hand).isCancelled()) {
++ return InteractionResultHolder.fail(itemstack);
++ }
++
++ if (!level.addFreshEntity(entityboat)) {
++ return InteractionResultHolder.pass(itemstack);
++ }
++ // CraftBukkit end
++ level.gameEvent((Entity) player, GameEvent.ENTITY_PLACE, movingobjectpositionblock.getLocation());
+ if (!player.getAbilities().instabuild) {
+ itemstack.shrink(1);
+ }
+@@ -85,14 +99,14 @@
+ }
+ }
+
+- private Boat getBoat(Level level, HitResult hitresult, ItemStack itemstack, Player player) {
+- Vec3 vec3 = hitresult.getLocation();
+- Object object = this.hasChest ? new ChestBoat(level, vec3.x, vec3.y, vec3.z) : new Boat(level, vec3.x, vec3.y, vec3.z);
++ private Boat getBoat(Level world, HitResult movingobjectposition, ItemStack itemstack, Player entityhuman) {
++ Vec3 vec3d = movingobjectposition.getLocation();
++ Boat object = this.hasChest ? new ChestBoat(world, vec3d.x, vec3d.y, vec3d.z) : new Boat(world, vec3d.x, vec3d.y, vec3d.z); // CraftBukkit - decompile error
+
+- if (level instanceof ServerLevel) {
+- ServerLevel serverlevel = (ServerLevel) level;
++ if (world instanceof ServerLevel) {
++ ServerLevel worldserver = (ServerLevel) world;
+
+- EntityType.createDefaultStackConfig(serverlevel, itemstack, player).accept(object);
++ EntityType.createDefaultStackConfig(worldserver, itemstack, entityhuman).accept(object);
+ }
+
+ return (Boat) object;