9
0
mirror of https://github.com/Samsuik/Sakura.git synced 2025-12-28 19:29:07 +00:00

Add outline collision to enderpearls

This commit is contained in:
Samsuik
2024-03-14 19:03:05 +00:00
parent 99b6c7b1bd
commit 8fe48d3156
2 changed files with 34 additions and 2 deletions

View File

@@ -645,10 +645,10 @@ index 0000000000000000000000000000000000000000..04dc81634277d05894076a2cafde60ca
+}
diff --git a/src/main/java/me/samsuik/sakura/configuration/WorldConfiguration.java b/src/main/java/me/samsuik/sakura/configuration/WorldConfiguration.java
new file mode 100644
index 0000000000000000000000000000000000000000..9f3bfd0394f2aa2033ec9affb22b7e2a3732dc5a
index 0000000000000000000000000000000000000000..b842875145a5a7659309256cfb8b275dee82d532
--- /dev/null
+++ b/src/main/java/me/samsuik/sakura/configuration/WorldConfiguration.java
@@ -0,0 +1,184 @@
@@ -0,0 +1,189 @@
+package me.samsuik.sakura.configuration;
+
+import com.mojang.logging.LogUtils;
@@ -819,6 +819,11 @@ index 0000000000000000000000000000000000000000..9f3bfd0394f2aa2033ec9affb22b7e2a
+ public double verticalSpeed = 1.0;
+ public boolean allowBreakingInsideEntities = false;
+ }
+
+ public EnderPearl enderPearl = new EnderPearl();
+ public class EnderPearl extends ConfigurationPart {
+ public boolean useOutlineForCollision = false;
+ }
+ }
+
+ public Environment environment;

View File

@@ -0,0 +1,27 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Samsuik <kfian294ma4@gmail.com>
Date: Thu, 14 Mar 2024 18:13:24 +0000
Subject: [PATCH] Add outline colliison to enderpearls
diff --git a/src/main/java/net/minecraft/world/entity/projectile/ThrowableProjectile.java b/src/main/java/net/minecraft/world/entity/projectile/ThrowableProjectile.java
index ab777952bda1651796ed41e8a7fc6621f27db9aa..72676ea1458e91e46a62bb6fd88d7a425664d56a 100644
--- a/src/main/java/net/minecraft/world/entity/projectile/ThrowableProjectile.java
+++ b/src/main/java/net/minecraft/world/entity/projectile/ThrowableProjectile.java
@@ -44,7 +44,15 @@ public abstract class ThrowableProjectile extends Projectile {
@Override
public void tick() {
super.tick();
- HitResult movingobjectposition = ProjectileUtil.getHitResultOnMoveVector(this, this::canHitEntity);
+ // Sakura start - enderpearls use outline for collision
+ final net.minecraft.world.level.ClipContext.Block type;
+ if (level().sakuraConfig().entity.enderPearl.useOutlineForCollision && this instanceof ThrownEnderpearl) {
+ type = net.minecraft.world.level.ClipContext.Block.OUTLINE;
+ } else {
+ type = net.minecraft.world.level.ClipContext.Block.COLLIDER;
+ }
+ HitResult movingobjectposition = ProjectileUtil.getHitResultOnMoveVector(this, this::canHitEntity, type);
+ // Sakura end - enderpearls use outline for collision
boolean flag = false;
if (movingobjectposition.getType() == HitResult.Type.BLOCK) {