@@ -0,0 +1,11 @@
|
||||
--- a/net/minecraft/world/item/enchantment/effects/ApplyMobEffect.java
|
||||
+++ b/net/minecraft/world/item/enchantment/effects/ApplyMobEffect.java
|
||||
@@ -34,7 +34,7 @@
|
||||
int j = Math.round(MathHelper.randomBetween(randomsource, this.minDuration.calculate(i), this.maxDuration.calculate(i)) * 20.0F);
|
||||
int k = Math.max(0, Math.round(MathHelper.randomBetween(randomsource, this.minAmplifier.calculate(i), this.maxAmplifier.calculate(i))));
|
||||
|
||||
- entityliving.addEffect(new MobEffect((Holder) optional.get(), j, k));
|
||||
+ entityliving.addEffect(new MobEffect((Holder) optional.get(), j, k), org.bukkit.event.entity.EntityPotionEffectEvent.Cause.ATTACK); // CraftBukkit
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,30 @@
|
||||
--- a/net/minecraft/world/item/enchantment/effects/Ignite.java
|
||||
+++ b/net/minecraft/world/item/enchantment/effects/Ignite.java
|
||||
@@ -8,6 +8,10 @@
|
||||
import net.minecraft.world.item.enchantment.LevelBasedValue;
|
||||
import net.minecraft.world.phys.Vec3D;
|
||||
|
||||
+// CraftBukkit start
|
||||
+import org.bukkit.event.entity.EntityCombustByEntityEvent;
|
||||
+// CraftBukkit end
|
||||
+
|
||||
public record Ignite(LevelBasedValue duration) implements EnchantmentEntityEffect {
|
||||
|
||||
public static final MapCodec<Ignite> CODEC = RecordCodecBuilder.mapCodec((instance) -> {
|
||||
@@ -18,7 +22,15 @@
|
||||
|
||||
@Override
|
||||
public void apply(WorldServer worldserver, int i, EnchantedItemInUse enchantediteminuse, Entity entity, Vec3D vec3d) {
|
||||
- entity.igniteForSeconds(this.duration.calculate(i));
|
||||
+ // CraftBukkit start - Call a combust event when somebody hits with a fire enchanted item
|
||||
+ EntityCombustByEntityEvent combustEvent = new EntityCombustByEntityEvent(enchantediteminuse.owner().getBukkitEntity(), entity.getBukkitEntity(), this.duration.calculate(i));
|
||||
+ org.bukkit.Bukkit.getPluginManager().callEvent(combustEvent);
|
||||
+
|
||||
+ if (combustEvent.isCancelled()) {
|
||||
+ return;
|
||||
+ }
|
||||
+ entity.igniteForSeconds(combustEvent.getDuration(), false);
|
||||
+ // CraftBukkit end
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -0,0 +1,11 @@
|
||||
--- a/net/minecraft/world/item/enchantment/effects/ReplaceBlock.java
|
||||
+++ b/net/minecraft/world/item/enchantment/effects/ReplaceBlock.java
|
||||
@@ -26,7 +26,7 @@
|
||||
|
||||
if ((Boolean) this.predicate.map((blockpredicate) -> {
|
||||
return blockpredicate.test(worldserver, blockposition);
|
||||
- }).orElse(true) && worldserver.setBlockAndUpdate(blockposition, this.blockState.getState(entity.getRandom(), blockposition))) {
|
||||
+ }).orElse(true) && org.bukkit.craftbukkit.event.CraftEventFactory.handleBlockFormEvent(worldserver, blockposition, this.blockState.getState(entity.getRandom(), blockposition), entity)) { // CraftBukkit - Call EntityBlockFormEvent
|
||||
this.triggerGameEvent.ifPresent((holder) -> {
|
||||
worldserver.gameEvent(entity, holder, blockposition);
|
||||
});
|
||||
@@ -0,0 +1,11 @@
|
||||
--- a/net/minecraft/world/item/enchantment/effects/ReplaceDisk.java
|
||||
+++ b/net/minecraft/world/item/enchantment/effects/ReplaceDisk.java
|
||||
@@ -37,7 +37,7 @@
|
||||
|
||||
if (blockposition1.distToCenterSqr(vec3d.x(), (double) blockposition1.getY() + 0.5D, vec3d.z()) < (double) MathHelper.square(j) && (Boolean) this.predicate.map((blockpredicate) -> {
|
||||
return blockpredicate.test(worldserver, blockposition1);
|
||||
- }).orElse(true) && worldserver.setBlockAndUpdate(blockposition1, this.blockState.getState(randomsource, blockposition1))) {
|
||||
+ }).orElse(true) && org.bukkit.craftbukkit.event.CraftEventFactory.handleBlockFormEvent(worldserver, blockposition1, this.blockState.getState(randomsource, blockposition1), entity)) { // CraftBukkit - Call EntityBlockFormEvent for Frost Walker
|
||||
this.triggerGameEvent.ifPresent((holder) -> {
|
||||
worldserver.gameEvent(entity, holder, blockposition1);
|
||||
});
|
||||
@@ -0,0 +1,36 @@
|
||||
--- a/net/minecraft/world/item/enchantment/effects/SummonEntityEffect.java
|
||||
+++ b/net/minecraft/world/item/enchantment/effects/SummonEntityEffect.java
|
||||
@@ -20,6 +20,12 @@
|
||||
import net.minecraft.world.level.World;
|
||||
import net.minecraft.world.phys.Vec3D;
|
||||
|
||||
+// CraftBukkit start
|
||||
+import net.minecraft.world.item.Items;
|
||||
+import org.bukkit.event.entity.CreatureSpawnEvent;
|
||||
+import org.bukkit.event.weather.LightningStrikeEvent;
|
||||
+// CraftBukkit end
|
||||
+
|
||||
public record SummonEntityEffect(HolderSet<EntityTypes<?>> entityTypes, boolean joinTeam) implements EnchantmentEntityEffect {
|
||||
|
||||
public static final MapCodec<SummonEntityEffect> CODEC = RecordCodecBuilder.mapCodec((instance) -> {
|
||||
@@ -34,7 +40,7 @@
|
||||
Optional<Holder<EntityTypes<?>>> optional = this.entityTypes().getRandomElement(worldserver.getRandom());
|
||||
|
||||
if (!optional.isEmpty()) {
|
||||
- Entity entity1 = ((EntityTypes) ((Holder) optional.get()).value()).spawn(worldserver, blockposition, EnumMobSpawn.TRIGGERED);
|
||||
+ Entity entity1 = ((EntityTypes) ((Holder) optional.get()).value()).create(worldserver, null, blockposition, EnumMobSpawn.TRIGGERED, false, false); // CraftBukkit
|
||||
|
||||
if (entity1 != null) {
|
||||
if (entity1 instanceof EntityLightning) {
|
||||
@@ -46,6 +52,11 @@
|
||||
|
||||
entitylightning.setCause(entityplayer);
|
||||
}
|
||||
+ // CraftBukkit start
|
||||
+ worldserver.strikeLightning(entity1, (enchantediteminuse.itemStack().getItem() == Items.TRIDENT) ? LightningStrikeEvent.Cause.TRIDENT : LightningStrikeEvent.Cause.ENCHANTMENT);
|
||||
+ } else {
|
||||
+ worldserver.addFreshEntityWithPassengers(entity, CreatureSpawnEvent.SpawnReason.ENCHANTMENT);
|
||||
+ // CraftBukkit end
|
||||
}
|
||||
|
||||
if (this.joinTeam && entity.getTeam() != null) {
|
||||
Reference in New Issue
Block a user