Fix thrown egg NPE (#1202)
This commit is contained in:
parent
132b181f1d
commit
600f108d17
|
@ -1,12 +1,12 @@
|
|||
package io.izzel.arclight.common.bridge.bukkit;
|
||||
|
||||
import io.izzel.arclight.i18n.conf.EntityPropertySpec;
|
||||
import org.bukkit.Location;
|
||||
|
||||
import java.util.function.Function;
|
||||
import net.minecraft.resources.ResourceLocation;
|
||||
import net.minecraft.world.entity.Entity;
|
||||
import net.minecraft.world.entity.EntityType;
|
||||
import org.bukkit.Location;
|
||||
|
||||
import java.util.function.Function;
|
||||
|
||||
public interface EntityTypeBridge {
|
||||
|
||||
|
@ -14,6 +14,8 @@ public interface EntityTypeBridge {
|
|||
|
||||
EntityType<?> bridge$getHandle();
|
||||
|
||||
void bridge$setHandle(EntityType<?> entityType);
|
||||
|
||||
EntityPropertySpec bridge$getSpec();
|
||||
|
||||
Function<Location, ? extends Entity> bridge$entityFactory();
|
||||
|
|
|
@ -4,6 +4,8 @@ import io.izzel.arclight.common.bridge.bukkit.EntityTypeBridge;
|
|||
import io.izzel.arclight.common.mod.ArclightMod;
|
||||
import io.izzel.arclight.i18n.LocalizedException;
|
||||
import io.izzel.arclight.i18n.conf.EntityPropertySpec;
|
||||
import net.minecraft.resources.ResourceLocation;
|
||||
import net.minecraft.server.level.ServerLevel;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.NamespacedKey;
|
||||
import org.bukkit.craftbukkit.v.CraftWorld;
|
||||
|
@ -16,8 +18,6 @@ import org.spongepowered.asm.mixin.Mutable;
|
|||
import org.spongepowered.asm.mixin.Shadow;
|
||||
|
||||
import java.util.function.Function;
|
||||
import net.minecraft.resources.ResourceLocation;
|
||||
import net.minecraft.server.level.ServerLevel;
|
||||
|
||||
@Mixin(value = EntityType.class, remap = false)
|
||||
public class EntityTypeMixin implements EntityTypeBridge {
|
||||
|
@ -75,6 +75,11 @@ public class EntityTypeMixin implements EntityTypeBridge {
|
|||
return this.handleType;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void bridge$setHandle(net.minecraft.world.entity.EntityType<?> entityType) {
|
||||
this.handleType = entityType;
|
||||
}
|
||||
|
||||
@Override
|
||||
public EntityPropertySpec bridge$getSpec() {
|
||||
return spec;
|
||||
|
|
|
@ -338,7 +338,10 @@ public class BukkitRegistry {
|
|||
boolean found = false;
|
||||
if (location.getNamespace().equals(NamespacedKey.MINECRAFT)) {
|
||||
entityType = EntityType.fromName(location.getPath());
|
||||
if (entityType != null) found = true;
|
||||
if (entityType != null) {
|
||||
found = true;
|
||||
((EntityTypeBridge) (Object) entityType).bridge$setHandle(type);
|
||||
}
|
||||
else ArclightMod.LOGGER.warn("Not found {} in {}", location, EntityType.class);
|
||||
}
|
||||
if (!found) {
|
||||
|
|
Loading…
Reference in New Issue
Block a user