mirror of
https://github.com/GTNewHorizons/Botania.git
synced 2026-11-22 13:09:42 +00:00
CLEANUP! Also added Mana Petals.
This commit is contained in:
1 parent
2d72bddc18
commit
41e3844975
86 files changed
+689
-643
No files matched your search
@@ -31,7 +31,7 @@ public final class BotaniaAPI {
|
||||
|
||||
private static List<LexiconCategory> categories = new ArrayList<LexiconCategory>();
|
||||
private static List<LexiconEntry> allEntries = new ArrayList<LexiconEntry>();
|
||||
|
||||
|
||||
public static List<RecipePetals> petalRecipes = new ArrayList<RecipePetals>();
|
||||
public static List<RecipeManaInfusion> manaInfusionRecipes = new ArrayList<RecipeManaInfusion>();
|
||||
|
||||
@@ -39,7 +39,7 @@ public final class BotaniaAPI {
|
||||
static {
|
||||
registerSubTile("", SubTileDummy.class);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* The internal method handler in use. Do not overwrite.
|
||||
* @see IInternalMethodHandler
|
||||
@@ -58,7 +58,7 @@ public final class BotaniaAPI {
|
||||
petalRecipes.add(recipe);
|
||||
return recipe;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Registers a Mana Infusion Recipe (throw an item in a mana pool)
|
||||
* @param output The ItemStack to craft
|
||||
@@ -70,11 +70,11 @@ public final class BotaniaAPI {
|
||||
manaInfusionRecipes.add(recipe);
|
||||
return recipe;
|
||||
}
|
||||
|
||||
|
||||
public static void registerSubTile(String key, Class<? extends SubTileEntity> subtileClass) {
|
||||
subTiles.put(key, subtileClass);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Adds a category to the list of registered categories to appear in the Lexicon.
|
||||
*/
|
||||
@@ -96,7 +96,7 @@ public final class BotaniaAPI {
|
||||
allEntries.add(entry);
|
||||
category.entries.add(entry);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Gets the last recipe to have been added to the recipe list.
|
||||
*/
|
||||
@@ -104,26 +104,26 @@ public final class BotaniaAPI {
|
||||
List<IRecipe> list = CraftingManager.getInstance().getRecipeList();
|
||||
return list.get(list.size() - 1);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Gets the last x recipes added to the recipe list.
|
||||
*/
|
||||
public static List<IRecipe> getLatestAddedRecipes(int x) {
|
||||
List<IRecipe> list = CraftingManager.getInstance().getRecipeList();
|
||||
List<IRecipe> newList = new ArrayList();
|
||||
for(int i = (x - 1); i >= 0; i--)
|
||||
for(int i = x - 1; i >= 0; i--)
|
||||
newList.add(list.get(list.size() - 1 - i));
|
||||
|
||||
|
||||
return newList;
|
||||
}
|
||||
|
||||
|
||||
public static Class<? extends SubTileEntity> getSubTileMapping(String key) {
|
||||
if(!subTiles.containsKey(key))
|
||||
key = "";
|
||||
|
||||
|
||||
return subTiles.get(key);
|
||||
}
|
||||
|
||||
|
||||
public static String getSubTileStringMapping(Class<? extends SubTileEntity> clazz) {
|
||||
return subTiles.inverse().get(clazz);
|
||||
}
|
||||
|
||||
@@ -25,5 +25,5 @@ public interface ILexiconable {
|
||||
* Gets the lexicon entry to open at this location. null works too.
|
||||
*/
|
||||
public LexiconEntry getEntry(World world, int x, int y, int z, EntityPlayer player, ItemStack lexicon);
|
||||
|
||||
|
||||
}
|
||||
@@ -19,7 +19,7 @@ import net.minecraft.world.World;
|
||||
* Any block that implements this can be used with the Wand for the Forest for some purpose.
|
||||
*/
|
||||
public interface IWandable {
|
||||
|
||||
|
||||
public boolean onUsedByWand(EntityPlayer player, ItemStack stack, World world, int x, int y, int z, int side);
|
||||
|
||||
}
|
||||
@@ -22,10 +22,10 @@ public class LexiconEntry implements Comparable<LexiconEntry>{
|
||||
|
||||
public final String unlocalizedName;
|
||||
public final LexiconCategory category;
|
||||
|
||||
|
||||
public List<LexiconPage> pages = new ArrayList<LexiconPage>();
|
||||
private boolean priority = false;
|
||||
|
||||
|
||||
/**
|
||||
* @param unlocalizedName The unlocalized name of this entry. This will be localized by the client display.
|
||||
*/
|
||||
@@ -33,7 +33,7 @@ public class LexiconEntry implements Comparable<LexiconEntry>{
|
||||
this.unlocalizedName = unlocalizedName;
|
||||
this.category = category;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Sets this page as prioritized, as in, will appear before others in the lexicon.
|
||||
*/
|
||||
@@ -41,7 +41,7 @@ public class LexiconEntry implements Comparable<LexiconEntry>{
|
||||
priority = true;
|
||||
return this;
|
||||
}
|
||||
|
||||
|
||||
public boolean isPriority() {
|
||||
return priority;
|
||||
}
|
||||
|
||||
@@ -49,7 +49,7 @@ public interface IGuiLexiconEntry {
|
||||
* Gets the GUI's height
|
||||
*/
|
||||
public int getHeight();
|
||||
|
||||
|
||||
/**
|
||||
* Gets the GUI's Z level for rendering.
|
||||
*/
|
||||
|
||||
@@ -31,9 +31,9 @@ public interface IInternalMethodHandler {
|
||||
public LexiconPage imagePage(String key, String resource);
|
||||
|
||||
public LexiconPage recipesPage(String key, List<IRecipe> recipes);
|
||||
|
||||
|
||||
public LexiconPage recipePage(String key, IRecipe recipe);
|
||||
|
||||
|
||||
public Icon getSubTileIconForName(String name);
|
||||
|
||||
}
|
||||
@@ -18,19 +18,19 @@ import net.minecraft.util.ChunkCoordinates;
|
||||
* Interface for the Mana Burst entity. This can safely be casted to EntityThrowable.
|
||||
*/
|
||||
public interface IManaBurst {
|
||||
|
||||
|
||||
public boolean isFake();
|
||||
|
||||
|
||||
public void setMotion(double x, double y, double z);
|
||||
|
||||
|
||||
public int getColor();
|
||||
|
||||
|
||||
public void setColor(int color);
|
||||
|
||||
public int getMana();
|
||||
|
||||
public void setMana(int mana);
|
||||
|
||||
|
||||
public int getStartingMana();
|
||||
|
||||
public void setStartingMana(int mana);
|
||||
@@ -42,19 +42,19 @@ public interface IManaBurst {
|
||||
public float getManaLossPerTick();
|
||||
|
||||
public void setManaLossPerTick(float mana);
|
||||
|
||||
|
||||
public float getGravity();
|
||||
|
||||
|
||||
public void setGravity(float gravity);
|
||||
|
||||
public ChunkCoordinates getBurstSourceChunkCoordinates();
|
||||
|
||||
public void setBurstSourceCoords(int x, int y, int z);
|
||||
|
||||
|
||||
public ItemStack getSourceLens();
|
||||
|
||||
|
||||
public void setSourceLens(ItemStack lens);
|
||||
|
||||
|
||||
public boolean hasAlreadyCollidedAt(int x, int y, int z);
|
||||
|
||||
}
|
||||
@@ -22,9 +22,9 @@ public final class BurstProperties {
|
||||
public float manaLossPerTick;
|
||||
public float gravity;
|
||||
public float motionModifier;
|
||||
|
||||
|
||||
public int color;
|
||||
|
||||
|
||||
public BurstProperties(int maxMana, int ticksBeforeManaLoss, float manaLossPerTick, float gravity, float motionModifier, int color) {
|
||||
this.maxMana = maxMana;
|
||||
this.ticksBeforeManaLoss = ticksBeforeManaLoss;
|
||||
@@ -33,5 +33,5 @@ public final class BurstProperties {
|
||||
this.motionModifier = motionModifier;
|
||||
this.color = color;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -21,27 +21,27 @@ import cpw.mods.fml.relauncher.SideOnly;
|
||||
* Have an Item implement this to be counted as a lens for the mana spreader.
|
||||
*/
|
||||
public interface ILens {
|
||||
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public int getLensColor(ItemStack stack);
|
||||
|
||||
|
||||
/**
|
||||
* Called when a mana spreader that has this focus shoots a burst. This is where
|
||||
* you change the properties of the burst.
|
||||
*/
|
||||
public void apply(ItemStack stack, BurstProperties props);
|
||||
|
||||
|
||||
/**
|
||||
* Called when a mana burst fired from a mana spreader with this focus collides against
|
||||
* any block. This is called after the collision is handled.
|
||||
* @return True to kill the burst. False to keep it alive.
|
||||
*/
|
||||
public boolean collideBurst(IManaBurst burst, MovingObjectPosition pos, boolean isManaBlock, boolean dead, ItemStack stack);
|
||||
|
||||
|
||||
/**
|
||||
* Called when a mana burst fired from a mana spreader with this focus is updated.
|
||||
* This is called before the update is handled.
|
||||
*/
|
||||
public void updateBurst(IManaBurst burst, ItemStack stack);
|
||||
|
||||
|
||||
}
|
||||
@@ -22,5 +22,5 @@ public interface IManaBlock {
|
||||
* Gets the amount of mana currently in this block.
|
||||
*/
|
||||
public int getCurrentMana();
|
||||
|
||||
|
||||
}
|
||||
@@ -20,7 +20,7 @@ package vazkii.botania.api.mana;
|
||||
* - On the first tick of onUpdate(), call </i>ManaNetworkEvent.addCollector(this);<i>
|
||||
*/
|
||||
public interface IManaCollector extends IManaReceiver {
|
||||
|
||||
|
||||
/**
|
||||
* Called every tick on the client case the player is holding a Wand of the Forest.
|
||||
*/
|
||||
|
||||
@@ -20,16 +20,16 @@ public interface IManaReceiver extends IManaBlock {
|
||||
* Is this Mana Receiver is full? Being full means no mana bursts will be sent.
|
||||
*/
|
||||
public boolean isFull();
|
||||
|
||||
|
||||
/**
|
||||
* Called when this receiver receives mana.
|
||||
*/
|
||||
public void recieveMana(int mana);
|
||||
|
||||
|
||||
/**
|
||||
* Can this tile receive mana from bursts? Generally set to false for
|
||||
* implementations of IManaCollector.
|
||||
*/
|
||||
public boolean canRecieveManaFromBursts();
|
||||
|
||||
|
||||
}
|
||||
@@ -20,13 +20,13 @@ public class ManaNetworkEvent extends Event {
|
||||
public final TileEntity tile;
|
||||
public final ManaBlockType type;
|
||||
public final Action action;
|
||||
|
||||
|
||||
public ManaNetworkEvent(TileEntity tile, ManaBlockType type, Action action) {
|
||||
this.tile = tile;
|
||||
this.type = type;
|
||||
this.action = action;
|
||||
}
|
||||
|
||||
|
||||
public static void addCollector(TileEntity tile) {
|
||||
ManaNetworkEvent event = new ManaNetworkEvent(tile, ManaBlockType.COLLECTOR, Action.ADD);
|
||||
MinecraftForge.EVENT_BUS.post(event);
|
||||
@@ -36,21 +36,21 @@ public class ManaNetworkEvent extends Event {
|
||||
ManaNetworkEvent event = new ManaNetworkEvent(tile, ManaBlockType.COLLECTOR, Action.REMOVE);
|
||||
MinecraftForge.EVENT_BUS.post(event);
|
||||
}
|
||||
|
||||
|
||||
public static void addPool(TileEntity tile) {
|
||||
ManaNetworkEvent event = new ManaNetworkEvent(tile, ManaBlockType.POOL, Action.ADD);
|
||||
MinecraftForge.EVENT_BUS.post(event);
|
||||
}
|
||||
|
||||
|
||||
public static void removePool(TileEntity tile) {
|
||||
ManaNetworkEvent event = new ManaNetworkEvent(tile, ManaBlockType.POOL, Action.ADD);
|
||||
MinecraftForge.EVENT_BUS.post(event);
|
||||
}
|
||||
|
||||
|
||||
public enum ManaBlockType {
|
||||
POOL, COLLECTOR
|
||||
}
|
||||
|
||||
|
||||
public enum Action {
|
||||
REMOVE, ADD
|
||||
}
|
||||
|
||||
@@ -35,7 +35,7 @@ public abstract class LexiconPage {
|
||||
public void updateScreen() {
|
||||
// NO-OP
|
||||
}
|
||||
|
||||
|
||||
public String getUnlocalizedName() {
|
||||
return unlocalizedName;
|
||||
}
|
||||
|
||||
@@ -15,21 +15,21 @@ import net.minecraft.item.ItemStack;
|
||||
import net.minecraftforge.oredict.OreDictionary;
|
||||
|
||||
public class RecipeManaInfusion {
|
||||
|
||||
|
||||
ItemStack output;
|
||||
Object input;
|
||||
int mana;
|
||||
|
||||
|
||||
public RecipeManaInfusion(ItemStack output, Object input, int mana) {
|
||||
this.output = output;
|
||||
this.input = input;
|
||||
this.mana = mana;
|
||||
}
|
||||
|
||||
|
||||
public boolean matches(ItemStack stack) {
|
||||
if(input instanceof ItemStack)
|
||||
return stack.isItemEqual((ItemStack) input);
|
||||
|
||||
|
||||
String oredict = OreDictionary.getOreName(OreDictionary.getOreID(stack));
|
||||
return oredict.equals(input);
|
||||
}
|
||||
@@ -37,7 +37,7 @@ public class RecipeManaInfusion {
|
||||
public ItemStack getOutput() {
|
||||
return output;
|
||||
}
|
||||
|
||||
|
||||
public int getManaToConsume() {
|
||||
return mana;
|
||||
}
|
||||
|
||||
@@ -21,31 +21,31 @@ public class RecipePetals {
|
||||
|
||||
ItemStack output;
|
||||
List<Integer> colors = new ArrayList();
|
||||
|
||||
|
||||
public RecipePetals(ItemStack output, int... colors) {
|
||||
this.output = output;
|
||||
for(int c : colors)
|
||||
this.colors.add(c);
|
||||
}
|
||||
|
||||
|
||||
public boolean matches(IInventory inv) {
|
||||
List<Integer> colorsMissing = new ArrayList(colors);
|
||||
|
||||
|
||||
for(int i = 0; i < inv.getSizeInventory(); i++) {
|
||||
ItemStack stack = inv.getStackInSlot(i);
|
||||
if(stack == null)
|
||||
break;
|
||||
|
||||
|
||||
int color = stack.getItemDamage();
|
||||
|
||||
|
||||
if(!colorsMissing.contains(color))
|
||||
return false;
|
||||
colorsMissing.remove((Integer) color);
|
||||
}
|
||||
|
||||
|
||||
return colorsMissing.isEmpty();
|
||||
}
|
||||
|
||||
|
||||
public ItemStack getOutput() {
|
||||
return output;
|
||||
}
|
||||
|
||||
@@ -29,37 +29,37 @@ import cpw.mods.fml.relauncher.SideOnly;
|
||||
* a no parameter constructor.
|
||||
*/
|
||||
public class SubTileEntity {
|
||||
|
||||
|
||||
protected TileEntity supertile;
|
||||
|
||||
|
||||
public void setSupertile(TileEntity tile) {
|
||||
supertile = tile;
|
||||
}
|
||||
|
||||
public boolean canUpdate() {
|
||||
|
||||
public boolean canUpdate() {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
public void onUpdate() { }
|
||||
|
||||
|
||||
/**
|
||||
* Writes some extra data to a network packet. This data is read
|
||||
* by readFromPacketNBT on the client that receives the packet.
|
||||
* Note: This method is also used to write to the world NBT.
|
||||
*/
|
||||
public void writeToPacketNBT(NBTTagCompound cmp) { }
|
||||
|
||||
|
||||
/**
|
||||
* Reads data from a network packet. This data is written by
|
||||
* writeToPacketNBT in the server. Note: This method is also used
|
||||
* to read from the world NBT.
|
||||
*/
|
||||
public void readFromPacketNBT(NBTTagCompound cmp) { }
|
||||
|
||||
|
||||
public String getUnlocalizedName() {
|
||||
return BotaniaAPI.getSubTileStringMapping(getClass());
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Gets the icon for this SubTileEntity, this is a block icon.
|
||||
*/
|
||||
@@ -75,14 +75,14 @@ public class SubTileEntity {
|
||||
public boolean onWanded(EntityPlayer player, ItemStack wand) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Gets which Lexicon Entry to open when this sub tile is right clicked with a lexicon.
|
||||
*/
|
||||
public LexiconEntry getEntry() {
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Called on the client when the block being pointed at is the one with this sub tile.
|
||||
* Used to render a HUD portraying some data from this sub tile.
|
||||
|
||||
@@ -39,7 +39,7 @@ public final class HUDHandler {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public static void drawSimpleManaHUD(int color, int mana, int maxMana, String name, ScaledResolution res) {
|
||||
int type = 0;
|
||||
if(mana >= 0) {
|
||||
@@ -62,7 +62,7 @@ public final class HUDHandler {
|
||||
mc.fontRenderer.drawStringWithShadow(filling, res.getScaledWidth() / 2 - mc.fontRenderer.getStringWidth(filling) / 2, res.getScaledHeight() / 2 + 20, color);
|
||||
GL11.glDisable(GL11.GL_BLEND);
|
||||
}
|
||||
|
||||
|
||||
public interface IHUD {
|
||||
public void renderHUD(Minecraft mc, ScaledResolution res, World world, int x, int y, int z);
|
||||
}
|
||||
|
||||
@@ -18,7 +18,6 @@ import net.minecraft.client.gui.FontRenderer;
|
||||
import net.minecraft.client.renderer.Tessellator;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
import org.lwjgl.opengl.GL12;
|
||||
|
||||
public final class RenderHelper {
|
||||
|
||||
@@ -35,7 +34,7 @@ public final class RenderHelper {
|
||||
|
||||
renderTooltip(x, y, tooltipData, color, color2);
|
||||
}
|
||||
|
||||
|
||||
public static void renderTooltip(int x, int y, List<String> tooltipData, int color, int color2) {
|
||||
boolean lighting = GL11.glGetBoolean(GL11.GL_LIGHTING);
|
||||
if(lighting)
|
||||
@@ -76,10 +75,10 @@ public final class RenderHelper {
|
||||
var7 += 10;
|
||||
}
|
||||
}
|
||||
GL11.glEnable(GL11.GL_DEPTH_TEST);
|
||||
GL11.glEnable(GL11.GL_DEPTH_TEST);
|
||||
if(!lighting)
|
||||
net.minecraft.client.renderer.RenderHelper.disableStandardItemLighting();
|
||||
GL11.glColor4f(1F, 1F, 1F, 1F);
|
||||
GL11.glColor4f(1F, 1F, 1F, 1F);
|
||||
}
|
||||
|
||||
public static void drawGradientRect(int par1, int par2, float z, int par3, int par4, int par5, int par6) {
|
||||
|
||||
@@ -15,6 +15,10 @@ import java.math.BigDecimal;
|
||||
import java.math.MathContext;
|
||||
import java.math.RoundingMode;
|
||||
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.Vec3;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
import org.lwjgl.util.vector.Vector3f;
|
||||
import org.lwjgl.util.vector.Vector4f;
|
||||
@@ -22,10 +26,6 @@ import org.lwjgl.util.vector.Vector4f;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.Vec3;
|
||||
|
||||
public class Vector3
|
||||
{
|
||||
public static Vector3 zero = new Vector3();
|
||||
@@ -215,6 +215,7 @@ public class Vector3
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString()
|
||||
{
|
||||
MathContext cont = new MathContext(4, RoundingMode.HALF_UP);
|
||||
@@ -275,7 +276,7 @@ public class Vector3
|
||||
|
||||
public boolean isAxial()
|
||||
{
|
||||
return x == 0 ? (y == 0 || z == 0) : (y == 0 && z == 0);
|
||||
return x == 0 ? y == 0 || z == 0 : y == 0 && z == 0;
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
|
||||
@@ -48,12 +48,12 @@ public class ClientProxy extends CommonProxy {
|
||||
@Override
|
||||
public void init(FMLInitializationEvent event) {
|
||||
super.init(event);
|
||||
|
||||
|
||||
MinecraftForge.EVENT_BUS.register(new HUDHandler());
|
||||
|
||||
|
||||
initRenderers();
|
||||
}
|
||||
|
||||
|
||||
private void initRenderers() {
|
||||
LibRenderIDs.idAltar = RenderingRegistry.getNextAvailableRenderId();
|
||||
LibRenderIDs.idSpecialFlower = RenderingRegistry.getNextAvailableRenderId();
|
||||
@@ -64,7 +64,7 @@ public class ClientProxy extends CommonProxy {
|
||||
RenderingRegistry.registerBlockHandler(new RenderSpecialFlower());
|
||||
RenderingRegistry.registerBlockHandler(new RenderSpreader());
|
||||
RenderingRegistry.registerBlockHandler(new RenderPool());
|
||||
|
||||
|
||||
RenderLens lensRender = new RenderLens();
|
||||
MinecraftForgeClient.registerItemRenderer(ModItems.lens.itemID, lensRender);
|
||||
|
||||
@@ -72,12 +72,12 @@ public class ClientProxy extends CommonProxy {
|
||||
ClientRegistry.bindTileEntitySpecialRenderer(TileSpreader.class, new RenderTileSpreader());
|
||||
ClientRegistry.bindTileEntitySpecialRenderer(TilePool.class, new RenderTilePool());
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void setEntryToOpen(LexiconEntry entry) {
|
||||
GuiLexicon.currentOpenLexicon = new GuiLexiconEntry(entry, new GuiLexiconIndex(entry.category));
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void twigWandClientUpdate() {
|
||||
for(TileEntity tile : ManaNetworkHandler.instance.getAllInWorld(ManaNetworkHandler.instance.manaCollectors, Minecraft.getMinecraft().thePlayer.dimension)) {
|
||||
@@ -85,14 +85,14 @@ public class ClientProxy extends CommonProxy {
|
||||
((IManaCollector) tile).onClientDisplayTick();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void sparkleFX(World world, double x, double y, double z, float r, float g, float b, float size, int m, boolean fake) {
|
||||
FXSparkle sparkle = new FXSparkle(world, x, y, z, size, r, g, b, m);
|
||||
sparkle.fake = sparkle.noClip = fake;
|
||||
Minecraft.getMinecraft().effectRenderer.addEffect(sparkle);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void wispFX(World world, double x, double y, double z, float r, float g, float b, float size, float motionx, float motiony, float motionz) {
|
||||
FXWisp wisp = new FXWisp(world, x, y, z, size, r, g, b);
|
||||
|
||||
@@ -152,9 +152,9 @@ public class FXSparkle extends EntityFX
|
||||
fx.noClip=true;
|
||||
FMLClientHandler.instance().getClient().effectRenderer.addEffect(fx);
|
||||
}
|
||||
|
||||
if(fake && particleAge > 1)
|
||||
setDead();
|
||||
|
||||
if(fake && particleAge > 1)
|
||||
setDead();
|
||||
}
|
||||
|
||||
public void setGravity(float value) {
|
||||
|
||||
@@ -29,7 +29,7 @@ import vazkii.botania.common.item.ModItems;
|
||||
public class GuiLexicon extends GuiScreen {
|
||||
|
||||
public static GuiLexicon currentOpenLexicon = new GuiLexicon();
|
||||
|
||||
|
||||
public static final ResourceLocation texture = new ResourceLocation(LibResources.GUI_LEXICON);
|
||||
|
||||
int guiWidth = 146;
|
||||
@@ -40,7 +40,7 @@ public class GuiLexicon extends GuiScreen {
|
||||
public void initGui() {
|
||||
super.initGui();
|
||||
currentOpenLexicon = this;
|
||||
|
||||
|
||||
left = width / 2 - guiWidth / 2;
|
||||
top = height / 2 - guiHeight / 2;
|
||||
|
||||
|
||||
@@ -99,7 +99,7 @@ public class GuiLexiconEntry extends GuiLexicon implements IGuiLexiconEntry {
|
||||
LexiconPage page = entry.pages.get(this.page);
|
||||
page.renderScreen(this, par1, par2);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void updateScreen() {
|
||||
LexiconPage page = entry.pages.get(this.page);
|
||||
|
||||
@@ -13,7 +13,6 @@ package vazkii.botania.client.gui;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.Comparator;
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.client.gui.GuiButton;
|
||||
@@ -60,7 +59,7 @@ public class GuiLexiconIndex extends GuiLexicon {
|
||||
entriesToDisplay.clear();
|
||||
entriesToDisplay.addAll(category.entries);
|
||||
Collections.sort(entriesToDisplay);
|
||||
|
||||
|
||||
updatePageButtons();
|
||||
populateIndex();
|
||||
}
|
||||
@@ -101,7 +100,7 @@ public class GuiLexiconIndex extends GuiLexicon {
|
||||
mc.displayGuiScreen(new GuiLexiconEntry(entry, this));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public void updatePageButtons() {
|
||||
leftButton.enabled = page != 0;
|
||||
rightButton.enabled = page < (entriesToDisplay.size() - 1) / 12;
|
||||
|
||||
@@ -36,7 +36,7 @@ public class GuiButtonBack extends GuiButton {
|
||||
par1Minecraft.renderEngine.bindTexture(GuiLexicon.texture);
|
||||
GL11.glColor4f(1F, 1F, 1F, 1F);
|
||||
drawTexturedModalRect(xPosition, yPosition, 36, k == 2 ? 180 : 189, 18, 9);
|
||||
|
||||
|
||||
if(k == 2)
|
||||
RenderHelper.renderTooltip(par2, par3, Arrays.asList(StatCollector.translateToLocal("botaniamisc.back")));
|
||||
}
|
||||
|
||||
@@ -13,7 +13,6 @@ package vazkii.botania.client.gui.button;
|
||||
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.gui.GuiButton;
|
||||
import net.minecraft.util.EnumChatFormatting;
|
||||
|
||||
public class GuiButtonInvisible extends GuiButton {
|
||||
|
||||
|
||||
@@ -40,7 +40,7 @@ public class GuiButtonPage extends GuiButton {
|
||||
par1Minecraft.renderEngine.bindTexture(GuiLexicon.texture);
|
||||
GL11.glColor4f(1F, 1F, 1F, 1F);
|
||||
drawTexturedModalRect(xPosition, yPosition, k == 2 ? 18 : 0, right ? 180 : 190, 18, 10);
|
||||
|
||||
|
||||
if(k == 2)
|
||||
RenderHelper.renderTooltip(par2, par3, Arrays.asList(StatCollector.translateToLocal(right ? "botaniamisc.nextPage" : "botaniamisc.prevPage")));
|
||||
}
|
||||
|
||||
@@ -18,7 +18,7 @@ public final class LibResources {
|
||||
public static final String PREFIX_LANG = "/assets/botania/lang/";
|
||||
|
||||
public static final String PREFIX_GUI = PREFIX_MOD + "textures/gui/";
|
||||
public static final String PREFIX_ENTRIES = PREFIX_GUI + "entries/";
|
||||
public static final String PREFIX_ENTRIES = PREFIX_GUI + "entries/";
|
||||
public static final String PREFIX_MODEL = PREFIX_MOD + "textures/model/";
|
||||
public static final String PREFIX_MISC = PREFIX_MOD + "textures/misc/";
|
||||
|
||||
|
||||
@@ -15,7 +15,7 @@ import net.minecraft.client.model.ModelBase;
|
||||
import net.minecraft.client.model.ModelRenderer;
|
||||
|
||||
public class ModelAltar extends ModelBase {
|
||||
|
||||
|
||||
ModelRenderer gobletBase;
|
||||
ModelRenderer gobletBase2;
|
||||
ModelRenderer gobletBase3;
|
||||
@@ -32,45 +32,45 @@ public class ModelAltar extends ModelBase {
|
||||
textureHeight = 128;
|
||||
|
||||
gobletBase = new ModelRenderer(this, 0, 0);
|
||||
gobletBase.addBox(0F, 0F, 0F, 16, 2, 16);
|
||||
gobletBase.setRotationPoint(-8F, 22F, -8F);
|
||||
gobletBase.setTextureSize(256, 128);
|
||||
gobletBase2 = new ModelRenderer(this, 0, 18);
|
||||
gobletBase2.addBox(0F, 0F, 0F, 14, 1, 14);
|
||||
gobletBase2.setRotationPoint(-7F, 21F, -7F);
|
||||
gobletBase2.setTextureSize(256, 128);
|
||||
gobletStand = new ModelRenderer(this, 68, 0);
|
||||
gobletStand.addBox(0F, 0F, 0F, 6, 8, 6);
|
||||
gobletStand.setRotationPoint(-3F, 12F, -3F);
|
||||
gobletStand.setTextureSize(256, 128);
|
||||
gobletBase3 = new ModelRenderer(this, 0, 33);
|
||||
gobletBase3.addBox(0F, 0F, 0F, 12, 1, 12);
|
||||
gobletBase3.setRotationPoint(-6F, 20F, -6F);
|
||||
gobletBase3.setTextureSize(256, 128);
|
||||
kelkBase = new ModelRenderer(this, 72, 45);
|
||||
kelkBase.addBox(0F, 0F, 0F, 8, 1, 8);
|
||||
kelkBase.setRotationPoint(-4F, 11F, -4F);
|
||||
kelkBase.setTextureSize(256, 128);
|
||||
kelkBase2 = new ModelRenderer(this, 72, 34);
|
||||
kelkBase2.addBox(0F, 0F, 0F, 10, 1, 10);
|
||||
kelkBase2.setRotationPoint(-5F, 10F, -5F);
|
||||
kelkBase2.setTextureSize(256, 128);
|
||||
kelkWall1 = new ModelRenderer(this, 72, 18);
|
||||
kelkWall1.addBox(0F, 0F, 0F, 1, 6, 10);
|
||||
kelkWall1.setRotationPoint(5F, 4F, -5F);
|
||||
kelkWall1.setTextureSize(256, 128);
|
||||
kelkWall2 = new ModelRenderer(this, 72, 18);
|
||||
kelkWall2.addBox(0F, 0F, 0F, 1, 6, 10);
|
||||
kelkWall2.setRotationPoint(-6F, 4F, -5F);
|
||||
kelkWall2.setTextureSize(256, 128);
|
||||
kelkWall3 = new ModelRenderer(this, 94, 18);
|
||||
kelkWall3.addBox(0F, 0F, 0F, 10, 6, 1);
|
||||
kelkWall3.setRotationPoint(-5F, 4F, 5F);
|
||||
kelkWall3.setTextureSize(256, 128);
|
||||
kelkWall4 = new ModelRenderer(this, 94, 18);
|
||||
kelkWall4.addBox(0F, 0F, 0F, 10, 6, 1);
|
||||
kelkWall4.setRotationPoint(-5F, 4F, -6F);
|
||||
kelkWall4.setTextureSize(256, 128);
|
||||
gobletBase.addBox(0F, 0F, 0F, 16, 2, 16);
|
||||
gobletBase.setRotationPoint(-8F, 22F, -8F);
|
||||
gobletBase.setTextureSize(256, 128);
|
||||
gobletBase2 = new ModelRenderer(this, 0, 18);
|
||||
gobletBase2.addBox(0F, 0F, 0F, 14, 1, 14);
|
||||
gobletBase2.setRotationPoint(-7F, 21F, -7F);
|
||||
gobletBase2.setTextureSize(256, 128);
|
||||
gobletStand = new ModelRenderer(this, 68, 0);
|
||||
gobletStand.addBox(0F, 0F, 0F, 6, 8, 6);
|
||||
gobletStand.setRotationPoint(-3F, 12F, -3F);
|
||||
gobletStand.setTextureSize(256, 128);
|
||||
gobletBase3 = new ModelRenderer(this, 0, 33);
|
||||
gobletBase3.addBox(0F, 0F, 0F, 12, 1, 12);
|
||||
gobletBase3.setRotationPoint(-6F, 20F, -6F);
|
||||
gobletBase3.setTextureSize(256, 128);
|
||||
kelkBase = new ModelRenderer(this, 72, 45);
|
||||
kelkBase.addBox(0F, 0F, 0F, 8, 1, 8);
|
||||
kelkBase.setRotationPoint(-4F, 11F, -4F);
|
||||
kelkBase.setTextureSize(256, 128);
|
||||
kelkBase2 = new ModelRenderer(this, 72, 34);
|
||||
kelkBase2.addBox(0F, 0F, 0F, 10, 1, 10);
|
||||
kelkBase2.setRotationPoint(-5F, 10F, -5F);
|
||||
kelkBase2.setTextureSize(256, 128);
|
||||
kelkWall1 = new ModelRenderer(this, 72, 18);
|
||||
kelkWall1.addBox(0F, 0F, 0F, 1, 6, 10);
|
||||
kelkWall1.setRotationPoint(5F, 4F, -5F);
|
||||
kelkWall1.setTextureSize(256, 128);
|
||||
kelkWall2 = new ModelRenderer(this, 72, 18);
|
||||
kelkWall2.addBox(0F, 0F, 0F, 1, 6, 10);
|
||||
kelkWall2.setRotationPoint(-6F, 4F, -5F);
|
||||
kelkWall2.setTextureSize(256, 128);
|
||||
kelkWall3 = new ModelRenderer(this, 94, 18);
|
||||
kelkWall3.addBox(0F, 0F, 0F, 10, 6, 1);
|
||||
kelkWall3.setRotationPoint(-5F, 4F, 5F);
|
||||
kelkWall3.setTextureSize(256, 128);
|
||||
kelkWall4 = new ModelRenderer(this, 94, 18);
|
||||
kelkWall4.addBox(0F, 0F, 0F, 10, 6, 1);
|
||||
kelkWall4.setRotationPoint(-5F, 4F, -6F);
|
||||
kelkWall4.setTextureSize(256, 128);
|
||||
}
|
||||
|
||||
public void render() {
|
||||
|
||||
@@ -20,7 +20,6 @@ import org.lwjgl.opengl.GL11;
|
||||
|
||||
import vazkii.botania.client.lib.LibRenderIDs;
|
||||
import vazkii.botania.common.block.tile.TilePool;
|
||||
import vazkii.botania.common.block.tile.TileSpreader;
|
||||
import cpw.mods.fml.client.registry.ISimpleBlockRenderingHandler;
|
||||
|
||||
public class RenderPool implements ISimpleBlockRenderingHandler {
|
||||
|
||||
@@ -11,13 +11,13 @@
|
||||
*/
|
||||
package vazkii.botania.client.render.block;
|
||||
|
||||
import vazkii.botania.client.lib.LibRenderIDs;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.client.renderer.EntityRenderer;
|
||||
import net.minecraft.client.renderer.RenderBlocks;
|
||||
import net.minecraft.client.renderer.Tessellator;
|
||||
import net.minecraft.util.Icon;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import vazkii.botania.client.lib.LibRenderIDs;
|
||||
import cpw.mods.fml.client.registry.ISimpleBlockRenderingHandler;
|
||||
|
||||
public class RenderSpecialFlower implements ISimpleBlockRenderingHandler {
|
||||
@@ -31,68 +31,68 @@ public class RenderSpecialFlower implements ISimpleBlockRenderingHandler {
|
||||
public boolean renderWorldBlock(IBlockAccess blockAccess, int x, int y, int z, Block block, int modelId, RenderBlocks renderer) {
|
||||
return renderCrossedSquares(blockAccess, block, x, y, z, renderer);
|
||||
}
|
||||
|
||||
|
||||
// Copied from RenderBlocks
|
||||
public boolean renderCrossedSquares(IBlockAccess blockAccess, Block par1Block, int par2, int par3, int par4, RenderBlocks render) {
|
||||
Tessellator tessellator = Tessellator.instance;
|
||||
tessellator.setBrightness(par1Block.getMixedBrightnessForBlock(blockAccess, par2, par3, par4));
|
||||
float f = 1.0F;
|
||||
int l = par1Block.colorMultiplier(blockAccess, par2, par3, par4);
|
||||
float f1 = (float)(l >> 16 & 255) / 255.0F;
|
||||
float f2 = (float)(l >> 8 & 255) / 255.0F;
|
||||
float f3 = (float)(l & 255) / 255.0F;
|
||||
Tessellator tessellator = Tessellator.instance;
|
||||
tessellator.setBrightness(par1Block.getMixedBrightnessForBlock(blockAccess, par2, par3, par4));
|
||||
float f = 1.0F;
|
||||
int l = par1Block.colorMultiplier(blockAccess, par2, par3, par4);
|
||||
float f1 = (l >> 16 & 255) / 255.0F;
|
||||
float f2 = (l >> 8 & 255) / 255.0F;
|
||||
float f3 = (l & 255) / 255.0F;
|
||||
|
||||
if(EntityRenderer.anaglyphEnable) {
|
||||
float f4 = (f1 * 30.0F + f2 * 59.0F + f3 * 11.0F) / 100.0F;
|
||||
float f5 = (f1 * 30.0F + f2 * 70.0F) / 100.0F;
|
||||
float f6 = (f1 * 30.0F + f3 * 70.0F) / 100.0F;
|
||||
f1 = f4;
|
||||
f2 = f5;
|
||||
f3 = f6;
|
||||
}
|
||||
if(EntityRenderer.anaglyphEnable) {
|
||||
float f4 = (f1 * 30.0F + f2 * 59.0F + f3 * 11.0F) / 100.0F;
|
||||
float f5 = (f1 * 30.0F + f2 * 70.0F) / 100.0F;
|
||||
float f6 = (f1 * 30.0F + f3 * 70.0F) / 100.0F;
|
||||
f1 = f4;
|
||||
f2 = f5;
|
||||
f3 = f6;
|
||||
}
|
||||
|
||||
tessellator.setColorOpaque_F(f * f1, f * f2, f * f3);
|
||||
double d0 = (double)par2;
|
||||
double d1 = (double)par3;
|
||||
double d2 = (double)par4;
|
||||
tessellator.setColorOpaque_F(f * f1, f * f2, f * f3);
|
||||
double d0 = par2;
|
||||
double d1 = par3;
|
||||
double d2 = par4;
|
||||
|
||||
drawCrossedSquares(blockAccess, par1Block, par2, par3, par4, d0, d1, d2, 1.0F, render);
|
||||
return true;
|
||||
}
|
||||
|
||||
drawCrossedSquares(blockAccess, par1Block, par2, par3, par4, d0, d1, d2, 1.0F, render);
|
||||
return true;
|
||||
}
|
||||
|
||||
// Copied from RenderBlocks
|
||||
public void drawCrossedSquares(IBlockAccess blockAccess, Block par1Block, int x, int y, int z, double par3, double par5, double par7, float par9, RenderBlocks render) {
|
||||
Tessellator tessellator = Tessellator.instance;
|
||||
|
||||
// Only change here, to use xyz rather than side/meta
|
||||
Icon icon = render.getBlockIcon(par1Block, blockAccess, x, y, z, 0);
|
||||
Tessellator tessellator = Tessellator.instance;
|
||||
|
||||
double d3 = (double)icon.getMinU();
|
||||
double d4 = (double)icon.getMinV();
|
||||
double d5 = (double)icon.getMaxU();
|
||||
double d6 = (double)icon.getMaxV();
|
||||
double d7 = 0.45D * (double)par9;
|
||||
double d8 = par3 + 0.5D - d7;
|
||||
double d9 = par3 + 0.5D + d7;
|
||||
double d10 = par7 + 0.5D - d7;
|
||||
double d11 = par7 + 0.5D + d7;
|
||||
tessellator.addVertexWithUV(d8, par5 + (double)par9, d10, d3, d4);
|
||||
tessellator.addVertexWithUV(d8, par5 + 0.0D, d10, d3, d6);
|
||||
tessellator.addVertexWithUV(d9, par5 + 0.0D, d11, d5, d6);
|
||||
tessellator.addVertexWithUV(d9, par5 + (double)par9, d11, d5, d4);
|
||||
tessellator.addVertexWithUV(d9, par5 + (double)par9, d11, d3, d4);
|
||||
tessellator.addVertexWithUV(d9, par5 + 0.0D, d11, d3, d6);
|
||||
tessellator.addVertexWithUV(d8, par5 + 0.0D, d10, d5, d6);
|
||||
tessellator.addVertexWithUV(d8, par5 + (double)par9, d10, d5, d4);
|
||||
tessellator.addVertexWithUV(d8, par5 + (double)par9, d11, d3, d4);
|
||||
tessellator.addVertexWithUV(d8, par5 + 0.0D, d11, d3, d6);
|
||||
tessellator.addVertexWithUV(d9, par5 + 0.0D, d10, d5, d6);
|
||||
tessellator.addVertexWithUV(d9, par5 + (double)par9, d10, d5, d4);
|
||||
tessellator.addVertexWithUV(d9, par5 + (double)par9, d10, d3, d4);
|
||||
tessellator.addVertexWithUV(d9, par5 + 0.0D, d10, d3, d6);
|
||||
tessellator.addVertexWithUV(d8, par5 + 0.0D, d11, d5, d6);
|
||||
tessellator.addVertexWithUV(d8, par5 + (double)par9, d11, d5, d4);
|
||||
}
|
||||
// Only change here, to use xyz rather than side/meta
|
||||
Icon icon = render.getBlockIcon(par1Block, blockAccess, x, y, z, 0);
|
||||
|
||||
double d3 = icon.getMinU();
|
||||
double d4 = icon.getMinV();
|
||||
double d5 = icon.getMaxU();
|
||||
double d6 = icon.getMaxV();
|
||||
double d7 = 0.45D * par9;
|
||||
double d8 = par3 + 0.5D - d7;
|
||||
double d9 = par3 + 0.5D + d7;
|
||||
double d10 = par7 + 0.5D - d7;
|
||||
double d11 = par7 + 0.5D + d7;
|
||||
tessellator.addVertexWithUV(d8, par5 + par9, d10, d3, d4);
|
||||
tessellator.addVertexWithUV(d8, par5 + 0.0D, d10, d3, d6);
|
||||
tessellator.addVertexWithUV(d9, par5 + 0.0D, d11, d5, d6);
|
||||
tessellator.addVertexWithUV(d9, par5 + par9, d11, d5, d4);
|
||||
tessellator.addVertexWithUV(d9, par5 + par9, d11, d3, d4);
|
||||
tessellator.addVertexWithUV(d9, par5 + 0.0D, d11, d3, d6);
|
||||
tessellator.addVertexWithUV(d8, par5 + 0.0D, d10, d5, d6);
|
||||
tessellator.addVertexWithUV(d8, par5 + par9, d10, d5, d4);
|
||||
tessellator.addVertexWithUV(d8, par5 + par9, d11, d3, d4);
|
||||
tessellator.addVertexWithUV(d8, par5 + 0.0D, d11, d3, d6);
|
||||
tessellator.addVertexWithUV(d9, par5 + 0.0D, d10, d5, d6);
|
||||
tessellator.addVertexWithUV(d9, par5 + par9, d10, d5, d4);
|
||||
tessellator.addVertexWithUV(d9, par5 + par9, d10, d3, d4);
|
||||
tessellator.addVertexWithUV(d9, par5 + 0.0D, d10, d3, d6);
|
||||
tessellator.addVertexWithUV(d8, par5 + 0.0D, d11, d5, d6);
|
||||
tessellator.addVertexWithUV(d8, par5 + par9, d11, d5, d4);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean shouldRender3DInInventory() {
|
||||
|
||||
@@ -19,7 +19,6 @@ import net.minecraft.world.IBlockAccess;
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import vazkii.botania.client.lib.LibRenderIDs;
|
||||
import vazkii.botania.common.block.tile.TileAltar;
|
||||
import vazkii.botania.common.block.tile.TileSpreader;
|
||||
import cpw.mods.fml.client.registry.ISimpleBlockRenderingHandler;
|
||||
|
||||
|
||||
@@ -54,7 +54,7 @@ public class RenderLens implements IItemRenderer {
|
||||
Icon icon = item.getItem().getIconFromDamageForRenderPass(dmg, 1);
|
||||
render.renderIcon(0, 0, icon, 16, 16);
|
||||
GL11.glDisable(GL11.GL_BLEND);
|
||||
|
||||
|
||||
icon = item.getItem().getIconFromDamageForRenderPass(dmg, 0);
|
||||
GL11.glColor4f(1F, 1F, 1F, 1F);
|
||||
render.renderIcon(0, 0, icon, 16, 16);
|
||||
@@ -78,12 +78,12 @@ public class RenderLens implements IItemRenderer {
|
||||
default : break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public static void render(ItemStack item) {
|
||||
Color color = new Color(((ILens) item.getItem()).getLensColor(item));
|
||||
render(item, color.getRGB());
|
||||
}
|
||||
|
||||
|
||||
public static void render(ItemStack item, int color_) {
|
||||
int dmg = item.getItemDamage();
|
||||
Icon icon = item.getItem().getIconFromDamageForRenderPass(dmg, 0);
|
||||
@@ -92,10 +92,10 @@ public class RenderLens implements IItemRenderer {
|
||||
float f2 = icon.getMinV();
|
||||
float f3 = icon.getMaxV();
|
||||
float scale = 1F / 16F;
|
||||
|
||||
|
||||
GL11.glColor4f(1F, 1F, 1F, 1F);
|
||||
ItemRenderer.renderItemIn2D(Tessellator.instance, f1, f2, f, f3, icon.getIconWidth(), icon.getIconHeight(), scale);
|
||||
|
||||
|
||||
GL11.glPushMatrix();
|
||||
GL11.glEnable(GL11.GL_BLEND);
|
||||
GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
|
||||
@@ -111,25 +111,25 @@ public class RenderLens implements IItemRenderer {
|
||||
GL11.glTranslatef(-16F, 0F, 0F);
|
||||
renderShinyLensIcon(icon, shiny);
|
||||
GL11.glPopMatrix();
|
||||
|
||||
|
||||
GL11.glColor4f(1F, 1F, 1F, 1F);
|
||||
}
|
||||
|
||||
|
||||
public static void renderShinyLensIcon(Icon icon, boolean shiny) {
|
||||
float par1 = 0;
|
||||
float par2 = 0;
|
||||
float par4 = 16;
|
||||
float par5 = 16;
|
||||
float zLevel = 0F;
|
||||
Tessellator tessellator = Tessellator.instance;
|
||||
tessellator.startDrawingQuads();
|
||||
if(shiny)
|
||||
tessellator.setBrightness(240);
|
||||
tessellator.addVertexWithUV((double)(par1 + 0), (double)(par2 + par5), (double)zLevel, (double)icon.getMinU(), (double)icon.getMaxV());
|
||||
tessellator.addVertexWithUV((double)(par1 + par4), (double)(par2 + par5), (double)zLevel, (double)icon.getMaxU(), (double)icon.getMaxV());
|
||||
tessellator.addVertexWithUV((double)(par1 + par4), (double)(par2 + 0), (double)zLevel, (double)icon.getMaxU(), (double)icon.getMinV());
|
||||
tessellator.addVertexWithUV((double)(par1 + 0), (double)(par2 + 0), (double)zLevel, (double)icon.getMinU(), (double)icon.getMinV());
|
||||
tessellator.draw();
|
||||
Tessellator tessellator = Tessellator.instance;
|
||||
tessellator.startDrawingQuads();
|
||||
if(shiny)
|
||||
tessellator.setBrightness(240);
|
||||
tessellator.addVertexWithUV(par1 + 0, par2 + par5, zLevel, icon.getMinU(), icon.getMaxV());
|
||||
tessellator.addVertexWithUV(par1 + par4, par2 + par5, zLevel, icon.getMaxU(), icon.getMaxV());
|
||||
tessellator.addVertexWithUV(par1 + par4, par2 + 0, zLevel, icon.getMaxU(), icon.getMinV());
|
||||
tessellator.addVertexWithUV(par1 + 0, par2 + 0, zLevel, icon.getMinU(), icon.getMinV());
|
||||
tessellator.draw();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -41,7 +41,7 @@ public class RenderTileAltar extends TileEntitySpecialRenderer {
|
||||
@Override
|
||||
public void renderTileEntityAt(TileEntity tileentity, double d0, double d1, double d2, float pticks) {
|
||||
TileAltar altar = (TileAltar) tileentity;
|
||||
|
||||
|
||||
GL11.glPushMatrix();
|
||||
GL11.glEnable(GL12.GL_RESCALE_NORMAL);
|
||||
GL11.glColor4f(1F, 1F, 1F, 1F);
|
||||
@@ -64,7 +64,7 @@ public class RenderTileAltar extends TileEntitySpecialRenderer {
|
||||
if(altar.getStackInSlot(i) != null)
|
||||
petals++;
|
||||
else break;
|
||||
|
||||
|
||||
if(petals > 0) {
|
||||
final float modifier = 6F;
|
||||
final float rotationModifier = 0.25F;
|
||||
@@ -98,29 +98,29 @@ public class RenderTileAltar extends TileEntitySpecialRenderer {
|
||||
GL11.glRotatef(deg, xRotate, yRotate, zRotate);
|
||||
GL11.glTranslatef(-v, -v, -v);
|
||||
v *= 2F;
|
||||
|
||||
|
||||
GL11.glColor4f(1F, 1F, 1F, 1F);
|
||||
|
||||
ItemStack stack = altar.getStackInSlot(i);
|
||||
Minecraft.getMinecraft().renderEngine.bindTexture(TextureMap.locationItemsTexture);
|
||||
Icon icon = stack.getItem().getIcon(stack, 0);
|
||||
if(icon != null) {
|
||||
Color color = new Color(stack.getItem().getColorFromItemStack(stack, 0));
|
||||
GL11.glColor3ub((byte) color.getRed(), (byte) color.getGreen(), (byte) color.getBlue());
|
||||
float f = icon.getMinU();
|
||||
float f1 = icon.getMaxU();
|
||||
float f2 = icon.getMinV();
|
||||
float f3 = icon.getMaxV();
|
||||
ItemRenderer.renderItemIn2D(Tessellator.instance, f1, f2, f, f3, icon.getIconWidth(), icon.getIconHeight(), 1F / 16F);
|
||||
GL11.glColor3f(1F, 1F, 1F);
|
||||
}
|
||||
|
||||
if(icon != null) {
|
||||
Color color = new Color(stack.getItem().getColorFromItemStack(stack, 0));
|
||||
GL11.glColor3ub((byte) color.getRed(), (byte) color.getGreen(), (byte) color.getBlue());
|
||||
float f = icon.getMinU();
|
||||
float f1 = icon.getMaxU();
|
||||
float f2 = icon.getMinV();
|
||||
float f3 = icon.getMaxV();
|
||||
ItemRenderer.renderItemIn2D(Tessellator.instance, f1, f2, f, f3, icon.getIconWidth(), icon.getIconHeight(), 1F / 16F);
|
||||
GL11.glColor3f(1F, 1F, 1F);
|
||||
}
|
||||
|
||||
GL11.glPopMatrix();
|
||||
}
|
||||
|
||||
|
||||
GL11.glPopMatrix();
|
||||
}
|
||||
|
||||
|
||||
Minecraft.getMinecraft().renderEngine.bindTexture(TextureMap.locationBlocksTexture);
|
||||
|
||||
GL11.glEnable(GL11.GL_BLEND);
|
||||
|
||||
@@ -33,7 +33,7 @@ public class RenderTilePool extends TileEntitySpecialRenderer {
|
||||
private static final ResourceLocation texture = new ResourceLocation(LibResources.MODEL_POOL);
|
||||
private static final ModelPool model = new ModelPool();
|
||||
RenderItem renderItem = new RenderItem();
|
||||
|
||||
|
||||
@Override
|
||||
public void renderTileEntityAt(TileEntity tileentity, double d0, double d1, double d2, float f) {
|
||||
TilePool pool = (TilePool) tileentity;
|
||||
@@ -49,16 +49,16 @@ public class RenderTilePool extends TileEntitySpecialRenderer {
|
||||
model.render();
|
||||
GL11.glScalef(1F, -1F, -1F);
|
||||
GL11.glEnable(GL12.GL_RESCALE_NORMAL);
|
||||
|
||||
|
||||
Minecraft.getMinecraft().renderEngine.bindTexture(TextureMap.locationBlocksTexture);
|
||||
|
||||
|
||||
float waterLevel = (float) pool.getCurrentMana() / (float) TilePool.MAX_MANA * 0.40F;
|
||||
if(waterLevel > 0) {
|
||||
float s = 1F / 256F * 14F;
|
||||
float v = 1F / 8F;
|
||||
float w = -v * 3.5F;
|
||||
|
||||
GL11.glPushMatrix();
|
||||
|
||||
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);
|
||||
@@ -71,14 +71,14 @@ public class RenderTilePool extends TileEntitySpecialRenderer {
|
||||
float par4 = 16;
|
||||
float par5 = 16;
|
||||
float zLevel = 0F;
|
||||
Tessellator tessellator = Tessellator.instance;
|
||||
tessellator.startDrawingQuads();
|
||||
tessellator.setBrightness(240);
|
||||
tessellator.addVertexWithUV((double)(par1 + 0), (double)(par2 + par5), (double)zLevel, (double)par3Icon.getMinU(), (double)par3Icon.getMaxV());
|
||||
tessellator.addVertexWithUV((double)(par1 + par4), (double)(par2 + par5), (double)zLevel, (double)par3Icon.getMaxU(), (double)par3Icon.getMaxV());
|
||||
tessellator.addVertexWithUV((double)(par1 + par4), (double)(par2 + 0), (double)zLevel, (double)par3Icon.getMaxU(), (double)par3Icon.getMinV());
|
||||
tessellator.addVertexWithUV((double)(par1 + 0), (double)(par2 + 0), (double)zLevel, (double)par3Icon.getMinU(), (double)par3Icon.getMinV());
|
||||
tessellator.draw();
|
||||
Tessellator tessellator = Tessellator.instance;
|
||||
tessellator.startDrawingQuads();
|
||||
tessellator.setBrightness(240);
|
||||
tessellator.addVertexWithUV(par1 + 0, par2 + par5, zLevel, par3Icon.getMinU(), par3Icon.getMaxV());
|
||||
tessellator.addVertexWithUV(par1 + par4, par2 + par5, zLevel, par3Icon.getMaxU(), par3Icon.getMaxV());
|
||||
tessellator.addVertexWithUV(par1 + par4, par2 + 0, zLevel, par3Icon.getMaxU(), par3Icon.getMinV());
|
||||
tessellator.addVertexWithUV(par1 + 0, par2 + 0, zLevel, par3Icon.getMinU(), par3Icon.getMinV());
|
||||
tessellator.draw();
|
||||
GL11.glDisable(GL11.GL_BLEND);
|
||||
GL11.glPopMatrix();
|
||||
}
|
||||
|
||||
@@ -51,7 +51,7 @@ public class RenderTileSpreader extends TileEntitySpecialRenderer {
|
||||
model.render();
|
||||
GL11.glScalef(1F, -1F, -1F);
|
||||
ItemStack stack = spreader.getStackInSlot(0);
|
||||
|
||||
|
||||
if(stack != null) {
|
||||
Minecraft.getMinecraft().renderEngine.bindTexture(TextureMap.locationItemsTexture);
|
||||
ILens lens = (ILens) stack.getItem();
|
||||
|
||||
@@ -11,7 +11,6 @@
|
||||
*/
|
||||
package vazkii.botania.common;
|
||||
|
||||
import vazkii.botania.api.mana.ManaNetworkEvent;
|
||||
import vazkii.botania.common.core.handler.ManaNetworkHandler;
|
||||
import vazkii.botania.common.core.proxy.CommonProxy;
|
||||
import vazkii.botania.common.lib.LibMisc;
|
||||
@@ -49,7 +48,7 @@ public class Botania {
|
||||
public void postInit(FMLPostInitializationEvent event) {
|
||||
proxy.postInit(event);
|
||||
}
|
||||
|
||||
|
||||
@EventHandler
|
||||
public void serverStopping(FMLServerStoppingEvent event) {
|
||||
ManaNetworkHandler.instance.clear();
|
||||
|
||||
@@ -37,28 +37,28 @@ import cpw.mods.fml.common.network.PacketDispatcher;
|
||||
public class BlockAltar extends BlockModContainer implements ILexiconable {
|
||||
|
||||
Random random;
|
||||
|
||||
|
||||
protected BlockAltar() {
|
||||
super(LibBlockIDs.idAltar, Material.rock);
|
||||
setHardness(3.5F);
|
||||
setStepSound(soundStoneFootstep);
|
||||
setUnlocalizedName(LibBlockNames.ALTAR);
|
||||
|
||||
|
||||
float f = 1F / 16F * 2F;
|
||||
setBlockBounds(f, f, f, 1F - f, 1F / 16F * 20F, 1F - f);
|
||||
|
||||
|
||||
random = new Random();
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void onEntityCollidedWithBlock(World par1World, int par2, int par3, int par4, Entity par5Entity) {
|
||||
if(par5Entity instanceof EntityItem) {
|
||||
TileAltar tile = (TileAltar) par1World.getBlockTileEntity(par2, par3, par4);
|
||||
if(tile.collideEntityItem((EntityItem) par5Entity))
|
||||
if(tile.collideEntityItem((EntityItem) par5Entity))
|
||||
PacketDispatcher.sendPacketToAllInDimension(tile.getDescriptionPacket(), par1World.provider.dimensionId);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean onBlockActivated(World par1World, int par2, int par3, int par4, EntityPlayer par5EntityPlayer, int par6, float par7, float par8, float par9) {
|
||||
ItemStack stack = par5EntityPlayer.getCurrentEquippedItem();
|
||||
@@ -74,22 +74,23 @@ public class BlockAltar extends BlockModContainer implements ILexiconable {
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public Icon getIcon(int par1, int par2) {
|
||||
return Block.cobblestone.getIcon(par1, par2);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean isOpaqueCube() {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean renderAsNormalBlock() {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public int getRenderType() {
|
||||
return LibRenderIDs.idAltar;
|
||||
}
|
||||
@@ -98,44 +99,44 @@ public class BlockAltar extends BlockModContainer implements ILexiconable {
|
||||
public TileEntity createNewTileEntity(World world) {
|
||||
return new TileAltar();
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void breakBlock(World par1World, int par2, int par3, int par4, int par5, int par6) {
|
||||
TileSimpleInventory inv = (TileSimpleInventory) par1World.getBlockTileEntity(par2, par3, par4);
|
||||
public void breakBlock(World par1World, int par2, int par3, int par4, int par5, int par6) {
|
||||
TileSimpleInventory inv = (TileSimpleInventory) par1World.getBlockTileEntity(par2, par3, par4);
|
||||
|
||||
if (inv != null) {
|
||||
for (int j1 = 0; j1 < inv.getSizeInventory(); ++j1) {
|
||||
ItemStack itemstack = inv.getStackInSlot(j1);
|
||||
if (inv != null) {
|
||||
for (int j1 = 0; j1 < inv.getSizeInventory(); ++j1) {
|
||||
ItemStack itemstack = inv.getStackInSlot(j1);
|
||||
|
||||
if (itemstack != null) {
|
||||
float f = random.nextFloat() * 0.8F + 0.1F;
|
||||
float f1 = random.nextFloat() * 0.8F + 0.1F;
|
||||
EntityItem entityitem;
|
||||
if (itemstack != null) {
|
||||
float f = random.nextFloat() * 0.8F + 0.1F;
|
||||
float f1 = random.nextFloat() * 0.8F + 0.1F;
|
||||
EntityItem entityitem;
|
||||
|
||||
for (float f2 = random.nextFloat() * 0.8F + 0.1F; itemstack.stackSize > 0; par1World.spawnEntityInWorld(entityitem)) {
|
||||
int k1 = random.nextInt(21) + 10;
|
||||
for (float f2 = random.nextFloat() * 0.8F + 0.1F; itemstack.stackSize > 0; par1World.spawnEntityInWorld(entityitem)) {
|
||||
int k1 = random.nextInt(21) + 10;
|
||||
|
||||
if (k1 > itemstack.stackSize)
|
||||
k1 = itemstack.stackSize;
|
||||
if (k1 > itemstack.stackSize)
|
||||
k1 = itemstack.stackSize;
|
||||
|
||||
itemstack.stackSize -= k1;
|
||||
entityitem = new EntityItem(par1World, par2 + f, par3 + f1, par4 + f2, new ItemStack(itemstack.itemID, k1, itemstack.getItemDamage()));
|
||||
float f3 = 0.05F;
|
||||
entityitem.motionX = (float)random.nextGaussian() * f3;
|
||||
entityitem.motionY = (float)random.nextGaussian() * f3 + 0.2F;
|
||||
entityitem.motionZ = (float)random.nextGaussian() * f3;
|
||||
itemstack.stackSize -= k1;
|
||||
entityitem = new EntityItem(par1World, par2 + f, par3 + f1, par4 + f2, new ItemStack(itemstack.itemID, k1, itemstack.getItemDamage()));
|
||||
float f3 = 0.05F;
|
||||
entityitem.motionX = (float)random.nextGaussian() * f3;
|
||||
entityitem.motionY = (float)random.nextGaussian() * f3 + 0.2F;
|
||||
entityitem.motionZ = (float)random.nextGaussian() * f3;
|
||||
|
||||
if (itemstack.hasTagCompound())
|
||||
entityitem.getEntityItem().setTagCompound((NBTTagCompound)itemstack.getTagCompound().copy());
|
||||
}
|
||||
}
|
||||
}
|
||||
if (itemstack.hasTagCompound())
|
||||
entityitem.getEntityItem().setTagCompound((NBTTagCompound)itemstack.getTagCompound().copy());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
par1World.func_96440_m(par2, par3, par4, par5);
|
||||
}
|
||||
par1World.func_96440_m(par2, par3, par4, par5);
|
||||
}
|
||||
|
||||
super.breakBlock(par1World, par2, par3, par4, par5, par6);
|
||||
}
|
||||
super.breakBlock(par1World, par2, par3, par4, par5, par6);
|
||||
}
|
||||
|
||||
@Override
|
||||
public LexiconEntry getEntry(World world, int x, int y, int z, EntityPlayer player, ItemStack lexicon) {
|
||||
|
||||
@@ -11,9 +11,9 @@
|
||||
*/
|
||||
package vazkii.botania.common.block;
|
||||
|
||||
import net.minecraft.block.material.Material;
|
||||
import vazkii.botania.common.lib.LibBlockIDs;
|
||||
import vazkii.botania.common.lib.LibBlockNames;
|
||||
import net.minecraft.block.material.Material;
|
||||
|
||||
public class BlockLivingrock extends BlockMod {
|
||||
|
||||
|
||||
@@ -11,9 +11,9 @@
|
||||
*/
|
||||
package vazkii.botania.common.block;
|
||||
|
||||
import net.minecraft.block.material.Material;
|
||||
import vazkii.botania.common.lib.LibBlockIDs;
|
||||
import vazkii.botania.common.lib.LibBlockNames;
|
||||
import net.minecraft.block.material.Material;
|
||||
|
||||
public class BlockLivingwood extends BlockMod {
|
||||
|
||||
|
||||
@@ -36,7 +36,7 @@ public abstract class BlockModContainer<T extends TileEntity> extends BlockConta
|
||||
GameRegistry.registerBlock(this, par1Str);
|
||||
return super.setUnlocalizedName(par1Str);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerIcons(IconRegister par1IconRegister) {
|
||||
|
||||
@@ -27,7 +27,6 @@ import net.minecraftforge.common.MinecraftForge;
|
||||
import vazkii.botania.api.ILexiconable;
|
||||
import vazkii.botania.api.LexiconEntry;
|
||||
import vazkii.botania.client.core.helper.IconHelper;
|
||||
import vazkii.botania.client.lib.LibRenderIDs;
|
||||
import vazkii.botania.common.Botania;
|
||||
import vazkii.botania.common.core.BotaniaCreativeTab;
|
||||
import vazkii.botania.common.item.block.ItemBlockModFlower;
|
||||
@@ -50,7 +49,7 @@ public class BlockModFlower extends BlockFlower implements ILexiconable {
|
||||
setBlockBounds(0.3F, 0.0F, 0.3F, 0.8F, 1, 0.8F);
|
||||
setTickRandomly(true);
|
||||
setCreativeTab(BotaniaCreativeTab.INSTANCE);
|
||||
|
||||
|
||||
for(int i = 0; i < 16; i++)
|
||||
MinecraftForge.addGrassPlant(this, i, 3);
|
||||
}
|
||||
@@ -84,12 +83,12 @@ public class BlockModFlower extends BlockFlower implements ILexiconable {
|
||||
public int damageDropped(int par1) {
|
||||
return par1;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void randomDisplayTick(World par1World, int par2, int par3, int par4, Random par5Random) {
|
||||
int meta = par1World.getBlockMetadata(par2, par3, par4);
|
||||
float[] color = EntitySheep.fleeceColorTable[meta];
|
||||
|
||||
|
||||
Botania.proxy.sparkleFX(par1World, par2 + 0.3 + par5Random.nextFloat() * 0.5, par3 + 0.5 + par5Random.nextFloat() * 0.5, par4 + 0.3 + par5Random.nextFloat() * 0.5, color[0], color[1], color[2], par5Random.nextFloat(), 5);
|
||||
}
|
||||
|
||||
|
||||
@@ -44,12 +44,12 @@ public class BlockPool extends BlockModContainer implements IHUD, IWandable {
|
||||
public TileEntity createNewTileEntity(World world) {
|
||||
return new TilePool();
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void onEntityCollidedWithBlock(World par1World, int par2, int par3, int par4, Entity par5Entity) {
|
||||
if(par5Entity instanceof EntityItem) {
|
||||
TilePool tile = (TilePool) par1World.getBlockTileEntity(par2, par3, par4);
|
||||
if(tile.collideEntityItem((EntityItem) par5Entity))
|
||||
if(tile.collideEntityItem((EntityItem) par5Entity))
|
||||
PacketDispatcher.sendPacketToAllInDimension(tile.getDescriptionPacket(), par1World.provider.dimensionId);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -51,14 +51,14 @@ public class BlockSpecialFlower extends BlockFlower implements ISpecialFlower, I
|
||||
private static String[] subtypes = {
|
||||
// Misc
|
||||
LibBlockNames.SUBTILE_PUREDAISY,
|
||||
|
||||
|
||||
// Generating
|
||||
LibBlockNames.SUBTILE_DAYBLOOM,
|
||||
|
||||
|
||||
// Functional
|
||||
LibBlockNames.SUBTILE_BELLETHORN,
|
||||
};
|
||||
|
||||
|
||||
protected BlockSpecialFlower() {
|
||||
super(LibBlockIDs.idSpecialFlower);
|
||||
setUnlocalizedName(LibBlockNames.SPECIAL_FLOWER);
|
||||
@@ -68,12 +68,12 @@ public class BlockSpecialFlower extends BlockFlower implements ISpecialFlower, I
|
||||
setCreativeTab(BotaniaCreativeTab.INSTANCE);
|
||||
setBlockBounds(0.3F, 0.0F, 0.3F, 0.8F, 1, 0.8F);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public int getRenderType() {
|
||||
return LibRenderIDs.idSpecialFlower;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public Block setUnlocalizedName(String par1Str) {
|
||||
GameRegistry.registerBlock(this, ItemBlockSpecialFlower.class, par1Str);
|
||||
@@ -84,18 +84,18 @@ public class BlockSpecialFlower extends BlockFlower implements ISpecialFlower, I
|
||||
public int quantityDropped(Random par1Random) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public int idDropped(int par1, Random par2Random, int par3) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void getSubBlocks(int par1, CreativeTabs par2CreativeTabs, List par3List) {
|
||||
for(String s : subtypes)
|
||||
par3List.add(ItemBlockSpecialFlower.ofType(s));
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void registerIcons(IconRegister par1IconRegister) {
|
||||
for(String s : subtypes)
|
||||
@@ -106,42 +106,42 @@ public class BlockSpecialFlower extends BlockFlower implements ISpecialFlower, I
|
||||
public TileEntity createTileEntity(World world, int metadata) {
|
||||
return new TileSpecialFlower();
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public Icon getBlockTexture(IBlockAccess par1iBlockAccess, int par2, int par3, int par4, int par5) {
|
||||
return ((TileSpecialFlower) par1iBlockAccess.getBlockTileEntity(par2, par3, par4)).getIcon();
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public Icon getIcon(int par1, int par2) {
|
||||
return Block.plantYellow.getIcon(0, 0);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public ItemStack getPickBlock(MovingObjectPosition target, World world, int x, int y, int z) {
|
||||
String name = ((TileSpecialFlower) world.getBlockTileEntity(x, y, z)).subTileName;
|
||||
return ItemBlockSpecialFlower.ofType(name);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void onBlockHarvested(World par1World, int par2, int par3, int par4, int par5, EntityPlayer par6EntityPlayer) {
|
||||
if(!par6EntityPlayer.capabilities.isCreativeMode)
|
||||
dropBlockAsItem(par1World, par2, par3, par4, par5, 0);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public ArrayList<ItemStack> getBlockDropped(World world, int x, int y, int z, int metadata, int fortune) {
|
||||
ArrayList<ItemStack> list = new ArrayList();
|
||||
TileEntity tile = world.getBlockTileEntity(x, y, z);
|
||||
|
||||
|
||||
if(tile != null) {
|
||||
String name = ((TileSpecialFlower) tile).subTileName;
|
||||
list.add(ItemBlockSpecialFlower.ofType(name));
|
||||
}
|
||||
|
||||
|
||||
return list;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean onBlockEventReceived(World par1World, int par2, int par3, int par4, int par5, int par6) {
|
||||
super.onBlockEventReceived(par1World, par2, par3, par4, par5, par6);
|
||||
|
||||
@@ -36,31 +36,31 @@ import vazkii.botania.common.lib.LibBlockNames;
|
||||
public class BlockSpreader extends BlockModContainer implements IWandable, IHUD {
|
||||
|
||||
Random random;
|
||||
|
||||
|
||||
protected BlockSpreader() {
|
||||
super(LibBlockIDs.idSpreader, Material.wood);
|
||||
setHardness(2.0F);
|
||||
setStepSound(soundWoodFootstep);
|
||||
setUnlocalizedName(LibBlockNames.SPREADER);
|
||||
|
||||
|
||||
random = new Random();
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean isOpaqueCube() {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean renderAsNormalBlock() {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public Icon getIcon(int par1, int par2) {
|
||||
return ModBlocks.livingwood.getIcon(par1, par2);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public int getRenderType() {
|
||||
return LibRenderIDs.idSpreader;
|
||||
@@ -75,7 +75,7 @@ public class BlockSpreader extends BlockModContainer implements IWandable, IHUD
|
||||
|
||||
if(heldItem != null && heldItem.itemID == ModItems.twigWand.itemID)
|
||||
return false;
|
||||
|
||||
|
||||
if(lens == null && isHeldItemLens) {
|
||||
par5EntityPlayer.inventory.setInventorySlotContents(par5EntityPlayer.inventory.currentItem, null);
|
||||
spreader.setInventorySlotContents(0, heldItem.copy());
|
||||
@@ -87,49 +87,49 @@ public class BlockSpreader extends BlockModContainer implements IWandable, IHUD
|
||||
spreader.setInventorySlotContents(0, null);
|
||||
spreader.onInventoryChanged();
|
||||
}
|
||||
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void breakBlock(World par1World, int par2, int par3, int par4, int par5, int par6) {
|
||||
TileSimpleInventory inv = (TileSimpleInventory) par1World.getBlockTileEntity(par2, par3, par4);
|
||||
public void breakBlock(World par1World, int par2, int par3, int par4, int par5, int par6) {
|
||||
TileSimpleInventory inv = (TileSimpleInventory) par1World.getBlockTileEntity(par2, par3, par4);
|
||||
|
||||
if (inv != null) {
|
||||
for (int j1 = 0; j1 < inv.getSizeInventory(); ++j1) {
|
||||
ItemStack itemstack = inv.getStackInSlot(j1);
|
||||
if (inv != null) {
|
||||
for (int j1 = 0; j1 < inv.getSizeInventory(); ++j1) {
|
||||
ItemStack itemstack = inv.getStackInSlot(j1);
|
||||
|
||||
if (itemstack != null) {
|
||||
float f = random.nextFloat() * 0.8F + 0.1F;
|
||||
float f1 = random.nextFloat() * 0.8F + 0.1F;
|
||||
EntityItem entityitem;
|
||||
if (itemstack != null) {
|
||||
float f = random.nextFloat() * 0.8F + 0.1F;
|
||||
float f1 = random.nextFloat() * 0.8F + 0.1F;
|
||||
EntityItem entityitem;
|
||||
|
||||
for (float f2 = random.nextFloat() * 0.8F + 0.1F; itemstack.stackSize > 0; par1World.spawnEntityInWorld(entityitem)) {
|
||||
int k1 = random.nextInt(21) + 10;
|
||||
for (float f2 = random.nextFloat() * 0.8F + 0.1F; itemstack.stackSize > 0; par1World.spawnEntityInWorld(entityitem)) {
|
||||
int k1 = random.nextInt(21) + 10;
|
||||
|
||||
if (k1 > itemstack.stackSize)
|
||||
k1 = itemstack.stackSize;
|
||||
if (k1 > itemstack.stackSize)
|
||||
k1 = itemstack.stackSize;
|
||||
|
||||
itemstack.stackSize -= k1;
|
||||
entityitem = new EntityItem(par1World, par2 + f, par3 + f1, par4 + f2, new ItemStack(itemstack.itemID, k1, itemstack.getItemDamage()));
|
||||
float f3 = 0.05F;
|
||||
entityitem.motionX = (float)random.nextGaussian() * f3;
|
||||
entityitem.motionY = (float)random.nextGaussian() * f3 + 0.2F;
|
||||
entityitem.motionZ = (float)random.nextGaussian() * f3;
|
||||
itemstack.stackSize -= k1;
|
||||
entityitem = new EntityItem(par1World, par2 + f, par3 + f1, par4 + f2, new ItemStack(itemstack.itemID, k1, itemstack.getItemDamage()));
|
||||
float f3 = 0.05F;
|
||||
entityitem.motionX = (float)random.nextGaussian() * f3;
|
||||
entityitem.motionY = (float)random.nextGaussian() * f3 + 0.2F;
|
||||
entityitem.motionZ = (float)random.nextGaussian() * f3;
|
||||
|
||||
if (itemstack.hasTagCompound())
|
||||
entityitem.getEntityItem().setTagCompound((NBTTagCompound)itemstack.getTagCompound().copy());
|
||||
}
|
||||
}
|
||||
}
|
||||
if (itemstack.hasTagCompound())
|
||||
entityitem.getEntityItem().setTagCompound((NBTTagCompound)itemstack.getTagCompound().copy());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
par1World.func_96440_m(par2, par3, par4, par5);
|
||||
}
|
||||
par1World.func_96440_m(par2, par3, par4, par5);
|
||||
}
|
||||
|
||||
super.breakBlock(par1World, par2, par3, par4, par5, par6);
|
||||
}
|
||||
|
||||
super.breakBlock(par1World, par2, par3, par4, par5, par6);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean onUsedByWand(EntityPlayer player, ItemStack stack, World world, int x, int y, int z, int side) {
|
||||
((TileSpreader) world.getBlockTileEntity(x, y, z)).onWanded(player, stack);
|
||||
|
||||
@@ -44,7 +44,7 @@ public final class ModBlocks {
|
||||
specialFlower = new BlockSpecialFlower();
|
||||
spreader = new BlockSpreader();
|
||||
pool = new BlockPool();
|
||||
|
||||
|
||||
for(int i = 0; i < 16; i++)
|
||||
OreDictionary.registerOre(LibOreDict.FLOWER[i], new ItemStack(flower.blockID, 1, i));
|
||||
OreDictionary.registerOre(LibBlockNames.LIVING_ROCK, livingrock);
|
||||
@@ -58,11 +58,11 @@ public final class ModBlocks {
|
||||
GameRegistry.registerTileEntity(TileSpecialFlower.class, LibBlockNames.SPECIAL_FLOWER);
|
||||
GameRegistry.registerTileEntity(TileSpreader.class, LibBlockNames.SPREADER);
|
||||
GameRegistry.registerTileEntity(TilePool.class, LibBlockNames.POOL);
|
||||
|
||||
|
||||
BotaniaAPI.registerSubTile(LibBlockNames.SUBTILE_PUREDAISY, SubTilePureDaisy.class);
|
||||
|
||||
BotaniaAPI.registerSubTile(LibBlockNames.SUBTILE_DAYBLOOM, SubTileDaybloom.class);
|
||||
|
||||
|
||||
BotaniaAPI.registerSubTile(LibBlockNames.SUBTILE_BELLETHORN, SubTileBellethorn.class);
|
||||
}
|
||||
}
|
||||
@@ -21,7 +21,6 @@ import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.ChunkCoordinates;
|
||||
import net.minecraft.util.StatCollector;
|
||||
import vazkii.botania.api.mana.IManaCollector;
|
||||
import vazkii.botania.api.mana.IManaPool;
|
||||
import vazkii.botania.api.subtile.SubTileEntity;
|
||||
import vazkii.botania.client.core.handler.HUDHandler;
|
||||
@@ -31,28 +30,28 @@ import vazkii.botania.common.core.handler.ManaNetworkHandler;
|
||||
public class SubTileFunctional extends SubTileEntity {
|
||||
|
||||
private static final String TAG_MANA = "mana";
|
||||
|
||||
|
||||
private static final String TAG_POOL_X = "poolX";
|
||||
private static final String TAG_POOL_Y = "poolY";
|
||||
private static final String TAG_POOL_Z = "poolZ";
|
||||
|
||||
public int mana;
|
||||
|
||||
|
||||
int sizeLastCheck = -1;
|
||||
TileEntity linkedPool = null;
|
||||
public int knownMana = -1;
|
||||
|
||||
|
||||
@Override
|
||||
public boolean canUpdate() {
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void onUpdate() {
|
||||
super.onUpdate();
|
||||
|
||||
|
||||
linkPool();
|
||||
|
||||
|
||||
if(linkedPool != null) {
|
||||
IManaPool pool = (IManaPool) linkedPool;
|
||||
int manaInPool = pool.getCurrentMana();
|
||||
@@ -61,22 +60,22 @@ public class SubTileFunctional extends SubTileEntity {
|
||||
pool.recieveMana(-manaToRemove);
|
||||
addMana(manaToRemove);
|
||||
}
|
||||
|
||||
|
||||
if(supertile.worldObj.isRemote) {
|
||||
double particleChance = 1F - ((double) mana / (double) getMaxMana()) / 2F;
|
||||
double particleChance = 1F - (double) mana / (double) getMaxMana() / 2F;
|
||||
Color color = new Color(getColor());
|
||||
if(Math.random() > particleChance)
|
||||
Botania.proxy.sparkleFX(supertile.worldObj, supertile.xCoord + 0.3 + Math.random() * 0.5, supertile.yCoord + 0.5 + Math.random() * 0.5, supertile.zCoord + 0.3 + Math.random() * 0.5, (float) color.getRed() / 255F, (float) color.getGreen() / 255F, (float) color.getBlue() / 255F, (float) Math.random(), 5);
|
||||
Botania.proxy.sparkleFX(supertile.worldObj, supertile.xCoord + 0.3 + Math.random() * 0.5, supertile.yCoord + 0.5 + Math.random() * 0.5, supertile.zCoord + 0.3 + Math.random() * 0.5, color.getRed() / 255F, color.getGreen() / 255F, color.getBlue() / 255F, (float) Math.random(), 5);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public void linkPool() {
|
||||
final int range = 6;
|
||||
|
||||
|
||||
boolean needsNew = false;
|
||||
if(linkedPool == null)
|
||||
needsNew = true;
|
||||
|
||||
|
||||
if(!needsNew) {
|
||||
TileEntity tileAt = supertile.worldObj.getBlockTileEntity(linkedPool.xCoord, linkedPool.yCoord, linkedPool.zCoord);
|
||||
if(!(tileAt instanceof IManaPool)) {
|
||||
@@ -84,7 +83,7 @@ public class SubTileFunctional extends SubTileEntity {
|
||||
needsNew = true;
|
||||
} else linkedPool = tileAt;
|
||||
}
|
||||
|
||||
|
||||
if(needsNew) {
|
||||
int size = ManaNetworkHandler.instance.getAmount(ManaNetworkHandler.instance.manaPools, supertile.worldObj.provider.dimensionId);
|
||||
if(size != sizeLastCheck) {
|
||||
@@ -94,11 +93,11 @@ public class SubTileFunctional extends SubTileEntity {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public void addMana(int mana) {
|
||||
this.mana = Math.min(getMaxMana(), this.mana + mana);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean onWanded(EntityPlayer player, ItemStack wand) {
|
||||
knownMana = mana;
|
||||
@@ -106,34 +105,34 @@ public class SubTileFunctional extends SubTileEntity {
|
||||
|
||||
return super.onWanded(player, wand);
|
||||
}
|
||||
|
||||
|
||||
public int getMaxMana() {
|
||||
return 20;
|
||||
}
|
||||
|
||||
|
||||
public int getColor() {
|
||||
return 0xFFFFFF;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void readFromPacketNBT(NBTTagCompound cmp) {
|
||||
mana = cmp.getInteger(TAG_MANA);
|
||||
|
||||
|
||||
int x = cmp.getInteger(TAG_POOL_X);
|
||||
int y = cmp.getInteger(TAG_POOL_Y);
|
||||
int z = cmp.getInteger(TAG_POOL_Z);
|
||||
|
||||
|
||||
if(supertile.worldObj != null) {
|
||||
TileEntity tileAt = supertile.worldObj.getBlockTileEntity(x, y, z);
|
||||
if(tileAt != null && tileAt instanceof IManaPool)
|
||||
linkedPool = tileAt;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void writeToPacketNBT(NBTTagCompound cmp) {
|
||||
cmp.setInteger(TAG_MANA, mana);
|
||||
|
||||
|
||||
int x = linkedPool == null ? 0 : linkedPool.xCoord;
|
||||
int y = linkedPool == null ? -1 : linkedPool.yCoord;
|
||||
int z = linkedPool == null ? 0 : linkedPool.zCoord;
|
||||
@@ -142,12 +141,12 @@ public class SubTileFunctional extends SubTileEntity {
|
||||
cmp.setInteger(TAG_POOL_Y, y);
|
||||
cmp.setInteger(TAG_POOL_Z, z);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void renderHUD(Minecraft mc, ScaledResolution res) {
|
||||
String name = StatCollector.translateToLocal("tile.botania:flower." + getUnlocalizedName() + ".name");
|
||||
int color = 0x66000000 | getColor();
|
||||
HUDHandler.drawSimpleManaHUD(color, knownMana, getMaxMana(), name, res);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -13,7 +13,6 @@ package vazkii.botania.common.block.subtile;
|
||||
|
||||
import java.awt.Color;
|
||||
|
||||
import cpw.mods.fml.common.network.PacketDispatcher;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.gui.ScaledResolution;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
@@ -31,48 +30,48 @@ import vazkii.botania.common.core.handler.ManaNetworkHandler;
|
||||
public class SubTileGenerating extends SubTileEntity {
|
||||
|
||||
private static final String TAG_MANA = "mana";
|
||||
|
||||
|
||||
private static final String TAG_COLLECTOR_X = "collectorX";
|
||||
private static final String TAG_COLLECTOR_Y = "collectorY";
|
||||
private static final String TAG_COLLECTOR_Z = "collectorZ";
|
||||
|
||||
int mana;
|
||||
|
||||
|
||||
int sizeLastCheck = -1;
|
||||
TileEntity linkedCollector = null;
|
||||
public int knownMana = -1;
|
||||
|
||||
|
||||
@Override
|
||||
public boolean canUpdate() {
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void onUpdate() {
|
||||
super.onUpdate();
|
||||
|
||||
|
||||
linkCollector();
|
||||
|
||||
|
||||
int delay = getDelayBetweenPassiveGeneration();
|
||||
if(delay > 0 && supertile.worldObj.getWorldTime() % delay == 0)
|
||||
addMana(1);
|
||||
emptyManaIntoCollector();
|
||||
|
||||
|
||||
if(supertile.worldObj.isRemote) {
|
||||
double particleChance = 1F - ((double) mana / (double) getMaxMana()) / 2F;
|
||||
double particleChance = 1F - (double) mana / (double) getMaxMana() / 2F;
|
||||
Color color = new Color(getColor());
|
||||
if(Math.random() > particleChance)
|
||||
Botania.proxy.sparkleFX(supertile.worldObj, supertile.xCoord + 0.3 + Math.random() * 0.5, supertile.yCoord + 0.5 + Math.random() * 0.5, supertile.zCoord + 0.3 + Math.random() * 0.5, (float) color.getRed() / 255F, (float) color.getGreen() / 255F, (float) color.getBlue() / 255F, (float) Math.random(), 5);
|
||||
Botania.proxy.sparkleFX(supertile.worldObj, supertile.xCoord + 0.3 + Math.random() * 0.5, supertile.yCoord + 0.5 + Math.random() * 0.5, supertile.zCoord + 0.3 + Math.random() * 0.5, color.getRed() / 255F, color.getGreen() / 255F, color.getBlue() / 255F, (float) Math.random(), 5);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public void linkCollector() {
|
||||
final int range = 6;
|
||||
|
||||
|
||||
boolean needsNew = false;
|
||||
if(linkedCollector == null)
|
||||
needsNew = true;
|
||||
|
||||
|
||||
if(!needsNew) {
|
||||
TileEntity tileAt = supertile.worldObj.getBlockTileEntity(linkedCollector.xCoord, linkedCollector.yCoord, linkedCollector.zCoord);
|
||||
if(!(tileAt instanceof IManaCollector)) {
|
||||
@@ -80,7 +79,7 @@ public class SubTileGenerating extends SubTileEntity {
|
||||
needsNew = true;
|
||||
} else linkedCollector = tileAt;
|
||||
}
|
||||
|
||||
|
||||
if(needsNew) {
|
||||
int size = ManaNetworkHandler.instance.getAmount(ManaNetworkHandler.instance.manaCollectors, supertile.worldObj.provider.dimensionId);
|
||||
if(size != sizeLastCheck) {
|
||||
@@ -90,11 +89,11 @@ public class SubTileGenerating extends SubTileEntity {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public void addMana(int mana) {
|
||||
this.mana = Math.min(getMaxMana(), this.mana + mana);
|
||||
}
|
||||
|
||||
|
||||
public void emptyManaIntoCollector() {
|
||||
if(linkedCollector != null) {
|
||||
IManaCollector collector = (IManaCollector) linkedCollector;
|
||||
@@ -104,11 +103,11 @@ public class SubTileGenerating extends SubTileEntity {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public int getDelayBetweenPassiveGeneration() {
|
||||
return 30;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean onWanded(EntityPlayer player, ItemStack wand) {
|
||||
knownMana = mana;
|
||||
@@ -116,34 +115,34 @@ public class SubTileGenerating extends SubTileEntity {
|
||||
|
||||
return super.onWanded(player, wand);
|
||||
}
|
||||
|
||||
|
||||
public int getMaxMana() {
|
||||
return 20;
|
||||
}
|
||||
|
||||
|
||||
public int getColor() {
|
||||
return 0xFFFFFF;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void readFromPacketNBT(NBTTagCompound cmp) {
|
||||
mana = cmp.getInteger(TAG_MANA);
|
||||
|
||||
|
||||
int x = cmp.getInteger(TAG_COLLECTOR_X);
|
||||
int y = cmp.getInteger(TAG_COLLECTOR_Y);
|
||||
int z = cmp.getInteger(TAG_COLLECTOR_Z);
|
||||
|
||||
|
||||
if(supertile.worldObj != null) {
|
||||
TileEntity tileAt = supertile.worldObj.getBlockTileEntity(x, y, z);
|
||||
if(tileAt != null && tileAt instanceof IManaCollector)
|
||||
linkedCollector = tileAt;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void writeToPacketNBT(NBTTagCompound cmp) {
|
||||
cmp.setInteger(TAG_MANA, mana);
|
||||
|
||||
|
||||
int x = linkedCollector == null ? 0 : linkedCollector.xCoord;
|
||||
int y = linkedCollector == null ? -1 : linkedCollector.yCoord;
|
||||
int z = linkedCollector == null ? 0 : linkedCollector.zCoord;
|
||||
@@ -152,12 +151,12 @@ public class SubTileGenerating extends SubTileEntity {
|
||||
cmp.setInteger(TAG_COLLECTOR_Y, y);
|
||||
cmp.setInteger(TAG_COLLECTOR_Z, z);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void renderHUD(Minecraft mc, ScaledResolution res) {
|
||||
String name = StatCollector.translateToLocal("tile.botania:flower." + getUnlocalizedName() + ".name");
|
||||
int color = 0x66000000 | getColor();
|
||||
HUDHandler.drawSimpleManaHUD(color, knownMana, getMaxMana(), name, res);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -11,8 +11,6 @@
|
||||
*/
|
||||
package vazkii.botania.common.block.subtile;
|
||||
|
||||
import java.util.Arrays;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
@@ -28,30 +26,30 @@ public class SubTilePureDaisy extends SubTileEntity {
|
||||
private static final String TAG_TICKS_REMAINING = "ticksRemaining";
|
||||
|
||||
private static final int[][] POSITIONS = new int[][] {
|
||||
{ -1, 0, -1 },
|
||||
{ -1, 0, 0 },
|
||||
{ -1, 0, 1 },
|
||||
{ 0, 0, 1 },
|
||||
{ 1, 0, 1 },
|
||||
{ 1, 0, 0 },
|
||||
{ 1, 0, -1 },
|
||||
{ 0, 0, -1 },
|
||||
{ -1, 0, -1 },
|
||||
{ -1, 0, 0 },
|
||||
{ -1, 0, 1 },
|
||||
{ 0, 0, 1 },
|
||||
{ 1, 0, 1 },
|
||||
{ 1, 0, 0 },
|
||||
{ 1, 0, -1 },
|
||||
{ 0, 0, -1 },
|
||||
};
|
||||
|
||||
|
||||
int positionAt = 0;
|
||||
int[] ticksRemaining = new int[] { 200, 200, 200, 200, 200, 200, 200, 200 };
|
||||
|
||||
|
||||
@Override
|
||||
public boolean canUpdate() {
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void onUpdate() {
|
||||
positionAt++;
|
||||
if(positionAt == POSITIONS.length)
|
||||
positionAt = 0;
|
||||
|
||||
|
||||
int[] acoords = POSITIONS[positionAt];
|
||||
ChunkCoordinates coords = new ChunkCoordinates(supertile.xCoord + acoords[0], supertile.yCoord + acoords[1], supertile.zCoord + acoords[2]);
|
||||
Block block = Block.blocksList[supertile.worldObj.getBlockId(coords.posX, coords.posY, coords.posZ)];
|
||||
@@ -62,11 +60,11 @@ public class SubTilePureDaisy extends SubTileEntity {
|
||||
ticksRemaining[positionAt] = ticksRemaining[positionAt] - 1;
|
||||
|
||||
Botania.proxy.sparkleFX(supertile.worldObj, coords.posX + Math.random(), coords.posY + Math.random(), coords.posZ + Math.random(), 1F, 1F, 1F, (float) Math.random(), 5);
|
||||
|
||||
|
||||
if(ticksRemaining[positionAt] <= 0) {
|
||||
supertile.worldObj.setBlock(coords.posX, coords.posY, coords.posZ, output);
|
||||
ticksRemaining[positionAt] = 200;
|
||||
|
||||
|
||||
for(int i = 0; i < 25; i++) {
|
||||
double x = coords.posX + Math.random();
|
||||
double y = coords.posY + Math.random() + 0.5;
|
||||
@@ -78,16 +76,16 @@ public class SubTilePureDaisy extends SubTileEntity {
|
||||
} else ticksRemaining[positionAt] = 200;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void readFromPacketNBT(NBTTagCompound cmp) {
|
||||
positionAt = cmp.getInteger(TAG_POSITION);
|
||||
|
||||
|
||||
if(supertile.worldObj != null && !supertile.worldObj.isRemote)
|
||||
for(int i = 0; i < ticksRemaining.length; i++)
|
||||
ticksRemaining[i] = cmp.getInteger(TAG_TICKS_REMAINING + i);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void writeToPacketNBT(NBTTagCompound cmp) {
|
||||
cmp.setInteger(TAG_POSITION, positionAt);
|
||||
|
||||
@@ -19,5 +19,5 @@ public class SubTileDaybloom extends SubTileGenerating {
|
||||
public int getColor() {
|
||||
return 0xFFFF00;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -30,9 +30,9 @@ import cpw.mods.fml.common.network.PacketDispatcher;
|
||||
public class TileAltar extends TileSimpleInventory implements ISidedInventory {
|
||||
|
||||
public static final String TAG_HAS_WATER = "hasWater";
|
||||
|
||||
|
||||
public boolean hasWater = false;
|
||||
|
||||
|
||||
public boolean collideEntityItem(EntityItem item) {
|
||||
if(!hasWater)
|
||||
return false;
|
||||
@@ -42,11 +42,11 @@ public class TileAltar extends TileSimpleInventory implements ISidedInventory {
|
||||
ItemStack stack = item.getEntityItem();
|
||||
if(stack == null)
|
||||
return false;
|
||||
|
||||
|
||||
if(stack.itemID == ModItems.petal.itemID) {
|
||||
if(getStackInSlot(getSizeInventory() - 1) != null)
|
||||
return false;
|
||||
|
||||
|
||||
if(!worldObj.isRemote) {
|
||||
stack.stackSize--;
|
||||
if(stack.stackSize == 0)
|
||||
@@ -64,12 +64,12 @@ public class TileAltar extends TileSimpleInventory implements ISidedInventory {
|
||||
if(recipe.matches(this)) {
|
||||
for(int i = 0; i < getSizeInventory(); i++)
|
||||
setInventorySlotContents(i, null);
|
||||
|
||||
|
||||
if(!worldObj.isRemote) {
|
||||
stack.stackSize--;
|
||||
if(stack.stackSize == 0)
|
||||
item.setDead();
|
||||
|
||||
|
||||
ItemStack output = recipe.getOutput().copy();
|
||||
EntityItem outputItem = new EntityItem(worldObj, xCoord + 0.5, yCoord + 1.5, zCoord + 0.5, output);
|
||||
worldObj.spawnEntityInWorld(outputItem);
|
||||
@@ -85,55 +85,55 @@ public class TileAltar extends TileSimpleInventory implements ISidedInventory {
|
||||
|
||||
return didChange;
|
||||
}
|
||||
|
||||
|
||||
public void craftingFanciness() {
|
||||
worldObj.playSoundEffect(xCoord, yCoord, zCoord, "random.levelup", 1F, 1F);
|
||||
for(int i = 0; i < 25; i++) {
|
||||
float red = (float) Math.random();
|
||||
float green = (float) Math.random();
|
||||
float blue = (float) Math.random();
|
||||
Botania.proxy.sparkleFX(worldObj, xCoord + 0.5 + (Math.random() * 0.4) - 0.2, yCoord + 1, zCoord + 0.5 + (Math.random() * 0.4) - 0.2, red, green, blue, (float) Math.random(), 10);
|
||||
Botania.proxy.sparkleFX(worldObj, xCoord + 0.5 + Math.random() * 0.4 - 0.2, yCoord + 1, zCoord + 0.5 + Math.random() * 0.4 - 0.2, red, green, blue, (float) Math.random(), 10);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void updateEntity() {
|
||||
List<EntityItem> items = worldObj.getEntitiesWithinAABB(EntityItem.class, AxisAlignedBB.getBoundingBox(xCoord, yCoord + (1D / 16D * 20D), zCoord, xCoord + 1, yCoord + (1D / 16D * 21D), zCoord + 1));
|
||||
|
||||
List<EntityItem> items = worldObj.getEntitiesWithinAABB(EntityItem.class, AxisAlignedBB.getBoundingBox(xCoord, yCoord + 1D / 16D * 20D, zCoord, xCoord + 1, yCoord + 1D / 16D * 21D, zCoord + 1));
|
||||
|
||||
boolean didChange = false;
|
||||
|
||||
|
||||
for(EntityItem item : items)
|
||||
didChange = collideEntityItem(item) || didChange;
|
||||
|
||||
|
||||
if(didChange)
|
||||
PacketDispatcher.sendPacketToAllInDimension(getDescriptionPacket(), worldObj.provider.dimensionId);
|
||||
|
||||
|
||||
for(int i = 0; i < getSizeInventory(); i++) {
|
||||
ItemStack stackAt = getStackInSlot(i);
|
||||
if(stackAt == null)
|
||||
break;
|
||||
|
||||
|
||||
if(Math.random() >= 0.97) {
|
||||
float[] color = EntitySheep.fleeceColorTable[stackAt.getItemDamage()];
|
||||
float red = color[0];
|
||||
float green = color[1];
|
||||
float blue = color[2];
|
||||
Botania.proxy.sparkleFX(worldObj, xCoord + 0.5 + (Math.random() * 0.4) - 0.2, yCoord + 1, zCoord + 0.5 + (Math.random() * 0.4) - 0.2, red, green, blue, (float) Math.random(), 10);
|
||||
Botania.proxy.sparkleFX(worldObj, xCoord + 0.5 + Math.random() * 0.4 - 0.2, yCoord + 1, zCoord + 0.5 + Math.random() * 0.4 - 0.2, red, green, blue, (float) Math.random(), 10);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void writeCustomNBT(NBTTagCompound cmp) {
|
||||
super.writeCustomNBT(cmp);
|
||||
|
||||
|
||||
cmp.setBoolean(TAG_HAS_WATER, hasWater);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void readCustomNBT(NBTTagCompound cmp) {
|
||||
super.readCustomNBT(cmp);
|
||||
|
||||
|
||||
hasWater = cmp.getBoolean(TAG_HAS_WATER);
|
||||
}
|
||||
|
||||
@@ -146,12 +146,12 @@ public class TileAltar extends TileSimpleInventory implements ISidedInventory {
|
||||
public int getSizeInventory() {
|
||||
return 16;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public int getInventoryStackLimit() {
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean isItemValidForSlot(int i, ItemStack itemstack) {
|
||||
return false;
|
||||
@@ -171,5 +171,5 @@ public class TileAltar extends TileSimpleInventory implements ISidedInventory {
|
||||
public boolean canExtractItem(int i, ItemStack itemstack, int j) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -40,7 +40,7 @@ public class TileMod extends TileEntity {
|
||||
public void readCustomNBT(NBTTagCompound cmp) {
|
||||
// NO-OP
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public Packet getDescriptionPacket() {
|
||||
NBTTagCompound nbttagcompound = new NBTTagCompound();
|
||||
@@ -54,5 +54,5 @@ public class TileMod extends TileEntity {
|
||||
readCustomNBT(packet.data);
|
||||
worldObj.markBlockForRenderUpdate(xCoord, yCoord, zCoord);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -27,7 +27,6 @@ import vazkii.botania.api.recipe.RecipeManaInfusion;
|
||||
import vazkii.botania.client.core.handler.HUDHandler;
|
||||
import vazkii.botania.common.Botania;
|
||||
import vazkii.botania.common.block.ModBlocks;
|
||||
import vazkii.botania.common.lib.LibBlockNames;
|
||||
import cpw.mods.fml.common.network.PacketDispatcher;
|
||||
import cpw.mods.fml.common.network.Player;
|
||||
|
||||
@@ -69,7 +68,7 @@ public class TilePool extends TileMod implements IManaPool {
|
||||
ItemStack stack = item.getEntityItem();
|
||||
if(stack == null)
|
||||
return false;
|
||||
|
||||
|
||||
for(RecipeManaInfusion recipe : BotaniaAPI.manaInfusionRecipes) {
|
||||
if(recipe.matches(stack)) {
|
||||
int mana = recipe.getManaToConsume();
|
||||
@@ -78,7 +77,7 @@ public class TilePool extends TileMod implements IManaPool {
|
||||
stack.stackSize--;
|
||||
if(stack.stackSize == 0)
|
||||
item.setDead();
|
||||
|
||||
|
||||
if(!worldObj.isRemote) {
|
||||
ItemStack output = recipe.getOutput().copy();
|
||||
EntityItem outputItem = new EntityItem(worldObj, xCoord + 0.5, yCoord + 1.5, zCoord + 0.5, output);
|
||||
@@ -87,24 +86,24 @@ public class TilePool extends TileMod implements IManaPool {
|
||||
craftingFanciness();
|
||||
didChange = true;
|
||||
}
|
||||
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return didChange;
|
||||
}
|
||||
|
||||
|
||||
public void craftingFanciness() {
|
||||
worldObj.playSoundEffect(xCoord, yCoord, zCoord, "random.levelup", 1F, 1F);
|
||||
for(int i = 0; i < 25; i++) {
|
||||
float red = (float) Math.random();
|
||||
float green = (float) Math.random();
|
||||
float blue = (float) Math.random();
|
||||
Botania.proxy.sparkleFX(worldObj, xCoord + 0.5 + (Math.random() * 0.4) - 0.2, yCoord + 1, zCoord + 0.5 + (Math.random() * 0.4) - 0.2, red, green, blue, (float) Math.random(), 10);
|
||||
Botania.proxy.sparkleFX(worldObj, xCoord + 0.5 + Math.random() * 0.4 - 0.2, yCoord + 1, zCoord + 0.5 + Math.random() * 0.4 - 0.2, red, green, blue, (float) Math.random(), 10);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void updateEntity() {
|
||||
if(!added) {
|
||||
@@ -112,10 +111,10 @@ public class TilePool extends TileMod implements IManaPool {
|
||||
added = true;
|
||||
}
|
||||
if(worldObj.isRemote) {
|
||||
double particleChance = 1F - ((double) getCurrentMana() / (double) MAX_MANA) * 0.25;
|
||||
double particleChance = 1F - (double) getCurrentMana() / (double) MAX_MANA * 0.25;
|
||||
Color color = new Color(0x00C6FF);
|
||||
if(Math.random() > particleChance)
|
||||
Botania.proxy.wispFX(worldObj, xCoord + 0.3 + Math.random() * 0.5, yCoord + 0.6 + Math.random() * 0.25, zCoord + Math.random(), (float) color.getRed() / 255F, (float) color.getGreen() / 255F, (float) color.getBlue() / 255F, (float) Math.random() / 3F, (float) -Math.random() / 25F);
|
||||
Botania.proxy.wispFX(worldObj, xCoord + 0.3 + Math.random() * 0.5, yCoord + 0.6 + Math.random() * 0.25, zCoord + Math.random(), color.getRed() / 255F, color.getGreen() / 255F, color.getBlue() / 255F, (float) Math.random() / 3F, (float) -Math.random() / 25F);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -23,26 +23,26 @@ import vazkii.botania.api.LexiconEntry;
|
||||
import vazkii.botania.api.subtile.SubTileEntity;
|
||||
|
||||
public class TileSpecialFlower extends TileMod {
|
||||
|
||||
|
||||
private static final String TAG_SUBTILE_NAME = "subTileName";
|
||||
private static final String TAG_SUBTILE_CMP = "subTileCmp";
|
||||
|
||||
|
||||
public String subTileName = "";
|
||||
SubTileEntity subTile;
|
||||
|
||||
|
||||
public void setSubTile(String name) {
|
||||
subTileName = name;
|
||||
provideSubTile(subTileName);
|
||||
}
|
||||
|
||||
|
||||
public void setSubTile(SubTileEntity tile) {
|
||||
subTile = tile;
|
||||
subTile.setSupertile(this);
|
||||
}
|
||||
|
||||
|
||||
private void provideSubTile(String name) {
|
||||
subTileName = name;
|
||||
|
||||
|
||||
Class<? extends SubTileEntity> tileClass = BotaniaAPI.getSubTileMapping(name);
|
||||
try {
|
||||
SubTileEntity tile = tileClass.newInstance();
|
||||
@@ -51,18 +51,18 @@ public class TileSpecialFlower extends TileMod {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void updateEntity() {
|
||||
if(subTile != null)
|
||||
subTile.onUpdate();
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean canUpdate() {
|
||||
return subTile == null || subTile.canUpdate();
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void writeCustomNBT(NBTTagCompound cmp) {
|
||||
super.writeCustomNBT(cmp);
|
||||
@@ -72,34 +72,34 @@ public class TileSpecialFlower extends TileMod {
|
||||
cmp.setCompoundTag(TAG_SUBTILE_CMP, subCmp);
|
||||
subTile.writeToPacketNBT(cmp);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void readCustomNBT(NBTTagCompound cmp) {
|
||||
super.readCustomNBT(cmp);
|
||||
|
||||
|
||||
subTileName = cmp.getString(TAG_SUBTILE_NAME);
|
||||
NBTTagCompound subCmp = cmp.getCompoundTag(TAG_SUBTILE_CMP);
|
||||
|
||||
if(subTile == null || !BotaniaAPI.getSubTileStringMapping(subTile.getClass()).equals(subTileName))
|
||||
provideSubTile(subTileName);
|
||||
|
||||
|
||||
subTile.readFromPacketNBT(subCmp);
|
||||
}
|
||||
|
||||
|
||||
public Icon getIcon() {
|
||||
return subTile == null ? Block.plantRed.getIcon(0, 0) : subTile.getIcon();
|
||||
}
|
||||
|
||||
|
||||
public LexiconEntry getEntry() {
|
||||
return subTile.getEntry();
|
||||
}
|
||||
|
||||
|
||||
public boolean onWanded(ItemStack wand, EntityPlayer player) {
|
||||
return subTile.onWanded(player, wand);
|
||||
}
|
||||
|
||||
|
||||
public void renderHUD(Minecraft mc, ScaledResolution res) {
|
||||
subTile.renderHUD(mc, res);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -11,8 +11,6 @@
|
||||
*/
|
||||
package vazkii.botania.common.block.tile;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.gui.ScaledResolution;
|
||||
import net.minecraft.client.renderer.entity.RenderItem;
|
||||
@@ -28,6 +26,9 @@ import net.minecraft.util.MovingObjectPosition;
|
||||
import net.minecraft.util.Vec3;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.ForgeDirection;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import vazkii.botania.api.mana.BurstProperties;
|
||||
import vazkii.botania.api.mana.ILens;
|
||||
import vazkii.botania.api.mana.IManaCollector;
|
||||
|
||||
@@ -40,22 +40,23 @@ public final class BotaniaCreativeTab extends CreativeTabs {
|
||||
this.list = list;
|
||||
|
||||
addItem(ModItems.lexicon);
|
||||
|
||||
|
||||
addBlock(ModBlocks.flower);
|
||||
addItem(ModItems.petal);
|
||||
addItem(ModItems.manaPetal);
|
||||
addItem(ModItems.pestleAndMortar);
|
||||
addItem(ModItems.dye);
|
||||
addItem(ModItems.twigWand);
|
||||
addItem(ModItems.manaResource);
|
||||
|
||||
|
||||
addBlock(ModBlocks.livingrock);
|
||||
addBlock(ModBlocks.livingwood);
|
||||
addBlock(ModBlocks.altar);
|
||||
|
||||
|
||||
addBlock(ModBlocks.spreader);
|
||||
addItem(ModItems.lens);
|
||||
addBlock(ModBlocks.pool);
|
||||
|
||||
|
||||
addBlock(ModBlocks.specialFlower);
|
||||
}
|
||||
|
||||
|
||||
@@ -12,9 +12,9 @@
|
||||
package vazkii.botania.common.core.handler;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraftforge.event.Event.Result;
|
||||
import net.minecraftforge.event.EventPriority;
|
||||
import net.minecraftforge.event.ForgeSubscribe;
|
||||
import net.minecraftforge.event.Event.Result;
|
||||
import net.minecraftforge.event.terraingen.DecorateBiomeEvent;
|
||||
import net.minecraftforge.event.terraingen.DecorateBiomeEvent.Decorate.EventType;
|
||||
import vazkii.botania.common.block.ModBlocks;
|
||||
@@ -29,15 +29,15 @@ public class BiomeDecorationHandler {
|
||||
int x = event.chunkX + event.world.rand.nextInt(16) + 8;
|
||||
int y = event.world.rand.nextInt(128);
|
||||
int z = event.chunkZ + event.world.rand.nextInt(16) + 8;
|
||||
|
||||
for (int j = 0; j < 96; j++) {
|
||||
int x1 = x + event.world.rand.nextInt(8) - event.world.rand.nextInt(8);
|
||||
int y1 = y + event.world.rand.nextInt(4) - event.world.rand.nextInt(4);
|
||||
int z1 = z + event.world.rand.nextInt(8) - event.world.rand.nextInt(8);
|
||||
|
||||
if (event.world.isAirBlock(x1, y1, z1) && (!event.world.provider.hasNoSky || y1 < 127) && Block.blocksList[ModBlocks.flower.blockID].canBlockStay(event.world, x1, y1, z1))
|
||||
event.world.setBlock(x1, y1, z1, ModBlocks.flower.blockID, event.world.rand.nextInt(16), 2);
|
||||
}
|
||||
|
||||
for (int j = 0; j < 96; j++) {
|
||||
int x1 = x + event.world.rand.nextInt(8) - event.world.rand.nextInt(8);
|
||||
int y1 = y + event.world.rand.nextInt(4) - event.world.rand.nextInt(4);
|
||||
int z1 = z + event.world.rand.nextInt(8) - event.world.rand.nextInt(8);
|
||||
|
||||
if (event.world.isAirBlock(x1, y1, z1) && (!event.world.provider.hasNoSky || y1 < 127) && Block.blocksList[ModBlocks.flower.blockID].canBlockStay(event.world, x1, y1, z1))
|
||||
event.world.setBlock(x1, y1, z1, ModBlocks.flower.blockID, event.world.rand.nextInt(16), 2);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -45,6 +45,7 @@ public final class ConfigHandler {
|
||||
LibItemIDs.idTwigWand = loadItem(LibItemNames.TWIG_WAND, LibItemIDs.idTwigWand);
|
||||
LibItemIDs.idManaResource = loadItem(LibItemNames.MANA_RESOURCE, LibItemIDs.idManaResource);
|
||||
LibItemIDs.idLens = loadItem(LibItemNames.LENS, LibItemIDs.idLens);
|
||||
LibItemIDs.idManaPetal = loadItem(LibItemNames.MANA_PETAL, LibItemIDs.idManaPetal);
|
||||
|
||||
config.save();
|
||||
}
|
||||
|
||||
@@ -27,7 +27,7 @@ import vazkii.botania.common.core.helper.MathHelper;
|
||||
public final class ManaNetworkHandler {
|
||||
|
||||
public static final ManaNetworkHandler instance = new ManaNetworkHandler();
|
||||
|
||||
|
||||
public Map<Integer, List<TileEntity>> manaPools = new HashMap();
|
||||
public Map<Integer, List<TileEntity>> manaCollectors = new HashMap();
|
||||
|
||||
@@ -38,12 +38,12 @@ public final class ManaNetworkHandler {
|
||||
add(map, event.tile);
|
||||
else remove(map, event.tile);
|
||||
}
|
||||
|
||||
|
||||
public void clear() {
|
||||
manaPools.clear();
|
||||
manaCollectors.clear();
|
||||
}
|
||||
|
||||
|
||||
public TileEntity getClosestPool(ChunkCoordinates pos, int dimension, int limit) {
|
||||
if(manaPools.containsKey(dimension))
|
||||
return getClosest(manaPools.get(dimension), pos, limit);
|
||||
@@ -55,54 +55,54 @@ public final class ManaNetworkHandler {
|
||||
return getClosest(manaCollectors.get(dimension), pos, limit);
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
private TileEntity getClosest(List<TileEntity> tiles, ChunkCoordinates pos, int limit) {
|
||||
float closest = Float.MAX_VALUE;
|
||||
TileEntity closestTile = null;
|
||||
|
||||
|
||||
for(TileEntity tile : tiles) {
|
||||
float distance = MathHelper.pointDistanceSpace(tile.xCoord, tile.yCoord, tile.zCoord, pos.posX, pos.posY, pos.posZ);
|
||||
if(distance > limit)
|
||||
continue;
|
||||
|
||||
|
||||
if(distance < closest) {
|
||||
closest = distance;
|
||||
closestTile = tile;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return closestTile;
|
||||
}
|
||||
|
||||
|
||||
private void remove(Map<Integer, List<TileEntity>> map, TileEntity tile) {
|
||||
int dim = tile.worldObj.provider.dimensionId;
|
||||
|
||||
|
||||
if(!map.containsKey(dim))
|
||||
return;
|
||||
|
||||
|
||||
List<TileEntity> tiles = map.get(dim);
|
||||
tiles.remove(tile);
|
||||
}
|
||||
|
||||
|
||||
private void add(Map<Integer, List<TileEntity>> map, TileEntity tile) {
|
||||
int dim = tile.worldObj.provider.dimensionId;
|
||||
|
||||
|
||||
List<TileEntity> tiles;
|
||||
if(!map.containsKey(dim))
|
||||
map.put(dim, new ArrayList());
|
||||
|
||||
|
||||
tiles = map.get(dim);
|
||||
|
||||
|
||||
if(!tiles.contains(tile))
|
||||
tiles.add(tile);
|
||||
}
|
||||
|
||||
|
||||
public List<TileEntity> getAllInWorld(Map<Integer, List<TileEntity>> map, int dim) {
|
||||
if(!map.containsKey(dim))
|
||||
return new ArrayList();
|
||||
return map.get(dim);
|
||||
}
|
||||
|
||||
|
||||
public int getAmount(Map<Integer, List<TileEntity>> map, int dim) {
|
||||
if(!map.containsKey(dim))
|
||||
return 0;
|
||||
|
||||
@@ -122,7 +122,7 @@ public final class ItemNBTHelper {
|
||||
return verifyExistance(stack, tag) ? getNBT(stack).getDouble(tag) : defaultExpected;
|
||||
}
|
||||
|
||||
/** If nullifyOnFail is true it'll return null if it doesn't find any
|
||||
/** If nullifyOnFail is true it'll return null if it doesn't find any
|
||||
* compounds, otherwise it'll return a new one. **/
|
||||
public static NBTTagCompound getCompound(ItemStack stack, String tag, boolean nullifyOnFail) {
|
||||
return verifyExistance(stack, tag) ? getNBT(stack).getCompoundTag(tag) : nullifyOnFail ? null : new NBTTagCompound();
|
||||
|
||||
@@ -14,7 +14,7 @@ package vazkii.botania.common.core.helper;
|
||||
public final class MathHelper {
|
||||
|
||||
public static float pointDistanceSpace(double x1, double y1, double z1, double x2, double y2, double z2) {
|
||||
return (float) Math.sqrt(Math.pow(x1 - x2, 2) + Math.pow(y1 - y2, 2) + Math.pow(z1 - z2, 2));
|
||||
}
|
||||
|
||||
return (float) Math.sqrt(Math.pow(x1 - x2, 2) + Math.pow(y1 - y2, 2) + Math.pow(z1 - z2, 2));
|
||||
}
|
||||
|
||||
}
|
||||
@@ -43,7 +43,7 @@ public class CommonProxy {
|
||||
ModBlocks.init();
|
||||
ModItems.init();
|
||||
ModEntities.init();
|
||||
|
||||
|
||||
ModCrafingRecipes.init();
|
||||
ModPetalRecipes.init();
|
||||
ModManaInfusionRecipes.init();
|
||||
@@ -53,7 +53,7 @@ public class CommonProxy {
|
||||
|
||||
public void init(FMLInitializationEvent event) {
|
||||
NetworkRegistry.instance().registerGuiHandler(Botania.instance, new GuiHandler());
|
||||
|
||||
|
||||
MinecraftForge.TERRAIN_GEN_BUS.register(new BiomeDecorationHandler());
|
||||
MinecraftForge.EVENT_BUS.register(ManaNetworkHandler.instance);
|
||||
}
|
||||
@@ -61,31 +61,31 @@ public class CommonProxy {
|
||||
public void postInit(FMLPostInitializationEvent event) {
|
||||
|
||||
}
|
||||
|
||||
|
||||
public void setEntryToOpen(LexiconEntry entry) {
|
||||
// NO-OP
|
||||
}
|
||||
|
||||
|
||||
public void twigWandClientUpdate() {
|
||||
|
||||
|
||||
}
|
||||
|
||||
public void sparkleFX(World world, double x, double y, double z, float r, float g, float b, float size, int m) {
|
||||
sparkleFX(world, x, y, z, r, g, b, size, m, false);
|
||||
}
|
||||
|
||||
|
||||
public void sparkleFX(World world, double x, double y, double z, float r, float g, float b, float size, int m, boolean fake) {
|
||||
// NO-OP
|
||||
}
|
||||
|
||||
|
||||
public void wispFX(World world, double x, double y, double z, float r, float g, float b, float size) {
|
||||
wispFX(world, x, y, z, r, g, b, size, 0F);
|
||||
}
|
||||
|
||||
|
||||
public void wispFX(World world, double x, double y, double z, float r, float g, float b, float size, float gravity) {
|
||||
wispFX(world, x, y, z, r, g, b, size, 0, -gravity, 0);
|
||||
}
|
||||
|
||||
|
||||
public void wispFX(World world, double x, double y, double z, float r, float g, float b, float size, float motionx, float motiony, float motionz) {
|
||||
// NO-OP
|
||||
}
|
||||
|
||||
@@ -25,7 +25,6 @@ import vazkii.botania.common.block.ModBlocks;
|
||||
import vazkii.botania.common.item.ItemTwigWand;
|
||||
import vazkii.botania.common.item.ModItems;
|
||||
import vazkii.botania.common.lib.LibOreDict;
|
||||
import cpw.mods.fml.common.registry.GameRegistry;
|
||||
|
||||
public final class ModCrafingRecipes {
|
||||
|
||||
@@ -40,50 +39,50 @@ public final class ModCrafingRecipes {
|
||||
// Lexicon Recipe
|
||||
addShapelessOreDictRecipe(new ItemStack(ModItems.lexicon), "treeSapling", Item.book);
|
||||
recipeLexicon = BotaniaAPI.getLatestAddedRecipe();
|
||||
|
||||
|
||||
// Petal/Dye Recipes
|
||||
for(int i = 0; i < 16; i++)
|
||||
addShapelessOreDictRecipe(new ItemStack(ModItems.petal, 2, i), LibOreDict.FLOWER[i]);
|
||||
recipesPetals = BotaniaAPI.getLatestAddedRecipes(16);
|
||||
|
||||
for(int i = 0; i < 16; i++)
|
||||
addShapelessOreDictRecipe(new ItemStack(ModItems.dye, 1, i), LibOreDict.PETAL[i], LibOreDict.PESTLE_AND_MORTAR);
|
||||
addShapelessOreDictRecipe(new ItemStack(ModItems.petal, 2, i), LibOreDict.FLOWER[i]);
|
||||
recipesPetals = BotaniaAPI.getLatestAddedRecipes(16);
|
||||
|
||||
for(int i = 0; i < 16; i++)
|
||||
addShapelessOreDictRecipe(new ItemStack(ModItems.dye, 1, i), LibOreDict.PETAL[i], LibOreDict.PESTLE_AND_MORTAR);
|
||||
recipesDyes = BotaniaAPI.getLatestAddedRecipes(16);
|
||||
|
||||
|
||||
// Pestle and Mortar Recipe
|
||||
addOreDictRecipe(new ItemStack(ModItems.pestleAndMortar),
|
||||
" S", "W ", "B ",
|
||||
'S', "stickWood",
|
||||
'W', "plankWood",
|
||||
'B', Item.bowlEmpty);
|
||||
addOreDictRecipe(new ItemStack(ModItems.pestleAndMortar),
|
||||
" S", "W ", "B ",
|
||||
'S', "stickWood",
|
||||
'W', "plankWood",
|
||||
'B', Item.bowlEmpty);
|
||||
recipePestleAndMortar = BotaniaAPI.getLatestAddedRecipe();
|
||||
|
||||
|
||||
// Wand of the Forest Recipes
|
||||
for(int i = 0; i < 16; i++)
|
||||
for(int j = 0; j < 16; j++) {
|
||||
addOreDictRecipe(ItemTwigWand.forColors(i, j),
|
||||
" AS", " SB", "S ",
|
||||
'A', LibOreDict.PETAL[i],
|
||||
'B', LibOreDict.PETAL[j],
|
||||
'S', "stickWood");
|
||||
addOreDictRecipe(ItemTwigWand.forColors(i, j),
|
||||
" AS", " SB", "S ",
|
||||
'A', LibOreDict.PETAL[i],
|
||||
'B', LibOreDict.PETAL[j],
|
||||
'S', "stickWood");
|
||||
}
|
||||
recipesTwigWand = BotaniaAPI.getLatestAddedRecipes(256);
|
||||
|
||||
|
||||
// Petal Apothecary Recipes
|
||||
for(int i = 0; i < 16; i++)
|
||||
addOreDictRecipe(new ItemStack(ModBlocks.altar),
|
||||
"SPS", " C ", "CCC",
|
||||
'S', new ItemStack(Block.stoneSingleSlab, 1, 3),
|
||||
'P', LibOreDict.PETAL[i],
|
||||
'C', "cobblestone");
|
||||
addOreDictRecipe(new ItemStack(ModBlocks.altar),
|
||||
"SPS", " C ", "CCC",
|
||||
'S', new ItemStack(Block.stoneSingleSlab, 1, 3),
|
||||
'P', LibOreDict.PETAL[i],
|
||||
'C', "cobblestone");
|
||||
recipesApothecary = BotaniaAPI.getLatestAddedRecipes(16);
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
private static void addOreDictRecipe(ItemStack output, Object... recipe) {
|
||||
CraftingManager.getInstance().getRecipeList().add(new ShapedOreRecipe(output, recipe));
|
||||
}
|
||||
|
||||
|
||||
private static void addShapelessOreDictRecipe(ItemStack output, Object... recipe) {
|
||||
CraftingManager.getInstance().getRecipeList().add(new ShapelessOreRecipe(output, recipe));
|
||||
}
|
||||
|
||||
@@ -11,17 +11,27 @@
|
||||
*/
|
||||
package vazkii.botania.common.crafting;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
import vazkii.botania.api.BotaniaAPI;
|
||||
import vazkii.botania.api.recipe.RecipeManaInfusion;
|
||||
import vazkii.botania.common.item.ModItems;
|
||||
import vazkii.botania.common.lib.LibItemNames;
|
||||
import vazkii.botania.common.lib.LibOreDict;
|
||||
|
||||
public final class ModManaInfusionRecipes {
|
||||
|
||||
public static List<RecipeManaInfusion> manaPetalRecipes;
|
||||
public static RecipeManaInfusion manasteelRecipe;
|
||||
|
||||
|
||||
public static void init() {
|
||||
manasteelRecipe = BotaniaAPI.registerManaInfusionRecipe(new ItemStack(ModItems.manaResource, 1, 0), "ingotIron", 1000);
|
||||
manaPetalRecipes = new ArrayList();
|
||||
for(int i = 0; i < 16; i++)
|
||||
manaPetalRecipes.add(BotaniaAPI.registerManaInfusionRecipe(new ItemStack(ModItems.manaPetal, 1, i), LibOreDict.PETAL[i], 1000));
|
||||
|
||||
manasteelRecipe = BotaniaAPI.registerManaInfusionRecipe(new ItemStack(ModItems.manaResource, 1, 0), "ingotIron", 5000);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -19,11 +19,11 @@ import vazkii.botania.api.recipe.RecipePetals;
|
||||
public final class ModPetalRecipes {
|
||||
|
||||
public static final int white = 0, orange = 1, magenta = 2, lightBlue = 3, yellow = 4, lime = 5, pink = 6, gray = 7, lightGray = 8, cyan = 9, purple = 10, blue = 11, brown = 12, green = 13, red = 14, black = 15;
|
||||
|
||||
|
||||
public static RecipePetals testRecipe;
|
||||
|
||||
|
||||
public static void init() {
|
||||
testRecipe = BotaniaAPI.registerPetalRecipe(new ItemStack(Item.diamond), orange, orange, white);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -57,7 +57,7 @@ public class EntityManaBurst extends EntityThrowable implements IManaBurst {
|
||||
final int dataWatcherStart = 32 - dataWatcherEntries;
|
||||
|
||||
List<String> alreadyCollidedAt = new ArrayList();
|
||||
|
||||
|
||||
public EntityManaBurst(World world) {
|
||||
super(world);
|
||||
setSize(0F, 0F);
|
||||
@@ -83,9 +83,9 @@ public class EntityManaBurst extends EntityThrowable implements IManaBurst {
|
||||
rotationPitch = spreader.rotationY;
|
||||
|
||||
float f = 0.4F;
|
||||
double mx = (MathHelper.sin(rotationYaw / 180.0F * (float) Math.PI) * MathHelper.cos(rotationPitch / 180.0F * (float) Math.PI) * f) / 2D;
|
||||
double mx = MathHelper.sin(rotationYaw / 180.0F * (float) Math.PI) * MathHelper.cos(rotationPitch / 180.0F * (float) Math.PI) * f / 2D;
|
||||
double mz = -(MathHelper.cos(rotationYaw / 180.0F * (float) Math.PI) * MathHelper.cos(rotationPitch / 180.0F * (float) Math.PI) * f) / 2D;
|
||||
double my = (MathHelper.sin((rotationPitch + func_70183_g()) / 180.0F * (float) Math.PI) * f) / 2D;
|
||||
double my = MathHelper.sin((rotationPitch + func_70183_g()) / 180.0F * (float) Math.PI) * f / 2D;
|
||||
setMotion(mx, my, mz);
|
||||
}
|
||||
|
||||
@@ -121,7 +121,7 @@ public class EntityManaBurst extends EntityThrowable implements IManaBurst {
|
||||
|
||||
if(entity1.canBeCollidedWith() && (entity1 != entitylivingbase || ticksInAir >= 5)) {
|
||||
float f = 0.3F;
|
||||
AxisAlignedBB axisalignedbb = entity1.boundingBox.expand((double)f, (double)f, (double)f);
|
||||
AxisAlignedBB axisalignedbb = entity1.boundingBox.expand(f, f, f);
|
||||
MovingObjectPosition movingobjectposition1 = axisalignedbb.calculateIntercept(vec3, vec31);
|
||||
|
||||
if(movingobjectposition1 != null) {
|
||||
@@ -151,7 +151,7 @@ public class EntityManaBurst extends EntityThrowable implements IManaBurst {
|
||||
float f1 = MathHelper.sqrt_double(motionX * motionX + motionZ * motionZ);
|
||||
rotationYaw = (float)(Math.atan2(motionX, motionZ) * 180.0D / Math.PI);
|
||||
|
||||
for(rotationPitch = (float)(Math.atan2(motionY, (double)f1) * 180.0D / Math.PI); rotationPitch - prevRotationPitch < -180.0F; prevRotationPitch -= 360.0F);
|
||||
for(rotationPitch = (float)(Math.atan2(motionY, f1) * 180.0D / Math.PI); rotationPitch - prevRotationPitch < -180.0F; prevRotationPitch -= 360.0F);
|
||||
|
||||
while(rotationPitch - prevRotationPitch >= 180.0F)
|
||||
prevRotationPitch += 360.0F;
|
||||
@@ -251,18 +251,18 @@ public class EntityManaBurst extends EntityThrowable implements IManaBurst {
|
||||
return;
|
||||
|
||||
Color color = new Color(getColor());
|
||||
float r = (float) color.getRed() / 255F;
|
||||
float g = (float) color.getGreen() / 255F;
|
||||
float b = (float) color.getBlue() / 255F;
|
||||
float r = color.getRed() / 255F;
|
||||
float g = color.getGreen() / 255F;
|
||||
float b = color.getBlue() / 255F;
|
||||
|
||||
int mana = getMana();
|
||||
int maxMana = getStartingMana();
|
||||
float size = (float) mana / (float) maxMana;
|
||||
|
||||
|
||||
if(fake) {
|
||||
if(getMana() == getStartingMana())
|
||||
size = 2F;
|
||||
|
||||
|
||||
if(!noParticles)
|
||||
Botania.proxy.sparkleFX(worldObj, posX, posY, posZ, r, g, b, 0.4F * size, 1, true);
|
||||
} else Botania.proxy.wispFX(worldObj, posX, posY, posZ, r, g, b, 0.2F * size, (float) -motionX * 0.01F, (float) -motionY * 0.01F, (float) -motionZ * 0.01F);
|
||||
@@ -272,7 +272,7 @@ public class EntityManaBurst extends EntityThrowable implements IManaBurst {
|
||||
protected void onImpact(MovingObjectPosition movingobjectposition) {
|
||||
boolean collided = false;
|
||||
boolean dead = false;
|
||||
|
||||
|
||||
if(movingobjectposition.entityHit == null) {
|
||||
TileEntity tile = worldObj.getBlockTileEntity(movingobjectposition.blockX, movingobjectposition.blockY, movingobjectposition.blockZ);
|
||||
|
||||
@@ -288,17 +288,17 @@ public class EntityManaBurst extends EntityThrowable implements IManaBurst {
|
||||
|
||||
dead = true;
|
||||
}
|
||||
|
||||
|
||||
collided = true;
|
||||
}
|
||||
|
||||
ILens lens = getLensInstance();
|
||||
if(lens != null)
|
||||
dead = lens.collideBurst(this, movingobjectposition, collidedTile != null && collidedTile instanceof IManaReceiver && ((IManaReceiver) collidedTile).canRecieveManaFromBursts(), dead, getSourceLens());
|
||||
|
||||
|
||||
if(collided && !hasAlreadyCollidedAt(movingobjectposition.blockX, movingobjectposition.blockY, movingobjectposition.blockZ))
|
||||
alreadyCollidedAt.add(getCollisionLocString(movingobjectposition.blockX, movingobjectposition.blockY, movingobjectposition.blockZ));
|
||||
|
||||
|
||||
if(dead)
|
||||
setDead();
|
||||
}
|
||||
@@ -437,8 +437,8 @@ public class EntityManaBurst extends EntityThrowable implements IManaBurst {
|
||||
public boolean hasAlreadyCollidedAt(int x, int y, int z) {
|
||||
return alreadyCollidedAt.contains(getCollisionLocString(x, y, z));
|
||||
}
|
||||
|
||||
|
||||
private String getCollisionLocString(int x, int y, int z) {
|
||||
return x + ":" + y + ":" + z;
|
||||
return x + ":" + y + ":" + z;
|
||||
}
|
||||
}
|
||||
@@ -20,5 +20,5 @@ public final class ModEntities {
|
||||
public static void init() {
|
||||
EntityRegistry.registerModEntity(EntityManaBurst.class, LibEntityNames.MANA_BURST, 0, Botania.instance, 64, 10, true);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -14,7 +14,6 @@ package vazkii.botania.common.item;
|
||||
import java.awt.Color;
|
||||
import java.util.List;
|
||||
|
||||
import vazkii.botania.common.lib.LibItemNames;
|
||||
import net.minecraft.creativetab.CreativeTabs;
|
||||
import net.minecraft.entity.passive.EntitySheep;
|
||||
import net.minecraft.item.ItemStack;
|
||||
@@ -32,20 +31,20 @@ public class Item16Colors extends ItemMod {
|
||||
float[] color = EntitySheep.fleeceColorTable[par1ItemStack.getItemDamage()];
|
||||
return new Color(color[0], color[1], color[2]).getRGB();
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void getSubItems(int par1, CreativeTabs par2CreativeTabs, List par3List) {
|
||||
for(int i = 0; i < 16; i++)
|
||||
par3List.add(new ItemStack(par1, 1, i));
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public String getUnlocalizedName(ItemStack par1ItemStack) {
|
||||
return getUnlocalizedNameLazy(par1ItemStack) + par1ItemStack.getItemDamage();
|
||||
}
|
||||
|
||||
|
||||
String getUnlocalizedNameLazy(ItemStack par1ItemStack) {
|
||||
return super.getUnlocalizedName(par1ItemStack);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -16,7 +16,6 @@ import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.renderer.texture.IconRegister;
|
||||
import net.minecraft.creativetab.CreativeTabs;
|
||||
@@ -237,7 +236,7 @@ public class ItemLens extends ItemMod implements ILens {
|
||||
|
||||
if(storedColor == 16) {
|
||||
World world = Minecraft.getMinecraft().theWorld;
|
||||
return world == null ? 0xFFFFFF : Color.HSBtoRGB((float) ((world.getTotalWorldTime() * 2) % 360) / 360F, 1F, 1F);
|
||||
return world == null ? 0xFFFFFF : Color.HSBtoRGB(world.getTotalWorldTime() * 2 % 360 / 360F, 1F, 1F);
|
||||
}
|
||||
|
||||
float[] color = EntitySheep.fleeceColorTable[storedColor];
|
||||
|
||||
@@ -30,12 +30,12 @@ public class ItemLexicon extends ItemMod {
|
||||
setMaxStackSize(1);
|
||||
setUnlocalizedName(LibItemNames.LEXICON);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean onItemUse(ItemStack par1ItemStack, EntityPlayer par2EntityPlayer, World par3World, int par4, int par5, int par6, int par7, float par8, float par9, float par10) {
|
||||
int id = par3World.getBlockId(par4, par5, par6);
|
||||
Block block = Block.blocksList[id];
|
||||
|
||||
|
||||
if(block != null && block instanceof ILexiconable) {
|
||||
LexiconEntry entry = ((ILexiconable) block).getEntry(par3World, par4, par5, par6, par2EntityPlayer, par1ItemStack);
|
||||
if(entry != null) {
|
||||
|
||||
@@ -0,0 +1,35 @@
|
||||
/**
|
||||
* This class was created by <Vazkii>. It's distributed as
|
||||
* part of the Botania Mod. Get the Source Code in github:
|
||||
* https://github.com/Vazkii/Botania
|
||||
*
|
||||
* Botania is Open Source and distributed under a
|
||||
* Creative Commons Attribution-NonCommercial-ShareAlike 3.0 License
|
||||
* (http://creativecommons.org/licenses/by-nc-sa/3.0/deed.en_GB)
|
||||
*
|
||||
* File Created @ [Feb 2, 2014, 12:57:22 PM (GMT)]
|
||||
*/
|
||||
package vazkii.botania.common.item;
|
||||
|
||||
import vazkii.botania.common.lib.LibItemIDs;
|
||||
import vazkii.botania.common.lib.LibItemNames;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.Icon;
|
||||
|
||||
public class ItemManaPetal extends Item16Colors {
|
||||
|
||||
public ItemManaPetal() {
|
||||
super(LibItemIDs.idManaPetal, LibItemNames.MANA_PETAL);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasEffect(ItemStack par1ItemStack, int pass) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Icon getIconFromDamage(int par1) {
|
||||
return ModItems.petal.getIconFromDamage(par1);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -25,19 +25,19 @@ public class ItemManaResource extends ItemMod {
|
||||
|
||||
final int types = 3;
|
||||
Icon[] icons;
|
||||
|
||||
|
||||
public ItemManaResource() {
|
||||
super(LibItemIDs.idManaResource);
|
||||
setUnlocalizedName(LibItemNames.MANA_RESOURCE);
|
||||
setHasSubtypes(true);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void getSubItems(int par1, CreativeTabs par2CreativeTabs, List par3List) {
|
||||
for(int i = 0; i < types; i++)
|
||||
par3List.add(new ItemStack(par1, 1, i));
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void registerIcons(IconRegister par1IconRegister) {
|
||||
icons = new Icon[types];
|
||||
@@ -49,7 +49,7 @@ public class ItemManaResource extends ItemMod {
|
||||
public String getUnlocalizedName(ItemStack par1ItemStack) {
|
||||
return "item." + LibItemNames.MANA_RESOURCE_NAMES[Math.min(types - 1, par1ItemStack.getItemDamage())];
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public Icon getIconFromDamage(int par1) {
|
||||
return icons[Math.min(icons.length - 1, par1)];
|
||||
|
||||
@@ -12,9 +12,7 @@
|
||||
package vazkii.botania.common.item;
|
||||
|
||||
import java.awt.Color;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.client.renderer.texture.IconRegister;
|
||||
@@ -24,11 +22,8 @@ import net.minecraft.entity.passive.EntitySheep;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.EnumRarity;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.ChunkCoordinates;
|
||||
import net.minecraft.util.Icon;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.FakePlayer;
|
||||
import vazkii.botania.api.IWandable;
|
||||
import vazkii.botania.client.core.helper.IconHelper;
|
||||
import vazkii.botania.common.Botania;
|
||||
@@ -64,7 +59,7 @@ public class ItemTwigWand extends Item16Colors {
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void onUpdate(ItemStack par1ItemStack, World par2World, Entity par3Entity, int par4, boolean par5) {
|
||||
if(par3Entity instanceof EntityPlayer && ((EntityPlayer) par3Entity).getCurrentEquippedItem() == par1ItemStack)
|
||||
|
||||
@@ -25,26 +25,29 @@ public final class ModItems {
|
||||
public static Item twigWand;
|
||||
public static Item manaResource;
|
||||
public static Item lens;
|
||||
|
||||
public static Item manaPetal;
|
||||
|
||||
public static void init() {
|
||||
lexicon = new ItemLexicon();
|
||||
petal = new ItemPetal();
|
||||
petal = new ItemPetal();
|
||||
dye = new ItemDye();
|
||||
pestleAndMortar = new ItemPestleAndMortar();
|
||||
twigWand = new ItemTwigWand();
|
||||
manaResource = new ItemManaResource();
|
||||
lens = new ItemLens();
|
||||
manaPetal = new ItemManaPetal();
|
||||
|
||||
OreDictionary.registerOre(LibOreDict.LEXICON, lexicon);
|
||||
for(int i = 0; i < 16; i++) {
|
||||
OreDictionary.registerOre(LibOreDict.PETAL[i], new ItemStack(petal.itemID, 1, i));
|
||||
OreDictionary.registerOre(LibOreDict.DYE[i], new ItemStack(dye.itemID, 1, i));
|
||||
OreDictionary.registerOre(LibOreDict.MANA_PETAL[i], new ItemStack(manaPetal.itemID, 1, i));
|
||||
}
|
||||
OreDictionary.registerOre(LibOreDict.PESTLE_AND_MORTAR, pestleAndMortar);
|
||||
OreDictionary.registerOre(LibOreDict.MANA_STEEL, new ItemStack(manaResource, 1, 0));
|
||||
OreDictionary.registerOre(LibOreDict.MANA_PEARL, new ItemStack(manaResource, 1, 1));
|
||||
OreDictionary.registerOre(LibOreDict.MANA_DIAMOND, new ItemStack(manaResource, 1, 1));
|
||||
|
||||
|
||||
// Vanilla ores (because forge doesn't do this by default for some reason)
|
||||
OreDictionary.registerOre("ingotIron", Item.ingotIron);
|
||||
OreDictionary.registerOre("ingotGold", Item.ingotGold);
|
||||
|
||||
@@ -11,11 +11,9 @@
|
||||
*/
|
||||
package vazkii.botania.common.item.block;
|
||||
|
||||
import vazkii.botania.common.lib.LibOreDict;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.item.ItemBlockWithMetadata;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraftforge.oredict.OreDictionary;
|
||||
|
||||
public class ItemBlockModFlower extends ItemBlockWithMetadata {
|
||||
|
||||
|
||||
@@ -11,42 +11,36 @@
|
||||
*/
|
||||
package vazkii.botania.common.item.block;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemBlock;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.Icon;
|
||||
import net.minecraft.world.World;
|
||||
import vazkii.botania.api.BotaniaAPI;
|
||||
import vazkii.botania.api.subtile.SubTileEntity;
|
||||
import vazkii.botania.common.block.ModBlocks;
|
||||
import vazkii.botania.common.block.tile.TileSpecialFlower;
|
||||
import vazkii.botania.common.core.helper.ItemNBTHelper;
|
||||
import vazkii.botania.common.lib.LibBlockNames;
|
||||
import cpw.mods.fml.common.network.PacketDispatcher;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
public class ItemBlockSpecialFlower extends ItemBlock {
|
||||
|
||||
private static String TAG_TYPE = "type";
|
||||
|
||||
|
||||
public ItemBlockSpecialFlower(int par1) {
|
||||
super(par1);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public Icon getIconIndex(ItemStack stack) {
|
||||
return BotaniaAPI.internalHandler.getSubTileIconForName(getType(stack));
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public Icon getIcon(ItemStack stack, int pass) {
|
||||
return getIconIndex(stack);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean placeBlockAt(ItemStack stack, EntityPlayer player, World world, int x, int y, int z, int side, float hitX, float hitY, float hitZ, int metadata) {
|
||||
boolean placed = super.placeBlockAt(stack, player, world, x, y, z, side, hitX, hitY, hitZ, metadata);
|
||||
@@ -57,15 +51,15 @@ public class ItemBlockSpecialFlower extends ItemBlock {
|
||||
if(!world.isRemote)
|
||||
PacketDispatcher.sendPacketToAllInDimension(tile.getDescriptionPacket(), world.provider.dimensionId);
|
||||
}
|
||||
|
||||
|
||||
return placed;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public String getUnlocalizedName(ItemStack stack) {
|
||||
return "tile." + LibBlockNames.SPECIAL_FLOWER_PREFIX + getType(stack);
|
||||
}
|
||||
|
||||
|
||||
public static String getType(ItemStack stack) {
|
||||
return ItemNBTHelper.getString(stack, TAG_TYPE, "");
|
||||
}
|
||||
@@ -75,5 +69,5 @@ public class ItemBlockSpecialFlower extends ItemBlock {
|
||||
ItemNBTHelper.setString(stack, TAG_TYPE, type);
|
||||
return stack;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -50,11 +50,11 @@ public final class LexiconData {
|
||||
flowers.setPriority().setLexiconPages(new PageText("0"), new PageImage("1", LibResources.ENTRY_FLOWERS), new PageText("2"), new PageCraftingRecipes("3", ModCrafingRecipes.recipesPetals), new PageCraftingRecipes("4", ModCrafingRecipes.recipePestleAndMortar), new PageCraftingRecipes("5", ModCrafingRecipes.recipesDyes));
|
||||
|
||||
apothecary = new BLexiconEntry(LibLexicon.BASICS_APOTHECARY, categoryBasics);
|
||||
apothecary.setPriority().setLexiconPages(new PageText("0"), new PageImage("1", LibResources.ENTRY_APOTHECARY), new PageText("2"), new PageText("3"), new PageCraftingRecipes("4", ModCrafingRecipes.recipesApothecary));
|
||||
|
||||
apothecary.setPriority().setLexiconPages(new PageText("0"), new PageImage("1", LibResources.ENTRY_APOTHECARY), new PageText("2"), new PageText("3"), new PageCraftingRecipes("4", ModCrafingRecipes.recipesApothecary));
|
||||
|
||||
lexicon = new BLexiconEntry(LibLexicon.BASICS_LEXICON, categoryBasics);
|
||||
lexicon.setPriority().setLexiconPages(new PageText("0"), new PageCraftingRecipes("1", ModCrafingRecipes.recipeLexicon));
|
||||
|
||||
|
||||
wand = new BLexiconEntry(LibLexicon.BASICS_WAND, categoryBasics);
|
||||
wand.setPriority().setLexiconPages(new PageText("0"), new PageCraftingRecipes("1", ModCrafingRecipes.recipesTwigWand));
|
||||
}
|
||||
|
||||
@@ -49,7 +49,7 @@ public class PageCraftingRecipes extends LexiconPage {
|
||||
int recipeAt = 0;
|
||||
|
||||
int relativeMouseX, relativeMouseY;
|
||||
|
||||
|
||||
boolean oreDictRecipe, shapelessRecipe;
|
||||
|
||||
ItemStack tooltipStack, tooltipContainerStack;
|
||||
@@ -79,7 +79,7 @@ public class PageCraftingRecipes extends LexiconPage {
|
||||
|
||||
IRecipe recipe = recipes.get(recipeAt);
|
||||
renderCraftingRecipe(gui, recipe);
|
||||
|
||||
|
||||
int width = gui.getWidth() - 30;
|
||||
int height = gui.getHeight();
|
||||
int x = gui.getLeft() + 16;
|
||||
@@ -90,7 +90,7 @@ public class PageCraftingRecipes extends LexiconPage {
|
||||
render.bindTexture(craftingOverlay);
|
||||
int iconX = gui.getLeft() + 115;
|
||||
int iconY = gui.getTop() + 12;
|
||||
|
||||
|
||||
if(shapelessRecipe) {
|
||||
((GuiScreen) gui).drawTexturedModalRect(iconX, iconY, 240, 0, 16, 16);
|
||||
|
||||
@@ -99,17 +99,17 @@ public class PageCraftingRecipes extends LexiconPage {
|
||||
|
||||
iconY += 20;
|
||||
}
|
||||
|
||||
|
||||
render.bindTexture(craftingOverlay);
|
||||
GL11.glEnable(GL11.GL_BLEND);
|
||||
|
||||
if(oreDictRecipe) {
|
||||
((GuiScreen) gui).drawTexturedModalRect(iconX, iconY, 240, 16, 16, 16);
|
||||
|
||||
|
||||
if(mx >= iconX && my >= iconY && mx < iconX + 16 && my < iconY + 16)
|
||||
RenderHelper.renderTooltip(mx, my, Arrays.asList(StatCollector.translateToLocal("botaniamisc.oredict")));
|
||||
RenderHelper.renderTooltip(mx, my, Arrays.asList(StatCollector.translateToLocal("botaniamisc.oredict")));
|
||||
}
|
||||
|
||||
|
||||
if(tooltipStack != null) {
|
||||
List<String> tooltipData = tooltipStack.getTooltip(Minecraft.getMinecraft().thePlayer, false);
|
||||
|
||||
@@ -131,7 +131,7 @@ public class PageCraftingRecipes extends LexiconPage {
|
||||
}
|
||||
++ticksElapsed;
|
||||
}
|
||||
|
||||
|
||||
public void renderCraftingRecipe(IGuiLexiconEntry gui, IRecipe recipe) {
|
||||
if(recipe instanceof ShapedRecipes) {
|
||||
ShapedRecipes shaped = (ShapedRecipes)recipe;
|
||||
@@ -143,14 +143,14 @@ public class PageCraftingRecipes extends LexiconPage {
|
||||
ShapedOreRecipe shaped = (ShapedOreRecipe) recipe;
|
||||
int width = (Integer) ReflectionHelper.getPrivateValue(ShapedOreRecipe.class, shaped, 4);
|
||||
int height = (Integer) ReflectionHelper.getPrivateValue(ShapedOreRecipe.class, shaped, 5);
|
||||
|
||||
|
||||
for(int y = 0; y < height; y++)
|
||||
for(int x = 0; x < width; x++) {
|
||||
Object input = shaped.getInput()[y * width + x];
|
||||
if(input != null)
|
||||
renderItemAtGridPos(gui, 1 + x, 1 + y, input instanceof ItemStack ? (ItemStack) input : ((ArrayList<ItemStack>) input).get(0), true);
|
||||
}
|
||||
|
||||
|
||||
oreDictRecipe = true;
|
||||
} else if(recipe instanceof ShapelessRecipes) {
|
||||
ShapelessRecipes shapeless = (ShapelessRecipes) recipe;
|
||||
@@ -166,7 +166,7 @@ public class PageCraftingRecipes extends LexiconPage {
|
||||
renderItemAtGridPos(gui, 1 + x, 1 + y, (ItemStack) shapeless.recipeItems.get(index), true);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
shapelessRecipe = true;
|
||||
} else if(recipe instanceof ShapelessOreRecipe) {
|
||||
ShapelessOreRecipe shapeless = (ShapelessOreRecipe) recipe;
|
||||
@@ -184,7 +184,7 @@ public class PageCraftingRecipes extends LexiconPage {
|
||||
renderItemAtGridPos(gui, 1 + x, 1 + y, input instanceof ItemStack ? (ItemStack) input : ((ArrayList<ItemStack>) input).get(0), true);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
shapelessRecipe = true;
|
||||
oreDictRecipe = true;
|
||||
}
|
||||
@@ -196,7 +196,7 @@ public class PageCraftingRecipes extends LexiconPage {
|
||||
if(stack == null || stack.getItem() == null)
|
||||
return;
|
||||
stack = stack.copy();
|
||||
|
||||
|
||||
if(stack.getItemDamage() == Short.MAX_VALUE)
|
||||
stack.setItemDamage(0);
|
||||
|
||||
@@ -226,7 +226,7 @@ public class PageCraftingRecipes extends LexiconPage {
|
||||
tooltipContainerStack = containerStack;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
GL11.glDisable(GL11.GL_LIGHTING);
|
||||
}
|
||||
|
||||
|
||||
@@ -18,7 +18,6 @@ import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.gui.FontRenderer;
|
||||
import net.minecraft.util.MathHelper;
|
||||
import net.minecraft.util.StatCollector;
|
||||
import net.minecraft.util.StringUtils;
|
||||
import vazkii.botania.api.internal.IGuiLexiconEntry;
|
||||
import vazkii.botania.api.page.LexiconPage;
|
||||
import vazkii.botania.client.core.helper.FontHelper;
|
||||
@@ -56,18 +55,18 @@ public class PageText extends LexiconPage {
|
||||
for(String s1 : tokens) {
|
||||
boolean skipPending = false;
|
||||
String format = FontHelper.getFormatFromString(s1);
|
||||
|
||||
|
||||
if(!format.isEmpty() && s1.length() > 0 && s1.charAt(0) != '\u00a7') {
|
||||
skipPending = true;
|
||||
pendingFormat = format;
|
||||
format = "";
|
||||
}
|
||||
|
||||
|
||||
if(!pendingFormat.isEmpty() && !skipPending) {
|
||||
format = pendingFormat;
|
||||
pendingFormat = "";
|
||||
}
|
||||
|
||||
|
||||
if(MathHelper.stringNullOrLengthZero(format))
|
||||
format = lastFormat;
|
||||
|
||||
|
||||
@@ -24,9 +24,9 @@ public final class LibBlockNames {
|
||||
public static final String POOL = LibResources.PREFIX_MOD + "pool";
|
||||
|
||||
public static final String SPECIAL_FLOWER_PREFIX = FLOWER + ".";
|
||||
|
||||
|
||||
public static final String SUBTILE_PUREDAISY = "puredaisy";
|
||||
|
||||
|
||||
public static final String SUBTILE_DAYBLOOM = "daybloom";
|
||||
|
||||
public static final String SUBTILE_BELLETHORN = "bellethorn";
|
||||
|
||||
@@ -16,5 +16,5 @@ import vazkii.botania.client.lib.LibResources;
|
||||
public final class LibEntityNames {
|
||||
|
||||
public static final String MANA_BURST = LibResources.PREFIX_MOD + "manaBurst";
|
||||
|
||||
|
||||
}
|
||||
@@ -20,5 +20,6 @@ public final class LibItemIDs {
|
||||
public static int idTwigWand = 19559;
|
||||
public static int idManaResource = 19560;
|
||||
public static int idLens = 19562;
|
||||
public static int idManaPetal = 19563;
|
||||
|
||||
}
|
||||
@@ -22,6 +22,7 @@ public final class LibItemNames {
|
||||
public static final String TWIG_WAND = LibResources.PREFIX_MOD + "twigWand";
|
||||
public static final String MANA_RESOURCE = LibResources.PREFIX_MOD + "manaResource";
|
||||
public static final String LENS = LibResources.PREFIX_MOD + "lens";
|
||||
public static final String MANA_PETAL = LibResources.PREFIX_MOD + "manaPetal";
|
||||
|
||||
public static final String[] LENS_NAMES = new String[] {
|
||||
LibResources.PREFIX_MOD + "lensNormal",
|
||||
@@ -34,7 +35,7 @@ public final class LibItemNames {
|
||||
LibResources.PREFIX_MOD + "lensMine",
|
||||
LibResources.PREFIX_MOD + "lensDamage"
|
||||
};
|
||||
|
||||
|
||||
public static final String[] MANA_RESOURCE_NAMES = new String[] {
|
||||
LibResources.PREFIX_MOD + "manasteel",
|
||||
LibResources.PREFIX_MOD + "manaPearl",
|
||||
|
||||
@@ -23,14 +23,18 @@ public final class LibOreDict {
|
||||
public static final String MANA_DIAMOND = "manaDiamond";
|
||||
|
||||
public static final String[] FLOWER = new String[] {
|
||||
"mysticFlowerWhite", "mysticFlowerOrange", "mysticFlowerMagenta", "mysticFlowerLightBlue", "mysticFlowerYellow", "mysticFlowerLime", "mysticFlowerPink", "mysticFlowerGray", "mysticFlowerLightGray", "mysticFlowerCyan", "mysticFlowerPurple", "mysticFlowerBlue", "mysticFlowerBrown", "mysticFlowerGreen", "mysticFlowerRed", "mysticFlowerBlack",
|
||||
"mysticFlowerWhite", "mysticFlowerOrange", "mysticFlowerMagenta", "mysticFlowerLightBlue", "mysticFlowerYellow", "mysticFlowerLime", "mysticFlowerPink", "mysticFlowerGray", "mysticFlowerLightGray", "mysticFlowerCyan", "mysticFlowerPurple", "mysticFlowerBlue", "mysticFlowerBrown", "mysticFlowerGreen", "mysticFlowerRed", "mysticFlowerBlack",
|
||||
};
|
||||
|
||||
|
||||
public static final String[] PETAL = new String[] {
|
||||
"petalWhite", "petalOrange", "petalMagenta", "petalLightBlue", "petalYellow", "petalLime", "petalPink", "petalGray", "petalLightGray", "petalCyan", "petalPurple", "petalBlue", "petalBrown", "petalGreen", "petalRed", "petalBlack",
|
||||
"petalWhite", "petalOrange", "petalMagenta", "petalLightBlue", "petalYellow", "petalLime", "petalPink", "petalGray", "petalLightGray", "petalCyan", "petalPurple", "petalBlue", "petalBrown", "petalGreen", "petalRed", "petalBlack",
|
||||
};
|
||||
|
||||
public static final String[] DYE = new String[] {
|
||||
"dyeWhite", "dyeOrange", "dyeMagenta", "dyeLightBlue", "dyeYellow", "dyeLime", "dyePink", "dyeGray", "dyeLightGray", "dyeCyan", "dyePurple", "dyeBlue", "dyeBrown", "dyeGreen", "dyeRed", "dyeBlack",
|
||||
};
|
||||
|
||||
public static final String[] DYE = new String[] {
|
||||
"dyeWhite", "dyeOrange", "dyeMagenta", "dyeLightBlue", "dyeYellow", "dyeLime", "dyePink", "dyeGray", "dyeLightGray", "dyeCyan", "dyePurple", "dyeBlue", "dyeBrown", "dyeGreen", "dyeRed", "dyeBlack",
|
||||
public static final String[] MANA_PETAL = new String[] {
|
||||
"manaPetalWhite", "manaPetalOrange", "manaPetalMagenta", "manaPetalLightBlue", "manaPetalYellow", "manaPetalLime", "manaPetalPink", "manaPetalGray", "manaPetalLightGray", "manaPetalCyan", "manaPetalPurple", "manaPetalBlue", "manaPetalBrown", "manaPetalGreen", "manaPetalRed", "manaPetalBlack",
|
||||
};
|
||||
}
|
||||
@@ -108,6 +108,22 @@ item.botania:lensBounce.name=Mana Lens: Bounce
|
||||
item.botania:lensGravity.name=Mana Lens: Gravity
|
||||
item.botania:lensMine.name=Mana Lens: Bore
|
||||
item.botania:lensDamage.name=Mana Lens: Damaging
|
||||
item.botania:manaPetal0.name=White Mana Petal
|
||||
item.botania:manaPetal1.name=Orange Mana Petal
|
||||
item.botania:manaPetal2.name=Magenta Mana Petal
|
||||
item.botania:manaPetal3.name=Light Blue Mana Petal
|
||||
item.botania:manaPetal4.name=Yellow Mana Petal
|
||||
item.botania:manaPetal5.name=Lime Mana Petal
|
||||
item.botania:manaPetal6.name=Pink Mana Petal
|
||||
item.botania:manaPetal7.name=Gray Mana Petal
|
||||
item.botania:manaPetal8.name=Light Gray Mana Petal
|
||||
item.botania:manaPetal9.name=Cyan Mana Petal
|
||||
item.botania:manaPetal10.name=Purple Mana Petal
|
||||
item.botania:manaPetal11.name=Blue Mana Petal
|
||||
item.botania:manaPetal12.name=Brown Mana Petal
|
||||
item.botania:manaPetal13.name=Green Mana Petal
|
||||
item.botania:manaPetal14.name=Red Mana Petal
|
||||
item.botania:manaPetal15.name=Black Mana Petal
|
||||
|
||||
# GUI TEXT
|
||||
botania.gui.lexicon.header=Lexica Botania Index - Pick which category you would like to study:
|
||||
|
||||
Reference in new issue
Block a user