This commit is contained in:
Lizbeth Rika committed 2015-03-18 17:21:26 +00:00
1 parent f04c50a2d7
commit a11127f368
46 files changed
+234 -261

No files matched your search

@@ -18,7 +18,7 @@ import net.minecraft.item.ItemStack;
public interface IPhantomInkable {
public boolean hasPhantomInk(ItemStack stack);
public void setPhantomInk(ItemStack stack, boolean ink);
}
@@ -14,7 +14,6 @@ import net.minecraft.init.Blocks;
import net.minecraft.item.Item;
import net.minecraft.util.StatCollector;
import net.minecraftforge.event.entity.player.ItemTooltipEvent;
import vazkii.botania.api.item.IPhantomInkable;
import vazkii.botania.common.core.helper.ItemNBTHelper;
import vazkii.botania.common.item.ItemRegenIvy;
import cpw.mods.fml.common.eventhandler.EventPriority;
@@ -11,7 +11,6 @@
package vazkii.botania.client.gui.bag;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.inventory.Container;
import net.minecraft.inventory.IInventory;
import net.minecraft.inventory.Slot;
@@ -20,27 +19,27 @@ import net.minecraft.item.ItemStack;
public class ContainerFlowerBag extends Container {
InventoryFlowerBag flowerBagInv;
public ContainerFlowerBag(EntityPlayer player) {
int i;
int j;
int i;
int j;
int slot = player.inventory.currentItem;
IInventory playerInv = player.inventory;
flowerBagInv = new InventoryFlowerBag(player, slot);
int slot = player.inventory.currentItem;
IInventory playerInv = player.inventory;
flowerBagInv = new InventoryFlowerBag(player, slot);
for(i = 0; i < 2; ++i)
for(j = 0; j < 8; ++j) {
int k = j + i * 8;
this.addSlotToContainer(new SlotFlower(flowerBagInv, k, 17 + j * 18, 26 + i * 18, k));
}
for(i = 0; i < 2; ++i)
for(j = 0; j < 8; ++j) {
int k = j + i * 8;
addSlotToContainer(new SlotFlower(flowerBagInv, k, 17 + j * 18, 26 + i * 18, k));
}
for(i = 0; i < 3; ++i)
for(j = 0; j < 9; ++j)
this.addSlotToContainer(new Slot(playerInv, j + i * 9 + 9, 8 + j * 18, 84 + i * 18));
for(i = 0; i < 3; ++i)
for(j = 0; j < 9; ++j)
addSlotToContainer(new Slot(playerInv, j + i * 9 + 9, 8 + j * 18, 84 + i * 18));
for(i = 0; i < 9; ++i)
this.addSlotToContainer(new Slot(playerInv, i, 8 + i * 18, 142));
for(i = 0; i < 9; ++i)
addSlotToContainer(new Slot(playerInv, i, 8 + i * 18, 142));
}
@Override
@@ -48,46 +47,46 @@ public class ContainerFlowerBag extends Container {
boolean can = flowerBagInv.isUseableByPlayer(player);
if(!can)
onContainerClosed(player);
return can;
}
@Override
public void onContainerClosed(EntityPlayer player) {
super.onContainerClosed(player);
flowerBagInv.pushInventory();
}
@Override
public ItemStack transferStackInSlot(EntityPlayer p_82846_1_, int p_82846_2_) {
ItemStack itemstack = null;
Slot slot = (Slot)this.inventorySlots.get(p_82846_2_);
public ItemStack transferStackInSlot(EntityPlayer p_82846_1_, int p_82846_2_) {
ItemStack itemstack = null;
Slot slot = (Slot)inventorySlots.get(p_82846_2_);
if(slot != null && slot.getHasStack()) {
ItemStack itemstack1 = slot.getStack();
itemstack = itemstack1.copy();
if(slot != null && slot.getHasStack()) {
ItemStack itemstack1 = slot.getStack();
itemstack = itemstack1.copy();
if(p_82846_2_ < 16) {
if(!this.mergeItemStack(itemstack1, 16, 52, true))
return null;
} else {
int i = itemstack.getItemDamage();
Slot slot1 = (Slot)this.inventorySlots.get(i);
if(slot1.isItemValid(itemstack) && !this.mergeItemStack(itemstack1, i, i + 1, true))
return null;
}
if(p_82846_2_ < 16) {
if(!mergeItemStack(itemstack1, 16, 52, true))
return null;
} else {
int i = itemstack.getItemDamage();
Slot slot1 = (Slot)inventorySlots.get(i);
if(slot1.isItemValid(itemstack) && !mergeItemStack(itemstack1, i, i + 1, true))
return null;
}
if(itemstack1.stackSize == 0)
slot.putStack((ItemStack)null);
else slot.onSlotChanged();
if(itemstack1.stackSize == 0)
slot.putStack((ItemStack)null);
else slot.onSlotChanged();
if(itemstack1.stackSize == itemstack.stackSize)
return null;
if(itemstack1.stackSize == itemstack.stackSize)
return null;
slot.onPickupFromSlot(p_82846_1_, itemstack1);
}
slot.onPickupFromSlot(p_82846_1_, itemstack1);
}
return itemstack;
}
return itemstack;
}
}
@@ -13,7 +13,6 @@ package vazkii.botania.client.gui.bag;
import java.util.List;
import net.minecraft.client.gui.inventory.GuiContainer;
import net.minecraft.client.renderer.ItemRenderer;
import net.minecraft.client.renderer.RenderHelper;
import net.minecraft.client.renderer.entity.RenderItem;
import net.minecraft.client.resources.I18n;
@@ -29,41 +28,42 @@ import vazkii.botania.client.lib.LibResources;
import vazkii.botania.common.block.ModBlocks;
public class GuiFlowerBag extends GuiContainer {
private static final ResourceLocation texture = new ResourceLocation(LibResources.GUI_FLOWER_BAG);
public GuiFlowerBag(EntityPlayer player) {
super(new ContainerFlowerBag(player));
}
protected void drawGuiContainerForegroundLayer(int p_146979_1_, int p_146979_2_) {
String s = StatCollector.translateToLocal("item.botania:flowerBag.name");
this.fontRendererObj.drawString(s, this.xSize / 2 - this.fontRendererObj.getStringWidth(s) / 2, 6, 4210752);
this.fontRendererObj.drawString(I18n.format("container.inventory", new Object[0]), 8, this.ySize - 96 + 2, 4210752);
}
@Override
protected void drawGuiContainerForegroundLayer(int p_146979_1_, int p_146979_2_) {
String s = StatCollector.translateToLocal("item.botania:flowerBag.name");
fontRendererObj.drawString(s, xSize / 2 - fontRendererObj.getStringWidth(s) / 2, 6, 4210752);
fontRendererObj.drawString(I18n.format("container.inventory", new Object[0]), 8, ySize - 96 + 2, 4210752);
}
@Override
protected void drawGuiContainerBackgroundLayer(float p_146976_1_, int p_146976_2_, int p_146976_3_) {
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
this.mc.getTextureManager().bindTexture(texture);
int k = (this.width - this.xSize) / 2;
int l = (this.height - this.ySize) / 2;
this.drawTexturedModalRect(k, l, 0, 0, this.xSize, this.ySize);
List<Slot> slotList = inventorySlots.inventorySlots;
for(Slot slot : slotList)
if(slot instanceof SlotFlower) {
SlotFlower slotf = (SlotFlower) slot;
if(!slotf.getHasStack()) {
ItemStack stack = new ItemStack(ModBlocks.flower, 0, slotf.color);
int x = guiLeft + slotf.xDisplayPosition;
int y = guiTop + slotf.yDisplayPosition;
RenderHelper.enableGUIStandardItemLighting();
RenderItem.getInstance().renderItemIntoGUI(mc.fontRenderer, mc.renderEngine, stack, x, y);
RenderHelper.disableStandardItemLighting();
mc.fontRenderer.drawStringWithShadow("0", x + 11, y + 9, 0xFF6666);
}
}
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
mc.getTextureManager().bindTexture(texture);
int k = (width - xSize) / 2;
int l = (height - ySize) / 2;
drawTexturedModalRect(k, l, 0, 0, xSize, ySize);
List<Slot> slotList = inventorySlots.inventorySlots;
for(Slot slot : slotList)
if(slot instanceof SlotFlower) {
SlotFlower slotf = (SlotFlower) slot;
if(!slotf.getHasStack()) {
ItemStack stack = new ItemStack(ModBlocks.flower, 0, slotf.color);
int x = guiLeft + slotf.xDisplayPosition;
int y = guiTop + slotf.yDisplayPosition;
RenderHelper.enableGUIStandardItemLighting();
RenderItem.getInstance().renderItemIntoGUI(mc.fontRenderer, mc.renderEngine, stack, x, y);
RenderHelper.disableStandardItemLighting();
mc.fontRenderer.drawStringWithShadow("0", x + 11, y + 9, 0xFF6666);
}
}
}
}
@@ -13,7 +13,6 @@ package vazkii.botania.client.gui.bag;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.inventory.IInventory;
import net.minecraft.item.ItemStack;
import vazkii.botania.common.core.helper.ItemNBTHelper;
import vazkii.botania.common.item.ItemFlowerBag;
import vazkii.botania.common.item.ModItems;
import vazkii.botania.common.lib.LibItemNames;
@@ -21,14 +20,14 @@ import vazkii.botania.common.lib.LibItemNames;
public class InventoryFlowerBag implements IInventory {
private static final ItemStack[] FALLBACK_INVENTORY = new ItemStack[16];
EntityPlayer player;
int slot;
ItemStack[] stacks = null;
boolean invPushed = false;
ItemStack storedInv = null;
public InventoryFlowerBag(EntityPlayer player, int slot) {
this.player = player;
this.slot = slot;
@@ -37,48 +36,48 @@ public class InventoryFlowerBag implements IInventory {
public static boolean isFlowerBag(ItemStack stack) {
return stack != null && stack.getItem() == ModItems.flowerBag;
}
ItemStack getStack() {
ItemStack stack = player.inventory.getStackInSlot(slot);
if(stack != null)
storedInv = stack;
return stack;
return stack;
}
ItemStack[] getInventory() {
if(stacks != null)
return stacks;
ItemStack stack = getStack();
if(isFlowerBag(getStack())) {
stacks = ItemFlowerBag.loadStacks(stack);
return stacks;
}
return FALLBACK_INVENTORY;
}
public void pushInventory() {
if(invPushed)
return;
ItemStack stack = getStack();
if(stack == null)
stack = storedInv;
if(stack != null) {
ItemStack[] inv = getInventory();
ItemFlowerBag.setStacks(stack, inv);
}
invPushed = true;
}
@Override
public int getSizeInventory() {
return 16;
}
@Override
public ItemStack getStackInSlot(int i) {
return getInventory()[i];
@@ -10,25 +10,22 @@
*/
package vazkii.botania.client.gui.bag;
import vazkii.botania.common.block.ModBlocks;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.inventory.IInventory;
import net.minecraft.inventory.Slot;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.util.IIcon;
import vazkii.botania.common.block.ModBlocks;
public class SlotFlower extends Slot {
InventoryFlowerBag inv;
int color;
public SlotFlower(InventoryFlowerBag p_i1824_1_, int p_i1824_2_, int p_i1824_3_, int p_i1824_4_, int color) {
super(p_i1824_1_, p_i1824_2_, p_i1824_3_, p_i1824_4_);
this.color = color;
inv = p_i1824_1_;
}
@Override
public void onSlotChange(ItemStack oldStack, ItemStack newStack) {
inv.setInventorySlotContents(color, newStack);
@@ -38,5 +35,5 @@ public class SlotFlower extends Slot {
public boolean isItemValid(ItemStack stack) {
return stack.getItem() == Item.getItemFromBlock(ModBlocks.flower) && stack.getItemDamage() == color;
}
}
@@ -40,7 +40,6 @@ import vazkii.botania.client.gui.lexicon.button.GuiButtonBookmark;
import vazkii.botania.client.gui.lexicon.button.GuiButtonCategory;
import vazkii.botania.client.gui.lexicon.button.GuiButtonHistory;
import vazkii.botania.client.gui.lexicon.button.GuiButtonInvisible;
import vazkii.botania.client.gui.lexicon.button.GuiButtonLexicon;
import vazkii.botania.client.gui.lexicon.button.GuiButtonOptions;
import vazkii.botania.client.lib.LibResources;
import vazkii.botania.common.core.handler.SheddingHandler;
@@ -342,7 +341,7 @@ public class GuiLexicon extends GuiScreen {
}
if(isMainPage())
buttonList.add(new GuiButtonHistory(BOOKMARK_START + MAX_BOOKMARK_COUNT, left + 138, top + guiHeight - 24, StatCollector.translateToLocal("botaniamisc.history"), this));
buttonList.add(new GuiButtonHistory(BOOKMARK_START + MAX_BOOKMARK_COUNT, left + 138, top + guiHeight - 24, StatCollector.translateToLocal("botaniamisc.history"), this));
}
public static void startTutorial() {
@@ -11,9 +11,7 @@
package vazkii.botania.client.gui.lexicon;
import java.awt.Desktop;
import java.io.IOException;
import java.net.URI;
import java.net.URISyntaxException;
import java.util.List;
import net.minecraft.client.Minecraft;
@@ -147,7 +145,7 @@ public class GuiLexiconEntry extends GuiLexicon implements IGuiLexiconEntry, IPa
mc.ingameGUI.getChatGUI().addToSentMessages(cmd);
mc.thePlayer.sendChatMessage(cmd);
break;
case 4 :
case 4 :
try {
if(Desktop.isDesktopSupported())
Desktop.getDesktop().browse(new URI("http://botaniamod.net/lexicon.php#" + entry.unlocalizedName));
@@ -20,12 +20,12 @@ import vazkii.botania.api.lexicon.LexiconEntry;
public class GuiLexiconHistory extends GuiLexiconIndex {
public static List<LexiconEntry> history = new ArrayList();
public GuiLexiconHistory() {
super(null);
title = StatCollector.translateToLocal("botaniamisc.historyLong");
}
@Override
void buildEntries() {
entriesToDisplay.clear();
@@ -36,7 +36,7 @@ public class GuiLexiconHistory extends GuiLexiconIndex {
entriesToDisplay.add(entry);
}
}
public static void visit(LexiconEntry entry) {
if(history.contains(entry))
history.remove(entry);
@@ -27,7 +27,6 @@ import vazkii.botania.api.lexicon.ILexicon;
import vazkii.botania.api.lexicon.LexiconCategory;
import vazkii.botania.api.lexicon.LexiconEntry;
import vazkii.botania.client.core.handler.ClientTickHandler;
import vazkii.botania.client.gui.GuiBotaniaConfig;
import vazkii.botania.client.gui.lexicon.button.GuiButtonBack;
import vazkii.botania.client.gui.lexicon.button.GuiButtonInvisible;
import vazkii.botania.client.gui.lexicon.button.GuiButtonPage;
@@ -20,7 +20,7 @@ import vazkii.botania.client.core.helper.RenderHelper;
import vazkii.botania.client.gui.lexicon.GuiLexicon;
public class GuiButtonHistory extends GuiButtonLexicon {
GuiLexicon gui;
public GuiButtonHistory(int par1, int par2, int par3, String str, GuiLexicon gui) {
@@ -42,5 +42,5 @@ public class GuiButtonHistory extends GuiButtonLexicon {
if(k == 2)
RenderHelper.renderTooltip(par2, par3 + tooltipY, tooltip);
}
}
@@ -27,7 +27,7 @@ public class GuiButtonOptions extends GuiButtonLexicon {
public GuiButtonOptions(int id, int x, int y) {
super(id, x, y, 11, 11, "");
}
@Override
public void drawButton(Minecraft par1Minecraft, int par2, int par3) {
field_146123_n = par2 >= xPosition && par3 >= yPosition && par2 < xPosition + width && par3 < yPosition + height;
@@ -36,11 +36,11 @@ public class GuiButtonOptions extends GuiButtonLexicon {
par1Minecraft.renderEngine.bindTexture(GuiLexicon.texture);
GL11.glColor4f(1F, 1F, 1F, 1F);
drawTexturedModalRect(xPosition, yPosition, k == 2 ? 110 : 99, 180, 11, 11);
List<String> tooltip = new ArrayList();
for(int i = 0; i < 3; i++)
tooltip.add((i == 0 ? EnumChatFormatting.RED : EnumChatFormatting.GRAY) + StatCollector.translateToLocal("botaniamisc.lexiconOptions" + i));
tooltip.add((i == 0 ? EnumChatFormatting.RED : EnumChatFormatting.GRAY) + StatCollector.translateToLocal("botaniamisc.lexiconOptions" + i));
int tooltipY = (tooltip.size() - 1) * 10;
if(k == 2)
RenderHelper.renderTooltip(par2, par3 + tooltipY, tooltip);
@@ -27,7 +27,7 @@ public class GuiButtonViewOnline extends GuiButtonLexicon {
public GuiButtonViewOnline(int id, int x, int y) {
super(id, x, y, 11, 11, "");
}
@Override
public void drawButton(Minecraft par1Minecraft, int par2, int par3) {
field_146123_n = par2 >= xPosition && par3 >= yPosition && par2 < xPosition + width && par3 < yPosition + height;
@@ -33,7 +33,7 @@ public class ModelPump extends ModelBase{
for(float r = 0; r <= Math.PI * 2; r += Math.PI) {
ModelRenderer side = new ModelRenderer(this, 22, 0);
side.addBox(-4.0F, -4.0F, 7.0F, 8, 8, 1);
side.addBox(-4.0F, -4.0F, 7.0F, 8, 8, 1);
side.setRotationPoint(0.0F, 0.0F, 0.0F);
side.rotateAngleY = r;
main.addChild(side);
@@ -59,9 +59,9 @@ public class ModelPump extends ModelBase{
parts.add(main);
}
}
public void render(float ringPos) {
public void render(float ringPos) {
for(ModelRenderer iRing : innerRing)
iRing.rotationPointZ = ringPos;
@@ -10,21 +10,20 @@
*/
package vazkii.botania.client.render.entity;
import vazkii.botania.client.render.tile.RenderTilePool;
import vazkii.botania.common.entity.EntityPoolMinecart;
import net.minecraft.block.Block;
import net.minecraft.client.renderer.entity.RenderMinecart;
import net.minecraft.entity.ai.EntityMinecartMobSpawner;
import net.minecraft.entity.item.EntityMinecart;
import vazkii.botania.client.render.tile.RenderTilePool;
import vazkii.botania.common.entity.EntityPoolMinecart;
public class RenderPoolMinecart extends RenderMinecart {
@Override
protected void func_147910_a(EntityMinecart p_147910_1_, float p_147910_2_, Block p_147910_3_, int p_147910_4_) {
protected void func_147910_a(EntityMinecart p_147910_1_, float p_147910_2_, Block p_147910_3_, int p_147910_4_) {
EntityPoolMinecart poolCart = (EntityPoolMinecart) p_147910_1_;
RenderTilePool.forceManaNumber = poolCart.getMana();
super.func_147910_a(p_147910_1_, p_147910_2_, p_147910_3_, p_147910_4_);
}
super.func_147910_a(p_147910_1_, p_147910_2_, p_147910_3_, p_147910_4_);
}
}
@@ -76,7 +76,7 @@ public class RenderTilePool extends TileEntitySpecialRenderer {
int cap = pool.manaCap;
if(cap == -1)
cap = TilePool.MAX_MANA;
float waterLevel = (float) mana / (float) cap * 0.4F;
if(forceMana)
waterLevel = 0.4F;
@@ -10,7 +10,6 @@
*/
package vazkii.botania.common.block.dispenser;
import vazkii.botania.common.entity.EntityPoolMinecart;
import net.minecraft.block.Block;
import net.minecraft.block.BlockDispenser;
import net.minecraft.block.BlockRailBase;
@@ -18,10 +17,10 @@ import net.minecraft.block.material.Material;
import net.minecraft.dispenser.BehaviorDefaultDispenseItem;
import net.minecraft.dispenser.IBlockSource;
import net.minecraft.entity.item.EntityMinecart;
import net.minecraft.item.ItemMinecart;
import net.minecraft.item.ItemStack;
import net.minecraft.util.EnumFacing;
import net.minecraft.world.World;
import vazkii.botania.common.entity.EntityPoolMinecart;
public class BehaviourPoolMinecart extends BehaviorDefaultDispenseItem {
@@ -29,9 +28,9 @@ public class BehaviourPoolMinecart extends BehaviorDefaultDispenseItem {
public ItemStack dispenseStack(IBlockSource p_82487_1_, ItemStack p_82487_2_) {
EnumFacing enumfacing = BlockDispenser.func_149937_b(p_82487_1_.getBlockMetadata());
World world = p_82487_1_.getWorld();
double d0 = p_82487_1_.getX() + (double)((float)enumfacing.getFrontOffsetX() * 1.125F);
double d1 = p_82487_1_.getY() + (double)((float)enumfacing.getFrontOffsetY() * 1.125F);
double d2 = p_82487_1_.getZ() + (double)((float)enumfacing.getFrontOffsetZ() * 1.125F);
double d0 = p_82487_1_.getX() + enumfacing.getFrontOffsetX() * 1.125F;
double d1 = p_82487_1_.getY() + enumfacing.getFrontOffsetY() * 1.125F;
double d2 = p_82487_1_.getZ() + enumfacing.getFrontOffsetZ() * 1.125F;
int i = p_82487_1_.getXInt() + enumfacing.getFrontOffsetX();
int j = p_82487_1_.getYInt() + enumfacing.getFrontOffsetY();
int k = p_82487_1_.getZInt() + enumfacing.getFrontOffsetZ();
@@ -34,8 +34,8 @@ import vazkii.botania.common.lib.LibBlockNames;
public class BlockPump extends BlockModContainer implements ILexiconable {
private static final int[] META_ROTATIONS = new int[] { 2, 5, 3, 4 };
private static final int[] META_ROTATIONS = new int[] { 2, 5, 3, 4 };
public BlockPump() {
super(Material.rock);
setHardness(2.0F);
@@ -47,8 +47,8 @@ public class BlockPump extends BlockModContainer implements ILexiconable {
@Override
public void onBlockPlacedBy(World p_149689_1_, int p_149689_2_, int p_149689_3_, int p_149689_4_, EntityLivingBase p_149689_5_, ItemStack p_149689_6_) {
int l = MathHelper.floor_double((double)(p_149689_5_.rotationYaw * 4.0F / 360.0F) + 0.5D) & 3;
p_149689_1_.setBlockMetadataWithNotify(p_149689_2_, p_149689_3_, p_149689_4_, META_ROTATIONS[l], 2);
int l = MathHelper.floor_double(p_149689_5_.rotationYaw * 4.0F / 360.0F + 0.5D) & 3;
p_149689_1_.setBlockMetadataWithNotify(p_149689_2_, p_149689_3_, p_149689_4_, META_ROTATIONS[l], 2);
}
@Override
@@ -64,9 +64,9 @@ public class BlockPump extends BlockModContainer implements ILexiconable {
@Override
public boolean rotateBlock(World worldObj, int x, int y, int z, ForgeDirection axis) {
return RotationHelper.rotateVanillaBlock(Blocks.furnace, worldObj, x, y, z, axis);
return RotationHelper.rotateVanillaBlock(Blocks.furnace, worldObj, x, y, z, axis);
}
@Override
public void registerBlockIcons(IIconRegister par1IconRegister) {
// NO-OP
@@ -12,7 +12,6 @@ package vazkii.botania.common.block.subtile.functional;
import net.minecraft.block.Block;
import net.minecraft.block.material.Material;
import net.minecraft.init.Blocks;
import vazkii.botania.api.lexicon.LexiconEntry;
import vazkii.botania.api.subtile.SubTileFunctional;
import vazkii.botania.common.block.ModBlocks;
@@ -58,7 +58,7 @@ public class SubTileSpectranthemum extends SubTileFunctional {
Item sitem = stack.getItem();
if(sitem instanceof IManaItem)
continue;
int cost = stack.stackSize * COST;
if(mana >= cost) {
spawnExplosionParticles(item);
@@ -79,10 +79,10 @@ public class SubtileOrechid extends SubTileFunctional {
// and stick them in your behind.
if(clname.startsWith("gregtech") || clname.startsWith("gregapi"))
continue;
return stack;
}
return getOreToPut();
}
@@ -16,7 +16,6 @@ import net.minecraft.tileentity.TileEntity;
import net.minecraftforge.common.util.ForgeDirection;
import vazkii.botania.api.lexicon.LexiconEntry;
import vazkii.botania.api.subtile.ISubTileContainer;
import vazkii.botania.api.subtile.SubTileGenerating;
import vazkii.botania.common.Botania;
import vazkii.botania.common.lexicon.LexiconData;
import vazkii.botania.common.lib.LibMisc;
@@ -10,7 +10,6 @@
*/
package vazkii.botania.common.block.subtile.generating;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
@@ -22,7 +21,6 @@ import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.world.World;
import vazkii.botania.api.lexicon.LexiconEntry;
import vazkii.botania.api.subtile.SubTileGenerating;
import vazkii.botania.common.Botania;
import vazkii.botania.common.core.helper.ItemNBTHelper;
import vazkii.botania.common.lexicon.LexiconData;
@@ -33,7 +31,7 @@ public class SubTileHydroangeas extends SubTilePassiveGenerating {
private static final String TAG_COOLDOWN = "cooldown";
private static final int[][] OFFSETS = { { 0, 1 }, { 0, -1 }, { 1, 0 }, { -1, 0 }, { -1, 1 }, { -1, -1 }, { 1, 1 }, { 1, -1 } };
int burnTime, cooldown;
@Override
@@ -53,11 +51,11 @@ public class SubTileHydroangeas extends SubTilePassiveGenerating {
if(mana < getMaxMana() && !supertile.getWorldObj().isRemote) {
List<int[]> offsets = Arrays.asList(OFFSETS);
Collections.shuffle(offsets);
for(int[] offsetArray : offsets) {
int[] positions = {
supertile.xCoord + offsetArray[0],
supertile.zCoord + offsetArray[1]
supertile.xCoord + offsetArray[0],
supertile.zCoord + offsetArray[1]
};
if(supertile.getWorldObj().getBlock(positions[0], supertile.yCoord, positions[1]) == getBlockToSearchFor() && (getBlockToSearchBelow() == null || supertile.getWorldObj().getBlock(positions[0], supertile.yCoord - 1, positions[1]) == getBlockToSearchBelow()) && supertile.getWorldObj().getBlockMetadata(positions[0], supertile.yCoord, positions[1]) == 0) {
supertile.getWorldObj().setBlockToAir(positions[0], supertile.yCoord, positions[1]);
@@ -67,7 +65,7 @@ public class SubTileHydroangeas extends SubTilePassiveGenerating {
break;
}
}
}
} else {
if(supertile.getWorldObj().rand.nextInt(8) == 0)
@@ -140,7 +138,7 @@ public class SubTileHydroangeas extends SubTilePassiveGenerating {
int cooldown = this.cooldown;
if(burnTime > 0)
cooldown = getCooldown();
if(cooldown > 0)
ItemNBTHelper.setInt(drops.get(0), TAG_COOLDOWN, getCooldown());
}
@@ -32,7 +32,7 @@ public class SubTileMunchdew extends SubTileGenerating {
private static final String TAG_COOLDOWN = "cooldown";
private static final String TAG_ATE_ONCE = "ateOnce";
boolean ateOnce = false;
int ticksWithoutEating = -1;
int cooldown = 0;
@@ -46,7 +46,7 @@ public class SubTileMunchdew extends SubTileGenerating {
ticksWithoutEating = 0;
return;
}
int manaPerLeaf = 160;
eatLeaves : {
if(getMaxMana() - mana >= manaPerLeaf && !supertile.getWorldObj().isRemote && ticksExisted % 4 == 0) {
@@ -99,7 +99,7 @@ public class SubTileMunchdew extends SubTileGenerating {
if(ticksWithoutEating >= 5)
cooldown = 1600;
}
}
@Override
@@ -17,7 +17,7 @@ public class SubTileNightshade extends SubTileDaybloom {
@Override
public int getDelayBetweenPassiveGeneration() {
return (int) super.getDelayBetweenPassiveGeneration();
return super.getDelayBetweenPassiveGeneration();
}
@Override
@@ -26,14 +26,14 @@ public class SubTilePassiveGenerating extends SubTileGenerating {
public boolean isPassiveFlower() {
return true;
}
@Override
public ArrayList<ItemStack> getDrops(ArrayList<ItemStack> list) {
ArrayList<ItemStack> drops = super.getDrops(list);
populateDropStackNBTs(drops);
return drops;
}
public void populateDropStackNBTs(List<ItemStack> drops) {
if(isPassiveFlower() && ticksExisted > 0 && ConfigHandler.hardcorePassiveGeneration > 0)
ItemNBTHelper.setInt(drops.get(0), TAG_TICKS_EXISTED, ticksExisted);
@@ -44,5 +44,5 @@ public class SubTilePassiveGenerating extends SubTileGenerating {
super.onBlockPlacedBy(world, x, y, z, entity, stack);
ticksExisted = ItemNBTHelper.getInt(stack, TAG_TICKS_EXISTED, 0);
}
}
@@ -14,21 +14,21 @@ import net.minecraft.nbt.NBTTagCompound;
import vazkii.botania.common.block.tile.TileMod;
public class TilePump extends TileMod {
private static final String TAG_ACTIVE = "active";
public float innerRingPos;
public boolean active = false;
public boolean hasCart = false;
public float moving = 0F;
@Override
public void updateEntity() {
float max = 8F;
float min = 0F;
float incr = max / 10F;
if(innerRingPos < max && active && moving >= 0F) {
innerRingPos += incr;
moving = incr;
@@ -44,29 +44,29 @@ public class TilePump extends TileMod {
moving = 0F;
}
}
if(!hasCart && active)
setActive(false);
hasCart = false;
super.updateEntity();
}
@Override
public void writeCustomNBT(NBTTagCompound cmp) {
cmp.setBoolean(TAG_ACTIVE, active);
}
@Override
public void readCustomNBT(NBTTagCompound cmp) {
active = cmp.getBoolean(TAG_ACTIVE);
}
public void setActive(boolean active) {
if(!worldObj.isRemote) {
this.active = active;
worldObj.markBlockForUpdate(xCoord, yCoord, zCoord);
worldObj.markBlockForUpdate(xCoord, yCoord, zCoord);
}
}
}
@@ -88,7 +88,7 @@ public final class ConfigHandler {
desc = "Set this to true to enable justified text in the Lexica Botania's text pages.";
lexiconJustifiedText = loadPropBool("lexicon.enable.justifiedText", desc, lexiconJustifiedText);
desc = "Set this to true to set the power system's particles to be a lot more subtle. Good for low-end systems, if the particles are causing lag.";
subtlePowerSystem = loadPropBool("powerSystem.subtle", desc, subtlePowerSystem);
@@ -163,7 +163,7 @@ public final class ConfigHandler {
desc = "Set this to false to disable the Mana Fluxfield (generates RF from mana). This only disables the entry and creation. Old ones that are already in the world will stay.";
fluxfieldEnabled = loadPropBool("manaFluxfield.enabled", desc, fluxfieldEnabled);
desc = "The quantity of Botania flower patches to generate in the world, defaults to 2, the lower the number the less patches generate.";
flowerQuantity = loadPropInt("worldgen.flower.quantity", desc, flowerQuantity);
@@ -10,18 +10,18 @@
*/
package vazkii.botania.common.core.proxy;
import org.apache.logging.log4j.Level;
import net.minecraft.block.Block;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.player.EntityPlayerMP;
import net.minecraft.item.ItemDoublePlant;
import net.minecraft.item.ItemStack;
import net.minecraft.server.MinecraftServer;
import net.minecraft.util.MovingObjectPosition;
import net.minecraft.util.StatCollector;
import net.minecraft.world.World;
import net.minecraftforge.common.MinecraftForge;
import org.apache.logging.log4j.Level;
import vazkii.botania.api.BotaniaAPI;
import vazkii.botania.api.lexicon.ITwoNamedPage;
import vazkii.botania.api.lexicon.LexiconEntry;
@@ -127,17 +127,17 @@ public class CommonProxy {
LexiconData.postInit();
registerNEIStuff();
int words = 0;
for(LexiconEntry entry : BotaniaAPI.getAllEntries())
for(LexiconPage page : entry.pages) {
words += countWords(page.getUnlocalizedName());
if(page instanceof ITwoNamedPage)
words += countWords(((ITwoNamedPage) page).getSecondUnlocalizedName());
words += countWords(((ITwoNamedPage) page).getSecondUnlocalizedName());
}
FMLLog.log(Level.INFO, "[Botania] The Lexica Botania has %d words.", words);
}
private int countWords(String s) {
String s1 = StatCollector.translateToLocal(s);
return s1.split(" ").length;
@@ -1279,7 +1279,7 @@ public final class ModCraftingRecipes {
'S', LibOreDict.LIVING_ROCK,
'M', LibOreDict.MANA_STEEL,
'R', new ItemStack(Blocks.redstone_block));
recipeRFGenerator = BotaniaAPI.getLatestAddedRecipe();
recipeRFGenerator = BotaniaAPI.getLatestAddedRecipe();
}
// Vial Recipe
@@ -1595,30 +1595,30 @@ public final class ModCraftingRecipes {
// Horn of the Covering Recipe
addShapelessOreDictRecipe(new ItemStack(ModItems.grassHorn, 1, 2), new ItemStack(ModItems.grassHorn), new ItemStack(Items.snowball));
recipeSnowHorn = BotaniaAPI.getLatestAddedRecipe();
// Flower Pouch Recipe
GameRegistry.addShapedRecipe(new ItemStack(ModItems.flowerBag),
GameRegistry.addShapedRecipe(new ItemStack(ModItems.flowerBag),
"WPW", "W W", " W ",
'P', new ItemStack(ModItems.petal, 1, Short.MAX_VALUE),
'W', new ItemStack(Blocks.wool, 1, Short.MAX_VALUE));
recipeFlowerBag = BotaniaAPI.getLatestAddedRecipe();
// Phantom Ink Recipe
addShapelessOreDictRecipe(new ItemStack(ModItems.phantomInk, 4), LibOreDict.MANA_PEARL, new ItemStack(Items.dye), new ItemStack(Blocks.glass), new ItemStack(Items.glass_bottle), new ItemStack(Items.glass_bottle), new ItemStack(Items.glass_bottle), new ItemStack(Items.glass_bottle));
recipePhantomInk = BotaniaAPI.getLatestAddedRecipe();
// Minecart with Mana Pool Recipe
GameRegistry.addShapelessRecipe(new ItemStack(ModItems.poolMinecart), new ItemStack(Items.minecart), new ItemStack(ModBlocks.pool));
recipePoolCart = BotaniaAPI.getLatestAddedRecipe();
// Mana Pump Recipe
addOreDictRecipe(new ItemStack(ModBlocks.pump),
addOreDictRecipe(new ItemStack(ModBlocks.pump),
"SSS", "IBI", "SSS",
'S', LibOreDict.LIVING_ROCK,
'I', LibOreDict.MANA_STEEL,
'B', new ItemStack(Items.bucket));
recipePump = BotaniaAPI.getLatestAddedRecipe();
// Storage Block Recipes
addOreDictRecipe(new ItemStack(ModBlocks.storage, 1, 0),
"III", "III", "III",
@@ -10,13 +10,12 @@
*/
package vazkii.botania.common.crafting.recipe;
import vazkii.botania.api.item.IAncientWillContainer;
import vazkii.botania.api.item.IPhantomInkable;
import vazkii.botania.common.item.ModItems;
import net.minecraft.inventory.InventoryCrafting;
import net.minecraft.item.ItemStack;
import net.minecraft.item.crafting.IRecipe;
import net.minecraft.world.World;
import vazkii.botania.api.item.IPhantomInkable;
import vazkii.botania.common.item.ModItems;
public class PhantomInkRecipe implements IRecipe {
@@ -25,12 +25,10 @@ import vazkii.botania.common.block.tile.mana.TilePump;
import vazkii.botania.common.lib.LibMisc;
public class EntityPoolMinecart extends EntityMinecart {
private static final int TRANSFER_RATE = 10000;
private static final String TAG_MANA = "mana";
private boolean isBlocked = true;
public EntityPoolMinecart(World p_i1712_1_) {
super(p_i1712_1_);
}
@@ -38,11 +36,12 @@ public class EntityPoolMinecart extends EntityMinecart {
public EntityPoolMinecart(World p_i1715_1_, double p_i1715_2_, double p_i1715_4_, double p_i1715_6_) {
super(p_i1715_1_, p_i1715_2_, p_i1715_4_, p_i1715_6_);
}
protected void entityInit() {
super.entityInit();
dataWatcher.addObject(16, 0);
}
@Override
protected void entityInit() {
super.entityInit();
dataWatcher.addObject(16, 0);
}
@Override
public Block func_145817_o() {
@@ -57,7 +56,7 @@ public class EntityPoolMinecart extends EntityMinecart {
@Override
public void killMinecart(DamageSource p_94095_1_) {
super.killMinecart(p_94095_1_);
this.func_145778_a(Item.getItemFromBlock(ModBlocks.pool), 1, 0.0F);
func_145778_a(Item.getItemFromBlock(ModBlocks.pool), 1, 0.0F);
}
@Override
@@ -68,7 +67,7 @@ public class EntityPoolMinecart extends EntityMinecart {
@Override
public void moveMinecartOnRail(int x, int y, int z, double par4) {
super.moveMinecartOnRail(x, y, z, par4);
for(ForgeDirection dir : LibMisc.CARDINAL_DIRECTIONS) {
int xp = x + dir.offsetX;
int zp = z + dir.offsetZ;
@@ -82,7 +81,7 @@ public class EntityPoolMinecart extends EntityMinecart {
IManaPool pool = (IManaPool) tile;
ForgeDirection pumpDir = ForgeDirection.getOrientation(meta);
boolean did = false;
if(pumpDir == dir) { // Pool -> Cart
int cartMana = getMana();
int poolMana = pool.getCurrentMana();
@@ -99,10 +98,10 @@ public class EntityPoolMinecart extends EntityMinecart {
if(transfer > 0) {
pool.recieveMana(transfer);
setMana(cartMana - transfer);
did = true;
did = true;
}
}
if(did) {
worldObj.markBlockForUpdate(xp_, y, zp_);
TileEntity tile_ = worldObj.getTileEntity(xp, y, zp);
@@ -117,25 +116,25 @@ public class EntityPoolMinecart extends EntityMinecart {
}
}
}
@Override
protected void writeEntityToNBT(NBTTagCompound p_70014_1_) {
super.writeEntityToNBT(p_70014_1_);
p_70014_1_.setInteger(TAG_MANA, getMana());
}
@Override
protected void readEntityFromNBT(NBTTagCompound p_70037_1_) {
super.readEntityFromNBT(p_70037_1_);
setMana(p_70037_1_.getInteger(TAG_MANA));
}
protected void writeEntityToNBT(NBTTagCompound p_70014_1_) {
super.writeEntityToNBT(p_70014_1_);
p_70014_1_.setInteger(TAG_MANA, getMana());
}
@Override
protected void readEntityFromNBT(NBTTagCompound p_70037_1_) {
super.readEntityFromNBT(p_70037_1_);
setMana(p_70037_1_.getInteger(TAG_MANA));
}
public int getMana() {
return dataWatcher.getWatchableObjectInt(16);
}
public void setMana(int mana) {
dataWatcher.updateObject(16, mana);
}
}
@@ -197,7 +197,7 @@ public class EntitySpark extends Entity implements ISparkEntity {
removeTransferants--;
getTransfers();
}
void particlesTowards(Entity e) {
Vector3 thisVec = Vector3.fromEntityCenter(this).add(0, 0, 0);
Vector3 receiverVec = Vector3.fromEntityCenter(e).add(0, 0, 0);
@@ -23,11 +23,10 @@ import vazkii.botania.common.block.ModBlocks;
import vazkii.botania.common.core.helper.ItemNBTHelper;
import vazkii.botania.common.lib.LibGuiIDs;
import vazkii.botania.common.lib.LibItemNames;
import cpw.mods.fml.common.FMLCommonHandler;
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
public class ItemFlowerBag extends ItemMod {
private static final String TAG_ITEMS = "InvItems";
private static final String TAG_SLOT = "Slot";
@@ -36,7 +35,7 @@ public class ItemFlowerBag extends ItemMod {
setMaxStackSize(1);
MinecraftForge.EVENT_BUS.register(this);
}
@SubscribeEvent
public void onPickupItem(EntityItemPickupEvent event) {
ItemStack stack = event.item.getEntityItem();
@@ -44,11 +43,11 @@ public class ItemFlowerBag extends ItemMod {
int color = stack.getItemDamage();
if(color > 15)
return;
for(int i = 0; i < event.entityPlayer.inventory.getSizeInventory(); i++) {
if(i == event.entityPlayer.inventory.currentItem)
continue; // prevent item deletion
ItemStack invStack = event.entityPlayer.inventory.getStackInSlot(i);
if(invStack != null && invStack.getItem() == this) {
ItemStack[] bagInv = loadStacks(invStack);
@@ -69,23 +68,23 @@ public class ItemFlowerBag extends ItemMod {
didChange = true;
}
}
if(didChange)
setStacks(invStack, bagInv);
}
if(stack.stackSize == 0)
return;
}
}
}
@Override
public ItemStack onItemRightClick(ItemStack stack, World world, EntityPlayer player) {
player.openGui(Botania.instance, LibGuiIDs.FLOWER_BAG, world, 0, 0, 0);
return stack;
}
public static ItemStack[] loadStacks(ItemStack stack) {
NBTTagList var2 = ItemNBTHelper.getList(stack, TAG_ITEMS, 10, false);
ItemStack[] inventorySlots = new ItemStack[16];
@@ -95,10 +94,10 @@ public class ItemFlowerBag extends ItemMod {
if(var5 >= 0 && var5 < inventorySlots.length)
inventorySlots[var5] = ItemStack.loadItemStackFromNBT(var4);
}
return inventorySlots;
}
public static void setStacks(ItemStack stack, ItemStack[] inventorySlots) {
NBTTagList var2 = new NBTTagList();
for(int var3 = 0; var3 < inventorySlots.length; ++var3)
@@ -108,8 +107,8 @@ public class ItemFlowerBag extends ItemMod {
inventorySlots[var3].writeToNBT(var4);
var2.appendTag(var4);
}
ItemNBTHelper.setList(stack, TAG_ITEMS, var2);
}
}
@@ -113,7 +113,7 @@ public class ItemGrassHorn extends ItemMod {
int z = srcz + j;
Block block = world.getBlock(x, y, z);
if((stackDmg == 0 && block instanceof BlockBush && !(block instanceof ISpecialFlower) && (!(block instanceof IGrassHornExcempt) || ((IGrassHornExcempt) block).canUproot(world, x, y, z))) || (stackDmg == 1 && block instanceof BlockLeavesBase) || (stackDmg == 2 && block == Blocks.snow_layer))
if(stackDmg == 0 && block instanceof BlockBush && !(block instanceof ISpecialFlower) && (!(block instanceof IGrassHornExcempt) || ((IGrassHornExcempt) block).canUproot(world, x, y, z)) || stackDmg == 1 && block instanceof BlockLeavesBase || stackDmg == 2 && block == Blocks.snow_layer)
coords.add(new ChunkCoordinates(x, y, z));
}
@@ -12,7 +12,6 @@ package vazkii.botania.common.item;
import net.minecraftforge.oredict.RecipeSorter;
import net.minecraftforge.oredict.RecipeSorter.Category;
import vazkii.botania.common.crafting.recipe.ManaGunLensRecipe;
import vazkii.botania.common.crafting.recipe.PhantomInkRecipe;
import vazkii.botania.common.lib.LibItemNames;
import cpw.mods.fml.common.registry.GameRegistry;
@@ -24,5 +23,5 @@ public class ItemPhantomInk extends ItemMod {
GameRegistry.addRecipe(new PhantomInkRecipe());
RecipeSorter.register("botania:phantomInk", PhantomInkRecipe.class, Category.SHAPELESS, "");
}
}
@@ -10,13 +10,13 @@
*/
package vazkii.botania.common.item;
import vazkii.botania.common.entity.EntityPoolMinecart;
import vazkii.botania.common.lib.LibItemNames;
import net.minecraft.block.BlockRailBase;
import net.minecraft.entity.item.EntityMinecart;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.world.World;
import vazkii.botania.common.entity.EntityPoolMinecart;
import vazkii.botania.common.lib.LibItemNames;
public class ItemPoolMinecart extends ItemMod {
@@ -24,7 +24,7 @@ public class ItemPoolMinecart extends ItemMod {
setMaxStackSize(1);
setUnlocalizedName(LibItemNames.POOL_MINECART);
}
@Override
public boolean onItemUse(ItemStack p_77648_1_, EntityPlayer p_77648_2_, World p_77648_3_, int p_77648_4_, int p_77648_5_, int p_77648_6_, int p_77648_7_, float p_77648_8_, float p_77648_9_, float p_77648_10_) {
if(BlockRailBase.func_150051_a(p_77648_3_.getBlock(p_77648_4_, p_77648_5_, p_77648_6_))) {
@@ -40,7 +40,7 @@ public class ItemPoolMinecart extends ItemMod {
--p_77648_1_.stackSize;
return true;
}
return false;
}
@@ -330,7 +330,7 @@ public final class ModItems {
flowerBag = new ItemFlowerBag();
phantomInk = new ItemPhantomInk();
poolMinecart = new ItemPoolMinecart();
OreDictionary.registerOre(LibOreDict.LEXICON, lexicon);
for(int i = 0; i < 16; i++) {
OreDictionary.registerOre(LibOreDict.PETAL[i], new ItemStack(petal, 1, i));
@@ -2,7 +2,6 @@ package vazkii.botania.common.item.equipment.armor.elementium;
import java.util.List;
import net.minecraft.entity.Entity;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.util.StatCollector;
@@ -44,7 +44,7 @@ public class ItemManasteelArmor extends ItemArmor implements ISpecialArmor, IMan
private static final int MANA_PER_DAMAGE = 70;
private static final String TAG_PHANTOM_INK = "phantomInk";
public ItemManasteelArmor(int type, String name) {
this(type, name, BotaniaAPI.manasteelArmorMaterial);
}
@@ -103,7 +103,7 @@ public class ItemManasteelArmor extends ItemArmor implements ISpecialArmor, IMan
public final String getArmorTexture(ItemStack stack, Entity entity, int slot, String type) {
return hasPhantomInk(stack) ? LibResources.MODEL_INVISIBLE_ARMOR : getArmorTextureAfterInk(stack, slot);
}
public String getArmorTextureAfterInk(ItemStack stack, int slot) {
return slot == 2 ? LibResources.MODEL_MANASTEEL_1 : LibResources.MODEL_MANASTEEL_0;
}
@@ -12,7 +12,6 @@ package vazkii.botania.common.item.equipment.armor.terrasteel;
import java.util.List;
import net.minecraft.entity.Entity;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.util.StatCollector;
@@ -10,7 +10,6 @@
*/
package vazkii.botania.common.item.interaction.thaumcraft;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.item.ItemStack;
import thaumcraft.api.IGoggles;
@@ -10,7 +10,6 @@
*/
package vazkii.botania.common.item.interaction.thaumcraft;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.item.ItemStack;
import thaumcraft.api.IGoggles;
@@ -10,7 +10,6 @@
*/
package vazkii.botania.common.item.interaction.thaumcraft;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.item.ItemStack;
import thaumcraft.api.IGoggles;
@@ -13,7 +13,6 @@ package vazkii.botania.common.lexicon;
import java.util.ArrayList;
import java.util.List;
import baubles.common.Config;
import net.minecraft.init.Blocks;
import net.minecraft.init.Items;
import net.minecraft.item.ItemStack;
@@ -87,7 +86,7 @@ public final class LexiconData {
public static LexiconEntry rfGenerator;
public static LexiconEntry prism;
public static LexiconEntry poolCart;
public static LexiconEntry functionalIntro;
public static LexiconEntry jadedAmaranthus;
public static LexiconEntry bellethorne;
@@ -298,7 +297,7 @@ public final class LexiconData {
flowerBag = new BLexiconEntry(LibLexicon.BASICS_FLOWER_BAG, categoryBasics);
flowerBag.setLexiconPages(new PageText("0"), new PageCraftingRecipe("1", ModCraftingRecipes.recipeFlowerBag));
if(Botania.thaumcraftLoaded)
new BLexiconEntry("wrap", categoryBasics).setLexiconPages(new PageText("0")); // lel
@@ -320,7 +319,7 @@ public final class LexiconData {
if(ConfigHandler.fluxfieldEnabled) {
rfGenerator = new BLexiconEntry(LibLexicon.MANA_RF_GENERATOR, categoryMana);
rfGenerator.setLexiconPages(new PageText("0"), new PageCraftingRecipe("1", ModCraftingRecipes.recipeRFGenerator));
rfGenerator.setLexiconPages(new PageText("0"), new PageCraftingRecipe("1", ModCraftingRecipes.recipeRFGenerator));
}
lenses = new BLexiconEntry(LibLexicon.MANA_LENSES, categoryMana);
@@ -353,7 +352,7 @@ public final class LexiconData {
manaMirror = new BLexiconEntry(LibLexicon.MANA_MIRROR, categoryMana);
manaMirror.setLexiconPages(new PageText("0"), new PageCraftingRecipe("1", ModCraftingRecipes.recipeManaMirror));
manaDetector = new BLexiconEntry(LibLexicon.MANA_DETECTOR, categoryMana);
manaDetector.setLexiconPages(new PageText("0"), new PageCraftingRecipe("1", ModCraftingRecipes.recipeManaDetector));
@@ -377,7 +376,7 @@ public final class LexiconData {
poolCart = new BLexiconEntry(LibLexicon.MANA_POOL_CART, categoryMana);
poolCart.setLexiconPages(new PageText("0"), new PageText("1"), new PageText("2"), new PageCraftingRecipe("3", ModCraftingRecipes.recipePoolCart), new PageCraftingRecipe("4", ModCraftingRecipes.recipePump));
// FUNCTIONAL FLOWERS ENTRIES
functionalIntro = new BLexiconEntry(LibLexicon.FFLOWER_INTRO, categoryFunctionalFlowers);
functionalIntro.setPriority().setLexiconPages(new PageText("0"), new PageText("1"), new PageText("2"), new PageText("3"), new PageCraftingRecipe("4", ModCraftingRecipes.recipeRedstoneRoot)).setIcon(null);;
@@ -853,7 +852,7 @@ public final class LexiconData {
phantomInk = new BLexiconEntry(LibLexicon.MISC_PHANTOM_INK, categoryMisc);
phantomInk.setLexiconPages(new PageText("0"), new PageCraftingRecipe("1", ModCraftingRecipes.recipePhantomInk));
if(Botania.bcTriggersLoaded) {
bcIntegration = new BLexiconEntry(LibLexicon.MISC_BC_INTEGRATION, categoryMisc);
bcIntegration.setLexiconPages(new PageText("0")).setIcon(new ItemStack(Items.redstone));
@@ -46,15 +46,15 @@ public class PageText extends LexiconPage {
x += 2;
y += 10;
width -= 4;
FontRenderer font = Minecraft.getMinecraft().fontRenderer;
boolean unicode = font.getUnicodeFlag();
font.setUnicodeFlag(true);
String text = StatCollector.translateToLocal(unlocalizedText).replaceAll("&", "\u00a7");
String[] textEntries = text.split("<br>");
List<List<String>> lines = new ArrayList();
String controlCodes = "";
for(String s : textEntries) {
List<String> words = new ArrayList();
@@ -65,7 +65,6 @@ public class PageText extends LexiconPage {
String spaced = token + " ";
lineStr += spaced;
if(font.getStringWidth(lineStr) > width) {
String addLine = toControlCodes(controlCodes) + prev;
lines.add(words);
lineStr = spaced;
words = new ArrayList();
@@ -73,7 +72,7 @@ public class PageText extends LexiconPage {
controlCodes = getControlCodes(prev);
words.add(toControlCodes(controlCodes) + token);
}
if(!lineStr.isEmpty())
lines.add(words);
lines.add(new ArrayList());
@@ -81,22 +80,22 @@ public class PageText extends LexiconPage {
int i = 0;
for(List<String> words : lines) {
int count = words.size();
words.size();
int xi = x;
int spacing = 4;
int wcount = words.size();
int compensationSpaces = 0;
boolean justify = ConfigHandler.lexiconJustifiedText && wcount > 0 && (lines.size() > i && !lines.get(i + 1).isEmpty());
boolean justify = ConfigHandler.lexiconJustifiedText && wcount > 0 && lines.size() > i && !lines.get(i + 1).isEmpty();
if(justify) {
String s = Joiner.on("").join(words);
int swidth = font.getStringWidth(s);
int space = width - swidth;
spacing = space / (wcount - 1);
compensationSpaces = space % (wcount - 1);
}
for(String s : words) {
int extra = 0;
if(compensationSpaces > 0) {
@@ -106,20 +105,20 @@ public class PageText extends LexiconPage {
font.drawString(s, xi, y, 0);
xi += font.getStringWidth(s) + spacing + extra;
}
y += 10;
i++;
}
font.setUnicodeFlag(unicode);
}
public static String getControlCodes(String s) {
String controls = s.replaceAll("(?<!\u00a7)(.)", "");
String wiped = controls.replaceAll(".*r", "r");
return wiped;
}
public static String toControlCodes(String s) {
return s.replaceAll(".", "\u00a7$0");
}