2015-12-27 19:38:12 -05:00
|
|
|
package WayofTime.bloodmagic.item.sigil;
|
|
|
|
|
2018-02-05 17:04:38 -08:00
|
|
|
import WayofTime.bloodmagic.apibutnotreally.compress.CompressionRegistry;
|
|
|
|
import WayofTime.bloodmagic.apibutnotreally.util.helper.PlayerHelper;
|
2015-12-28 19:09:51 -05:00
|
|
|
import net.minecraft.entity.item.EntityItem;
|
|
|
|
import net.minecraft.entity.player.EntityPlayer;
|
|
|
|
import net.minecraft.item.ItemStack;
|
|
|
|
import net.minecraft.world.World;
|
|
|
|
|
2017-08-15 21:30:48 -07:00
|
|
|
public class ItemSigilCompression extends ItemSigilToggleableBase {
|
|
|
|
public ItemSigilCompression() {
|
2015-12-28 19:09:51 -05:00
|
|
|
super("compression", 200);
|
|
|
|
}
|
|
|
|
|
2015-12-30 15:34:40 -05:00
|
|
|
// TODO REWRITE all compression stuff if someone has time
|
|
|
|
// TODO for now, there is a semi-working system in place
|
2015-12-28 19:09:51 -05:00
|
|
|
|
|
|
|
@Override
|
2017-08-15 21:30:48 -07:00
|
|
|
public void onSigilUpdate(ItemStack stack, World world, EntityPlayer player, int itemSlot, boolean isSelected) {
|
2017-08-15 20:21:54 -07:00
|
|
|
if (true)
|
|
|
|
return; // TODO - Rewrite compression system
|
|
|
|
|
2016-11-11 16:57:50 -08:00
|
|
|
if (PlayerHelper.isFakePlayer(player))
|
|
|
|
return;
|
|
|
|
|
2017-01-02 00:10:28 -08:00
|
|
|
ItemStack compressedStack = CompressionRegistry.compressInventory(player.inventory.mainInventory.toArray(new ItemStack[player.inventory.mainInventory.size()]), world);
|
2015-12-28 19:09:51 -05:00
|
|
|
|
2017-08-15 21:30:48 -07:00
|
|
|
if (compressedStack != null) {
|
2015-12-28 19:09:51 -05:00
|
|
|
EntityItem entityItem = new EntityItem(world, player.posX, player.posY, player.posZ, compressedStack);
|
2017-01-02 00:10:28 -08:00
|
|
|
world.spawnEntity(entityItem);
|
2015-12-28 19:09:51 -05:00
|
|
|
}
|
|
|
|
}
|
2015-12-27 19:38:12 -05:00
|
|
|
}
|