mirror of
https://github.com/GTNewHorizons/Draconic-Evolution.git
synced 2026-10-26 22:33:58 +00:00
Compare commits
3
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
b2734fdafa | ||
|
|
33e048a295 | ||
|
|
358c55b82d |
@@ -112,6 +112,8 @@ public class Magnet extends ItemDE implements IBauble, IConfigurableItem {
|
||||
entity.posZ).expand(range, range, range));
|
||||
|
||||
boolean playSound = false;
|
||||
boolean didPlayerDrop;
|
||||
NBTTagCompound itemNBT = new NBTTagCompound();
|
||||
|
||||
for (EntityItem item : items) {
|
||||
if (item.getEntityItem() == null || ModHelper.isAE2EntityFloatingItem(item)
|
||||
@@ -126,19 +128,36 @@ public class Magnet extends ItemDE implements IBauble, IConfigurableItem {
|
||||
== item.getEntityItem().getItemDamage())) {
|
||||
continue;
|
||||
}
|
||||
playSound = true;
|
||||
|
||||
if (item.delayBeforeCanPickup > 0) {
|
||||
item.delayBeforeCanPickup = 0;
|
||||
EntityPlayer closestPlayer = world.getClosestPlayerToEntity(item, range);
|
||||
if (closestPlayer != null && closestPlayer != player) {
|
||||
continue;
|
||||
}
|
||||
|
||||
item.writeEntityToNBT(itemNBT);
|
||||
|
||||
if (!world.isRemote) {
|
||||
didPlayerDrop = item.func_145800_j() != null
|
||||
&& item.func_145800_j().equals(player.getCommandSenderName());
|
||||
if (!didPlayerDrop) item.delayBeforeCanPickup = 0;
|
||||
if (item.delayBeforeCanPickup <= 0) {
|
||||
itemNBT.setBoolean("attractable", true);
|
||||
item.readEntityFromNBT(itemNBT);
|
||||
}
|
||||
}
|
||||
|
||||
if (itemNBT.getBoolean("attractable")) {
|
||||
playSound = true;
|
||||
item.motionX = 0;
|
||||
item.motionY = 0;
|
||||
item.motionZ = 0;
|
||||
item.setPosition(
|
||||
entity.posX - 0.2 + (world.rand.nextDouble() * 0.4),
|
||||
entity.posY - 0.6,
|
||||
entity.posZ - 0.2 + (world.rand.nextDouble() * 0.4));
|
||||
}
|
||||
item.motionX = 0;
|
||||
item.motionY = 0;
|
||||
item.motionZ = 0;
|
||||
item.setPosition(
|
||||
entity.posX - 0.2 + (world.rand.nextDouble() * 0.4),
|
||||
entity.posY - 0.6,
|
||||
entity.posZ - 0.2 + (world.rand.nextDouble() * 0.4));
|
||||
}
|
||||
|
||||
if (playSound && !ConfigHandler.itemDislocatorDisableSound) {
|
||||
world.playSoundAtEntity(
|
||||
entity,
|
||||
|
||||
Reference in new issue
Block a user