mirror of
https://github.com/Creators-of-Create/Create.git
synced 2024-11-14 22:44:07 +01:00
Remove Entity#level AT
Use an invoker for Entity#setLevel() instead
This commit is contained in:
parent
78cf451f6d
commit
7021a17226
@ -0,0 +1,13 @@
|
|||||||
|
package com.simibubi.create.foundation.mixin.accessor;
|
||||||
|
|
||||||
|
import org.spongepowered.asm.mixin.Mixin;
|
||||||
|
import org.spongepowered.asm.mixin.gen.Invoker;
|
||||||
|
|
||||||
|
import net.minecraft.world.entity.Entity;
|
||||||
|
import net.minecraft.world.level.Level;
|
||||||
|
|
||||||
|
@Mixin(Entity.class)
|
||||||
|
public interface EntityAccessor {
|
||||||
|
@Invoker("setLevel")
|
||||||
|
void create$callSetLevel(Level level);
|
||||||
|
}
|
@ -5,6 +5,8 @@ import java.util.List;
|
|||||||
|
|
||||||
import javax.annotation.ParametersAreNonnullByDefault;
|
import javax.annotation.ParametersAreNonnullByDefault;
|
||||||
|
|
||||||
|
import com.simibubi.create.foundation.mixin.accessor.EntityAccessor;
|
||||||
|
|
||||||
import net.minecraft.MethodsReturnNonnullByDefault;
|
import net.minecraft.MethodsReturnNonnullByDefault;
|
||||||
import net.minecraft.Util;
|
import net.minecraft.Util;
|
||||||
import net.minecraft.core.BlockPos;
|
import net.minecraft.core.BlockPos;
|
||||||
@ -93,7 +95,7 @@ public class WrappedServerWorld extends ServerLevel {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean addFreshEntity(Entity entityIn) {
|
public boolean addFreshEntity(Entity entityIn) {
|
||||||
entityIn.level = world;
|
((EntityAccessor) entityIn).create$callSetLevel(world);
|
||||||
return world.addFreshEntity(entityIn);
|
return world.addFreshEntity(entityIn);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -6,6 +6,8 @@ import java.util.function.Predicate;
|
|||||||
|
|
||||||
import javax.annotation.Nullable;
|
import javax.annotation.Nullable;
|
||||||
|
|
||||||
|
import com.simibubi.create.foundation.mixin.accessor.EntityAccessor;
|
||||||
|
|
||||||
import net.minecraft.core.BlockPos;
|
import net.minecraft.core.BlockPos;
|
||||||
import net.minecraft.core.Direction;
|
import net.minecraft.core.Direction;
|
||||||
import net.minecraft.core.Holder;
|
import net.minecraft.core.Holder;
|
||||||
@ -146,7 +148,7 @@ public class WrappedWorld extends Level {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean addFreshEntity(Entity entityIn) {
|
public boolean addFreshEntity(Entity entityIn) {
|
||||||
entityIn.level = world;
|
((EntityAccessor) entityIn).create$callSetLevel(world);
|
||||||
return world.addFreshEntity(entityIn);
|
return world.addFreshEntity(entityIn);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -14,7 +14,6 @@ public net.minecraft.server.network.ServerGamePacketListenerImpl f_9737_ # above
|
|||||||
public net.minecraft.server.network.ServerGamePacketListenerImpl f_9739_ # aboveGroundVehicleTickCount
|
public net.minecraft.server.network.ServerGamePacketListenerImpl f_9739_ # aboveGroundVehicleTickCount
|
||||||
|
|
||||||
public net.minecraft.world.entity.Entity f_146795_ # removalReason
|
public net.minecraft.world.entity.Entity f_146795_ # removalReason
|
||||||
public net.minecraft.world.entity.Entity f_19853_ # level
|
|
||||||
protected net.minecraft.world.entity.Entity m_19956_(Lnet/minecraft/world/entity/Entity;Lnet/minecraft/world/entity/Entity$MoveFunction;)V # positionRider
|
protected net.minecraft.world.entity.Entity m_19956_(Lnet/minecraft/world/entity/Entity;Lnet/minecraft/world/entity/Entity$MoveFunction;)V # positionRider
|
||||||
public net.minecraft.world.entity.LivingEntity f_20899_ # jumping
|
public net.minecraft.world.entity.LivingEntity f_20899_ # jumping
|
||||||
|
|
||||||
|
@ -16,6 +16,7 @@
|
|||||||
"TestCommandMixin",
|
"TestCommandMixin",
|
||||||
"accessor.AbstractProjectileDispenseBehaviorAccessor",
|
"accessor.AbstractProjectileDispenseBehaviorAccessor",
|
||||||
"accessor.DispenserBlockAccessor",
|
"accessor.DispenserBlockAccessor",
|
||||||
|
"accessor.EntityAccessor",
|
||||||
"accessor.FallingBlockEntityAccessor",
|
"accessor.FallingBlockEntityAccessor",
|
||||||
"accessor.GameTestHelperAccessor",
|
"accessor.GameTestHelperAccessor",
|
||||||
"accessor.LivingEntityAccessor",
|
"accessor.LivingEntityAccessor",
|
||||||
|
Loading…
Reference in New Issue
Block a user