mirror of
https://github.com/PolyhedralDev/Terra.git
synced 2025-07-03 08:25:31 +00:00
fix loot NPE
This commit is contained in:
parent
3b9280b19c
commit
4cd4720101
@ -40,7 +40,7 @@ public class BufferedLootApplication implements BufferedItem {
|
|||||||
data.update(false);
|
data.update(false);
|
||||||
} catch(Exception e) {
|
} catch(Exception e) {
|
||||||
main.logger().warning("Could not apply loot at " + origin + ": " + e.getMessage());
|
main.logger().warning("Could not apply loot at " + origin + ": " + e.getMessage());
|
||||||
main.getDebugLogger().stack(e);
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -21,7 +21,7 @@ public class BufferedStateManipulator implements BufferedItem {
|
|||||||
state.update(false);
|
state.update(false);
|
||||||
} catch(Exception e) {
|
} catch(Exception e) {
|
||||||
main.logger().warning("Could not apply BlockState at " + origin + ": " + e.getMessage());
|
main.logger().warning("Could not apply BlockState at " + origin + ": " + e.getMessage());
|
||||||
main.getDebugLogger().stack(e);
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -26,6 +26,9 @@ public abstract class BlockEntityMixin {
|
|||||||
@Shadow
|
@Shadow
|
||||||
public abstract net.minecraft.block.BlockState getCachedState();
|
public abstract net.minecraft.block.BlockState getCachedState();
|
||||||
|
|
||||||
|
@Shadow
|
||||||
|
public abstract boolean hasWorld();
|
||||||
|
|
||||||
public Object terra$getHandle() {
|
public Object terra$getHandle() {
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
@ -51,7 +54,7 @@ public abstract class BlockEntityMixin {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public boolean terra$update(boolean applyPhysics) {
|
public boolean terra$update(boolean applyPhysics) {
|
||||||
world.getChunk(pos).setBlockEntity(pos, (BlockEntity) (Object) this);
|
if(hasWorld()) world.getChunk(pos).setBlockEntity(pos, (BlockEntity) (Object) this);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -4,11 +4,9 @@ import com.dfsek.terra.api.math.vector.Location;
|
|||||||
import com.dfsek.terra.api.platform.world.World;
|
import com.dfsek.terra.api.platform.world.World;
|
||||||
import com.dfsek.terra.fabric.world.FabricAdapter;
|
import com.dfsek.terra.fabric.world.FabricAdapter;
|
||||||
import net.minecraft.entity.Entity;
|
import net.minecraft.entity.Entity;
|
||||||
import net.minecraft.server.world.ServerWorld;
|
|
||||||
import net.minecraft.text.LiteralText;
|
import net.minecraft.text.LiteralText;
|
||||||
import net.minecraft.text.Text;
|
import net.minecraft.text.Text;
|
||||||
import net.minecraft.util.math.BlockPos;
|
import net.minecraft.util.math.BlockPos;
|
||||||
import org.jetbrains.annotations.Nullable;
|
|
||||||
import org.spongepowered.asm.mixin.Implements;
|
import org.spongepowered.asm.mixin.Implements;
|
||||||
import org.spongepowered.asm.mixin.Interface;
|
import org.spongepowered.asm.mixin.Interface;
|
||||||
import org.spongepowered.asm.mixin.Mixin;
|
import org.spongepowered.asm.mixin.Mixin;
|
||||||
@ -28,10 +26,6 @@ public abstract class EntityMixin {
|
|||||||
@Shadow
|
@Shadow
|
||||||
public abstract void teleport(double destX, double destY, double destZ);
|
public abstract void teleport(double destX, double destY, double destZ);
|
||||||
|
|
||||||
@Shadow
|
|
||||||
@Nullable
|
|
||||||
public abstract Entity moveToWorld(ServerWorld destination);
|
|
||||||
|
|
||||||
@Shadow
|
@Shadow
|
||||||
public abstract void sendSystemMessage(Text message, UUID senderUuid);
|
public abstract void sendSystemMessage(Text message, UUID senderUuid);
|
||||||
|
|
||||||
@ -45,7 +39,6 @@ public abstract class EntityMixin {
|
|||||||
|
|
||||||
public void terra$setLocation(Location location) {
|
public void terra$setLocation(Location location) {
|
||||||
teleport(location.getX(), location.getY(), location.getZ());
|
teleport(location.getX(), location.getY(), location.getZ());
|
||||||
moveToWorld((ServerWorld) location.getWorld());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public World getWorld() {
|
public World getWorld() {
|
||||||
|
@ -37,7 +37,10 @@ public abstract class ChunkRegionWorldMixin {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public Entity terra$spawnEntity(Location location, EntityType entityType) {
|
public Entity terra$spawnEntity(Location location, EntityType entityType) {
|
||||||
throw new UnsupportedOperationException();
|
net.minecraft.entity.Entity entity = ((net.minecraft.entity.EntityType<?>) entityType).create(((ChunkRegion) (Object) this).toServerWorld());
|
||||||
|
entity.setPos(location.getX(), location.getY(), location.getZ());
|
||||||
|
((ChunkRegion) (Object) this).spawnEntity(entity);
|
||||||
|
return (Entity) entity;
|
||||||
}
|
}
|
||||||
|
|
||||||
public int terra$getMinHeight() {
|
public int terra$getMinHeight() {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user