Fixed: BlockSource.spawnExpOrbs

This commit is contained in:
Reider745
2024-12-25 09:38:44 +03:00
parent 735b38abeb
commit 61236d2392
@@ -27,6 +27,7 @@ import com.zhekasmirnov.innercore.api.NativeItemInstanceExtra;
import java.util.Arrays; import java.util.Arrays;
import java.util.HashMap; import java.util.HashMap;
import java.util.Map; import java.util.Map;
import java.util.Random;
public class BlockSourceMethods { public class BlockSourceMethods {
@@ -285,13 +286,20 @@ public class BlockSourceMethods {
} }
public static long spawnExpOrbs(Level level, float x, float y, float z, int amount) { public static long spawnExpOrbs(Level level, float x, float y, float z, int amount) {
Vector3 source = new Vector3(x, y, z); if(amount > 0) {
CompoundTag nbt = Entity.getDefaultNBT(source, new Vector3(0, 0, 0)); final Position source = new Position(x, y, z, level);
Entity entity = Entity.createEntity("XpOrb", new Position(x, y, z, level), nbt); final CompoundTag nbt = Entity.getDefaultNBT(source, new Vector3(0, 0, 0));
if (entity != null) {
entity.spawnToAll(); nbt.putShort("Value", amount);
return EntityMethod.getIdForEntity(entity); nbt.putShort("PickupDelay", 10);
final Entity entity = Entity.createEntity("XpOrb", level.getChunk(source.getChunkX(), source.getChunkZ()), nbt);
if (entity != null) {
entity.spawnToAll();
return EntityMethod.getIdForEntity(entity);
}
} }
return -1; return -1;
} }