Fix mixin compatibility with TrickOrTreatMod (#1178)
This commit is contained in:
parent
0be5502f8e
commit
efc0d1c95d
|
@ -1,5 +1,6 @@
|
||||||
package io.izzel.arclight.common.mixin.core.world.entity.projectile;
|
package io.izzel.arclight.common.mixin.core.world.entity.projectile;
|
||||||
|
|
||||||
|
import io.izzel.arclight.common.bridge.bukkit.EntityTypeBridge;
|
||||||
import io.izzel.arclight.common.bridge.core.entity.EntityBridge;
|
import io.izzel.arclight.common.bridge.core.entity.EntityBridge;
|
||||||
import io.izzel.arclight.common.bridge.core.entity.player.ServerPlayerEntityBridge;
|
import io.izzel.arclight.common.bridge.core.entity.player.ServerPlayerEntityBridge;
|
||||||
import io.izzel.arclight.common.bridge.core.world.WorldBridge;
|
import io.izzel.arclight.common.bridge.core.world.WorldBridge;
|
||||||
|
@ -10,7 +11,6 @@ import net.minecraft.world.entity.animal.Chicken;
|
||||||
import net.minecraft.world.entity.projectile.ThrownEgg;
|
import net.minecraft.world.entity.projectile.ThrownEgg;
|
||||||
import net.minecraft.world.phys.HitResult;
|
import net.minecraft.world.phys.HitResult;
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.Location;
|
|
||||||
import org.bukkit.entity.Ageable;
|
import org.bukkit.entity.Ageable;
|
||||||
import org.bukkit.entity.Egg;
|
import org.bukkit.entity.Egg;
|
||||||
import org.bukkit.event.entity.CreatureSpawnEvent;
|
import org.bukkit.event.entity.CreatureSpawnEvent;
|
||||||
|
@ -48,7 +48,10 @@ public abstract class ThrownEggMixin extends ThrowableProjectileMixin {
|
||||||
}
|
}
|
||||||
if (hatching) {
|
if (hatching) {
|
||||||
for (int i = 0; i < b0; ++i) {
|
for (int i = 0; i < b0; ++i) {
|
||||||
Entity entity = ((WorldBridge) this.level()).bridge$getWorld().createEntity(new Location(((WorldBridge) this.level()).bridge$getWorld(), this.getX(), this.getY(), this.getZ(), this.getYRot(), 0.0f), hatchingType.getEntityClass());
|
// TrickOrTreatMod compat https://github.com/IzzelAliz/Arclight/issues/1178
|
||||||
|
// https://github.com/MehVahdJukaar/TrickOrTreatMod/blob/020bc478b8f8de6bfec2191a9e667f423f45d7db/common/src/main/java/net/mehvahdjukaar/hauntedharvest/mixins/ThrownEggEntityMixin.java
|
||||||
|
var entityType = ((EntityTypeBridge) (Object) hatchingType).bridge$getHandle();
|
||||||
|
var entity = entityType.create(this.level());
|
||||||
// Let's do: Meadow mixin compatibility https://github.com/IzzelAliz/Arclight/issues/1149
|
// Let's do: Meadow mixin compatibility https://github.com/IzzelAliz/Arclight/issues/1149
|
||||||
if (entity instanceof Chicken) {
|
if (entity instanceof Chicken) {
|
||||||
Chicken chicken = (Chicken) entity;
|
Chicken chicken = (Chicken) entity;
|
||||||
|
@ -58,6 +61,7 @@ public abstract class ThrownEggMixin extends ThrowableProjectileMixin {
|
||||||
if (((EntityBridge) entity).bridge$getBukkitEntity() instanceof Ageable) {
|
if (((EntityBridge) entity).bridge$getBukkitEntity() instanceof Ageable) {
|
||||||
((Ageable) ((EntityBridge) entity).bridge$getBukkitEntity()).setBaby();
|
((Ageable) ((EntityBridge) entity).bridge$getBukkitEntity()).setBaby();
|
||||||
}
|
}
|
||||||
|
entity.moveTo(this.getX(), this.getY(), this.getZ(), this.getYRot(), 0.0F);
|
||||||
((WorldBridge) this.level()).bridge$pushAddEntityReason(CreatureSpawnEvent.SpawnReason.EGG);
|
((WorldBridge) this.level()).bridge$pushAddEntityReason(CreatureSpawnEvent.SpawnReason.EGG);
|
||||||
this.level().addFreshEntity(entity);
|
this.level().addFreshEntity(entity);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user