Some cleanup...

This commit is contained in:
Lizbeth Rika committed 2015-06-29 20:13:45 +01:00
1 parent 64109d9fcc
commit 49ed5a9d50
77 files changed
+341 -394

No files matched your search

@@ -462,9 +462,9 @@ public final class BotaniaAPI {
* https://gist.github.com/Vazkii/9493322
*/
public static void addOreWeightNether(String ore, int weight) {
if(ore.contains("Nether") && OreDictionary.getOres(ore.replace("Nether", "")).size() == 0)
return;
if(ore.contains("Nether") && OreDictionary.getOres(ore.replace("Nether", "")).size() == 0)
return;
oreWeightsNether.put(ore, weight);
}
@@ -30,7 +30,7 @@ public final class CorporeaHelper {
private static final List<IInventory> empty = Collections.unmodifiableList(new ArrayList());
private static final WeakHashMap<List<ICorporeaSpark>, List<IInventory>> cachedNetworks = new WeakHashMap();
private static final List<ICorporeaAutoCompleteController> autoCompleteControllers = new ArrayList<ICorporeaAutoCompleteController>();
public static final String[] WILDCARD_STRINGS = new String[] {
"...", "~", "+", "?" , "*"
};
@@ -215,7 +215,7 @@ public final class CorporeaHelper {
count -= rem;
}
}
if(removedAny)
inv.markDirty();
}
@@ -10,12 +10,8 @@
*/
package vazkii.botania.api.corporea;
import java.util.List;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import net.minecraft.inventory.IInventory;
import net.minecraft.item.ItemStack;
/**
* An interface for systems which may control if the item auto complete system should be active
@@ -104,7 +104,7 @@ public class DummyMethodHandler implements IInternalMethodHandler {
public LexiconPage brewPage(String key, String bottomText, RecipeBrew recipe) {
return dummyPage(key);
}
@Override
public LexiconPage multiblockPage(String key, MultiblockSet mb) {
return dummyPage(key);
@@ -199,7 +199,7 @@ public class DummyMethodHandler implements IInternalMethodHandler {
public long getWorldElapsedTicks() {
return 0;
}
@Override
public boolean isBotaniaFlower(World world, int x, int y, int z) {
return false;
@@ -72,7 +72,7 @@ public interface IInternalMethodHandler {
public LexiconPage brewPage(String key, String bottomText, RecipeBrew recipe);
public LexiconPage multiblockPage(String key, MultiblockSet mb);
public IManaNetwork getManaNetworkInstance();
public ItemStack getSubTileAsStack(String subTile);
@@ -108,9 +108,9 @@ public interface IInternalMethodHandler {
public boolean isBuildcraftPipe(TileEntity tile);
public void sparkleFX(World world, double x, double y, double z, float r, float g, float b, float size, int m);
public long getWorldElapsedTicks();
public boolean isBotaniaFlower(World world, int x, int y, int z);
}
@@ -63,11 +63,11 @@ public interface IManaBurst {
public int getTicksExisted();
public void setFake(boolean fake);
public void setShooterUUID(UUID uuid);
public UUID getShooterUIID();
public void ping();
}
@@ -16,7 +16,6 @@ import java.util.Map;
import net.minecraft.block.Block;
import net.minecraft.client.renderer.RenderBlocks;
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;
/**
* A hook for rendering blocks in the multiblock display.
@@ -24,7 +23,7 @@ import net.minecraft.world.World;
public interface IMultiblockRenderHook {
public static Map<Block, IMultiblockRenderHook> renderHooks = new HashMap();
public void renderBlockForMultiblock(IBlockAccess world, Multiblock mb, Block block, int meta, RenderBlocks renderBlocks);
}
@@ -24,15 +24,15 @@ import vazkii.botania.api.lexicon.multiblock.component.MultiblockComponent;
* look in the world.
*/
public class Multiblock {
public List<MultiblockComponent> components = new ArrayList();
public List<ItemStack> materials = new ArrayList();
public int minX, minY, minZ, maxX, maxY, maxZ, offX, offY, offZ;
/**
* Adds a multiblock component to this multiblock. The component's x y z
* coords should be pivoted to the center of the structure.
* coords should be pivoted to the center of the structure.
*/
public void addComponent(MultiblockComponent component) {
components.add(component);
@@ -47,54 +47,54 @@ public class Multiblock {
public void addComponent(int x, int y, int z, Block block, int meta) {
addComponent(new MultiblockComponent(new ChunkCoordinates(x, y, z), block, meta));
}
private void changeAxisForNewComponent(int x, int y, int z) {
if(x < minX)
minX = x;
else if(x > maxX)
maxX = x;
if(y < minY)
minY = y;
else if(y > maxY)
maxY = y;
if(z < minZ)
minZ = z;
else if(z > maxZ)
maxZ = z;
}
private void calculateCostForNewComponent(MultiblockComponent comp) {
ItemStack[] materials = comp.getMaterials();
if(materials != null)
for(ItemStack stack : materials)
addStack(stack);
}
private void addStack(ItemStack stack) {
if(stack == null)
return;
for(ItemStack oStack : materials)
if(oStack.isItemEqual(stack) && ItemStack.areItemStackTagsEqual(oStack, stack)) {
oStack.stackSize += stack.stackSize;
return;
}
materials.add(stack);
}
public void setRenderOffset(int x, int y, int z) {
offX = x;
offY = y;
offZ = z;
}
public List<MultiblockComponent> getComponents() {
return components;
}
/**
* Rotates this multiblock by the angle passed in. For the best results, use
* only multiples of pi/2.
@@ -103,19 +103,19 @@ public class Multiblock {
for(MultiblockComponent comp : getComponents())
comp.rotate(angle);
}
public Multiblock copy() {
Multiblock mb = new Multiblock();
for(MultiblockComponent comp : getComponents())
mb.addComponent(comp.copy());
return mb;
}
/**
* Creates a length 4 array of all the rotations multiple of pi/2 required
* to render this multiblock in the world relevant to the 4 cardinal
* orientations.
* orientations.
*/
public Multiblock[] createRotations() {
Multiblock[] blocks = new Multiblock[4];
@@ -126,10 +126,10 @@ public class Multiblock {
blocks[2].rotate(Math.PI / 2);
blocks[3] = blocks[2].copy();
blocks[3].rotate(Math.PI / 2);
return blocks;
}
/**
* Makes a MultiblockSet from this Multiblock and its rotations using
* createRotations().
@@ -137,7 +137,7 @@ public class Multiblock {
public MultiblockSet makeSet() {
return new MultiblockSet(this);
}
public int getXSize() {
return Math.abs(minX) + Math.abs(maxX) + 1;
}
@@ -145,9 +145,9 @@ public class Multiblock {
public int getYSize() {
return Math.abs(minY) + Math.abs(maxY) + 1;
}
public int getZSize() {
return Math.abs(minZ) + Math.abs(maxZ) + 1;
}
}
@@ -33,7 +33,7 @@ public class MultiblockSet {
}
public Multiblock getForRotation(double rotation) {
int facing = MathHelper.floor_double((rotation * 4.0 / 360.0) + 0.5) & 3;
int facing = MathHelper.floor_double(rotation * 4.0 / 360.0 + 0.5) & 3;
return getForIndex(facing);
}
@@ -11,13 +11,9 @@
package vazkii.botania.api.lexicon.multiblock.component;
import net.minecraft.block.Block;
import net.minecraft.init.Blocks;
import net.minecraft.util.ChunkCoordinates;
import net.minecraft.world.World;
import vazkii.botania.api.BotaniaAPI;
import vazkii.botania.common.Botania;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
/**
* A multiblock component that switches through the 16 colors of the
@@ -28,17 +24,17 @@ public class ColorSwitchingComponent extends MultiblockComponent {
public ColorSwitchingComponent(ChunkCoordinates relPos, Block block) {
super(relPos, block, -1);
}
@Override
public int getMeta() {
return (int) (BotaniaAPI.internalHandler.getWorldElapsedTicks() / 20) % 16;
}
@Override
public boolean matches(World world, int x, int y, int z) {
return world.getBlock(x, y, z) == getBlock();
}
@Override
public MultiblockComponent copy() {
return new ColorSwitchingComponent(relPos, block);
@@ -10,10 +10,10 @@
*/
package vazkii.botania.api.lexicon.multiblock.component;
import vazkii.botania.api.BotaniaAPI;
import net.minecraft.block.Block;
import net.minecraft.util.ChunkCoordinates;
import net.minecraft.world.World;
import vazkii.botania.api.BotaniaAPI;
/**
* A multiblock component that matches any botania flower.
@@ -23,12 +23,12 @@ public class FlowerComponent extends ColorSwitchingComponent {
public FlowerComponent(ChunkCoordinates relPos, Block block) {
super(relPos, block);
}
@Override
public boolean matches(World world, int x, int y, int z) {
return BotaniaAPI.internalHandler.isBotaniaFlower(world, x, y, z);
}
@Override
public MultiblockComponent copy() {
return new FlowerComponent(relPos, block);
@@ -24,44 +24,44 @@ public class MultiblockComponent {
public ChunkCoordinates relPos;
public final Block block;
public final int meta;
public MultiblockComponent(ChunkCoordinates relPos, Block block, int meta) {
this.relPos = relPos;
this.block = block;
this.meta = meta;
}
public ChunkCoordinates getRelativePosition() {
return relPos;
}
public Block getBlock() {
return block;
}
public int getMeta() {
return meta;
}
public boolean matches(World world, int x, int y, int z) {
return world.getBlock(x, y, z) == getBlock() && (meta == -1 || world.getBlockMetadata(x, y, z) == meta);
}
public ItemStack[] getMaterials() {
return new ItemStack[] { new ItemStack(block, 1, meta) };
}
public void rotate(double angle) {
double x = relPos.posX;
double z = relPos.posZ;
double sin = Math.sin(angle);
double cos = Math.cos(angle);
double xn = x * cos - z * sin;
double zn = x * sin + z * cos;
relPos = new ChunkCoordinates((int) Math.round(xn), relPos.posY, (int) Math.round(zn));
}
public MultiblockComponent copy() {
return new MultiblockComponent(relPos, block, meta);
}
@@ -17,7 +17,7 @@ import java.util.UUID;
* an UUID. This UUID must presist between sessions.
*/
public interface IIdentifiable {
public UUID getIdentifier();
}
@@ -23,9 +23,9 @@ public interface IPingable extends IIdentifiable {
/**
* Pings this object back, telling it that the burst passed in is still alive
* in the world. The UUID parameter should be the UUID with which the burst
* was created, this is used to let the object handle the check for if it's the
* was created, this is used to let the object handle the check for if it's the
* correct ID internally. IManaBurst implementations should do this every tick.
*/
public void pingback(IManaBurst burst, UUID expectedIdentity);
}
@@ -192,7 +192,7 @@ public class SubTileEntity {
public void renderHUD(Minecraft mc, ScaledResolution res) {
// NO-OP
}
/**
* Gets the light value for this SubTileEntity, this is a int (-1 to default to the flower)
*/
@@ -214,5 +214,5 @@ public class SubTileEntity {
return 0;
}
}
@@ -14,7 +14,7 @@ import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
public class Challenge {
public final String unlocalizedName;
public final ItemStack icon;
public final EnumChallengeLevel level;
@@ -25,13 +25,13 @@ public class Challenge {
this.icon = icon;
this.level = level;
}
public void writeToNBT(NBTTagCompound cmp) {
cmp.setBoolean(unlocalizedName, complete);
}
public void readFromNBT(NBTTagCompound cmp) {
complete = cmp.getBoolean(unlocalizedName);
}
}
@@ -18,7 +18,7 @@ public enum EnumChallengeLevel {
LUNATIC("botania.challengelevel.lunatic");
String name;
private EnumChallengeLevel(String name) {
this.name = name;
}
@@ -26,5 +26,5 @@ public enum EnumChallengeLevel {
public String getName() {
return name;
}
}
@@ -27,18 +27,18 @@ public final class ModChallenges {
public static final EnumMap<EnumChallengeLevel, List<Challenge>> challenges = new EnumMap(EnumChallengeLevel.class);
public static final HashMap<String, Challenge> challengeLookup = new HashMap();
public static void init() {
for(EnumChallengeLevel level : EnumChallengeLevel.class.getEnumConstants())
challenges.put(level, new ArrayList());
addChallenge(EnumChallengeLevel.EASY, "flowerFarm", new ItemStack(ModBlocks.flower, 1, 6));
addChallenge(EnumChallengeLevel.EASY, "recordFarm", new ItemStack(Items.record_13));
addChallenge(EnumChallengeLevel.EASY, "reedFarm", new ItemStack(Items.reeds));
addChallenge(EnumChallengeLevel.EASY, "cobbleGen", new ItemStack(Blocks.cobblestone));
addChallenge(EnumChallengeLevel.EASY, "pureDaisy", ItemBlockSpecialFlower.ofType(LibBlockNames.SUBTILE_PUREDAISY));
addChallenge(EnumChallengeLevel.EASY, "battery", new ItemStack(ModBlocks.pool));
addChallenge(EnumChallengeLevel.NORMAL, "apothecaryRefill", new ItemStack(ModBlocks.altar));
addChallenge(EnumChallengeLevel.NORMAL, "treeFarm", new ItemStack(Blocks.sapling));
addChallenge(EnumChallengeLevel.NORMAL, "fullCropFarm", new ItemStack(Items.wheat_seeds));
@@ -55,11 +55,11 @@ public final class ModChallenges {
addChallenge(EnumChallengeLevel.LUNATIC, "autoQuarry", new ItemStack(Items.diamond_pickaxe));
addChallenge(EnumChallengeLevel.LUNATIC, "runeCrafter", new ItemStack(ModItems.rune));
}
public static void addChallenge(EnumChallengeLevel level, String name, ItemStack icon) {
Challenge c = new Challenge("botania.challenge." + name, icon, level);
challenges.get(level).add(c);
challengeLookup.put(c.unlocalizedName, c);
}
}
@@ -121,7 +121,7 @@ public final class ContributorFancinessHandler {
GL11.glRotatef(90F, 0F, 1F, 0F);
GL11.glRotatef(180F, 1F, 0F, 0F);
GL11.glTranslatef(-0.4F, 0.1F, -0.25F);
Minecraft.getMinecraft().renderEngine.bindTexture(TextureMap.locationItemsTexture);
Minecraft.getMinecraft().renderEngine.bindTexture(TextureMap.locationItemsTexture);
GL11.glRotatef(90F, 0F, 1F, 0F);
GL11.glScalef(0.4F, 0.4F, 0.4F);
GL11.glTranslatef(-1.2F, 0.2F, 0.2F);
@@ -146,7 +146,7 @@ public final class ContributorFancinessHandler {
ItemRenderer.renderItemIn2D(Tessellator.instance, f1, f2, f, f3, icon.getIconWidth(), icon.getIconHeight(), 1F / 16F);
GL11.glPopMatrix();
}
private static void renderFlower(RenderPlayerEvent event, IIcon icon) {
GL11.glPushMatrix();
Helper.translateToHeadLevel(event.entityPlayer);
@@ -98,7 +98,7 @@ public class CorporeaAutoCompleteHandler {
if(!CorporeaHelper.shouldAutoComplete())
return;
GuiTextField inputField = ReflectionHelper.getPrivateValue(GuiChat.class, chat, LibObfuscation.INPUT_FIELD);
if(!isAutoCompleted)
buildAutoCompletes(inputField, chat);
@@ -107,9 +107,9 @@ public class CorporeaAutoCompleteHandler {
}
private void advanceAutoComplete(GuiTextField inputField, GuiChat chat) {
this.position++;
if(this.position >= completions.size())
this.position -= completions.size();
position++;
if(position >= completions.size())
position -= completions.size();
CompletionData data = completions.get(position);
String str = originalString.substring(0, originalString.length() - data.prefixLength) + data.string;
inputField.setText(str);
@@ -123,10 +123,10 @@ public class CorporeaAutoCompleteHandler {
leftOfCursor = inputField.getText().substring(0, inputField.getCursorPosition());
if(leftOfCursor.length() == 0 || leftOfCursor.charAt(0) == '/')
return;
this.completions = getNames(leftOfCursor);
completions = getNames(leftOfCursor);
if(completions.isEmpty())
return;
this.position = -1;
position = -1;
ReflectionHelper.setPrivateValue(GuiChat.class, chat, true, LibObfuscation.COMPLETE_FLAG);
StringBuilder stringbuilder = new StringBuilder();
CompletionData data;
@@ -135,7 +135,7 @@ public class CorporeaAutoCompleteHandler {
if(stringbuilder.length() > 0)
stringbuilder.append(", ");
}
Minecraft.getMinecraft().ingameGUI.getChatGUI().printChatMessageWithOptionalDeletion(new ChatComponentText(stringbuilder.toString()), 1);
isAutoCompleted = true;
originalString = inputField.getText();
@@ -113,7 +113,7 @@ public final class HUDHandler {
mc.fontRenderer.drawStringWithShadow(s, event.resolution.getScaledWidth() / 2 - mc.fontRenderer.getStringWidth(s) / 2, event.resolution.getScaledHeight() / 2 - 30, 0xFFFFFF);
profiler.endSection();
}
if(equippedStack != null && equippedStack.getItem() == ModItems.craftingHalo) {
profiler.startSection("craftingHalo");
ItemCraftingHalo.renderHUD(event.resolution, mc.thePlayer, equippedStack);
@@ -16,7 +16,6 @@ import net.minecraft.client.renderer.RenderBlocks;
import net.minecraft.client.renderer.entity.RenderManager;
import net.minecraft.client.renderer.texture.TextureMap;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.util.ChatComponentTranslation;
import net.minecraft.util.ChatStyle;
import net.minecraft.util.ChunkCoordinates;
@@ -34,13 +33,12 @@ import vazkii.botania.api.lexicon.multiblock.IMultiblockRenderHook;
import vazkii.botania.api.lexicon.multiblock.Multiblock;
import vazkii.botania.api.lexicon.multiblock.MultiblockSet;
import vazkii.botania.api.lexicon.multiblock.component.MultiblockComponent;
import vazkii.botania.common.block.ModMultiblocks;
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
public final class MultiblockRenderHandler {
public static boolean rendering = false;
private static RenderBlocks blockRender = RenderBlocks.getInstance();
public static MultiblockSet currentMultiblock;
public static ChunkCoordinates anchor;
@@ -51,21 +49,21 @@ public final class MultiblockRenderHandler {
anchor = null;
angle = 0;
}
@SubscribeEvent
public void onWorldRenderLast(RenderWorldLastEvent event) {
Minecraft mc = Minecraft.getMinecraft();
if(mc.thePlayer != null && mc.objectMouseOver != null && (!mc.thePlayer.isSneaking() || anchor != null)) {
ItemStack currentStack = mc.thePlayer.getCurrentEquippedItem();
mc.thePlayer.getCurrentEquippedItem();
renderPlayerLook(mc.thePlayer, mc.objectMouseOver);
}
}
@SubscribeEvent
public void onPlayerInteract(PlayerInteractEvent event) {
if(currentMultiblock != null && anchor == null && event.action == Action.RIGHT_CLICK_BLOCK) {
anchor = new ChunkCoordinates(event.x, event.y, event.z);
angle = MathHelper.floor_double((event.entityPlayer.rotationYaw * 4.0 / 360.0) + 0.5) & 3;
angle = MathHelper.floor_double(event.entityPlayer.rotationYaw * 4.0 / 360.0 + 0.5) & 3;
event.setCanceled(true);
}
}
@@ -75,7 +73,7 @@ public final class MultiblockRenderHandler {
int anchorX = anchor != null ? anchor.posX : src.blockX;
int anchorY = anchor != null ? anchor.posY : src.blockY;
int anchorZ = anchor != null ? anchor.posZ : src.blockZ;
rendering = true;
Multiblock mb = anchor != null ? currentMultiblock.getForIndex(angle) : currentMultiblock.getForEntity(player);
boolean didAny = false;
@@ -83,7 +81,7 @@ public final class MultiblockRenderHandler {
if(renderComponent(player.worldObj, mb, comp, anchorX, anchorY, anchorZ))
didAny = true;
rendering = false;
if(!didAny) {
setMultiblock(null);
player.addChatComponentMessage(new ChatComponentTranslation("botaniamisc.structureComplete").setChatStyle(new ChatStyle().setColor(EnumChatFormatting.GREEN)));
@@ -98,7 +96,7 @@ public final class MultiblockRenderHandler {
int z = pos.posZ + anchorZ;
if(anchor != null && comp.matches(world, x, y, z))
return false;
GL11.glPushMatrix();
GL11.glEnable(GL11.GL_BLEND);
GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
@@ -106,7 +104,7 @@ public final class MultiblockRenderHandler {
GL11.glColor4f(1F, 1F, 1F, 0.4F);
GL11.glTranslated(x + 0.5 - RenderManager.renderPosX, y + 0.5 - RenderManager.renderPosY, z + 0.5 - RenderManager.renderPosZ);
Minecraft.getMinecraft().renderEngine.bindTexture(TextureMap.locationBlocksTexture);
blockRender.useInventoryTint = false;
Block block = comp.getBlock();
if(IMultiblockRenderHook.renderHooks.containsKey(block))
@@ -31,14 +31,14 @@ public final class PresistantVariableHelper {
private static final String TAG_BOOKMARKS = "bookmarks";
private static final String TAG_CHALLENGES = "challenges";
private static final String TAG_FIRST_LOAD = "firstLoad";
private static File cacheFile;
public static boolean firstLoad = true;
public static void save() throws IOException {
NBTTagCompound cmp = new NBTTagCompound();
List<GuiLexicon> bookmarks = GuiLexicon.bookmarks;
int count = bookmarks.size();
cmp.setInteger(TAG_BOOKMARK_COUNT, count);
@@ -50,20 +50,20 @@ public final class PresistantVariableHelper {
bookmarksCmp.setTag(TAG_BOOKMARK_PREFIX + i, bookmarkCmp);
}
cmp.setTag(TAG_BOOKMARKS, bookmarksCmp);
NBTTagCompound challengesCmp = new NBTTagCompound();
for(Challenge c : ModChallenges.challengeLookup.values())
c.writeToNBT(challengesCmp);
cmp.setTag(TAG_CHALLENGES, challengesCmp);
cmp.setBoolean(TAG_FIRST_LOAD, firstLoad);
injectNBTToFile(cmp, getCacheFile());
}
public static void load() throws IOException {
NBTTagCompound cmp = getCacheCompound();
int count = cmp.getInteger(TAG_BOOKMARK_COUNT);
GuiLexicon.bookmarks.clear();
if(count > 0) {
@@ -75,18 +75,18 @@ public final class PresistantVariableHelper {
GuiLexicon.bookmarks.add(gui);
}
}
if(cmp.hasKey(TAG_CHALLENGES)) {
NBTTagCompound challengesCmp = cmp.getCompoundTag(TAG_CHALLENGES);
for(Challenge c : ModChallenges.challengeLookup.values())
c.readFromNBT(challengesCmp);
}
firstLoad = cmp.hasKey(TAG_FIRST_LOAD) ? cmp.getBoolean(TAG_FIRST_LOAD) : firstLoad;
if(firstLoad)
GuiLexicon.currentOpenLexicon = new GuiLexiconEntry(LexiconData.welcome, new GuiLexicon());
}
public static void saveSafe() {
try {
save();
@@ -94,22 +94,22 @@ public final class PresistantVariableHelper {
e.printStackTrace();
}
}
public static void setCacheFile(File f) {
cacheFile = f;
}
public static File getCacheFile() throws IOException {
if(!cacheFile.exists())
cacheFile.createNewFile();
return cacheFile;
}
public static NBTTagCompound getCacheCompound() throws IOException {
return getCacheCompound(getCacheFile());
}
public static NBTTagCompound getCacheCompound(File cache) throws IOException {
if(cache == null)
throw new RuntimeException("No cache file!");
@@ -131,5 +131,5 @@ public final class PresistantVariableHelper {
e.printStackTrace();
}
}
}
@@ -19,7 +19,6 @@ import net.minecraft.client.gui.Gui;
import net.minecraft.client.gui.GuiScreen;
import net.minecraft.client.gui.ScaledResolution;
import net.minecraft.client.gui.inventory.GuiContainer;
import net.minecraft.inventory.ContainerPlayer;
import net.minecraft.inventory.Slot;
import net.minecraft.item.ItemStack;
import net.minecraft.util.StatCollector;
@@ -52,13 +51,13 @@ public final class TerraPickRankDisplayHandler {
for(String s : tooltip)
width = Math.max(width, font.getStringWidth(s));
int tooltipHeight = (tooltip.size() - 1) * 10 + 5;
int height = 3;
int offx = 11;
int offy = 17;
boolean offscreen = mouseX + width + 19 >= res.getScaledWidth();
int fixY = res.getScaledHeight() - (mouseY + tooltipHeight);
if(fixY < 0)
offy -= fixY;
@@ -164,14 +164,14 @@ public class ClientProxy extends CommonProxy {
@Override
public void preInit(FMLPreInitializationEvent event) {
super.preInit(event);
PresistantVariableHelper.setCacheFile(new File(event.getModConfigurationDirectory().getParent(), "BotaniaVars.dat"));
}
@Override
public void init(FMLInitializationEvent event) {
super.init(event);
ModChallenges.init();
FMLCommonHandler.instance().bus().register(new ClientTickHandler());
@@ -195,7 +195,7 @@ public class ClientProxy extends CommonProxy {
singAnnoyingChristmasSongsTillVazkiisHeadExplodesFromAllTheDamnJingle = true;
initRenderers();
try {
PresistantVariableHelper.load();
} catch (IOException e) {
@@ -245,7 +245,7 @@ public class ClientProxy extends CommonProxy {
IMultiblockRenderHook.renderHooks.put(ModBlocks.flower, specialFlowerRender);
IMultiblockRenderHook.renderHooks.put(ModBlocks.shinyFlower, specialFlowerRender);
RenderTransparentItem renderTransparentItem = new RenderTransparentItem();
RenderFloatingFlowerItem renderFloatingFlower = new RenderFloatingFlowerItem();
RenderBow renderBow = new RenderBow();
@@ -298,7 +298,7 @@ public class ClientProxy extends CommonProxy {
ShaderHelper.initShaders();
}
@Override
@Optional.Method(modid = "NotEnoughItems")
public void registerNEIStuff() {
@@ -27,7 +27,6 @@ import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.util.EnumChatFormatting;
import net.minecraft.util.ResourceLocation;
import net.minecraft.util.StatCollector;
import net.minecraftforge.client.event.GuiScreenEvent.ActionPerformedEvent.Pre;
import org.lwjgl.opengl.GL11;
@@ -59,7 +58,7 @@ public class GuiLexicon extends GuiScreen {
public static ItemStack stackUsed;
private static final String TAG_TYPE = "type";
private static final int[] KONAMI_CODE = { 200, 200, 208, 208, 203, 205, 203, 205, 48, 30 };
public static final int BOOKMARK_START = 1337;
@@ -97,7 +96,7 @@ public class GuiLexicon extends GuiScreen {
PresistantVariableHelper.firstLoad = false;
PresistantVariableHelper.saveSafe();
}
onInitGui();
putTutorialArrow();
@@ -312,7 +311,7 @@ public class GuiLexicon extends GuiScreen {
public int bookmarkWidth(String b) {
if(fontRendererObj == null)
fontRendererObj = Minecraft.getMinecraft().fontRenderer;
boolean unicode = fontRendererObj.getUnicodeFlag();
fontRendererObj.setUnicodeFlag(true);
int width = fontRendererObj.getStringWidth(b) + 15;
@@ -335,7 +334,7 @@ public class GuiLexicon extends GuiScreen {
boolean isIndex() {
return false;
}
boolean isChallenge() {
return false;
}
@@ -459,7 +458,7 @@ public class GuiLexicon extends GuiScreen {
super.keyTyped(par1, par2);
}
public static GuiLexicon create(NBTTagCompound cmp) {
String type = cmp.getString(TAG_TYPE);
try {
@@ -478,15 +477,15 @@ public class GuiLexicon extends GuiScreen {
public void serialize(NBTTagCompound cmp) {
cmp.setString(TAG_TYPE, getClass().getName());
}
public void load(NBTTagCompound cmp) {
// NO-OP
}
public GuiLexicon copy() {
return new GuiLexicon();
}
public static boolean isValidLexiconGui(GuiLexicon gui) {
if(gui == null)
return false;
@@ -30,7 +30,7 @@ import vazkii.botania.common.lexicon.page.PageText;
public class GuiLexiconChallenge extends GuiLexicon implements IParented {
private static final String TAG_CHALLENGE = "challenge";
Challenge challenge;
GuiLexicon parent;
GuiButton backButton, completeButton;
@@ -74,7 +74,7 @@ public class GuiLexiconChallenge extends GuiLexicon implements IParented {
fontRendererObj.setUnicodeFlag(true);
fontRendererObj.drawString(EnumChatFormatting.BOLD + StatCollector.translateToLocal(challenge.unlocalizedName), left + 38, top + 13, 0);
fontRendererObj.drawString(StatCollector.translateToLocal(challenge.level.getName()) + " / " + (challenge.complete ? EnumChatFormatting.DARK_GREEN : EnumChatFormatting.DARK_RED) + StatCollector.translateToLocal(challenge.complete ? "botaniamisc.completed" : "botaniamisc.notCompleted"), left + 38, top + 23, 0);
int width = guiWidth - 30;
int x = left + 16;
int y = top + 28;
@@ -116,7 +116,7 @@ public class GuiLexiconChallenge extends GuiLexicon implements IParented {
PresistantVariableHelper.saveSafe();
}
}
void setCompleteButtonTitle() {
completeButton.displayString = StatCollector.translateToLocal(challenge.complete ? "botaniamisc.markNotCompleted" : "botaniamisc.markCompleted");
}
@@ -163,7 +163,7 @@ public class GuiLexiconChallenge extends GuiLexicon implements IParented {
super.serialize(cmp);
cmp.setString(TAG_CHALLENGE, challenge.unlocalizedName);
}
@Override
public void load(NBTTagCompound cmp) {
super.load(cmp);
@@ -172,5 +172,5 @@ public class GuiLexiconChallenge extends GuiLexicon implements IParented {
challenge = c;
setTitle();
}
}
@@ -21,7 +21,6 @@ import vazkii.botania.client.challenge.ModChallenges;
import vazkii.botania.client.core.handler.ClientTickHandler;
import vazkii.botania.client.gui.lexicon.button.GuiButtonBack;
import vazkii.botania.client.gui.lexicon.button.GuiButtonChallengeIcon;
import vazkii.botania.client.gui.lexicon.button.GuiButtonChallengeInfo;
public class GuiLexiconChallengesList extends GuiLexicon implements IParented {
@@ -46,7 +45,7 @@ public class GuiLexiconChallengesList extends GuiLexicon implements IParented {
for(EnumChallengeLevel level : EnumChallengeLevel.class.getEnumConstants()) {
int j = 0;
for(Challenge c : ModChallenges.challenges.get(level)) {
buttonList.add(new GuiButtonChallengeIcon(i, left + 20 + (j % perline) * 18, y + (j / perline) * 17, c));
buttonList.add(new GuiButtonChallengeIcon(i, left + 20 + j % perline * 18, y + j / perline * 17, c));
i++;
j++;
}
@@ -40,7 +40,7 @@ public class GuiLexiconEntry extends GuiLexicon implements IGuiLexiconEntry, IPa
private static final String TAG_ENTRY = "entry";
private static final String TAG_PAGE = "page";
public int page = 0;
LexiconEntry entry;
GuiScreen parent;
@@ -53,19 +53,19 @@ public class GuiLexiconEntry extends GuiLexicon implements IGuiLexiconEntry, IPa
parent = new GuiLexicon();
setTitle();
}
public GuiLexiconEntry(LexiconEntry entry, GuiScreen parent) {
this.entry = entry;
this.parent = parent;
setTitle();
}
public void setTitle() {
if(entry == null) {
title = "(null)";
return;
}
title = StatCollector.translateToLocal(entry.getUnlocalizedName());
if(entry instanceof IAddonEntry)
subtitle = StatCollector.translateToLocal(((IAddonEntry) entry).getSubtitle());
@@ -359,30 +359,30 @@ public class GuiLexiconEntry extends GuiLexicon implements IGuiLexiconEntry, IPa
public float getTickDelta() {
return timeDelta;
}
@Override
public void serialize(NBTTagCompound cmp) {
super.serialize(cmp);
cmp.setString(TAG_ENTRY, entry.getUnlocalizedName());
cmp.setInteger(TAG_PAGE, page);
}
@Override
public void load(NBTTagCompound cmp) {
super.load(cmp);
String entryStr = cmp.getString(TAG_ENTRY);
for(LexiconEntry entry : BotaniaAPI.getAllEntries())
if(entry.getUnlocalizedName().equals(entryStr)) {
this.entry = entry;
break;
}
page = cmp.getInteger(TAG_PAGE);
setTitle();
}
@Override
public GuiLexicon copy() {
GuiLexiconEntry gui = new GuiLexiconEntry(entry, new GuiScreen());
@@ -48,7 +48,7 @@ public class GuiLexiconHistory extends GuiLexiconIndex {
public GuiLexicon copy() {
return new GuiLexiconHistory();
}
@Override
public void load(NBTTagCompound cmp) {
// NO-OP
@@ -33,10 +33,10 @@ import vazkii.botania.client.gui.lexicon.button.GuiButtonInvisible;
import vazkii.botania.client.gui.lexicon.button.GuiButtonPage;
public class GuiLexiconIndex extends GuiLexicon implements IParented {
private static final String TAG_CATEGORY = "category";
private static final String TAG_PAGE = "page";
LexiconCategory category;
String title;
int page = 0;
@@ -52,13 +52,13 @@ public class GuiLexiconIndex extends GuiLexicon implements IParented {
public GuiLexiconIndex() {
parent = new GuiLexicon();
}
public GuiLexiconIndex(LexiconCategory category) {
this.category = category;
parent = new GuiLexicon();
setTitle();
}
public void setTitle() {
title = StatCollector.translateToLocal(category == null ? "botaniamisc.lexiconIndex" : category.getUnlocalizedName());
}
@@ -336,7 +336,7 @@ public class GuiLexiconIndex extends GuiLexicon implements IParented {
cmp.setString(TAG_CATEGORY, category == null ? "" : category.getUnlocalizedName());
cmp.setInteger(TAG_PAGE, page);
}
@Override
public void load(NBTTagCompound cmp) {
super.load(cmp);
@@ -344,14 +344,14 @@ public class GuiLexiconIndex extends GuiLexicon implements IParented {
if(categoryStr.isEmpty())
category = null;
else for(LexiconCategory cat : BotaniaAPI.getAllCategories())
if(cat.getUnlocalizedName().equals(categoryStr)) {
category = cat;
break;
}
if(cat.getUnlocalizedName().equals(categoryStr)) {
category = cat;
break;
}
page = cmp.getInteger(TAG_PAGE);
setTitle();
}
@Override
public GuiLexicon copy() {
GuiLexiconIndex gui = new GuiLexiconIndex(category);
@@ -43,7 +43,7 @@ public class GuiButtonChallengeIcon extends GuiButtonLexicon {
RenderItem.getInstance().renderItemIntoGUI(par1Minecraft.fontRenderer, par1Minecraft.renderEngine, challenge.icon, xPosition, yPosition);
RenderHelper.disableStandardItemLighting();
GL11.glEnable(GL11.GL_BLEND);
if(challenge.complete) {
GL11.glDisable(GL11.GL_DEPTH_TEST);
par1Minecraft.fontRenderer.drawStringWithShadow("\u2714", xPosition + 10, yPosition + 9, 0x004C00);
@@ -14,7 +14,6 @@ import java.util.ArrayList;
import java.util.List;
import net.minecraft.client.Minecraft;
import net.minecraft.util.EnumChatFormatting;
import net.minecraft.util.StatCollector;
import vazkii.botania.client.core.helper.RenderHelper;
import vazkii.botania.client.gui.lexicon.GuiLexicon;
@@ -33,7 +32,7 @@ public class GuiButtonChallengeInfo extends GuiButtonLexicon {
gui.drawBookmark(xPosition, yPosition, displayString, false);
field_146123_n = par2 >= xPosition && par3 >= yPosition && par2 < xPosition + width && par3 < yPosition + height;
int k = getHoverState(field_146123_n);
List<String> tooltip = new ArrayList();
tooltip.add(StatCollector.translateToLocal("botaniamisc.challengeInfo"));
@@ -16,9 +16,6 @@ import net.minecraft.client.model.ModelBase;
import net.minecraft.client.model.ModelRenderer;
import org.lwjgl.opengl.GL11;
import org.lwjgl.opengl.GL12;
import vazkii.botania.client.core.helper.ShaderHelper;
public class ModelHourglass extends ModelBase {
@@ -56,13 +53,13 @@ public class ModelHourglass extends ModelBase {
glass2.addBox(-3.0F, 0.501F, -3.0F, 6, 6, 6, 0.0F);
}
public void render(float fract1, float fract2, boolean flip, int color) {
public void render(float fract1, float fract2, boolean flip, int color) {
if(flip) {
float fract3 = fract1;
fract1 = fract2;
fract2 = fract3;
}
float f = 1F / 16F;
ring.render(f);
base1.render(f);
@@ -71,7 +68,7 @@ public class ModelHourglass extends ModelBase {
GL11.glColor3ub((byte) c.getRed(), (byte) c.getGreen(), (byte) c.getBlue());
boolean normalize = GL11.glGetBoolean(GL11.GL_NORMALIZE);
GL11.glEnable(GL11.GL_NORMALIZE);
if(fract1 > 0) {
GL11.glPushMatrix();
if(flip)
@@ -85,7 +82,7 @@ public class ModelHourglass extends ModelBase {
sand1.render(f);
GL11.glPopMatrix();
}
if(fract2 > 0) {
GL11.glPushMatrix();
if(flip)
@@ -94,12 +91,12 @@ public class ModelHourglass extends ModelBase {
GL11.glRotatef(180F, 0F, 0F, 1F);
GL11.glTranslatef(-2.5F * f, 1.0F * f, -2.5F * f);
}
GL11.glScalef(1F, fract2, 1F);
sand2.render(f);
GL11.glPopMatrix();
}
if(!normalize)
GL11.glDisable(GL11.GL_NORMALIZE);
GL11.glColor3f(1F, 1F, 1F);
@@ -19,7 +19,6 @@ import org.lwjgl.opengl.GL11;
import vazkii.botania.client.lib.LibRenderIDs;
import vazkii.botania.common.block.tile.TileHourglass;
import vazkii.botania.common.block.tile.mana.TileSpreader;
import cpw.mods.fml.client.registry.ISimpleBlockRenderingHandler;
public class RenderHourglass implements ISimpleBlockRenderingHandler {
@@ -16,7 +16,6 @@ import net.minecraft.client.renderer.RenderBlocks;
import net.minecraft.client.renderer.Tessellator;
import net.minecraft.util.IIcon;
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;
import vazkii.botania.api.lexicon.multiblock.IMultiblockRenderHook;
import vazkii.botania.api.lexicon.multiblock.Multiblock;
import cpw.mods.fml.client.registry.ISimpleBlockRenderingHandler;
@@ -19,7 +19,6 @@ import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.ResourceLocation;
import org.lwjgl.opengl.GL11;
import org.lwjgl.opengl.GL12;
import vazkii.botania.client.core.handler.ClientTickHandler;
import vazkii.botania.client.lib.LibResources;
@@ -34,37 +33,37 @@ public class RenderTileHourglass extends TileEntitySpecialRenderer {
@Override
public void renderTileEntityAt(TileEntity tileentity, double d0, double d1, double d2, float ticks) {
TileHourglass hourglass = (TileHourglass) tileentity;
GL11.glPushMatrix();
GL11.glEnable(GL11.GL_BLEND);
GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
GL11.glColor4f(1F, 1F, 1F, 1F);
GL11.glTranslated(d0, d1, d2);
Minecraft.getMinecraft().renderEngine.bindTexture(texture);
int wtime = tileentity.getWorldObj() == null ? 0 : ClientTickHandler.ticksInGame;
if(wtime != 0)
wtime += new Random(tileentity.xCoord ^ tileentity.yCoord ^ tileentity.zCoord).nextInt(360);
float time = wtime == 0 ? 0 : wtime + ticks;
float x = 0.5F + (float) Math.cos(time * 0.05F) * 0.025F;
float y = 0.55F + (float) (Math.sin(time * 0.04F) + 1F) * 0.05F;
float z = 0.5F + (float) Math.sin(time * 0.05F) * 0.025F;
ItemStack stack = hourglass.getStackInSlot(0);
float fract1 = stack == null ? 0 : hourglass.timeFraction;
float fract2 = stack == null ? 0 : 1F - hourglass.timeFraction;
GL11.glTranslatef(x, y, z);
float rot = hourglass.flip ? 180F : 1F;
if(hourglass.flipTicks > 0)
rot += (float) (hourglass.flipTicks - ticks) * (180F / 4F);
rot += (hourglass.flipTicks - ticks) * (180F / 4F);
GL11.glRotatef(rot, 0F, 0F, 1F);
GL11.glScalef(1F, -1F, -1F);
model.render(fract1, fract2, hourglass.flip, hourglass.getColor());
GL11.glScalef(1F, -1F, -1F);
GL11.glPopMatrix();
}
}
@@ -19,7 +19,6 @@ import vazkii.botania.common.integration.coloredlights.LightHelperVanilla;
import vazkii.botania.common.lib.LibMisc;
import cpw.mods.fml.common.Loader;
import cpw.mods.fml.common.Mod;
import cpw.mods.fml.common.Optional;
import cpw.mods.fml.common.Mod.EventHandler;
import cpw.mods.fml.common.Mod.Instance;
import cpw.mods.fml.common.ModAPIManager;
@@ -53,7 +52,7 @@ public class Botania {
bcTriggersLoaded = ModAPIManager.INSTANCE.hasAPI("BuildCraftAPI|statements");
bloodMagicLoaded = Loader.isModLoaded("AWWayofTime"); // Psh, noob
coloredLightsLoaded = Loader.isModLoaded("easycoloredlights");
lightHelper = coloredLightsLoaded ? new LightHelperColored() : new LightHelperVanilla();
proxy.preInit(event);
@@ -77,9 +77,9 @@ public class BlockFloatingSpecialFlower extends BlockFloatingFlower implements I
@Override
public int isProvidingStrongPower(IBlockAccess world, int x, int y, int z, int side) {
return this.isProvidingWeakPower(world, x, y, z, side);
return isProvidingWeakPower(world, x, y, z, side);
}
@Override
public boolean canProvidePower() {
return true;
@@ -10,12 +10,19 @@
*/
package vazkii.botania.common.block;
import net.minecraft.block.Block;
import net.minecraft.block.BlockRailBase;
import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.util.MathHelper;
import net.minecraft.world.World;
import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.event.entity.minecart.MinecartUpdateEvent;
import vazkii.botania.api.lexicon.ILexiconable;
import vazkii.botania.api.lexicon.LexiconEntry;
import vazkii.botania.api.recipe.IElvenItem;
import vazkii.botania.client.core.helper.IconHelper;
import vazkii.botania.common.core.BotaniaCreativeTab;
import vazkii.botania.common.item.block.ItemBlockElven;
import vazkii.botania.common.item.block.ItemBlockMod;
import vazkii.botania.common.lexicon.LexiconData;
import vazkii.botania.common.lib.LibBlockNames;
@@ -23,22 +30,11 @@ import cpw.mods.fml.common.eventhandler.SubscribeEvent;
import cpw.mods.fml.common.registry.GameRegistry;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import net.minecraft.block.Block;
import net.minecraft.block.BlockRailBase;
import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.init.Blocks;
import net.minecraft.item.ItemStack;
import net.minecraft.util.MathHelper;
import net.minecraft.world.World;
import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.event.entity.minecart.MinecartUpdateEvent;
public class BlockGhostRail extends BlockRailBase implements ILexiconable {
private static final String TAG_FLOAT_TICKS = "Botania_FloatTicks";
public BlockGhostRail() {
super(true);
setCreativeTab(BotaniaCreativeTab.INSTANCE);
@@ -75,11 +71,11 @@ public class BlockGhostRail extends BlockRailBase implements ILexiconable {
event.entity.worldObj.playAuxSFX(2003, x, y, z, 0);
}
floatTicks = event.entity.getEntityData().getInteger(TAG_FLOAT_TICKS);
if(floatTicks > 0) {
Block blockBelow = event.entity.worldObj.getBlock(x, y - 1, z);
boolean airBelow = blockBelow.isAir(event.entity.worldObj, x, y - 1, z);
if((air && airBelow) || !air && !(airBelow))
if(air && airBelow || !air && !airBelow)
event.entity.noClip = true;
event.entity.motionY = 0.2;
event.entity.motionX *= 1.4;
@@ -93,5 +89,5 @@ public class BlockGhostRail extends BlockRailBase implements ILexiconable {
public LexiconEntry getEntry(World world, int x, int y, int z, EntityPlayer player, ItemStack lexicon) {
return LexiconData.ghostRail;
}
}
@@ -43,18 +43,18 @@ import vazkii.botania.common.lib.LibBlockNames;
public class BlockHourglass extends BlockModContainer implements IManaTrigger, IWandable, IWandHUD, ILexiconable {
Random random;
protected BlockHourglass() {
super(Material.iron);
setBlockName(LibBlockNames.HOURGLASS);
setHardness(2.0F);
setStepSound(soundTypeMetal);
float f = 1F / 16F;
float w = 8F * f;
float d = (1F - w) / 2;
setBlockBounds(d, 0F, d, 1F - d, 1.15F, 1F - d);
random = new Random();
}
@@ -65,14 +65,14 @@ public class BlockHourglass extends BlockModContainer implements IManaTrigger, I
ItemStack stack = player.getCurrentEquippedItem();
if(stack != null && stack.getItem() == ModItems.twigWand)
return false;
if(hourglass.lock) {
if(!player.worldObj.isRemote)
player.addChatMessage(new ChatComponentTranslation("botaniamisc.hourglassLock"));
return true;
}
if(hgStack == null && hourglass.getStackItemTime(stack) > 0) {
if(hgStack == null && TileHourglass.getStackItemTime(stack) > 0) {
hourglass.setInventorySlotContents(0, stack.copy());
hourglass.markDirty();
stack.stackSize = 0;
@@ -85,30 +85,30 @@ public class BlockHourglass extends BlockModContainer implements IManaTrigger, I
hourglass.markDirty();
return true;
}
return false;
}
@Override
public boolean canProvidePower() {
return true;
}
@Override
public int isProvidingWeakPower(IBlockAccess world, int x, int y, int z, int side) {
return world.getBlockMetadata(x, y, z) == 0 ? 0 : 15;
}
@Override
public int tickRate(World world) {
return 4;
}
@Override
public void updateTick(World world, int x, int y, int z, Random rand) {
world.setBlockMetadataWithNotify(x, y, z, 0, 1 | 2);
}
@Override
public void breakBlock(World par1World, int par2, int par3, int par4, Block par5, int par6) {
TileSimpleInventory inv = (TileSimpleInventory) par1World.getTileEntity(par2, par3, par4);
@@ -146,7 +146,7 @@ public class BlockHourglass extends BlockModContainer implements IManaTrigger, I
super.breakBlock(par1World, par2, par3, par4, par5, par6);
}
@Override
public void registerBlockIcons(IIconRegister par1IconRegister) {
// NO-OP
@@ -203,5 +203,5 @@ public class BlockHourglass extends BlockModContainer implements IManaTrigger, I
public LexiconEntry getEntry(World world, int x, int y, int z, EntityPlayer player, ItemStack lexicon) {
return LexiconData.hourglass;
}
}
@@ -84,12 +84,12 @@ public class BlockIncensePlate extends BlockModContainer implements ILexiconable
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
public boolean hasComparatorInputOverride() {
return true;
}
@Override
public int getComparatorInputOverride(World world, int x, int y, int z, int side) {
return ((TileIncensePlate) world.getTileEntity(x, y, z)).comparatorOutput;
@@ -28,8 +28,6 @@ import vazkii.botania.api.lexicon.LexiconEntry;
import vazkii.botania.client.core.helper.IconHelper;
import vazkii.botania.common.block.tile.TileSimpleInventory;
import vazkii.botania.common.block.tile.TileSparkChanger;
import vazkii.botania.common.block.tile.TileTerraPlate;
import vazkii.botania.common.block.tile.string.TileRedStringDispenser;
import vazkii.botania.common.item.ModItems;
import vazkii.botania.common.lexicon.LexiconData;
import vazkii.botania.common.lib.LibBlockNames;
@@ -46,7 +44,7 @@ public class BlockSparkChanger extends BlockModContainer implements ILexiconable
setResistance(10.0F);
setStepSound(soundTypeStone);
setBlockName(LibBlockNames.SPARK_CHANGER);
random = new Random();
}
@@ -76,7 +74,7 @@ public class BlockSparkChanger extends BlockModContainer implements ILexiconable
public IIcon getIcon(int par1, int par2) {
return icons[Math.min(2, par1)];
}
@Override
public void onNeighborBlockChange(World world, int x, int y, int z, Block block) {
boolean power = world.isBlockIndirectlyGettingPowered(x, y, z) || world.isBlockIndirectlyGettingPowered(x, y + 1, z);
@@ -89,7 +87,7 @@ public class BlockSparkChanger extends BlockModContainer implements ILexiconable
} else if(!power && powered)
world.setBlockMetadataWithNotify(x, y, z, meta & -9, 4);
}
@Override
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int s, float xs, float ys, float zs) {
TileSparkChanger changer = (TileSparkChanger) world.getTileEntity(x, y, z);
@@ -98,11 +96,11 @@ public class BlockSparkChanger extends BlockModContainer implements ILexiconable
if(pstack != null && pstack.getItem() == ModItems.sparkUpgrade) {
changer.setInventorySlotContents(0, pstack.copy());
changer.markDirty();
pstack.stackSize--;
if(pstack.stackSize == 0)
player.inventory.setInventorySlotContents(player.inventory.currentItem, null);
if(cstack != null && !player.inventory.addItemStackToInventory(cstack))
player.dropPlayerItemWithRandomChoice(cstack, false);
return true;
@@ -113,10 +111,10 @@ public class BlockSparkChanger extends BlockModContainer implements ILexiconable
player.dropPlayerItemWithRandomChoice(cstack, false);
return true;
}
return false;
}
@Override
public void breakBlock(World par1World, int par2, int par3, int par4, Block par5, int par6) {
TileSimpleInventory inv = (TileSimpleInventory) par1World.getTileEntity(par2, par3, par4);
@@ -159,7 +157,7 @@ public class BlockSparkChanger extends BlockModContainer implements ILexiconable
public TileEntity createNewTileEntity(World world, int meta) {
return new TileSparkChanger();
}
@Override
public LexiconEntry getEntry(World world, int x, int y, int z, EntityPlayer player, ItemStack lexicon) {
return LexiconData.sparkChanger;
@@ -41,11 +41,9 @@ import vazkii.botania.api.wand.IWandable;
import vazkii.botania.client.lib.LibRenderIDs;
import vazkii.botania.common.block.tile.TileSpecialFlower;
import vazkii.botania.common.core.BotaniaCreativeTab;
import vazkii.botania.common.integration.coloredlights.ColoredLightHelper;
import vazkii.botania.common.integration.coloredlights.LightHelper;
import vazkii.botania.common.item.block.ItemBlockSpecialFlower;
import vazkii.botania.common.lib.LibBlockNames;
import cpw.mods.fml.common.Optional;
import cpw.mods.fml.common.registry.GameRegistry;
public class BlockSpecialFlower extends BlockFlower implements ITileEntityProvider, ISpecialFlower, IWandable, ILexiconable, IWandHUD {
@@ -131,21 +129,21 @@ public class BlockSpecialFlower extends BlockFlower implements ITileEntityProvid
}
@Override
public int isProvidingWeakPower(IBlockAccess world, int x, int y, int z, int side) {
return ((TileSpecialFlower) world.getTileEntity(x, y, z)).getPowerLevel(side);
}
public int isProvidingWeakPower(IBlockAccess world, int x, int y, int z, int side) {
return ((TileSpecialFlower) world.getTileEntity(x, y, z)).getPowerLevel(side);
}
@Override
public int isProvidingStrongPower(IBlockAccess world, int x, int y, int z, int side) {
return this.isProvidingWeakPower(world, x, y, z, side);
}
@Override
public boolean canProvidePower() {
return true;
}
public int isProvidingStrongPower(IBlockAccess world, int x, int y, int z, int side) {
return isProvidingWeakPower(world, x, y, z, side);
}
@Override
@Override
public boolean canProvidePower() {
return true;
}
@Override
public int getRenderType() {
return LibRenderIDs.idSpecialFlower;
}
@@ -305,7 +305,7 @@ public final class ModBlocks {
hourglass = new BlockHourglass();
ghostRail = new BlockGhostRail();
sparkChanger = new BlockSparkChanger();
ModFluffBlocks.init();
for(int i = 0; i < 16; i++)
@@ -18,8 +18,8 @@ import vazkii.botania.common.entity.EntityDoppleganger;
public final class ModMultiblocks {
public static MultiblockSet enchanter;
public static MultiblockSet alfPortal;
public static MultiblockSet enchanter;
public static MultiblockSet alfPortal;
public static MultiblockSet terrasteelPlate;
public static MultiblockSet gaiaRitual;
@@ -29,5 +29,5 @@ public final class ModMultiblocks {
terrasteelPlate = TileTerraPlate.makeMultiblockSet();
gaiaRitual = EntityDoppleganger.makeMultiblockSet();
}
}
@@ -38,7 +38,7 @@ public class SubTileSpectranthemum extends SubTileFunctional {
private static final int COST = 24;
private static final int RANGE = 2;
private static final int BIND_RANGE = 12;
private static final String TAG_TELEPORTED = "Botania_TPd";
int bindX, bindY = -1, bindZ;
@@ -134,7 +134,7 @@ public class SubTileSpectranthemum extends SubTileFunctional {
@Override
public boolean bindTo(EntityPlayer player, ItemStack wand, int x, int y, int z, int side) {
boolean bound = super.bindTo(player, wand, x, y, z, side);
if(!bound && (x != bindX || y != bindY || z != bindZ) && MathHelper.pointDistanceSpace(x, y, z, supertile.xCoord, supertile.yCoord, supertile.zCoord) <= BIND_RANGE && (x != supertile.xCoord || y != supertile.yCoord || z != supertile.zCoord)) {
bindX = x;
bindY = y;
@@ -12,8 +12,6 @@ package vazkii.botania.common.block.subtile.generating;
import java.util.List;
import net.minecraft.block.material.Material;
import net.minecraft.block.material.MaterialLiquid;
import net.minecraft.entity.item.EntityTNTPrimed;
import net.minecraft.util.AxisAlignedBB;
import net.minecraft.util.MathHelper;
@@ -20,13 +20,11 @@ import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.AxisAlignedBB;
import net.minecraft.util.ChunkCoordinates;
import net.minecraftforge.common.MinecraftForge;
import vazkii.botania.api.BotaniaAPI;
import vazkii.botania.api.lexicon.ILexicon;
import vazkii.botania.api.lexicon.multiblock.Multiblock;
import vazkii.botania.api.lexicon.multiblock.MultiblockSet;
import vazkii.botania.api.lexicon.multiblock.component.ColorSwitchingComponent;
import vazkii.botania.api.recipe.ElvenPortalUpdateEvent;
import vazkii.botania.api.recipe.IElvenItem;
import vazkii.botania.api.recipe.RecipeElvenTrade;
@@ -94,10 +92,10 @@ public class TileAlfPortal extends TileMod {
return new int[] { input[0], input[1], -input[2] };
}
};
public static MultiblockSet makeMultiblockSet() {
Multiblock mb = new Multiblock();
for(int[] l : LIVINGWOOD_POSITIONS)
mb.addComponent(l[0], l[1] + 1, l[2], ModBlocks.livingwood, 0);
for(int[] g : GLIMMERING_LIVINGWOOD_POSITIONS)
@@ -106,10 +104,10 @@ public class TileAlfPortal extends TileMod {
mb.addComponent(-p[0], p[1] + 1, -p[2], ModBlocks.pylon, 1);
for(int[] p : POOL_POSITIONS)
mb.addComponent(-p[0], p[1] + 1, -p[2], ModBlocks.pool, 0);
mb.addComponent(0, 1, 0, ModBlocks.alfPortal, 0);
mb.setRenderOffset(0, -1, 0);
return mb.makeSet();
}
@@ -33,7 +33,6 @@ import vazkii.botania.api.BotaniaAPI;
import vazkii.botania.api.internal.VanillaPacketDispatcher;
import vazkii.botania.api.lexicon.multiblock.Multiblock;
import vazkii.botania.api.lexicon.multiblock.MultiblockSet;
import vazkii.botania.api.lexicon.multiblock.component.ColorSwitchingComponent;
import vazkii.botania.api.lexicon.multiblock.component.FlowerComponent;
import vazkii.botania.api.mana.IManaPool;
import vazkii.botania.api.mana.spark.ISparkAttachable;
@@ -81,10 +80,10 @@ public class TileEnchanter extends TileMod implements ISparkAttachable {
private static final int[][] FLOWER_LOCATIONS = new int[][] {
{ -1, 0, -1 }, { 1, 0, -1 }, { -1, 0, 1 }, { 1, 0, 1 }
};
public static MultiblockSet makeMultiblockSet() {
Multiblock mb = new Multiblock();
for(int[] o : OBSIDIAN_LOCATIONS)
mb.addComponent(o[0], o[1] + 1, o[2], Blocks.obsidian, 0);
for(int[] p : PYLON_LOCATIONS[0]) {
@@ -93,9 +92,9 @@ public class TileEnchanter extends TileMod implements ISparkAttachable {
}
for(int[] f : FLOWER_LOCATIONS)
mb.addComponent(new FlowerComponent(new ChunkCoordinates(f[0], f[1] + 1, f[2]), ModBlocks.flower));
mb.addComponent(0, 1, 0, Blocks.lapis_block, 0);
return mb.makeSet();
}
@@ -10,26 +10,21 @@
*/
package vazkii.botania.common.block.tile;
import io.netty.util.internal.StringUtil;
import org.lwjgl.opengl.GL11;
import org.lwjgl.opengl.GL12;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.ScaledResolution;
import net.minecraft.client.renderer.ItemRenderer;
import net.minecraft.client.renderer.RenderHelper;
import net.minecraft.client.renderer.entity.RenderItem;
import net.minecraft.init.Blocks;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.potion.Potion;
import net.minecraft.potion.PotionEffect;
import net.minecraft.util.StatCollector;
import net.minecraft.util.StringUtils;
import org.lwjgl.opengl.GL11;
import org.lwjgl.opengl.GL12;
import vazkii.botania.common.lib.LibBlockNames;
import vazkii.botania.common.lib.LibItemNames;
public class TileHourglass extends TileSimpleInventory {
@@ -39,18 +34,18 @@ public class TileHourglass extends TileSimpleInventory {
private static final String TAG_FLIP_TICKS = "flipTicks";
private static final String TAG_LOCK = "lock";
private static final String TAG_MOVE = "move";
int time = 0;
public float timeFraction = 0F;
public boolean flip = false;
public int flipTicks = 0;
public boolean lock = false;
public boolean move = true;
@Override
public void updateEntity() {
super.updateEntity();
int totalTime = getTotalTime();
if(totalTime > 0) {
if(move)
@@ -67,19 +62,19 @@ public class TileHourglass extends TileSimpleInventory {
time = 0;
timeFraction = 0F;
}
if(flipTicks > 0)
flipTicks--;
}
public int getTotalTime() {
ItemStack stack = getStackInSlot(0);
if(stack == null)
return 0;
return getStackItemTime(stack) * stack.stackSize;
}
public static int getStackItemTime(ItemStack stack) {
if(stack == null)
return 0;
@@ -89,7 +84,7 @@ public class TileHourglass extends TileSimpleInventory {
return 1200;
return 0;
}
public int getColor() {
ItemStack stack = getStackInSlot(0);
if(stack == null)
@@ -100,7 +95,7 @@ public class TileHourglass extends TileSimpleInventory {
return 0x5A412f;
return 0;
}
@Override
public void writeCustomNBT(NBTTagCompound par1nbtTagCompound) {
super.writeCustomNBT(par1nbtTagCompound);
@@ -111,7 +106,7 @@ public class TileHourglass extends TileSimpleInventory {
par1nbtTagCompound.setBoolean(TAG_MOVE, move);
par1nbtTagCompound.setBoolean(TAG_LOCK, lock);
}
@Override
public void readCustomNBT(NBTTagCompound par1nbtTagCompound) {
super.readCustomNBT(par1nbtTagCompound);
@@ -122,24 +117,24 @@ public class TileHourglass extends TileSimpleInventory {
move = par1nbtTagCompound.getBoolean(TAG_MOVE);
lock = par1nbtTagCompound.getBoolean(TAG_LOCK);
}
@Override
public int getSizeInventory() {
return 1;
}
@Override
public void markDirty() {
super.markDirty();
time = 0;
timeFraction = 0F;
}
public void renderHUD(ScaledResolution res) {
Minecraft mc = Minecraft.getMinecraft();
int x = res.getScaledWidth() / 2 + 10;
int y = res.getScaledHeight() / 2 - 10;
ItemStack stack = getStackInSlot(0);
if(stack != null) {
RenderHelper.enableGUIStandardItemLighting();
@@ -148,11 +143,11 @@ public class TileHourglass extends TileSimpleInventory {
RenderItem.getInstance().renderItemOverlayIntoGUI(mc.fontRenderer, mc.renderEngine, stack, x, y);
GL11.glDisable(GL12.GL_RESCALE_NORMAL);
RenderHelper.disableStandardItemLighting();
int time = getTotalTime();
String timeStr = StringUtils.ticksToElapsedTime(time);
mc.fontRenderer.drawStringWithShadow(timeStr, x + 20, y, getColor());
String status = "";
if(lock)
status = "locked";
@@ -38,7 +38,7 @@ public class TileIncensePlate extends TileSimpleInventory implements ISidedInven
public boolean burning = false;
public int comparatorOutput = 0;
@Override
public void updateEntity() {
ItemStack stack = getStackInSlot(0);
@@ -77,7 +77,7 @@ public class TileIncensePlate extends TileSimpleInventory implements ISidedInven
VanillaPacketDispatcher.dispatchTEToNearbyPlayers(this);
}
} else timeLeft = 0;
int newComparator = 0;
if(stack != null)
newComparator = 1;
@@ -88,12 +88,12 @@ public class TileIncensePlate extends TileSimpleInventory implements ISidedInven
worldObj.func_147453_f(xCoord, yCoord, zCoord, worldObj.getBlock(xCoord, yCoord, zCoord));
}
}
public void ignite() {
ItemStack stack = getStackInSlot(0);
if(stack == null || burning)
return;
burning = true;
Brew brew = ((ItemIncenseStick) ModItems.incenseStick).getBrew(stack);
timeLeft = brew.getPotionEffects(stack).get(0).getDuration() * ItemIncenseStick.TIME_MULTIPLIER;
@@ -142,12 +142,12 @@ public class TileIncensePlate extends TileSimpleInventory implements ISidedInven
public boolean canExtractItem(int p_102008_1_, ItemStack p_102008_2_, int p_102008_3_) {
return false;
}
@Override
public void markDirty() {
super.markDirty();
if(!worldObj.isRemote)
VanillaPacketDispatcher.dispatchTEToNearbyPlayers(this);
}
}
@@ -26,8 +26,8 @@ public class TilePylon extends TileEntity {
int centerX, centerY, centerZ;
int ticks = 0;
@Override
public void updateEntity() {
++ticks;
@@ -29,7 +29,7 @@ public class TileSparkChanger extends TileSimpleInventory {
public void doSwap() {
if(worldObj.isRemote)
return;
ItemStack changeStack = getStackInSlot(0);
List<ISparkAttachable> attachables = new ArrayList();
for(ForgeDirection dir : LibMisc.CARDINAL_DIRECTIONS) {
@@ -60,17 +60,17 @@ public class TileSparkChanger extends TileSimpleInventory {
markDirty();
}
}
@Override
public int getSizeInventory() {
return 1;
}
@Override
public boolean isItemValidForSlot(int i, ItemStack itemstack) {
return itemstack != null && itemstack.getItem() == ModItems.sparkUpgrade;
}
@Override
public int getInventoryStackLimit() {
return 1;
@@ -81,7 +81,7 @@ public class TileSparkChanger extends TileSimpleInventory {
super.markDirty();
VanillaPacketDispatcher.dispatchTEToNearbyPlayers(this);
}
@Override
public String getInventoryName() {
return LibBlockNames.SPARK_CHANGER;
@@ -48,18 +48,18 @@ public class TileTerraPlate extends TileMod implements ISparkAttachable {
public static MultiblockSet makeMultiblockSet() {
Multiblock mb = new Multiblock();
for(int[] l : LAPIS_BLOCKS)
mb.addComponent(l[0], 0, l[1], Blocks.lapis_block, 0);
for(int[] l : LIVINGROCK_BLOCKS)
mb.addComponent(l[0], 0, l[1], ModBlocks.livingrock, 0);
mb.addComponent(0, 1, 0, ModBlocks.terraPlate, 0);
mb.setRenderOffset(0, 1, 0);
return mb.makeSet();
}
@Override
public void updateEntity() {
boolean removeMana = true;
@@ -222,13 +222,13 @@ public class TileCorporeaIndex extends TileCorporeaBase {
input = new InputHandler();
return input;
}
public static final class InputHandler implements ICorporeaAutoCompleteController {
public InputHandler() {
CorporeaHelper.registerAutoCompleteController(this);
}
@SubscribeEvent(priority = EventPriority.HIGHEST)
public void onChatMessage(ServerChatEvent event) {
List<TileCorporeaIndex> nearbyIndexes = getNearbyIndexes(event.player);
@@ -116,7 +116,7 @@ public class TileSpreader extends TileSimpleInventory implements IManaCollector,
public static boolean staticUltra = false;
UUID identity;
int mana;
int knownMana = -1;
public float rotationX, rotationY;
@@ -132,12 +132,12 @@ public class TileSpreader extends TileSimpleInventory implements IManaCollector,
public boolean canShootBurst = true;
public int lastBurstDeathTick = -1;
public int burstParticleTick = 0;
public int pingbackTicks = 0;
public double lastPingbackX = 0;
public double lastPingbackY = -1;
public double lastPingbackZ = 0;
List<PositionProperties> lastTentativeBurst;
boolean invalidTentativeBurst = false;
@@ -210,14 +210,14 @@ public class TileSpreader extends TileSimpleInventory implements IManaCollector,
found = burst;
break;
}
if(found != null)
found.ping();
else setCanShoot(true);
} else pingbackTicks--;
boolean shouldShoot = !redstone;
if(isRedstone())
shouldShoot = redstone && !redstoneLastTick;
@@ -239,19 +239,19 @@ public class TileSpreader extends TileSimpleInventory implements IManaCollector,
@Override
public void writeCustomNBT(NBTTagCompound cmp) {
super.writeCustomNBT(cmp);
UUID identity = getIdentifier();
cmp.setBoolean(TAG_HAS_IDENTITY, true);
cmp.setLong(TAG_UUID_MOST, identity.getMostSignificantBits());
cmp.setLong(TAG_UUID_LEAST, identity.getLeastSignificantBits());
cmp.setInteger(TAG_MANA, mana);
cmp.setFloat(TAG_ROTATION_X, rotationX);
cmp.setFloat(TAG_ROTATION_Y, rotationY);
cmp.setBoolean(TAG_REQUEST_UPDATE, requestsClientUpdate);
cmp.setInteger(TAG_PADDING_COLOR, paddingColor);
cmp.setBoolean(TAG_CAN_SHOOT_BURST, canShootBurst);
cmp.setInteger(TAG_PINGBACK_TICKS, pingbackTicks);
cmp.setDouble(TAG_LAST_PINGBACK_X, lastPingbackX);
cmp.setDouble(TAG_LAST_PINGBACK_Y, lastPingbackY);
@@ -271,14 +271,14 @@ public class TileSpreader extends TileSimpleInventory implements IManaCollector,
cmp.setFloat(TAG_FORCED_MANA_LOSS_PER_TICK, mmForcedManaLossPerTick);
cmp.setFloat(TAG_FORCED_GRAVITY, mmForcedGravity);
cmp.setFloat(TAG_FORCED_VELOCITY_MULTIPLIER, mmForcedVelocityMultiplier);
requestsClientUpdate = false;
}
@Override
public void readCustomNBT(NBTTagCompound cmp) {
super.readCustomNBT(cmp);
if(cmp.getBoolean(TAG_HAS_IDENTITY)) {
long most = cmp.getLong(TAG_UUID_MOST);
long least = cmp.getLong(TAG_UUID_LEAST);
@@ -286,7 +286,7 @@ public class TileSpreader extends TileSimpleInventory implements IManaCollector,
if(identity == null || most != identity.getMostSignificantBits() || least != identity.getLeastSignificantBits())
identity = new UUID(most, least);
} else getIdentifier();
mana = cmp.getInteger(TAG_MANA);
rotationX = cmp.getFloat(TAG_ROTATION_X);
rotationY = cmp.getFloat(TAG_ROTATION_Y);
@@ -311,7 +311,7 @@ public class TileSpreader extends TileSimpleInventory implements IManaCollector,
paddingColor = cmp.getInteger(TAG_PADDING_COLOR);
if(cmp.hasKey(TAG_CAN_SHOOT_BURST))
canShootBurst = cmp.getBoolean(TAG_CAN_SHOOT_BURST);
pingbackTicks = cmp.getInteger(TAG_PINGBACK_TICKS);
lastPingbackX = cmp.getDouble(TAG_LAST_PINGBACK_X);
lastPingbackY = cmp.getDouble(TAG_LAST_PINGBACK_Y);
@@ -709,7 +709,7 @@ public class TileSpreader extends TileSimpleInventory implements IManaCollector,
identity = UUID.randomUUID();
return identity;
}
public UUID getIdentifierUnsafe() {
return identity;
}
@@ -126,7 +126,7 @@ public final class BotaniaCreativeTab extends CreativeTabs {
addBlock(ModBlocks.pylon);
addBlock(ModBlocks.pistonRelay);
addBlock(ModBlocks.hourglass);
addBlock(ModBlocks.redStringContainer);
addBlock(ModBlocks.redStringDispenser);
addBlock(ModBlocks.redStringFertilizer);
@@ -137,7 +137,7 @@ public final class ConfigHandler {
desc = "The height of the mana display bar in above the XP bar. You can change this if you have a mod that changes where the XP bar is.";
manaBarHeight = loadPropInt("manaBar.height", desc, manaBarHeight);
desc = "Set this to true to use alternate flower textures by Futureazoo, not all flowers are textured. http://redd.it/2b3o3f";
altFlowerTextures = loadPropBool("flowerTextures.alt", desc, altFlowerTextures);
@@ -148,7 +148,7 @@ public class InternalMethodHandler extends DummyMethodHandler {
public LexiconPage multiblockPage(String key, MultiblockSet mb) {
return new PageMultiblock(key, mb);
}
@Override
public ItemStack getSubTileAsStack(String subTile) {
return ItemBlockSpecialFlower.ofType(subTile);
@@ -219,12 +219,12 @@ public class InternalMethodHandler extends DummyMethodHandler {
public void breakOnAllCursors(EntityPlayer player, Item item, ItemStack stack, int x, int y, int z, int side) {
ItemLokiRing.breakOnAllCursors(player, item, stack, x, y, z, side);
}
@Override
public long getWorldElapsedTicks() {
return Botania.proxy.getWorldElapsedTicks();
}
@Override
public boolean isBotaniaFlower(World world, int x, int y, int z) {
Block block = world.getBlock(x, y, z);
@@ -853,8 +853,8 @@ public final class ModCraftingRecipes {
recipeAlfPortal = BotaniaAPI.getLatestAddedRecipe();
// Natura Pylon Recipe
addOreDictRecipe(new ItemStack(ModBlocks.pylon, 1, 1),
" T ", "TPT", " E ",
addOreDictRecipe(new ItemStack(ModBlocks.pylon, 1, 1),
" T ", "TPT", " E ",
'T', LibOreDict.TERRASTEEL_NUGGET,
'P', new ItemStack(ModBlocks.pylon),
'E', new ItemStack(Items.ender_eye));
@@ -1746,18 +1746,18 @@ public final class ModCraftingRecipes {
recipeTerraAxe = BotaniaAPI.getLatestAddedRecipe();
// Hovering Hourglass Recipe
addOreDictRecipe(new ItemStack(ModBlocks.hourglass),
addOreDictRecipe(new ItemStack(ModBlocks.hourglass),
"GMG", "RSR", "GMG",
'G', "ingotGold",
'M', new ItemStack(ModBlocks.manaGlass),
'R', new ItemStack(Items.redstone),
'S', LibOreDict.MANA_STEEL);
recipeHourglass = BotaniaAPI.getLatestAddedRecipe();
// Spectral Rail Recipe
GameRegistry.addShapelessRecipe(new ItemStack(ModBlocks.ghostRail), new ItemStack(Blocks.rail), new ItemStack(ModBlocks.platform, 1, 1));
recipeGhostRail = BotaniaAPI.getLatestAddedRecipe();
// Drum of the Canopy Recipe
addOreDictRecipe(new ItemStack(ModBlocks.forestDrum, 1, 2),
"WLW", "WHW", "WLW",
@@ -1765,15 +1765,15 @@ public final class ModCraftingRecipes {
'L', new ItemStack(Items.leather),
'H', new ItemStack(ModItems.grassHorn, 1, 1));
recipeCanopyDrum = BotaniaAPI.getLatestAddedRecipe();
// Spark Changer Recipe
addOreDictRecipe(new ItemStack(ModBlocks.sparkChanger),
addOreDictRecipe(new ItemStack(ModBlocks.sparkChanger),
"ESE", "SRS",
'S', LibOreDict.LIVING_ROCK,
'E', LibOreDict.ELEMENTIUM,
'R', new ItemStack(Items.redstone));
recipeSparkChanger = BotaniaAPI.getLatestAddedRecipe();
// Storage Block/Nugget Recipes
addOreDictRecipe(new ItemStack(ModBlocks.storage, 1, 0),
"III", "III", "III",
@@ -1808,7 +1808,7 @@ public final class ModCraftingRecipes {
addShapelessOreDictRecipe(new ItemStack(ModItems.manaResource, 9, 17), LibOreDict.MANA_STEEL);
addShapelessOreDictRecipe(new ItemStack(ModItems.manaResource, 9, 18), LibOreDict.TERRA_STEEL);
addShapelessOreDictRecipe(new ItemStack(ModItems.manaResource, 9, 19), LibOreDict.ELEMENTIUM);
// Revealing Helmet Recipes
if(Botania.thaumcraftLoaded) {
Item goggles = (Item) Item.itemRegistry.getObject("Thaumcraft:ItemGoggles");
@@ -41,7 +41,7 @@ public class ModManaConjurationRecipes {
netherrackRecipe = BotaniaAPI.registerManaConjurationRecipe(new ItemStack(Blocks.netherrack, 2), new ItemStack(Blocks.netherrack), 200);
soulSandRecipe = BotaniaAPI.registerManaConjurationRecipe(new ItemStack(Blocks.soul_sand, 2), new ItemStack(Blocks.soul_sand), 1500);
gravelRecipe = BotaniaAPI.registerManaConjurationRecipe(new ItemStack(Block.getBlockFromName("gravel"), 2), new ItemStack(Block.getBlockFromName("gravel")), 720);
leavesRecipes = new ArrayList();
for(int i = 0; i < 4; i++)
leavesRecipes.add(BotaniaAPI.registerManaConjurationRecipe(new ItemStack(Blocks.leaves, 2, i), new ItemStack(Blocks.leaves, 1, i), 2000));
@@ -63,7 +63,6 @@ import vazkii.botania.common.block.ModBlocks;
import vazkii.botania.common.core.handler.ConfigHandler;
import vazkii.botania.common.core.helper.Vector3;
import vazkii.botania.common.item.ModItems;
import vazkii.botania.common.item.equipment.tool.ToolCommons;
import vazkii.botania.common.lib.LibObfuscation;
import cpw.mods.fml.relauncher.ReflectionHelper;
import cpw.mods.fml.relauncher.Side;
@@ -112,17 +111,17 @@ public class EntityDoppleganger extends EntityCreature implements IBotaniaBossWi
isImmuneToFire = true;
experienceValue = 825;
}
public static MultiblockSet makeMultiblockSet() {
Multiblock mb = new Multiblock();
for(int[] p : PYLON_LOCATIONS)
mb.addComponent(p[0], p[1] + 1, p[2], ModBlocks.pylon, 2);
for(int i = 0; i < 3; i++)
for(int j = 0; j < 3; j++)
mb.addComponent(i - 1, 0, j - 1, Blocks.iron_block, 0);
mb.addComponent(0, 1, 0, Blocks.beacon, 0);
mb.setRenderOffset(0, -1, 0);
@@ -390,7 +389,7 @@ public class EntityDoppleganger extends EntityCreature implements IBotaniaBossWi
if(!worldObj.isRemote && worldObj.difficultySetting == EnumDifficulty.PEACEFUL)
setDead();
int posXInt = MathHelper.floor_double(posX);
int posYInt = MathHelper.floor_double(posY);
int posZInt = MathHelper.floor_double(posZ);
@@ -404,7 +403,7 @@ public class EntityDoppleganger extends EntityCreature implements IBotaniaBossWi
}
worldObj.setBlockToAir(posXInt, posYInt, posZInt);
}
ChunkCoordinates source = getSource();
boolean hard = isHardMode();
@@ -439,7 +439,7 @@ public class EntityManaBurst extends EntityThrowable implements IManaBurst {
par1nbtTagCompound.setDouble(TAG_LAST_MOTION_X, motionX);
par1nbtTagCompound.setDouble(TAG_LAST_MOTION_Y, motionY);
par1nbtTagCompound.setDouble(TAG_LAST_MOTION_Z, motionZ);
UUID identity = getShooterUIID();
boolean hasShooter = identity != null;
par1nbtTagCompound.setBoolean(TAG_HAS_SHOOTER, hasShooter);
@@ -477,7 +477,7 @@ public class EntityManaBurst extends EntityThrowable implements IManaBurst {
double lastMotionZ = par1nbtTagCompound.getDouble(TAG_LAST_MOTION_Z);
setMotion(lastMotionX, lastMotionY, lastMotionZ);
boolean hasShooter = par1nbtTagCompound.getBoolean(TAG_HAS_SHOOTER);
if(hasShooter) {
long most = par1nbtTagCompound.getLong(TAG_SHOOTER_UUID_MOST);
@@ -650,7 +650,7 @@ public class EntityManaBurst extends EntityThrowable implements IManaBurst {
((IManaSpreader) tile).setCanShoot(true);
} else setDeathTicksForFakeParticle();
}
public TileEntity getShooter() {
ChunkCoordinates coords = getBurstSourceChunkCoordinates();
TileEntity tile = worldObj.getTileEntity(coords.posX, coords.posY, coords.posZ);
@@ -25,7 +25,6 @@ import net.minecraft.entity.Entity;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.nbt.NBTTagList;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.MathHelper;
import net.minecraft.world.World;
@@ -10,11 +10,7 @@
*/
package vazkii.botania.common.item;
import net.minecraft.block.Block;
import net.minecraft.block.BlockRail;
import net.minecraft.block.BlockRailBase;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.init.Blocks;
import net.minecraft.inventory.IInventory;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
@@ -22,11 +18,9 @@ import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.nbt.NBTTagList;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.tileentity.TileEntityChest;
import net.minecraft.util.MathHelper;
import net.minecraft.world.World;
import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.common.util.ForgeDirection;
import net.minecraftforge.event.entity.minecart.MinecartUpdateEvent;
import net.minecraftforge.event.entity.player.EntityItemPickupEvent;
import vazkii.botania.common.Botania;
import vazkii.botania.common.block.ModBlocks;
@@ -25,9 +25,7 @@ import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.util.ChunkCoordinates;
import net.minecraft.util.IIcon;
import net.minecraft.util.MathHelper;
import net.minecraft.world.World;
import net.minecraftforge.event.entity.minecart.MinecartUpdateEvent;
import vazkii.botania.client.core.helper.IconHelper;
import vazkii.botania.common.Botania;
import vazkii.botania.common.block.decor.IFloatingFlower.IslandType;
@@ -134,7 +132,7 @@ public class ItemGrassSeeds extends ItemMod {
}
}
}
private static BlockSwapper addBlockSwapper(World world, int x, int y, int z, int meta) {
BlockSwapper swapper = swapperFromMeta(world, x, y, z, meta);
@@ -160,7 +160,7 @@ public class ItemTwigWand extends Item16Colors implements ICoordBoundItem {
BlockPistonRelay.playerPositions.remove(par2EntityPlayer.getCommandSenderName());
BlockPistonRelay.mappedPositions.put(bindPos, currentPos);
BlockPistonRelay.WorldData.get(par3World).markDirty();
par3World.playSoundAtEntity(par2EntityPlayer, "botania:ding", 1F, 1F);
}
@@ -45,7 +45,7 @@ public class ItemTravelBelt extends ItemBauble implements IBaubleRender {
private static final int COST = 1;
private static final int COST_INTERVAL = 10;
public static List<String> playersWithStepup = new ArrayList();
final float speed;
@@ -84,7 +84,7 @@ public class ItemTravelBelt extends ItemBauble implements IBaubleRender {
if(player.isSneaking())
player.stepHeight = 0.50001F; // Not 0.5F because that is the default
else player.stepHeight = 1F;
if(player.ticksExisted % COST_INTERVAL == 0)
ManaItemHandler.requestManaExact(belt, player, COST, true);
} else {
@@ -24,8 +24,6 @@ import vazkii.botania.common.Botania;
import vazkii.botania.common.core.helper.ItemNBTHelper;
import vazkii.botania.common.item.ItemMod;
import vazkii.botania.common.lib.LibItemNames;
import vazkii.botania.common.lib.LibObfuscation;
import cpw.mods.fml.relauncher.ReflectionHelper;
public class ItemTornadoRod extends ItemMod implements IManaUsingItem {
@@ -53,7 +51,7 @@ public class ItemTornadoRod extends ItemMod implements IManaUsingItem {
if(damaged && !isFlying(par1ItemStack))
par1ItemStack.setItemDamage(par1ItemStack.getItemDamage() - 1);
if(itemInUse != par1ItemStack)
setFlying(par1ItemStack, false);
else {
@@ -72,7 +70,7 @@ public class ItemTornadoRod extends ItemMod implements IManaUsingItem {
Botania.proxy.wispFX(player.worldObj, player.posX, player.posY, player.posZ, 0.25F, 0.25F, 0.25F, 0.35F + (float) Math.random() * 0.1F, 0.2F * (float) (Math.random() - 0.5), -0.01F * (float) Math.random(), 0.2F * (float) (Math.random() - 0.5));
}
}
if(damaged)
player.fallDistance = 0;
}
@@ -49,7 +49,7 @@ public class BLexiconEntry extends LexiconEntry {
public String getWebLink() {
return "http://botaniamod.net/lexicon.php#" + unlocalizedName;
}
@Override
public int compareTo(LexiconEntry o) {
return o instanceof WLexiconEntry ? 1 : super.compareTo(o);
@@ -17,7 +17,7 @@ import vazkii.botania.common.lib.LibMisc;
public class CLexiconEntry extends BLexiconEntry implements IAddonEntry {
String mod;
public CLexiconEntry(String unlocalizedName, LexiconCategory category, String mod) {
super(unlocalizedName, category);
this.mod = mod;
@@ -402,7 +402,7 @@ public final class LexiconData {
sparkChanger = new ALexiconEntry(LibLexicon.MANA_SPARK_CHANGER, categoryMana);
sparkChanger.setLexiconPages(new PageText("0"), new PageText("1"), new PageCraftingRecipe("2", ModCraftingRecipes.recipeSparkChanger));
// 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);;
@@ -597,13 +597,13 @@ public final class LexiconData {
hourglass = new BLexiconEntry(LibLexicon.DEVICE_HOURGLASS, categoryDevices);
hourglass.setLexiconPages(new PageText("0"), new PageText("1"), new PageText("2"), new PageText("3"), new PageText("4"), new PageCraftingRecipe("5", ModCraftingRecipes.recipeHourglass));
ghostRail = new ALexiconEntry(LibLexicon.DEVICE_GHOST_RAIL, categoryDevices);
ghostRail.setLexiconPages(new PageText("0"), new PageCraftingRecipe("1", ModCraftingRecipes.recipeGhostRail));
canopyDrum = new BLexiconEntry(LibLexicon.DEVICE_CANOPY_DRUM, categoryDevices);
canopyDrum.setLexiconPages(new PageText("0"), new PageCraftingRecipe("1", ModCraftingRecipes.recipeCanopyDrum));
// TOOLS ENTRIES
manaBlaster = new BLexiconEntry(LibLexicon.TOOL_MANA_BLASTER, categoryTools);
manaBlaster.setLexiconPages(new PageText("0"), new PageText("1"), new PageText("2"), new PageCraftingRecipe("3", ModCraftingRecipes.recipeManaBlaster));
@@ -934,7 +934,7 @@ public final class LexiconData {
challenges = new BLexiconEntry(LibLexicon.MISC_CHALLENGES, categoryMisc);
challenges.setLexiconPages(new PageText("0"), new PageText("1"), new PageText("2")).setPriority().setIcon(new ItemStack(ModItems.cosmetic, 1, 31));
if(Botania.bcTriggersLoaded) {
bcIntegration = new CLexiconEntry(LibLexicon.MISC_BC_INTEGRATION, categoryMisc, "BuildCraft");
bcIntegration.setLexiconPages(new PageText("0")).setIcon(new ItemStack(Items.redstone));
@@ -21,21 +21,21 @@ import vazkii.botania.common.lib.LibLexicon;
public class WLexiconEntry extends BLexiconEntry {
private static final int PAGES = 9;
public WLexiconEntry() {
super(LibLexicon.BASICS_WELCOME, BotaniaAPI.categoryBasics);
setPriority();
setIcon(new ItemStack(ModItems.cosmetic, 1, 31));
LexiconPage[] pages = new LexiconPage[PAGES];
for(int i = 0; i < PAGES; i++)
pages[i] = new PageText("" + i);
setLexiconPages(pages);
}
}
@Override
public int compareTo(LexiconEntry o) {
return -1;
}
}
@@ -19,7 +19,6 @@ import org.lwjgl.opengl.GL11;
import vazkii.botania.api.internal.IGuiLexiconEntry;
import vazkii.botania.api.lexicon.LexiconPage;
import vazkii.botania.client.lib.LibResources;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
@@ -47,7 +47,7 @@ import cpw.mods.fml.relauncher.SideOnly;
public class PageMultiblock extends LexiconPage {
private static final ResourceLocation multiblockOverlay = new ResourceLocation(LibResources.GUI_MULTIBLOCK_OVERLAY);
GuiButton button;
MultiblockSet set;
Multiblock mb;
@@ -55,10 +55,10 @@ public class PageMultiblock extends LexiconPage {
public PageMultiblock(String unlocalizedName, MultiblockSet set) {
super(unlocalizedName);
this.mb = set.getForIndex(0);
mb = set.getForIndex(0);
this.set = set;
}
@Override
@SideOnly(Side.CLIENT)
public void renderScreen(IGuiLexiconEntry gui, int mx, int my) {
@@ -72,7 +72,7 @@ public class PageMultiblock extends LexiconPage {
((GuiScreen) gui).drawTexturedModalRect(gui.getLeft(), gui.getTop(), 0, 0, gui.getWidth(), gui.getHeight());
GL11.glDisable(GL11.GL_BLEND);
GL11.glEnable(GL11.GL_ALPHA_TEST);
final float maxX = 90, maxY = 60;
GL11.glPushMatrix();
GL11.glTranslatef(gui.getLeft() + gui.getWidth() / 2, gui.getTop() + 90, gui.getZLevel() + 100F);
@@ -86,20 +86,20 @@ public class PageMultiblock extends LexiconPage {
GL11.glRotatef(-20F, 1, 0, 0);
GL11.glRotatef(gui.getElapsedTicks(), 0, 1, 0);
for(MultiblockComponent comp : mb.getComponents()) {
ChunkCoordinates pos = comp.getRelativePosition();
renderBlock(comp.getBlock(), comp.getMeta(), pos.posX + mb.offX, pos.posY + mb.offY, pos.posZ + mb.offZ);
}
GL11.glPopMatrix();
FontRenderer font = Minecraft.getMinecraft().fontRenderer;
boolean unicode = font.getUnicodeFlag();
String s = EnumChatFormatting.BOLD + StatCollector.translateToLocal(getUnlocalizedName());
font.setUnicodeFlag(true);
font.drawString(s, gui.getLeft() + gui.getWidth() / 2 - font.getStringWidth(s) / 2, gui.getTop() + 16, 0x000000);
font.setUnicodeFlag(unicode);
GL11.glEnable(GL12.GL_RESCALE_NORMAL);
RenderHelper.enableGUIStandardItemLighting();
int x = gui.getLeft() + 15;
@@ -107,7 +107,7 @@ public class PageMultiblock extends LexiconPage {
RenderItem.getInstance().renderItemIntoGUI(font, render, new ItemStack(Blocks.stonebrick), x, y);
RenderHelper.disableStandardItemLighting();
GL11.glDisable(GL12.GL_RESCALE_NORMAL);
GL11.glPushMatrix();
GL11.glTranslatef(0F, 0F, 200F);
if(mx >= x && mx < x + 16 && my >= y && my < y + 16) {
@@ -119,7 +119,7 @@ public class PageMultiblock extends LexiconPage {
size = "0" + size;
mats.add(" " + EnumChatFormatting.AQUA + size + " " + EnumChatFormatting.GRAY + stack.getDisplayName());
}
vazkii.botania.client.core.helper.RenderHelper.renderTooltip(mx, my, mats);
}
GL11.glPopMatrix();
@@ -131,7 +131,7 @@ public class PageMultiblock extends LexiconPage {
GL11.glPushMatrix();
GL11.glTranslatef(x, y, z);
RenderBlocks blockRender = RenderBlocks.getInstance();
if(IMultiblockRenderHook.renderHooks.containsKey(block))
IMultiblockRenderHook.renderHooks.get(block).renderBlockForMultiblock(Minecraft.getMinecraft().theWorld, mb, block, meta, blockRender);
@@ -139,13 +139,13 @@ public class PageMultiblock extends LexiconPage {
GL11.glPopMatrix();
}
}
@Override
public void onOpened(IGuiLexiconEntry gui) {
button = new GuiButton(101, gui.getLeft() + 30, gui.getTop() + gui.getHeight() - 50, gui.getWidth() - 60, 20, getButtonStr());
gui.getButtonList().add(button);
}
String getButtonStr() {
return StatCollector.translateToLocal(MultiblockRenderHandler.currentMultiblock == set ? "botaniamisc.unvisualize" : "botaniamisc.visualize");
}
@@ -165,7 +165,7 @@ public class PageMultiblock extends LexiconPage {
button.displayString = getButtonStr();
}
}
@Override
@SideOnly(Side.CLIENT)
public void updateScreen() {
@@ -64,14 +64,14 @@ public class PageText extends LexiconPage {
String prev = lineStr;
String spaced = token + " ";
lineStr += spaced;
controlCodes = toControlCodes(getControlCodes(prev));
if(font.getStringWidth(lineStr) > width) {
lines.add(words);
lineStr = controlCodes + spaced;
words = new ArrayList();
}
words.add(controlCodes + token);
}