From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 From: Martijn Muijsers Date: Wed, 23 Nov 2022 22:29:05 +0100 Subject: [PATCH] Use fast item merge raytracing License: GPL-3.0 (https://www.gnu.org/licenses/gpl-3.0.html) Gale - https://galemc.org This patch is based on the following patch: "Patch Paper to use fast item merge raytracing" By: Paul Sauve As part of: Airplane (https://github.com/TECHNOVE/Airplane) Licensed under: GPL-3.0 (https://www.gnu.org/licenses/gpl-3.0.html) * Airplane copyright * Airplane Copyright (C) 2020 Technove LLC This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see . diff --git a/src/main/java/net/minecraft/world/entity/item/ItemEntity.java b/src/main/java/net/minecraft/world/entity/item/ItemEntity.java index f0ccdfbd7d7be8c6e302609accf8fe9cac8885c4..893eb4904df79a5fc629a0fc7a0c018548eeffb1 100644 --- a/src/main/java/net/minecraft/world/entity/item/ItemEntity.java +++ b/src/main/java/net/minecraft/world/entity/item/ItemEntity.java @@ -255,10 +255,16 @@ public class ItemEntity extends Entity { if (entityitem.isMergable()) { // Paper Start - Fix items merging through walls if (this.level.paperConfig().fixes.fixItemsMergingThroughWalls) { + // Gale start - Airplane - use fast item merge raytracing - skip the allocations + /* net.minecraft.world.level.ClipContext rayTrace = new net.minecraft.world.level.ClipContext(this.position(), entityitem.position(), net.minecraft.world.level.ClipContext.Block.COLLIDER, net.minecraft.world.level.ClipContext.Fluid.NONE, this); net.minecraft.world.phys.BlockHitResult rayTraceResult = level.clip(rayTrace); if (rayTraceResult.getType() == net.minecraft.world.phys.HitResult.Type.BLOCK) continue; + */ + if (level.rayTraceDirect(this.position(), entityitem.position(), net.minecraft.world.phys.shapes.CollisionContext.of(this)) == + net.minecraft.world.phys.HitResult.Type.BLOCK) continue; + // Gale end - Airplane - use fast item merge raytracing - skip the allocations } // Paper End this.tryToMerge(entityitem);