mirror of
https://github.com/LeavesMC/Leaves.git
synced 2025-12-21 15:59:33 +00:00
34 lines
2.7 KiB
Diff
34 lines
2.7 KiB
Diff
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
From: violetc <58360096+s-yh-china@users.noreply.github.com>
|
|
Date: Mon, 17 Jul 2023 22:27:12 +0800
|
|
Subject: [PATCH] Use fast item merge raytracing
|
|
|
|
This patch is Powered by Gale(https://github.com/GaleMC/Gale)
|
|
|
|
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 1234310bf4b981039135c865296e6d94052d81e2..c72e73ee5878651f48a0513e03dc7903386d6eb5 100644
|
|
--- a/src/main/java/net/minecraft/world/entity/item/ItemEntity.java
|
|
+++ b/src/main/java/net/minecraft/world/entity/item/ItemEntity.java
|
|
@@ -286,10 +286,17 @@ public class ItemEntity extends Entity implements TraceableEntity {
|
|
if (entityitem.isMergable()) {
|
|
// Paper Start - Fix items merging through walls
|
|
if (this.level().paperConfig().fixes.fixItemsMergingThroughWalls) {
|
|
- 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 = this.level().clip(rayTrace);
|
|
- if (rayTraceResult.getType() == net.minecraft.world.phys.HitResult.Type.BLOCK) continue;
|
|
+ // Leaves start - use fast item merge raytracing
|
|
+ if (!top.leavesmc.leaves.LeavesConfig.useFastItemMergeRaytracing) {
|
|
+ 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 = this.level().clip(rayTrace);
|
|
+ if (rayTraceResult.getType() == net.minecraft.world.phys.HitResult.Type.BLOCK) continue;
|
|
+ } else {
|
|
+ if (level().rayTraceDirect(this.position(), entityitem.position(), net.minecraft.world.phys.shapes.CollisionContext.of(this)) ==
|
|
+ net.minecraft.world.phys.HitResult.Type.BLOCK) continue;
|
|
+ }
|
|
+ // Leaves end - use fast item merge raytracing
|
|
}
|
|
// Paper End
|
|
this.tryToMerge(entityitem);
|