Skip to content

Commit

Permalink
Add outline collision to enderpearls
Browse files Browse the repository at this point in the history
  • Loading branch information
Samsuik committed Mar 14, 2024
1 parent 99b6c7b commit 8fe48d3
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 2 deletions.
9 changes: 7 additions & 2 deletions patches/server/0004-Sakura-Configuration-Files.patch
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down
27 changes: 27 additions & 0 deletions patches/server/0064-Add-outline-colliison-to-enderpearls.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Samsuik <[email protected]>
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) {

0 comments on commit 8fe48d3

Please sign in to comment.