mirror of
https://github.com/GTNewHorizons/ForbiddenMagic.git
synced 2026-11-17 19:05:27 +00:00
1 parent
0eb028601d
commit
7aefe92f09
5 files changed
+103
-11
No files matched your search
@@ -2,17 +2,30 @@ package fox.spiteful.forbidden.items.baubles;
|
||||
|
||||
import baubles.api.BaubleType;
|
||||
import baubles.api.IBauble;
|
||||
import cpw.mods.fml.common.Optional;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import fox.spiteful.forbidden.Forbidden;
|
||||
import fox.spiteful.forbidden.compat.Compat;
|
||||
import net.minecraft.client.gui.GuiScreen;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.util.EnumChatFormatting;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraft.util.StatCollector;
|
||||
import thaumcraft.api.IRunicArmor;
|
||||
import thaumcraft.api.aspects.Aspect;
|
||||
import vazkii.botania.api.item.ICosmeticAttachable;
|
||||
|
||||
public class ItemRingNutrition extends Item implements IRunicArmor, IBauble {
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
|
||||
@Optional.Interface(iface = "vazkii.botania.api.item.ICosmeticAttachable", modid = "Botania")
|
||||
public class ItemRingNutrition extends Item implements IRunicArmor, IBauble, ICosmeticAttachable {
|
||||
IIcon icon;
|
||||
|
||||
public ItemRingNutrition(){
|
||||
@@ -52,4 +65,37 @@ public class ItemRingNutrition extends Item implements IRunicArmor, IBauble {
|
||||
public int getRunicCharge(ItemStack itemstack){
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack getCosmeticItem(ItemStack stack) {
|
||||
if(stack == null || stack.getTagCompound() == null)
|
||||
return null;
|
||||
if(!stack.getTagCompound().hasKey("cosmeticItem"))
|
||||
return null;
|
||||
NBTTagCompound cosmetic = stack.getTagCompound().getCompoundTag("cosmeticItem");
|
||||
return ItemStack.loadItemStackFromNBT(cosmetic);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setCosmeticItem(ItemStack stack, ItemStack cosmetic) {
|
||||
if(cosmetic == null || stack == null)
|
||||
return;
|
||||
NBTTagCompound cmp = new NBTTagCompound();
|
||||
cosmetic.writeToNBT(cmp);
|
||||
NBTTagCompound tag = stack.getTagCompound();
|
||||
if(tag == null){
|
||||
tag = new NBTTagCompound();
|
||||
stack.setTagCompound(tag);
|
||||
}
|
||||
|
||||
tag.setTag("cosmeticItem", cmp);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addInformation(ItemStack stack, EntityPlayer player, List list, boolean par4) {
|
||||
|
||||
if(Compat.botan && GuiScreen.isShiftKeyDown() && getCosmeticItem(stack) != null)
|
||||
list.add(String.format(StatCollector.translateToLocal("botaniamisc.hasCosmetic"), getCosmeticItem(stack).getDisplayName()).replaceAll("&", "\u00a7"));
|
||||
|
||||
}
|
||||
}
|
||||
@@ -1,9 +1,12 @@
|
||||
package fox.spiteful.forbidden.items.baubles;
|
||||
|
||||
import baubles.api.BaublesApi;
|
||||
import cpw.mods.fml.common.Optional;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import fox.spiteful.forbidden.Forbidden;
|
||||
import fox.spiteful.forbidden.compat.Compat;
|
||||
import net.minecraft.client.gui.GuiScreen;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.creativetab.CreativeTabs;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
@@ -19,12 +22,14 @@ import net.minecraft.util.IIcon;
|
||||
import net.minecraft.util.StatCollector;
|
||||
import thaumcraft.api.aspects.Aspect;
|
||||
import thaumcraft.common.items.baubles.ItemAmuletVis;
|
||||
import vazkii.botania.api.item.ICosmeticAttachable;
|
||||
|
||||
import java.text.DecimalFormat;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
|
||||
public class ItemSubCollar extends ItemAmuletVis {
|
||||
@Optional.Interface(iface = "vazkii.botania.api.item.ICosmeticAttachable", modid = "Botania")
|
||||
public class ItemSubCollar extends ItemAmuletVis implements ICosmeticAttachable {
|
||||
|
||||
public IIcon icon;
|
||||
DecimalFormat myFormatter = new DecimalFormat("#######.##");
|
||||
@@ -82,6 +87,10 @@ public class ItemSubCollar extends ItemAmuletVis {
|
||||
}
|
||||
if(stack.stackTagCompound.hasKey("owner"))
|
||||
list.add(StatCollector.translateToLocal("tooltip.collar.owner") + " " + stack.stackTagCompound.getString("owner"));
|
||||
|
||||
if(Compat.botan && GuiScreen.isShiftKeyDown() && getCosmeticItem(stack) != null)
|
||||
list.add(String.format(StatCollector.translateToLocal("botaniamisc.hasCosmetic"), getCosmeticItem(stack).getDisplayName()).replaceAll("&", "\u00a7"));
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -124,4 +133,29 @@ public class ItemSubCollar extends ItemAmuletVis {
|
||||
list.add(new ItemStack(item, 1, 0));
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack getCosmeticItem(ItemStack stack) {
|
||||
if(stack == null || stack.getTagCompound() == null)
|
||||
return null;
|
||||
if(!stack.getTagCompound().hasKey("cosmeticItem"))
|
||||
return null;
|
||||
NBTTagCompound cosmetic = stack.getTagCompound().getCompoundTag("cosmeticItem");
|
||||
return ItemStack.loadItemStackFromNBT(cosmetic);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setCosmeticItem(ItemStack stack, ItemStack cosmetic) {
|
||||
if(cosmetic == null || stack == null)
|
||||
return;
|
||||
NBTTagCompound cmp = new NBTTagCompound();
|
||||
cosmetic.writeToNBT(cmp);
|
||||
NBTTagCompound tag = stack.getTagCompound();
|
||||
if(tag == null){
|
||||
tag = new NBTTagCompound();
|
||||
stack.setTagCompound(tag);
|
||||
}
|
||||
|
||||
tag.setTag("cosmeticItem", cmp);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -6,6 +6,7 @@ import fox.spiteful.forbidden.Forbidden;
|
||||
import fox.spiteful.forbidden.LogHandler;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.entity.player.EntityPlayerMP;
|
||||
import net.minecraft.item.Item;
|
||||
@@ -33,7 +34,10 @@ public class ItemCrystalwell extends Item implements IScribeTools {
|
||||
public ItemCrystalwell() {
|
||||
maxStackSize = 1;
|
||||
canRepair = false;
|
||||
setMaxDamage(100);
|
||||
if(Config.researchDifficulty == -1)
|
||||
setMaxDamage(50);
|
||||
else
|
||||
setMaxDamage(100);
|
||||
setCreativeTab(Forbidden.tab);
|
||||
setHasSubtypes(false);
|
||||
|
||||
@@ -53,7 +57,7 @@ public class ItemCrystalwell extends Item implements IScribeTools {
|
||||
|
||||
@Override
|
||||
public ItemStack onItemRightClick(ItemStack stack, World world, EntityPlayer player) {
|
||||
if (stack.getItemDamage() >= 100) {
|
||||
if (Config.researchDifficulty != -1 && stack.getItemDamage() >= 100) {
|
||||
if (!world.isRemote) {
|
||||
Aspect aspect;
|
||||
short amount;
|
||||
@@ -72,7 +76,7 @@ public class ItemCrystalwell extends Item implements IScribeTools {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onUpdate(ItemStack stack, World world, Entity entity, int wat, boolean isSelected) {
|
||||
public void onUpdate(ItemStack stack, World world, Entity entity, int slot, boolean isSelected) {
|
||||
|
||||
if(world.isRemote)
|
||||
return;
|
||||
@@ -83,6 +87,9 @@ public class ItemCrystalwell extends Item implements IScribeTools {
|
||||
Thaumcraft.proxy.playerKnowledge.addAspectPool(player.getCommandSenderName(), aspect, amount);
|
||||
PacketHandler.INSTANCE.sendTo(new PacketAspectPool(aspect.getTag(), amount, Short.valueOf(Thaumcraft.proxy.playerKnowledge.getAspectPoolFor(player.getCommandSenderName(), aspect))), (EntityPlayerMP) player);
|
||||
ResearchManager.scheduleSave(player);
|
||||
stack.setItemDamage(stack.getItemDamage() + 1);
|
||||
if(stack.getItemDamage() >= stack.getMaxDamage())
|
||||
((EntityPlayer)entity).inventory.setInventorySlotContents(slot, null);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -92,7 +99,7 @@ public class ItemCrystalwell extends Item implements IScribeTools {
|
||||
@SideOnly(Side.CLIENT)
|
||||
@Override
|
||||
public boolean hasEffect(ItemStack stack, int pass) {
|
||||
return stack.getItemDamage() >= 100;
|
||||
return Config.researchDifficulty != -1 && stack.getItemDamage() >= 100;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -35,7 +35,7 @@ public class SubTileTainthistle extends SubTileGenerating {
|
||||
super.onUpdate();
|
||||
boolean didSomething = false;
|
||||
if(this.ticksExisted % 80 == 0) {
|
||||
if (mana < getMaxMana() && !supertile.getWorldObj().isRemote) {
|
||||
if (!supertile.getWorldObj().isRemote) {
|
||||
for (int ex = supertile.xCoord - range; ex <= supertile.xCoord + range; ex++) {
|
||||
for (int wy = supertile.yCoord - range; wy <= supertile.yCoord + range; wy++) {
|
||||
for (int zee = supertile.zCoord - range; zee <= supertile.zCoord + range; zee++) {
|
||||
@@ -43,7 +43,7 @@ public class SubTileTainthistle extends SubTileGenerating {
|
||||
int depth = supertile.getWorldObj().getBlockMetadata(ex, wy, zee);
|
||||
supertile.getWorldObj().setBlockToAir(ex, wy, zee);
|
||||
didSomething = true;
|
||||
burnTime = Math.min(burnTime + depth * (4 + supertile.getWorldObj().rand.nextInt(4)), 4000);
|
||||
burnTime = Math.min(burnTime + depth * (20), 4000);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -119,7 +119,7 @@ public class SubTileTainthistle extends SubTileGenerating {
|
||||
|
||||
@Override
|
||||
public int getValueForPassiveGeneration() {
|
||||
return 2 + supertile.getWorldObj().rand.nextInt(5);
|
||||
return 3;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
Reference in new issue
Block a user