mirror of
https://github.com/GTNewHorizons/Botania.git
synced 2026-10-26 22:34:08 +00:00
Replace IInventory baubles with IItemHandler where appropriate
This commit is contained in:
22 files changed
+60
-51
No files matched your search
@@ -12,6 +12,7 @@ package vazkii.botania.client.core.handler;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
import net.minecraftforge.items.IItemHandler;
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import baubles.api.BaublesApi;
|
||||
@@ -24,7 +25,6 @@ import net.minecraft.client.renderer.texture.TextureMap;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.init.MobEffects;
|
||||
import net.minecraft.inventory.EntityEquipmentSlot;
|
||||
import net.minecraft.inventory.IInventory;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import vazkii.botania.api.item.IBaubleRender;
|
||||
@@ -43,7 +43,7 @@ public final class BaubleRenderHandler implements LayerRenderer<EntityPlayer> {
|
||||
if(!ConfigHandler.renderBaubles || player.getActivePotionEffect(MobEffects.INVISIBILITY) != null)
|
||||
return;
|
||||
|
||||
IInventory inv = BaublesApi.getBaubles(player);
|
||||
IItemHandler inv = BaublesApi.getBaublesHandler(player);
|
||||
|
||||
dispatchRenders(inv, player, RenderType.BODY, partialTicks);
|
||||
if(!inv.getStackInSlot(3).isEmpty())
|
||||
@@ -66,8 +66,8 @@ public final class BaubleRenderHandler implements LayerRenderer<EntityPlayer> {
|
||||
GlStateManager.popMatrix();
|
||||
}
|
||||
|
||||
private void dispatchRenders(IInventory inv, EntityPlayer player, RenderType type, float partialTicks) {
|
||||
for(int i = 0; i < inv.getSizeInventory(); i++) {
|
||||
private void dispatchRenders(IItemHandler inv, EntityPlayer player, RenderType type, float partialTicks) {
|
||||
for(int i = 0; i < inv.getSlots(); i++) {
|
||||
ItemStack stack = inv.getStackInSlot(i);
|
||||
if(!stack.isEmpty()) {
|
||||
Item item = stack.getItem();
|
||||
|
||||
@@ -15,6 +15,8 @@ import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Map.Entry;
|
||||
|
||||
import net.minecraftforge.items.CapabilityItemHandler;
|
||||
import net.minecraftforge.items.IItemHandler;
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import baubles.api.BaublesApi;
|
||||
@@ -30,7 +32,6 @@ import net.minecraft.client.gui.ScaledResolution;
|
||||
import net.minecraft.client.renderer.GlStateManager;
|
||||
import net.minecraft.client.resources.I18n;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.inventory.IInventory;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.profiler.Profiler;
|
||||
@@ -88,7 +89,7 @@ public final class HUDHandler {
|
||||
|
||||
if(event.getType() == ElementType.HEALTH) {
|
||||
profiler.startSection("botania-hud");
|
||||
IInventory baublesInv = BaublesApi.getBaubles(mc.player);
|
||||
IItemHandler baublesInv = BaublesApi.getBaublesHandler(mc.player);
|
||||
ItemStack headpiece = baublesInv.getStackInSlot(4);
|
||||
if(!headpiece.isEmpty() && headpiece.getItem() == ModItems.flightTiara) {
|
||||
profiler.startSection("flugelTiara");
|
||||
@@ -203,17 +204,17 @@ public final class HUDHandler {
|
||||
boolean anyRequest = false;
|
||||
boolean creative = false;
|
||||
|
||||
IInventory mainInv = player.inventory;
|
||||
IInventory baublesInv = BaublesApi.getBaubles(player);
|
||||
IItemHandler mainInv = player.getCapability(CapabilityItemHandler.ITEM_HANDLER_CAPABILITY, null);
|
||||
IItemHandler baublesInv = BaublesApi.getBaublesHandler(player);
|
||||
|
||||
int invSize = mainInv.getSizeInventory();
|
||||
int invSize = mainInv.getSlots();
|
||||
int size = invSize;
|
||||
if(baublesInv != null)
|
||||
size += baublesInv.getSizeInventory();
|
||||
size += baublesInv.getSlots();
|
||||
|
||||
for(int i = 0; i < size; i++) {
|
||||
boolean useBaubles = i >= invSize;
|
||||
IInventory inv = useBaubles ? baublesInv : mainInv;
|
||||
IItemHandler inv = useBaubles ? baublesInv : mainInv;
|
||||
ItemStack stack = inv.getStackInSlot(i - (useBaubles ? invSize : 0));
|
||||
|
||||
if(!stack.isEmpty()) {
|
||||
|
||||
@@ -188,8 +188,7 @@ public class InternalMethodHandler extends DummyMethodHandler {
|
||||
|
||||
@Override
|
||||
public IItemHandlerModifiable getBaublesInventoryWrapped(EntityPlayer player) {
|
||||
IInventory inv = getBaublesInventory(player);
|
||||
return inv == null ? null : new InvWrapper(inv);
|
||||
return BaublesApi.getBaublesHandler(player);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -4,12 +4,12 @@ import baubles.api.BaublesApi;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.init.MobEffects;
|
||||
import net.minecraft.inventory.IInventory;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.potion.Potion;
|
||||
import net.minecraft.potion.PotionEffect;
|
||||
import net.minecraftforge.event.entity.living.LivingHurtEvent;
|
||||
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
|
||||
import net.minecraftforge.items.IItemHandler;
|
||||
import vazkii.botania.api.item.IPixieSpawner;
|
||||
import vazkii.botania.common.core.helper.PlayerHelper;
|
||||
import vazkii.botania.common.entity.EntityPixie;
|
||||
@@ -37,8 +37,8 @@ public final class PixieHandler {
|
||||
for (ItemStack element : player.inventory.armorInventory)
|
||||
chance += getChance(element);
|
||||
|
||||
IInventory baubles = BaublesApi.getBaubles(player);
|
||||
for(int i = 0; i < baubles.getSizeInventory(); i++)
|
||||
IItemHandler baubles = BaublesApi.getBaublesHandler(player);
|
||||
for(int i = 0; i < baubles.getSlots(); i++)
|
||||
chance += getChance(baubles.getStackInSlot(i));
|
||||
|
||||
if(Math.random() < chance) {
|
||||
|
||||
@@ -40,6 +40,7 @@ import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.math.MathHelper;
|
||||
import net.minecraft.util.math.RayTraceResult;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.items.IItemHandler;
|
||||
import vazkii.botania.api.mana.IManaItem;
|
||||
import vazkii.botania.api.mana.IManaPool;
|
||||
import vazkii.botania.api.mana.spark.ISparkAttachable;
|
||||
@@ -112,11 +113,9 @@ public class EntitySpark extends Entity implements ISparkEntity {
|
||||
stacks.addAll(player.inventory.mainInventory);
|
||||
stacks.addAll(player.inventory.armorInventory);
|
||||
|
||||
IInventory baubles = BaublesApi.getBaubles(player);
|
||||
ItemStack[] baubleStacks = new ItemStack[baubles.getSizeInventory()];
|
||||
for(int i = 0; i < baubleStacks.length; i++)
|
||||
baubleStacks[i] = baubles.getStackInSlot(i);
|
||||
stacks.addAll(Arrays.asList(baubleStacks));
|
||||
IItemHandler baubles = BaublesApi.getBaublesHandler(player);
|
||||
for (int i = 0; i < baubles.getSlots(); i++)
|
||||
stacks.add(baubles.getStackInSlot(i));
|
||||
|
||||
for(ItemStack stack : stacks) {
|
||||
if(stack.isEmpty() || !(stack.getItem() instanceof IManaItem))
|
||||
|
||||
@@ -33,6 +33,8 @@ import net.minecraft.world.World;
|
||||
import net.minecraftforge.fml.common.Optional;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
import net.minecraftforge.items.IItemHandler;
|
||||
import net.minecraftforge.items.IItemHandlerModifiable;
|
||||
import thaumcraft.api.items.IRunicArmor;
|
||||
import vazkii.botania.api.item.ICosmeticAttachable;
|
||||
import vazkii.botania.api.item.IPhantomInkable;
|
||||
@@ -67,13 +69,14 @@ public abstract class ItemBauble extends ItemMod implements IBauble, ICosmeticAt
|
||||
toEquip.setCount(1);
|
||||
|
||||
if(canEquip(toEquip, player)) {
|
||||
IInventory baubles = BaublesApi.getBaubles(player);
|
||||
for(int i = 0; i < baubles.getSizeInventory(); i++) {
|
||||
if(baubles.isItemValidForSlot(i, toEquip)) {
|
||||
IItemHandlerModifiable baubles = BaublesApi.getBaublesHandler(player);
|
||||
for(int i = 0; i < baubles.getSlots(); i++) {
|
||||
ItemStack simulate = baubles.insertItem(i, toEquip, true);
|
||||
if(simulate.isEmpty()) {
|
||||
ItemStack stackInSlot = baubles.getStackInSlot(i);
|
||||
if(stackInSlot.isEmpty() || ((IBauble) stackInSlot.getItem()).canUnequip(stackInSlot, player)) {
|
||||
if(!world.isRemote) {
|
||||
baubles.setInventorySlotContents(i, toEquip);
|
||||
baubles.setStackInSlot(i, toEquip);
|
||||
stack.shrink(1);
|
||||
}
|
||||
|
||||
|
||||
@@ -54,7 +54,7 @@ public class ItemDivaCharm extends ItemBauble implements IManaUsingItem, IBauble
|
||||
public void onEntityDamaged(LivingHurtEvent event) {
|
||||
if(event.getSource().getEntity() instanceof EntityPlayer && event.getEntityLiving() instanceof EntityLiving && !event.getEntityLiving().world.isRemote && Math.random() < 0.6F) {
|
||||
EntityPlayer player = (EntityPlayer) event.getSource().getEntity();
|
||||
ItemStack amulet = BaublesApi.getBaubles(player).getStackInSlot(6);
|
||||
ItemStack amulet = BaublesApi.getBaublesHandler(player).getStackInSlot(6);
|
||||
if(!amulet.isEmpty() && amulet.getItem() == this) {
|
||||
final int cost = 250;
|
||||
if(ManaItemHandler.requestManaExact(amulet, player, cost, false)) {
|
||||
|
||||
@@ -27,6 +27,7 @@ import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
|
||||
import net.minecraftforge.fml.common.gameevent.InputEvent.KeyInputEvent;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
import net.minecraftforge.items.IItemHandler;
|
||||
import vazkii.botania.client.core.handler.ClientTickHandler;
|
||||
import vazkii.botania.common.core.helper.ItemNBTHelper;
|
||||
import vazkii.botania.common.core.helper.Vector3;
|
||||
@@ -53,7 +54,7 @@ public class ItemDodgeRing extends ItemBauble {
|
||||
public void onKeyDown(KeyInputEvent event) {
|
||||
Minecraft mc = Minecraft.getMinecraft();
|
||||
|
||||
IInventory baublesInv = BaublesApi.getBaubles(mc.player);
|
||||
IItemHandler baublesInv = BaublesApi.getBaublesHandler(mc.player);
|
||||
ItemStack ringStack = baublesInv.getStackInSlot(1);
|
||||
if(ringStack.isEmpty() || !(ringStack.getItem() instanceof ItemDodgeRing)) {
|
||||
ringStack = baublesInv.getStackInSlot(2);
|
||||
|
||||
@@ -183,7 +183,7 @@ public class ItemFlightTiara extends ItemBauble implements IManaUsingItem, IBaub
|
||||
public void updatePlayerFlyStatus(LivingUpdateEvent event) {
|
||||
if(event.getEntityLiving() instanceof EntityPlayer) {
|
||||
EntityPlayer player = (EntityPlayer) event.getEntityLiving();
|
||||
ItemStack tiara = BaublesApi.getBaubles(player).getStackInSlot(4);
|
||||
ItemStack tiara = BaublesApi.getBaublesHandler(player).getStackInSlot(4);
|
||||
int left = ItemNBTHelper.getInt(tiara, TAG_TIME_LEFT, MAX_FLY_TIME);
|
||||
|
||||
if(playersWithFlight.contains(playerStr(player))) {
|
||||
@@ -281,7 +281,7 @@ public class ItemFlightTiara extends ItemBauble implements IManaUsingItem, IBaub
|
||||
}
|
||||
|
||||
private boolean shouldPlayerHaveFlight(EntityPlayer player) {
|
||||
ItemStack armor = BaublesApi.getBaubles(player).getStackInSlot(4);
|
||||
ItemStack armor = BaublesApi.getBaublesHandler(player).getStackInSlot(4);
|
||||
if(!armor.isEmpty() && armor.getItem() == this) {
|
||||
int left = ItemNBTHelper.getInt(armor, TAG_TIME_LEFT, MAX_FLY_TIME);
|
||||
boolean flying = ItemNBTHelper.getBoolean(armor, TAG_FLYING, false);
|
||||
|
||||
@@ -28,6 +28,7 @@ import net.minecraftforge.event.world.ExplosionEvent;
|
||||
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
import net.minecraftforge.items.IItemHandler;
|
||||
import vazkii.botania.api.item.IBaubleRender;
|
||||
import vazkii.botania.api.mana.IManaUsingItem;
|
||||
import vazkii.botania.api.mana.ManaItemHandler;
|
||||
@@ -49,8 +50,7 @@ public class ItemGoddessCharm extends ItemBauble implements IManaUsingItem, IBau
|
||||
List<EntityPlayer> players = event.getWorld().getEntitiesWithinAABB(EntityPlayer.class, new AxisAlignedBB(vec.xCoord, vec.yCoord, vec.zCoord, vec.xCoord, vec.yCoord, vec.zCoord).expand(8, 8, 8));
|
||||
|
||||
for(EntityPlayer player : players) {
|
||||
IInventory inv = BaublesApi.getBaubles(player);
|
||||
ItemStack charm = inv.getStackInSlot(6);
|
||||
ItemStack charm = BaublesApi.getBaublesHandler(player).getStackInSlot(6);
|
||||
if(!charm.isEmpty() && charm.getItem() instanceof ItemGoddessCharm && ManaItemHandler.requestManaExact(charm, player, COST, true)) {
|
||||
event.getAffectedBlocks().clear();
|
||||
return;
|
||||
|
||||
@@ -44,7 +44,7 @@ public class ItemGoldenLaurel extends ItemBauble implements IBaubleRender {
|
||||
public void onPlayerDeath(LivingDeathEvent event) {
|
||||
if(event.getEntityLiving() instanceof EntityPlayer) {
|
||||
EntityPlayer player = (EntityPlayer) event.getEntityLiving();
|
||||
ItemStack headgear = BaublesApi.getBaubles(player).getStackInSlot(4);
|
||||
ItemStack headgear = BaublesApi.getBaublesHandler(player).getStackInSlot(4);
|
||||
|
||||
if(!headgear.isEmpty() && headgear.getItem() == this) {
|
||||
event.setCanceled(true);
|
||||
@@ -52,7 +52,7 @@ public class ItemGoldenLaurel extends ItemBauble implements IBaubleRender {
|
||||
player.addPotionEffect(new PotionEffect(MobEffects.RESISTANCE, 300, 6));
|
||||
player.sendMessage(new TextComponentTranslation("botaniamisc.savedByLaurel"));
|
||||
player.world.playSound(null, player.posX, player.posY, player.posZ, BotaniaSoundEvents.goldenLaurel, SoundCategory.PLAYERS, 1F, 0.3F);
|
||||
BaublesApi.getBaubles(player).setInventorySlotContents(4, ItemStack.EMPTY);
|
||||
BaublesApi.getBaublesHandler(player).setStackInSlot(4, ItemStack.EMPTY);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -27,6 +27,7 @@ import net.minecraftforge.event.entity.living.LivingHurtEvent;
|
||||
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
import net.minecraftforge.items.IItemHandler;
|
||||
import vazkii.botania.api.item.IBaubleRender;
|
||||
import vazkii.botania.api.sound.BotaniaSoundEvents;
|
||||
import vazkii.botania.client.lib.LibResources;
|
||||
@@ -59,8 +60,7 @@ public class ItemHolyCloak extends ItemBauble implements IBaubleRender {
|
||||
public void onPlayerDamage(LivingHurtEvent event) {
|
||||
if(event.getEntityLiving() instanceof EntityPlayer) {
|
||||
EntityPlayer player = (EntityPlayer) event.getEntityLiving();
|
||||
IInventory baubles = BaublesApi.getBaubles(player);
|
||||
ItemStack belt = baubles.getStackInSlot(5);
|
||||
ItemStack belt = BaublesApi.getBaublesHandler(player).getStackInSlot(5);
|
||||
if(!belt.isEmpty() && belt.getItem() instanceof ItemHolyCloak && !isInEffect(belt)) {
|
||||
ItemHolyCloak cloak = (ItemHolyCloak) belt.getItem();
|
||||
int cooldown = getCooldown(belt);
|
||||
|
||||
@@ -145,7 +145,7 @@ public class ItemItemFinder extends ItemBauble implements IBaubleRender {
|
||||
} else if(e instanceof EntityPlayer) {
|
||||
EntityPlayer player_ = (EntityPlayer) e;
|
||||
IItemHandler playerInv = player.getCapability(CapabilityItemHandler.ITEM_HANDLER_CAPABILITY, null);
|
||||
IItemHandler binv = new InvWrapper(BaublesApi.getBaubles(player_));
|
||||
IItemHandler binv = BaublesApi.getBaublesHandler(player);
|
||||
if(scanInventory(binv, pstack) || scanInventory(playerInv, pstack))
|
||||
entIdBuilder.add(player_.getEntityId());
|
||||
|
||||
|
||||
@@ -27,6 +27,7 @@ import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraftforge.common.MinecraftForge;
|
||||
import net.minecraftforge.event.entity.item.ItemTossEvent;
|
||||
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
|
||||
import net.minecraftforge.items.IItemHandler;
|
||||
import vazkii.botania.api.BotaniaAPI;
|
||||
import vazkii.botania.api.item.IRelic;
|
||||
import vazkii.botania.api.mana.IManaItem;
|
||||
@@ -59,8 +60,8 @@ public class ItemMagnetRing extends ItemBauble {
|
||||
|
||||
@SubscribeEvent
|
||||
public void onTossItem(ItemTossEvent event) {
|
||||
IInventory inv = BaublesApi.getBaubles(event.getPlayer());
|
||||
for(int i = 0; i < inv.getSizeInventory(); i++) {
|
||||
IItemHandler inv = BaublesApi.getBaublesHandler(event.getPlayer());
|
||||
for(int i = 0; i < inv.getSlots(); i++) {
|
||||
ItemStack stack = inv.getStackInSlot(i);
|
||||
if(!stack.isEmpty() && stack.getItem() instanceof ItemMagnetRing) {
|
||||
setCooldown(stack, 100);
|
||||
|
||||
@@ -104,7 +104,7 @@ public class ItemMonocle extends ItemBauble implements IBurstViewerBauble, ICosm
|
||||
|
||||
public static boolean hasMonocle(EntityPlayer player) {
|
||||
for(int i = 0; i < 7; i++) {
|
||||
ItemStack stack = BaublesApi.getBaubles(player).getStackInSlot(i);
|
||||
ItemStack stack = BaublesApi.getBaublesHandler(player).getStackInSlot(i);
|
||||
if(!stack.isEmpty()) {
|
||||
Item item = stack.getItem();
|
||||
if(item instanceof IBurstViewerBauble)
|
||||
|
||||
@@ -73,7 +73,7 @@ public class ItemTravelBelt extends ItemBauble implements IBaubleRender, IManaUs
|
||||
EntityPlayer player = (EntityPlayer) event.getEntityLiving();
|
||||
String s = playerStr(player);
|
||||
|
||||
ItemStack belt = BaublesApi.getBaubles(player).getStackInSlot(3);
|
||||
ItemStack belt = BaublesApi.getBaublesHandler(player).getStackInSlot(3);
|
||||
if(playersWithStepup.contains(s)) {
|
||||
if(shouldPlayerHaveStepup(player)) {
|
||||
ItemTravelBelt beltItem = (ItemTravelBelt) belt.getItem();
|
||||
@@ -116,7 +116,7 @@ public class ItemTravelBelt extends ItemBauble implements IBaubleRender, IManaUs
|
||||
public void onPlayerJump(LivingJumpEvent event) {
|
||||
if(event.getEntityLiving() instanceof EntityPlayer) {
|
||||
EntityPlayer player = (EntityPlayer) event.getEntityLiving();
|
||||
ItemStack belt = BaublesApi.getBaubles(player).getStackInSlot(3);
|
||||
ItemStack belt = BaublesApi.getBaublesHandler(player).getStackInSlot(3);
|
||||
|
||||
if(!belt.isEmpty() && belt.getItem() instanceof ItemTravelBelt && ManaItemHandler.requestManaExact(belt, player, COST, false)) {
|
||||
player.motionY += ((ItemTravelBelt) belt.getItem()).jump;
|
||||
@@ -126,7 +126,7 @@ public class ItemTravelBelt extends ItemBauble implements IBaubleRender, IManaUs
|
||||
}
|
||||
|
||||
private boolean shouldPlayerHaveStepup(EntityPlayer player) {
|
||||
ItemStack armor = BaublesApi.getBaubles(player).getStackInSlot(3);
|
||||
ItemStack armor = BaublesApi.getBaublesHandler(player).getStackInSlot(3);
|
||||
return !armor.isEmpty() && armor.getItem() instanceof ItemTravelBelt && ManaItemHandler.requestManaExact(armor, player, COST, false);
|
||||
}
|
||||
|
||||
|
||||
@@ -37,7 +37,7 @@ public class ItemWaterRing extends ItemBauble implements IManaUsingItem {
|
||||
|
||||
if(player.isInsideOfMaterial(Material.WATER)) {
|
||||
if(player instanceof EntityPlayer) {
|
||||
ItemStack firstRing = BaublesApi.getBaubles((EntityPlayer) player).getStackInSlot(1);
|
||||
ItemStack firstRing = BaublesApi.getBaublesHandler((EntityPlayer) player).getStackInSlot(1);
|
||||
if(!firstRing.isEmpty() && firstRing.getItem() instanceof ItemWaterRing && firstRing != stack) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -37,6 +37,7 @@ import net.minecraftforge.event.entity.player.PlayerInteractEvent;
|
||||
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
import net.minecraftforge.items.IItemHandler;
|
||||
import vazkii.botania.api.BotaniaAPI;
|
||||
import vazkii.botania.api.item.ISequentialBreaker;
|
||||
import vazkii.botania.api.item.IWireframeCoordinateListProvider;
|
||||
@@ -72,8 +73,8 @@ public class ItemLokiRing extends ItemRelicBauble implements IWireframeCoordinat
|
||||
return;
|
||||
|
||||
int slot = -1;
|
||||
IInventory inv = BaublesApi.getBaubles(player);
|
||||
for(int i = 0; i < inv.getSizeInventory(); i++) {
|
||||
IItemHandler inv = BaublesApi.getBaublesHandler(player);
|
||||
for(int i = 0; i < inv.getSlots(); i++) {
|
||||
ItemStack stack = inv.getStackInSlot(i);
|
||||
if(stack == lokiRing) {
|
||||
slot = i;
|
||||
@@ -194,7 +195,7 @@ public class ItemLokiRing extends ItemRelicBauble implements IWireframeCoordinat
|
||||
}
|
||||
|
||||
private static ItemStack getLokiRing(EntityPlayer player) {
|
||||
IInventory baubles = BaublesApi.getBaubles(player);
|
||||
IItemHandler baubles = BaublesApi.getBaublesHandler(player);
|
||||
ItemStack stack1 = baubles.getStackInSlot(1);
|
||||
ItemStack stack2 = baubles.getStackInSlot(2);
|
||||
return isLokiRing(stack1) ? stack1 : isLokiRing(stack2) ? stack2 : null;
|
||||
|
||||
@@ -28,6 +28,7 @@ import net.minecraft.util.DamageSource;
|
||||
import net.minecraftforge.common.MinecraftForge;
|
||||
import net.minecraftforge.event.entity.living.LivingAttackEvent;
|
||||
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
|
||||
import net.minecraftforge.items.IItemHandler;
|
||||
import vazkii.botania.common.core.handler.ConfigHandler;
|
||||
import vazkii.botania.common.item.ModItems;
|
||||
import vazkii.botania.common.lib.LibItemNames;
|
||||
@@ -75,7 +76,7 @@ public class ItemOdinRing extends ItemRelicBauble {
|
||||
}
|
||||
|
||||
public static ItemStack getOdinRing(EntityPlayer player) {
|
||||
IInventory baubles = BaublesApi.getBaubles(player);
|
||||
IItemHandler baubles = BaublesApi.getBaublesHandler(player);
|
||||
ItemStack stack1 = baubles.getStackInSlot(1);
|
||||
ItemStack stack2 = baubles.getStackInSlot(2);
|
||||
return isOdinRing(stack1) ? stack1 : isOdinRing(stack2) ? stack2 : null;
|
||||
|
||||
@@ -15,6 +15,7 @@ import baubles.api.BaublesApi;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.inventory.IInventory;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraftforge.items.IItemHandler;
|
||||
import vazkii.botania.common.item.ModItems;
|
||||
import vazkii.botania.common.lib.LibItemNames;
|
||||
|
||||
@@ -30,7 +31,7 @@ public class ItemThorRing extends ItemRelicBauble {
|
||||
}
|
||||
|
||||
public static ItemStack getThorRing(EntityPlayer player) {
|
||||
IInventory baubles = BaublesApi.getBaubles(player);
|
||||
IItemHandler baubles = BaublesApi.getBaublesHandler(player);
|
||||
ItemStack stack1 = baubles.getStackInSlot(1);
|
||||
ItemStack stack2 = baubles.getStackInSlot(2);
|
||||
return isThorRing(stack1) ? stack1 : isThorRing(stack2) ? stack2 : null;
|
||||
|
||||
@@ -19,6 +19,7 @@ import net.minecraft.util.SoundCategory;
|
||||
import net.minecraftforge.fml.common.network.simpleimpl.IMessage;
|
||||
import net.minecraftforge.fml.common.network.simpleimpl.IMessageHandler;
|
||||
import net.minecraftforge.fml.common.network.simpleimpl.MessageContext;
|
||||
import net.minecraftforge.items.IItemHandler;
|
||||
import vazkii.botania.api.sound.BotaniaSoundEvents;
|
||||
import vazkii.botania.common.core.helper.ItemNBTHelper;
|
||||
import vazkii.botania.common.item.equipment.bauble.ItemDodgeRing;
|
||||
@@ -39,7 +40,7 @@ public class PacketDodge implements IMessage {
|
||||
player.mcServer.addScheduledTask(() -> {
|
||||
player.world.playSound(null, player.posX, player.posY, player.posZ, BotaniaSoundEvents.dash, SoundCategory.PLAYERS, 1F, 1F);
|
||||
|
||||
IInventory baublesInv = BaublesApi.getBaubles(player);
|
||||
IItemHandler baublesInv = BaublesApi.getBaublesHandler(player);
|
||||
ItemStack ringStack = baublesInv.getStackInSlot(1);
|
||||
if(ringStack.isEmpty() || !(ringStack.getItem() instanceof ItemDodgeRing)) {
|
||||
ringStack = baublesInv.getStackInSlot(2);
|
||||
|
||||
@@ -19,6 +19,7 @@ import net.minecraft.util.SoundCategory;
|
||||
import net.minecraftforge.fml.common.network.simpleimpl.IMessage;
|
||||
import net.minecraftforge.fml.common.network.simpleimpl.IMessageHandler;
|
||||
import net.minecraftforge.fml.common.network.simpleimpl.MessageContext;
|
||||
import net.minecraftforge.items.IItemHandler;
|
||||
import vazkii.botania.api.mana.ManaItemHandler;
|
||||
import vazkii.botania.api.sound.BotaniaSoundEvents;
|
||||
import vazkii.botania.common.core.helper.ItemNBTHelper;
|
||||
@@ -40,14 +41,14 @@ public class PacketJump implements IMessage {
|
||||
public IMessage onMessage(PacketJump message, MessageContext ctx) {
|
||||
EntityPlayerMP player = ctx.getServerHandler().playerEntity;
|
||||
player.mcServer.addScheduledTask(() -> {
|
||||
IInventory baublesInv = BaublesApi.getBaubles(player);
|
||||
IItemHandler baublesInv = BaublesApi.getBaublesHandler(player);
|
||||
ItemStack amuletStack = baublesInv.getStackInSlot(0);
|
||||
|
||||
if(!amuletStack.isEmpty() && amuletStack.getItem() instanceof CloudPendantShim) {
|
||||
player.addExhaustion(0.3F);
|
||||
player.fallDistance = 0;
|
||||
|
||||
ItemStack belt = BaublesApi.getBaubles(player).getStackInSlot(3);
|
||||
ItemStack belt = BaublesApi.getBaublesHandler(player).getStackInSlot(3);
|
||||
|
||||
if(!belt.isEmpty() && belt.getItem() instanceof ItemTravelBelt)
|
||||
player.fallDistance = -((ItemTravelBelt) belt.getItem()).fallBuffer * ((CloudPendantShim) amuletStack.getItem()).getMaxAllowedJumps();
|
||||
|
||||
Reference in new issue
Block a user