Updated for the new version of baubles. Runs, not done yet.

This commit is contained in:
Vasco Lavos committed 2016-10-11 16:28:05 +01:00
1 parent 589b3320f9
commit 4d9f300087
22 files changed
+93 -90

No files matched your search

+1 -1
View File
@@ -66,7 +66,7 @@ configurations {
dependencies {
compile files(
'Baubles-deobf.jar'
'Baubles-1.10.2-1.3.BETA8-deobf.jar'
)
deobfCompile "mezz.jei:jei_1.10.2:3.7.8.234"
@@ -14,8 +14,7 @@ import javax.annotation.Nonnull;
import org.lwjgl.opengl.GL11;
import baubles.common.container.InventoryBaubles;
import baubles.common.lib.PlayerHandler;
import baubles.api.BaublesApi;
import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.GlStateManager;
import net.minecraft.client.renderer.OpenGlHelper;
@@ -25,6 +24,7 @@ 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;
InventoryBaubles inv = PlayerHandler.getPlayerBaubles(player);
IInventory inv = BaublesApi.getBaubles(player);
dispatchRenders(inv, player, RenderType.BODY, partialTicks);
if(inv.getStackInSlot(3) != null)
@@ -66,7 +66,7 @@ public final class BaubleRenderHandler implements LayerRenderer<EntityPlayer> {
GlStateManager.popMatrix();
}
private void dispatchRenders(InventoryBaubles inv, EntityPlayer player, RenderType type, float partialTicks) {
private void dispatchRenders(IInventory inv, EntityPlayer player, RenderType type, float partialTicks) {
for(int i = 0; i < inv.getSizeInventory(); i++) {
ItemStack stack = inv.getStackInSlot(i);
if(stack != null) {
@@ -17,7 +17,7 @@ import java.util.Map.Entry;
import org.lwjgl.opengl.GL11;
import baubles.common.lib.PlayerHandler;
import baubles.api.BaublesApi;
import net.minecraft.block.Block;
import net.minecraft.block.BlockLiquid;
import net.minecraft.block.state.IBlockState;
@@ -88,7 +88,7 @@ public final class HUDHandler {
if(event.getType() == ElementType.HEALTH) {
profiler.startSection("botania-hud");
IInventory baublesInv = PlayerHandler.getPlayerBaubles(mc.thePlayer);
IInventory baublesInv = BaublesApi.getBaubles(mc.thePlayer);
ItemStack amulet = baublesInv.getStackInSlot(0);
if(amulet != null && amulet.getItem() == ModItems.flightTiara) {
profiler.startSection("flugelTiara");
@@ -204,7 +204,7 @@ public final class HUDHandler {
boolean creative = false;
IInventory mainInv = player.inventory;
IInventory baublesInv = PlayerHandler.getPlayerBaubles(player);
IInventory baublesInv = BaublesApi.getBaubles(player);
int invSize = mainInv.getSizeInventory();
int size = invSize;
@@ -13,10 +13,11 @@ package vazkii.botania.client.gui.box;
import javax.annotation.Nonnull;
import baubles.api.BaubleType;
import baubles.api.BaublesApi;
import baubles.api.IBauble;
import baubles.common.container.InventoryBaubles;
import baubles.api.cap.BaublesCapabilities;
import baubles.api.cap.IBaublesItemHandler;
import baubles.common.container.SlotBauble;
import baubles.common.lib.PlayerHandler;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.inventory.Container;
import net.minecraft.inventory.IInventory;
@@ -29,7 +30,7 @@ import vazkii.botania.client.gui.SlotLocked;
public class ContainerBaubleBox extends Container {
private final InventoryBaubleBox baubleBoxInv;
private final InventoryBaubles baubles;
public IBaublesItemHandler baubles;
public ContainerBaubleBox(EntityPlayer player, InventoryBaubleBox boxInv) {
int i;
@@ -38,15 +39,16 @@ public class ContainerBaubleBox extends Container {
IInventory playerInv = player.inventory;
baubleBoxInv = boxInv;
baubles = new InventoryBaubles(player);
baubles.setEventHandler(this);
if(!player.worldObj.isRemote)
baubles.stackList = PlayerHandler.getPlayerBaubles(player).stackList;
baubles = player.getCapability(BaublesCapabilities.CAPABILITY_BAUBLES, null);
addSlotToContainer(new SlotBauble(baubles, BaubleType.AMULET, 0, 8, 8 + 0 * 18));
addSlotToContainer(new SlotBauble(baubles, BaubleType.RING, 1, 8, 8 + 1 * 18));
addSlotToContainer(new SlotBauble(baubles, BaubleType.RING, 2, 8, 8 + 2 * 18));
addSlotToContainer(new SlotBauble(baubles, BaubleType.BELT, 3, 8, 8 + 3 * 18));
addSlotToContainer(new SlotBauble(player, baubles, 0, 8, 8 + 0 * 18));
addSlotToContainer(new SlotBauble(player, baubles, 1, 8, 8 + 1 * 18));
addSlotToContainer(new SlotBauble(player, baubles, 2, 8, 8 + 2 * 18));
addSlotToContainer(new SlotBauble(player, baubles, 3, 8, 8 + 3 * 18));
addSlotToContainer(new SlotBauble(player, baubles, 4, 27, 8 + 0 * 18));
addSlotToContainer(new SlotBauble(player, baubles, 5, 27, 8 + 1 * 18));
addSlotToContainer(new SlotBauble(player, baubles, 6, 27, 8 + 2 * 18));
for(i = 0; i < 4; ++i)
for(j = 0; j < 6; ++j) {
@@ -75,14 +77,12 @@ public class ContainerBaubleBox extends Container {
@Override
public void onContainerClosed(EntityPlayer player) {
super.onContainerClosed(player);
if(!player.worldObj.isRemote)
PlayerHandler.setPlayerBaubles(player, baubles);
// TODO do we need anything here?
}
@Override
public void putStacksInSlots(ItemStack[] arr) {
baubles.blockEvents = true;
baubles.setEventBlock(true);
super.putStacksInSlots(arr);
}
@@ -95,11 +95,15 @@ public class ContainerBaubleBox extends Container {
ItemStack itemstack1 = slot.getStack();
itemstack = itemstack1.copy();
if(slotIndex < 28) {
if(!mergeItemStack(itemstack1, 28, 64, true))
int boxStart = 7;
int boxEnd = boxStart + 24;
int invEnd = boxEnd + 36;
if(slotIndex < boxEnd) {
if(!mergeItemStack(itemstack1, boxEnd, invEnd, true))
return null;
} else {
if(itemstack1 != null && (itemstack1.getItem() instanceof IBauble || itemstack1.getItem() instanceof IManaItem) && !mergeItemStack(itemstack1, 4, 28, false))
if(itemstack1 != null && (itemstack1.getItem() instanceof IBauble || itemstack1.getItem() instanceof IManaItem) && !mergeItemStack(itemstack1, boxStart, boxEnd, false))
return null;
}
@@ -10,6 +10,7 @@
*/
package vazkii.botania.client.gui.box;
import net.minecraft.client.gui.inventory.GuiContainer;
import net.minecraft.client.gui.inventory.GuiInventory;
import net.minecraft.client.renderer.GlStateManager;
import net.minecraft.client.renderer.InventoryEffectRenderer;
@@ -18,7 +19,7 @@ import net.minecraft.inventory.Slot;
import net.minecraft.util.ResourceLocation;
import vazkii.botania.client.lib.LibResources;
public class GuiBaubleBox extends InventoryEffectRenderer {
public class GuiBaubleBox extends GuiContainer {
private static final ResourceLocation texture = new ResourceLocation(LibResources.GUI_BAUBLE_BOX);
@@ -38,7 +39,7 @@ public class GuiBaubleBox extends InventoryEffectRenderer {
drawTexturedModalRect(guiLeft+slot.xDisplayPosition, guiTop+slot.yDisplayPosition, 200, 0, 16, 16);
}
GuiInventory.drawEntityOnScreen(guiLeft + 43, guiTop + 61, 20, guiLeft + 43 - mouseX, guiTop + 45 - 30 - mouseY, mc.thePlayer);
// GuiInventory.drawEntityOnScreen(guiLeft + 43, guiTop + 61, 20, guiLeft + 43 - mouseX, guiTop + 45 - 30 - mouseY, mc.thePlayer);
}
}
@@ -13,9 +13,9 @@ package vazkii.botania.common.core.handler;
import java.util.ArrayList;
import java.util.List;
import baubles.common.lib.PlayerHandler;
import baubles.api.BaublesApi;
import baubles.common.network.PacketHandler;
import baubles.common.network.PacketSyncBauble;
import baubles.common.network.PacketSync;
import buildcraft.api.transport.IPipeTile;
import net.minecraft.block.Block;
import net.minecraft.client.gui.ScaledResolution;
@@ -184,7 +184,7 @@ public class InternalMethodHandler extends DummyMethodHandler {
@Override
public IInventory getBaublesInventory(EntityPlayer player) {
return PlayerHandler.getPlayerBaubles(player);
return BaublesApi.getBaubles(player);
}
@Override
@@ -263,10 +263,9 @@ public class InternalMethodHandler extends DummyMethodHandler {
@Override
public void sendBaubleUpdatePacket(EntityPlayer player, int slot) {
if(player instanceof EntityPlayerMP)
PacketHandler.INSTANCE.sendTo(new PacketSyncBauble(player, slot), (EntityPlayerMP) player);
PacketHandler.INSTANCE.sendTo(new PacketSync(player, slot), (EntityPlayerMP) player);
}
@Override
public List<IWrappedInventory> wrapInventory(List<InvWithLocation> inventories) {
List<IWrappedInventory> arrayList = new ArrayList<IWrappedInventory>();
@@ -1,10 +1,10 @@
package vazkii.botania.common.core.handler;
import baubles.common.container.InventoryBaubles;
import baubles.common.lib.PlayerHandler;
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;
@@ -37,7 +37,7 @@ public final class PixieHandler {
for (ItemStack element : player.inventory.armorInventory)
chance += getChance(element);
InventoryBaubles baubles = PlayerHandler.getPlayerBaubles(player);
IInventory baubles = BaublesApi.getBaubles(player);
for(int i = 0; i < baubles.getSizeInventory(); i++)
chance += getChance(baubles.getStackInSlot(i));
@@ -23,11 +23,12 @@ import java.util.WeakHashMap;
import javax.annotation.Nonnull;
import baubles.common.lib.PlayerHandler;
import baubles.api.BaublesApi;
import gnu.trove.map.hash.TObjectIntHashMap;
import net.minecraft.entity.Entity;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.player.EntityPlayerMP;
import net.minecraft.inventory.IInventory;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.network.datasync.DataParameter;
@@ -110,7 +111,12 @@ public class EntitySpark extends Entity implements ISparkEntity {
List<ItemStack> stacks = new ArrayList<>();
stacks.addAll(Arrays.asList(player.inventory.mainInventory));
stacks.addAll(Arrays.asList(player.inventory.armorInventory));
stacks.addAll(Arrays.asList(PlayerHandler.getPlayerBaubles(player).stackList));
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));
for(ItemStack stack : stacks) {
if(stack == null || !(stack.getItem() instanceof IManaItem))
@@ -16,13 +16,13 @@ import java.util.UUID;
import javax.annotation.Nonnull;
import baubles.api.BaubleType;
import baubles.api.BaublesApi;
import baubles.api.IBauble;
import baubles.common.container.InventoryBaubles;
import baubles.common.lib.PlayerHandler;
import net.minecraft.client.gui.GuiScreen;
import net.minecraft.client.resources.I18n;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.inventory.IInventory;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.util.ActionResult;
@@ -66,7 +66,7 @@ public abstract class ItemBauble extends ItemMod implements IBauble, ICosmeticAt
toEquip.stackSize = 1;
if(canEquip(toEquip, player)) {
InventoryBaubles baubles = PlayerHandler.getPlayerBaubles(player);
IInventory baubles = BaublesApi.getBaubles(player);
for(int i = 0; i < baubles.getSizeInventory(); i++) {
if(baubles.isItemValidForSlot(i, toEquip)) {
ItemStack stackInSlot = baubles.getStackInSlot(i);
@@ -15,7 +15,7 @@ import java.util.List;
import com.google.common.base.Predicates;
import baubles.api.BaubleType;
import baubles.common.lib.PlayerHandler;
import baubles.api.BaublesApi;
import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.GlStateManager;
import net.minecraft.client.renderer.block.model.ItemCameraTransforms;
@@ -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().worldObj.isRemote && Math.random() < 0.6F) {
EntityPlayer player = (EntityPlayer) event.getSource().getEntity();
ItemStack amulet = PlayerHandler.getPlayerBaubles(player).getStackInSlot(0);
ItemStack amulet = BaublesApi.getBaubles(player).getStackInSlot(0);
if(amulet != null && amulet.getItem() == this) {
final int cost = 250;
if(ManaItemHandler.requestManaExact(amulet, player, cost, false)) {
@@ -22,7 +22,7 @@ import javax.xml.bind.annotation.adapters.HexBinaryAdapter;
import org.lwjgl.opengl.GL11;
import baubles.api.BaubleType;
import baubles.common.lib.PlayerHandler;
import baubles.api.BaublesApi;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.Gui;
import net.minecraft.client.gui.ScaledResolution;
@@ -213,7 +213,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 = PlayerHandler.getPlayerBaubles(player).getStackInSlot(0);
ItemStack tiara = BaublesApi.getBaubles(player).getStackInSlot(0);
int left = ItemNBTHelper.getInt(tiara, TAG_TIME_LEFT, MAX_FLY_TIME);
if(playersWithFlight.contains(playerStr(player))) {
@@ -311,7 +311,7 @@ public class ItemFlightTiara extends ItemBauble implements IManaUsingItem, IBaub
}
private boolean shouldPlayerHaveFlight(EntityPlayer player) {
ItemStack armor = PlayerHandler.getPlayerBaubles(player).getStackInSlot(0);
ItemStack armor = BaublesApi.getBaubles(player).getStackInSlot(0);
if(armor != null && armor.getItem() == this) {
int left = ItemNBTHelper.getInt(armor, TAG_TIME_LEFT, MAX_FLY_TIME);
boolean flying = ItemNBTHelper.getBoolean(armor, TAG_FLYING, false);
@@ -11,7 +11,7 @@
package vazkii.botania.common.item.equipment.bauble;
import baubles.api.BaubleType;
import baubles.common.lib.PlayerHandler;
import baubles.api.BaublesApi;
import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.GlStateManager;
import net.minecraft.client.renderer.block.model.ItemCameraTransforms;
@@ -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 amulet = PlayerHandler.getPlayerBaubles(player).getStackInSlot(0);
ItemStack amulet = BaublesApi.getBaubles(player).getStackInSlot(0);
if(amulet != null && amulet.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.addChatMessage(new TextComponentTranslation("botaniamisc.savedByLaurel"));
player.worldObj.playSound(null, player.posX, player.posY, player.posZ, BotaniaSoundEvents.goldenLaurel, SoundCategory.PLAYERS, 1F, 0.3F);
PlayerHandler.getPlayerBaubles(player).setInventorySlotContents(0, null);
BaublesApi.getBaubles(player).setInventorySlotContents(0, null);
}
}
}
@@ -11,14 +11,14 @@
package vazkii.botania.common.item.equipment.bauble;
import baubles.api.BaubleType;
import baubles.common.container.InventoryBaubles;
import baubles.common.lib.PlayerHandler;
import baubles.api.BaublesApi;
import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.GlStateManager;
import net.minecraft.client.renderer.OpenGlHelper;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.inventory.EntityEquipmentSlot;
import net.minecraft.inventory.IInventory;
import net.minecraft.item.ItemStack;
import net.minecraft.util.ResourceLocation;
import net.minecraft.util.SoundCategory;
@@ -59,7 +59,7 @@ public class ItemHolyCloak extends ItemBauble implements IBaubleRender {
public void onPlayerDamage(LivingHurtEvent event) {
if(event.getEntityLiving() instanceof EntityPlayer) {
EntityPlayer player = (EntityPlayer) event.getEntityLiving();
InventoryBaubles baubles = PlayerHandler.getPlayerBaubles(player);
IInventory baubles = BaublesApi.getBaubles(player);
ItemStack belt = baubles.getStackInSlot(3);
if(belt != null && belt.getItem() instanceof ItemHolyCloak && !isInEffect(belt)) {
ItemHolyCloak cloak = (ItemHolyCloak) belt.getItem();
@@ -15,9 +15,7 @@ import java.util.Arrays;
import java.util.List;
import baubles.api.BaubleType;
import baubles.common.lib.PlayerHandler;
import baubles.common.network.PacketHandler;
import baubles.common.network.PacketSyncBauble;
import baubles.api.BaublesApi;
import gnu.trove.list.array.TIntArrayList;
import gnu.trove.list.array.TLongArrayList;
import net.minecraft.client.Minecraft;
@@ -43,6 +41,7 @@ import net.minecraftforge.fml.relauncher.SideOnly;
import net.minecraftforge.items.CapabilityItemHandler;
import net.minecraftforge.items.IItemHandler;
import net.minecraftforge.items.wrapper.InvWrapper;
import vazkii.botania.api.BotaniaAPI;
import vazkii.botania.api.item.IBaubleRender;
import vazkii.botania.client.core.handler.MiscellaneousIcons;
import vazkii.botania.client.core.helper.IconHelper;
@@ -117,7 +116,7 @@ public class ItemItemFinder extends ItemBauble implements IBaubleRender {
if(!blocksEqual)
setBlockPositions(stack, currentBlocks);
if(!entsEqual || !blocksEqual)
PacketHandler.INSTANCE.sendToAll(new PacketSyncBauble(player, 0));
BotaniaAPI.internalHandler.sendBaubleUpdatePacket(player, 0);
}
private void scanForStack(ItemStack pstack, EntityPlayer player, TIntArrayList entIdBuilder, TLongArrayList blockPosBuilder) {
@@ -146,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(PlayerHandler.getPlayerBaubles(player_));
IItemHandler binv = new InvWrapper(BaublesApi.getBaubles(player_));
if(scanInventory(binv, pstack) || scanInventory(playerInv, pstack))
entIdBuilder.add(player_.getEntityId());
@@ -15,10 +15,10 @@ import java.util.List;
import com.google.common.collect.ImmutableList;
import baubles.api.BaubleType;
import baubles.common.container.InventoryBaubles;
import baubles.common.lib.PlayerHandler;
import baubles.api.BaublesApi;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.item.EntityItem;
import net.minecraft.inventory.IInventory;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.util.ResourceLocation;
@@ -59,7 +59,7 @@ public class ItemMagnetRing extends ItemBauble {
@SubscribeEvent
public void onTossItem(ItemTossEvent event) {
InventoryBaubles inv = PlayerHandler.getPlayerBaubles(event.getPlayer());
IInventory inv = BaublesApi.getBaubles(event.getPlayer());
for(int i = 0; i < inv.getSizeInventory(); i++) {
ItemStack stack = inv.getStackInSlot(i);
if(stack != null && stack.getItem() instanceof ItemMagnetRing) {
@@ -11,7 +11,7 @@
package vazkii.botania.common.item.equipment.bauble;
import baubles.api.BaubleType;
import baubles.common.lib.PlayerHandler;
import baubles.api.BaublesApi;
import net.minecraft.block.Block;
import net.minecraft.block.BlockRedstoneComparator;
import net.minecraft.block.BlockRedstoneRepeater;
@@ -104,7 +104,7 @@ public class ItemMonocle extends ItemBauble implements IBurstViewerBauble, ICosm
public static boolean hasMonocle(EntityPlayer player) {
for(int i = 0; i < 4; i++) {
ItemStack stack = PlayerHandler.getPlayerBaubles(player).getStackInSlot(i);
ItemStack stack = BaublesApi.getBaubles(player).getStackInSlot(i);
if(stack != null) {
Item item = stack.getItem();
if(item instanceof IBurstViewerBauble)
@@ -14,7 +14,7 @@ import java.util.ArrayList;
import java.util.List;
import baubles.api.BaubleType;
import baubles.common.lib.PlayerHandler;
import baubles.api.BaublesApi;
import net.minecraft.block.material.Material;
import net.minecraft.client.Minecraft;
import net.minecraft.client.model.ModelBiped;
@@ -73,7 +73,7 @@ public class ItemTravelBelt extends ItemBauble implements IBaubleRender, IManaUs
EntityPlayer player = (EntityPlayer) event.getEntityLiving();
String s = playerStr(player);
ItemStack belt = PlayerHandler.getPlayerBaubles(player).getStackInSlot(3);
ItemStack belt = BaublesApi.getBaubles(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 = PlayerHandler.getPlayerBaubles(player).getStackInSlot(3);
ItemStack belt = BaublesApi.getBaubles(player).getStackInSlot(3);
if(belt != null && 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 = PlayerHandler.getPlayerBaubles(player).getStackInSlot(3);
ItemStack armor = BaublesApi.getBaubles(player).getStackInSlot(3);
return armor != null && armor.getItem() instanceof ItemTravelBelt && ManaItemHandler.requestManaExact(armor, player, COST, false);
}
@@ -11,7 +11,7 @@
package vazkii.botania.common.item.equipment.bauble;
import baubles.api.BaubleType;
import baubles.common.lib.PlayerHandler;
import baubles.api.BaublesApi;
import net.minecraft.block.material.Material;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.player.EntityPlayer;
@@ -37,7 +37,7 @@ public class ItemWaterRing extends ItemBauble implements IManaUsingItem {
if(player.isInsideOfMaterial(Material.WATER)) {
if(player instanceof EntityPlayer) {
ItemStack firstRing = PlayerHandler.getPlayerBaubles((EntityPlayer) player).getStackInSlot(1);
ItemStack firstRing = BaublesApi.getBaubles((EntityPlayer) player).getStackInSlot(1);
if(firstRing != null && firstRing.getItem() instanceof ItemWaterRing && firstRing != stack) {
return;
}
@@ -16,18 +16,15 @@ import java.util.List;
import com.google.common.collect.ImmutableList;
import baubles.api.BaubleType;
import baubles.common.container.InventoryBaubles;
import baubles.common.lib.PlayerHandler;
import baubles.common.network.PacketHandler;
import baubles.common.network.PacketSyncBauble;
import baubles.api.BaublesApi;
import net.minecraft.block.material.Material;
import net.minecraft.block.state.IBlockState;
import net.minecraft.client.Minecraft;
import net.minecraft.enchantment.EnchantmentHelper;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.player.EntityPlayerMP;
import net.minecraft.init.Enchantments;
import net.minecraft.inventory.IInventory;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
@@ -40,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 vazkii.botania.api.BotaniaAPI;
import vazkii.botania.api.item.ISequentialBreaker;
import vazkii.botania.api.item.IWireframeCoordinateListProvider;
import vazkii.botania.api.mana.IManaUsingItem;
@@ -74,7 +72,7 @@ public class ItemLokiRing extends ItemRelicBauble implements IWireframeCoordinat
return;
int slot = -1;
InventoryBaubles inv = PlayerHandler.getPlayerBaubles(player);
IInventory inv = BaublesApi.getBaubles(player);
for(int i = 0; i < inv.getSizeInventory(); i++) {
ItemStack stack = inv.getStackInSlot(i);
if(stack == lokiRing) {
@@ -95,13 +93,11 @@ public class ItemLokiRing extends ItemRelicBauble implements IWireframeCoordinat
if(originCoords.getY() == -1 && lookPos != null && lookPos.getBlockPos() != null) {
setOriginPos(lokiRing, lookPos.getBlockPos());
setCursorList(lokiRing, null);
if(player instanceof EntityPlayerMP)
PacketHandler.INSTANCE.sendTo(new PacketSyncBauble(player, slot), (EntityPlayerMP) player);
BotaniaAPI.internalHandler.sendBaubleUpdatePacket(player, slot);
} else if(lookPos != null && lookPos.getBlockPos() != null) {
if(originCoords.equals(lookPos.getBlockPos())) {
setOriginPos(lokiRing, new BlockPos(0, -1, 0));
if(player instanceof EntityPlayerMP)
PacketHandler.INSTANCE.sendTo(new PacketSyncBauble(player, slot), (EntityPlayerMP) player);
BotaniaAPI.internalHandler.sendBaubleUpdatePacket(player, slot);
} else {
addCursor : {
BlockPos relPos = lookPos.getBlockPos().add(new BlockPos(-originCoords.getX(), -originCoords.getY(), -originCoords.getZ()));
@@ -110,14 +106,12 @@ public class ItemLokiRing extends ItemRelicBauble implements IWireframeCoordinat
if(cursor.equals(relPos)) {
cursors.remove(cursor);
setCursorList(lokiRing, cursors);
if(player instanceof EntityPlayerMP)
PacketHandler.INSTANCE.sendTo(new PacketSyncBauble(player, slot), (EntityPlayerMP) player);
BotaniaAPI.internalHandler.sendBaubleUpdatePacket(player, slot);
break addCursor;
}
addCursor(lokiRing, relPos);
if(player instanceof EntityPlayerMP)
PacketHandler.INSTANCE.sendTo(new PacketSyncBauble(player, slot), (EntityPlayerMP) player);
BotaniaAPI.internalHandler.sendBaubleUpdatePacket(player, slot);
}
}
}
@@ -197,7 +191,7 @@ public class ItemLokiRing extends ItemRelicBauble implements IWireframeCoordinat
}
private static ItemStack getLokiRing(EntityPlayer player) {
InventoryBaubles baubles = PlayerHandler.getPlayerBaubles(player);
IInventory baubles = BaublesApi.getBaubles(player);
ItemStack stack1 = baubles.getStackInSlot(1);
ItemStack stack2 = baubles.getStackInSlot(2);
return isLokiRing(stack1) ? stack1 : isLokiRing(stack2) ? stack2 : null;
@@ -17,12 +17,12 @@ import com.google.common.collect.HashMultimap;
import com.google.common.collect.Multimap;
import baubles.api.BaubleType;
import baubles.common.container.InventoryBaubles;
import baubles.common.lib.PlayerHandler;
import baubles.api.BaublesApi;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.SharedMonsterAttributes;
import net.minecraft.entity.ai.attributes.AttributeModifier;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.inventory.IInventory;
import net.minecraft.item.ItemStack;
import net.minecraft.util.DamageSource;
import net.minecraftforge.common.MinecraftForge;
@@ -75,7 +75,7 @@ public class ItemOdinRing extends ItemRelicBauble {
}
public static ItemStack getOdinRing(EntityPlayer player) {
InventoryBaubles baubles = PlayerHandler.getPlayerBaubles(player);
IInventory baubles = BaublesApi.getBaubles(player);
ItemStack stack1 = baubles.getStackInSlot(1);
ItemStack stack2 = baubles.getStackInSlot(2);
return isOdinRing(stack1) ? stack1 : isOdinRing(stack2) ? stack2 : null;
@@ -11,9 +11,9 @@
package vazkii.botania.common.item.relic;
import baubles.api.BaubleType;
import baubles.common.container.InventoryBaubles;
import baubles.common.lib.PlayerHandler;
import baubles.api.BaublesApi;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.inventory.IInventory;
import net.minecraft.item.ItemStack;
import vazkii.botania.common.item.ModItems;
import vazkii.botania.common.lib.LibItemNames;
@@ -30,7 +30,7 @@ public class ItemThorRing extends ItemRelicBauble {
}
public static ItemStack getThorRing(EntityPlayer player) {
InventoryBaubles baubles = PlayerHandler.getPlayerBaubles(player);
IInventory baubles = BaublesApi.getBaubles(player);
ItemStack stack1 = baubles.getStackInSlot(1);
ItemStack stack2 = baubles.getStackInSlot(2);
return isThorRing(stack1) ? stack1 : isThorRing(stack2) ? stack2 : null;
Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.8 KiB

After

Width:  |  Height:  |  Size: 16 KiB