mirror of
https://github.com/Samsuik/Sakura.git
synced 2025-12-27 02:39:06 +00:00
Add config for potion mechanics
This commit is contained in:
@@ -15,4 +15,5 @@ minecraft net.minecraft.world.level.block.FallingBlock
|
||||
minecraft net.minecraft.world.level.block.piston.MovingPistonBlock
|
||||
minecraft net.minecraft.world.level.block.piston.PistonHeadBlock
|
||||
minecraft net.minecraft.world.level.block.LadderBlock
|
||||
minecraft net.minecraft.world.level.block.Blocks
|
||||
minecraft net.minecraft.world.level.block.Blocks
|
||||
minecraft net.minecraft.world.entity.projectile.ProjectileUtil
|
||||
@@ -634,10 +634,10 @@ index 0000000000000000000000000000000000000000..74d4e257440842d40bfd72ff0741f1d7
|
||||
+}
|
||||
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..1ec5190fe6755e5be10aa30f98bcfd6f1d8ce84b
|
||||
index 0000000000000000000000000000000000000000..f9a99319a4ba86762e2486a75f73df1cf74dcfdc
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/me/samsuik/sakura/configuration/WorldConfiguration.java
|
||||
@@ -0,0 +1,177 @@
|
||||
@@ -0,0 +1,184 @@
|
||||
+package me.samsuik.sakura.configuration;
|
||||
+
|
||||
+import com.mojang.logging.LogUtils;
|
||||
@@ -801,6 +801,13 @@ index 0000000000000000000000000000000000000000..1ec5190fe6755e5be10aa30f98bcfd6f
|
||||
+ public Map<EntityType<?>, Integer> chunkTravelLimit = Util.make(new Reference2ObjectOpenHashMap<>(), map -> {
|
||||
+ map.put(EntityType.ENDER_PEARL, 8);
|
||||
+ });
|
||||
+
|
||||
+ public ThrownPotion thrownPotion = new ThrownPotion();
|
||||
+ public class ThrownPotion extends ConfigurationPart {
|
||||
+ public double horizontalSpeed = 1.0;
|
||||
+ public double verticalSpeed = 1.0;
|
||||
+ public boolean allowBreakingInsideEntities = false;
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ public Environment environment;
|
||||
|
||||
@@ -0,0 +1,69 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Samsuik <kfian294ma4@gmail.com>
|
||||
Date: Fri, 23 Feb 2024 16:18:51 +0000
|
||||
Subject: [PATCH] Configure potion speed and breaking inside entities
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/projectile/Projectile.java b/src/main/java/net/minecraft/world/entity/projectile/Projectile.java
|
||||
index 156809090f1f83ad68e7e2477a3cfddac5757a8e..f834a3a2634a7b245ea8881b2cc613296f3b94ba 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/projectile/Projectile.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/projectile/Projectile.java
|
||||
@@ -151,7 +151,7 @@ public abstract class Projectile extends Entity implements TraceableEntity {
|
||||
super.tick();
|
||||
}
|
||||
|
||||
- private boolean checkLeftOwner() {
|
||||
+ protected boolean checkLeftOwner() { // Sakura - configure potion mechanics
|
||||
Entity entity = this.getOwner();
|
||||
|
||||
if (entity != null) {
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/projectile/ProjectileUtil.java b/src/main/java/net/minecraft/world/entity/projectile/ProjectileUtil.java
|
||||
index 391ba45cce8196720e1856626067857ad8ad2443..9d38a45f8fc6583db7dd51aa7d9d69b38ebc256a 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/projectile/ProjectileUtil.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/projectile/ProjectileUtil.java
|
||||
@@ -49,7 +49,14 @@ public final class ProjectileUtil {
|
||||
vec3 = hitResult.getLocation();
|
||||
}
|
||||
|
||||
- HitResult hitResult2 = getEntityHitResult(world, entity, pos, vec3, entity.getBoundingBox().expandTowards(velocity).inflate(1.0D), predicate, margin);
|
||||
+ // Sakura start - configure potion mechanics
|
||||
+ final HitResult hitResult2;
|
||||
+ if (world.sakuraConfig().entity.thrownPotion.allowBreakingInsideEntities && entity instanceof ThrownPotion) {
|
||||
+ hitResult2 = getEntityHitResult(entity, pos, vec3, entity.getBoundingBox().expandTowards(velocity).inflate(1.0D), predicate, margin);
|
||||
+ } else {
|
||||
+ hitResult2 = getEntityHitResult(world, entity, pos, vec3, entity.getBoundingBox().expandTowards(velocity).inflate(1.0D), predicate, margin);
|
||||
+ }
|
||||
+ // Sakura end - configure potion mechanics
|
||||
if (hitResult2 != null) {
|
||||
hitResult = hitResult2;
|
||||
}
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/projectile/ThrownPotion.java b/src/main/java/net/minecraft/world/entity/projectile/ThrownPotion.java
|
||||
index 0c5bac5d955b1e380103c9b51635010212c6526e..f0580c221a1e64c721d6438daa0950fc46e58450 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/projectile/ThrownPotion.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/projectile/ThrownPotion.java
|
||||
@@ -60,6 +60,25 @@ public class ThrownPotion extends ThrowableItemProjectile implements ItemSupplie
|
||||
super(EntityType.POTION, x, y, z, world);
|
||||
}
|
||||
|
||||
+ // Sakura start - configure potion mechanics
|
||||
+ @Override
|
||||
+ public void shoot(double x, double y, double z, float speed, float divergence) {
|
||||
+ super.shoot(x, y, z, speed, divergence);
|
||||
+
|
||||
+ net.minecraft.world.phys.Vec3 movement = getDeltaMovement();
|
||||
+ double moveX = movement.x * level().sakuraConfig().entity.thrownPotion.horizontalSpeed;
|
||||
+ double moveY = movement.y * level().sakuraConfig().entity.thrownPotion.verticalSpeed;
|
||||
+ double moveZ = movement.z * level().sakuraConfig().entity.thrownPotion.horizontalSpeed;
|
||||
+
|
||||
+ setDeltaMovement(moveX, moveY, moveZ);
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ protected final boolean checkLeftOwner() {
|
||||
+ return super.checkLeftOwner() || level().sakuraConfig().entity.thrownPotion.allowBreakingInsideEntities && tickCount >= 5;
|
||||
+ }
|
||||
+ // Sakura end - configure potion mechanics
|
||||
+
|
||||
@Override
|
||||
protected Item getDefaultItem() {
|
||||
return Items.SPLASH_POTION;
|
||||
Reference in New Issue
Block a user