put 1.7.10 in main folder

This commit is contained in:
Martin Robertz committed 2023-01-13 19:25:21 +01:00
1 parent f6dd34eb96
commit b3a9147a3c
1429 files changed
+1 -135029

No files matched your search

+40
View File
@@ -0,0 +1,40 @@
package ab;
import ab.common.core.proxy.CommonProxy;
import cpw.mods.fml.common.Mod;
import cpw.mods.fml.common.SidedProxy;
import cpw.mods.fml.common.event.FMLInitializationEvent;
import cpw.mods.fml.common.event.FMLPostInitializationEvent;
import cpw.mods.fml.common.event.FMLPreInitializationEvent;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraftforge.common.MinecraftForge;
@Mod (modid = AdvancedBotany.modid, name="Advanced Botany", version = AdvancedBotany.version, dependencies = "required-after:Botania", guiFactory = "ab.client.core.handler.GuiABFactory")
public class AdvancedBotany {
public static final String modid = "AdvancedBotany";
public static final String version = "1.3.1.5";
@Mod.Instance("AdvancedBotany")
public static AdvancedBotany instance;
@SidedProxy(clientSide = "ab.client.core.proxy.ClientProxy", serverSide = "ab.common.core.proxy.CommonProxy")
public static CommonProxy proxy;
@Mod.EventHandler
public void preInit(FMLPreInitializationEvent event) {
proxy.preInit(event);
}
@Mod.EventHandler
public void init(FMLInitializationEvent event) {
proxy.init(event);
}
@Mod.EventHandler
public void postInit(FMLPostInitializationEvent event) {
proxy.postInit(event);
}
public static final CreativeTabs tabAB = new AdvancedBotanyTab("tabAB");
}
+24
View File
@@ -0,0 +1,24 @@
package ab;
import ab.common.lib.register.BlockListAB;
import ab.common.lib.register.ItemListAB;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.init.Items;
import net.minecraft.item.Item;
import net.minecraft.item.ItemBlock;
public class AdvancedBotanyTab extends CreativeTabs {
public AdvancedBotanyTab(String str) {
super(str);
this.setNoTitle();
this.setBackgroundImageName("ab.png");
}
@SideOnly(Side.CLIENT)
public Item getTabIconItem() {
return ItemBlock.getItemFromBlock(BlockListAB.blockABSpreader);
}
}
+17
View File
@@ -0,0 +1,17 @@
package ab.api;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.stats.Achievement;
import vazkii.botania.api.item.IRelic;
public class AchievementAB extends Achievement {
public AchievementAB(String name, int x, int y, ItemStack icon, Achievement parent) {
super("achievement.ab:" + name, "ab:" + name, x, y, icon, parent);
AdvancedBotanyAPI.achievements.add(this);
registerStat();
if(icon.getItem() instanceof IRelic)
((IRelic)icon.getItem()).setBindAchievement(this);
}
}
@@ -0,0 +1,53 @@
package ab.api;
import java.util.ArrayList;
import java.util.List;
import ab.api.recipe.RecipeAdvancedPlate;
import ab.api.recipe.RecipeAncientAlphirine;
import ab.common.core.handler.ConfigABHandler;
import ab.common.lib.register.ItemListAB;
import net.minecraft.block.Block;
import net.minecraft.item.EnumRarity;
import net.minecraft.item.Item;
import net.minecraft.item.ItemArmor;
import net.minecraft.item.ItemStack;
import net.minecraft.stats.Achievement;
import net.minecraft.util.EnumChatFormatting;
import net.minecraftforge.common.util.EnumHelper;
import vazkii.botania.common.item.ModItems;
public class AdvancedBotanyAPI {
public static List<RecipeAdvancedPlate> advancedPlateRecipes = new ArrayList<RecipeAdvancedPlate>();
public static List<RecipeAncientAlphirine> alphirineRecipes = new ArrayList<RecipeAncientAlphirine>();
public static List<TerraFarmlandList> farmlandList = new ArrayList<TerraFarmlandList>();
public static List<Achievement> achievements = new ArrayList<Achievement>();
public static List<ItemStack> relicList = new ArrayList<ItemStack>();
public static List<ItemStack> diceList = new ArrayList<ItemStack>();
public static Item.ToolMaterial mithrilToolMaterial = EnumHelper.addToolMaterial("MITHRIL", 7, -1, 8.0F, 4.0F, 24);
public static ItemArmor.ArmorMaterial nebulaArmorMaterial = EnumHelper.addArmorMaterial("NEBULA", 0, new int[] { (int)(3 * ConfigABHandler.protectionFactorNebula), (int)(8 * ConfigABHandler.protectionFactorNebula), (int)(6 * ConfigABHandler.protectionFactorNebula), (int)(3 * ConfigABHandler.protectionFactorNebula) }, 26);
public static ItemArmor.ArmorMaterial wildHundArmor = EnumHelper.addArmorMaterial("WILD_HUNT_MATERIAL", 34, new int[] { 7, 8, 3, 2 }, 26);
public static EnumRarity rarityNebula = EnumHelper.addRarity("NEBULA", EnumChatFormatting.LIGHT_PURPLE, "Nebula");
public static EnumRarity rarityWildHunt = EnumHelper.addRarity("WILD_HUNT", EnumChatFormatting.AQUA, "WildHunt");
public static RecipeAdvancedPlate registerAdvancedPlateRecipe(ItemStack output, ItemStack input1, ItemStack input2, ItemStack input3, int mana, int color) {
RecipeAdvancedPlate recipe = new RecipeAdvancedPlate(output, mana, color, input1, input2, input3);
advancedPlateRecipes.add(recipe);
return recipe;
}
public static RecipeAncientAlphirine registerAlphirineRecipe(ItemStack output, ItemStack input, int chance) {
RecipeAncientAlphirine recipe = new RecipeAncientAlphirine(output, input, chance);
alphirineRecipes.add(recipe);
return recipe;
}
public static TerraFarmlandList registerFarmlandSeed(Block block, int meta) {
TerraFarmlandList seed = new TerraFarmlandList(block, meta);
farmlandList.add(seed);
return seed;
}
}
+9
View File
@@ -0,0 +1,9 @@
package ab.api;
import net.minecraft.util.ChunkCoordinates;
import vazkii.botania.api.wand.IWandBindable;
public interface IBoundRender extends IWandBindable {
public ChunkCoordinates[] getBlocksCoord();
}
+11
View File
@@ -0,0 +1,11 @@
package ab.api;
import net.minecraft.item.ItemStack;
import vazkii.botania.api.mana.IManaItem;
public interface IRankItem extends IManaItem {
public int getLevel(ItemStack stack);
public int[] getLevels();
}
+9
View File
@@ -0,0 +1,9 @@
package ab.api;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.ScaledResolution;
public interface IRenderHud {
public void renderHud(Minecraft mc, ScaledResolution res);
}
@@ -0,0 +1,22 @@
package ab.api;
import net.minecraft.block.Block;
public class TerraFarmlandList {
Block block;
int meta;
public TerraFarmlandList(Block block, int meta) {
this.block = block;
this.meta = meta;
}
public Block getBlock() {
return block;
}
public int getMeta() {
return meta;
}
}
@@ -0,0 +1,70 @@
package ab.api.recipe;
import java.util.ArrayList;
import java.util.List;
import net.minecraft.inventory.IInventory;
import net.minecraft.item.ItemStack;
public class RecipeAdvancedPlate {
private ItemStack output;
private int color;
private List<ItemStack> inputs;
private int mana;
public RecipeAdvancedPlate(ItemStack output, int mana, int color, ItemStack... inputs) {
this.output = output;
this.mana = mana;
this.color = color;
List<ItemStack> inputsToSet = new ArrayList();
for (ItemStack obj : inputs)
inputsToSet.add(obj);
this.inputs = inputsToSet;
}
public List<ItemStack> getInputs() {
return new ArrayList(this.inputs);
}
public ItemStack getOutput() {
return this.output;
}
public int getManaUsage() {
return this.mana;
}
public int getColor() {
return this.color;
}
public boolean matches(IInventory inv) {
List<ItemStack> inputsMissing = new ArrayList(this.inputs);
for (int i = 1; i < inv.getSizeInventory(); i++) {
ItemStack stack = inv.getStackInSlot(i);
if (stack == null)
break;
int stackIndex = -1;
for (int j = 0; j < inputsMissing.size(); j++) {
ItemStack input = inputsMissing.get(j);
if (input instanceof ItemStack && simpleAreStacksEqual(input.copy(), stack)) {
stackIndex = j;
break;
}
}
if (stackIndex != -1) {
inputsMissing.remove(stackIndex);
} else {
return false;
}
}
return inputsMissing.isEmpty();
}
boolean simpleAreStacksEqual(ItemStack input, ItemStack stack) {
if(input.getItemDamage() == 32767)
input.setItemDamage(stack.getItemDamage());
return (input.getItem() == stack.getItem() && input.getItemDamage() == stack.getItemDamage());
}
}
@@ -0,0 +1,40 @@
package ab.api.recipe;
import net.minecraft.inventory.IInventory;
import net.minecraft.item.ItemStack;
public class RecipeAncientAlphirine {
private ItemStack output;
private ItemStack input;
private int chance;
public RecipeAncientAlphirine(ItemStack output, ItemStack input, int chance) {
this.output = output;
this.input = input;
if(chance > 100)
chance = 100;
else if(chance <= 0)
chance = 1;
this.chance = chance;
}
public ItemStack getOutput() {
return output;
}
public ItemStack getInput() {
return input;
}
public int getChance() {
return chance;
}
public boolean matches(ItemStack stack) {
ItemStack inputCopy = this.input.copy();
if(inputCopy.getItemDamage() == 32767)
inputCopy.setItemDamage(stack.getItemDamage());
return stack.getItem() == input.getItem() && stack.getItemDamage() == inputCopy.getItemDamage();
}
}
@@ -0,0 +1,121 @@
package ab.api.recipe.lexicon;
import java.util.ArrayList;
import java.util.List;
import org.lwjgl.opengl.GL11;
import ab.api.AdvancedBotanyAPI;
import ab.api.recipe.RecipeAdvancedPlate;
import ab.client.core.ClientHelper;
import ab.common.lib.register.BlockListAB;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.FontRenderer;
import net.minecraft.client.gui.GuiScreen;
import net.minecraft.client.renderer.texture.TextureManager;
import net.minecraft.item.ItemStack;
import net.minecraft.util.ResourceLocation;
import net.minecraft.util.StatCollector;
import vazkii.botania.api.internal.IGuiLexiconEntry;
import vazkii.botania.api.lexicon.LexiconEntry;
import vazkii.botania.api.lexicon.LexiconRecipeMappings;
import vazkii.botania.client.core.handler.ClientTickHandler;
import vazkii.botania.client.core.handler.HUDHandler;
import vazkii.botania.common.core.handler.ConfigHandler;
import vazkii.botania.common.lexicon.page.PageRecipe;
public class AdvancedPlateCraftPage extends PageRecipe {
private static final ResourceLocation plateOverlay = new ResourceLocation("botania:textures/gui/petalOverlay.png");
private RecipeAdvancedPlate recipe;
private final ItemStack resultStack;
int ticksElapsed = 0;
public AdvancedPlateCraftPage(LexiconEntry entry, ItemStack stack) {
this(entry, stack, "");
}
public AdvancedPlateCraftPage(LexiconEntry entry, ItemStack stack, String str) {
super(str);
resultStack = stack;
refreshRecipe(entry, stack);
}
public ItemStack getResult() {
return resultStack;
}
public void refreshRecipe(LexiconEntry entry, ItemStack stack) {
RecipeAdvancedPlate rec = null;
for(RecipeAdvancedPlate recipe : AdvancedBotanyAPI.advancedPlateRecipes) {
if(stack != null && recipe.getOutput() != null && recipe.getOutput().isItemEqual(stack)) {
rec = recipe;
break;
}
}
if(rec == null)
entry.pages.remove(this);
recipe = rec;
}
public void onPageAdded(LexiconEntry entry, int index) {
LexiconRecipeMappings.map(recipe.getOutput(), entry, index);
}
@SideOnly(Side.CLIENT)
public void renderRecipe(IGuiLexiconEntry gui, int mx, int my) {
TextureManager render = (Minecraft.getMinecraft()).renderEngine;
renderItemAtGridPos(gui, 3, 0, recipe.getOutput(), false);
renderItemAtGridPos(gui, 2, 1, new ItemStack(BlockListAB.blockABPlate), false);
List<ItemStack> inputs = recipe.getInputs();
int degreePerInput = (int)(360.0F / inputs.size());
float currentDegree = ConfigHandler.lexiconRotatingItems ? (GuiScreen.isShiftKeyDown() ? this.ticksElapsed : (this.ticksElapsed + ClientTickHandler.partialTicks)) : 0.0F;
for (ItemStack obj : inputs) {
ItemStack copy = obj.copy();
if (copy.getItemDamage() == 32767)
copy.setItemDamage(0);
renderItemAtAngle(gui, currentDegree, copy);
currentDegree += degreePerInput;
}
renderManaBar(gui, mx, my);
render.bindTexture(plateOverlay);
GL11.glEnable(3042);
GL11.glBlendFunc(770, 771);
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
((GuiScreen)gui).drawTexturedModalRect(gui.getLeft(), gui.getTop(), 0, 0, gui.getWidth(), gui.getHeight());
GL11.glDisable(3042);
}
@SideOnly(Side.CLIENT)
public void renderManaBar(IGuiLexiconEntry gui, int mx, int my) {
FontRenderer font = (Minecraft.getMinecraft()).fontRenderer;
GL11.glEnable(3042);
GL11.glBlendFunc(770, 771);
String manaUsage = StatCollector.translateToLocal("botaniamisc.manaUsage");
font.drawString(manaUsage, gui.getLeft() + gui.getWidth() / 2 - font.getStringWidth(manaUsage) / 2, gui.getTop() + 105, 1711276032);
int x = gui.getLeft() + gui.getWidth() / 2 - 50;
int y = gui.getTop() + 120;
String stopStr = StatCollector.translateToLocal("botaniamisc.shiftToStopSpin");
ClientHelper.renderPoolManaBar(x, y - 5, 0x239ddc, 1.0f, this.recipe.getManaUsage());
boolean unicode = font.getUnicodeFlag();
font.setUnicodeFlag(true);
font.drawString(stopStr, x + 49 - font.getStringWidth(stopStr) / 2, y + 18, -1728053248);
font.setUnicodeFlag(unicode);
GL11.glDisable(3042);
}
@SideOnly(Side.CLIENT)
public void updateScreen() {
if (GuiScreen.isShiftKeyDown())
return;
this.ticksElapsed++;
}
public List<ItemStack> getDisplayedRecipes() {
ArrayList<ItemStack> list = new ArrayList<ItemStack>();
list.add(recipe.getOutput());
return list;
}
}
@@ -0,0 +1,97 @@
package ab.api.recipe.lexicon;
import java.util.ArrayList;
import java.util.List;
import org.lwjgl.opengl.GL11;
import ab.api.AdvancedBotanyAPI;
import ab.api.recipe.RecipeAdvancedPlate;
import ab.api.recipe.RecipeAncientAlphirine;
import ab.client.core.ClientHelper;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.FontRenderer;
import net.minecraft.client.gui.GuiScreen;
import net.minecraft.client.renderer.texture.TextureManager;
import net.minecraft.item.ItemStack;
import net.minecraft.util.EnumChatFormatting;
import net.minecraft.util.ResourceLocation;
import net.minecraft.util.StatCollector;
import vazkii.botania.api.internal.IGuiLexiconEntry;
import vazkii.botania.api.lexicon.LexiconEntry;
import vazkii.botania.api.lexicon.LexiconRecipeMappings;
import vazkii.botania.common.item.block.ItemBlockSpecialFlower;
import vazkii.botania.common.lexicon.page.PageRecipe;
import vazkii.botania.common.lexicon.page.PageText;
public class AlphirineCraftPage extends PageRecipe {
private static final ResourceLocation alphirineOverlay = new ResourceLocation("botania:textures/gui/pureDaisyOverlay.png");
private RecipeAncientAlphirine recipe;
private final ItemStack resultStack;
public AlphirineCraftPage(LexiconEntry entry, ItemStack stack) {
this(entry, stack, "");
}
public AlphirineCraftPage(LexiconEntry entry, ItemStack stack, String str) {
super(str);
resultStack = stack;
refreshRecipe(entry, stack);
}
public ItemStack getResult() {
return resultStack;
}
public void refreshRecipe(LexiconEntry entry, ItemStack stack) {
RecipeAncientAlphirine rec = null;
for(RecipeAncientAlphirine recipe : AdvancedBotanyAPI.alphirineRecipes) {
if(stack != null && recipe.getOutput() != null && recipe.getOutput().isItemEqual(stack)) {
rec = recipe;
break;
}
}
if(rec == null)
entry.pages.remove(this);
recipe = rec;
}
public void onPageAdded(LexiconEntry entry, int index) {
LexiconRecipeMappings.map(recipe.getOutput(), entry, index);
}
@SideOnly(Side.CLIENT)
public void renderRecipe(IGuiLexiconEntry gui, int mx, int my) {
TextureManager render = (Minecraft.getMinecraft()).renderEngine;
FontRenderer font = (Minecraft.getMinecraft()).fontRenderer;
GL11.glEnable(3042);
GL11.glBlendFunc(770, 771);
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
render.bindTexture(alphirineOverlay);
((GuiScreen)gui).drawTexturedModalRect(gui.getLeft() + 40, gui.getTop() + 44, 0, 0, gui.getWidth(), gui.getHeight());
ItemStack inp = recipe.getInput().copy();
if(inp.getItemDamage() == 32767)
inp.setItemDamage(0);
this.renderItem(gui, gui.getLeft() + 34, gui.getTop() + 59, inp, false);
this.renderItem(gui, gui.getLeft() + 62, gui.getTop() + 57, ItemBlockSpecialFlower.ofType("ancientAlphirine").copy(), false);
this.renderItem(gui, gui.getLeft() + 93, gui.getTop() + 54, recipe.getOutput().copy(), false);
int x = gui.getLeft() + gui.getWidth() / 2 - 50;
int y = gui.getTop() + 85;
String name = EnumChatFormatting.BOLD + StatCollector.translateToLocal("ab.name.alpherine.craft");
boolean unicode = font.getUnicodeFlag();
font.setUnicodeFlag(true);
font.drawString(name, x + 50 - font.getStringWidth(name) / 2, y - 65, -1728053248);
font.setUnicodeFlag(unicode);
ClientHelper.drawChanceBar(x + 21, y + 14, recipe.getChance());
GL11.glDisable(3042);
}
public List<ItemStack> getDisplayedRecipes() {
ArrayList<ItemStack> list = new ArrayList<ItemStack>();
list.add(recipe.getOutput());
return list;
}
}
@@ -0,0 +1,242 @@
package ab.client.core;
import java.awt.Color;
import java.nio.FloatBuffer;
import java.util.Random;
import org.lwjgl.opengl.GL11;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.ScaledResolution;
import net.minecraft.client.renderer.ActiveRenderInfo;
import net.minecraft.client.renderer.GLAllocation;
import net.minecraft.client.renderer.OpenGlHelper;
import net.minecraft.client.renderer.RenderHelper;
import net.minecraft.client.renderer.Tessellator;
import net.minecraft.client.renderer.entity.RenderItem;
import net.minecraft.client.renderer.tileentity.TileEntityRendererDispatcher;
import net.minecraft.item.ItemStack;
import net.minecraft.util.IIcon;
import net.minecraft.util.ResourceLocation;
import net.minecraft.util.StatCollector;
import vazkii.botania.client.core.handler.ClientTickHandler;
import vazkii.botania.client.core.handler.HUDHandler;
import vazkii.botania.common.block.ModBlocks;
import vazkii.botania.common.core.helper.Vector3;
public class ClientHelper {
public static final ResourceLocation miscHuds = new ResourceLocation("ab:textures/misc/miscHuds.png");
private static final ResourceLocation field_147529_c = new ResourceLocation("textures/environment/end_sky.png");
private static final ResourceLocation field_147526_d = new ResourceLocation("textures/entity/end_portal.png");
private static final Random field_147527_e = new Random(31100L);
public static Minecraft mc = Minecraft.getMinecraft();
private static FloatBuffer field_147528_b = GLAllocation.createDirectFloatBuffer(16);
public static void renderCosmicBackground() {
field_147527_e.setSeed(31100L);
float f4 = 0.24F;
for (int i = 0; i < 16; i++) {
GL11.glPushMatrix();
float f5 = (16 - i);
float f6 = 0.0625F;
float f7 = 1.0F / (f5 + 1.0F);
if (i == 0) {
mc.renderEngine.bindTexture(field_147529_c);
f7 = 0.1F;
f5 = 65.0F;
f6 = 0.125F;
GL11.glEnable(GL11.GL_BLEND);
GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
}
if (i == 1) {
mc.renderEngine.bindTexture(field_147526_d);
GL11.glEnable(GL11.GL_BLEND);
GL11.glBlendFunc(GL11.GL_ONE, GL11.GL_ONE);
f6 = 0.5F;
}
GL11.glTranslatef(0.0f, 1.5f, 0.0f);
GL11.glTexGeni(GL11.GL_S, GL11.GL_TEXTURE_GEN_MODE, GL11.GL_OBJECT_LINEAR);
GL11.glTexGeni(GL11.GL_T, GL11.GL_TEXTURE_GEN_MODE, GL11.GL_OBJECT_LINEAR);
GL11.glTexGeni(GL11.GL_R, GL11.GL_TEXTURE_GEN_MODE, GL11.GL_OBJECT_LINEAR);
GL11.glTexGeni(GL11.GL_Q, GL11.GL_TEXTURE_GEN_MODE, GL11.GL_EYE_LINEAR);
GL11.glTexGen(GL11.GL_S, GL11.GL_OBJECT_PLANE, func_147525_a(1.0F, 0.0F, 0.0F, 0.0F));
GL11.glTexGen(GL11.GL_T, GL11.GL_OBJECT_PLANE, func_147525_a(0.0F, 0.0F, 1.0F, 0.0F));
GL11.glTexGen(GL11.GL_R, GL11.GL_OBJECT_PLANE, func_147525_a(0.0F, 0.0F, 0.0F, 1.0F));
GL11.glTexGen(GL11.GL_Q, GL11.GL_EYE_PLANE, func_147525_a(0.0F, 1.0F, 0.0F, 0.0F));
GL11.glEnable(GL11.GL_TEXTURE_GEN_S);
GL11.glEnable(GL11.GL_TEXTURE_GEN_T);
GL11.glEnable(GL11.GL_TEXTURE_GEN_R);
GL11.glEnable(GL11.GL_TEXTURE_GEN_Q);
GL11.glPopMatrix();
GL11.glMatrixMode(GL11.GL_TEXTURE);
GL11.glPushMatrix();
GL11.glLoadIdentity();
GL11.glTranslatef(0.0F, (float)(Minecraft.getSystemTime() % 20000L) / 20000.0F, 0.0F);
GL11.glScalef(f6, f6, f6);
GL11.glTranslatef(0.5F, 0.5F, 0.0F);
GL11.glRotatef((i * i * 4321 + i * 9) * 2.0F, 0.0F, 0.0F, 1.0F);
GL11.glTranslatef(-0.5F, -0.5F, 0.0F);
Tessellator tessellator = Tessellator.instance;
tessellator.startDrawingQuads();
Color color = Color.getHSBColor((float)Minecraft.getSystemTime() / 20.0F % 360.0F / 360.0F, 1.0F, 1.0F);
float f11 = color.getRed() / 255.0F;
float f12 = color.getGreen() / 255.0F;
float f13 = color.getBlue() / 255.0F;
tessellator.setBrightness(60);
tessellator.setColorRGBA_F(f11 * f7, f12 * f7, f13 * f7, 1.0F);
tessellator.addVertex(0.0D, f4, 0.0D);
tessellator.addVertex(0.0D, f4, 1.0D);
tessellator.addVertex(1.0D, f4, 1.0D);
tessellator.addVertex(1.0D, f4, 0.0D);
tessellator.draw();
GL11.glPopMatrix();
GL11.glMatrixMode(GL11.GL_MODELVIEW);
}
GL11.glDisable(GL11.GL_BLEND);
GL11.glDisable(GL11.GL_TEXTURE_GEN_S);
GL11.glDisable(GL11.GL_TEXTURE_GEN_T);
GL11.glDisable(GL11.GL_TEXTURE_GEN_R);
GL11.glDisable(GL11.GL_TEXTURE_GEN_Q);
}
private static FloatBuffer func_147525_a(float p_147525_1_, float p_147525_2_, float p_147525_3_, float p_147525_4_) {
field_147528_b.clear();
field_147528_b.put(p_147525_1_).put(p_147525_2_).put(p_147525_3_).put(p_147525_4_);
field_147528_b.flip();
return field_147528_b;
}
public static void drawArrow(int x, int y, boolean side) {
mc.renderEngine.bindTexture(miscHuds);
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0f);
vazkii.botania.client.core.helper.RenderHelper.drawTexturedModalRect(x, y, 0.0F, 0, 10, side ? 0 : 22, 38);
}
public static void drawChanceBar(int x, int y, int chance) {
mc.renderEngine.bindTexture(miscHuds);
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0f);
vazkii.botania.client.core.helper.RenderHelper.drawTexturedModalRect(x, y, 0.0F, 0, 0, 57, 6);
int chancePercentage = Math.max(0, (int)((chance / 100.f) * 55.0D));
vazkii.botania.client.core.helper.RenderHelper.drawTexturedModalRect(x + 1, y + 1, 0.0F, 0, 6, 55, 4);
Color color = new Color(Color.HSBtoRGB((chance) / 360.0f, ((float)Math.sin((ClientTickHandler.ticksInGame + ClientTickHandler.partialTicks) * 0.2D) + 1.0F) * 0.3F + 0.4F, 1.0f));
GL11.glColor4ub((byte)color.getRed(), (byte)color.getGreen(), (byte)color.getBlue(), (byte)255);
vazkii.botania.client.core.helper.RenderHelper.drawTexturedModalRect(x + 1, y + 1, 0.0F, 0, 6, Math.min(55, chancePercentage), 4);
}
public static void renderPoolManaBar(int x, int y, int color, float alpha, int mana) {
Minecraft mc = Minecraft.getMinecraft();
int poolCount = (int)Math.floor(mana / 1000000.0D);
if(poolCount < 0)
poolCount = 0;
int onePoolMana = mana - (poolCount * 1000000);
String strPool = poolCount + "x";
int xc = x - mc.fontRenderer.getStringWidth(strPool) / 2;
int yc = y;
GL11.glPushMatrix();
GL11.glTranslatef(xc + 42.0f, yc + 5.0f, 0.0f);
RenderHelper.enableGUIStandardItemLighting();
RenderItem.getInstance().renderItemAndEffectIntoGUI(mc.fontRenderer, mc.renderEngine, new ItemStack(ModBlocks.pool), 0, 0);
RenderHelper.disableStandardItemLighting();
GL11.glTranslatef(18.0f, 5.0f, 300.0f);
mc.fontRenderer.drawString(strPool, 0, 0, color);
GL11.glPopMatrix();
if((poolCount * 1000000) == mana)
onePoolMana = poolCount * 1000000;
HUDHandler.renderManaBar(x, y, color, alpha, onePoolMana, 1000000);
}
public static void drawPoolManaHUD(ScaledResolution res, String name, int mana, int maxMana, int color) {
Minecraft mc = Minecraft.getMinecraft();
int poolCount = (int)Math.floor(mana / 1000000.0D);
int maxPoolCount = (int)Math.floor(maxMana / 1000000.0D);
if(poolCount < 0)
poolCount = 0;
if(maxPoolCount < 0)
maxPoolCount = 0;
int onePoolMana = mana - (poolCount * 1000000);
String strPool = poolCount + "x / " + maxPoolCount + "x";
int xc = res.getScaledWidth() / 2 - mc.fontRenderer.getStringWidth(strPool) / 2 - 3;
int yc = res.getScaledHeight() / 2;
GL11.glPushMatrix();
GL11.glTranslatef(xc - 6.0f, yc + 30.0f, 0.0f);
RenderHelper.enableGUIStandardItemLighting();
RenderItem.getInstance().renderItemAndEffectIntoGUI(mc.fontRenderer, mc.renderEngine, new ItemStack(ModBlocks.pool), 0, 0);
RenderHelper.disableStandardItemLighting();
GL11.glTranslatef(18.0f, 4.5f, 300.0f);
mc.fontRenderer.drawStringWithShadow(strPool, 0, 0, color);
GL11.glPopMatrix();
if((poolCount * 1000000) == mana)
onePoolMana = poolCount * 1000000;
HUDHandler.drawSimpleManaHUD(color, onePoolMana, 1000000, name, res);
}
public static void setLightmapTextureCoords() {
int light = 15728880;
int lightmapX = light % 65536;
int lightmapY = light / 65536;
OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, lightmapX, lightmapY);
}
public static Vector3 setRotation(float angel, float vX, float vY, float vZ, Vector3 v3) {
Vector3 rVec = new Vector3(vX, vY, vZ);
Vector3 rVec1 = v3.copy().normalize();
double rAngel = Math.toRadians(angel) * 0.5f;
double sin = Math.sin(rAngel);
double x = rVec.x * sin;
double y = rVec.y * sin;
double z = rVec.z * sin;
rAngel = Math.cos(rAngel);
double d = -x * rVec1.x - y * rVec1.y - z * rVec1.z;
double d1 = rAngel * rVec1.x + y * rVec1.z - z * rVec1.y;
double d2 = rAngel * rVec1.y - x * rVec1.z + z * rVec1.x;
double d3 = rAngel * rVec1.z + x * rVec1.y - y * rVec1.x;
v3.x = d1 * rAngel - d * x - d2 * z + d3 * y;
v3.y = d2 * rAngel - d * y + d1 * z - d3 * x;
v3.z = d3 * rAngel - d * z - d1 * y + d2 * x;
return v3;
}
public static Color getCorporeaRuneColor(int posX, int posY, int posZ, int meta) {
double time = ClientTickHandler.ticksInGame + ClientTickHandler.partialTicks;
time += (new Random((posX ^ posY ^ posZ))).nextInt(360);
float sin = (float)(Math.sin(time / 20.0f) * 0.15f) - 0.15f;
int color = 0;
switch(meta) {
case 0:
color = Color.HSBtoRGB(0.0f, 0.0f, 0.54f + (sin / 1.2f));
break;
case 1:
color = Color.HSBtoRGB(0.688f, 0.93f, 0.96f + sin - 0.15f);
break;
case 2:
color = Color.HSBtoRGB(0.983f, 0.99f, 1.0f + sin - 0.15f);
break;
case 3:
color = Color.HSBtoRGB(0.319f, 0.92f, 0.95f + sin - 0.15f);
break;
case 4:
color = Color.HSBtoRGB(0.536f, 0.53f, 0.92f + sin - 0.15f);
break;
}
return new Color(color);
}
public static void renderIcon(IIcon icon, int light) {
Tessellator tessellator = Tessellator.instance;
float f = icon.getMinU();
float f1 = icon.getMaxU();
float f2 = icon.getMinV();
float f3 = icon.getMaxV();
float f4 = 1.0F;
float f5 = 0.5F;
float f6 = 0.25F;
tessellator.startDrawingQuads();
tessellator.setNormal(0.0F, 1.0F, 0.0F);
tessellator.addVertexWithUV((0.0F - f5), (0.0F - f6), 0.0D, f, f3);
tessellator.addVertexWithUV((f4 - f5), (0.0F - f6), 0.0D, f1, f3);
tessellator.addVertexWithUV((f4 - f5), (f4 - f6), 0.0D, f1, f2);
tessellator.addVertexWithUV((0.0F - f5), (f4 - f6), 0.0D, f, f2);
tessellator.draw();
}
}
@@ -0,0 +1,129 @@
package ab.client.core.handler;
import java.awt.Color;
import org.lwjgl.opengl.GL11;
import ab.api.IBoundRender;
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
import net.minecraft.block.Block;
import net.minecraft.client.Minecraft;
import net.minecraft.client.entity.EntityClientPlayerMP;
import net.minecraft.client.multiplayer.WorldClient;
import net.minecraft.client.renderer.Tessellator;
import net.minecraft.client.renderer.entity.RenderManager;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.AxisAlignedBB;
import net.minecraft.util.ChunkCoordinates;
import net.minecraft.util.MovingObjectPosition;
import net.minecraft.world.World;
import net.minecraftforge.client.event.RenderWorldLastEvent;
import vazkii.botania.api.wand.ICoordBoundItem;
import vazkii.botania.api.wand.IWireframeAABBProvider;
import vazkii.botania.client.core.handler.ClientTickHandler;
public class BoundRenderHandler {
@SubscribeEvent
public void onWorldRenderLast(RenderWorldLastEvent event) {
GL11.glPushMatrix();
GL11.glPushAttrib(2896);
GL11.glDisable(2929);
GL11.glDisable(3553);
GL11.glDisable(2896);
GL11.glEnable(3042);
Tessellator.renderingWorldRenderer = false;
EntityClientPlayerMP entityClientPlayerMP = (Minecraft.getMinecraft()).thePlayer;
ItemStack stack = entityClientPlayerMP.getCurrentEquippedItem();
int color = Color.HSBtoRGB((ClientTickHandler.ticksInGame % 200) / 200.0F, 0.6F, 1.0F);
if(stack != null && stack.getItem() instanceof ICoordBoundItem) {
ChunkCoordinates[] coords = null;
MovingObjectPosition pos = (Minecraft.getMinecraft()).objectMouseOver;
if(pos != null) {
TileEntity tile = (Minecraft.getMinecraft()).theWorld.getTileEntity(pos.blockX, pos.blockY, pos.blockZ);
if(tile != null && tile instanceof IBoundRender)
coords = ((IBoundRender)tile).getBlocksCoord();
}
if(coords != null)
for(int i = 0; i < coords.length; i++) {
if(coords[i].posY == -1)
continue;
renderBlockOutlineAt(coords[i], color, 1.0f);
}
}
GL11.glEnable(2929);
GL11.glEnable(3553);
GL11.glDisable(3042);
GL11.glPopAttrib();
GL11.glPopMatrix();
}
private void renderBlockOutlineAt(ChunkCoordinates pos, int color, float thickness) {
GL11.glPushMatrix();
GL11.glTranslated(pos.posX - RenderManager.renderPosX, pos.posY - RenderManager.renderPosY, pos.posZ - RenderManager.renderPosZ + 1.0D);
Color colorRGB = new Color(color);
GL11.glColor4ub((byte)colorRGB.getRed(), (byte)colorRGB.getGreen(), (byte)colorRGB.getBlue(), (byte)-1);
WorldClient worldClient = (Minecraft.getMinecraft()).theWorld;
Block block = worldClient.getBlock(pos.posX, pos.posY, pos.posZ);
if(block != null) {
AxisAlignedBB axis;
if(block instanceof IWireframeAABBProvider) {
axis = ((IWireframeAABBProvider)block).getWireframeAABB((World)worldClient, pos.posX, pos.posY, pos.posZ);
} else {
axis = block.getSelectedBoundingBoxFromPool((World)worldClient, pos.posX, pos.posY, pos.posZ);
}
if(axis != null) {
axis.minX -= pos.posX;
axis.maxX -= pos.posX;
axis.minY -= pos.posY;
axis.maxY -= pos.posY;
axis.minZ -= (pos.posZ + 1);
axis.maxZ -= (pos.posZ + 1);
GL11.glScalef(1.0F, 1.0F, 1.0F);
GL11.glLineWidth(thickness);
renderBlockOutline(axis);
GL11.glLineWidth(thickness + 3.0F);
GL11.glColor4ub((byte)colorRGB.getRed(), (byte)colorRGB.getGreen(), (byte)colorRGB.getBlue(), (byte)64);
renderBlockOutline(axis);
}
}
GL11.glPopMatrix();
}
private void renderBlockOutline(AxisAlignedBB aabb) {
Tessellator tessellator = Tessellator.instance;
double ix = aabb.minX;
double iy = aabb.minY;
double iz = aabb.minZ;
double ax = aabb.maxX;
double ay = aabb.maxY;
double az = aabb.maxZ;
tessellator.startDrawing(1);
tessellator.addVertex(ix, iy, iz);
tessellator.addVertex(ix, ay, iz);
tessellator.addVertex(ix, ay, iz);
tessellator.addVertex(ax, ay, iz);
tessellator.addVertex(ax, ay, iz);
tessellator.addVertex(ax, iy, iz);
tessellator.addVertex(ax, iy, iz);
tessellator.addVertex(ix, iy, iz);
tessellator.addVertex(ix, iy, az);
tessellator.addVertex(ix, ay, az);
tessellator.addVertex(ix, iy, az);
tessellator.addVertex(ax, iy, az);
tessellator.addVertex(ax, iy, az);
tessellator.addVertex(ax, ay, az);
tessellator.addVertex(ix, ay, az);
tessellator.addVertex(ax, ay, az);
tessellator.addVertex(ix, iy, iz);
tessellator.addVertex(ix, iy, az);
tessellator.addVertex(ix, ay, iz);
tessellator.addVertex(ix, ay, az);
tessellator.addVertex(ax, iy, iz);
tessellator.addVertex(ax, iy, az);
tessellator.addVertex(ax, ay, iz);
tessellator.addVertex(ax, ay, az);
tessellator.draw();
}
}
@@ -0,0 +1,127 @@
package ab.client.core.handler;
import java.awt.Color;
import java.util.ArrayList;
import java.util.List;
import org.lwjgl.input.Mouse;
import org.lwjgl.opengl.GL11;
import ab.api.IBoundRender;
import ab.api.IRankItem;
import ab.client.core.handler.PlayerItemUsingSound.ClientSoundHandler;
import ab.common.block.tile.TileLebethronCore;
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
import cpw.mods.fml.common.gameevent.TickEvent;
import cpw.mods.fml.relauncher.ReflectionHelper;
import net.minecraft.block.Block;
import net.minecraft.client.Minecraft;
import net.minecraft.client.entity.EntityClientPlayerMP;
import net.minecraft.client.gui.FontRenderer;
import net.minecraft.client.gui.Gui;
import net.minecraft.client.gui.GuiScreen;
import net.minecraft.client.gui.ScaledResolution;
import net.minecraft.client.gui.inventory.GuiContainer;
import net.minecraft.client.multiplayer.WorldClient;
import net.minecraft.client.renderer.Tessellator;
import net.minecraft.client.renderer.entity.RenderManager;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.inventory.Slot;
import net.minecraft.item.ItemStack;
import net.minecraft.profiler.Profiler;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.AxisAlignedBB;
import net.minecraft.util.ChunkCoordinates;
import net.minecraft.util.MovingObjectPosition;
import net.minecraft.util.StatCollector;
import net.minecraft.world.World;
import net.minecraftforge.client.event.RenderGameOverlayEvent;
import net.minecraftforge.client.event.RenderWorldLastEvent;
import vazkii.botania.api.wand.ICoordBoundItem;
import vazkii.botania.api.wand.IWireframeAABBProvider;
import vazkii.botania.client.core.handler.ClientTickHandler;
import vazkii.botania.common.lib.LibObfuscation;
public class ClientHandler {
@SubscribeEvent
public void renderTick(TickEvent.RenderTickEvent event) {
if(event.phase != TickEvent.Phase.START)
renderTooltip();
}
@SubscribeEvent
public void clientTickEnd(TickEvent.ClientTickEvent event) {
if(event.phase == TickEvent.Phase.END) {
ItemsRemainingRender.tick();
ClientSoundHandler.tick();
}
}
public static void renderTooltip() {
Minecraft mc = Minecraft.getMinecraft();
GuiScreen gui = mc.currentScreen;
if (gui != null && gui instanceof GuiContainer && mc.thePlayer != null && mc.thePlayer.inventory.getItemStack() == null) {
GuiContainer container = (GuiContainer)gui;
Slot slot = (Slot)ReflectionHelper.getPrivateValue(GuiContainer.class, container, LibObfuscation.THE_SLOT);
if (slot != null && slot.getHasStack()) {
ItemStack stack = slot.getStack();
if (stack != null) {
List<String> tooltip;
ScaledResolution res = new ScaledResolution(mc, mc.displayWidth, mc.displayHeight);
FontRenderer font = mc.fontRenderer;
int mouseX = Mouse.getX() * res.getScaledWidth() / mc.displayWidth;
int mouseY = res.getScaledHeight() - Mouse.getY() * res.getScaledHeight() / mc.displayHeight;
try {
tooltip = stack.getTooltip((EntityPlayer)mc.thePlayer, mc.gameSettings.advancedItemTooltips);
} catch (Exception e) {
tooltip = new ArrayList<String>();
}
int width = 0;
for (String s : tooltip)
width = Math.max(width, font.getStringWidth(s) + 2);
int tooltipHeight = (tooltip.size() - 1) * 10 + 5;
int height = 3;
int offx = 11;
int offy = 17;
boolean offscreen = (mouseX + width + 19 >= res.getScaledWidth());
int fixY = res.getScaledHeight() - mouseY + tooltipHeight;
if (fixY < 0)
offy -= fixY;
if (offscreen)
offx = -13 - width;
if (stack.getItem() instanceof IRankItem) {
drawRankItemBar(stack, mouseX, mouseY, offx, offy, width, height, font);
}
}
}
}
}
private static void drawRankItemBar(ItemStack stack, int mouseX, int mouseY, int offx, int offy, int width, int height, FontRenderer font) {
IRankItem item = (IRankItem)stack.getItem();
int level = item.getLevel(stack);
int max = item.getLevels()[Math.min(item.getLevels().length - 1, level + 1)];
boolean ss = (level >= item.getLevels().length - 1);
int curr = item.getMana(stack);
float percent = (level == 0) ? 0.0F : ((float)curr / (float)max);
int rainbowWidth = Math.min(width - (ss ? 0 : 1), (int)(width * percent));
float huePer = (width == 0) ? 0.0F : (1.0F / width);
float hueOff = (ClientTickHandler.ticksInGame + ClientTickHandler.partialTicks) * 0.01F;
GL11.glDisable(2929);
Gui.drawRect(mouseX + offx - 1, mouseY - offy - height - 1, mouseX + offx + width + 1, mouseY - offy, -16777216);
for(int i = 0; i < rainbowWidth; i++)
Gui.drawRect(mouseX + offx + i, mouseY - offy - height, mouseX + offx + i + 1, mouseY - offy, Color.HSBtoRGB(hueOff + huePer * i, 1.0F, 1.0F));
Gui.drawRect(mouseX + offx + rainbowWidth, mouseY - offy - height, mouseX + offx + width, mouseY - offy, -11184811);
String rank = StatCollector.translateToLocal("botania.rank" + level).replaceAll("&", "\u00A7");
GL11.glPushAttrib(2896);
GL11.glDisable(2896);
font.drawStringWithShadow(rank, mouseX + offx, mouseY - offy - 12, 16777215);
if(!ss) {
rank = StatCollector.translateToLocal("botania.rank" + (level + 1)).replaceAll("&", "\u00A7");
font.drawStringWithShadow(rank, mouseX + offx + width - font.getStringWidth(rank), mouseY - offy - 12, 16777215);
}
GL11.glEnable(2929);
GL11.glPopAttrib();
}
}
@@ -0,0 +1,18 @@
package ab.client.core.handler;
import java.util.ArrayList;
import java.util.List;
import ab.AdvancedBotany;
import ab.common.core.handler.ConfigABHandler;
import cpw.mods.fml.client.config.GuiConfig;
import cpw.mods.fml.client.config.IConfigElement;
import net.minecraft.client.gui.GuiScreen;
import net.minecraftforge.common.config.ConfigElement;
public class GuiABConfigHandler extends GuiConfig {
public GuiABConfigHandler(GuiScreen parentScreen) {
super(parentScreen, (new ConfigElement(ConfigABHandler.config.getCategory("general"))).getChildElements(), AdvancedBotany.modid, false, false, GuiConfig.getAbridgedConfigPath(ConfigABHandler.config.toString()));
}
}
@@ -0,0 +1,24 @@
package ab.client.core.handler;
import java.util.Set;
import cpw.mods.fml.client.IModGuiFactory;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.GuiScreen;
public class GuiABFactory implements IModGuiFactory {
public void initialize(Minecraft minecraftInstance) {}
public Class<? extends GuiScreen> mainConfigGuiClass() {
return GuiABConfigHandler.class;
}
public Set<IModGuiFactory.RuntimeOptionCategoryElement> runtimeGuiCategories() {
return null;
}
public IModGuiFactory.RuntimeOptionGuiHandler getHandlerFor(IModGuiFactory.RuntimeOptionCategoryElement element) {
return null;
}
}
@@ -0,0 +1,62 @@
package ab.client.core.handler;
import java.awt.Color;
import org.lwjgl.opengl.GL11;
import ab.api.IRenderHud;
import ab.common.block.tile.TileLebethronCore;
import ab.common.item.equipment.ItemBlackHalo;
import ab.common.item.equipment.armor.ItemNebulaArmor;
import ab.common.item.equipment.armor.ItemNebulaHelm;
import ab.common.lib.register.ItemListAB;
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
import net.minecraft.block.Block;
import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.ItemRenderer;
import net.minecraft.client.renderer.OpenGlHelper;
import net.minecraft.client.renderer.Tessellator;
import net.minecraft.client.renderer.texture.TextureMap;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.profiler.Profiler;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.MovingObjectPosition;
import net.minecraft.util.ResourceLocation;
import net.minecraftforge.client.event.RenderGameOverlayEvent;
import net.minecraftforge.client.event.RenderPlayerEvent;
import vazkii.botania.api.item.IPhantomInkable;
import vazkii.botania.client.core.handler.ClientTickHandler;
import vazkii.botania.common.item.ItemLexicon;
import vazkii.botania.common.item.ItemTwigWand;
public class HudRenderHandler {
@SubscribeEvent
public void onDrawScreenPost(RenderGameOverlayEvent.Post event) {
Minecraft mc = Minecraft.getMinecraft();
Profiler profiler = mc.mcProfiler;
ItemStack equippedStack = mc.thePlayer.getCurrentEquippedItem();
if (event.type == RenderGameOverlayEvent.ElementType.ALL) {
profiler.startSection("advabcedBotany-hud");
MovingObjectPosition pos = mc.objectMouseOver;
if (pos != null) {
Block block = mc.theWorld.getBlock(pos.blockX, pos.blockY, pos.blockZ);
TileEntity tile = mc.theWorld.getTileEntity(pos.blockX, pos.blockY, pos.blockZ);
boolean canRender = equippedStack != null && (equippedStack.getItem() instanceof ItemTwigWand || equippedStack.getItem() instanceof ItemLexicon);
if(tile != null && tile instanceof IRenderHud && !canRender) {
((IRenderHud)tile).renderHud(mc, event.resolution);
}
}
if(equippedStack != null && equippedStack.getItem() instanceof ItemBlackHalo) {
profiler.startSection("blackHalo");
ItemBlackHalo.renderHUD(event.resolution, mc.thePlayer, equippedStack);
profiler.endSection();
}
profiler.endStartSection("itemsRemainingAB");
ItemsRemainingRender.render(event.resolution, event.partialTicks);
profiler.endSection();
}
}
}
@@ -0,0 +1,63 @@
package ab.client.core.handler;
import org.lwjgl.opengl.GL11;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.ScaledResolution;
import net.minecraft.client.renderer.RenderHelper;
import net.minecraft.client.renderer.entity.RenderItem;
import net.minecraft.item.ItemStack;
public class ItemsRemainingRender {
private static int maxTicks = 30;
private static int leaveTicks = 20;
private static ItemStack stack;
private static int ticks;
private static String text;
@SideOnly(Side.CLIENT)
public static void render(ScaledResolution resolution, float partTicks) {
if(ticks > 0 && stack != null) {
int pos = maxTicks - ticks;
Minecraft mc = Minecraft.getMinecraft();
int x = resolution.getScaledWidth() / 2 + 10 + Math.max(0, pos - leaveTicks);
int y = resolution.getScaledHeight() / 2;
int start = maxTicks - leaveTicks;
float alpha = (ticks + partTicks > start) ? 1.0F : ((ticks + partTicks) / start);
GL11.glDisable(3008);
GL11.glEnable(3042);
GL11.glEnable(32826);
GL11.glBlendFunc(770, 771);
GL11.glColor4f(1.0F, 1.0F, 1.0F, alpha);
RenderHelper.enableGUIStandardItemLighting();
int xp = x + (int)(16.0F * (1.0F - alpha));
GL11.glTranslatef(xp, y, 0.0F);
GL11.glScalef(alpha, 1.0F, 1.0F);
RenderItem.getInstance().renderItemAndEffectIntoGUI(mc.fontRenderer, mc.renderEngine, stack, 0, 0);
GL11.glScalef(1.0F / alpha, 1.0F, 1.0F);
GL11.glTranslatef(-xp, -y, 0.0F);
RenderHelper.disableStandardItemLighting();
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
GL11.glEnable(3042);
int color = 0xFFFFFF | (int)(alpha * 255.0F) << 24;
mc.fontRenderer.drawStringWithShadow(text, x + 20, y + 6, color);
GL11.glDisable(3042);
GL11.glEnable(3008);
}
}
@SideOnly(Side.CLIENT)
public static void tick() {
if(ticks > 0)
ticks--;
}
public static void set(ItemStack stack, String text) {
ItemsRemainingRender.stack = stack;
ItemsRemainingRender.text = text;
ticks = (stack == null) ? 0 : maxTicks;
}
}
@@ -0,0 +1,83 @@
package ab.client.core.handler;
import java.util.ArrayList;
import java.util.List;
import net.minecraft.client.Minecraft;
import net.minecraft.client.audio.ISound;
import net.minecraft.client.audio.PositionedSoundRecord;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.util.ResourceLocation;
public class PlayerItemUsingSound {
public EntityPlayer player;
public ISound sound;
public int maxTick = 0;
public int tick = 0;
public boolean isDeadingSound = false;
public boolean hasCheckUse;
public PlayerItemUsingSound(EntityPlayer player, ISound sound, int maxTick, boolean hasCheckUse) {
this.player = player;
this.sound = sound;
this.maxTick = maxTick;
this.hasCheckUse = hasCheckUse;
}
public static class ClientSoundHandler {
public static Minecraft mc = Minecraft.getMinecraft();
public static List<PlayerItemUsingSound> soundsList = new ArrayList<PlayerItemUsingSound>();
public static void playSound(EntityPlayer player, String name, float volume, float pitch, int maxTick, boolean hasCheckUse) {
if(!soundsList.isEmpty())
for(int i = 0; i < soundsList.size(); i++) {
PlayerItemUsingSound playerSound = soundsList.get(i);
if(playerSound.player.getCommandSenderName().equals(player.getCommandSenderName())) {
if(playerSound.maxTick != 0 && playerSound.maxTick <= playerSound.tick && !playerSound.isDeadingSound) {
playerSound.isDeadingSound = true;
setSound(player, name, volume, pitch, maxTick, hasCheckUse);
return;
}
return;
} else
setSound(player, name, volume, pitch, maxTick, hasCheckUse);
}
else
setSound(player, name, volume, pitch, maxTick, hasCheckUse);
}
public static void playSound(EntityPlayer player, String name, float volume, float pitch, int maxTick) {
playSound(player, name, volume, pitch, maxTick, true);
}
public static void playSound(EntityPlayer player, String name, float volume, float pitch) {
playSound(player, name, volume, pitch, 0);
}
protected static void setSound(EntityPlayer player, String name, float volume, float pitch, int maxTick, boolean hasCheckUse) {
PositionedSoundRecord posSound = new PositionedSoundRecord(new ResourceLocation(name), volume, pitch, (float)player.posX, (float)player.posY, (float)player.posZ);
soundsList.add(new PlayerItemUsingSound(player, posSound, maxTick, hasCheckUse));
mc.getSoundHandler().playSound(posSound);
}
public static void tick() {
if(!soundsList.isEmpty()) {
for(int i = 0; i < soundsList.size(); i++) {
PlayerItemUsingSound playerSound = soundsList.get(i);
playerSound.tick++;
if(!mc.getSoundHandler().isSoundPlaying(playerSound.sound)) {
soundsList.remove(playerSound);
continue;
} else if(playerSound.hasCheckUse && !playerSound.player.isUsingItem()) {
if(mc.getSoundHandler().isSoundPlaying(playerSound.sound))
mc.getSoundHandler().stopSound(playerSound.sound);
soundsList.remove(playerSound);
continue;
}
}
}
}
}
}
@@ -0,0 +1,88 @@
package ab.client.core.handler;
import java.awt.Color;
import org.lwjgl.opengl.GL11;
import ab.client.core.ClientHelper;
import ab.common.item.equipment.armor.ItemNebulaArmor;
import ab.common.item.equipment.armor.ItemNebulaHelm;
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.ItemRenderer;
import net.minecraft.client.renderer.OpenGlHelper;
import net.minecraft.client.renderer.Tessellator;
import net.minecraft.client.renderer.texture.TextureMap;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraftforge.client.event.RenderPlayerEvent;
import vazkii.botania.api.item.IPhantomInkable;
import vazkii.botania.client.core.handler.ClientTickHandler;
public class PlayerRendererHandler {
@SubscribeEvent
public void onPlayerRender(RenderPlayerEvent.Specials.Post event) {
EntityPlayer player = event.entityPlayer;
ItemStack item = player.getCurrentArmor(3);
if(item != null && item.getItem() instanceof ItemNebulaHelm) {
Item helm = player.getCurrentArmor(3).getItem();
boolean hasPhantomInk = helm instanceof IPhantomInkable && ((IPhantomInkable)helm).hasPhantomInk(item);
if(!hasPhantomInk && ((ItemNebulaHelm)helm).enableCosmicFace(item)) {
float angelX = event.renderer.modelBipedMain.bipedHead.rotateAngleX * 180.0F / (float)Math.PI;
float angelY = event.renderer.modelBipedMain.bipedHead.rotateAngleY * 180.0F / (float)Math.PI;
GL11.glPushMatrix();
if(player.isSneaking())
GL11.glTranslatef(event.renderer.modelBipedMain.bipedHead.rotationPointX * 0.0625f, event.renderer.modelBipedMain.bipedHead.rotationPointY * 0.0625f, 0.0f);
GL11.glRotatef(angelY, 0.0F, 1.0F, 0.0F);
GL11.glRotatef(angelX, 1.0F, 0.0F, 0.0F);
renderCosmicFace();
GL11.glPopMatrix();
}
}
}
private void renderCosmicFace() {
double worldTime = ClientTickHandler.ticksInGame + ClientTickHandler.partialTicks;
GL11.glPushMatrix();
GL11.glEnable(GL11.GL_TEXTURE_2D);
GL11.glDisable(2884);
GL11.glPushMatrix();
GL11.glScalef(0.5f, 0.4f, 0.4f);
GL11.glRotatef(90.0f, 1.0f, 0.0f, 0.0f);
GL11.glTranslatef(-0.5f, -0.8675f, 0.0f);
GL11.glColor4f(1.0f, 1.0f, 1.0f, 1.0f);
boolean hasFog = GL11.glGetBoolean(2912);
if(hasFog)
GL11.glDisable(2912);
ClientHelper.renderCosmicBackground();
if(hasFog)
GL11.glEnable(2912);
GL11.glPopMatrix();
int light = 15728880;
int lightmapX = light % 65536;
int lightmapY = light / 65536;
GL11.glEnable(3042);
GL11.glBlendFunc(770, 771);
OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, lightmapX, lightmapY);
(Minecraft.getMinecraft()).renderEngine.bindTexture(TextureMap.locationItemsTexture);
GL11.glTranslatef(-0.2F, -0.35F, -0.25F);
GL11.glScalef(0.4f, 0.4f, 0.4f);
float f = ItemNebulaArmor.nebulaEyes.getMinU();
float f1 = ItemNebulaArmor.nebulaEyes.getMaxU();
float f2 = ItemNebulaArmor.nebulaEyes.getMinV();
float f3 = ItemNebulaArmor.nebulaEyes.getMaxV();
Color color = Color.getHSBColor((float)Minecraft.getSystemTime() / 20.0F % 360.0F / 360.0F, 1.0F, 1.0F);
float r = color.getRed() / 510.0F;
float g = color.getGreen() / 510.0F;
float b = color.getBlue() / 510.0F;
GL11.glColor4f(0.5f + r, 0.5f + g, 0.5f + b, 0.685f + (float)Math.sin(worldTime / 50.0D) * 0.175F);
ItemRenderer.renderItemIn2D(Tessellator.instance, f1, f2, f, f3, ItemNebulaArmor.nebulaEyes.getIconWidth(), ItemNebulaArmor.nebulaEyes.getIconHeight(), 0.03125F);
GL11.glDisable(3042);
GL11.glEnable(32826);
GL11.glPopMatrix();
}
}
@@ -0,0 +1,88 @@
package ab.client.core.proxy;
import ab.client.core.handler.BoundRenderHandler;
import ab.client.core.handler.ClientHandler;
import ab.client.core.handler.HudRenderHandler;
import ab.client.core.handler.PlayerRendererHandler;
import ab.client.render.block.*;
import ab.client.render.entity.*;
import ab.client.render.item.RenderItemAntigravityCharm;
import ab.client.render.item.RenderItemSphereNavigation;
import ab.client.render.tile.*;
import ab.common.block.tile.*;
import ab.common.core.handler.ConfigABHandler;
import ab.common.core.proxy.CommonProxy;
import ab.common.entity.*;
import ab.common.lib.register.BlockListAB;
import ab.common.lib.register.ItemListAB;
import cpw.mods.fml.client.registry.ClientRegistry;
import cpw.mods.fml.client.registry.RenderingRegistry;
import cpw.mods.fml.common.FMLCommonHandler;
import cpw.mods.fml.common.event.FMLInitializationEvent;
import cpw.mods.fml.common.event.FMLPostInitializationEvent;
import cpw.mods.fml.common.event.FMLPreInitializationEvent;
import net.minecraft.client.renderer.entity.Render;
import net.minecraft.client.renderer.entity.RenderSnowball;
import net.minecraft.item.ItemStack;
import net.minecraftforge.client.MinecraftForgeClient;
import net.minecraftforge.common.MinecraftForge;
import vazkii.botania.common.Botania;
import vazkii.botania.common.item.ModItems;
public class ClientProxy extends CommonProxy {
public void preInit(FMLPreInitializationEvent event) {
super.preInit(event);
}
public void init(FMLInitializationEvent event) {
super.init(event);
FMLCommonHandler.instance().bus().register(new ClientHandler());
MinecraftForge.EVENT_BUS.register(new HudRenderHandler());
MinecraftForge.EVENT_BUS.register(new PlayerRendererHandler());
MinecraftForge.EVENT_BUS.register(new BoundRenderHandler());
ClientRegistry.bindTileEntitySpecialRenderer(TileNidavellirForge.class, new RenderTileNidavellirForge());
ClientRegistry.bindTileEntitySpecialRenderer(TileABSpreader.class, new RenderTileABSpreader());
ClientRegistry.bindTileEntitySpecialRenderer(TileManaContainer.class, new RenderTileManaContainer());
ClientRegistry.bindTileEntitySpecialRenderer(TileManaCrystalCube.class, new RenderTileManaCrystalCube());
if(ConfigABHandler.hasManaCharger)
ClientRegistry.bindTileEntitySpecialRenderer(TileManaCharger.class, new RenderTileManaCharger());
ClientRegistry.bindTileEntitySpecialRenderer(TileEngineerHopper.class, new RenderTileEngineerHopper());
ClientRegistry.bindTileEntitySpecialRenderer(TileBoardFate.class, new RenderTileBoardFate());
ClientRegistry.bindTileEntitySpecialRenderer(TileGameBoard.class, new RenderTileGameBoard());
if(Botania.thaumcraftLoaded && ConfigABHandler.hasAutoThaum)
ClientRegistry.bindTileEntitySpecialRenderer(TileMagicCraftCrate.class, new RenderTileMagicCraftingCrate());
BlockListAB.blockABSpreaderRI = RenderingRegistry.getNextAvailableRenderId();
BlockListAB.blockManaContainerRI = RenderingRegistry.getNextAvailableRenderId();
BlockListAB.blockManaCrystalCubeRI = RenderingRegistry.getNextAvailableRenderId();
BlockListAB.blockManaChargerRI = RenderingRegistry.getNextAvailableRenderId();
BlockListAB.blockEngineerHopperRI = RenderingRegistry.getNextAvailableRenderId();
BlockListAB.blockABPlateRI = RenderingRegistry.getNextAvailableRenderId();
RenderingRegistry.registerBlockHandler(new RenderBlockABSpreader());
RenderingRegistry.registerBlockHandler(new RenderBlockManaContainer());
RenderingRegistry.registerBlockHandler(new RenderBlockManaCrystalCube());
RenderingRegistry.registerBlockHandler(new RenderBlockManaCharger());
RenderingRegistry.registerBlockHandler(new RenderBlockEngineerHopper());
RenderingRegistry.registerBlockHandler(new RenderBlockNidavellirForge());
RenderingRegistry.registerEntityRenderingHandler(EntityAdvancedSpark.class, new RenderEntityAdvancedSpark());
RenderingRegistry.registerEntityRenderingHandler(EntityNebulaBlaze.class, new EntityNullRender());
RenderingRegistry.registerEntityRenderingHandler(EntityManaVine.class, new EntityNullRender());
RenderingRegistry.registerEntityRenderingHandler(EntityAlphirinePortal.class, new RenderEntityAlphirinePortal());
RenderingRegistry.registerEntityRenderingHandler(EntitySword.class, new EntityNullRender());
RenderingRegistry.registerEntityRenderingHandler(EntitySeed.class, new EntityNullRender());
MinecraftForgeClient.registerItemRenderer(ItemListAB.itemAntigravityCharm, new RenderItemAntigravityCharm());
MinecraftForgeClient.registerItemRenderer(ItemListAB.itemSphereNavigation, new RenderItemSphereNavigation());
}
public void postInit(FMLPostInitializationEvent event) {
super.postInit(event);
// ItemStack crashGameForRender = null;
// System.out.println(crashGameForRender.stackSize);
}
}
@@ -0,0 +1,79 @@
package ab.client.gui;
import ab.common.item.relic.ItemTalismanHiddenRiches;
import ab.common.lib.register.ItemListAB;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.inventory.Container;
import net.minecraft.inventory.Slot;
import net.minecraft.item.ItemStack;
import vazkii.botania.client.gui.SlotLocked;
public class ContainerItemChest extends Container {
public InventoryItemChest itemChestInv;
private int numRows;
public ContainerItemChest(EntityPlayer player) {
int slot = player.inventory.currentItem;
InventoryPlayer inventoryPlayer = player.inventory;
this.itemChestInv = new InventoryItemChest(player, slot, ItemTalismanHiddenRiches.getOpenChest(player.getHeldItem()));
this.numRows = itemChestInv.getSizeInventory() / 9;
int i, j, k;
for(j = 0; j < this.numRows; ++j) {
for(k = 0; k < 9; ++k) {
this.addSlotToContainer(new SlotItemChest(itemChestInv, k + j * 9, 8 + k * 18, 18 + j * 18, k));
}
}
for(i = 0; i < 3; i++) {
for (j = 0; j < 9; j++)
addSlotToContainer(new Slot(inventoryPlayer, j + i * 9 + 9, 8 + j * 18, 85 + i * 18));
}
for(i = 0; i < 9; i++) {
if(player.inventory.currentItem == i) {
addSlotToContainer(new SlotLocked(inventoryPlayer, i, 8 + i * 18, 143));
} else {
addSlotToContainer(new Slot(inventoryPlayer, i, 8 + i * 18, 143));
}
}
}
public boolean canInteractWith(EntityPlayer player) {
boolean can = this.itemChestInv.isUseableByPlayer(player);
if(!can)
onContainerClosed(player);
return can;
}
public void onContainerClosed(EntityPlayer player) {
super.onContainerClosed(player);
this.itemChestInv.pushInventory();
}
public ItemStack transferStackInSlot(EntityPlayer player, int i) {
ItemStack itemstack = null;
Slot slot = (Slot)this.inventorySlots.get(i);
if(slot != null && slot.getHasStack()) {
ItemStack stack = slot.getStack();
itemstack = stack.copy();
if(!itemChestInv.isRelicTalisman(stack)) {
if(i < itemChestInv.getSizeInventory()) {
if(!this.mergeItemStack(stack, itemChestInv.getSizeInventory(), inventorySlots.size(), true)) {
return null;
}
}
else if(!this.mergeItemStack(stack, 0, itemChestInv.getSizeInventory(), false)) {
return null;
}
} else {
return null;
}
if(stack.stackSize == 0) {
slot.putStack((ItemStack)null);
} else {
slot.onSlotChanged();
}
}
return itemstack;
}
}
@@ -0,0 +1,40 @@
package ab.client.gui;
import org.lwjgl.opengl.GL11;
import net.minecraft.client.gui.inventory.GuiContainer;
import net.minecraft.client.resources.I18n;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.util.ResourceLocation;
public class GuiItemChest extends GuiContainer {
private static final ResourceLocation field_147017_u = new ResourceLocation("textures/gui/container/generic_54.png");
private int inventoryRows;
public GuiItemChest(EntityPlayer player) {
super(new ContainerItemChest(player));
short short1 = 222;
int i = short1 - 108;
this.inventoryRows = ((ContainerItemChest)this.inventorySlots).itemChestInv.getSizeInventory() / 9;
this.ySize = i + this.inventoryRows * 18;
}
protected boolean checkHotbarKeys(int p_146983_1_) {
return false;
}
protected void drawGuiContainerForegroundLayer(int p_146979_1_, int p_146979_2_) {
this.fontRendererObj.drawString(I18n.format("container.chest", new Object[0]), 8, 6, 4210752);
this.fontRendererObj.drawString(I18n.format("container.inventory", new Object[0]), 8, this.ySize - 96 + 2, 4210752);
}
protected void drawGuiContainerBackgroundLayer(float p_146976_1_, int p_146976_2_, int p_146976_3_) {
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
this.mc.getTextureManager().bindTexture(field_147017_u);
int k = (this.width - this.xSize) / 2;
int l = (this.height - this.ySize) / 2;
this.drawTexturedModalRect(k, l, 0, 0, this.xSize, this.inventoryRows * 18 + 17);
this.drawTexturedModalRect(k, l + this.inventoryRows * 18 + 17, 0, 126, this.xSize, 96);
}
}
@@ -0,0 +1,118 @@
package ab.client.gui;
import ab.common.item.relic.ItemTalismanHiddenRiches;
import ab.common.lib.register.ItemListAB;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.inventory.IInventory;
import net.minecraft.item.ItemStack;
public class InventoryItemChest implements IInventory {
EntityPlayer player;
int slot;
ItemStack[] stacks = null;
boolean invPushed = false;
ItemStack storedInv = null;
int openChest;
public InventoryItemChest(EntityPlayer player, int slot, int openChest) {
this.player = player;
this.slot = slot;
this.openChest = openChest;
}
public static boolean isRelicTalisman(ItemStack stack) {
return (stack != null && stack.getItem() == ItemListAB.itemTalismanHiddenRiches);
}
protected ItemStack getStack() {
ItemStack stack = this.player.inventory.getStackInSlot(this.slot);
if(stack != null)
this.storedInv = stack;
return stack;
}
protected ItemStack[] getInventory() {
if(this.stacks != null)
return this.stacks;
ItemStack stack = getStack();
if(isRelicTalisman(getStack())) {
this.stacks = ItemTalismanHiddenRiches.getChestLoot(stack, openChest);
return this.stacks;
}
return new ItemStack[getSizeInventory()];
}
public void pushInventory() {
if(this.invPushed)
return;
ItemStack stack = getStack();
if(stack == null)
stack = this.storedInv;
if(stack != null) {
ItemStack[] inv = getInventory();
ItemTalismanHiddenRiches.setChestLoot(stack, inv, openChest);
ItemTalismanHiddenRiches.setOpenChest(stack, -1);
}
this.invPushed = true;
}
public int getSizeInventory() {
return 27;
}
public ItemStack getStackInSlot(int i) {
return getInventory()[i];
}
public ItemStack decrStackSize(int i, int j) {
ItemStack[] inventorySlots = getInventory();
if(inventorySlots[i] != null) {
if((inventorySlots[i]).stackSize <= j) {
ItemStack itemStack = inventorySlots[i];
inventorySlots[i] = null;
return itemStack;
}
ItemStack stackAt = inventorySlots[i].splitStack(j);
if((inventorySlots[i]).stackSize == 0)
inventorySlots[i] = null;
return stackAt;
}
return null;
}
public ItemStack getStackInSlotOnClosing(int i) {
return getStackInSlot(i);
}
public void setInventorySlotContents(int i, ItemStack itemstack) {
ItemStack[] inventorySlots = getInventory();
inventorySlots[i] = itemstack;
}
public int getInventoryStackLimit() {
return isRelicTalisman(getStack()) ? 64 : 0;
}
public boolean isUseableByPlayer(EntityPlayer entityplayer) {
return isRelicTalisman(getStack());
}
public boolean isItemValidForSlot(int i, ItemStack itemstack) {
return isRelicTalisman(getStack());
}
public boolean hasCustomInventoryName() {
return false;
}
public void openInventory() {}
public void closeInventory() {}
public String getInventoryName() {
return "itemChestTalisman";
}
public void markDirty() {}
}
@@ -0,0 +1,24 @@
package ab.client.gui;
import net.minecraft.inventory.Slot;
import net.minecraft.item.ItemStack;
public class SlotItemChest extends Slot {
InventoryItemChest itemChestInv;
int slot;
public SlotItemChest(InventoryItemChest inv, int index, int x, int y, int slot) {
super(inv, index, x, y);
this.itemChestInv = inv;
this.slot = slot;
}
public void onSlotChange(ItemStack oldStack, ItemStack newStack) {
itemChestInv.setInventorySlotContents(slot, newStack);
}
public boolean isItemValid(ItemStack stack) {
return !itemChestInv.isRelicTalisman(stack);
}
}
@@ -0,0 +1,36 @@
package ab.client.model;
import net.minecraft.client.model.ModelBase;
import net.minecraft.client.model.ModelBox;
import net.minecraft.client.model.ModelRenderer;
public class ModelDiceFate extends ModelBase {
private final ModelRenderer bb_main;
public ModelDiceFate() {
textureWidth = 48;
textureHeight = 48;
bb_main = new ModelRenderer(this);
bb_main.setRotationPoint(0.0F, 18.0F, 0.0F);
bb_main.cubeList.add(new ModelBox(bb_main, 0, 24, -6.0F, -6.0F, -6.0F, 12, 12, 12, 0.0F));
bb_main.cubeList.add(new ModelBox(bb_main, 0, 0, -6.0F, -6.0F, -6.0F, 12, 12, 12, 0.0F));
}
public void render(float rotX, float rotY, float rotZ) {
setRotationAngle(bb_main, getAngel(rotX), getAngel(rotY), getAngel(rotZ));
bb_main.render(0.0625f);
}
private float getAngel(float rot) {
return rot / 180.0F * (float)Math.PI;
}
public void setRotationAngle(ModelRenderer modelRenderer, float x, float y, float z) {
modelRenderer.rotateAngleX = x;
modelRenderer.rotateAngleY = y;
modelRenderer.rotateAngleZ = z;
}
}
@@ -0,0 +1,64 @@
package ab.client.model;
import org.lwjgl.opengl.GL11;
import net.minecraft.client.model.ModelBase;
import net.minecraft.client.model.ModelBox;
import net.minecraft.client.model.ModelRenderer;
public class ModelEngineerHopper extends ModelBase {
private final ModelRenderer hopperBase;
private final ModelRenderer hopperTop;
private final ModelRenderer hopperBottom;
public ModelEngineerHopper() {
textureWidth = 64;
textureHeight = 64;
hopperBase = new ModelRenderer(this);
hopperBase.setRotationPoint(0.0F, 24.0F, 0.0F);
hopperBase.cubeList.add(new ModelBox(hopperBase, 0, 45, -7.0F, -16.0F, -7.0F, 2, 5, 14, 0.0F));
hopperBase.cubeList.add(new ModelBox(hopperBase, 12, 27, -5.0F, -11.2F, -5.0F, 10, 3, 10, 0.0F));
hopperBase.cubeList.add(new ModelBox(hopperBase, 0, 38, -6.0F, -11.0F, -2.0F, 2, 5, 4, 0.0F));
hopperBase.cubeList.add(new ModelBox(hopperBase, 52, 38, 4.0F, -11.0F, -2.0F, 2, 5, 4, 0.0F));
hopperBase.cubeList.add(new ModelBox(hopperBase, 0, 49, -2.0F, -11.0F, -6.0F, 4, 5, 2, 0.0F));
hopperBase.cubeList.add(new ModelBox(hopperBase, 52, 49, -2.0F, -11.0F, 4.0F, 4, 5, 2, 0.0F));
hopperBase.cubeList.add(new ModelBox(hopperBase, 32, 45, 5.0F, -16.0F, -7.0F, 2, 5, 14, 0.0F));
hopperBase.cubeList.add(new ModelBox(hopperBase, 20, 50, -5.0F, -16.0F, 5.0F, 10, 5, 2, 0.0F));
hopperBase.cubeList.add(new ModelBox(hopperBase, 20, 42, -5.0F, -16.0F, -7.0F, 10, 5, 2, 0.0F));
hopperTop = new ModelRenderer(this);
hopperTop.setRotationPoint(0.0F, 24.0F, 0.0F);
hopperTop.cubeList.add(new ModelBox(hopperTop, 20, 13, -3.0F, -20.0F, -3.0F, 6, 6, 6, 0.0F));
hopperBottom = new ModelRenderer(this);
hopperBottom.setRotationPoint(0.0F, 24.0F, 0.0F);
hopperBottom.cubeList.add(new ModelBox(hopperBottom, 24, 3, -2.0F, -5.0F, -2.0F, 4, 4, 4, 0.0F));
}
public void renderHoper(double time) {
float offset = (float)Math.sin(time / 10.0D) * 0.05F + 0.01F;
hopperBase.render(0.0625f);
GL11.glEnable(3042);
GL11.glBlendFunc(770, 771);
GL11.glPushMatrix();
GL11.glTranslatef(0.0f, offset, 0.0f);
GL11.glColor4f(1.0F, 1.0F, 1.0F, 0.6F);
hopperTop.render(0.0625f);
GL11.glPopMatrix();
GL11.glPushMatrix();
GL11.glTranslatef(0.0f, -offset, 0.0f);
GL11.glColor4f(1.0F, 1.0F, 1.0F, 0.6F);
hopperBottom.render(0.0625f);
GL11.glPopMatrix();
}
public void setRotationAngle(ModelRenderer modelRenderer, float x, float y, float z) {
modelRenderer.rotateAngleX = x;
modelRenderer.rotateAngleY = y;
modelRenderer.rotateAngleZ = z;
}
}
@@ -0,0 +1,120 @@
package ab.client.model;
import java.util.Random;
import org.lwjgl.opengl.GL11;
import ab.client.render.tile.RenderTileManaCharger;
import ab.common.block.tile.TileManaCharger;
import net.minecraft.client.model.ModelBase;
import net.minecraft.client.model.ModelBox;
import net.minecraft.client.model.ModelRenderer;
import net.minecraft.item.ItemStack;
import vazkii.botania.api.mana.IManaItem;
import vazkii.botania.client.core.handler.LightningHandler;
import vazkii.botania.common.Botania;
import vazkii.botania.common.core.helper.Vector3;
public class ModelManaCharger extends ModelBase {
private final ModelRenderer chargerBase;
private final ModelRenderer chargerPlate;
public ModelManaCharger() {
textureWidth = 32;
textureHeight = 32;
chargerBase = new ModelRenderer(this);
chargerBase.setRotationPoint(0.0F, 24.0F, 0.0F);
chargerBase.cubeList.add(new ModelBox(chargerBase, 0, 9, -2.5F, -9.0F, -2.5F, 5, 4, 5, 0.0F));
chargerBase.cubeList.add(new ModelBox(chargerBase, 0, 0, -3.5F, -11.0F, -3.5F, 7, 2, 7, 0.0F));
chargerBase.cubeList.add(new ModelBox(chargerBase, 20, 9, -1.5F, -5.0F, -1.5F, 3, 3, 3, 0.0F));
chargerPlate = new ModelRenderer(this);
chargerPlate.setRotationPoint(0.0F, 17.0F, 0.0F);
chargerPlate.cubeList.add(new ModelBox(chargerPlate, 0, 18, 5.0F, 0.0F, -2.0F, 4, 1, 4, 0.0F));
}
public void render(RenderTileManaCharger render, double time) {
TileManaCharger tile = render.charger;
float offset = (float)Math.sin(time / 40.0D) * 0.1F + 0.05F;
float polerot = -((float)time / 16.0F) * 25.0F;
GL11.glPushMatrix();
GL11.glTranslatef(0.0F, offset, 0.0F);
GL11.glRotatef(polerot, 0.0F, 1.0F, 0.0F);
chargerBase.render(0.0625f);
if (tile.getStackInSlot(0) != null) {
float rot = this.chargerPlate.rotateAngleY * 180.0F / (float)Math.PI;
GL11.glRotatef(rot, 0.0F, 1.0F, 0.0F);
GL11.glTranslatef(-0.125F, 0.8125F, 0.125F);
GL11.glRotatef(-90.0F, 1.0F, 0.0F, 0.0F);
render.renderItemStack(tile.getStackInSlot(0));
}
GL11.glPopMatrix();
GL11.glPushMatrix();
GL11.glTranslatef(0.0F, offset / 1.3f + 0.185f, 0.0F);
GL11.glScalef(0.85f, 0.85f, 0.85f);
for (int i = 1; i < 5; i++) {
switch(i) {
case 1: chargerPlate.rotateAngleY = 3.1416F;
break;
case 2: chargerPlate.rotateAngleY = 0;
break;
case 3: chargerPlate.rotateAngleY = 1.5708F;
break;
case 4: chargerPlate.rotateAngleY = -1.5708F;
break;
}
if(tile.getWorldObj() != null)
time += i * 36.0f;
float offset1 = (float)Math.sin(time / 15.0D) * 0.1F - 0.1F;
if(time == -1.0D)
offset1 = 0.0F;
ItemStack stack = tile.getStackInSlot(i);
GL11.glTranslatef(0.0F, -offset1, 0.0F);
if(stack != null) {
GL11.glPushMatrix();
float manaPercent = TileManaCharger.getManaPercent(stack);
float rot = this.chargerPlate.rotateAngleY * 180.0F / (float)Math.PI;
if(manaPercent < 100.0f) {
float chargeY = (offset1 + (offset1 / 2.4f)) * ((100.0f - manaPercent) / 150.0f);
GL11.glTranslatef(0.0F, chargeY, 0.0F);
if(tile.clientTick[i] > 12) {
float posX = 0;
float posZ = 0;
switch(i) {
case 1: posX = 0.0f; posZ = -0.375f;
break;
case 2: posX = 0.0f; posZ = 0.375f;
break;
case 3: posX = -0.375f; posZ = 0.0f;
break;
case 4: posX = 0.375f; posZ = 0.0f;
break;
}
Vector3 itemVec = Vector3.fromTileEntity(render.charger).add(0.5D + posX + ((Math.random() / 8) - 0.0625f), 0.67D + offset1, 0.5D + posZ + ((Math.random() / 8) - 0.0625f));
Vector3 tileVec = Vector3.fromTileEntity(render.charger).add(0.5D + posX, 0.7425D + offset1 - (chargeY / 2), 0.5D + posZ);
LightningHandler.spawnLightningBolt(render.charger.getWorldObj(), itemVec, tileVec, 10.0F, render.charger.getWorldObj().rand.nextLong(), 1140881820, 1140901631);
render.charger.clientTick[i] = 0;
}
}
GL11.glRotatef(rot, 0.0F, 1.0F, 0.0F);
GL11.glTranslatef(0.3125F, 1.06F, 0.1245F);
GL11.glRotatef(-90.0F, 1.0F, 0.0F, 0.0F);
render.renderItemStack(stack);
GL11.glPopMatrix();
}
chargerPlate.render(0.0625f);
GL11.glTranslatef(0.0F, offset1, 0.0F);
}
GL11.glPopMatrix();
}
public void setRotationAngle(ModelRenderer modelRenderer, float x, float y, float z) {
modelRenderer.rotateAngleX = x;
modelRenderer.rotateAngleY = y;
modelRenderer.rotateAngleZ = z;
}
}
@@ -0,0 +1,46 @@
package ab.client.model;
import net.minecraft.client.model.ModelBase;
import net.minecraft.client.model.ModelBox;
import net.minecraft.client.model.ModelRenderer;
public class ModelManaContainer extends ModelBase {
private final ModelRenderer bb_main;
public ModelManaContainer() {
textureWidth = 64;
textureHeight = 64;
bb_main = new ModelRenderer(this);
bb_main.setRotationPoint(0.0F, 24.0F, 0.0F);
bb_main.cubeList.add(new ModelBox(bb_main, 6, 14, -7.0F, -15.0F, -7.0F, 14, 5, 3, 0.0F));
bb_main.cubeList.add(new ModelBox(bb_main, 24, 0, -5.0F, -10.2F, -5.0F, 10, 4, 10, 0.0F));
bb_main.cubeList.add(new ModelBox(bb_main, 49, 37, -6.0F, -10.0F, -2.0F, 2, 6, 4, 0.0F));
bb_main.cubeList.add(new ModelBox(bb_main, 50, 26, 4.0F, -10.0F, -2.0F, 2, 6, 4, 0.0F));
bb_main.cubeList.add(new ModelBox(bb_main, 13, 23, -2.0F, -10.0F, -6.0F, 4, 6, 2, 0.0F));
bb_main.cubeList.add(new ModelBox(bb_main, 0, 23, -2.0F, -10.0F, 4.0F, 4, 6, 2, 0.0F));
bb_main.cubeList.add(new ModelBox(bb_main, 27, 23, -5.0F, -18.0F, -5.0F, 1, 3, 10, 0.0F));
bb_main.cubeList.add(new ModelBox(bb_main, 40, 14, -3.0F, -6.2F, -3.0F, 6, 5, 6, 0.0F));
bb_main.cubeList.add(new ModelBox(bb_main, 55, 0, -6.0F, -17.0F, -6.0F, 2, 2, 2, 0.0F));
bb_main.cubeList.add(new ModelBox(bb_main, 28, 28, 4.0F, -17.0F, -6.0F, 2, 2, 2, 0.0F));
bb_main.cubeList.add(new ModelBox(bb_main, 55, 5, 4.0F, -17.0F, 4.0F, 2, 2, 2, 0.0F));
bb_main.cubeList.add(new ModelBox(bb_main, 28, 23, -6.0F, -17.0F, 4.0F, 2, 2, 2, 0.0F));
bb_main.cubeList.add(new ModelBox(bb_main, 1, 0, 4.0F, -18.0F, -5.0F, 1, 3, 10, 0.0F));
bb_main.cubeList.add(new ModelBox(bb_main, 16, 5, -4.0F, -18.0F, 4.0F, 8, 3, 1, 0.0F));
bb_main.cubeList.add(new ModelBox(bb_main, 16, 0, -4.0F, -18.0F, -5.0F, 8, 3, 1, 0.0F));
bb_main.cubeList.add(new ModelBox(bb_main, 14, 38, -7.0F, -15.0F, 4.0F, 14, 5, 3, 0.0F));
bb_main.cubeList.add(new ModelBox(bb_main, 41, 48, 4.0F, -15.0F, -4.0F, 3, 5, 8, 0.0F));
bb_main.cubeList.add(new ModelBox(bb_main, 18, 48, -7.0F, -15.0F, -4.0F, 3, 5, 8, 0.0F));
}
public void render() {
bb_main.render(0.0625f);
}
public void setRotationAngle(ModelRenderer modelRenderer, float x, float y, float z) {
modelRenderer.rotateAngleX = x;
modelRenderer.rotateAngleY = y;
modelRenderer.rotateAngleZ = z;
}
}
@@ -0,0 +1,47 @@
package ab.client.model;
import net.minecraft.client.model.ModelBase;
import net.minecraft.client.model.ModelBox;
import net.minecraft.client.model.ModelRenderer;
public class ModelNidavellirForge extends ModelBase {
private final ModelRenderer bottomAnvil;
private final ModelRenderer topAnvil;
public ModelNidavellirForge() {
textureWidth = 48;
textureHeight = 48;
bottomAnvil = new ModelRenderer(this);
bottomAnvil.setRotationPoint(0.0F, 24.0F, 0.0F);
bottomAnvil.cubeList.add(new ModelBox(bottomAnvil, 32, 26, -3.0F, -1.0F, -4.0F, 6, 1, 1, 0.0F));
bottomAnvil.cubeList.add(new ModelBox(bottomAnvil, 0, 31, -5.0F, -1.0F, -3.0F, 12, 1, 6, 0.0F));
bottomAnvil.cubeList.add(new ModelBox(bottomAnvil, 32, 17, -2.0F, -3.0F, -2.0F, 4, 1, 4, 0.0F));
bottomAnvil.cubeList.add(new ModelBox(bottomAnvil, 0, 8, -4.0F, -2.0F, -3.0F, 8, 1, 6, 0.0F));
bottomAnvil.cubeList.add(new ModelBox(bottomAnvil, 32, 23, -3.0F, -1.0F, 3.0F, 6, 1, 1, 0.0F));
topAnvil = new ModelRenderer(this);
topAnvil.setRotationPoint(0.0F, 26.0F, 0.0F);
topAnvil.cubeList.add(new ModelBox(topAnvil, 0, 23, -6.5F, -11.0F, -3.0F, 12, 2, 6, 0.0F));
topAnvil.cubeList.add(new ModelBox(topAnvil, 0, 38, -5.5F, -12.0F, -4.0F, 13, 2, 8, 0.0F));
topAnvil.cubeList.add(new ModelBox(topAnvil, 0, 15, -5.5F, -9.0F, -3.0F, 9, 2, 6, 0.0F));
topAnvil.cubeList.add(new ModelBox(topAnvil, 17, 0, -4.5F, -11.0F, 2.5F, 7, 3, 1, 0.0F));
topAnvil.cubeList.add(new ModelBox(topAnvil, 0, 0, -4.5F, -11.0F, -3.5F, 7, 3, 1, 0.0F));
topAnvil.cubeList.add(new ModelBox(topAnvil, 30, 12, -2.5F, -7.0F, -2.0F, 5, 1, 4, 0.0F));
}
public void renderBottom() {
bottomAnvil.render(0.0625f);
}
public void renderTop() {
topAnvil.render(0.0625f);
}
public void setRotationAngle(ModelRenderer modelRenderer, float x, float y, float z) {
modelRenderer.rotateAngleX = x;
modelRenderer.rotateAngleY = y;
modelRenderer.rotateAngleZ = z;
}
}
@@ -0,0 +1,408 @@
package ab.client.model.armor;
import java.awt.Color;
import org.lwjgl.opengl.GL11;
import ab.client.core.ClientHelper;
import net.minecraft.client.Minecraft;
import net.minecraft.client.model.ModelBiped;
import net.minecraft.client.model.ModelBox;
import net.minecraft.client.model.ModelRenderer;
import net.minecraft.client.renderer.OpenGlHelper;
import net.minecraft.client.renderer.tileentity.TileEntityRendererDispatcher;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.EnumAction;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.MathHelper;
import net.minecraft.util.ResourceLocation;
import vazkii.botania.client.core.handler.ClientTickHandler;
public class ModelArmorNebula extends ModelBiped {
private final ModelRenderer head;
private final ModelRenderer cube_r1;
private final ModelRenderer cube_r2;
private final ModelRenderer cube_r3;
private final ModelRenderer cube_r12;
private final ModelRenderer cube_r13;
private final ModelRenderer cube_r14;
private final ModelRenderer cube_r15;
private final ModelRenderer chestplate;
private final ModelRenderer cube_r16;
private final ModelRenderer cube_r4;
private final ModelRenderer cube_r4_r1;
private final ModelRenderer cube_r5;
private final ModelRenderer cube_r5_r1;
private final ModelRenderer cube_r6;
private final ModelRenderer cube_r7;
private final ModelRenderer cube_r7_r1;
private final ModelRenderer cube_r7_r2;
private final ModelRenderer lArm;
private final ModelRenderer cube_r17;
private final ModelRenderer cube_r8;
private final ModelRenderer cube_r9;
private final ModelRenderer rArm;
private final ModelRenderer cube_r18;
private final ModelRenderer cube_r10;
private final ModelRenderer cube_r11;
private final ModelRenderer lLeg;
private final ModelRenderer cube_r19;
private final ModelRenderer cube_r20;
private final ModelRenderer cube_r21;
private final ModelRenderer rLeg;
private final ModelRenderer cube_r22;
private final ModelRenderer cube_r23;
private final ModelRenderer cube_r24;
private final ModelRenderer lBoot;
private final ModelRenderer cube_r25;
private final ModelRenderer cube_r26;
private final ModelRenderer rBoot;
private final ModelRenderer cube_r27;
private final ModelRenderer cube_r28;
int slot;
public ModelArmorNebula(int slot) {
this.slot = slot;
textureWidth = 64;
textureHeight = 128;
head = new ModelRenderer(this);
head.setRotationPoint(0.0F, 0.0F, 0.0F);
head.cubeList.add(new ModelBox(head, 0, 66, -4.0F, -8.0F, -4.0F, 8, 2, 8, 0.21F));
head.cubeList.add(new ModelBox(head, 36, 90, -3.0F, -8.75F, -3.0F, 6, 1, 4, 0.21F));
head.cubeList.add(new ModelBox(head, 0, 90, -4.0F, -6.0F, -4.0F, 1, 3, 7, 0.2085F));
head.cubeList.add(new ModelBox(head, 19, 86, 3.0F, -6.0F, -4.0F, 1, 3, 7, 0.2085F));
head.cubeList.add(new ModelBox(head, 28, 80, -3.0F, -6.0F, -4.0F, 6, 1, 1, 0.2075F));
head.cubeList.add(new ModelBox(head, 23, 81, -4.0F, -6.0F, 3.0F, 1, 1, 1, 0.2075F));
head.cubeList.add(new ModelBox(head, 23, 78, 3.0F, -6.0F, 3.0F, 1, 1, 1, 0.2075F));
cube_r1 = new ModelRenderer(this);
cube_r1.setRotationPoint(0.0F, 0.0F, 0.3F);
head.addChild(cube_r1);
setRotationAngle(cube_r1, -0.1745F, -0.3491F, 0.0F);
cube_r1.cubeList.add(new ModelBox(cube_r1, 16, 78, 0.6F, -8.4F, -6.8F, 2, 3, 1, 0.21F));
cube_r2 = new ModelRenderer(this);
cube_r2.setRotationPoint(0.0F, 0.0F, 0.3F);
head.addChild(cube_r2);
setRotationAngle(cube_r2, -0.1745F, 0.3491F, 0.0F);
cube_r2.cubeList.add(new ModelBox(cube_r2, 9, 78, -2.6F, -8.4F, -6.8F, 2, 3, 1, 0.21F));
cube_r3 = new ModelRenderer(this);
cube_r3.setRotationPoint(0.0F, 0.0F, 0.0F);
head.addChild(cube_r3);
setRotationAngle(cube_r3, -0.2618F, 0.0F, 0.0F);
cube_r3.cubeList.add(new ModelBox(cube_r3, 5, 83, -1.0F, -9.0F, -2.5F, 2, 1, 5, 0.21F));
cube_r12 = new ModelRenderer(this);
cube_r12.setRotationPoint(0.0F, 0.0F, 0.0F);
head.addChild(cube_r12);
setRotationAngle(cube_r12, 0.7418F, 0.0F, -0.0873F);
cube_r12.cubeList.add(new ModelBox(cube_r12, 47, 83, -4.6F, -7.0F, 3.0F, 2, 2, 4, 0.21F));
cube_r13 = new ModelRenderer(this);
cube_r13.setRotationPoint(0.0F, 0.0F, 0.0F);
head.addChild(cube_r13);
setRotationAngle(cube_r13, 0.7418F, 0.0F, 0.0873F);
cube_r13.cubeList.add(new ModelBox(cube_r13, 45, 76, 2.6F, -7.0F, 3.0F, 2, 2, 4, 0.21F));
cube_r14 = new ModelRenderer(this);
cube_r14.setRotationPoint(0.0F, 0.0F, 0.0F);
head.addChild(cube_r14);
setRotationAngle(cube_r14, -0.0873F, 0.0F, 0.0F);
cube_r14.cubeList.add(new ModelBox(cube_r14, 31, 84, -1.0F, -5.0F, -4.6F, 2, 1, 1, 0.21F));
cube_r15 = new ModelRenderer(this);
cube_r15.setRotationPoint(0.0F, 0.0F, 0.0F);
head.addChild(cube_r15);
setRotationAngle(cube_r15, -0.48F, 0.0F, 0.0F);
cube_r15.cubeList.add(new ModelBox(cube_r15, 0, 78, -1.0F, -7.9F, -8.0F, 2, 4, 2, 0.21F));
chestplate = new ModelRenderer(this);
chestplate.setRotationPoint(0.0F, 0.0F, 0.0F);
chestplate.cubeList.add(new ModelBox(chestplate, 0, 0, -4.5F, -0.2F, -3.0F, 9, 11, 6, 0.0F));
chestplate.cubeList.add(new ModelBox(chestplate, 31, 10, -2.5F, 5.7F, 1.9F, 5, 4, 2, 0.0F));
chestplate.cubeList.add(new ModelBox(chestplate, 31, 0, -3.5F, -0.6F, 2.6F, 7, 7, 2, 0.0F));
cube_r16 = new ModelRenderer(this);
cube_r16.setRotationPoint(0.0F, 24.0F, -1.0F);
chestplate.addChild(cube_r16);
setRotationAngle(cube_r16, 0.1309F, 0.0F, 0.0F);
cube_r16.cubeList.add(new ModelBox(cube_r16, 57, 16, -1.0F, -20.7F, 7.7F, 2, 6, 1, 0.0F));
cube_r4 = new ModelRenderer(this);
cube_r4.setRotationPoint(-0.1F, 25.2F, 3.35F);
chestplate.addChild(cube_r4);
setRotationAngle(cube_r4, 0.2618F, 0.0F, 0.1745F);
cube_r4_r1 = new ModelRenderer(this);
cube_r4_r1.setRotationPoint(0.1F, -1.2F, -3.35F);
cube_r4.addChild(cube_r4_r1);
setRotationAngle(cube_r4_r1, -0.5236F, 0.0F, 0.0F);
cube_r4_r1.cubeList.add(new ModelBox(cube_r4_r1, 50, 8, -2.0F, -25.0F, -3.0F, 2, 5, 2, 0.0F));
cube_r5 = new ModelRenderer(this);
cube_r5.setRotationPoint(-0.1F, 25.2F, 3.35F);
chestplate.addChild(cube_r5);
setRotationAngle(cube_r5, 0.2618F, 0.0F, -0.1745F);
cube_r5_r1 = new ModelRenderer(this);
cube_r5_r1.setRotationPoint(0.1F, -1.2F, -3.35F);
cube_r5.addChild(cube_r5_r1);
setRotationAngle(cube_r5_r1, -0.5236F, 0.0F, 0.0F);
cube_r5_r1.cubeList.add(new ModelBox(cube_r5_r1, 50, 0, 0.0F, -25.0F, -3.0F, 2, 5, 2, 0.0F));
cube_r6 = new ModelRenderer(this);
cube_r6.setRotationPoint(0.0F, 24.0F, 0.0F);
chestplate.addChild(cube_r6);
setRotationAngle(cube_r6, -0.1745F, 0.0F, 0.0F);
cube_r7 = new ModelRenderer(this);
cube_r7.setRotationPoint(0.0F, 23.75F, 0.0F);
chestplate.addChild(cube_r7);
setRotationAngle(cube_r7, -0.0873F, 0.0F, 0.0F);
cube_r7_r1 = new ModelRenderer(this);
cube_r7_r1.setRotationPoint(0.0F, -0.3F, 0.0F);
cube_r7.addChild(cube_r7_r1);
setRotationAngle(cube_r7_r1, 0.2182F, 0.0F, 0.0F);
cube_r7_r1.cubeList.add(new ModelBox(cube_r7_r1, 34, 68, -1.5F, -23.1842F, -1.1615F, 3, 8, 2, 0.0F));
cube_r7_r2 = new ModelRenderer(this);
cube_r7_r2.setRotationPoint(0.0F, -0.3F, 0.0F);
cube_r7.addChild(cube_r7_r2);
setRotationAngle(cube_r7_r2, 0.2618F, 0.0F, 0.0F);
cube_r7_r2.cubeList.add(new ModelBox(cube_r7_r2, 34, 17, 1.5F, -21.1842F, -0.8615F, 2, 7, 2, 0.0F));
cube_r7_r2.cubeList.add(new ModelBox(cube_r7_r2, 54, 69, -3.5F, -21.1842F, -0.8615F, 2, 7, 2, 0.0F));
lArm = new ModelRenderer(this);
lArm.setRotationPoint(-5.0F, 2.0F, 0.0F);
lArm.cubeList.add(new ModelBox(lArm, 0, 27, -4.0F, -2.4F, -2.5F, 5, 5, 5, 0.05F));
lArm.cubeList.add(new ModelBox(lArm, 21, 27, -3.0F, 6.0F, -2.0F, 4, 4, 4, 0.2F));
cube_r17 = new ModelRenderer(this);
cube_r17.setRotationPoint(0.0F, -3.5F, 0.0F);
lArm.addChild(cube_r17);
setRotationAngle(cube_r17, 0.8727F, 0.0F, 0.0F);
cube_r17.cubeList.add(new ModelBox(cube_r17, 45, 63, -1.7F, 1.3F, -2.3F, 2, 1, 4, 0.0F));
cube_r8 = new ModelRenderer(this);
cube_r8.setRotationPoint(5.2F, 22.3F, 0.0F);
lArm.addChild(cube_r8);
setRotationAngle(cube_r8, 0.0F, 0.0F, 0.2182F);
cube_r8.cubeList.add(new ModelBox(cube_r8, 54, 25, -14.0918F, -24.4119F, -1.0F, 2, 3, 2, 0.0F));
cube_r9 = new ModelRenderer(this);
cube_r9.setRotationPoint(5.2F, 22.3F, 0.0F);
lArm.addChild(cube_r9);
setRotationAngle(cube_r9, 0.0F, 0.0F, 0.0873F);
cube_r9.cubeList.add(new ModelBox(cube_r9, 16, 19, -11.8564F, -24.7019F, -2.0F, 4, 3, 4, 0.0F));
rArm = new ModelRenderer(this);
rArm.setRotationPoint(5.0F, 2.0F, 0.0F);
rArm.cubeList.add(new ModelBox(rArm, 38, 26, -1.0F, -2.4F, -2.5F, 5, 5, 5, 0.05F));
rArm.cubeList.add(new ModelBox(rArm, 0, 38, -1.0F, 6.0F, -2.0F, 4, 4, 4, 0.2F));
cube_r18 = new ModelRenderer(this);
cube_r18.setRotationPoint(-10.0F, -3.5F, 0.0F);
rArm.addChild(cube_r18);
setRotationAngle(cube_r18, 0.8727F, 0.0F, 0.0F);
cube_r18.cubeList.add(new ModelBox(cube_r18, 45, 63, 9.7F, 1.3F, -2.3F, 2, 1, 4, 0.0F));
cube_r10 = new ModelRenderer(this);
cube_r10.setRotationPoint(-4.8F, 22.3F, 0.0F);
rArm.addChild(cube_r10);
setRotationAngle(cube_r10, 0.0F, 0.0F, -0.2182F);
cube_r10.cubeList.add(new ModelBox(cube_r10, 19, 36, 11.6918F, -24.4119F, -1.0F, 2, 3, 2, 0.0F));
cube_r11 = new ModelRenderer(this);
cube_r11.setRotationPoint(-4.8F, 22.3F, 0.0F);
rArm.addChild(cube_r11);
setRotationAngle(cube_r11, 0.0F, 0.0F, -0.0873F);
cube_r11.cubeList.add(new ModelBox(cube_r11, 24, 38, 7.4564F, -24.7019F, -2.0F, 4, 3, 4, 0.0F));
lLeg = new ModelRenderer(this);
lLeg.setRotationPoint(0.0F, 12.0F, 0.0F);
lLeg.cubeList.add(new ModelBox(lLeg, 0, 50, -4.0F, 0.0F, -2.0F, 4, 8, 4, 0.2F));
cube_r19 = new ModelRenderer(this);
cube_r19.setRotationPoint(0.0F, 0.0F, 0.0F);
lLeg.addChild(cube_r19);
setRotationAngle(cube_r19, 0.2618F, 0.0F, 0.0F);
cube_r19.cubeList.add(new ModelBox(cube_r19, 46, 17, -3.0F, 0.6F, -3.8F, 2, 4, 1, 0.2F));
cube_r20 = new ModelRenderer(this);
cube_r20.setRotationPoint(0.0F, 0.0F, 0.0F);
lLeg.addChild(cube_r20);
setRotationAngle(cube_r20, 0.3054F, 0.0F, 0.0F);
cube_r20.cubeList.add(new ModelBox(cube_r20, 7, 20, -3.0F, 2.0F, 0.7F, 2, 4, 1, 0.2F));
cube_r21 = new ModelRenderer(this);
cube_r21.setRotationPoint(0.0F, 12.0F, 1.0F);
lLeg.addChild(cube_r21);
setRotationAngle(cube_r21, 0.1745F, 0.0F, -0.1745F);
cube_r21.cubeList.add(new ModelBox(cube_r21, 17, 48, -3.0F, -10.7F, -1.9F, 2, 4, 2, 0.2F));
rLeg = new ModelRenderer(this);
rLeg.setRotationPoint(0.0F, 12.0F, 0.0F);
rLeg.cubeList.add(new ModelBox(rLeg, 42, 38, 0.0F, 0.0F, -2.0F, 4, 8, 4, 0.2F));
cube_r22 = new ModelRenderer(this);
cube_r22.setRotationPoint(0.0F, 0.0F, 0.0F);
rLeg.addChild(cube_r22);
setRotationAngle(cube_r22, 0.2618F, 0.0F, 0.0F);
cube_r22.cubeList.add(new ModelBox(cube_r22, 35, 46, 1.0F, 0.6F, -3.8F, 2, 4, 1, 0.2F));
cube_r23 = new ModelRenderer(this);
cube_r23.setRotationPoint(0.0F, 0.0F, 0.0F);
rLeg.addChild(cube_r23);
setRotationAngle(cube_r23, 0.3054F, 0.0F, 0.0F);
cube_r23.cubeList.add(new ModelBox(cube_r23, 0, 20, 1.0F, 2.0F, 0.7F, 2, 4, 1, 0.2F));
cube_r24 = new ModelRenderer(this);
cube_r24.setRotationPoint(0.0F, 12.0F, 1.0F);
rLeg.addChild(cube_r24);
setRotationAngle(cube_r24, 0.1745F, 0.0F, 0.1745F);
cube_r24.cubeList.add(new ModelBox(cube_r24, 26, 48, 1.0F, -10.7F, -1.9F, 2, 4, 2, 0.2F));
lBoot = new ModelRenderer(this);
lBoot.setRotationPoint(0.0F, 12.0F, 0.0F);
lBoot.cubeList.add(new ModelBox(lBoot, 18, 56, 0.0F, 9.0F, -2.8F, 4, 3, 5, 0.2F));
cube_r25 = new ModelRenderer(this);
cube_r25.setRotationPoint(0.0F, 12.0F, -1.0F);
lBoot.addChild(cube_r25);
setRotationAngle(cube_r25, -0.3054F, 0.0F, 0.0F);
cube_r25.cubeList.add(new ModelBox(cube_r25, 40, 52, 1.0F, -5.7F, 1.9F, 2, 3, 1, 0.2F));
cube_r26 = new ModelRenderer(this);
cube_r26.setRotationPoint(0.0F, 12.0F, -1.0F);
lBoot.addChild(cube_r26);
setRotationAngle(cube_r26, 0.7418F, 0.0F, 0.1745F);
cube_r26.cubeList.add(new ModelBox(cube_r26, 33, 54, 3.2F, -1.8F, 2.2F, 1, 2, 3, 0.2F));
rBoot = new ModelRenderer(this);
rBoot.setRotationPoint(0.0F, 12.0F, 0.0F);
rBoot.cubeList.add(new ModelBox(rBoot, 44, 53, -4.0F, 9.0F, -2.8F, 4, 3, 5, 0.2F));
cube_r27 = new ModelRenderer(this);
cube_r27.setRotationPoint(0.0F, 12.0F, -1.0F);
rBoot.addChild(cube_r27);
setRotationAngle(cube_r27, -0.3054F, 0.0F, 0.0F);
cube_r27.cubeList.add(new ModelBox(cube_r27, 27, 65, -3.0F, -5.7F, 1.9F, 2, 3, 1, 0.2F));
cube_r28 = new ModelRenderer(this);
cube_r28.setRotationPoint(0.0F, 12.0F, -1.0F);
rBoot.addChild(cube_r28);
setRotationAngle(cube_r28, 0.7418F, 0.0F, -0.1745F);
cube_r28.cubeList.add(new ModelBox(cube_r28, 37, 61, -4.2F, -1.8F, 2.2F, 1, 2, 3, 0.2F));
}
public void render(Entity entity, float f, float f1, float f2, float f3, float f4, float f5) {
if(entity instanceof net.minecraft.entity.monster.EntitySkeleton || entity instanceof net.minecraft.entity.monster.EntityZombie)
setRotationAnglesMonster(f, f1, f2, f3, f4, f5, entity);
else {
prepareForRender(entity);
setRotationAngles(f, f1, f2, f3, f4, f5, entity);
}
this.head.showModel = (this.slot == 0);
this.chestplate.showModel = (this.slot == 1);
this.lArm.showModel = (this.slot == 1);
this.rArm.showModel = (this.slot == 1);
this.rLeg.showModel = (this.slot == 2);
this.lLeg.showModel = (this.slot == 2);
this.lBoot.showModel = (this.slot == 3);
this.rBoot.showModel = (this.slot == 3);
this.bipedHeadwear.showModel = false;
this.bipedHead = this.head;
this.bipedBody = this.chestplate;
this.bipedRightArm = this.lArm;
this.bipedLeftArm = this.rArm;
if(this.slot == 2) {
this.bipedRightLeg = this.lLeg;
this.bipedLeftLeg = this.rLeg;
} else {
this.bipedRightLeg = this.rBoot;
this.bipedLeftLeg = this.lBoot;
}
if(this.isChild) {
float f6 = 2.0F;
GL11.glPushMatrix();
GL11.glScalef(1.5F / f6, 1.5F / f6, 1.5F / f6);
GL11.glTranslatef(0.0F, 16.0F * f5, 0.0F);
this.bipedHead.render(f5);
GL11.glPopMatrix();
GL11.glPushMatrix();
GL11.glScalef(1.0F / f6, 1.0F / f6, 1.0F / f6);
GL11.glTranslatef(0.0F, 24.0F * f5, 0.0F);
this.bipedBody.render(f5);
this.bipedRightArm.render(f5);
this.bipedLeftArm.render(f5);
this.bipedRightLeg.render(f5);
this.bipedLeftLeg.render(f5);
this.bipedHeadwear.render(f5);
GL11.glPopMatrix();
} else {
this.bipedHead.render(f5);
this.bipedBody.render(f5);
this.bipedRightArm.render(f5);
this.bipedLeftArm.render(f5);
this.bipedRightLeg.render(f5);
this.bipedLeftLeg.render(f5);
this.bipedHeadwear.render(f5);
}
}
public void prepareForRender(Entity entity) {
EntityLivingBase living = (EntityLivingBase)entity;
this.isSneak = (living != null) ? living.isSneaking() : false;
if (living != null && living instanceof EntityPlayer) {
EntityPlayer player = (EntityPlayer)living;
ItemStack itemstack = player.inventory.getCurrentItem();
this.heldItemRight = (itemstack != null) ? 1 : 0;
this.aimedBow = false;
if (itemstack != null && player.getItemInUseCount() > 0) {
EnumAction enumaction = itemstack.getItemUseAction();
if (enumaction == EnumAction.block) {
this.heldItemRight = 3;
} else if (enumaction == EnumAction.bow) {
this.aimedBow = true;
}
}
}
}
public void setRotationAnglesMonster(float p_78087_1_, float p_78087_2_, float p_78087_3_, float p_78087_4_, float p_78087_5_, float p_78087_6_, Entity p_78087_7_) {
setRotationAngles(p_78087_1_, p_78087_2_, p_78087_3_, p_78087_4_, p_78087_5_, p_78087_6_, p_78087_7_);
float f6 = MathHelper.sin(this.onGround * 3.1415927F);
float f7 = MathHelper.sin((1.0F - (1.0F - this.onGround) * (1.0F - this.onGround)) * 3.1415927F);
this.bipedRightArm.rotateAngleZ = 0.0F;
this.bipedLeftArm.rotateAngleZ = 0.0F;
this.bipedRightArm.rotateAngleY = -(0.1F - f6 * 0.6F);
this.bipedLeftArm.rotateAngleY = 0.1F - f6 * 0.6F;
this.bipedRightArm.rotateAngleX = -1.5707964F;
this.bipedLeftArm.rotateAngleX = -1.5707964F;
this.bipedRightArm.rotateAngleX -= f6 * 1.2F - f7 * 0.4F;
this.bipedLeftArm.rotateAngleX -= f6 * 1.2F - f7 * 0.4F;
this.bipedRightArm.rotateAngleZ += MathHelper.cos(p_78087_3_ * 0.09F) * 0.05F + 0.05F;
this.bipedLeftArm.rotateAngleZ -= MathHelper.cos(p_78087_3_ * 0.09F) * 0.05F + 0.05F;
this.bipedRightArm.rotateAngleX += MathHelper.sin(p_78087_3_ * 0.067F) * 0.05F;
this.bipedLeftArm.rotateAngleX -= MathHelper.sin(p_78087_3_ * 0.067F) * 0.05F;
}
public void setRotationAngle(ModelRenderer modelRenderer, float x, float y, float z) {
modelRenderer.rotateAngleX = x;
modelRenderer.rotateAngleY = y;
modelRenderer.rotateAngleZ = z;
}
}
@@ -0,0 +1,423 @@
package ab.client.model.armor;
import org.lwjgl.opengl.GL11;
import net.minecraft.client.model.ModelBiped;
import net.minecraft.client.model.ModelBox;
import net.minecraft.client.model.ModelRenderer;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.EnumAction;
import net.minecraft.item.ItemStack;
import net.minecraft.util.MathHelper;
public class ModelArmorWildHunt extends ModelBiped {
private final ModelRenderer head;
private final ModelRenderer cube_r1;
private final ModelRenderer cube_r2;
private final ModelRenderer cube_r3;
private final ModelRenderer cube_r4;
private final ModelRenderer cube_r5;
private final ModelRenderer cube_r6;
private final ModelRenderer cube_r7;
private final ModelRenderer cube_r8;
private final ModelRenderer cube_r9;
private final ModelRenderer cube_r10;
private final ModelRenderer cube_r11;
private final ModelRenderer cube_r12;
private final ModelRenderer cube_r13;
private final ModelRenderer cube_r14;
private final ModelRenderer cube_r15;
private final ModelRenderer cube_r16;
private final ModelRenderer chest;
private final ModelRenderer cube_r17;
private final ModelRenderer cube_r18;
private final ModelRenderer cube_r19;
private final ModelRenderer cloak;
private final ModelRenderer cube_r20;
private final ModelRenderer lArm;
private final ModelRenderer cube_r21;
private final ModelRenderer cube_r22;
private final ModelRenderer cube_r23;
private final ModelRenderer cube_r24;
private final ModelRenderer cube_r25;
private final ModelRenderer cube_r26;
private final ModelRenderer rArm;
private final ModelRenderer cube_r27;
private final ModelRenderer cube_r28;
private final ModelRenderer cube_r29;
private final ModelRenderer cube_r30;
private final ModelRenderer cube_r31;
private final ModelRenderer cube_r32;
private final ModelRenderer lLeg;
private final ModelRenderer cube_r33;
private final ModelRenderer rLeg;
private final ModelRenderer cube_r34;
private final ModelRenderer rBoot;
private final ModelRenderer lBoot;
int slot;
public ModelArmorWildHunt(int slot) {
this.slot = slot;
textureWidth = 64;
textureHeight = 128;
head = new ModelRenderer(this);
head.setRotationPoint(0.0F, 0.0F, 0.0F);
head.cubeList.add(new ModelBox(head, 32, 7, -4.0F, -8.0F, -4.0F, 8, 2, 8, 0.25F));
head.cubeList.add(new ModelBox(head, 38, 18, -4.0F, -8.6F, -4.0F, 8, 1, 5, 0.0F));
head.cubeList.add(new ModelBox(head, 21, 20, -3.0F, -8.6F, 1.0F, 6, 1, 2, 0.0F));
head.cubeList.add(new ModelBox(head, 46, 86, -3.5F, -6.0F, 3.0F, 7, 1, 1, 0.1F));
head.cubeList.add(new ModelBox(head, 40, 25, 3.0F, -6.2F, -1.8F, 1, 4, 5, 0.1F));
head.cubeList.add(new ModelBox(head, 52, 25, -4.0F, -6.2F, -1.8F, 1, 4, 5, 0.1F));
head.cubeList.add(new ModelBox(head, 28, 0, -4.0F, -6.3F, -4.0F, 1, 5, 2, 0.1F));
head.cubeList.add(new ModelBox(head, 33, 7, 3.0F, -6.3F, -4.0F, 1, 5, 2, 0.1F));
cube_r1 = new ModelRenderer(this);
cube_r1.setRotationPoint(0.0F, 3.8F, -2.7F);
head.addChild(cube_r1);
setRotationAngle(cube_r1, -0.1745F, 0.0F, 0.1309F);
cube_r1.cubeList.add(new ModelBox(cube_r1, 31, 25, 1.7F, -6.7F, -3.0F, 2, 3, 2, -0.2F));
cube_r2 = new ModelRenderer(this);
cube_r2.setRotationPoint(0.0F, 3.8F, -2.7F);
head.addChild(cube_r2);
setRotationAngle(cube_r2, -0.1745F, 0.0F, -0.1309F);
cube_r2.cubeList.add(new ModelBox(cube_r2, 22, 25, -3.7F, -6.7F, -3.0F, 2, 3, 2, -0.2F));
cube_r3 = new ModelRenderer(this);
cube_r3.setRotationPoint(0.0F, 4.0F, -1.0F);
head.addChild(cube_r3);
setRotationAngle(cube_r3, -0.1309F, 0.0F, 0.0F);
cube_r3.cubeList.add(new ModelBox(cube_r3, 21, 12, -1.0F, -13.1F, -2.8F, 2, 1, 6, 0.0F));
cube_r4 = new ModelRenderer(this);
cube_r4.setRotationPoint(0.3F, 4.0F, -1.2F);
head.addChild(cube_r4);
setRotationAngle(cube_r4, -0.1309F, 0.0F, 0.0F);
cube_r4.cubeList.add(new ModelBox(cube_r4, 47, 61, 1.0F, -15.2F, -3.4F, 2, 3, 2, -0.3F));
cube_r4.cubeList.add(new ModelBox(cube_r4, 47, 55, -3.6F, -15.2F, -3.4F, 2, 3, 2, -0.3F));
cube_r5 = new ModelRenderer(this);
cube_r5.setRotationPoint(-0.3F, 4.0F, -1.2F);
head.addChild(cube_r5);
setRotationAngle(cube_r5, 0.2182F, 0.0F, 0.0F);
cube_r5.cubeList.add(new ModelBox(cube_r5, 47, 71, -3.0F, -13.0F, 1.2F, 2, 1, 2, -0.1F));
cube_r5.cubeList.add(new ModelBox(cube_r5, 47, 67, 1.6F, -13.0F, 1.2F, 2, 1, 2, -0.1F));
cube_r6 = new ModelRenderer(this);
cube_r6.setRotationPoint(0.0F, 4.0F, -1.0F);
head.addChild(cube_r6);
setRotationAngle(cube_r6, 0.1309F, 0.0F, 0.0F);
cube_r6.cubeList.add(new ModelBox(cube_r6, 24, 8, -1.0F, -11.2F, -2.0F, 2, 2, 1, 0.1F));
cube_r7 = new ModelRenderer(this);
cube_r7.setRotationPoint(-0.8F, 5.5F, -0.1F);
head.addChild(cube_r7);
setRotationAngle(cube_r7, -0.1309F, 1.5708F, 0.0F);
cube_r7.cubeList.add(new ModelBox(cube_r7, 56, 43, -1.0F, -15.7F, -6.4F, 2, 3, 2, -0.35F));
cube_r8 = new ModelRenderer(this);
cube_r8.setRotationPoint(0.8F, 4.5F, -0.1F);
head.addChild(cube_r8);
setRotationAngle(cube_r8, 0.2182F, -1.5708F, 0.0F);
cube_r8.cubeList.add(new ModelBox(cube_r8, 56, 68, -1.0F, -13.7F, -1.7F, 2, 3, 2, -0.2F));
cube_r9 = new ModelRenderer(this);
cube_r9.setRotationPoint(0.8F, 5.5F, -0.1F);
head.addChild(cube_r9);
setRotationAngle(cube_r9, -0.1309F, -1.5708F, 0.0F);
cube_r9.cubeList.add(new ModelBox(cube_r9, 56, 49, -1.0F, -15.7F, -6.4F, 2, 3, 2, -0.35F));
cube_r10 = new ModelRenderer(this);
cube_r10.setRotationPoint(-0.8F, 4.5F, -0.1F);
head.addChild(cube_r10);
setRotationAngle(cube_r10, 0.2182F, 1.5708F, 0.0F);
cube_r10.cubeList.add(new ModelBox(cube_r10, 56, 74, -1.0F, -13.7F, -1.7F, 2, 3, 2, -0.2F));
cube_r11 = new ModelRenderer(this);
cube_r11.setRotationPoint(0.0F, 3.9F, -0.7F);
head.addChild(cube_r11);
setRotationAngle(cube_r11, -0.1309F, 0.0F, 0.0F);
cube_r11.cubeList.add(new ModelBox(cube_r11, 56, 62, -1.0F, -15.7F, -6.6F, 2, 3, 2, -0.35F));
cube_r12 = new ModelRenderer(this);
cube_r12.setRotationPoint(0.0F, 3.9F, -0.7F);
head.addChild(cube_r12);
setRotationAngle(cube_r12, 0.2182F, 0.0F, 0.0F);
cube_r12.cubeList.add(new ModelBox(cube_r12, 56, 55, -1.0F, -14.7F, -1.7F, 2, 4, 2, -0.2F));
cube_r13 = new ModelRenderer(this);
cube_r13.setRotationPoint(-1.6F, 3.8F, -1.6F);
head.addChild(cube_r13);
setRotationAngle(cube_r13, 0.2182F, 0.7854F, 0.0F);
cube_r13.cubeList.add(new ModelBox(cube_r13, 47, 43, -1.0F, -13.7F, -1.7F, 2, 3, 2, -0.2F));
cube_r14 = new ModelRenderer(this);
cube_r14.setRotationPoint(1.6F, 3.8F, -1.6F);
head.addChild(cube_r14);
setRotationAngle(cube_r14, -0.1309F, -0.7854F, 0.0F);
cube_r14.cubeList.add(new ModelBox(cube_r14, 0, 0, -1.0F, -14.7F, -6.3F, 2, 3, 2, -0.35F));
cube_r15 = new ModelRenderer(this);
cube_r15.setRotationPoint(1.6F, 3.8F, -1.6F);
head.addChild(cube_r15);
setRotationAngle(cube_r15, 0.2182F, -0.7854F, 0.0F);
cube_r15.cubeList.add(new ModelBox(cube_r15, 47, 49, -1.0F, -13.7F, -1.7F, 2, 3, 2, -0.2F));
cube_r16 = new ModelRenderer(this);
cube_r16.setRotationPoint(-1.6F, 3.8F, -1.6F);
head.addChild(cube_r16);
setRotationAngle(cube_r16, -0.1309F, 0.7854F, 0.0F);
cube_r16.cubeList.add(new ModelBox(cube_r16, 0, 6, -1.0F, -14.7F, -6.3F, 2, 3, 2, -0.35F));
chest = new ModelRenderer(this);
chest.setRotationPoint(0.0F, 0.0F, 0.0F);
chest.cubeList.add(new ModelBox(chest, 49, 25, -1.0F, 7.85F, -2.9F, 2, 2, 1, 0.0F));
chest.cubeList.add(new ModelBox(chest, 0, 84, -4.0F, 0.9F, -3.1F, 8, 7, 1, 0.0F));
chest.cubeList.add(new ModelBox(chest, 19, 85, -2.5F, 4.7F, 1.9F, 5, 6, 1, 0.0F));
chest.cubeList.add(new ModelBox(chest, 44, 89, -3.5F, 0.0F, 1.1F, 7, 7, 2, 0.0F));
chest.cubeList.add(new ModelBox(chest, 0, 93, -4.0F, 0.0F, -2.0F, 8, 12, 4, 0.2F));
cube_r17 = new ModelRenderer(this);
cube_r17.setRotationPoint(0.0F, -3.0F, 1.2F);
chest.addChild(cube_r17);
setRotationAngle(cube_r17, 0.0873F, 0.0F, 0.0F);
cube_r17.cubeList.add(new ModelBox(cube_r17, 36, 1, -4.0F, 10.1F, -5.1F, 8, 4, 1, -0.1F));
cube_r18 = new ModelRenderer(this);
cube_r18.setRotationPoint(0.0F, 20.5F, 0.8F);
chest.addChild(cube_r18);
setRotationAngle(cube_r18, 0.0F, 0.0F, 0.0436F);
cube_r18.cubeList.add(new ModelBox(cube_r18, 51, 35, 0.9F, -14.0F, -3.9F, 2, 6, 1, -0.1F));
cube_r19 = new ModelRenderer(this);
cube_r19.setRotationPoint(0.0F, 20.5F, 0.8F);
chest.addChild(cube_r19);
setRotationAngle(cube_r19, 0.0F, 0.0F, -0.0436F);
cube_r19.cubeList.add(new ModelBox(cube_r19, 58, 35, -2.9F, -14.0F, -3.9F, 2, 6, 1, -0.1F));
cloak = new ModelRenderer(this);
cloak.setRotationPoint(0.0F, 2.0F, 0.0F);
cube_r20 = new ModelRenderer(this);
cube_r20.setRotationPoint(0.0F, -6.0F, 1.0F);
cloak.addChild(cube_r20);
setRotationAngle(cube_r20, 0.2182F, 0.0F, 0.0F);
cube_r20.cubeList.add(new ModelBox(cube_r20, 0, 71, -3.0F, 4.6F, 1.4F, 6, 10, 0, 0.0F));
lArm = new ModelRenderer(this);
lArm.setRotationPoint(-5.0F, 2.0F, 0.0F);
lArm.cubeList.add(new ModelBox(lArm, 31, 95, -3.0F, -2.0F, -2.0F, 4, 4, 4, 0.3F));
lArm.cubeList.add(new ModelBox(lArm, 19, 59, -3.0F, 2.0F, -2.0F, 4, 8, 4, 0.1F));
lArm.cubeList.add(new ModelBox(lArm, 19, 51, -3.9F, -2.7F, -2.0F, 4, 3, 4, 0.0F));
cube_r21 = new ModelRenderer(this);
cube_r21.setRotationPoint(-1.1F, 10.3F, 0.5F);
lArm.addChild(cube_r21);
setRotationAngle(cube_r21, -0.1309F, 0.7854F, 0.0F);
cube_r21.cubeList.add(new ModelBox(cube_r21, 0, 29, -1.0F, -13.7F, -6.3F, 2, 2, 2, -0.45F));
cube_r22 = new ModelRenderer(this);
cube_r22.setRotationPoint(0.8F, 9.9F, 1.0F);
lArm.addChild(cube_r22);
setRotationAngle(cube_r22, -0.1309F, 0.0F, 0.0F);
cube_r22.cubeList.add(new ModelBox(cube_r22, 9, 51, -3.0F, -14.7F, -3.4F, 2, 3, 2, -0.35F));
cube_r23 = new ModelRenderer(this);
cube_r23.setRotationPoint(0.8F, 9.9F, 1.0F);
lArm.addChild(cube_r23);
setRotationAngle(cube_r23, 0.2182F, 0.0F, 0.0F);
cube_r23.cubeList.add(new ModelBox(cube_r23, 9, 63, -3.0F, -13.0F, 1.2F, 2, 1, 2, -0.1F));
cube_r24 = new ModelRenderer(this);
cube_r24.setRotationPoint(-1.1F, 9.7F, -0.8F);
lArm.addChild(cube_r24);
setRotationAngle(cube_r24, 0.2182F, 2.3562F, 0.0F);
cube_r24.cubeList.add(new ModelBox(cube_r24, 0, 47, -1.0F, -13.7F, -1.7F, 2, 2, 2, -0.3F));
cube_r25 = new ModelRenderer(this);
cube_r25.setRotationPoint(-1.1F, 9.9F, -0.8F);
lArm.addChild(cube_r25);
setRotationAngle(cube_r25, -0.1309F, 2.3562F, 0.0F);
cube_r25.cubeList.add(new ModelBox(cube_r25, 0, 23, -1.0F, -13.7F, -6.3F, 2, 2, 2, -0.45F));
cube_r26 = new ModelRenderer(this);
cube_r26.setRotationPoint(-1.1F, 10.1F, 0.5F);
lArm.addChild(cube_r26);
setRotationAngle(cube_r26, 0.2182F, 0.7854F, 0.0F);
cube_r26.cubeList.add(new ModelBox(cube_r26, 0, 53, -1.0F, -13.7F, -1.7F, 2, 2, 2, -0.3F));
rArm = new ModelRenderer(this);
rArm.setRotationPoint(5.0F, 2.0F, 0.0F);
rArm.cubeList.add(new ModelBox(rArm, 19, 72, -1.0F, 2.0F, -2.0F, 4, 8, 4, 0.1F));
rArm.cubeList.add(new ModelBox(rArm, 31, 105, -1.0F, -2.0F, -2.0F, 4, 4, 4, 0.3F));
rArm.cubeList.add(new ModelBox(rArm, 19, 43, -0.1F, -2.7F, -2.0F, 4, 3, 4, 0.0F));
cube_r27 = new ModelRenderer(this);
cube_r27.setRotationPoint(1.1F, 10.1F, 0.5F);
rArm.addChild(cube_r27);
setRotationAngle(cube_r27, 0.2182F, -0.7854F, 0.0F);
cube_r27.cubeList.add(new ModelBox(cube_r27, 0, 59, -1.0F, -13.7F, -1.7F, 2, 2, 2, -0.3F));
cube_r28 = new ModelRenderer(this);
cube_r28.setRotationPoint(1.1F, 10.3F, 0.5F);
rArm.addChild(cube_r28);
setRotationAngle(cube_r28, -0.1309F, -0.7854F, 0.0F);
cube_r28.cubeList.add(new ModelBox(cube_r28, 0, 35, -1.0F, -13.7F, -6.3F, 2, 2, 2, -0.45F));
cube_r29 = new ModelRenderer(this);
cube_r29.setRotationPoint(1.2F, 10.0F, -0.8F);
rArm.addChild(cube_r29);
setRotationAngle(cube_r29, -0.1309F, -2.3562F, 0.0F);
cube_r29.cubeList.add(new ModelBox(cube_r29, 0, 41, -1.0F, -13.7F, -6.3F, 2, 2, 2, -0.45F));
cube_r30 = new ModelRenderer(this);
cube_r30.setRotationPoint(1.2F, 9.8F, -0.8F);
rArm.addChild(cube_r30);
setRotationAngle(cube_r30, 0.2182F, -2.3562F, 0.0F);
cube_r30.cubeList.add(new ModelBox(cube_r30, 0, 65, -1.0F, -13.7F, -1.7F, 2, 2, 2, -0.3F));
cube_r31 = new ModelRenderer(this);
cube_r31.setRotationPoint(3.3F, 10.0F, 1.0F);
rArm.addChild(cube_r31);
setRotationAngle(cube_r31, -0.1309F, 0.0F, 0.0F);
cube_r31.cubeList.add(new ModelBox(cube_r31, 9, 57, -3.0F, -14.7F, -3.4F, 2, 3, 2, -0.35F));
cube_r32 = new ModelRenderer(this);
cube_r32.setRotationPoint(3.3F, 10.0F, 1.0F);
rArm.addChild(cube_r32);
setRotationAngle(cube_r32, 0.2182F, 0.0F, 0.0F);
cube_r32.cubeList.add(new ModelBox(cube_r32, 9, 67, -3.0F, -13.0F, 1.2F, 2, 1, 2, -0.1F));
lLeg = new ModelRenderer(this);
lLeg.setRotationPoint(0.0F, 12.0F, 0.0F);
lLeg.cubeList.add(new ModelBox(lLeg, 48, 103, -4.0F, 0.4F, -2.0F, 4, 8, 4, 0.15F));
cube_r33 = new ModelRenderer(this);
cube_r33.setRotationPoint(0.0F, 11.9F, 1.0F);
lLeg.addChild(cube_r33);
setRotationAngle(cube_r33, 0.0873F, 0.0F, 0.0F);
cube_r33.cubeList.add(new ModelBox(cube_r33, 37, 122, -3.5F, -10.1F, -3.1F, 3, 4, 2, -0.3F));
rLeg = new ModelRenderer(this);
rLeg.setRotationPoint(0.0F, 12.0F, 0.0F);
rLeg.cubeList.add(new ModelBox(rLeg, 48, 116, 0.0F, 0.4F, -2.0F, 4, 8, 4, 0.15F));
cube_r34 = new ModelRenderer(this);
cube_r34.setRotationPoint(0.0F, 11.9F, 1.0F);
rLeg.addChild(cube_r34);
setRotationAngle(cube_r34, 0.0873F, 0.0F, 0.0F);
cube_r34.cubeList.add(new ModelBox(cube_r34, 37, 115, 0.5F, -10.1F, -3.1F, 3, 4, 2, -0.3F));
rBoot = new ModelRenderer(this);
rBoot.setRotationPoint(0.0F, 12.0F, 0.0F);
rBoot.cubeList.add(new ModelBox(rBoot, 0, 120, -4.0F, 9.0F, -2.8F, 4, 3, 5, 0.25F));
lBoot = new ModelRenderer(this);
lBoot.setRotationPoint(0.0F, 12.0F, 0.0F);
lBoot.cubeList.add(new ModelBox(lBoot, 0, 111, 0.0F, 9.0F, -2.8F, 4, 3, 5, 0.25F));
}
public void render(Entity entity, float f, float f1, float f2, float f3, float f4, float f5) {
if(entity instanceof net.minecraft.entity.monster.EntitySkeleton || entity instanceof net.minecraft.entity.monster.EntityZombie)
setRotationAnglesMonster(f, f1, f2, f3, f4, f5, entity);
else {
prepareForRender(entity);
setRotationAngles(f, f1, f2, f3, f4, f5, entity);
}
this.head.showModel = (this.slot == 0);
this.chest.showModel = (this.slot == 1);
this.lArm.showModel = (this.slot == 1);
this.rArm.showModel = (this.slot == 1);
this.rLeg.showModel = (this.slot == 2);
this.lLeg.showModel = (this.slot == 2);
this.lBoot.showModel = (this.slot == 3);
this.rBoot.showModel = (this.slot == 3);
this.bipedHeadwear.showModel = false;
this.bipedHead = this.head;
this.bipedBody = this.chest;
this.bipedRightArm = this.lArm;
this.bipedLeftArm = this.rArm;
if(this.slot == 2) {
this.bipedRightLeg = this.lLeg;
this.bipedLeftLeg = this.rLeg;
} else {
this.bipedRightLeg = this.rBoot;
this.bipedLeftLeg = this.lBoot;
}
if(this.isChild) {
float f6 = 2.0F;
GL11.glPushMatrix();
GL11.glScalef(1.5F / f6, 1.5F / f6, 1.5F / f6);
GL11.glTranslatef(0.0F, 16.0F * f5, 0.0F);
this.bipedHead.render(f5);
GL11.glPopMatrix();
GL11.glPushMatrix();
GL11.glScalef(1.0F / f6, 1.0F / f6, 1.0F / f6);
GL11.glTranslatef(0.0F, 24.0F * f5, 0.0F);
this.bipedBody.render(f5);
this.bipedRightArm.render(f5);
this.bipedLeftArm.render(f5);
this.bipedRightLeg.render(f5);
this.bipedLeftLeg.render(f5);
this.bipedHeadwear.render(f5);
GL11.glPopMatrix();
} else {
this.bipedHead.render(f5);
this.bipedBody.render(f5);
this.bipedRightArm.render(f5);
this.bipedLeftArm.render(f5);
this.bipedRightLeg.render(f5);
this.bipedLeftLeg.render(f5);
this.bipedHeadwear.render(f5);
}
}
public void prepareForRender(Entity entity) {
EntityLivingBase living = (EntityLivingBase)entity;
this.isSneak = (living != null) ? living.isSneaking() : false;
if(living != null && living instanceof EntityPlayer) {
EntityPlayer player = (EntityPlayer)living;
ItemStack itemstack = player.inventory.getCurrentItem();
this.heldItemRight = (itemstack != null) ? 1 : 0;
this.aimedBow = false;
if(itemstack != null && player.getItemInUseCount() > 0) {
EnumAction enumaction = itemstack.getItemUseAction();
if(enumaction == EnumAction.block) {
this.heldItemRight = 3;
} else if(enumaction == EnumAction.bow) {
this.aimedBow = true;
}
}
}
}
public void setRotationAnglesMonster(float p_78087_1_, float p_78087_2_, float p_78087_3_, float p_78087_4_, float p_78087_5_, float p_78087_6_, Entity p_78087_7_) {
setRotationAngles(p_78087_1_, p_78087_2_, p_78087_3_, p_78087_4_, p_78087_5_, p_78087_6_, p_78087_7_);
float f6 = MathHelper.sin(this.onGround * 3.1415927F);
float f7 = MathHelper.sin((1.0F - (1.0F - this.onGround) * (1.0F - this.onGround)) * 3.1415927F);
this.bipedRightArm.rotateAngleZ = 0.0F;
this.bipedLeftArm.rotateAngleZ = 0.0F;
this.bipedRightArm.rotateAngleY = -(0.1F - f6 * 0.6F);
this.bipedLeftArm.rotateAngleY = 0.1F - f6 * 0.6F;
this.bipedRightArm.rotateAngleX = -1.5707964F;
this.bipedLeftArm.rotateAngleX = -1.5707964F;
this.bipedRightArm.rotateAngleX -= f6 * 1.2F - f7 * 0.4F;
this.bipedLeftArm.rotateAngleX -= f6 * 1.2F - f7 * 0.4F;
this.bipedRightArm.rotateAngleZ += MathHelper.cos(p_78087_3_ * 0.09F) * 0.05F + 0.05F;
this.bipedLeftArm.rotateAngleZ -= MathHelper.cos(p_78087_3_ * 0.09F) * 0.05F + 0.05F;
this.bipedRightArm.rotateAngleX += MathHelper.sin(p_78087_3_ * 0.067F) * 0.05F;
this.bipedLeftArm.rotateAngleX -= MathHelper.sin(p_78087_3_ * 0.067F) * 0.05F;
}
public void setRotationAngle(ModelRenderer modelRenderer, float x, float y, float z) {
modelRenderer.rotateAngleX = x;
modelRenderer.rotateAngleY = y;
modelRenderer.rotateAngleZ = z;
}
}
@@ -0,0 +1,29 @@
package ab.client.nei;
import ab.AdvancedBotany;
import ab.common.core.handler.ConfigABHandler;
import ab.common.lib.register.BlockListAB;
import codechicken.nei.api.API;
import codechicken.nei.api.IConfigureNEI;
import codechicken.nei.recipe.ICraftingHandler;
import codechicken.nei.recipe.IUsageHandler;
import net.minecraft.item.ItemStack;
public class NEIConfig implements IConfigureNEI {
public String getName() {
return AdvancedBotany.modid;
}
public String getVersion() {
return AdvancedBotany.version;
}
public void loadConfig() {
API.registerRecipeHandler((ICraftingHandler)new RecipeHandlerAlphirine());
API.registerUsageHandler((IUsageHandler)new RecipeHandlerAlphirine());
API.registerRecipeHandler((ICraftingHandler)new RecipeHandlerAdvancedPlate());
API.registerUsageHandler((IUsageHandler)new RecipeHandlerAdvancedPlate());
API.hideItem(new ItemStack(BlockListAB.blockAntigravitation));
}
}
@@ -0,0 +1,118 @@
package ab.client.nei;
import java.awt.Rectangle;
import java.util.ArrayList;
import java.util.List;
import org.lwjgl.opengl.GL11;
import ab.api.AdvancedBotanyAPI;
import ab.api.recipe.RecipeAdvancedPlate;
import ab.client.core.ClientHelper;
import ab.client.nei.RecipeHandlerAlphirine.CachedHandlerAlphirine;
import ab.common.lib.register.BlockListAB;
import codechicken.lib.gui.GuiDraw;
import codechicken.nei.NEIServerUtils;
import codechicken.nei.PositionedStack;
import codechicken.nei.recipe.TemplateRecipeHandler;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.FontRenderer;
import net.minecraft.item.ItemStack;
import net.minecraft.util.StatCollector;
public class RecipeHandlerAdvancedPlate extends TemplateRecipeHandler {
public class CachedAdvancedPlateRecipe extends TemplateRecipeHandler.CachedRecipe {
public List<PositionedStack> inputs = new ArrayList<PositionedStack>();
public PositionedStack output;
public int manaUsage;
public CachedAdvancedPlateRecipe(RecipeAdvancedPlate recipe) {
setIngredients(recipe.getInputs());
this.output = new PositionedStack(recipe.getOutput(), 111, 21);
this.inputs.add(new PositionedStack(new ItemStack(BlockListAB.blockABPlate), 73, 55));
this.manaUsage = recipe.getManaUsage();
}
public void setIngredients(List<ItemStack> inputs) {
float degreePerInput = 360.0F / inputs.size();
float currentDegree = -90.0F;
for (Object o : inputs) {
int posX = (int)Math.round(73.0D + Math.cos(currentDegree * Math.PI / 180.0D) * 32.0D);
int posY = (int)Math.round(55.0D + Math.sin(currentDegree * Math.PI / 180.0D) * 32.0D);
this.inputs.add(new PositionedStack(o, posX, posY));
currentDegree += degreePerInput;
}
}
public List<PositionedStack> getIngredients() {
return getCycledIngredients(RecipeHandlerAdvancedPlate.this.cycleticks / 20, this.inputs);
}
public PositionedStack getResult() {
return this.output;
}
}
public String getRecipeName() {
return StatCollector.translateToLocal("ab.nei.advancedPlate");
}
public String getRecipeID() {
return "ab.advancedPlate";
}
public String getGuiTexture() {
return "botania:textures/gui/neiBlank.png";
}
public void loadTransferRects() {
this.transferRects.add(new TemplateRecipeHandler.RecipeTransferRect(new Rectangle(72, 54, 18, 18), getRecipeID(), new Object[0]));
}
public int recipiesPerPage() {
return 1;
}
public void drawBackground(int recipe) {
super.drawBackground(recipe);
GL11.glEnable(3042);
GL11.glColor4f(1.0F, 1.0F, 1.0F, 0.5F);
GuiDraw.changeTexture("botania:textures/gui/petalOverlay.png");
GuiDraw.drawTexturedModalRect(45, 10, 38, 7, 92, 92);
int mana = ((CachedAdvancedPlateRecipe)this.arecipes.get(recipe)).manaUsage;
ClientHelper.renderPoolManaBar(32, 112, 0x239ddc, 1.0f, mana);
}
public CachedAdvancedPlateRecipe getCachedRecipe(RecipeAdvancedPlate recipe) {
return new CachedAdvancedPlateRecipe(recipe);
}
public void loadCraftingRecipes(String outputId, Object... results) {
if (outputId.equals(getRecipeID())) {
for (RecipeAdvancedPlate recipe : AdvancedBotanyAPI.advancedPlateRecipes) {
this.arecipes.add(getCachedRecipe(recipe));
}
} else {
super.loadCraftingRecipes(outputId, results);
}
}
public void loadCraftingRecipes(ItemStack result) {
for (RecipeAdvancedPlate recipe : AdvancedBotanyAPI.advancedPlateRecipes) {
if (recipe == null)
continue;
if (((recipe.getOutput()).stackTagCompound != null && NEIServerUtils.areStacksSameType(recipe.getOutput(), result)) || ((recipe.getOutput()).stackTagCompound == null && NEIServerUtils.areStacksSameTypeCrafting(recipe.getOutput(), result)))
this.arecipes.add(getCachedRecipe(recipe));
}
}
public void loadUsageRecipes(ItemStack ingredient) {
for (RecipeAdvancedPlate recipe : AdvancedBotanyAPI.advancedPlateRecipes) {
if (recipe == null)
continue;
CachedAdvancedPlateRecipe crecipe = getCachedRecipe(recipe);
if(crecipe.contains(crecipe.getIngredients(), ingredient) || crecipe.contains(crecipe.getOtherStacks(), ingredient))
this.arecipes.add(crecipe);
}
}
}
@@ -0,0 +1,121 @@
package ab.client.nei;
import java.awt.Rectangle;
import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
import org.lwjgl.opengl.GL11;
import ab.api.AdvancedBotanyAPI;
import ab.api.recipe.RecipeAncientAlphirine;
import ab.client.core.ClientHelper;
import codechicken.lib.gui.GuiDraw;
import codechicken.nei.NEIServerUtils;
import codechicken.nei.PositionedStack;
import codechicken.nei.recipe.TemplateRecipeHandler;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.FontRenderer;
import net.minecraft.item.ItemStack;
import net.minecraft.util.StatCollector;
import vazkii.botania.common.item.block.ItemBlockSpecialFlower;
public class RecipeHandlerAlphirine extends TemplateRecipeHandler {
public class CachedHandlerAlphirine extends TemplateRecipeHandler.CachedRecipe {
public List<PositionedStack> inputs = new ArrayList<PositionedStack>();
public PositionedStack output;
public List<PositionedStack> otherStacks = new ArrayList<PositionedStack>();
public int chance;
public CachedHandlerAlphirine(RecipeAncientAlphirine recipe) {
if (recipe == null)
return;
this.inputs.add(new PositionedStack(ItemBlockSpecialFlower.ofType("ancientAlphirine"), 71, 23));
this.inputs.add(new PositionedStack(recipe.getInput(), 42, 23));
this.output = new PositionedStack(recipe.getOutput(), 101, 23);
this.chance = recipe.getChance();
}
public List<PositionedStack> getIngredients() {
return getCycledIngredients(RecipeHandlerAlphirine.this.cycleticks / 20, this.inputs);
}
public PositionedStack getResult() {
return this.output;
}
public List<PositionedStack> getOtherStacks() {
return this.otherStacks;
}
public boolean contains(Collection<PositionedStack> ingredients, ItemStack ingredient) {
if (ingredients == this.inputs)
for (PositionedStack stack : ingredients) {
if (stack.contains(ingredient))
return true;
}
return super.contains(ingredients, ingredient);
}
}
public String getRecipeName() {
return StatCollector.translateToLocal("ab.nei.alphirine");
}
public String getRecipeID() {
return "ab.alphirine";
}
public String getGuiTexture() {
return "botania:textures/gui/neiBlank.png";
}
public int recipiesPerPage() {
return 2;
}
public void loadTransferRects() {
this.transferRects.add(new TemplateRecipeHandler.RecipeTransferRect(new Rectangle(70, 22, 18, 18), getRecipeID(), new Object[0]));
}
public void drawBackground(int recipe) {
super.drawBackground(recipe);
GL11.glEnable(3042);
GL11.glColor4f(1.0F, 1.0F, 1.0F, 0.5F);
GuiDraw.changeTexture("botania:textures/gui/pureDaisyOverlay.png");
GuiDraw.drawTexturedModalRect(45, 10, 0, 0, 65, 44);
int chance = ((CachedHandlerAlphirine)this.arecipes.get(recipe)).chance;
ClientHelper.drawChanceBar(52, 58, chance);
}
public void loadCraftingRecipes(String outputId, Object... results) {
if (outputId.equals(getRecipeID())) {
for (RecipeAncientAlphirine recipe : AdvancedBotanyAPI.alphirineRecipes) {
if (recipe == null)
continue;
this.arecipes.add(new CachedHandlerAlphirine(recipe));
}
} else {
super.loadCraftingRecipes(outputId, results);
}
}
public void loadCraftingRecipes(ItemStack result) {
for (RecipeAncientAlphirine recipe : AdvancedBotanyAPI.alphirineRecipes) {
if (recipe == null)
continue;
if (NEIServerUtils.areStacksSameTypeCrafting(recipe.getOutput(), result))
this.arecipes.add(new CachedHandlerAlphirine(recipe));
}
}
public void loadUsageRecipes(ItemStack ingredient) {
for (RecipeAncientAlphirine recipe : AdvancedBotanyAPI.alphirineRecipes) {
if (recipe == null)
continue;
CachedHandlerAlphirine crecipe = new CachedHandlerAlphirine(recipe);
if (crecipe.contains(crecipe.getIngredients(), ingredient) || crecipe.contains(crecipe.getOtherStacks(), ingredient))
this.arecipes.add(crecipe);
}
}
}
@@ -0,0 +1,36 @@
package ab.client.render.block;
import org.lwjgl.opengl.GL11;
import ab.common.block.tile.TileABSpreader;
import ab.common.lib.register.BlockListAB;
import cpw.mods.fml.client.registry.ISimpleBlockRenderingHandler;
import net.minecraft.block.Block;
import net.minecraft.client.renderer.RenderBlocks;
import net.minecraft.client.renderer.tileentity.TileEntityRendererDispatcher;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.world.IBlockAccess;
public class RenderBlockABSpreader implements ISimpleBlockRenderingHandler {
public void renderInventoryBlock(Block block, int metadata, int modelID, RenderBlocks renderer) {
GL11.glPushMatrix();
GL11.glTranslatef(-0.5F, -0.5F, -0.5F);
TileABSpreader spreader = new TileABSpreader();
spreader.rotationX = -180.0F;
TileEntityRendererDispatcher.instance.renderTileEntityAt((TileEntity)spreader, 0.0D, 0.0D, 0.0D, 0.0F);
GL11.glPopMatrix();
}
public boolean renderWorldBlock(IBlockAccess world, int x, int y, int z, Block block, int modelId, RenderBlocks renderer) {
return false;
}
public int getRenderId() {
return BlockListAB.blockABSpreaderRI;
}
public boolean shouldRender3DInInventory(int modelId) {
return true;
}
}
@@ -0,0 +1,36 @@
package ab.client.render.block;
import org.lwjgl.opengl.GL11;
import ab.common.block.tile.TileEngineerHopper;
import ab.common.lib.register.BlockListAB;
import cpw.mods.fml.client.registry.ISimpleBlockRenderingHandler;
import net.minecraft.block.Block;
import net.minecraft.client.renderer.RenderBlocks;
import net.minecraft.client.renderer.tileentity.TileEntityRendererDispatcher;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.world.IBlockAccess;
public class RenderBlockEngineerHopper implements ISimpleBlockRenderingHandler {
public void renderInventoryBlock(Block block, int metadata, int modelID, RenderBlocks renderer) {
GL11.glPushMatrix();
GL11.glTranslatef(-0.5F, -0.5F, -0.5F);
GL11.glScalef(1.4f, 1.4f, 1.4f);
TileEngineerHopper hopper = new TileEngineerHopper();
TileEntityRendererDispatcher.instance.renderTileEntityAt((TileEntity)hopper, 0.0D, 0.0D, 0.0D, 0.0F);
GL11.glPopMatrix();
}
public boolean renderWorldBlock(IBlockAccess world, int x, int y, int z, Block block, int modelId, RenderBlocks renderer) {
return false;
}
public int getRenderId() {
return BlockListAB.blockEngineerHopperRI;
}
public boolean shouldRender3DInInventory(int modelId) {
return true;
}
}
@@ -0,0 +1,36 @@
package ab.client.render.block;
import org.lwjgl.opengl.GL11;
import ab.common.block.tile.TileManaCharger;
import ab.common.lib.register.BlockListAB;
import cpw.mods.fml.client.registry.ISimpleBlockRenderingHandler;
import net.minecraft.block.Block;
import net.minecraft.client.renderer.RenderBlocks;
import net.minecraft.client.renderer.tileentity.TileEntityRendererDispatcher;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.world.IBlockAccess;
public class RenderBlockManaCharger implements ISimpleBlockRenderingHandler {
public void renderInventoryBlock(Block block, int metadata, int modelID, RenderBlocks renderer) {
GL11.glPushMatrix();
GL11.glTranslatef(-0.5F, -0.625F, -0.5F);
GL11.glScalef(1.35f, 1.35f, 1.35f);
TileManaCharger charger = new TileManaCharger();
TileEntityRendererDispatcher.instance.renderTileEntityAt((TileEntity)charger, 0.0D, 0.0D, 0.0D, 0.0F);
GL11.glPopMatrix();
}
public boolean renderWorldBlock(IBlockAccess world, int x, int y, int z, Block block, int modelId, RenderBlocks renderer) {
return false;
}
public int getRenderId() {
return BlockListAB.blockManaChargerRI;
}
public boolean shouldRender3DInInventory(int modelId) {
return true;
}
}
@@ -0,0 +1,38 @@
package ab.client.render.block;
import org.lwjgl.opengl.GL11;
import ab.client.render.tile.RenderTileManaContainer;
import ab.common.block.tile.TileManaContainer;
import ab.common.lib.register.BlockListAB;
import cpw.mods.fml.client.registry.ISimpleBlockRenderingHandler;
import net.minecraft.block.Block;
import net.minecraft.client.renderer.RenderBlocks;
import net.minecraft.client.renderer.tileentity.TileEntityRendererDispatcher;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.world.IBlockAccess;
public class RenderBlockManaContainer implements ISimpleBlockRenderingHandler {
public void renderInventoryBlock(Block block, int metadata, int modelID, RenderBlocks renderer) {
GL11.glPushMatrix();
GL11.glTranslatef(-0.5F, -0.5F, -0.5F);
GL11.glScalef(1.4f, 1.4f, 1.4f);
TileManaContainer container = new TileManaContainer();
RenderTileManaContainer.metadata = metadata;
TileEntityRendererDispatcher.instance.renderTileEntityAt((TileEntity)container, 0.0D, 0.0D, 0.0D, 0.0F);
GL11.glPopMatrix();
}
public boolean renderWorldBlock(IBlockAccess world, int x, int y, int z, Block block, int modelId, RenderBlocks renderer) {
return false;
}
public int getRenderId() {
return BlockListAB.blockManaContainerRI;
}
public boolean shouldRender3DInInventory(int modelId) {
return true;
}
}
@@ -0,0 +1,37 @@
package ab.client.render.block;
import org.lwjgl.opengl.GL11;
import ab.common.block.tile.TileManaCrystalCube;
import ab.common.lib.register.BlockListAB;
import cpw.mods.fml.client.registry.ISimpleBlockRenderingHandler;
import net.minecraft.block.Block;
import net.minecraft.client.renderer.RenderBlocks;
import net.minecraft.client.renderer.tileentity.TileEntityRendererDispatcher;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.world.IBlockAccess;
public class RenderBlockManaCrystalCube implements ISimpleBlockRenderingHandler {
public void renderInventoryBlock(Block block, int metadata, int modelID, RenderBlocks renderer) {
GL11.glPushMatrix();
GL11.glTranslatef(-0.5F, -0.5F, -0.5F);
GL11.glDisable(3008);
TileManaCrystalCube cube = new TileManaCrystalCube();
TileEntityRendererDispatcher.instance.renderTileEntityAt((TileEntity)cube, 0.0D, 0.0D, 0.0D, 0.0F);
GL11.glEnable(3008);
GL11.glPopMatrix();
}
public boolean renderWorldBlock(IBlockAccess world, int x, int y, int z, Block block, int modelId, RenderBlocks renderer) {
return false;
}
public int getRenderId() {
return BlockListAB.blockManaCrystalCubeRI;
}
public boolean shouldRender3DInInventory(int modelId) {
return true;
}
}
@@ -0,0 +1,38 @@
package ab.client.render.block;
import org.lwjgl.opengl.GL11;
import ab.client.render.tile.RenderTileManaContainer;
import ab.common.block.tile.TileNidavellirForge;
import ab.common.lib.register.BlockListAB;
import cpw.mods.fml.client.registry.ISimpleBlockRenderingHandler;
import net.minecraft.block.Block;
import net.minecraft.client.renderer.RenderBlocks;
import net.minecraft.client.renderer.tileentity.TileEntityRendererDispatcher;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.world.IBlockAccess;
public class RenderBlockNidavellirForge implements ISimpleBlockRenderingHandler {
public void renderInventoryBlock(Block block, int metadata, int modelID, RenderBlocks renderer) {
GL11.glPushMatrix();
GL11.glTranslatef(-0.5F, -0.375F, -0.5F);
GL11.glScalef(1.25f, 1.25f, 1.25f);
TileNidavellirForge forge = new TileNidavellirForge();
RenderTileManaContainer.metadata = metadata;
TileEntityRendererDispatcher.instance.renderTileEntityAt((TileEntity)forge, 0.0D, 0.0D, 0.0D, 0.0F);
GL11.glPopMatrix();
}
public boolean renderWorldBlock(IBlockAccess world, int x, int y, int z, Block block, int modelId, RenderBlocks renderer) {
return false;
}
public int getRenderId() {
return BlockListAB.blockABPlateRI;
}
public boolean shouldRender3DInInventory(int modelId) {
return true;
}
}
@@ -0,0 +1,15 @@
package ab.client.render.entity;
import net.minecraft.client.entity.AbstractClientPlayer;
import net.minecraft.client.renderer.entity.Render;
import net.minecraft.entity.Entity;
import net.minecraft.util.ResourceLocation;
public class EntityNullRender extends Render {
public void doRender(Entity entity, double d, double d1, double d2, float f, float f1) {}
protected ResourceLocation getEntityTexture(Entity entity) {
return AbstractClientPlayer.locationStevePng;
}
}
@@ -0,0 +1,20 @@
package ab.client.render.entity;
import ab.common.entity.EntityAdvancedSpark;
import ab.common.item.ItemAdvancedSpark;
import ab.common.lib.register.ItemListAB;
import net.minecraft.util.IIcon;
import vazkii.botania.client.render.entity.RenderSparkBase;
import vazkii.botania.common.item.ItemSparkUpgrade;
public class RenderEntityAdvancedSpark extends RenderSparkBase<EntityAdvancedSpark> {
public IIcon getSpinningIcon(EntityAdvancedSpark entity) {
int upgrade = entity.getUpgrade() - 1;
return (upgrade >= 0 && upgrade < ItemSparkUpgrade.worldIcons.length) ? ItemSparkUpgrade.worldIcons[upgrade] : null;
}
public IIcon getBaseIcon(EntityAdvancedSpark entity) {
return ItemAdvancedSpark.worldIcon;
}
}
@@ -0,0 +1,58 @@
package ab.client.render.entity;
import java.awt.Color;
import java.util.Random;
import org.lwjgl.opengl.GL11;
import ab.client.core.ClientHelper;
import ab.common.block.BlockLebethronWood;
import ab.common.lib.register.BlockListAB;
import net.minecraft.block.Block;
import net.minecraft.client.Minecraft;
import net.minecraft.client.entity.AbstractClientPlayer;
import net.minecraft.client.renderer.ItemRenderer;
import net.minecraft.client.renderer.OpenGlHelper;
import net.minecraft.client.renderer.RenderBlocks;
import net.minecraft.client.renderer.Tessellator;
import net.minecraft.client.renderer.entity.Render;
import net.minecraft.client.renderer.texture.TextureMap;
import net.minecraft.entity.Entity;
import net.minecraft.entity.item.EntityItem;
import net.minecraft.item.ItemStack;
import net.minecraft.util.IIcon;
import net.minecraft.util.ResourceLocation;
import net.minecraft.world.World;
import net.minecraftforge.client.ForgeHooksClient;
import net.minecraftforge.client.IItemRenderer.ItemRendererHelper;
import vazkii.botania.client.core.handler.ClientTickHandler;
public class RenderEntityAlphirinePortal extends Render {
public void doRender(Entity entity, double x, double y, double z, float fl, float fl1) {
double worldTime = (entity.worldObj == null) ? 0.0D : (ClientTickHandler.ticksInGame + fl1);
if(entity != null)
worldTime += (new Random(((int)entity.posX ^ (int)entity.posY ^ (int)entity.posZ))).nextInt(360);
Minecraft mc = Minecraft.getMinecraft();
float burn = Math.min(1.0f, entity.ticksExisted * 0.0561f);
GL11.glPushMatrix();
GL11.glTranslated(x, y, z);
GL11.glEnable(3042);
GL11.glBlendFunc(770, 771);
burn = Math.max(0.0f, (float)(burn + (Math.sin(worldTime / 3.2f) / 9.0f)));
GL11.glScalef(burn / 3.15f, burn / 3.15f, burn / 3.15f);
GL11.glRotatef(180.0f - this.renderManager.playerViewY, 0.0f, 1.0f, 0.0f);
GL11.glRotatef(-this.renderManager.playerViewX, 1.0f, 0.0f, 0.0f);
GL11.glDisable(GL11.GL_CULL_FACE);
mc.renderEngine.bindTexture(TextureMap.locationBlocksTexture);
ClientHelper.setLightmapTextureCoords();
ClientHelper.renderIcon(BlockLebethronWood.iconPortal, 220);
GL11.glEnable(GL11.GL_CULL_FACE);
GL11.glDisable(3042);
GL11.glPopMatrix();
}
protected ResourceLocation getEntityTexture(Entity entity) {
return AbstractClientPlayer.locationStevePng;
}
}
@@ -0,0 +1,58 @@
package ab.client.render.item;
import org.lwjgl.opengl.GL11;
import ab.common.item.ItemAntigravityCharm;
import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.ItemRenderer;
import net.minecraft.client.renderer.OpenGlHelper;
import net.minecraft.client.renderer.Tessellator;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.util.IIcon;
import net.minecraftforge.client.IItemRenderer;
import vazkii.botania.common.core.helper.ItemNBTHelper;
public class RenderItemAntigravityCharm implements IItemRenderer {
public boolean handleRenderType(ItemStack item, IItemRenderer.ItemRenderType type) {
return true;
}
public boolean shouldUseRenderHelper(IItemRenderer.ItemRenderType type, ItemStack item, IItemRenderer.ItemRendererHelper helper) {
return (helper == IItemRenderer.ItemRendererHelper.ENTITY_ROTATION || helper == IItemRenderer.ItemRendererHelper.ENTITY_BOBBING);
}
public void renderItem(IItemRenderer.ItemRenderType type, ItemStack item, Object... data) {
int dmg = item.getItemDamage();
IIcon icon = ItemAntigravityCharm.icons[0];
IIcon iconIsland = ItemAntigravityCharm.icons[1];
GL11.glPushMatrix();
if(type == type.INVENTORY) {
GL11.glScalef(16, 16, 16);
GL11.glRotatef(180, 0, 0, 1);
GL11.glTranslatef(-1.0f, -1.0f, 0);
} else if(type == type.ENTITY) {
GL11.glTranslatef(-0.5F, 0.0F, 0.0F);
if (item.isOnItemFrame())
GL11.glTranslatef(0.0F, -0.3F, 0.01F);
}
GL11.glEnable(GL11.GL_BLEND);
OpenGlHelper.glBlendFunc(770, 771, 1, 0);
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
ItemRenderer.renderItemIn2D(Tessellator.instance, icon.getMaxU(), icon.getMinV(), icon.getMinU(), icon.getMaxV(), icon.getIconWidth(), icon.getIconHeight(), 0.0625F);
double time = (double) Minecraft.getSystemTime();
if(type != type.INVENTORY) {
GL11.glScalef(1.0f, 1.0f, 1.05f);
GL11.glTranslated(0.0f, 0.0f, 0.0015625f);
}
if(ItemNBTHelper.getBoolean(item, "isActive", true)) {
GL11.glTranslated(0, Math.cos(time / 650.0) * 0.0075 -0.05f, 0.0f);
} else {
GL11.glTranslated(0.0f, -0.125f, 0.0f);
}
ItemRenderer.renderItemIn2D(Tessellator.instance, iconIsland.getMaxU(), iconIsland.getMinV(), iconIsland.getMinU(), iconIsland.getMaxV(), iconIsland.getIconWidth(), iconIsland.getIconHeight(), 0.0625F);
GL11.glDisable(GL11.GL_BLEND);
GL11.glPopMatrix();
}
}
@@ -0,0 +1,56 @@
package ab.client.render.item;
import org.lwjgl.opengl.GL11;
import ab.common.item.relic.ItemSphereNavigation;
import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.ItemRenderer;
import net.minecraft.client.renderer.OpenGlHelper;
import net.minecraft.client.renderer.Tessellator;
import net.minecraft.item.ItemStack;
import net.minecraft.util.IIcon;
import net.minecraftforge.client.IItemRenderer;
import vazkii.botania.common.core.helper.ItemNBTHelper;
public class RenderItemSphereNavigation implements IItemRenderer {
public boolean handleRenderType(ItemStack item, IItemRenderer.ItemRenderType type) {
return true;
}
public boolean shouldUseRenderHelper(IItemRenderer.ItemRenderType type, ItemStack item, IItemRenderer.ItemRendererHelper helper) {
return (helper == IItemRenderer.ItemRendererHelper.ENTITY_ROTATION || helper == IItemRenderer.ItemRendererHelper.ENTITY_BOBBING);
}
public void renderItem(IItemRenderer.ItemRenderType type, ItemStack stack, Object... data) {
GL11.glPushMatrix();
if(type == type.INVENTORY) {
GL11.glScalef(16, 16, 16);
GL11.glRotatef(180, 0, 0, 1);
GL11.glTranslatef(-1.0f, -1.0f, 0);
} else if(type == type.ENTITY) {
GL11.glTranslatef(-0.5F, 0.0F, 0.0F);
if(stack.isOnItemFrame())
GL11.glTranslatef(0.0F, -0.3F, 0.01F);
}
GL11.glEnable(GL11.GL_BLEND);
OpenGlHelper.glBlendFunc(770, 771, 1, 0);
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
IIcon icon = ItemSphereNavigation.icons[0];
ItemRenderer.renderItemIn2D(Tessellator.instance, icon.getMaxU(), icon.getMinV(), icon.getMinU(), icon.getMaxV(), icon.getIconWidth(), icon.getIconHeight(), 0.0625F);
IIcon iconEnable = ItemSphereNavigation.icons[stack.getItemDamage() == 0 ? 4 : 3];
ItemRenderer.renderItemIn2D(Tessellator.instance, iconEnable.getMaxU(), iconEnable.getMinV(), iconEnable.getMinU(), iconEnable.getMaxV(), iconEnable.getIconWidth(), iconEnable.getIconHeight(), 0.0625F);
double time = (double) Minecraft.getSystemTime();
if(type != type.INVENTORY) {
GL11.glScalef(1.0f, 1.0f, 1.05f);
GL11.glTranslated(0.0f, 0.0f, 0.0015625f);
}
IIcon iconBlock = ItemSphereNavigation.icons[ItemSphereNavigation.getFindBlock(stack) != null ? 1 : 2];
if(ItemSphereNavigation.getFindBlock(stack) != null) {
GL11.glTranslated(0, Math.cos(time / 650.0) * 0.0075 - 0.015f, 0.0f);
}
ItemRenderer.renderItemIn2D(Tessellator.instance, iconBlock.getMaxU(), iconBlock.getMinV(), iconBlock.getMinU(), iconBlock.getMaxV(), iconBlock.getIconWidth(), iconBlock.getIconHeight(), 0.0625F);
GL11.glDisable(GL11.GL_BLEND);
GL11.glPopMatrix();
}
}
@@ -0,0 +1,90 @@
package ab.client.render.tile;
import org.lwjgl.opengl.GL11;
import ab.common.block.tile.TileABSpreader;
import net.minecraft.block.Block;
import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.RenderBlocks;
import net.minecraft.client.renderer.texture.TextureMap;
import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer;
import net.minecraft.init.Blocks;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.ResourceLocation;
import vazkii.botania.api.mana.ILens;
import vazkii.botania.client.core.handler.ClientTickHandler;
import vazkii.botania.client.core.proxy.ClientProxy;
import vazkii.botania.client.model.ModelSpreader;
import vazkii.botania.client.render.item.RenderLens;
public class RenderTileABSpreader extends TileEntitySpecialRenderer {
private static final ResourceLocation texture_0 = new ResourceLocation("ab:textures/model/lebethronSpreader.png");
private static final ResourceLocation texture_1 = new ResourceLocation("ab:textures/model/lebethronSpreader_halloween.png");
private static final ModelSpreader model = new ModelSpreader();
public void renderTileEntityAt(final TileEntity tileentity, final double x, final double y, final double z, final float ticks) {
TileABSpreader spreader = (TileABSpreader)tileentity;
GL11.glPushMatrix();
GL11.glEnable(32826);
GL11.glColor4f(1.0f, 1.0f, 1.0f, 1.0f);
GL11.glTranslated(x, y, z);
GL11.glTranslatef(0.5f, 1.5f, 0.5f);
GL11.glRotatef(spreader.rotationX + 90.0f, 0.0f, 1.0f, 0.0f);
GL11.glTranslatef(0.0f, -1.0f, 0.0f);
GL11.glRotatef(spreader.rotationY, 1.0f, 0.0f, 0.0f);
GL11.glTranslatef(0.0f, 1.0f, 0.0f);
if (!ClientProxy.dootDoot)
Minecraft.getMinecraft().renderEngine.bindTexture(texture_0);
else
Minecraft.getMinecraft().renderEngine.bindTexture(texture_1);
GL11.glScalef(1.0f, -1.0f, -1.0f);
double time = ClientTickHandler.ticksInGame + ticks;
model.render();
GL11.glColor3f(1.0f, 1.0f, 1.0f);
GL11.glPushMatrix();
final double worldTicks = (tileentity.getWorldObj() == null) ? 0.0 : time;
GL11.glRotatef((float)worldTicks % 360.0f, 0.0f, 1.0f, 0.0f);
GL11.glTranslatef(0.0f, (float)Math.sin(worldTicks / 20.0) * 0.05f, 0.0f);
model.renderCube();
GL11.glPopMatrix();
GL11.glScalef(1.0f, -1.0f, -1.0f);
final ItemStack stack = spreader.getStackInSlot(0);
if (stack != null) {
Minecraft.getMinecraft().renderEngine.bindTexture(TextureMap.locationItemsTexture);
final ILens lens = (ILens)stack.getItem();
GL11.glPushMatrix();
GL11.glTranslatef(-0.4f, -1.4f, -0.4375f);
GL11.glScalef(0.8f, 0.8f, 0.8f);
RenderLens.render(stack, lens.getLensColor(stack));
GL11.glPopMatrix();
}
if (spreader.paddingColor != -1) {
Minecraft.getMinecraft().renderEngine.bindTexture(TextureMap.locationBlocksTexture);
final Block block = Blocks.carpet;
final int color2 = spreader.paddingColor;
final RenderBlocks render = RenderBlocks.getInstance();
final float f = 0.0625f;
GL11.glTranslatef(0.0f, -f, 0.0f);
render.renderBlockAsItem(block, color2, 1.0f);
GL11.glTranslatef(0.0f, -f * 15.0f, 0.0f);
render.renderBlockAsItem(block, color2, 1.0f);
GL11.glRotatef(90.0f, 1.0f, 0.0f, 0.0f);
GL11.glRotatef(90.0f, 0.0f, 1.0f, 0.0f);
GL11.glPushMatrix();
GL11.glScalef(f * 14.0f, 1.0f, 1.0f);
render.renderBlockAsItem(block, color2, 1.0f);
GL11.glPopMatrix();
GL11.glRotatef(90.0f, 1.0f, 0.0f, 0.0f);
GL11.glTranslatef(0.0f, 0.0f, -f / 2.0f);
GL11.glScalef(f * 14.0f, 1.0f, f * 15.0f);
render.renderBlockAsItem(block, color2, 1.0f);
GL11.glTranslatef(0.0f, f * 15.0f, 0.0f);
render.renderBlockAsItem(block, color2, 1.0f);
}
GL11.glEnable(32826);
GL11.glPopMatrix();
}
}
@@ -0,0 +1,77 @@
package ab.client.render.tile;
import java.util.Random;
import org.lwjgl.opengl.GL11;
import ab.client.model.ModelDiceFate;
import ab.common.block.tile.TileBoardFate;
import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.entity.RenderManager;
import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.ResourceLocation;
import vazkii.botania.client.core.handler.ClientTickHandler;
public class RenderTileBoardFate extends TileEntitySpecialRenderer {
private static final ModelDiceFate model = new ModelDiceFate();
private static final ResourceLocation texture = new ResourceLocation("ab:textures/model/diceFate.png");
public void renderTileEntityAt(TileEntity tile, double x, double y, double z, float ticks) {
double time = (tile.getWorldObj() == null) ? 0.0D : (ClientTickHandler.ticksInGame + ticks);
if(tile != null)
time += (new Random((tile.xCoord ^ tile.yCoord ^ tile.zCoord))).nextInt(360);
TileBoardFate board = (TileBoardFate)tile;
GL11.glEnable(3042);
GL11.glEnable(32826);
GL11.glBlendFunc(770, 771);
GL11.glPushMatrix();
GL11.glTranslated(x + 0.5f, y, z + 0.5f);
GL11.glRotatef(90.0f - RenderManager.instance.playerViewY, 0.0f, 1.0f, 0.0f);
for(int i = 0; i < board.getSizeInventory(); i++) {
if(board.getStackInSlot(i) == null)
continue;
time += i * 83.256f;
GL11.glPushMatrix();
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
float dropAnim = (1.0f - (Math.min(150.0f, (board.clientTick[i] * board.clientTick[i] * 1.42f) + ticks) / 150.0f));
dropAnim = Math.min(1.0f, Math.max(dropAnim, 0.0f));
float alpha = (float)Math.cos(dropAnim);
float indet = i == 0 ? 0.16f + (0.08f * dropAnim) : -0.16f - (0.08f * dropAnim);
GL11.glTranslated(indet, 0.02f + Math.sin(time / 12.0D) / 48.0D + (0.28f * dropAnim), indet);
GL11.glScalef(0.25f, 0.25f, 0.25f);
GL11.glColor4f(1.0F, 1.0F, 1.0F, alpha);
Minecraft.getMinecraft().renderEngine.bindTexture(texture);
float dropAngel = 70.0f * dropAnim;
switch(board.slotChance[i]) {
case 1:
model.render(180.0f + dropAngel, 0.0f + dropAngel, 0.0f);
break;
case 2:
model.render(0.0f + dropAngel, 0.0f + dropAngel, 0.0f);
break;
case 3:
model.render(90.0f + dropAngel, 0.0f + dropAngel, 0.0f);
break;
case 4:
model.render(270.0f + dropAngel, 0.0f + dropAngel, 0.0f);
break;
case 5:
model.render(0.0f + dropAngel, 0.0f + dropAngel, 270.0f);
break;
case 6:
model.render(0.0f + dropAngel, 0.0f + dropAngel, 90.0f);
break;
default:
model.render(0.0f + dropAngel, 0.0f + dropAngel, 0.0f);
break;
}
GL11.glEnable(32826);
GL11.glPopMatrix();
}
GL11.glPopMatrix();
GL11.glEnable(32826);
GL11.glDisable(3042);
}
}
@@ -0,0 +1,35 @@
package ab.client.render.tile;
import java.util.Random;
import org.lwjgl.opengl.GL11;
import ab.client.model.ModelEngineerHopper;
import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.ResourceLocation;
import vazkii.botania.client.core.handler.ClientTickHandler;
public class RenderTileEngineerHopper extends TileEntitySpecialRenderer {
private static final ModelEngineerHopper model = new ModelEngineerHopper();
private static final ResourceLocation texture = new ResourceLocation("ab:textures/model/engineerHopper.png");
public void renderTileEntityAt(TileEntity tile, double x, double y, double z, float ticks) {
double time = (tile.getWorldObj() == null) ? 0.0D : (ClientTickHandler.ticksInGame + ticks);
if(tile != null)
time += (new Random((tile.xCoord ^ tile.yCoord ^ tile.zCoord))).nextInt(360);
GL11.glPushMatrix();
GL11.glEnable(32826);
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
GL11.glTranslated(x, y, z);
GL11.glTranslatef(0.5f, 1.0625f, 0.5f);
GL11.glRotatef(180, 1.0f, 0.0f, 1.0f);
GL11.glScalef(0.7f, 0.7f, 0.7f);
Minecraft.getMinecraft().renderEngine.bindTexture(texture);
model.renderHoper(time);
GL11.glEnable(32826);
GL11.glPopMatrix();
}
}
@@ -0,0 +1,96 @@
package ab.client.render.tile;
import java.util.Random;
import org.lwjgl.opengl.GL11;
import ab.client.model.ModelDiceFate;
import ab.common.block.tile.TileGameBoard;
import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.entity.RenderManager;
import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.ResourceLocation;
import vazkii.botania.client.core.handler.ClientTickHandler;
public class RenderTileGameBoard extends TileEntitySpecialRenderer {
private static final ModelDiceFate model = new ModelDiceFate();
private static final ResourceLocation texture = new ResourceLocation("ab:textures/model/gameDice.png");
private static final ResourceLocation textureEnemy = new ResourceLocation("ab:textures/model/gameDice_enemy.png");
public void renderTileEntityAt(TileEntity tile, double x, double y, double z, float ticks) {
double time = (tile.getWorldObj() == null) ? 0.0D : (ClientTickHandler.ticksInGame + ticks);
if(tile != null)
time += (new Random((tile.xCoord ^ tile.yCoord ^ tile.zCoord))).nextInt(360);
TileGameBoard board = (TileGameBoard)tile;
GL11.glEnable(3042);
GL11.glEnable(32826);
GL11.glBlendFunc(770, 771);
GL11.glPushMatrix();
GL11.glTranslated(x + 0.5f, y, z + 0.5f);
GL11.glRotatef(90.0f - RenderManager.instance.playerViewY, 0.0f, 1.0f, 0.0f);
for(int i = 0; i < board.slotChance.length; i++) {
if(board.slotChance[i] == 0)
continue;
time += i * 83.256f;
GL11.glPushMatrix();
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
float posX = 0.0f;
float posZ = 0.0f;
float dropAnim = (1.0f - (Math.min(150.0f, (board.clientTick[i] * board.clientTick[i] * 1.42f) + ticks) / 150.0f));
dropAnim = Math.min(1.0f, Math.max(dropAnim, 0.0f));
float alpha = (float)Math.cos(dropAnim);
GL11.glColor4f(1.0F, 1.0F, 1.0F, alpha);
switch(i) {
case 0:
posX = 0.16f + 0.08f * dropAnim;
posZ = 0.16f + 0.08f * dropAnim;
break;
case 1:
posX = -0.16f - 0.08f * dropAnim;
posZ = 0.16f + 0.08f * dropAnim;
break;
case 2:
posX = 0.16f + 0.08f * dropAnim;
posZ = -0.16f - 0.08f * dropAnim;
break;
case 3:
posX = -0.16f - 0.08f * dropAnim;
posZ = -0.16f - 0.08f * dropAnim;
break;
}
GL11.glTranslated(posX, 0.02f + Math.sin(time / 12.0D) / 48.0D + (0.28f * dropAnim), posZ);
GL11.glScalef(0.25f, 0.25f, 0.25f);
Minecraft.getMinecraft().renderEngine.bindTexture(i > 1 ? textureEnemy : texture);
float dropAngel = 70.0f * dropAnim;
switch(board.slotChance[i]) {
case 1:
model.render(180.0f + dropAngel, 0.0f + dropAngel, 0.0f);
break;
case 2:
model.render(0.0f + dropAngel, 0.0f + dropAngel, 0.0f);
break;
case 3:
model.render(90.0f + dropAngel, 0.0f + dropAngel, 0.0f);
break;
case 4:
model.render(270.0f + dropAngel, 0.0f + dropAngel, 0.0f);
break;
case 5:
model.render(0.0f + dropAngel, 0.0f + dropAngel, 270.0f);
break;
case 6:
model.render(0.0f + dropAngel, 0.0f + dropAngel, 90.0f);
break;
default:
model.render(0.0f + dropAngel, 0.0f + dropAngel, 0.0f);
break;
}
GL11.glPopMatrix();
}
GL11.glPopMatrix();
GL11.glEnable(32826);
GL11.glDisable(3042);
}
}
@@ -0,0 +1,134 @@
package ab.client.render.tile;
import java.util.Random;
import org.lwjgl.opengl.GL11;
import ab.common.block.BlockMagicCraftCrate;
import ab.common.block.tile.TileMagicCraftCrate;
import ab.common.lib.register.BlockListAB;
import net.minecraft.client.Minecraft;
import net.minecraft.client.model.ModelBase;
import net.minecraft.client.model.ModelRenderer;
import net.minecraft.client.renderer.Tessellator;
import net.minecraft.client.renderer.entity.RenderItem;
import net.minecraft.client.renderer.entity.RenderManager;
import net.minecraft.client.renderer.texture.TextureMap;
import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer;
import net.minecraft.entity.item.EntityItem;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.IIcon;
import net.minecraft.util.ResourceLocation;
import vazkii.botania.client.core.handler.ClientTickHandler;
public class RenderTileMagicCraftingCrate extends TileEntitySpecialRenderer {
private ModelCrateBook model = new ModelCrateBook();
public void renderTileEntityAt(TileEntity tile, double x, double y, double z, float fq) {
double time = (tile.getWorldObj() == null) ? 0.0D : (ClientTickHandler.ticksInGame + fq);
if(tile != null)
time += (new Random((tile.xCoord ^ tile.yCoord ^ tile.zCoord))).nextInt(360);
float f1 = 0.002f;
float f2 = 0.125f;
float f3 = 0.1875f;
float f4 = 0.25f;
TileMagicCraftCrate crate = (TileMagicCraftCrate) tile;
boolean[][] pattern = crate.getPattern();
GL11.glPushMatrix();
GL11.glEnable(GL11.GL_BLEND);
GL11.glDisable(GL11.GL_LIGHTING);
GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
Minecraft.getMinecraft().renderEngine.bindTexture(TextureMap.locationBlocksTexture);
Tessellator t = new Tessellator();
t.startDrawingQuads();
t.setColorRGBA_I(0xfc0195, 50);
IIcon icon = ((BlockMagicCraftCrate)BlockListAB.blockMagicCraftCrate).nothing;
float maxU = icon.getMaxU();
float maxV = icon.getMaxV();
float minU = icon.getMinU();
float minV = icon.getMinV();
boolean hasPattern = false;
for(int i = 0; i < 3; i++)
for(int j = 0; j < 3; j++) {
if(!pattern[i][j]) {
int i1 = 2 - i;
int j1 = 2 - j;
hasPattern = true;
t.addVertexWithUV(x + f4 + f3 * j1 + f2, y + 1 + f1, z + f4 + f3 * i1+ f2, maxU, maxV);
t.addVertexWithUV(x + f4 + f3 * j1 + f2, y + 1 + f1, z + f4 + f3 * i1, maxU, minV);
t.addVertexWithUV(x + f4 + f3 * j1, y + 1 + f1, z + f4 + f3 * i1, minU, minV);
t.addVertexWithUV(x + f4 + f3 * j1, y + 1 + f1, z + f4 + f3 * i1+ f2, minU, maxV);
float f0 = f2;
if(i == 0 && j == 1)
f0 = 0.0625f;
float minY = (float) (y + f4 + f3 * i1);
float maxY = minY + f0;
t.addVertexWithUV(x + f4 + f3 * j1, minY, z - f1, maxU, maxV);
t.addVertexWithUV(x + f4 + f3 * j1, maxY, z - f1, maxU, minV);
t.addVertexWithUV(x + f4 + f3 * j1 + f2, maxY, z - f1, minU, minV);
t.addVertexWithUV(x + f4 + f3 * j1 + f2, minY, z - f1, minU, maxV);
t.addVertexWithUV(x + 1 + f1, minY, z + f4 + f3 * j1, maxU, maxV);
t.addVertexWithUV(x + 1 + f1, maxY, z + f4 + f3 * j1, maxU, minV);
t.addVertexWithUV(x + 1 + f1, maxY, z + f4 + f3 * j1 + f2, minU, minV);
t.addVertexWithUV(x + 1 + f1, minY, z + f4 + f3 * j1 + f2, minU, maxV);
j1 = j;
t.addVertexWithUV(x - f1, minY, z + f4 + f3 * j1 + f2, maxU, maxV);
t.addVertexWithUV(x - f1, maxY, z + f4 + f3 * j1 + f2, maxU, minV);
t.addVertexWithUV(x - f1, maxY, z + f4 + f3 * j1, minU, minV);
t.addVertexWithUV(x - f1, minY, z + f4 + f3 * j1, minU, maxV);
t.addVertexWithUV(x + f4 + f3 * j1 + f2, minY, z + 1 + f1, maxU, maxV);
t.addVertexWithUV(x + f4 + f3 * j1 + f2, maxY, z + 1 + f1, maxU, minV);
t.addVertexWithUV(x + f4 + f3 * j1, maxY, z + 1 + f1, minU, minV);
t.addVertexWithUV(x + f4 + f3 * j1, minY, z + 1 + f1, minU, maxV);
}
}
t.draw();
GL11.glDisable(GL11.GL_BLEND);
GL11.glEnable(GL11.GL_LIGHTING);
GL11.glPopMatrix();
ItemStack wand = crate.getStackInSlot(10);
if(wand != null) {
GL11.glPushMatrix();
GL11.glTranslated(x + 0.5f, y + 1.12f + (Math.sin(time / 24.0D) / 40.0D - 0.05D), z + 0.275f);
GL11.glRotated(Math.sin(time / 24.0D) * 5.0f, 0.0f, 1.0f, 0.0f);
GL11.glRotatef(90.0f, 0.0f, 0.0f, 1.0f);
EntityItem entity = new EntityItem(tile.getWorldObj(), 0, -0.125, 0, wand.copy());
entity.hoverStart = 0.0f;
RenderItem.renderInFrame = true;
RenderManager.instance.renderEntityWithPosYaw(entity, 0, -0.285, 0, 0.0f, 0.0f);
RenderItem.renderInFrame = false;
GL11.glPopMatrix();
}
ItemStack book = crate.getStackInSlot(11);
if(book != null) {
GL11.glPushMatrix();
GL11.glTranslated(x + 0.7f, y + 0.825f + (Math.sin(-time / 24.0D) / 40.0D - 0.05D), z + 0.825f);
GL11.glRotatef(90.0f, 0.0f, 0.0f, 1.0f);
GL11.glRotatef(90.0f, 0.0f, 1.0f, 0.0f);
GL11.glRotated(Math.sin(-time / 24.0D) * 5.0f, 0.0f, 0.0f, 1.0f);
Minecraft.getMinecraft().renderEngine.bindTexture(model.texture);
model.render();
GL11.glPopMatrix();
}
}
public class ModelCrateBook extends ModelBase {
public final ResourceLocation texture = new ResourceLocation("thaumcraft:textures/models/fortress_armor.png");
private ModelRenderer Book;
public ModelCrateBook() {
textureWidth = 128;
textureHeight = 64;
Book = new ModelRenderer(this, 100, 8);
Book.addBox(1.0F, -0.3F, 4.0F, 5, 7, 2);
Book.setRotationPoint(0.0F, 0.0F, 0.0F);
Book.setTextureSize(128, 64);
}
public void render() {
Book.render(0.0625f);
}
}
}
@@ -0,0 +1,89 @@
package ab.client.render.tile;
import java.awt.Color;
import java.util.ArrayList;
import java.util.List;
import java.util.Random;
import org.lwjgl.opengl.GL11;
import ab.client.model.ModelManaCharger;
import ab.common.block.tile.TileManaCharger;
import net.minecraft.block.Block;
import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.ItemRenderer;
import net.minecraft.client.renderer.RenderBlocks;
import net.minecraft.client.renderer.Tessellator;
import net.minecraft.client.renderer.texture.TextureMap;
import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer;
import net.minecraft.entity.item.EntityItem;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.IIcon;
import net.minecraft.util.ResourceLocation;
import net.minecraftforge.client.ForgeHooksClient;
import vazkii.botania.client.core.handler.ClientTickHandler;
public class RenderTileManaCharger extends TileEntitySpecialRenderer {
private static final ResourceLocation texture = new ResourceLocation("ab:textures/model/manaCharger.png");
private static final ModelManaCharger model = new ModelManaCharger();
public TileManaCharger charger;
public void renderTileEntityAt(final TileEntity tile, final double x, final double y, final double z, final float ticks) {
this.charger = (TileManaCharger)tile;
double time = (tile.getWorldObj() == null) ? 0.0D : (ClientTickHandler.ticksInGame + ticks);
if (tile != null)
time += (new Random((tile.xCoord ^ tile.yCoord ^ tile.zCoord))).nextInt(360);
GL11.glPushMatrix();
GL11.glEnable(32826);
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
GL11.glTranslated(x, y, z);
GL11.glTranslatef(0.5f, 1.65f, 0.5f);
GL11.glRotatef(180, 1.0f, 0.0f, 1.0f);
Minecraft.getMinecraft().renderEngine.bindTexture(texture);
model.render(this, time);
GL11.glEnable(32826);
GL11.glPopMatrix();
}
public void renderItemStack(ItemStack stack) {
if (stack != null) {
Minecraft mc = Minecraft.getMinecraft();
mc.renderEngine.bindTexture((stack.getItem() instanceof net.minecraft.item.ItemBlock) ? TextureMap.locationBlocksTexture : TextureMap.locationItemsTexture);
float s = 0.25F;
GL11.glScalef(s, s, s);
GL11.glScalef(2.0F, 2.0F, 2.0F);
if (!ForgeHooksClient.renderEntityItem(new EntityItem(this.charger.getWorldObj(), this.charger.xCoord, this.charger.yCoord, this.charger.zCoord, stack), stack, 0.0F, 0.0F, (this.charger.getWorldObj()).rand, mc.renderEngine, RenderBlocks.getInstance(), 1)) {
GL11.glScalef(0.5F, 0.5F, 0.5F);
if (stack.getItem() instanceof net.minecraft.item.ItemBlock && RenderBlocks.renderItemIn3d(Block.getBlockFromItem(stack.getItem()).getRenderType())) {
GL11.glScalef(0.5F, 0.5F, 0.5F);
GL11.glTranslatef(1.0F, 1.1F, 0.0F);
GL11.glPushMatrix();
RenderBlocks.getInstance().renderBlockAsItem(Block.getBlockFromItem(stack.getItem()), stack.getItemDamage(), 1.0F);
GL11.glPopMatrix();
GL11.glTranslatef(-1.0F, -1.1F, 0.0F);
GL11.glScalef(2.0F, 2.0F, 2.0F);
} else {
int renderPass = 0;
do {
IIcon icon = stack.getItem().getIcon(stack, renderPass);
if (icon == null)
continue;
Color color = new Color(stack.getItem().getColorFromItemStack(stack, renderPass));
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(), 0.0625F);
GL11.glColor3f(1.0F, 1.0F, 1.0F);
++renderPass;
} while (renderPass < stack.getItem().getRenderPasses(stack.getItemDamage()));
}
}
GL11.glScalef(1.0F / s, 1.0F / s, 1.0F / s);
(Minecraft.getMinecraft()).renderEngine.bindTexture(texture);
}
}
}
@@ -0,0 +1,90 @@
package ab.client.render.tile;
import java.awt.Color;
import java.util.Random;
import org.lwjgl.opengl.GL11;
import ab.client.core.ClientHelper;
import ab.client.model.ModelManaContainer;
import ab.common.block.tile.TileManaContainer;
import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.Tessellator;
import net.minecraft.client.renderer.texture.TextureMap;
import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer;
import net.minecraft.entity.passive.EntitySheep;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.IIcon;
import net.minecraft.util.ResourceLocation;
import net.minecraft.world.World;
import vazkii.botania.client.core.handler.ClientTickHandler;
import vazkii.botania.client.core.helper.ShaderHelper;
import vazkii.botania.common.block.mana.BlockPool;
public class RenderTileManaContainer extends TileEntitySpecialRenderer {
private static final ResourceLocation texture = new ResourceLocation("ab:textures/model/mana_container.png");
private static final ResourceLocation texture1 = new ResourceLocation("ab:textures/model/mana_container1.png");
private static final ModelManaContainer model = new ModelManaContainer();
public static int metadata;
public void renderTileEntityAt(TileEntity tileentity, double x, double y, double z, float ticks) {
TileManaContainer container = (TileManaContainer)tileentity;
double worldTime = (tileentity.getWorldObj() == null) ? 0.0D : (ClientTickHandler.ticksInGame + ticks);
if(tileentity != null)
worldTime += (new Random((tileentity.xCoord ^ tileentity.yCoord ^ tileentity.zCoord))).nextInt(360);
boolean dil = (tileentity.getWorldObj() == null) ? ((metadata == 1)) : ((tileentity.getBlockMetadata() == 1));
boolean fab = (tileentity.getWorldObj() == null) ? ((metadata == 2)) : ((tileentity.getBlockMetadata() == 2));
GL11.glPushMatrix();
GL11.glEnable(32826);
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
GL11.glTranslated(x, y, z);
GL11.glTranslatef(0.5f, 1.075f, 0.5f);
GL11.glScalef(0.7f, 0.7f, 0.7f);
GL11.glRotatef((float)worldTime * 0.375F, 0.0F, 1.0F, 0.0F);
GL11.glTranslated(0.0D, Math.sin(worldTime / 80.0D) / 20.0D - 0.025D, 0.0D);
GL11.glRotatef(180, 1.0f, 0.0f, 1.0f);
if(fab) {
float time = ClientTickHandler.ticksInGame + ClientTickHandler.partialTicks;
if(tileentity != null)
time += (new Random((tileentity.xCoord ^ tileentity.yCoord ^ tileentity.zCoord))).nextInt(100000);
Color color = Color.getHSBColor((float)(time * 0.005F), 0.6F, 1.0F);
GL11.glColor4ub((byte)color.getRed(), (byte)color.getGreen(), (byte)color.getBlue(), (byte)-1);
}
Minecraft.getMinecraft().renderEngine.bindTexture(dil ? texture1 : texture);
model.render();
renderMana(tileentity.getWorldObj(), container);
GL11.glEnable(32826);
GL11.glPopMatrix();
metadata = 0;
}
public void renderMana(World world, TileManaContainer container) {
if(world != null) {
(Minecraft.getMinecraft()).renderEngine.bindTexture(TextureMap.locationBlocksTexture);
int mana = container.getCurrentMana();
int cap = container.getMaxMana();
float waterLevel = ((float)mana / (float)cap) * 0.8F;
float v = 0.125F;
float w = -v * 3.5F;
if(waterLevel > 0.0F) {
float s = 0.5f;
GL11.glPushMatrix();
GL11.glEnable(3042);
GL11.glBlendFunc(770, 771);
GL11.glDisable(3008);
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0f);
GL11.glScalef(s, s, s);
GL11.glTranslatef(0.0f, 1.71F - waterLevel, -0.25f);
GL11.glRotatef(90.0F, 1.0F, 0.0F, 0.0F);
ShaderHelper.useShader(ShaderHelper.manaPool);
ClientHelper.renderIcon(BlockPool.manaIcon, 240);
ShaderHelper.releaseShader();
GL11.glEnable(3008);
GL11.glDisable(3042);
GL11.glPopMatrix();
}
}
}
}
@@ -0,0 +1,59 @@
package ab.client.render.tile;
import org.lwjgl.opengl.GL11;
import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.entity.Render;
import net.minecraft.client.renderer.entity.RenderManager;
import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer;
import net.minecraft.entity.Entity;
import net.minecraft.entity.item.EntityItem;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.ResourceLocation;
import vazkii.botania.client.core.handler.ClientTickHandler;
import vazkii.botania.client.model.ModelCrystalCube;
import vazkii.botania.common.item.ModItems;
public class RenderTileManaCrystalCube extends TileEntitySpecialRenderer {
private static final ResourceLocation texture = new ResourceLocation("ab:textures/model/crystalCube.png");
private static final ModelCrystalCube model = new ModelCrystalCube();
private EntityItem entity = null;
public void renderTileEntityAt(TileEntity tile, double d0, double d1, double d2, float f) {
if(this.entity == null)
this.entity = new EntityItem(tile.getWorldObj(), tile.xCoord, tile.yCoord, tile.zCoord, new ItemStack(ModItems.twigWand));
this.entity.age = ClientTickHandler.ticksInGame;
double time = (ClientTickHandler.ticksInGame + f);
double worldTicks = (tile.getWorldObj() == null) ? 0.0D : time;
Minecraft mc = Minecraft.getMinecraft();
GL11.glPushMatrix();
GL11.glEnable(32826);
GL11.glEnable(3042);
GL11.glBlendFunc(770, 771);
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
GL11.glTranslated(d0, d1, d2);
mc.renderEngine.bindTexture(texture);
GL11.glTranslatef(0.5F, 1.5F, 0.5F);
GL11.glScalef(1.0F, -1.0F, -1.0F);
this.model.renderBase();
GL11.glTranslatef(0.0F, (float)Math.sin(worldTicks / 20.0D) * 0.05F, 0.0F);
if(tile.getWorldObj() != null) {
GL11.glPushMatrix();
float s = 0.5F;
GL11.glTranslatef(0.0F, 0.8F, 0.0F);
GL11.glScalef(s, s, s);
GL11.glRotatef(180.0F, 0.0F, 0.0F, 1.0F);
((Render)RenderManager.instance.entityRenderMap.get(EntityItem.class)).doRender((Entity)this.entity, 0.0D, 0.0D, 0.0D, 1.0F, f);
GL11.glPopMatrix();
mc.renderEngine.bindTexture(texture);
}
GL11.glColor4f(1.0F, 1.0F, 1.0F, 0.4F);
this.model.renderCube();
GL11.glColor3f(1.0F, 1.0F, 1.0F);
GL11.glScalef(1.0F, -1.0F, -1.0F);
GL11.glEnable(32826);
GL11.glPopMatrix();
}
}
@@ -0,0 +1,101 @@
package ab.client.render.tile;
import java.util.ArrayList;
import java.util.List;
import java.util.Random;
import org.lwjgl.opengl.GL11;
import ab.client.model.ModelNidavellirForge;
import ab.common.block.tile.TileNidavellirForge;
import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.OpenGlHelper;
import net.minecraft.client.renderer.Tessellator;
import net.minecraft.client.renderer.entity.Render;
import net.minecraft.client.renderer.entity.RenderManager;
import net.minecraft.client.renderer.texture.TextureMap;
import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer;
import net.minecraft.entity.Entity;
import net.minecraft.entity.item.EntityItem;
import net.minecraft.item.ItemBlock;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.IIcon;
import net.minecraft.util.ResourceLocation;
import vazkii.botania.client.core.handler.ClientTickHandler;
import vazkii.botania.client.core.helper.ShaderHelper;
import vazkii.botania.common.block.mana.BlockTerraPlate;
public class RenderTileNidavellirForge extends TileEntitySpecialRenderer {
private List<EntityItem> entityList = null;
private static final ResourceLocation texture = new ResourceLocation("ab:textures/model/nidavellirForge.png");
private static final ModelNidavellirForge model = new ModelNidavellirForge();
public void renderTileEntityAt(TileEntity tileentity, double x, double y, double z, float f) {
TileNidavellirForge tile = (TileNidavellirForge)tileentity;
double worldTime = 0.0D;
int meta = 2;
float invRender = 0.0f;
if(tileentity != null && tileentity.getWorldObj() != null) {
worldTime = ClientTickHandler.ticksInGame + f + (new Random((tileentity.xCoord ^ tileentity.yCoord ^ tileentity.zCoord))).nextInt(360);
meta = tileentity.getWorldObj().getBlockMetadata(tileentity.xCoord, tileentity.yCoord, tileentity.zCoord);
} else
invRender = 0.0875f;
float indetY = (float)(Math.sin(worldTime / 18.0D) / 24.0D);
GL11.glPushMatrix();
GL11.glEnable(32826);
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
GL11.glTranslated(x - invRender, y, z);
GL11.glTranslatef(0.5f, 1.5f, 0.5f);
GL11.glRotatef(180.0f, 1.0f, 0.0f, 1.0f);
GL11.glRotatef(90.0f * meta, 0.0f, 1.0f, 0.0f);
Minecraft.getMinecraft().renderEngine.bindTexture(texture);
model.renderBottom();
GL11.glTranslatef(0.0f, indetY, 0.0f);
model.renderTop();
GL11.glEnable(32826);
GL11.glPopMatrix();
if(entityList == null) {
List<EntityItem> list = new ArrayList();
for(int i = 0; i < tile.getSizeInventory(); i++) {
list.add(new EntityItem(tile.getWorldObj(), tile.xCoord, tile.yCoord, tile.zCoord));
}
entityList = list;
}
GL11.glPushMatrix();
GL11.glTranslated(x + 0.5f, y + 0.675f - indetY, z + 0.5f);
GL11.glScalef(0.2F, 0.225F, 0.225F);
for(int i = 1; i < entityList.size(); i++) {
GL11.glPushMatrix();
ItemStack stack = tile.getStackInSlot(i);
if(stack != null) {
switch(i) {
case 1:
GL11.glTranslated(0.15f, 0.0f, 0.0f);
break;
case 2:
GL11.glTranslated(-0.15f, 0.0f, -0.15f);
break;
case 3:
GL11.glTranslated(-0.15f, 0.0f, 0.15f);
break;
}
entityList.get(i).setEntityItemStack(stack);
entityList.get(i).age = ClientTickHandler.ticksInGame;
((Render)RenderManager.instance.entityRenderMap.get(EntityItem.class)).doRender((Entity)entityList.get(i), 0.0D, 0.0D, 0.0D, 1.0F, f);
}
GL11.glPopMatrix();
}
GL11.glPopMatrix();
if(tile.getStackInSlot(0) != null) {
GL11.glPushMatrix();
GL11.glTranslated(x + 0.5, y + 0.915f - indetY, z + 0.5);
GL11.glScalef(0.45f, 0.45f, 0.45f);
entityList.get(0).setEntityItemStack(tile.getStackInSlot(0));
entityList.get(0).age = ClientTickHandler.ticksInGame;
((Render)RenderManager.instance.entityRenderMap.get(EntityItem.class)).doRender((Entity)entityList.get(0), 0.0D, 0.0D, 0.0D, 1.0F, f);
GL11.glPopMatrix();
}
}
}
@@ -0,0 +1,111 @@
package ab.client.render.tile;
import net.minecraft.client.renderer.Tessellator;
import net.minecraft.util.IIcon;
public class TileRenderer {
public static void renderCube(double xCenter, double yCenter, double zCenter, double r, IIcon icon, Tessellator t) {
renderCube(xCenter, yCenter, zCenter, r, icon, t, 0.0f);
}
public static void renderLateralSides(double xCenter, double yCenter, double zCenter, double r, IIcon icon, Tessellator t) {
renderLateralSides(xCenter, yCenter, zCenter, r, icon, t, 0.0f);
}
public static void renderUpperlSide(double xCenter, double yCenter, double zCenter, double r, IIcon icon, Tessellator t) {
renderUpperlSide(xCenter, yCenter, zCenter, r, icon, t, 0.0f);
}
public static void renderDownside(double xCenter, double yCenter, double zCenter, double r, IIcon icon, Tessellator t) {
renderUpperlSide(xCenter, yCenter, zCenter, r, icon, t, 0.0f);
}
public static void renderCube(double xCenter, double yCenter, double zCenter, double r, IIcon icon, Tessellator t, float sideOffset) {
renderLateralSides(xCenter, yCenter, zCenter, r, icon, t, sideOffset);
renderUpperlSide(xCenter, yCenter, zCenter, r, icon, t, sideOffset);
renderDownside(xCenter, yCenter, zCenter, r, icon, t, sideOffset);
}
public static void renderLateralSides(double xCenter, double yCenter, double zCenter, double r, IIcon icon, Tessellator t, float sideOffset) {
float maxU = icon.getMaxU();
float maxV = icon.getMaxV();
float minU = icon.getMinU();
float minV = icon.getMinV();
double minX = xCenter - r;
double minY = yCenter - r;
double minZ = zCenter - r;
double maxX = xCenter + r;
double maxY = yCenter + r;
double maxZ = zCenter + r;
t.addVertexWithUV(maxX, minY, maxZ + sideOffset, maxU, maxV);
t.addVertexWithUV(maxX, maxY, maxZ + sideOffset, maxU, minV);
t.addVertexWithUV(minX, maxY, maxZ + sideOffset, minU, minV);
t.addVertexWithUV(minX, minY, maxZ + sideOffset, minU, maxV);
t.addVertexWithUV(minX, minY, minZ - sideOffset, maxU, maxV);
t.addVertexWithUV(minX, maxY, minZ - sideOffset, maxU, minV);
t.addVertexWithUV(maxX, maxY, minZ - sideOffset, minU, minV);
t.addVertexWithUV(maxX, minY, minZ - sideOffset, minU, maxV);
t.addVertexWithUV(minX - sideOffset, minY, maxZ, maxU, maxV);
t.addVertexWithUV(minX - sideOffset, maxY, maxZ, maxU, minV);
t.addVertexWithUV(minX - sideOffset, maxY, minZ, minU, minV);
t.addVertexWithUV(minX - sideOffset, minY, minZ, minU, maxV);
t.addVertexWithUV(maxX + sideOffset, minY, minZ, maxU, maxV);
t.addVertexWithUV(maxX + sideOffset, maxY, minZ, maxU, minV);
t.addVertexWithUV(maxX + sideOffset, maxY, maxZ, minU, minV);
t.addVertexWithUV(maxX + sideOffset, minY, maxZ, minU, maxV);
}
public static void renderUpperlSide(double xCenter, double yCenter, double zCenter, double r, IIcon icon, Tessellator t, float sideOffset) {
float maxU = icon.getMaxU();
float maxV = icon.getMaxV();
float minU = icon.getMinU();
float minV = icon.getMinV();
double minX = xCenter - r;
double minY = yCenter - r;
double minZ = zCenter - r;
double maxX = xCenter + r;
double maxY = yCenter + r;
double maxZ = zCenter + r;
t.addVertexWithUV(maxX, maxY + sideOffset, maxZ, maxU, maxV);
t.addVertexWithUV(maxX, maxY + sideOffset, minZ, maxU, minV);
t.addVertexWithUV(minX, maxY + sideOffset, minZ, minU, minV);
t.addVertexWithUV(minX, maxY + sideOffset, maxZ, minU, maxV);
}
public static void renderDownside(double xCenter, double yCenter, double zCenter, double r, IIcon icon, Tessellator t, float sideOffset) {
float maxU = icon.getMaxU();
float maxV = icon.getMaxV();
float minU = icon.getMinU();
float minV = icon.getMinV();
double minX = xCenter - r;
double minY = yCenter - r;
double minZ = zCenter - r;
double maxX = xCenter + r;
double maxY = yCenter + r;
double maxZ = zCenter + r;
t.addVertexWithUV(minX, minY - sideOffset, minZ, maxU, maxV);
t.addVertexWithUV(maxX, minY - sideOffset, minZ, maxU, minV);
t.addVertexWithUV(maxX, minY - sideOffset, maxZ, minU, minV);
t.addVertexWithUV(minX, minY - sideOffset, maxZ, minU, maxV);
}
}
@@ -0,0 +1,172 @@
package ab.common.block;
import java.util.List;
import ab.AdvancedBotany;
import ab.common.block.tile.TileABSpreader;
import ab.common.lib.register.BlockListAB;
import ab.common.lib.register.RecipeListAB;
import net.minecraft.block.Block;
import net.minecraft.block.BlockContainer;
import net.minecraft.block.BlockPistonBase;
import net.minecraft.block.material.Material;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.ScaledResolution;
import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.item.EntityItem;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.init.Blocks;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.AxisAlignedBB;
import net.minecraft.util.IIcon;
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;
import vazkii.botania.api.lexicon.ILexiconable;
import vazkii.botania.api.lexicon.LexiconEntry;
import vazkii.botania.api.wand.IWandHUD;
import vazkii.botania.api.wand.IWandable;
import vazkii.botania.api.wand.IWireframeAABBProvider;
import vazkii.botania.common.item.ModItems;
public class BlockABSpreader extends BlockContainer implements IWandable, IWandHUD, IWireframeAABBProvider, ILexiconable {
public BlockABSpreader() {
super(Material.wood);
this.setCreativeTab(AdvancedBotany.tabAB);
this.setHardness(7.0F);
this.setStepSound(soundTypeWood);
this.setBlockName("advancedSpreader");
}
public void onBlockPlacedBy(World world, int x, int y, int z, EntityLivingBase liv, ItemStack stack) {
int orientation = BlockPistonBase.determineOrientation(world, x, y, z, liv);
TileABSpreader spreader = (TileABSpreader)world.getTileEntity(x, y, z);
world.setBlockMetadataWithNotify(x, y, z, stack.getItemDamage(), 3);
switch (orientation) {
case 0:
spreader.rotationY = -90.0F;
case 1:
spreader.rotationY = 90.0F;
case 2:
spreader.rotationX = 270.0F;
case 3:
spreader.rotationX = 90.0F;
case 4:
return;
}
spreader.rotationX = 180.0F;
}
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int par6, float par7, float par8, float par9) {
TileEntity tile = world.getTileEntity(x, y, z);
if (!(tile instanceof TileABSpreader))
return false;
TileABSpreader spreader = (TileABSpreader)tile;
ItemStack lens = spreader.getStackInSlot(0);
ItemStack heldItem = player.getCurrentEquippedItem();
boolean isHeldItemLens = (heldItem != null && heldItem.getItem() instanceof vazkii.botania.api.mana.ILens);
boolean wool = (heldItem != null && heldItem.getItem() == Item.getItemFromBlock(Blocks.wool));
if (heldItem != null && heldItem.getItem() == ModItems.twigWand)
return false;
if (lens == null && isHeldItemLens) {
if (!player.capabilities.isCreativeMode)
player.inventory.setInventorySlotContents(player.inventory.currentItem, null);
spreader.setInventorySlotContents(0, heldItem.copy());
spreader.markDirty();
} else if (lens != null && !wool) {
ItemStack add = lens.copy();
if (!player.inventory.addItemStackToInventory(add))
player.dropPlayerItemWithRandomChoice(add, false);
spreader.setInventorySlotContents(0, null);
spreader.markDirty();
}
if (wool && spreader.paddingColor == -1) {
spreader.paddingColor = heldItem.getItemDamage();
heldItem.stackSize--;
if (heldItem.stackSize == 0)
player.inventory.setInventorySlotContents(player.inventory.currentItem, null);
} else if (heldItem == null && spreader.paddingColor != -1 && lens == null) {
ItemStack pad = new ItemStack(Blocks.wool, 1, spreader.paddingColor);
if (!player.inventory.addItemStackToInventory(pad))
player.dropPlayerItemWithRandomChoice(pad, false);
spreader.paddingColor = -1;
spreader.markDirty();
}
return true;
}
public void breakBlock(World world, int x, int y, int z, Block par5, int par6) {
TileEntity tile = world.getTileEntity(x, y, z);
if (!(tile instanceof TileABSpreader))
return;
TileABSpreader inv = (TileABSpreader)tile;
if (inv != null) {
for (int i = 0; i < inv.getSizeInventory() + 1; i++) {
ItemStack stack = (i >= inv.getSizeInventory()) ? ((inv.paddingColor == -1) ? null : new ItemStack(Blocks.wool, 1, inv.paddingColor)) : inv.getStackInSlot(i);
if(stack != null) {
float spawnX = x + world.rand.nextFloat();
float spawnY = y + world.rand.nextFloat();
float spawnZ = z + world.rand.nextFloat();
EntityItem droppedItem = new EntityItem(world, spawnX, spawnY, spawnZ, stack);
float mult = 0.05F;
droppedItem.motionX = ((-0.5F + world.rand.nextFloat()) * mult);
droppedItem.motionY = ((4.0F + world.rand.nextFloat()) * mult);
droppedItem.motionZ = ((-0.5F + world.rand.nextFloat()) * mult);
if (stack.hasTagCompound())
droppedItem.getEntityItem().setTagCompound((NBTTagCompound)stack.getTagCompound().copy());
world.spawnEntityInWorld((Entity)droppedItem);
}
}
world.func_147453_f(x, y, z, par5);
}
super.breakBlock(world, x, y, z, par5, par6);
}
public IIcon getIcon(int par1, int par2) {
return BlockListAB.blockLebethron.getIcon(par1, 0);
}
public boolean isOpaqueCube() {
return false;
}
public boolean renderAsNormalBlock() {
return false;
}
public int getRenderType() {
return BlockListAB.blockABSpreaderRI;
}
public int getLightValue(IBlockAccess world, int x, int y, int z) {
return 12;
}
public TileEntity createNewTileEntity(World world, int meta) {
return new TileABSpreader();
}
public boolean onUsedByWand(EntityPlayer player, ItemStack stack, World world, int x, int y, int z, int side) {
((TileABSpreader)world.getTileEntity(x, y, z)).onWanded(player, stack);
return true;
}
public AxisAlignedBB getWireframeAABB(World world, int x, int y, int z) {
float f = 0.0625F;
return AxisAlignedBB.getBoundingBox((x + f), (y + f), (z + f), ((x + 1) - f), ((y + 1) - f), ((z + 1) - f));
}
public void renderHUD(Minecraft mc, ScaledResolution res, World world, int x, int y, int z) {
((TileABSpreader)world.getTileEntity(x, y, z)).renderHUD(mc, res);
}
public LexiconEntry getEntry(World arg0, int arg1, int arg2, int arg3, EntityPlayer arg4, ItemStack arg5) {
return RecipeListAB.lebethronSpreader;
}
}
@@ -0,0 +1,54 @@
package ab.common.block;
import java.util.List;
import ab.AdvancedBotany;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import net.minecraft.block.Block;
import net.minecraft.block.material.Material;
import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.util.IIcon;
import net.minecraft.world.IBlockAccess;
public class BlockABStorage extends Block {
private static IIcon[] icon = new IIcon[1];
public BlockABStorage() {
super(Material.iron);
this.setCreativeTab(AdvancedBotany.tabAB);
this.setHardness(3.0F);
this.setResistance(10.0F);
this.setStepSound(soundTypeMetal);
this.setBlockName("abStorage");
}
public void getSubBlocks(Item par1, CreativeTabs par2CreativeTabs, List list) {
for(int i = 0; i < icon.length; i++) {
list.add(new ItemStack(par1, 1, i));
}
}
@SideOnly(Side.CLIENT)
public void registerBlockIcons(IIconRegister ir) {
for (int i = 0; i < icon.length; i++)
icon[i] = ir.registerIcon("ab:abStorage_" + i);
}
@SideOnly(Side.CLIENT)
public IIcon getIcon(int side, int meta) {
return this.icon[meta];
}
public int damageDropped(int par1) {
return par1;
}
public boolean isBeaconBase(IBlockAccess worldObj, int x, int y, int z, int beaconX, int beaconY, int beaconZ) {
return true;
}
}
@@ -0,0 +1,62 @@
package ab.common.block;
import java.util.Random;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import net.minecraft.block.Block;
import net.minecraft.block.material.Material;
import net.minecraft.util.AxisAlignedBB;
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;
import vazkii.botania.common.Botania;
public class BlockAntigravitation extends Block {
public BlockAntigravitation() {
super(Material.ground);
this.setHardness(-1.0f);
this.setTickRandomly(true);
this.useNeighborBrightness = false;
}
public boolean isReplaceable(IBlockAccess world, int x, int y, int z) {
return true;
}
public int getRenderType() {
return -1;
}
public AxisAlignedBB getCollisionBoundingBoxFromPool(World world, int x, int y, int z) {
return null;
}
public boolean renderAsNormalBlock() {
return false;
}
public boolean isOpaqueCube() {
return false;
}
public boolean canCollideCheck(int p_149678_1_, boolean p_149678_2_) {
return false;
}
public void dropBlockAsItemWithChance(World p_149690_1_, int p_149690_2_, int p_149690_3_, int p_149690_4_, int p_149690_5_, float p_149690_6_, int p_149690_7_) {}
public void onNeighborBlockChange(World world, int x, int y, int z, Block block) {
if(world.isAirBlock(x, y + 1, z))
world.setBlockToAir(x, y, z);
}
@SideOnly(Side.CLIENT)
public void randomDisplayTick(World world, int x, int y, int z, Random random) {
if(random.nextBoolean()) {
float r = random.nextInt(128) / 255.0f;
float g = (random.nextInt(128) + 70) / 255.0f;
float b = 200.0f / 255.0f;
Botania.proxy.wispFX(world, x + 0.1f + Math.random() * 0.8f, y - 0.18f + 1.0f, z + 0.1 + Math.random() * 0.8, r, g, b, 0.24F * (float)(Math.random() - 0.5D), 0.0f, (float)(0.001f + Math.random() * 0.01f), 0.0f);
}
}
}
@@ -0,0 +1,165 @@
package ab.common.block;
import java.util.List;
import ab.AdvancedBotany;
import ab.common.block.tile.TileBoardFate;
import ab.common.block.tile.TileGameBoard;
import ab.common.block.tile.TileInventory;
import ab.common.lib.register.AchievementRegister;
import ab.common.lib.register.RecipeListAB;
import net.minecraft.block.Block;
import net.minecraft.block.BlockContainer;
import net.minecraft.block.material.Material;
import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.entity.Entity;
import net.minecraft.entity.item.EntityItem;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.stats.Achievement;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.IIcon;
import net.minecraft.world.World;
import vazkii.botania.api.lexicon.ILexiconable;
import vazkii.botania.api.lexicon.LexiconEntry;
import vazkii.botania.api.wand.IWandable;
import vazkii.botania.common.achievement.IPickupAchievement;
import vazkii.botania.common.core.handler.ConfigHandler;
public class BlockBoardFate extends BlockContainer implements IPickupAchievement, ILexiconable {
protected IIcon[] iconsFate;
protected IIcon[] iconsBoard;
public BlockBoardFate() {
super(Material.iron);
this.setCreativeTab(AdvancedBotany.tabAB);
this.setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 0.1875F, 1.0F);
this.setHardness(3.0F);
this.setResistance(10.0F);
this.setStepSound(soundTypeMetal);
this.setBlockName("boardFate");
}
public void getSubBlocks(Item par1, CreativeTabs par2CreativeTabs, List list) {
for(int i = 0; i < 2; i++)
list.add(new ItemStack(par1, 1, i));
}
public void registerBlockIcons(IIconRegister ir) {
this.iconsFate = new IIcon[3];
this.iconsBoard = new IIcon[3];
for(int i = 0; i < iconsFate.length; i++)
this.iconsFate[i] = ir.registerIcon("ab:boardFate_" + i);
for(int i = 0; i < iconsBoard.length; i++)
this.iconsBoard[i] = ir.registerIcon("ab:gameBoard_" + i);
}
public IIcon getIcon(int side, int meta) {
if(meta == 0)
return this.iconsBoard[Math.min(2, side)];
else
return this.iconsFate[Math.min(2, side)];
}
public boolean isOpaqueCube() {
return false;
}
public boolean renderAsNormalBlock() {
return false;
}
public int damageDropped(int par1) {
return par1;
}
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int side, float par7, float par8, float par9) {
int meta = world.getBlockMetadata(x, y, z);
if(meta == 0) {
TileGameBoard tile = (TileGameBoard)world.getTileEntity(x, y, z);
if(player.isSneaking() && !tile.hasGame()) {
tile.isSingleGame = !tile.isSingleGame;
if(!world.isRemote)
world.playSoundAtEntity((Entity)player, "botania:ding", 0.11F, 0.8F);
return true;
}
if(!tile.hasGame())
tile.setPlayer(player);
else if(!tile.isSingleGame && tile.playersName[1].isEmpty() && !tile.playersName[0].equals(player.getCommandSenderName()))
tile.setPlayer(player);
else {
return tile.dropDice(player);
}
return false;
} else {
if(!player.isSneaking()) {
ItemStack heldItem = player.getCurrentEquippedItem();
TileBoardFate tile = (TileBoardFate)world.getTileEntity(x, y, z);
if(heldItem != null && tile != null && tile.isDice(heldItem)) {
for(int i = 0; i < tile.getSizeInventory(); i++) {
ItemStack slotStack = tile.getStackInSlot(i);
if(slotStack != null)
continue;
heldItem.stackSize--;
if(heldItem.stackSize == 0)
player.inventory.setInventorySlotContents(player.inventory.currentItem, null);
if(!world.isRemote) {
ItemStack copy = heldItem.copy();
copy.stackSize = 1;
tile.setInventorySlotContents(i, copy);
tile.slotChance[i] = (byte)(world.rand.nextInt(6) + 1);
tile.requestUpdate = true;
world.playSoundEffect(x, y, z, "ab:boardCube", 0.6F, 1.0F);
}
return true;
}
}
return false;
} else {
TileBoardFate tile = (TileBoardFate)world.getTileEntity(x, y, z);
return tile.spawnRelic(player);
}
}
}
public TileEntity createNewTileEntity(World world, int meta) {
return meta == 0 ? new TileGameBoard() : new TileBoardFate();
}
public void breakBlock(World world, int x, int y, int z, Block block, int meta) {
if(!world.isRemote && meta == 1) {
TileInventory inv = (TileInventory)world.getTileEntity(x, y, z);
if (inv != null) {
for (int i = 0; i < inv.getSizeInventory(); i++) {
ItemStack stack = inv.getStackInSlot(i);
if (stack != null) {
float f = world.rand.nextFloat() * 0.8F + 0.1F;
float f1 = world.rand.nextFloat() * 0.8F + 0.1F;
float f2 = world.rand.nextFloat() * 0.8F + 0.1F;
EntityItem entityitem = new EntityItem(world, (x + f), (y + f1), (z + f2), stack.copy());
float f3 = 0.05F;
entityitem.motionX = ((float)world.rand.nextGaussian() * f3);
entityitem.motionY = ((float)world.rand.nextGaussian() * f3 + 0.2F);
entityitem.motionZ = ((float)world.rand.nextGaussian() * f3);
if (stack.hasTagCompound())
entityitem.getEntityItem().setTagCompound((NBTTagCompound)stack.getTagCompound().copy());
world.spawnEntityInWorld(entityitem);
}
}
}
}
super.breakBlock(world, x, y, z, block, meta);
}
public Achievement getAchievementOnPickup(ItemStack stack, EntityPlayer player, EntityItem item) {
return stack.getItemDamage() == 1 ? AchievementRegister.fateBoard : null;
}
public LexiconEntry getEntry(World world, int x, int y, int z, EntityPlayer player, ItemStack stack) {
return world.getBlockMetadata(x, y, z) == 0 ? RecipeListAB.gameBoard : RecipeListAB.fateBoard;
}
}
@@ -0,0 +1,110 @@
package ab.common.block;
import java.util.List;
import ab.AdvancedBotany;
import ab.common.block.tile.TileEngineerHopper;
import ab.common.block.tile.TileInventory;
import ab.common.lib.register.BlockListAB;
import ab.common.lib.register.RecipeListAB;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import net.minecraft.block.Block;
import net.minecraft.block.BlockContainer;
import net.minecraft.block.BlockHopper;
import net.minecraft.block.material.Material;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.ScaledResolution;
import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.entity.Entity;
import net.minecraft.entity.item.EntityItem;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.AxisAlignedBB;
import net.minecraft.util.Facing;
import net.minecraft.util.IIcon;
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;
import vazkii.botania.api.lexicon.ILexiconable;
import vazkii.botania.api.lexicon.LexiconEntry;
import vazkii.botania.api.wand.IWandHUD;
import vazkii.botania.api.wand.IWandable;
import vazkii.botania.common.block.ModBlocks;
public class BlockEngineerHopper extends BlockContainer implements IWandable, IWandHUD, ILexiconable {
private static IIcon[] icons = new IIcon[3];
public BlockEngineerHopper() {
super(Material.iron);
this.setCreativeTab(AdvancedBotany.tabAB);
this.setBlockName("engineerHopper");
float offset = 0.125F;
this.setBlockBounds(offset, offset / 2.0f, offset, 1.0F - offset, 1.0F - (offset / 2.0f), 1.0F - offset);
}
public LexiconEntry getEntry(World world, int x, int y, int z, EntityPlayer player, ItemStack lexicon) {
return RecipeListAB.engineerHopper;
}
public IIcon getIcon(int par1, int par2) {
return ModBlocks.blazeBlock.getIcon(0, 0);
}
public void breakBlock(World world, int x, int y, int z, Block block, int meta) {
if(!world.isRemote) {
TileInventory inv = (TileInventory)world.getTileEntity(x, y, z);
if (inv != null) {
for (int i = 0; i < inv.getSizeInventory(); i++) {
ItemStack stack = inv.getStackInSlot(i);
if (stack != null) {
float f = world.rand.nextFloat() * 0.8F + 0.1F;
float f1 = world.rand.nextFloat() * 0.8F + 0.1F;
float f2 = world.rand.nextFloat() * 0.8F + 0.1F;
EntityItem entityitem = new EntityItem(world, (x + f), (y + f1), (z + f2), stack.copy());
float f3 = 0.05F;
entityitem.motionX = ((float)world.rand.nextGaussian() * f3);
entityitem.motionY = ((float)world.rand.nextGaussian() * f3 + 0.2F);
entityitem.motionZ = ((float)world.rand.nextGaussian() * f3);
if (stack.hasTagCompound())
entityitem.getEntityItem().setTagCompound((NBTTagCompound)stack.getTagCompound().copy());
world.spawnEntityInWorld(entityitem);
}
}
}
}
super.breakBlock(world, x, y, z, block, meta);
}
public TileEntity createNewTileEntity(World world, int meta) {
return new TileEngineerHopper();
}
public void renderHUD(Minecraft mc, ScaledResolution res, World world, int x, int y, int z) {
((TileEngineerHopper)world.getTileEntity(x, y, z)).renderHUD(mc, res);
}
public int getRenderType() {
return BlockListAB.blockEngineerHopperRI;
}
public boolean isOpaqueCube() {
return false;
}
public boolean renderAsNormalBlock() {
return false;
}
public boolean onUsedByWand(EntityPlayer player, ItemStack wand, World world, int x, int y, int z, int meta) {
if(!player.isSneaking()) {
TileEngineerHopper tile = (TileEngineerHopper)world.getTileEntity(x, y, z);
tile.changeBindType();
if(!world.isRemote)
world.playSoundAtEntity((Entity)player, "botania:ding", 0.11F, 1.0F);
}
return true;
}
}
@@ -0,0 +1,80 @@
package ab.common.block;
import java.util.Random;
import ab.common.core.CommonHelper;
import ab.common.lib.register.BlockListAB;
import ab.common.lib.register.RecipeListAB;
import net.minecraft.block.Block;
import net.minecraft.block.BlockBush;
import net.minecraft.block.IGrowable;
import net.minecraft.block.material.Material;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;
import net.minecraftforge.common.util.ForgeDirection;
import vazkii.botania.api.lexicon.ILexiconable;
import vazkii.botania.api.lexicon.LexiconEntry;
public class BlockFreyrLiana extends BlockBush implements ILexiconable {
public BlockFreyrLiana() {
super(Material.plants);
this.setBlockName("BlockFreyrLiana");
this.setStepSound(soundTypeGrass);
this.setBlockTextureName("ab:freyrLiana");
}
public LexiconEntry getEntry(World world, int x, int y, int z, EntityPlayer player, ItemStack lexicon) {
return RecipeListAB.freyrSlingshot;
}
public boolean canPlaceBlockAt(World world, int x, int y, int z) {
return world.getBlock(x, y + 1, z).getMaterial() == Material.leaves
|| world.getBlock(x, y + 1, z).getMaterial() == Material.wood
|| world.getBlock(x, y + 1, z).getMaterial() == Material.ground
|| world.getBlock(x, y + 1, z).getMaterial() == Material.rock
|| world.getBlock(x, y + 1, z).getMaterial() == Material.sand
|| world.getBlock(x, y + 1, z).getMaterial() == Material.grass
|| world.getBlock(x, y + 1, z) instanceof BlockFreyrLiana;
}
public void updateTick(World world, int x, int y, int z, Random rand) {
this.checkAndDropBlock(world, x, y, z);
world.markBlockForUpdate(x, y, z);
for(int i1 = 1; i1 < 5; i1++) {
Block block = world.getBlock(x, y - i1, z);
if(block instanceof IGrowable) {
CommonHelper.fertilizer(world, block, x, y - i1, z, 18, null);
if(world.getBlock(x, y - i1 - 1, z) == BlockListAB.blockTerraFarmland)
world.getBlock(x, y - i1 - 1, z).updateTick(world, x, y - i1 - 1, z, rand);
break;
}
}
}
protected void checkAndDropBlock(World world, int x, int y, int z) {
if (!this.canBlockStay(world, x, y, z)) {
this.dropBlockAsItem(world, x, y, z, world.getBlockMetadata(x, y, z), 0);
world.setBlock(x, y, z, getBlockById(0), 0, 3);
}
}
public Item getItemDropped(int p_149650_1_, Random p_149650_2_, int p_149650_3_) {
return null;
}
public boolean canBlockStay(World world, int x, int y, int z) {
return this.canPlaceBlockAt(world, x, y, z);
}
public int getFlammability(final IBlockAccess world, final int x, final int y, final int z, final ForgeDirection face) {
return 100;
}
public int getFireSpreadSpeed(final IBlockAccess world, final int x, final int y, final int z, final ForgeDirection face) {
return 60;
}
}
@@ -0,0 +1,135 @@
package ab.common.block;
import java.util.List;
import ab.AdvancedBotany;
import ab.common.block.tile.TileLebethronCore;
import ab.common.lib.register.RecipeListAB;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import net.minecraft.block.Block;
import net.minecraft.block.ITileEntityProvider;
import net.minecraft.block.material.Material;
import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.entity.item.EntityItem;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.init.Blocks;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.IIcon;
import net.minecraft.util.MovingObjectPosition;
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;
import vazkii.botania.api.internal.VanillaPacketDispatcher;
import vazkii.botania.api.lexicon.ILexiconable;
import vazkii.botania.api.lexicon.LexiconEntry;
import vazkii.botania.common.item.ModItems;
public class BlockLebethronWood extends Block implements ILexiconable, ITileEntityProvider {
private static IIcon[] icon = new IIcon[5];
public static IIcon iconPortal;
public BlockLebethronWood() {
super(Material.wood);
this.setCreativeTab(AdvancedBotany.tabAB);
this.setHardness(6.0F);
this.setStepSound(soundTypeWood);
this.setBlockName("lebethronWood");
}
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int par6, float par7, float par8, float par9) {
int meta = world.getBlockMetadata(x, y, z);
if(meta == 4) {
TileLebethronCore core = (TileLebethronCore)world.getTileEntity(x, y, z);
ItemStack heldItem = player.getCurrentEquippedItem();
if(heldItem == null)
return false;
Block block = Block.getBlockFromItem(heldItem.getItem());
if(block.getMaterial() == Material.leaves && !heldItem.hasTagCompound()) {
if(!world.isRemote) {
core.updateStructure();
if(core.getValidTree()) {
if(core.setBlock(player, block, heldItem.getItemDamage())) {
heldItem.stackSize--;
if(heldItem.stackSize == 0)
player.inventory.setInventorySlotContents(player.inventory.currentItem, null);
VanillaPacketDispatcher.dispatchTEToNearbyPlayers(world, x, y, z);
}
}
}
return true;
}
}
return false;
}
public void breakBlock(World world, int x, int y, int z, Block block, int meta) {
if(!world.isRemote && meta == 4) {
TileLebethronCore tile = (TileLebethronCore)world.getTileEntity(x, y, z);
if(tile != null) {
ItemStack stack = new ItemStack(tile.getBlock(), 1, tile.getMeta());
if (stack != null) {
float f = world.rand.nextFloat() * 0.8F + 0.1F;
float f1 = world.rand.nextFloat() * 0.8F + 0.1F;
float f2 = world.rand.nextFloat() * 0.8F + 0.1F;
EntityItem entityitem = new EntityItem(world, (x + f), (y + f1), (z + f2), stack.copy());
float f3 = 0.05F;
entityitem.motionX = ((float)world.rand.nextGaussian() * f3);
entityitem.motionY = ((float)world.rand.nextGaussian() * f3 + 0.2F);
entityitem.motionZ = ((float)world.rand.nextGaussian() * f3);
if (stack.hasTagCompound())
entityitem.getEntityItem().setTagCompound((NBTTagCompound)stack.getTagCompound().copy());
world.spawnEntityInWorld(entityitem);
}
}
}
super.breakBlock(world, x, y, z, block, meta);
}
public void getSubBlocks(Item par1, CreativeTabs par2CreativeTabs, List list) {
for(int i = 0; i < icon.length; i++) {
list.add(new ItemStack(par1, 1, i));
}
}
@SideOnly(Side.CLIENT)
public void registerBlockIcons(IIconRegister ir) {
for (int i = 0; i < icon.length; i++)
icon[i] = ir.registerIcon("ab:lebethronWood_" + i);
iconPortal = ir.registerIcon("ab:portalAlphirine");
}
@SideOnly(Side.CLIENT)
public IIcon getIcon(int side, int meta) {
return this.icon[meta];
}
public int damageDropped(int par1) {
return par1;
}
public int getLightValue(IBlockAccess world, int x, int y, int z) {
return (world.getBlockMetadata(x, y, z) == 3) ? 12 : 0;
}
public boolean canSustainLeaves(IBlockAccess world, int x, int y, int z) {
return (world.getBlockMetadata(x, y, z) == 0);
}
public ItemStack getPickBlock(MovingObjectPosition target, World world, int x, int y, int z) {
int meta = world.getBlockMetadata(x, y, z);
return new ItemStack(this, 1, meta);
}
public LexiconEntry getEntry(World world, int x, int y, int z, EntityPlayer player, ItemStack lexicon) {
return RecipeListAB.lebethronWood;
}
public TileEntity createNewTileEntity(World world, int meta) {
return meta == 4 ? new TileLebethronCore() : null;
}
}
@@ -0,0 +1,49 @@
package ab.common.block;
import java.util.Random;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import net.minecraft.entity.item.EntityItem;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.init.Items;
import net.minecraft.item.ItemStack;
import net.minecraft.world.World;
import vazkii.botania.common.Botania;
public class BlockLuminousFreyrLiana extends BlockFreyrLiana {
public BlockLuminousFreyrLiana() {
this.setBlockName("BlockLuminousFreyrLiana");
this.setBlockTextureName("ab:freyrLuminousLiana");
this.setTickRandomly(true);
}
public int getLightValue() {
return 11;
}
public void updateTick(World world, int x, int y, int z, Random rand) {
super.updateTick(world, x, y, z, rand);
if(rand.nextInt(11) == 0)
world.setBlockMetadataWithNotify(x, y, z, 1, 3);
}
@SideOnly(Side.CLIENT)
public void randomDisplayTick(World world, int x, int y, int z, Random rand) {
if(world.getBlockMetadata(x, y, z) == 1)
if(rand.nextInt(3) == 0)
Botania.proxy.wispFX(world, x + 0.1 + Math.random() * 0.8, y + Math.random() * 0.5, z + 0.1 + Math.random() * 0.8, 249 / 255f, 230 / 255f, 3 / 255f, 0.14f, -0.04f, 2);
}
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int side, float hitX, float hitY, float hitZ) {
Random rand = new Random();
if(world.getBlockMetadata(x, y, z) == 1) {
if (!world.isRemote)
(new EntityItem(world, x + 0.5, y, z + 0.5)).entityDropItem(new ItemStack(Items.gold_nugget, 1 + rand.nextInt(3)), 0.75f);
world.setBlockMetadataWithNotify(x, y, z, 0, 3);
return true;
}
return false;
}
}
@@ -0,0 +1,275 @@
package ab.common.block;
import org.lwjgl.opengl.GL11;
import org.lwjgl.opengl.GL12;
import ab.AdvancedBotany;
import ab.common.block.tile.TileMagicCraftCrate;
import ab.common.item.ItemCraftingPattern;
import ab.common.lib.register.RecipeListAB;
import net.minecraft.block.Block;
import net.minecraft.block.material.Material;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.Gui;
import net.minecraft.client.gui.ScaledResolution;
import net.minecraft.client.renderer.entity.RenderItem;
import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.entity.item.EntityItem;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.inventory.IInventory;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.IIcon;
import net.minecraft.util.MathHelper;
import net.minecraft.util.Vec3;
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;
import thaumcraft.api.aspects.Aspect;
import thaumcraft.api.aspects.AspectList;
import thaumcraft.client.lib.UtilsFX;
import thaumcraft.common.items.wands.ItemWandCasting;
import thaumcraft.common.lib.crafting.ThaumcraftCraftingManager;
import vazkii.botania.api.lexicon.ILexiconable;
import vazkii.botania.api.lexicon.LexiconEntry;
import vazkii.botania.api.wand.IWandHUD;
import vazkii.botania.api.wand.IWandable;
import vazkii.botania.common.block.BlockModContainer;
public class BlockMagicCraftCrate extends BlockModContainer implements IWandable, IWandHUD, ILexiconable {
public static final Aspect[] primals = new Aspect[] { Aspect.AIR, Aspect.WATER, Aspect.EARTH, Aspect.FIRE, Aspect.ORDER, Aspect.ENTROPY };
IIcon iconSide;
IIcon iconBottom;
IIcon iconTop;
public IIcon nothing;
public BlockMagicCraftCrate() {
super(Material.wood);
this.setHardness(2.0F);
this.setStepSound(soundTypeWood);
this.setBlockName("magicThaumCrafter");
this.setCreativeTab(AdvancedBotany.tabAB);
}
public LexiconEntry getEntry(World arg0, int arg1, int arg2, int arg3, EntityPlayer arg4, ItemStack arg5) {
return RecipeListAB.thaumAutoCraft;
}
public void registerBlockIcons(IIconRegister ir) {
iconSide = ir.registerIcon("ab:magicCrateSide");
iconTop = ir.registerIcon("ab:magicCrateTop");
iconBottom = ir.registerIcon("ab:magicCrateBottom");
nothing = ir.registerIcon("ab:nothing");
}
public boolean hasComparatorInputOverride() {
return true;
}
public int getComparatorInputOverride(World par1World, int par2, int par3, int par4, int par5) {
TileMagicCraftCrate crate = (TileMagicCraftCrate) par1World.getTileEntity(par2, par3, par4);
return crate.getSignal();
}
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int side, float hitX, float hitY, float hitZ) {
TileMagicCraftCrate crate = (TileMagicCraftCrate) world.getTileEntity(x, y, z);
ItemStack stack = player.getHeldItem();
for(int i = 10; i < 12; i++) {
ItemStack item = crate.getStackInSlot(i);
if(player.isSneaking()) {
if(item == null)
continue;
if(!world.isRemote) {
Vec3 vec3 = player.getLook(1.0F).normalize();
EntityItem entityitem = new EntityItem(world, player.posX + vec3.xCoord, player.posY + vec3.yCoord + 0.5f, player.posZ + vec3.zCoord, item.copy());
world.spawnEntityInWorld(entityitem);
}
crate.setInventorySlotContents(i, null);
world.playSoundEffect((double) x, (double) y, (double) z, "random.pop", 0.2f, ((world.rand.nextFloat() - world.rand.nextFloat()) * 0.7f + 1.0f) * 1.5f);
crate.markDirty();
return true;
} else if(stack != null && crate.isItemValidForSlot(i, stack)) {
if(item != null) {
if(!world.isRemote) {
Vec3 vec3 = player.getLook(1.0F).normalize();
EntityItem entityitem = new EntityItem(world, player.posX + vec3.xCoord, player.posY + vec3.yCoord + 0.5f, player.posZ + vec3.zCoord, item.copy());
world.spawnEntityInWorld(entityitem);
}
}
crate.setInventorySlotContents(i, stack.copy());
if(i == 11)
crate.setPlayer(player);
stack.splitStack(1);
world.playSoundEffect((double) x, (double) y, (double) z, "random.pop", 0.2f, ((world.rand.nextFloat() - world.rand.nextFloat()) * 0.7f + 1.0f) * 1.5f);
crate.markDirty();
return true;
}
}
if(stack != null && stack.getItem() instanceof ItemCraftingPattern && stack.getItemDamage() != 0) {
boolean[][] pattern = ((ItemCraftingPattern) stack.getItem()).getPattern(stack.getItemDamage());
crate.setPattern(pattern);
stack.splitStack(1);
return true;
}
return false;
}
public IIcon getIcon(int side, int meta) {
switch (side) {
case 0:
return iconBottom;
case 1:
return iconTop;
default:
return iconSide;
}
}
public IIcon getIcon(IBlockAccess world, int x, int y, int z, int side) {
switch (side) {
case 0:
return iconBottom;
case 1:
return iconTop;
default:
return iconSide;
}
}
public TileEntity createNewTileEntity(World world, int meta) {
return new TileMagicCraftCrate();
}
public void renderHUD(Minecraft mc, ScaledResolution res, World world, int x, int y, int z) {
TileEntity tile = world.getTileEntity(x, y, z);
if(tile instanceof TileMagicCraftCrate) {
TileMagicCraftCrate craft = (TileMagicCraftCrate) tile;
int width = 52;
int height = 52;
int xc = res.getScaledWidth() / 2 + 20;
int yc = res.getScaledHeight() / 2 - height / 2;
Gui.drawRect(xc - 6 - 3, yc - 6, xc + width + 3, yc + height + 6, 0x2294178a);
Gui.drawRect(xc - 4 - 3, yc - 4, xc + width + 1, yc + height + 4, 0x2294178a);
Gui.drawRect(xc + 60 - 3, yc + 18 - 3, xc + 60 + 16 + 3, yc + 18 + 16 + 3, 0x2294178a);
Gui.drawRect(xc + 60 - 2, yc + 18 - 2, xc + 60 + 16 + 2, yc + 18 + 16 + 2, 0x2294178a);
Gui.drawRect(xc + 60, yc + 18, xc + 60 + 16, yc + 18 + 16, 0x22efd3f4);
AspectList waitingAspects = null;
if(craft.getWaitingStack() != null && craft.getPlayer() != null) {
GL11.glColor4f(1.0f, 1.0f, 1.0f, 0.7f);
GL11.glEnable(GL12.GL_RESCALE_NORMAL);
RenderItem.getInstance().renderItemAndEffectIntoGUI(mc.fontRenderer, mc.renderEngine, craft.getWaitingStack(), xc + 60, yc + 18);
net.minecraft.client.renderer.RenderHelper.disableStandardItemLighting();
GL11.glColor4f(1.0f, 1.0f, 1.0f, 1.0f);
waitingAspects = ThaumcraftCraftingManager.findMatchingArcaneRecipeAspects((IInventory) craft, craft.getPlayer());
}
if(craft.getStackInSlot(10) != null) {
GL11.glEnable(GL11.GL_BLEND);
ItemStack wand = craft.getStackInSlot(10);
ItemWandCasting itemWand = ((ItemWandCasting) wand.getItem());
AspectList aspects = itemWand.getAllVis(wand);
int n = 0;
for (Aspect a : primals) {
float alpha = 1.0f;
if (waitingAspects != null) {
float amt = (float) waitingAspects.getAmount(a);
if (amt > 0) {
amt *= itemWand.getConsumptionModifier(wand, craft.getPlayer(), a, true);
if (amt * 100.0f > itemWand.getVis(wand, a)) {
alpha = 0.5f + (MathHelper.sin((craft.getPlayer().ticksExisted + n * 10) / 2.0f) * 0.2f
- 0.2f);
}
}
}
int xa = (int) (xc - 45 + Math.cos(0.2f * Math.PI * n + Math.PI / 2) * 45);
int ya = (int) (yc + 16 + Math.sin(0.2f * Math.PI * n + Math.PI / 2) * 45);
float amout = aspects.getAmount(a) + 0.000001f;
UtilsFX.drawTag(xa, ya, a, amout / 100f, 0, 0, 771, alpha, false);
n++;
}
GL11.glDisable(GL11.GL_BLEND);
GL11.glEnable(GL12.GL_RESCALE_NORMAL);
net.minecraft.client.renderer.RenderHelper.disableStandardItemLighting();
}
Gui.drawRect(xc - 28 - 20 - 3, yc + 7 - 3, xc - 28 - 20 + 16 + 3, yc + 7 + 16 + 3, 0x2294178a);
Gui.drawRect(xc - 28 - 20 - 2, yc + 7 - 2, xc - 28 - 20 + 16 + 2, yc + 7 + 16 + 2, 0x2294178a);
Gui.drawRect(xc - 28 - 20, yc + 7, xc - 28 - 20 + 16, yc + 7 + 16, 0x22efd3f4);
net.minecraft.client.renderer.RenderHelper.enableGUIStandardItemLighting();
GL11.glEnable(GL12.GL_RESCALE_NORMAL);
RenderItem.getInstance().renderItemAndEffectIntoGUI(mc.fontRenderer, mc.renderEngine,
craft.getStackInSlot(10), xc - 28 - 20, yc + 8);
net.minecraft.client.renderer.RenderHelper.disableStandardItemLighting();
Gui.drawRect(xc - 28 - 20 - 3, yc + 29 - 3, xc - 28 - 20 + 16 - 3, yc + 29 + 16 + 3, 0x2294178a);
Gui.drawRect(xc - 28 - 20 - 2, yc + 29 - 2, xc - 28 - 20 + 16 + 2, yc + 29 + 16 + 2, 0x2294178a);
Gui.drawRect(xc - 28 - 20, yc + 29, xc - 28 - 20 + 16, yc + 29 + 16, 0x22efd3f4);
net.minecraft.client.renderer.RenderHelper.enableGUIStandardItemLighting();
GL11.glEnable(GL12.GL_RESCALE_NORMAL);
RenderItem.getInstance().renderItemAndEffectIntoGUI(mc.fontRenderer, mc.renderEngine,
craft.getStackInSlot(11), xc - 28 - 20, yc + 29);
net.minecraft.client.renderer.RenderHelper.disableStandardItemLighting();
for (int i = 0; i < 3; i++)
for (int j = 0; j < 3; j++) {
int index = i * 3 + j;
int xp = xc + j * 18 - 3;
int yp = yc + i * 18;
boolean enabled = craft.getPattern()[i][j];
Gui.drawRect(xp, yp, xp + 16, yp + 16, enabled ? 0x22efd3f4 : 0x22fb02a6);
ItemStack item = craft.getStackInSlot(index);
net.minecraft.client.renderer.RenderHelper.enableGUIStandardItemLighting();
GL11.glEnable(GL12.GL_RESCALE_NORMAL);
RenderItem.getInstance().renderItemAndEffectIntoGUI(mc.fontRenderer, mc.renderEngine, item, xp, yp);
net.minecraft.client.renderer.RenderHelper.disableStandardItemLighting();
}
}
}
public void breakBlock(World world, int x, int y, int z, Block block, int meta) {
if(!world.isRemote) {
TileMagicCraftCrate inv = (TileMagicCraftCrate)world.getTileEntity(x, y, z);
if(inv != null) {
for(int i = 0; i < inv.getSizeInventory(); i++) {
ItemStack stack = inv.getStackInSlot(i);
if(stack != null) {
float f = world.rand.nextFloat() * 0.8F + 0.1F;
float f1 = world.rand.nextFloat() * 0.8F + 0.1F;
float f2 = world.rand.nextFloat() * 0.8F + 0.1F;
EntityItem entityitem = new EntityItem(world, (x + f), (y + f1), (z + f2), stack.copy());
float f3 = 0.05F;
entityitem.motionX = ((float)world.rand.nextGaussian() * f3);
entityitem.motionY = ((float)world.rand.nextGaussian() * f3 + 0.2F);
entityitem.motionZ = ((float)world.rand.nextGaussian() * f3);
if(stack.hasTagCompound())
entityitem.getEntityItem().setTagCompound((NBTTagCompound)stack.getTagCompound().copy());
world.spawnEntityInWorld(entityitem);
}
}
}
}
super.breakBlock(world, x, y, z, block, meta);
}
public boolean renderAsNormalBlock() {
return false;
}
public boolean isOpaqueCube() {
return false;
}
public boolean onUsedByWand(EntityPlayer player, ItemStack stack, World world, int x, int y, int z, int side) {
TileMagicCraftCrate crate = (TileMagicCraftCrate) world.getTileEntity(x, y, z);
crate.ejectAll();
return true;
}
}
@@ -0,0 +1,137 @@
package ab.common.block;
import ab.AdvancedBotany;
import ab.common.block.tile.TileInventory;
import ab.common.block.tile.TileManaCharger;
import ab.common.lib.register.BlockListAB;
import ab.common.lib.register.RecipeListAB;
import net.minecraft.block.Block;
import net.minecraft.block.BlockContainer;
import net.minecraft.block.material.Material;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.ScaledResolution;
import net.minecraft.entity.item.EntityItem;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.IIcon;
import net.minecraft.util.Vec3;
import net.minecraft.world.World;
import vazkii.botania.api.internal.VanillaPacketDispatcher;
import vazkii.botania.api.lexicon.ILexiconable;
import vazkii.botania.api.lexicon.LexiconEntry;
import vazkii.botania.api.mana.IManaItem;
import vazkii.botania.api.wand.IWandHUD;
import vazkii.botania.api.wand.IWandable;
import vazkii.botania.common.block.ModBlocks;
public class BlockManaCharger extends BlockContainer implements IWandHUD, IWandable, ILexiconable {
public BlockManaCharger() {
super(Material.iron);
this.setCreativeTab(AdvancedBotany.tabAB);
this.setHardness(6.0F);
float f = 0.0625f;
this.setBlockBounds(f * 3, f * 3, f * 3, 1.0f - f * 3, 1.0f - f * 4 + f * 3, 1.0f - f * 3);
this.setBlockName("ABManaCharger");
}
public IIcon getIcon(int par1, int par2) {
return ModBlocks.livingrock.getIcon(0, 0);
}
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int side, float par7, float par8, float par9) {
TileManaCharger tile = (TileManaCharger)world.getTileEntity(x, y, z);
if(tile != null) {
int slotSide = side - 1;
if(slotSide < 0)
return false;
ItemStack heldItem = player.getCurrentEquippedItem();
ItemStack stackInSlot = tile.getStackInSlot(slotSide);
if(player.isSneaking()) {
if(stackInSlot != null) {
ItemStack copy = stackInSlot.copy();
tile.setInventorySlotContents(slotSide, null);
if(!world.isRemote) {
Vec3 vec3 = player.getLook(1.0F).normalize();
EntityItem entityitem = new EntityItem(world, player.posX + vec3.xCoord, player.posY + 1.2f, player.posZ + vec3.zCoord, copy);
world.spawnEntityInWorld(entityitem);
tile.requestUpdate = true;
}
world.func_147453_f(x, y, z, (Block)this);
return true;
}
} else {
if(heldItem != null && heldItem.getItem() instanceof IManaItem && stackInSlot == null && heldItem.getMaxStackSize() == 1) {
ItemStack copy = heldItem.copy();
copy.stackSize = 1;
heldItem.stackSize--;
if(heldItem.stackSize == 0)
player.inventory.setInventorySlotContents(player.inventory.currentItem, null);
player.inventory.markDirty();
if(!world.isRemote) {
tile.setInventorySlotContents(slotSide, copy);
tile.requestUpdate = true;
}
return true;
}
}
}
return false;
}
public void breakBlock(World world, int x, int y, int z, Block block, int meta) {
if(!world.isRemote) {
TileInventory inv = (TileInventory)world.getTileEntity(x, y, z);
if (inv != null) {
for (int i = 0; i < inv.getSizeInventory(); i++) {
ItemStack stack = inv.getStackInSlot(i);
if (stack != null) {
float f = world.rand.nextFloat() * 0.8F + 0.1F;
float f1 = world.rand.nextFloat() * 0.8F + 0.1F;
float f2 = world.rand.nextFloat() * 0.8F + 0.1F;
EntityItem entityitem = new EntityItem(world, (x + f), (y + f1), (z + f2), stack.copy());
float f3 = 0.05F;
entityitem.motionX = ((float)world.rand.nextGaussian() * f3);
entityitem.motionY = ((float)world.rand.nextGaussian() * f3 + 0.2F);
entityitem.motionZ = ((float)world.rand.nextGaussian() * f3);
if (stack.hasTagCompound())
entityitem.getEntityItem().setTagCompound((NBTTagCompound)stack.getTagCompound().copy());
world.spawnEntityInWorld(entityitem);
}
}
}
}
super.breakBlock(world, x, y, z, block, meta);
}
public boolean isOpaqueCube() {
return false;
}
public boolean renderAsNormalBlock() {
return false;
}
public int getRenderType() {
return BlockListAB.blockManaChargerRI;
}
public TileEntity createNewTileEntity(World world, int meta) {
return new TileManaCharger();
}
public void renderHUD(Minecraft mc, ScaledResolution res, World world, int x, int y, int z) {
((TileManaCharger)world.getTileEntity(x, y, z)).renderHUD(mc, res);
}
public boolean onUsedByWand(EntityPlayer player, ItemStack stack, World world, int x, int y, int z, int side) {
((TileManaCharger)world.getTileEntity(x, y, z)).onWanded(player, stack);
return true;
}
public LexiconEntry getEntry(World arg0, int arg1, int arg2, int arg3, EntityPlayer arg4, ItemStack arg5) {
return RecipeListAB.manaCharger;
}
}
@@ -0,0 +1,83 @@
package ab.common.block;
import java.util.List;
import java.util.Random;
import ab.AdvancedBotany;
import ab.common.block.tile.TileABSpreader;
import ab.common.block.tile.TileManaContainer;
import ab.common.lib.register.BlockListAB;
import ab.common.lib.register.RecipeListAB;
import net.minecraft.block.BlockContainer;
import net.minecraft.block.material.Material;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.ScaledResolution;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.IIcon;
import net.minecraft.util.MovingObjectPosition;
import net.minecraft.world.World;
import vazkii.botania.api.lexicon.ILexiconable;
import vazkii.botania.api.lexicon.LexiconEntry;
import vazkii.botania.api.wand.IWandHUD;
import vazkii.botania.api.wand.IWandable;
import vazkii.botania.common.block.BlockLivingrock;
import vazkii.botania.common.block.ModBlocks;
public class BlockManaContainer extends BlockContainer implements IWandHUD, IWandable, ILexiconable {
public BlockManaContainer() {
super(Material.iron);
this.setCreativeTab(AdvancedBotany.tabAB);
this.setHardness(9.0F);
this.setBlockName("ABManaContainer");
float offset = 0.08F;
this.setBlockBounds(offset, offset / 2.0f, offset, 1.0F - offset, 1.0F - (offset / 2.0f), 1.0F - offset);
}
public void getSubBlocks(Item par1, CreativeTabs par2, List par3) {
par3.add(new ItemStack(par1, 1, 0));
par3.add(new ItemStack(par1, 1, 1));
par3.add(new ItemStack(par1, 1, 2));
}
public int damageDropped(int meta) {
return meta;
}
public TileEntity createNewTileEntity(World world, int meta) {
return new TileManaContainer();
}
public boolean isOpaqueCube() {
return false;
}
public boolean renderAsNormalBlock() {
return false;
}
public int getRenderType() {
return BlockListAB.blockManaContainerRI;
}
public IIcon getIcon(int par1, int par2) {
return ModBlocks.livingrock.getIcon(0, 0);
}
public void renderHUD(Minecraft mc, ScaledResolution res, World world, int x, int y, int z) {
((TileManaContainer)world.getTileEntity(x, y, z)).renderHUD(mc, res);
}
public boolean onUsedByWand(EntityPlayer player, ItemStack stack, World world, int x, int y, int z, int side) {
((TileManaContainer)world.getTileEntity(x, y, z)).onWanded(player, stack);
return true;
}
public LexiconEntry getEntry(World world, int x, int y, int z, EntityPlayer player, ItemStack lexicon) {
return RecipeListAB.manaContainer;
}
}
@@ -0,0 +1,81 @@
package ab.common.block;
import ab.AdvancedBotany;
import ab.common.block.tile.TileManaCrystalCube;
import ab.common.lib.register.BlockListAB;
import ab.common.lib.register.RecipeListAB;
import net.minecraft.block.BlockContainer;
import net.minecraft.block.material.Material;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.ScaledResolution;
import net.minecraft.entity.Entity;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.player.EntityPlayerMP;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.network.Packet;
import net.minecraft.network.play.server.S35PacketUpdateTileEntity;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.IIcon;
import net.minecraft.world.World;
import vazkii.botania.api.lexicon.ILexiconable;
import vazkii.botania.api.lexicon.LexiconEntry;
import vazkii.botania.api.wand.IWandHUD;
import vazkii.botania.api.wand.IWandable;
import vazkii.botania.common.block.ModBlocks;
import vazkii.botania.common.item.ItemTwigWand;
public class BlockManaCrystalCube extends BlockContainer implements ILexiconable {
public BlockManaCrystalCube() {
super(Material.iron);
this.setCreativeTab(AdvancedBotany.tabAB);
float f = 0.1875F;
this.setBlockBounds(f, 0.0F, f, 1.0F - f, 1.0F, 1.0F - f);
this.setHardness(5.5F);
this.setStepSound(soundTypeMetal);
this.setBlockName("ABManaCrystalCube");
}
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int side, float par7, float par8, float par9) {
boolean isWand = player.getHeldItem() != null && player.getHeldItem().getItem() instanceof ItemTwigWand;
if(isWand)
return false;
TileManaCrystalCube tile = (TileManaCrystalCube)world.getTileEntity(x, y, z);
if(tile != null && !world.isRemote) {
NBTTagCompound nbttagcompound = new NBTTagCompound();
tile.writeCustomNBT(nbttagcompound);
int[] mana = tile.getManaAround();
nbttagcompound.setInteger("knownMana", mana[0]);
nbttagcompound.setInteger("knownMaxMana", mana[1]);
if(player instanceof EntityPlayerMP)
((EntityPlayerMP)player).playerNetServerHandler.sendPacket(new S35PacketUpdateTileEntity(tile.xCoord, tile.yCoord, tile.zCoord, -999, nbttagcompound));
}
world.playSoundAtEntity((Entity)player, "botania:ding", 0.11F, 1.0F);
return true;
}
public TileEntity createNewTileEntity(World world, int meta) {
return new TileManaCrystalCube();
}
public IIcon getIcon(int par1, int par2) {
return ModBlocks.dreamwood.getIcon(0, 0);
}
public int getRenderType() {
return BlockListAB.blockManaCrystalCubeRI;
}
public boolean isOpaqueCube() {
return false;
}
public boolean renderAsNormalBlock() {
return false;
}
public LexiconEntry getEntry(World world, int x, int y, int z, EntityPlayer player, ItemStack lexicon) {
return RecipeListAB.manaCrystalCube;
}
}
@@ -0,0 +1,147 @@
package ab.common.block;
import ab.AdvancedBotany;
import ab.common.block.tile.TileNidavellirForge;
import ab.common.block.tile.TileInventory;
import ab.common.lib.register.BlockListAB;
import ab.common.lib.register.RecipeListAB;
import net.minecraft.block.Block;
import net.minecraft.block.BlockContainer;
import net.minecraft.block.material.Material;
import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.item.EntityItem;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.IIcon;
import net.minecraft.util.MathHelper;
import net.minecraft.util.Vec3;
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;
import vazkii.botania.api.BotaniaAPI;
import vazkii.botania.api.lexicon.ILexiconable;
import vazkii.botania.api.lexicon.LexiconEntry;
import vazkii.botania.common.block.ModBlocks;
public class BlockNidavellirForge extends BlockContainer implements ILexiconable {
public BlockNidavellirForge() {
super(Material.iron);
this.setCreativeTab(AdvancedBotany.tabAB);
this.setHardness(3.0F);
this.setResistance(10.0F);
this.setStepSound(soundTypeMetal);
this.setBlockName("ABPlate");
}
public void setBlockBoundsBasedOnState(IBlockAccess world, int x, int y, int z) {
float f = 0.1875F;
float f1 = 0.0625F;
switch(world.getBlockMetadata(x, y, z)) {
case 0: this.setBlockBounds(f, 0.0F, f1, 1.0F - f, 0.75F, 1.0F);
break;
case 1: this.setBlockBounds(0.0F, 0.0F, f, 1.0F - f1, 0.75F, 1.0F - f);
break;
case 2: this.setBlockBounds(f, 0.0F, 0.0F, 1.0F - f, 0.75F, 1.0F - f1);
break;
case 3: this.setBlockBounds(f1, 0.0F, f, 1.0F, 0.75F, 1.0F - f);
break;
default: this.setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 1.0F, 1.0F);
}
}
public void onBlockPlacedBy(World world, int x, int y, int z, EntityLivingBase liv, ItemStack stack) {
int meta = MathHelper.floor_double((double)(liv.rotationYaw * 4.0F / 360.0F) + 0.5D) & 3;
world.setBlockMetadataWithNotify(x, y, z, meta, 3);
}
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int par6, float par7, float par8, float par9) {
TileNidavellirForge tile = (TileNidavellirForge)world.getTileEntity(x, y, z);
if(player.isSneaking()) {
if(tile.getStackInSlot(0) != null) {
ItemStack copy = tile.getStackInSlot(0).copy();
if(!world.isRemote) {
Vec3 vec3 = player.getLook(1.0F).normalize();
EntityItem entityitem = new EntityItem(world, player.posX + vec3.xCoord, player.posY + 1.2f, player.posZ + vec3.zCoord, copy);
world.spawnEntityInWorld(entityitem);
tile.requestUpdate = true;
}
tile.setInventorySlotContents(0, null);
world.func_147453_f(x, y, z, (Block)this);
return true;
}
for(int i = tile.getSizeInventory() - 1; i > 0; i--) {
ItemStack stack = tile.getStackInSlot(i);
if(stack != null) {
ItemStack copy = stack.copy();
if(!world.isRemote) {
Vec3 vec3 = player.getLook(1.0F).normalize();
EntityItem entityitem = new EntityItem(world, player.posX + vec3.xCoord, player.posY + 1.2f, player.posZ + vec3.zCoord, copy);
world.spawnEntityInWorld(entityitem);
tile.requestUpdate = true;
}
tile.setInventorySlotContents(i, null);
world.func_147453_f(x, y, z, (Block)this);
return true;
}
}
}
return false;
}
public void breakBlock(World world, int x, int y, int z, Block block, int meta) {
if(!world.isRemote) {
TileInventory inv = (TileInventory)world.getTileEntity(x, y, z);
if (inv != null) {
for (int i = 0; i < inv.getSizeInventory(); i++) {
ItemStack stack = inv.getStackInSlot(i);
if (stack != null) {
float f = world.rand.nextFloat() * 0.8F + 0.1F;
float f1 = world.rand.nextFloat() * 0.8F + 0.1F;
float f2 = world.rand.nextFloat() * 0.8F + 0.1F;
EntityItem entityitem = new EntityItem(world, (x + f), (y + f1), (z + f2), stack.copy());
float f3 = 0.05F;
entityitem.motionX = ((float)world.rand.nextGaussian() * f3);
entityitem.motionY = ((float)world.rand.nextGaussian() * f3 + 0.2F);
entityitem.motionZ = ((float)world.rand.nextGaussian() * f3);
if (stack.hasTagCompound())
entityitem.getEntityItem().setTagCompound((NBTTagCompound)stack.getTagCompound().copy());
world.spawnEntityInWorld(entityitem);
}
}
}
}
super.breakBlock(world, x, y, z, block, meta);
}
public int getRenderType() {
return BlockListAB.blockABPlateRI;
}
public IIcon getIcon(int par1, int par2) {
return ModBlocks.storage.getIcon(0, 0);
}
public boolean renderAsNormalBlock() {
return false;
}
public boolean isOpaqueCube() {
return false;
}
public boolean getBlocksMovement(IBlockAccess p_149655_1_, int p_149655_2_, int p_149655_3_, int p_149655_4_) {
return false;
}
public TileEntity createNewTileEntity(World world, int meta) {
return new TileNidavellirForge();
}
public LexiconEntry getEntry(World arg0, int arg1, int arg2, int arg3, EntityPlayer arg4, ItemStack arg5) {
return RecipeListAB.advandedAgglomerationPlate;
}
}
@@ -0,0 +1,137 @@
package ab.common.block;
import static net.minecraftforge.common.util.ForgeDirection.UP;
import java.util.List;
import java.util.Random;
import ab.api.AdvancedBotanyAPI;
import ab.api.TerraFarmlandList;
import ab.common.lib.register.RecipeListAB;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import net.minecraft.block.Block;
import net.minecraft.block.BlockBush;
import net.minecraft.block.BlockCrops;
import net.minecraft.block.BlockFarmland;
import net.minecraft.block.IGrowable;
import net.minecraft.block.material.Material;
import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.item.EntityItem;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.init.Blocks;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.util.AxisAlignedBB;
import net.minecraft.util.IIcon;
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;
import net.minecraftforge.common.EnumPlantType;
import net.minecraftforge.common.IPlantable;
import net.minecraftforge.common.util.ForgeDirection;
import vazkii.botania.api.lexicon.ILexiconable;
import vazkii.botania.api.lexicon.LexiconEntry;
public class BlockTerraFarmland extends Block implements ILexiconable {
private IIcon icon;
public BlockTerraFarmland() {
super(Material.ground);
this.setTickRandomly(true);
this.setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 0.9375F, 1.0F);
this.setBlockName("terraFarmland");
this.setLightOpacity(255);
this.setStepSound(soundTypeGravel);
}
public boolean canSustainPlant(IBlockAccess world, int x, int y, int z, ForgeDirection direction, IPlantable plantable) {
Block plant = plantable.getPlant(world, x, y + 1, z);
return plant != Blocks.cactus && plant != Blocks.reeds;
}
public void updateTick(World world, int x, int y, int z, Random rand) {
if(world.isRemote)
return;
Block block = world.getBlock(x, y + 1, z);
int meta = world.getBlockMetadata(x, y + 1, z);
if(block instanceof BlockCrops) {
if(meta == 7) {
refreshSeed(world, x, y, z, block, meta);
return;
}
} else if(block instanceof IPlantable) {
for(TerraFarmlandList fSeed : AdvancedBotanyAPI.farmlandList) {
int meta1 = fSeed.getMeta();
Block block1 = fSeed.getBlock();
if(block != block1)
continue;
if(meta == meta1) {
refreshSeed(world, x, y, z, block1, meta1);
return;
}
}
} else {
world.setBlock(x, y, z, Blocks.dirt);
}
}
private void refreshSeed(World world, int x, int y, int z, Block block, int meta) {
List<EntityItem> items = world.getEntitiesWithinAABB(EntityItem.class, AxisAlignedBB.getBoundingBox(x - 4, y - 4, z - 4, x + 4, y + 4, z + 4));
if(!items.isEmpty() && items.size() > 7)
return;
IPlantable seed = (IPlantable)block;
List<ItemStack> list = block.getDrops(world, x, y + 1, z, meta, 0);
for(ItemStack stack : list) {
if(stack == null)
continue;
else if(stack.getItem() == seed) {
if(stack.stackSize > 1)
stack.stackSize -= 1;
} else
stack.stackSize = Math.min(64, (int)(stack.stackSize * 2.5f));
}
for(ItemStack stack : list) {
if(stack == null)
continue;
EntityItem itemEnt = new EntityItem(world, x + 0.5f, y + 1, z + 0.5f, stack);
world.spawnEntityInWorld(itemEnt);
}
world.setBlock(x, y + 1, z, block, 0, 3);
}
public AxisAlignedBB getCollisionBoundingBoxFromPool(World p_149668_1_, int p_149668_2_, int p_149668_3_, int p_149668_4_) {
return AxisAlignedBB.getBoundingBox((double)(p_149668_2_ + 0), (double)(p_149668_3_ + 0), (double)(p_149668_4_ + 0), (double)(p_149668_2_ + 1), (double)(p_149668_3_ + 1), (double)(p_149668_4_ + 1));
}
public boolean isOpaqueCube() {
return false;
}
public boolean renderAsNormalBlock() {
return false;
}
public Item getItemDropped(int p_149650_1_, Random p_149650_2_, int p_149650_3_) {
return Blocks.dirt.getItemDropped(0, p_149650_2_, p_149650_3_);
}
@SideOnly(Side.CLIENT)
public Item getItem(World p_149694_1_, int p_149694_2_, int p_149694_3_, int p_149694_4_) {
return Item.getItemFromBlock(Blocks.dirt);
}
@SideOnly(Side.CLIENT)
public IIcon getIcon(int p_149691_1_, int p_149691_2_) {
return p_149691_1_ == 1 ? icon : Blocks.dirt.getIcon(0, 0);
}
@SideOnly(Side.CLIENT)
public void registerBlockIcons(IIconRegister reg) {
icon = reg.registerIcon("ab:terraFarmland");
}
public LexiconEntry getEntry(World world, int x, int y, int z, EntityPlayer player, ItemStack lexicon) {
return RecipeListAB.terraHoe;
}
}
@@ -0,0 +1,65 @@
package ab.common.block.subtile;
import java.util.List;
import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.util.EnumChatFormatting;
import net.minecraft.util.IIcon;
import net.minecraft.util.StatCollector;
import vazkii.botania.api.BotaniaAPI;
import vazkii.botania.api.subtile.SubTileEntity;
import vazkii.botania.api.subtile.SubTileFunctional;
import vazkii.botania.api.subtile.SubTileGenerating;
import vazkii.botania.api.subtile.signature.PassiveFlower;
import vazkii.botania.api.subtile.signature.SubTileSignature;
import vazkii.botania.common.block.BlockSpecialFlower;
public class ABSubTileSignature extends SubTileSignature {
String name;
IIcon icon;
public ABSubTileSignature(String name) {
this.name = name;
}
public void registerIcons(IIconRegister reg) {
this.icon = reg.registerIcon("ab:flower_" + this.name);
BlockSpecialFlower.icons.put(name, icon);
}
public IIcon getIconForStack(ItemStack item) {
return this.icon;
}
public String getUnlocalizedNameForStack(ItemStack item) {
return unlocalizedName("");
}
private String unlocalizedName(String end) {
return "ab.flower." + this.name + end;
}
public String getUnlocalizedLoreTextForStack(ItemStack stack) {
return unlocalizedName(".reference");
}
public String getType() {
Class<? extends SubTileEntity> clazz = BotaniaAPI.getSubTileMapping(this.name);
if(clazz == null)
return "uwotm8";
if(clazz.getAnnotation(PassiveFlower.class) != null)
return "botania.flowerType.passiveGenerating";
if(SubTileGenerating.class.isAssignableFrom(clazz))
return "botania.flowerType.generating";
if(SubTileFunctional.class.isAssignableFrom(clazz))
return "botania.flowerType.functional";
return "botania.flowerType.misc";
}
public void addTooltip(ItemStack stack, EntityPlayer player, List<String> tooltip) {
tooltip.add(EnumChatFormatting.BLUE + StatCollector.translateToLocal(getType()));
}
}
@@ -0,0 +1,131 @@
package ab.common.block.subtile;
import java.util.List;
import ab.api.AdvancedBotanyAPI;
import ab.api.recipe.RecipeAncientAlphirine;
import ab.common.entity.EntityAlphirinePortal;
import ab.common.lib.register.BlockListAB;
import ab.common.lib.register.RecipeListAB;
import net.minecraft.block.Block;
import net.minecraft.entity.item.EntityItem;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.init.Blocks;
import net.minecraft.inventory.IInventory;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTBase;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.nbt.NBTTagList;
import net.minecraft.util.AxisAlignedBB;
import net.minecraft.world.World;
import vazkii.botania.api.lexicon.LexiconEntry;
import vazkii.botania.api.lexicon.multiblock.Multiblock;
import vazkii.botania.api.lexicon.multiblock.MultiblockSet;
import vazkii.botania.api.subtile.RadiusDescriptor;
import vazkii.botania.api.subtile.SubTileEntity;
import vazkii.botania.api.subtile.SubTileFunctional;
import vazkii.botania.common.Botania;
import vazkii.botania.common.block.ModBlocks;
import vazkii.botania.common.block.ModFluffBlocks;
import vazkii.botania.common.item.ItemLexicon;
public class SubTileAncientAlphirine extends SubTileFunctional {
protected static int manaRequare = 4500;
public void onUpdate() {
super.onUpdate();
float posX = this.supertile.xCoord + 0.5f;
float posY = this.supertile.yCoord;
float posZ = this.supertile.zCoord + 0.5f;
World world = this.supertile.getWorldObj();
List<EntityItem> items = world.getEntitiesWithinAABB(EntityItem.class, AxisAlignedBB.getBoundingBox(posX, posY, posZ, (posX + 1), (posY + 1), (posZ + 1)).expand(1, 0, 1));
if(this.ticksExisted % 10 == 0 && this.mana >= manaRequare) {
label666: for(EntityItem item : items) {
if(item.isDead || !(item.getEntityItem().stackSize >= 1))
continue;
for(RecipeAncientAlphirine recipe : AdvancedBotanyAPI.alphirineRecipes) {
if(recipe.matches(item.getEntityItem())) {
if(world.isRemote) {
spawnParticle(world, item);
} else {
if(item.getEntityItem().stackSize > 1)
item.getEntityItem().stackSize -= 1;
else
item.setDead();
if(world.rand.nextInt(111) <= recipe.getChance()) {
spawnPortal(world, recipe.getOutput().copy(), posX, posY, posZ);
this.mana -= manaRequare;
} else {
this.mana -= manaRequare / 10;
}
this.sync();
}
break label666;
}
}
if(item.getEntityItem().getItem() instanceof ItemLexicon) {
if(!((ItemLexicon)item.getEntityItem().getItem()).isKnowledgeUnlocked(item.getEntityItem(), RecipeListAB.forgotten)) {
if(world.isRemote)
spawnParticle(world, item);
else {
if(item.getEntityItem().stackSize > 1)
item.getEntityItem().stackSize -= 1;
else
item.setDead();
ItemStack lexicon = item.getEntityItem().copy();
((ItemLexicon)lexicon.getItem()).unlockKnowledge(lexicon, RecipeListAB.forgotten);
this.mana -= manaRequare;
spawnPortal(world, lexicon, posX, posY, posZ);
this.sync();
}
break label666;
}
}
}
}
}
public RadiusDescriptor getRadius() {
return new RadiusDescriptor.Square(toChunkCoordinates(), 1);
}
private void spawnPortal(World world, ItemStack stack, float posX, float posY, float posZ) {
EntityAlphirinePortal portal = new EntityAlphirinePortal(world);
float itemX = (float)(posX + (Math.random() * 2.0f - 1.0f));
float itemY = (float)(posY + 1.2f + (Math.random() - 0.5f));
float itemZ = (float)(posZ + (Math.random() * 2.0f - 1.0f));
portal.setPosition(itemX, itemY, itemZ);
portal.setStack(stack);
world.spawnEntityInWorld(portal);
}
private void spawnParticle(World world, EntityItem item) {
ItemStack stack = item.getEntityItem();
if(world.isRemote)
for (int i = 0; i < 10; i++) {
float m = 0.2F;
float mx = (float)(Math.random() - 0.5D) * m;
float my = (float)(Math.random() - 0.5D) * m;
float mz = (float)(Math.random() - 0.5D) * m;
if(stack.getItem() instanceof net.minecraft.item.ItemBlock) {
world.spawnParticle("blockcrack_" + Item.getIdFromItem(stack.getItem()) + "_" + stack.getItemDamage(), item.posX, item.posY, item.posZ, mx, my, mz);
} else {
world.spawnParticle("iconcrack_" + Item.getIdFromItem(stack.getItem()) + "_" + stack.getItemDamage(), item.posX, item.posY, item.posZ, mx, my, mz);
}
}
}
public int getMaxMana() {
return 180000;
}
public int getColor() {
return 0xd0bf58;
}
public LexiconEntry getEntry() {
return RecipeListAB.ancientAlphirine;
}
}
@@ -0,0 +1,96 @@
package ab.common.block.subtile;
import ab.common.block.tile.TileGameBoard;
import ab.common.lib.register.RecipeListAB;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.world.World;
import vazkii.botania.api.lexicon.LexiconEntry;
import vazkii.botania.api.subtile.RadiusDescriptor;
import vazkii.botania.api.subtile.SubTileGenerating;
import vazkii.botania.common.item.block.ItemBlockSpecialFlower;
public class SubTileArdentAzarcissus extends SubTileGenerating {
public static final String playerName = "ArdentAzarcissus#21sda2gaj91*21df#111sfq3jrns@#";
public static final ItemStack flowerStack = ItemBlockSpecialFlower.ofType("ardentAzarcissus");
int cooldown;
int workMana = 320;
public void onUpdate() {
super.onUpdate();
World world = this.supertile.getWorldObj();
int posX = this.supertile.xCoord;
int posY = this.supertile.yCoord;
int posZ = this.supertile.zCoord;
if(world.isRemote)
return;
if(cooldown > 0) {
cooldown--;
return;
} else if(this.mana == this.getMaxMana())
return;
boolean needSync = false;
for(int i = -1; i <= 1; i++)
for(int j = -1; j <= 1; j++) {
int x = posX + i;
int z = posZ + j;
TileEntity tile = world.getTileEntity(x, posY, z);
if(tile != null && tile instanceof TileGameBoard) {
TileGameBoard board = (TileGameBoard)tile;
if(board.isSingleGame) {
if(!board.hasGame()) {
board.setPlayer(playerName, true);
cooldown = 120;
} else {
if(!board.playersName[0].equals(playerName))
board.playersName[0] = playerName;
if(!board.isCustomGame)
board.isCustomGame = true;
if(board.endGameTick == 0) {
int winCount = (board.slotChance[0] + board.slotChance[1]) - (board.slotChance[2] + board.slotChance[3]);
if(winCount > 0) {
mana = Math.min(this.getMaxMana(), this.mana + (workMana * winCount));
needSync = true;
}
board.finishGame(false);
} else
board.dropDice(playerName);
cooldown = 120;
}
board.changeCustomStack(flowerStack);
}
}
}
if(needSync)
sync();
}
public RadiusDescriptor getRadius() {
return new RadiusDescriptor.Square(toChunkCoordinates(), 1);
}
public int getMaxMana() {
return 16000;
}
public int getColor() {
return 0xdf3596;
}
public LexiconEntry getEntry() {
return RecipeListAB.azartFlower;
}
public void writeToPacketNBT(NBTTagCompound cmp) {
super.writeToPacketNBT(cmp);
cmp.setInteger("cooldown", this.cooldown);
}
public void readFromPacketNBT(NBTTagCompound cmp) {
super.readFromPacketNBT(cmp);
this.cooldown = cmp.getInteger("cooldown");
}
}
@@ -0,0 +1,100 @@
package ab.common.block.subtile;
import java.util.ArrayList;
import java.util.List;
import java.util.Random;
import ab.common.lib.register.RecipeListAB;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.player.EntityPlayerMP;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.util.AxisAlignedBB;
import net.minecraft.world.World;
import thaumcraft.api.aspects.Aspect;
import thaumcraft.api.aspects.AspectList;
import thaumcraft.common.Thaumcraft;
import thaumcraft.common.lib.network.PacketHandler;
import thaumcraft.common.lib.network.playerdata.PacketAspectPool;
import thaumcraft.common.lib.network.playerdata.PacketSyncAspects;
import vazkii.botania.api.lexicon.LexiconEntry;
import vazkii.botania.api.subtile.RadiusDescriptor;
import vazkii.botania.api.subtile.SubTileFunctional;
public class SubTileAspecolus extends SubTileFunctional {
protected static int manaRequare = 1250;
int cooldown = 0;
public void onUpdate() {
super.onUpdate();
World world = this.supertile.getWorldObj();
if(world.isRemote)
return;
if(this.cooldown > 0)
this.cooldown -= 1;
int posX = this.supertile.xCoord;
int posY = this.supertile.yCoord;
int posZ = this.supertile.zCoord;
List<EntityPlayer> players = world.getEntitiesWithinAABB(EntityPlayer.class, AxisAlignedBB.getBoundingBox(posX, posY, posZ, (posX + 1), (posY + 1), (posZ + 1)));
int countPlayer = 0;
for(EntityPlayer p : players) {
if(!(this.mana >= this.manaRequare))
break;
else if(this.cooldown > 0)
break;
AspectList aspList = Thaumcraft.proxy.playerKnowledge.getAspectsDiscovered(p.getDisplayName());
ArrayList<Aspect> aspects = new ArrayList<Aspect>();
for(Aspect a : aspList.getAspects()) {
if(!Aspect.getPrimalAspects().contains(a) && Thaumcraft.proxy.playerKnowledge.getAspectPoolFor(p.getCommandSenderName(), a) > 0)
aspects.add(a);
}
if(aspects.isEmpty())
continue;
for(int i = 0; i < 8; i++) {
Aspect a = aspects.get(world.rand.nextInt(aspects.size()));
if(!(Thaumcraft.proxy.playerKnowledge.getAspectPoolFor(p.getCommandSenderName(), a) > 0))
continue;
Aspect[] components = a.getComponents();
aspList.reduce(a, 1);
for(int r = 0; r < components.length; r++) {
if(world.rand.nextInt(100) < 70)
continue;
Thaumcraft.proxy.playerKnowledge.addAspectPool(p.getDisplayName(), components[r], (short) 1);
PacketHandler.INSTANCE.sendTo(new PacketAspectPool(components[r].getTag(), (short) 1, Thaumcraft.proxy.playerKnowledge.getAspectPoolFor(p.getCommandSenderName(), components[r])),
(EntityPlayerMP) p);
}
}
this.mana -= this.manaRequare;
this.sync();
++countPlayer;
}
if(countPlayer > 0)
this.cooldown = 75 * countPlayer;
}
public RadiusDescriptor getRadius() {
return new RadiusDescriptor.Square(toChunkCoordinates(), 1);
}
public int getMaxMana() {
return 15000;
}
public int getColor() {
return 0x8a20dc;
}
public LexiconEntry getEntry() {
return RecipeListAB.aspecolus;
}
public void writeToPacketNBT(NBTTagCompound cmp) {
super.writeToPacketNBT(cmp);
cmp.setInteger("cooldown", this.cooldown);
}
public void readFromPacketNBT(NBTTagCompound cmp) {
super.readFromPacketNBT(cmp);
this.cooldown = cmp.getInteger("cooldown");
}
}
@@ -0,0 +1,120 @@
package ab.common.block.subtile;
import java.util.List;
import ab.common.core.handler.ConfigABHandler;
import ab.common.lib.register.RecipeListAB;
import net.minecraft.block.Block;
import net.minecraft.client.Minecraft;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.passive.EntityVillager;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.init.Blocks;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.AxisAlignedBB;
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;
import net.minecraftforge.common.util.ForgeDirection;
import vazkii.botania.api.lexicon.LexiconEntry;
import vazkii.botania.api.subtile.RadiusDescriptor;
import vazkii.botania.api.subtile.SubTileGenerating;
import vazkii.botania.common.block.tile.TileSpecialFlower;
public class SubTileDictarius extends SubTileGenerating {
private static final int workMana = 480;
int cooldown;
public void onUpdate() {
super.onUpdate();
if(this.supertile.getWorldObj().isRemote)
return;
int posX = this.supertile.xCoord;
int posY = this.supertile.yCoord;
int posZ = this.supertile.zCoord;
World world = this.supertile.getWorldObj();
if(world.getTotalWorldTime() % 1200 == 0)
checkNearDictarius();
if(this.mana != this.getMaxMana() && cooldown == 0) {
List<EntityLivingBase> livs = world.getEntitiesWithinAABB(EntityLivingBase.class, AxisAlignedBB.getBoundingBox(posX, posY, posZ, (posX + 1), (posY + 1), (posZ + 1)).expand(2, 1, 2));
int workMana = 0;
int villagers = 0;
if(!livs.isEmpty()) {
for(int i = 0; i < Math.min(livs.size(), 16); i++) {
EntityLivingBase liv = livs.get(i);
if(liv instanceof EntityPlayer)
workMana += SubTileDictarius.workMana;
else if(!world.isRemote && liv instanceof EntityVillager) {
workMana += (int)(SubTileDictarius.workMana / 6);
if(villagers > 15 && world.rand.nextInt(100) <= 4)
liv.setDead();
villagers++;
}
}
}
if(workMana > 0) {
this.cooldown = 200;
workMana *= Math.random();
this.mana = Math.min(this.getMaxMana(), this.mana + workMana);
sync();
}
}
if(cooldown > 0)
cooldown -= 1;
}
public RadiusDescriptor getRadius() {
return new RadiusDescriptor.Square(toChunkCoordinates(), 2);
}
public void checkNearDictarius() {
int findedFlower = 0;
for(int z = -4; z < 4; z++) {
for(int x = -4; x < 4; x++) {
for(int y = -4; y < 4; y++) {
int posX = this.supertile.xCoord + x;
int posY = this.supertile.yCoord + y;
int posZ = this.supertile.zCoord + z;
TileEntity tile = this.supertile.getWorldObj().getTileEntity(posX, posY, posZ);
if(tile != null && tile instanceof TileSpecialFlower) {
TileSpecialFlower tileFlower = (TileSpecialFlower)tile;
if(tileFlower.subTileName.equals("dictarius")) {
if(findedFlower >= ConfigABHandler.maxDictariusCount) {
this.supertile.getWorldObj().playAuxSFX(2001, this.supertile.xCoord, this.supertile.yCoord, this.supertile.zCoord, Block.getIdFromBlock(this.supertile.getBlockType()));
if(this.supertile.getWorldObj().getBlock(this.supertile.xCoord, this.supertile.yCoord - 1, this.supertile.zCoord).isSideSolid((IBlockAccess)this.supertile.getWorldObj(), this.supertile.xCoord, this.supertile.yCoord - 1, this.supertile.zCoord, ForgeDirection.UP))
this.supertile.getWorldObj().setBlock(this.supertile.xCoord, this.supertile.yCoord, this.supertile.zCoord, (Block)Blocks.deadbush);
else
this.supertile.getWorldObj().setBlockToAir(this.supertile.xCoord, this.supertile.yCoord, this.supertile.zCoord);
return;
}
findedFlower++;
}
}
}
}
}
}
public int getMaxMana() {
return 8000;
}
public int getColor() {
return 0xd2cdb2;
}
public LexiconEntry getEntry() {
return RecipeListAB.dictarius;
}
public void writeToPacketNBT(NBTTagCompound cmp) {
super.writeToPacketNBT(cmp);
cmp.setInteger("cooldown", this.cooldown);
}
public void readFromPacketNBT(NBTTagCompound cmp) {
super.readFromPacketNBT(cmp);
this.cooldown = cmp.getInteger("cooldown");
}
}
@@ -0,0 +1,89 @@
package ab.common.block.subtile;
import java.util.List;
import ab.common.lib.register.RecipeListAB;
import net.minecraft.block.material.Material;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.util.AxisAlignedBB;
import net.minecraft.world.World;
import thaumcraft.api.aspects.Aspect;
import thaumcraft.common.entities.EntityAspectOrb;
import vazkii.botania.api.lexicon.LexiconEntry;
import vazkii.botania.api.subtile.RadiusDescriptor;
import vazkii.botania.api.subtile.SubTileFunctional;
import vazkii.botania.common.Botania;
import vazkii.botania.common.block.ModBlocks;
public class SubTilePureGladiolus extends SubTileFunctional {
private static final int MAX_MANA = 10000;
private static final String COOLDOWN_TAG = "Cooldown";
private static final Aspect[] PRIMALS = new Aspect[] { Aspect.AIR, Aspect.WATER, Aspect.EARTH, Aspect.ENTROPY, Aspect.ORDER, Aspect.FIRE };
private int cooldown = 180;
protected static int manaRequare = 1000;
public void onUpdate() {
super.onUpdate();
int tick = 1;
World world = this.supertile.getWorldObj();
int x = this.supertile.xCoord;
int y = this.supertile.yCoord;
int z = this.supertile.zCoord;
List<EntityPlayer> players = world.getEntitiesWithinAABB(EntityPlayer.class, AxisAlignedBB.getBoundingBox(x, y, z, (x + 1), (y + 1), (z + 1)).expand(1.9f, 1.2f, 1.9f));
if(world.getBlock(x, y + 1, z).getMaterial() != Material.air)
return;
else if(world.getBlock(x, y - 1, z) == ModBlocks.enchantedSoil)
tick = 2;
if(players.isEmpty())
return;
if(cooldown > 0)
cooldown -= tick;
else if(mana >= manaRequare && cooldown <= 0) {
mana -= manaRequare;
cooldown = 180;
spawnAspectOrbs(world, x + 0.5, y + 1.0, z + 0.5);
}
}
public RadiusDescriptor getRadius() {
return new RadiusDescriptor.Square(toChunkCoordinates(), 1);
}
public LexiconEntry getEntry() {
return RecipeListAB.gladious;
}
public void spawnAspectOrbs(World world, double x, double y, double z) {
if(!world.isRemote) {
for (int i = 0; i < 3 + world.rand.nextInt(3); i++) {
EntityAspectOrb orb = new EntityAspectOrb(world, x, y, z, PRIMALS[world.rand.nextInt(6)], 2 + world.rand.nextInt(3));
orb.motionX = 0.05 - Math.random() * 0.1;
orb.motionY = 0.07;
orb.motionZ = 0.05 - Math.random() * 0.1;
world.spawnEntityInWorld(orb);
}
this.sync();
}
}
public int getColor() {
return 0xFF00FF;
}
public int getMaxMana() {
return MAX_MANA;
}
public void writeToPacketNBT(NBTTagCompound cmp) {
super.writeToPacketNBT(cmp);
cmp.setInteger(COOLDOWN_TAG, this.cooldown);
}
public void readFromPacketNBT(NBTTagCompound cmp) {
super.readFromPacketNBT(cmp);
this.cooldown = cmp.getInteger(COOLDOWN_TAG);
}
}
@@ -0,0 +1,122 @@
package ab.common.block.tile;
import java.util.UUID;
import org.lwjgl.opengl.GL11;
import ab.common.core.handler.ConfigABHandler;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.ScaledResolution;
import net.minecraft.client.renderer.RenderHelper;
import net.minecraft.client.renderer.entity.RenderItem;
import net.minecraft.entity.Entity;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.StatCollector;
import vazkii.botania.api.internal.IManaBurst;
import vazkii.botania.api.mana.BurstProperties;
import vazkii.botania.api.mana.ILensEffect;
import vazkii.botania.api.mana.IManaReceiver;
import vazkii.botania.client.core.handler.HUDHandler;
import vazkii.botania.common.block.tile.mana.TileSpreader;
import vazkii.botania.common.entity.EntityManaBurst;
public class TileABSpreader extends TileSpreader {
protected boolean requestsClientUpdate = false;
protected int knownMana = -1;
protected IManaReceiver receiver = null;
public void readCustomNBT(NBTTagCompound cmp) {
super.readCustomNBT(cmp);
this.requestsClientUpdate = cmp.getBoolean("requestUpdate");
if(cmp.hasKey("knownMana"))
this.knownMana = cmp.getInteger("knownMana");
if(this.requestsClientUpdate && this.worldObj != null) {
int x = cmp.getInteger("forceClientBindingX");
int y = cmp.getInteger("forceClientBindingY");
int z = cmp.getInteger("forceClientBindingZ");
if(y != -1) {
TileEntity tile = this.worldObj.getTileEntity(x, y, z);
if(tile instanceof IManaReceiver) {
this.receiver = (IManaReceiver)tile;
} else {
this.receiver = null;
}
} else {
this.receiver = null;
}
}
}
public EntityManaBurst getBurst(boolean fake) {
EntityManaBurst burst = new EntityManaBurst(this, fake);
int maxMana = ConfigABHandler.spreaderBurstMana;
int color = 0xcdd419;
int ticksBeforeManaLoss = 35;
float manaLossPerTick = ConfigABHandler.spreaderBurstMana / 4.5f;
float motionModifier = 2.5f;
float gravity = 0.0F;
BurstProperties props = new BurstProperties(maxMana, ticksBeforeManaLoss, manaLossPerTick, gravity, motionModifier, color);
ItemStack lens = getStackInSlot(0);
if(lens != null && lens.getItem() instanceof ILensEffect)
((ILensEffect)lens.getItem()).apply(lens, props);
burst.setSourceLens(lens);
if(getCurrentMana() >= props.maxMana || fake) {
burst.setColor(props.color);
burst.setMana(props.maxMana);
burst.setStartingMana(props.maxMana);
burst.setMinManaLoss(props.ticksBeforeManaLoss);
burst.setManaLossPerTick(props.manaLossPerTick);
burst.setGravity(props.gravity);
burst.setMotion(burst.motionX * props.motionModifier, burst.motionY * props.motionModifier, burst.motionZ * props.motionModifier);
return burst;
}
return null;
}
public void renderHUD(Minecraft mc, ScaledResolution res) {
String name = StatCollector.translateToLocal("tile.advancedSpreader.name");
int color = 0xcdd419;
HUDHandler.drawSimpleManaHUD(color, this.knownMana, getMaxMana(), name, res);
ItemStack lens = getStackInSlot(0);
if(lens != null) {
GL11.glEnable(3042);
GL11.glBlendFunc(770, 771);
String lensName = lens.getDisplayName();
int width = 16 + mc.fontRenderer.getStringWidth(lensName) / 2;
int x = res.getScaledWidth() / 2 - width;
int y = res.getScaledHeight() / 2 + 50;
mc.fontRenderer.drawStringWithShadow(lensName, x + 20, y + 5, color);
RenderHelper.enableGUIStandardItemLighting();
RenderItem.getInstance().renderItemAndEffectIntoGUI(mc.fontRenderer, mc.renderEngine, lens, x, y);
RenderHelper.disableStandardItemLighting();
GL11.glDisable(2896);
GL11.glDisable(3042);
}
if(this.receiver != null) {
TileEntity receiverTile = (TileEntity)this.receiver;
ItemStack recieverStack = new ItemStack(this.worldObj.getBlock(receiverTile.xCoord, receiverTile.yCoord, receiverTile.zCoord), 1, receiverTile.getBlockMetadata());
GL11.glEnable(3042);
GL11.glBlendFunc(770, 771);
if(recieverStack != null && recieverStack.getItem() != null) {
String stackName = recieverStack.getDisplayName();
int width = 16 + mc.fontRenderer.getStringWidth(stackName) / 2;
int x = res.getScaledWidth() / 2 - width;
int y = res.getScaledHeight() / 2 + 30;
mc.fontRenderer.drawStringWithShadow(stackName, x + 20, y + 5, color);
RenderHelper.enableGUIStandardItemLighting();
RenderItem.getInstance().renderItemAndEffectIntoGUI(mc.fontRenderer, mc.renderEngine, recieverStack, x, y);
RenderHelper.disableStandardItemLighting();
}
GL11.glDisable(2896);
GL11.glDisable(3042);
}
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
}
public int getMaxMana() {
return ConfigABHandler.spreaderMaxMana;
}
}
@@ -0,0 +1,169 @@
package ab.common.block.tile;
import java.util.List;
import ab.api.AdvancedBotanyAPI;
import ab.common.core.handler.ConfigABHandler;
import net.minecraft.entity.item.EntityItem;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.player.EntityPlayerMP;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.util.AxisAlignedBB;
import net.minecraft.util.ChatComponentTranslation;
import net.minecraft.util.ChatStyle;
import net.minecraft.util.EnumChatFormatting;
import net.minecraft.util.Vec3;
import vazkii.botania.api.internal.VanillaPacketDispatcher;
import vazkii.botania.api.item.IRelic;
import vazkii.botania.common.item.relic.ItemDice;
import vazkii.botania.common.item.relic.ItemRelic;
public class TileBoardFate extends TileInventory {
public byte[] slotChance = new byte[getSizeInventory()];
public int clientTick[] = new int[] { 0, 0, 0, 0 };
public boolean requestUpdate;
public void updateEntity() {
if(!worldObj.isRemote)
updateServer();
else
updateAnimationTicks();
}
public void updateAnimationTicks() {
for(int i = 0; i < getSizeInventory(); i++)
if(getStackInSlot(i) != null)
clientTick[i]++;
else
clientTick[i] = 0;
}
protected void updateServer() {
if(requestUpdate)
VanillaPacketDispatcher.dispatchTEToNearbyPlayers(this.worldObj, this.xCoord, this.yCoord, this.zCoord);
boolean hasUpdate = false;
if(hasFreeSlot())
hasUpdate = setDiceFate();
requestUpdate = hasUpdate;
}
public boolean spawnRelic(EntityPlayer player) {
int relicCount = 0;
for(int i = 0; i < getSizeInventory(); i++) {
if(getStackInSlot(i) == null)
slotChance[i] = 0;
else if(!ItemRelic.isRightPlayer(player, getStackInSlot(i))) {
if(!worldObj.isRemote)
dropRelic(player, i);
return true;
}
else
setInventorySlotContents(i, null);
relicCount += slotChance[i];
}
if(relicCount < 1)
return false;
else if(!worldObj.isRemote) {
ItemStack relic = AdvancedBotanyAPI.relicList.get(Math.min(relicCount - 1, AdvancedBotanyAPI.relicList.size() - 1)).copy();
worldObj.playSoundAtEntity(player, "random.bow", 0.5F, 0.4F / (worldObj.rand.nextFloat() * 0.4F + 0.8F));
if(hasRelicAchievement(player, relic) || !ConfigABHandler.fateBoardRelicEnables[relicCount - 1]) {
player.addChatMessage((new ChatComponentTranslation("botaniamisc.dudDiceRoll", new Object[] { Integer.valueOf(relicCount) })).setChatStyle((new ChatStyle()).setColor(EnumChatFormatting.DARK_GREEN)));
} else {
ItemRelic.updateRelic(relic, player);
EntityItem entityItem = new EntityItem(worldObj, xCoord + 0.5f, yCoord + 0.5f, zCoord + 0.5f, relic);
player.addChatMessage((new ChatComponentTranslation("botaniamisc.diceRoll", new Object[] { Integer.valueOf(relicCount) })).setChatStyle((new ChatStyle()).setColor(EnumChatFormatting.DARK_GREEN)));
worldObj.spawnEntityInWorld(entityItem);
}
requestUpdate = true;
}
return true;
}
private void dropRelic(EntityPlayer player, int slot) {
EntityItem entityItem = new EntityItem(worldObj, xCoord + 0.5f, yCoord + 0.8f, zCoord + 0.5f, getStackInSlot(slot).copy());
float f3 = 0.15F;
Vec3 vec = player.getLookVec();
entityItem.motionX = vec.xCoord * f3;
entityItem.motionY = 0.25F;
entityItem.motionZ = vec.zCoord * f3;
setInventorySlotContents(slot, null);
worldObj.spawnEntityInWorld(entityItem);
}
public static boolean hasRelicAchievement(EntityPlayer player, ItemStack rStack) {
EntityPlayerMP mpPlayer = (EntityPlayerMP)player;
IRelic irelic = (IRelic)rStack.getItem();
if(irelic.getBindAchievement() == null)
return false;
return mpPlayer.func_147099_x().hasAchievementUnlocked(irelic.getBindAchievement());
}
protected boolean hasFreeSlot() {
for(int i = 0; i < getSizeInventory(); i++)
if(getStackInSlot(i) == null)
return true;
return false;
}
protected boolean setDiceFate() {
boolean hasUpdate = false;
List<EntityItem> items = this.worldObj.getEntitiesWithinAABB(EntityItem.class, AxisAlignedBB.getBoundingBox(this.xCoord, this.yCoord, this.zCoord, (this.xCoord + 1), (this.yCoord + 0.7f), (this.zCoord + 1)));
label666: for(EntityItem item : items) {
if(!item.isDead && item.getEntityItem() != null) {
ItemStack stack = item.getEntityItem();
if(!isDice(stack))
continue;
for(int s = 0; s < getSizeInventory(); s++) {
ItemStack slotStack = getStackInSlot(s);
if(slotStack != null)
continue;
ItemStack copy = stack.copy();
copy.stackSize = 1;
setInventorySlotContents(s, copy);
slotChance[s] = (byte)(worldObj.rand.nextInt(6) + 1);
stack.stackSize--;
if(stack.stackSize == 0)
item.setDead();
hasUpdate = true;
worldObj.playSoundEffect(this.xCoord, this.yCoord, this.zCoord, "ab:boardCube", 0.6F, 1.0F);
break label666;
}
}
}
return hasUpdate;
}
public static boolean isDice(ItemStack stack) {
for(ItemStack dice : AdvancedBotanyAPI.diceList) {
if(dice.getItem() == stack.getItem() && (dice.getItemDamage() == stack.getItemDamage() || dice.getItemDamage() == 32767))
return true;
}
return false;
}
public void writeCustomNBT(NBTTagCompound cmp) {
super.writeCustomNBT(cmp);
cmp.setByteArray("slotChance", slotChance);
cmp.setBoolean("requestUpdate", requestUpdate);
}
public void readCustomNBT(NBTTagCompound cmp) {
super.readCustomNBT(cmp);
slotChance = cmp.getByteArray("slotChance");
requestUpdate = cmp.getBoolean("requestUpdate");
}
public int getInventoryStackLimit() {
return 1;
}
public String getInventoryName() {
return "inv.boardFate";
}
public int getSizeInventory() {
return 2;
}
}
@@ -0,0 +1,333 @@
package ab.common.block.tile;
import java.util.List;
import org.lwjgl.opengl.GL11;
import ab.api.IBoundRender;
import ab.client.core.ClientHelper;
import net.minecraft.block.Block;
import net.minecraft.block.BlockChest;
import net.minecraft.block.BlockHopper;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.Gui;
import net.minecraft.client.gui.ScaledResolution;
import net.minecraft.client.renderer.RenderHelper;
import net.minecraft.client.renderer.entity.RenderItem;
import net.minecraft.command.IEntitySelector;
import net.minecraft.entity.Entity;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.init.Blocks;
import net.minecraft.inventory.IInventory;
import net.minecraft.inventory.ISidedInventory;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.tileentity.IHopper;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.tileentity.TileEntityChest;
import net.minecraft.tileentity.TileEntityHopper;
import net.minecraft.util.AxisAlignedBB;
import net.minecraft.util.ChunkCoordinates;
import net.minecraft.util.Facing;
import net.minecraft.util.MathHelper;
import net.minecraft.util.MovingObjectPosition;
import net.minecraft.world.World;
import net.minecraftforge.common.util.ForgeDirection;
import vazkii.botania.api.wand.IWandBindable;
import vazkii.botania.client.core.handler.HUDHandler;
import vazkii.botania.common.core.helper.Vector3;
import vazkii.botania.common.item.ModItems;
public class TileEngineerHopper extends TileInventory implements IHopper, IBoundRender {
private int cooldown;
private int[] invPosX = new int[] {0, 0};
private int[] invPosY = new int[] {-1, -1};
private int[] invPosZ = new int[] {0, 0};
private int[] invSide = new int[] {-1, -1};
private boolean bindType;
public int redstoneSignal = 0;
public void updateEntity() {
this.redstoneSignal = 0;
for(ForgeDirection dir : ForgeDirection.VALID_DIRECTIONS) {
int redstoneSide = getWorldObj().getIndirectPowerLevelTo(xCoord + dir.offsetX, yCoord + dir.offsetY, zCoord + dir.offsetZ, dir.ordinal());
this.redstoneSignal = Math.max(this.redstoneSignal, redstoneSide);
}
if(redstoneSignal > 0)
return;
else if(this.worldObj != null) {
if(!this.worldObj.isRemote) {
if(cooldown > 0)
--cooldown;
else if(cooldown == 0) {
if(worldObj != null && !worldObj.isRemote) {
boolean hasUpdate = false;
ItemStack stack = getStackInSlot(0);
if(stack != null)
hasUpdate = canExtractStack();
if(stack == null || stack.stackSize != stack.getMaxStackSize())
hasUpdate = canInsertStack() || hasUpdate;
if(hasUpdate)
this.cooldown = 8;
this.markDirty();
}
}
}
}
}
public boolean bindTo(EntityPlayer player, ItemStack wand, int x, int y, int z, int side) {
TileEntity tile = player.getEntityWorld().getTileEntity(x, y, z);
boolean isFar = Math.abs(this.xCoord - x) >= 10 || Math.abs(this.yCoord - y) >= 10 || Math.abs(this.zCoord - z) >= 10;
if(isFar)
return false;
int invCount = bindType ? 0 : 1;
if(tile instanceof TileEngineerHopper)
return false;
else if(tile != null && tile instanceof IInventory) {
setDistantInventory(invCount, x, y, z);
invSide[invCount] = side;
return true;
} else {
setDistantInventory(invCount, 0, -1, 0);
invSide[invCount] = -1;
return false;
}
}
public void changeBindType() {
bindType = !bindType;
}
public void setDistantInventory(int count, int posX, int posY, int posZ) {
invPosX[count] = posX;
invPosY[count] = posY;
invPosZ[count] = posZ;
}
public IInventory getDistantInventory(int count) {
IInventory inv = TileEntityHopper.func_145893_b(this.getWorldObj(), invPosX[count], invPosY[count], invPosZ[count]);
if(inv == null)
setDistantInventory(count, 0, -1, 0);
return inv;
}
public boolean canSelect(EntityPlayer player, ItemStack wand, int x, int y, int z, int side) {
return true;
}
public ChunkCoordinates[] getBlocksCoord() {
return new ChunkCoordinates[] { new ChunkCoordinates(invPosX[0], invPosY[0], invPosZ[0]), new ChunkCoordinates(invPosX[1], invPosY[1], invPosZ[1]) };
}
public ChunkCoordinates getBinding() {
return null;
}
public void renderHUD(Minecraft mc, ScaledResolution res) {
int x = res.getScaledWidth() / 2 - 7;
int y = res.getScaledHeight() / 2 + 16;
GL11.glEnable(3042);
GL11.glBlendFunc(770, 771);
ClientHelper.drawArrow(x - 2, y, false);
for(int i = 0; i < 2; i++) {
ItemStack stack = null;
boolean hasInv = false;
int posX = x + (i == 0 ? 32 : -32);
if(getDistantInventory(i) != null && (TileEntity)getDistantInventory(i) != null) {
TileEntity tile = (TileEntity)getDistantInventory(i);
Block block = tile.getWorldObj().getBlock(tile.xCoord, tile.yCoord, tile.zCoord);
int meta = tile.getWorldObj().getBlockMetadata(tile.xCoord, tile.yCoord, tile.zCoord);
stack = new ItemStack(block, 1, meta);
hasInv = true;
}
Gui.drawRect(posX - 4, y - 4, posX + 20, y + 20, 1140850688);
Gui.drawRect(posX - 2, y - 2, posX + 18, y + 18, 1140850688);
if(stack != null) {
RenderHelper.enableGUIStandardItemLighting();
GL11.glEnable(32826);
RenderItem.getInstance().renderItemAndEffectIntoGUI(mc.fontRenderer, mc.renderEngine, stack, posX, y);
RenderHelper.disableStandardItemLighting();
GL11.glDisable(2929);
}
int invCount = bindType ? 0 : 1;
if(invCount == i) {
GL11.glTranslatef(0.0f, 0.0f, 300.0f);
RenderHelper.enableGUIStandardItemLighting();
GL11.glEnable(32826);
RenderItem.getInstance().renderItemIntoGUI(mc.fontRenderer, mc.renderEngine, new ItemStack(ModItems.twigWand), posX + 10, y + 7);
RenderHelper.disableStandardItemLighting();
GL11.glDisable(2929);
GL11.glTranslatef(0.0f, 0.0f, -300.0f);
}
boolean unicode = mc.fontRenderer.getUnicodeFlag();
mc.fontRenderer.setUnicodeFlag(true);
if(!hasInv) {
mc.fontRenderer.drawStringWithShadow("\u2717", posX + 5, y + 6, 4980736);
mc.fontRenderer.drawStringWithShadow("\u2717", posX + 5, y + 5, 13764621);
}
mc.fontRenderer.setUnicodeFlag(unicode);
GL11.glEnable(2929);
}
GL11.glDisable(3042);
}
public void writeCustomNBT(NBTTagCompound nbtt) {
super.writeCustomNBT(nbtt);
nbtt.setInteger("cooldown", this.cooldown);
nbtt.setBoolean("bindType", this.bindType);
nbtt.setIntArray("bindingX", this.invPosX);
nbtt.setIntArray("bindingY", this.invPosY);
nbtt.setIntArray("bindingZ", this.invPosZ);
nbtt.setIntArray("bindingSide", this.invSide);
}
public void readCustomNBT(NBTTagCompound nbtt) {
super.readCustomNBT(nbtt);
this.cooldown = nbtt.getInteger("cooldown");
this.bindType = nbtt.getBoolean("bindType");
this.invPosX = nbtt.getIntArray("bindingX");
this.invPosY = nbtt.getIntArray("bindingY");
this.invPosZ = nbtt.getIntArray("bindingZ");
this.invSide = nbtt.getIntArray("bindingSide");
}
private boolean canExtractStack() {
IInventory inv = getDistantInventory(0);
if(inv == null)
return false;
else {
int side = invSide[0];
int pullCount = getPullCount(inv, side);
System.out.println("canExtractStack " + pullCount);
if(pullCount <= 0)
return false;
else {
if(getStackInSlot(0) != null) {
ItemStack itemstack = getStackInSlot(0).copy();
ItemStack itemstack1 = TileEntityHopper.func_145889_a(inv, decrStackSize(0, pullCount), side);
if(itemstack1 == null || itemstack1.stackSize == 0) {
inv.markDirty();
return true;
}
setInventorySlotContents(0, itemstack);
}
return false;
}
}
}
private int getPullCount(IInventory inv, int side) {
if(inv instanceof ISidedInventory && side > -1) {
ISidedInventory sideInv = (ISidedInventory)inv;
int[] slots = sideInv.getAccessibleSlotsFromSide(side);
for(int i = 0; i < slots.length; ++i) {
ItemStack stack = sideInv.getStackInSlot(slots[i]);
if(stack == null)
return inv.getInventoryStackLimit();
else if(inv.getInventoryStackLimit() != stack.stackSize && stack.stackSize != stack.getMaxStackSize() && TileNidavellirForge.isItemEqual(stack, getStackInSlot(0)))
return inv.getInventoryStackLimit() - stack.stackSize;
}
} else {
int size = inv.getSizeInventory();
for(int i = 0; i < size; ++i) {
ItemStack stack = inv.getStackInSlot(i);
if(stack == null)
return inv.getInventoryStackLimit();
else if(inv.getInventoryStackLimit() != stack.stackSize && stack.stackSize != stack.getMaxStackSize() && TileNidavellirForge.isItemEqual(stack, getStackInSlot(0)))
return inv.getInventoryStackLimit() - stack.stackSize;
}
}
return 0;
}
private boolean canInsertStack() {
IInventory inv = getDistantInventory(1);
if(inv != null) {
int side = invSide[1];
int takeCount = getTakeCount(inv, side);
System.out.println("canInsertStack " + takeCount);
if(takeCount <= 0)
return false;
if(inv instanceof ISidedInventory && side > -1) {
ISidedInventory sidedInv = (ISidedInventory)inv;
int[] slots = sidedInv.getAccessibleSlotsFromSide(side);
for(int k = 0; k < slots.length; ++k) {
if(func_145892_a(inv, slots[k], side, takeCount))
return true;
}
} else {
int i = inv.getSizeInventory();
for(int j = 0; j < i; ++j) {
if(func_145892_a(inv, j, side, takeCount))
return true;
}
}
}
return false;
}
private int getTakeCount(IInventory inv, int side) {
if(inv instanceof ISidedInventory && side > -1) {
ISidedInventory sideInv = (ISidedInventory)inv;
int[] slots = sideInv.getAccessibleSlotsFromSide(side);
for(int i = 0; i < slots.length; ++i) {
ItemStack stack = sideInv.getStackInSlot(slots[i]);
if(stack != null)
if(getStackInSlot(0) == null)
return Math.min(stack.getMaxStackSize(), getInventoryStackLimit());
else if(getInventoryStackLimit() != getStackInSlot(0).stackSize && getStackInSlot(0).stackSize != getStackInSlot(0).getMaxStackSize() && TileNidavellirForge.isItemEqual(stack, getStackInSlot(0)))
return getInventoryStackLimit() - getStackInSlot(0).stackSize;
}
} else {
for(int i = 0; i < inv.getSizeInventory(); ++i) {
ItemStack stack = inv.getStackInSlot(i);
if(stack != null)
if(getStackInSlot(0) == null)
return Math.min(stack.getMaxStackSize(), getInventoryStackLimit());
else if(getInventoryStackLimit() != getStackInSlot(0).stackSize && getStackInSlot(0).stackSize != getStackInSlot(0).getMaxStackSize() && TileNidavellirForge.isItemEqual(stack, getStackInSlot(0)))
return getInventoryStackLimit() - getStackInSlot(0).stackSize;
}
}
return 0;
}
private boolean func_145892_a(IInventory inv, int slot, int side, int takeCount) {
ItemStack itemstack = inv.getStackInSlot(slot);
if(itemstack != null && func_145890_b(inv, itemstack, slot, side)) {
ItemStack itemstack1 = itemstack.copy();
ItemStack itemstack2 = TileEntityHopper.func_145889_a(this, inv.decrStackSize(slot, takeCount), side);
if(itemstack2 == null || itemstack2.stackSize == 0) {
inv.markDirty();
return true;
}
inv.setInventorySlotContents(slot, itemstack1);
}
return false;
}
private static boolean func_145890_b(IInventory inv, ItemStack stack, int slot, int side) {
return !(inv instanceof ISidedInventory) || ((ISidedInventory)inv).canExtractItem(slot, stack, side);
}
public int getSizeInventory() {
return 1;
}
public String getInventoryName() {
return "engineerHopper";
}
public double getXPos() {
return this.xCoord;
}
public double getYPos() {
return this.yCoord;
}
public double getZPos() {
return this.zCoord;
}
}
@@ -0,0 +1,259 @@
package ab.common.block.tile;
import java.util.List;
import ab.api.IRenderHud;
import ab.common.block.subtile.SubTileArdentAzarcissus;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.ScaledResolution;
import net.minecraft.client.renderer.RenderHelper;
import net.minecraft.client.renderer.entity.RenderItem;
import net.minecraft.entity.item.EntityItem;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.init.Items;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.AxisAlignedBB;
import net.minecraft.util.ChatComponentTranslation;
import net.minecraft.util.ChatStyle;
import net.minecraft.util.EnumChatFormatting;
import vazkii.botania.api.internal.VanillaPacketDispatcher;
import vazkii.botania.common.block.tile.TileMod;
public class TileGameBoard extends TileMod implements IRenderHud {
public String[] playersName = new String[] { "", "" };
public byte[] slotChance = new byte[] { 0, 0, 0, 0 };
protected int botTick = -1;
public int endGameTick = -1;
protected boolean requestUpdate;
public boolean isSingleGame = true;
public boolean isCustomGame = false;
public int clientTick[] = new int[] { 0, 0, 0, 0 };
public static final ItemStack headRender = new ItemStack(Items.skull, 1, 3);
private ItemStack customStack;
public void updateEntity() {
if(botTick > 0)
botTick--;
if(endGameTick > 0)
endGameTick--;
if(!worldObj.isRemote)
updateServer();
else
updateAnimationTicks();
}
public void updateAnimationTicks() {
for(int i = 0; i < slotChance.length; i++)
if(slotChance[i] > 0)
clientTick[i]++;
else
clientTick[i] = 0;
}
protected void updateServer() {
if(hasGame() && endGameTick == 0 && !isCustomGame)
finishGame();
if(requestUpdate)
VanillaPacketDispatcher.dispatchTEToNearbyPlayers(this.worldObj, this.xCoord, this.yCoord, this.zCoord);
if(worldObj.getTotalWorldTime() % 20 == 0 && hasFullDice() && endGameTick == -1)
endGameTick = 28;
boolean hasUpdate = false;
if(isSingleGame) {
if(botTick == 0 && hasGame()) {
for(int i = 2; i < 4; i++) {
if(slotChance[i] == 0) {
slotChance[i] = (byte)(worldObj.rand.nextInt(6) + 1);
botTick = -1;
hasUpdate = true;
worldObj.playSoundEffect(this.xCoord, this.yCoord, this.zCoord, "ab:boardCube", 0.6F, 1.0F);
break;
}
}
}
} else {
if(botTick == 0 && hasGame())
endGameTick = 0;
}
requestUpdate = hasUpdate;
}
public void setPlayer(String name, boolean isCustomGame) {
this.isCustomGame = isCustomGame;
if(isSingleGame) {
playersName[0] = name;
playersName[1] = "";
requestUpdate = true;
botTick = 8;
} else {
if(playersName[0].isEmpty())
playersName[0] = name;
else if(!playersName[0].equals(name))
playersName[1] = name;
requestUpdate = true;
}
}
public void setPlayer(EntityPlayer player) {
setPlayer(player.getCommandSenderName(), false);
}
public boolean dropDice(String name) {
if(isSingleGame) {
if(name.equals(playersName[0]) && botTick == -1) {
boolean hasDrop = false;
for(int i = 0; i < 2; i++) {
if(slotChance[i] == 0) {
hasDrop = true;
if(!worldObj.isRemote) {
slotChance[i] = (byte)(worldObj.rand.nextInt(6) + 1);
botTick = 18;
worldObj.playSoundEffect(this.xCoord, this.yCoord, this.zCoord, "ab:boardCube", 0.6F, 1.0F);
requestUpdate = true;
}
break;
}
}
return hasDrop;
}
} else {
for(int i = 0; i < playersName.length; i++) {
if(name.equals(playersName[i])) {
boolean hasDrop = false;
for(int j = i * 2; j < (i + 1) * 2; j++) {
if(slotChance[j] == 0) {
hasDrop = true;
if(!worldObj.isRemote) {
slotChance[j] = (byte)(worldObj.rand.nextInt(6) + 1);
botTick = playersName[1].isEmpty() ? 240 : 1200;
worldObj.playSoundEffect(this.xCoord, this.yCoord, this.zCoord, "ab:boardCube", 0.6F, 1.0F);
requestUpdate = true;
}
break;
}
}
return hasDrop;
}
}
}
return false;
}
public boolean dropDice(EntityPlayer player) {
return dropDice(player.getCommandSenderName());
}
public boolean hasFullDice() {
boolean hasFull = false;
for(int i = 0; i < slotChance.length; i++) {
if(!(slotChance[i] > 0))
return false;
hasFull = slotChance[i] > 0;
}
return hasFull;
}
public boolean hasGame() {
if(isSingleGame)
return !playersName[0].isEmpty();
else
for(int i = 0; i < playersName.length; i++)
if(!playersName[i].isEmpty())
return true;
return false;
}
public void finishGame(boolean hasChatMessage) {
if(worldObj.isRemote)
return;
else if(!hasChatMessage) {
resetGame();
return;
} else if(!hasFullDice()) {
sendNearMessage("ab.gameBoard.misc.notPlayer", new Object[] {});
resetGame();
return;
}
String str = isSingleGame ? "" : ".mult";
if((slotChance[0] + slotChance[1]) > (slotChance[2] + slotChance[3]))
sendNearMessage("ab.gameBoard.misc.0" + str, new Object[] { playersName[0] });
else if((slotChance[0] + slotChance[1]) == (slotChance[2] + slotChance[3]))
sendNearMessage("ab.gameBoard.misc.1" + str, new Object[] {});
else
sendNearMessage("ab.gameBoard.misc.2" + str, new Object[] { playersName[isSingleGame ? 0 : 1] });
resetGame();
}
public void finishGame() {
finishGame(true);
}
public void sendNearMessage(String text, Object[] obj) {
List<EntityPlayer> players = this.worldObj.getEntitiesWithinAABB(EntityPlayer.class, AxisAlignedBB.getBoundingBox(this.xCoord, this.yCoord, this.zCoord, (this.xCoord + 1), (this.yCoord + 1), (this.zCoord + 1)).expand(3.5f, 3.5f, 3.5f));
for(EntityPlayer player : players) {
if(player != null)
player.addChatMessage((new ChatComponentTranslation(text, obj)).setChatStyle((new ChatStyle()).setColor(EnumChatFormatting.DARK_GREEN)));
}
}
public boolean changeCustomStack(ItemStack stack) {
if(!isCustomGame)
return false;
else if(customStack == null || !ItemStack.areItemStacksEqual(customStack, stack)) {
customStack = stack;
requestUpdate = true;
return true;
} else
return false;
}
public void resetGame() {
playersName[0] = "";
playersName[1] = "";
for(int i = 0; i < slotChance.length; i++)
slotChance[i] = 0;
botTick = -1;
endGameTick = -1;
isCustomGame = false;
requestUpdate = true;
}
public void renderHud(Minecraft mc, ScaledResolution res) {
int x = res.getScaledWidth() / 2 - 7;
int y = res.getScaledHeight() / 2 + 12;
RenderHelper.enableGUIStandardItemLighting();
RenderItem.getInstance().renderItemAndEffectIntoGUI(mc.fontRenderer, mc.renderEngine, isCustomGame ? (customStack == null ? headRender : customStack) : headRender, x - (!isSingleGame ? 1 : 0), y - (!isSingleGame ? 1 : 0));
if(!isSingleGame)
RenderItem.getInstance().renderItemAndEffectIntoGUI(mc.fontRenderer, mc.renderEngine, headRender, x + 3, y + 3);
RenderHelper.disableStandardItemLighting();
}
public void writeCustomNBT(NBTTagCompound cmp) {
super.writeCustomNBT(cmp);
for(int i = 0; i < playersName.length; i++)
cmp.setString("playerName" + i, playersName[i]);
cmp.setByteArray("slotChance", slotChance);
cmp.setInteger("botTick", botTick);
cmp.setInteger("endGameTick", endGameTick);
cmp.setBoolean("requestUpdate", requestUpdate);
cmp.setBoolean("isSingleGame", isSingleGame);
cmp.setBoolean("isAnonimGame", isCustomGame);
if(customStack != null)
customStack.writeToNBT(cmp);
}
public void readCustomNBT(NBTTagCompound cmp) {
super.readCustomNBT(cmp);
for(int i = 0; i < playersName.length; i++)
playersName[i] = cmp.getString("playerName" + i);
botTick = cmp.getInteger("botTick");
endGameTick = cmp.getInteger("endGameTick");
slotChance = cmp.getByteArray("slotChance");
requestUpdate = cmp.getBoolean("requestUpdate");
isSingleGame = cmp.getBoolean("isSingleGame");
isCustomGame = cmp.getBoolean("isAnonimGame");
customStack = ItemStack.loadItemStackFromNBT(cmp);
}
}
@@ -0,0 +1,92 @@
package ab.common.block.tile;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.inventory.IInventory;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTBase;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.nbt.NBTTagList;
import vazkii.botania.common.block.tile.TileMod;
public abstract class TileInventory extends TileMod implements IInventory {
ItemStack[] inventorySlots = new ItemStack[getSizeInventory()];
public void readCustomNBT(NBTTagCompound par1NBTTagCompound) {
NBTTagList var2 = par1NBTTagCompound.getTagList("Items", 10);
this.inventorySlots = new ItemStack[getSizeInventory()];
for(int var3 = 0; var3 < var2.tagCount(); var3++) {
NBTTagCompound var4 = var2.getCompoundTagAt(var3);
byte var5 = var4.getByte("Slot");
if(var5 >= 0 && var5 < this.inventorySlots.length)
this.inventorySlots[var5] = ItemStack.loadItemStackFromNBT(var4);
}
}
public void writeCustomNBT(NBTTagCompound par1NBTTagCompound) {
NBTTagList var2 = new NBTTagList();
for(int var3 = 0; var3 < this.inventorySlots.length; var3++) {
if (this.inventorySlots[var3] != null) {
NBTTagCompound var4 = new NBTTagCompound();
var4.setByte("Slot", (byte)var3);
this.inventorySlots[var3].writeToNBT(var4);
var2.appendTag((NBTBase)var4);
}
}
par1NBTTagCompound.setTag("Items", (NBTBase)var2);
}
public ItemStack getStackInSlot(int i) {
return this.inventorySlots[i];
}
public ItemStack decrStackSize(int i, int j) {
if(this.inventorySlots[i] != null) {
if(!this.worldObj.isRemote)
this.worldObj.markBlockForUpdate(this.xCoord, this.yCoord, this.zCoord);
if((this.inventorySlots[i]).stackSize <= j) {
ItemStack itemStack = this.inventorySlots[i];
this.inventorySlots[i] = null;
markDirty();
return itemStack;
}
ItemStack stackAt = this.inventorySlots[i].splitStack(j);
if((this.inventorySlots[i]).stackSize == 0)
this.inventorySlots[i] = null;
markDirty();
return stackAt;
}
return null;
}
public ItemStack getStackInSlotOnClosing(int i) {
return getStackInSlot(i);
}
public void setInventorySlotContents(int i, ItemStack itemstack) {
this.inventorySlots[i] = itemstack;
markDirty();
if (!this.worldObj.isRemote)
this.worldObj.markBlockForUpdate(this.xCoord, this.yCoord, this.zCoord);
}
public int getInventoryStackLimit() {
return 64;
}
public boolean isUseableByPlayer(EntityPlayer entityplayer) {
return (this.worldObj.getTileEntity(this.xCoord, this.yCoord, this.zCoord) != this) ? false : ((entityplayer.getDistanceSq(this.xCoord + 0.5D, this.yCoord + 0.5D, this.zCoord + 0.5D) <= 64.0D));
}
public boolean isItemValidForSlot(int i, ItemStack itemstack) {
return true;
}
public boolean hasCustomInventoryName() {
return false;
}
public void openInventory() {}
public void closeInventory() {}
}
@@ -0,0 +1,214 @@
package ab.common.block.tile;
import org.lwjgl.opengl.GL11;
import ab.api.IRenderHud;
import ab.common.lib.register.BlockListAB;
import net.minecraft.block.Block;
import net.minecraft.block.material.Material;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.Gui;
import net.minecraft.client.gui.ScaledResolution;
import net.minecraft.client.renderer.RenderHelper;
import net.minecraft.client.renderer.entity.RenderItem;
import net.minecraft.entity.item.EntityItem;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.init.Blocks;
import net.minecraft.item.ItemBlock;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.Vec3;
import net.minecraft.world.World;
import vazkii.botania.api.internal.VanillaPacketDispatcher;
import vazkii.botania.api.lexicon.multiblock.Multiblock;
import vazkii.botania.api.lexicon.multiblock.MultiblockSet;
import vazkii.botania.common.Botania;
import vazkii.botania.common.block.ModBlocks;
import vazkii.botania.common.block.ModFluffBlocks;
import vazkii.botania.common.block.tile.TileMod;
import vazkii.botania.common.core.handler.ConfigHandler;
public class TileLebethronCore extends TileMod implements IRenderHud {
protected int tick;
protected Block block;
protected int meta;
protected boolean validTree;
public static MultiblockSet makeMultiblockSet() {
Multiblock mb = new Multiblock();
mb.addComponent(0, 1, 0, BlockListAB.blockLebethron, 4);
mb.addComponent(0, 0, 0, BlockListAB.blockLebethron, 0);
mb.addComponent(0, 2, 0, BlockListAB.blockLebethron, 0);
mb.addComponent(0, 3, 0, BlockListAB.blockLebethron, 0);
mb.addComponent(0, 4, 0, BlockListAB.blockLebethron, 0);
mb.addComponent(0, 5, 0, BlockListAB.blockLebethron, 0);
mb.setRenderOffset(0, 1, 0);
return mb.makeSet();
}
public void updateEntity() {
if(!worldObj.isRemote) {
if(tick <= 0) {
updateStructure();
if(validTree && getBlock() != null) {
spawnLeaves();
tick = 40;
}
} else
tick--;
} else if(worldObj.rand.nextBoolean())
Botania.proxy.sparkleFX(this.worldObj, this.xCoord + Math.random(), this.yCoord + Math.random(), this.zCoord + Math.random(), 0.5F, 1.0F, 0.5F, (float)Math.random() * 2, 2);
}
public boolean getValidTree() {
return this.validTree;
}
public void updateStructure() {
boolean oldValidTree = validTree;
validTree = hasValidTree();
if(oldValidTree != validTree)
VanillaPacketDispatcher.dispatchTEToNearbyPlayers(this.worldObj, this.xCoord, this.yCoord, this.zCoord);
}
public void writeCustomNBT(NBTTagCompound nbtt) {
nbtt.setInteger("blockID", Block.getIdFromBlock(block));
nbtt.setInteger("blockMeta", this.meta);
nbtt.setInteger("tick", this.tick);
nbtt.setBoolean("validTree", validTree);
}
public void readCustomNBT(NBTTagCompound nbtt) {
this.block = Block.getBlockById(nbtt.getInteger("blockID"));
this.meta = nbtt.getInteger("blockMeta");
this.tick = nbtt.getInteger("tick");
this.validTree = nbtt.getBoolean("validTree");
}
public boolean setBlock(EntityPlayer player, Block block, int meta) {
if(this.block == null) {
this.block = block;
this.meta = meta;
return true;
} else {
if(Block.isEqualTo(this.block, block) && this.meta == meta)
return false;
else if(!worldObj.isRemote) {
Vec3 vec3 = player.getLook(1.0F).normalize();
EntityItem entityitem = new EntityItem(worldObj, player.posX + vec3.xCoord, player.posY + 1.2f, player.posZ + vec3.zCoord, new ItemStack(this.block, 1, this.meta));
worldObj.spawnEntityInWorld(entityitem);
}
this.block = block;
this.meta = meta;
return true;
}
}
public Block getBlock() {
if(!Block.isEqualTo(block, Blocks.air) && block != null)
return this.block;
return null;
}
public int getMeta() {
return this.meta;
}
public boolean hasValidTree() {
if(!checkBlock(this.worldObj.getBlock(this.xCoord, this.yCoord - 1, this.zCoord), this.worldObj.getBlockMetadata(this.xCoord, this.yCoord - 1, this.zCoord))) {
return false;
}
for(int i = 1; i <= 4; i++) {
if(!checkBlock(this.worldObj.getBlock(this.xCoord, this.yCoord + i, this.zCoord), this.worldObj.getBlockMetadata(this.xCoord, this.yCoord + i, this.zCoord))) {
return false;
}
}
return true;
}
boolean checkBlock(Block block, int meta) {
return block == BlockListAB.blockLebethron && meta == 0;
}
private void spawnLeaves() {
for(int x = -1; x <= 1; x++) {
for(int z = -1; z <= 1; z++) {
for(int y = 0; y < 5; y++) {
this.setBlock(worldObj, this.xCoord + x, this.yCoord + y + 2, this.zCoord + z);
}
}
}
this.setBlock(worldObj, this.xCoord + 1, this.yCoord + 1, this.zCoord);
this.setBlock(worldObj, this.xCoord - 1, this.yCoord + 1, this.zCoord);
this.setBlock(worldObj, this.xCoord, this.yCoord + 1, this.zCoord + 1);
this.setBlock(worldObj, this.xCoord, this.yCoord + 1, this.zCoord - 1);
this.setBlock(worldObj, this.xCoord + 1, this.yCoord + 7, this.zCoord);
this.setBlock(worldObj, this.xCoord - 1, this.yCoord + 7, this.zCoord);
this.setBlock(worldObj, this.xCoord, this.yCoord + 7, this.zCoord + 1);
this.setBlock(worldObj, this.xCoord, this.yCoord + 7, this.zCoord - 1);
for(int i = 0; i <= 3; i++)
this.setBlock(worldObj, this.xCoord, this.yCoord + 6 + i, this.zCoord);
this.setBlock(worldObj, this.xCoord, this.yCoord + 2, this.zCoord - 2);
for(int i = -1; i <= 1; i++) {
this.setBlock(worldObj, this.xCoord + i, this.yCoord + 3, this.zCoord - 2);
this.setBlock(worldObj, this.xCoord + i, this.yCoord + 4, this.zCoord - 2);
}
this.setBlock(worldObj, this.xCoord, this.yCoord + 5, this.zCoord - 2);
this.setBlock(worldObj, this.xCoord, this.yCoord + 2, this.zCoord + 2);
for(int i = -1; i <= 1; i++) {
this.setBlock(worldObj, this.xCoord + i, this.yCoord + 3, this.zCoord + 2);
this.setBlock(worldObj, this.xCoord + i, this.yCoord + 4, this.zCoord + 2);
}
this.setBlock(worldObj, this.xCoord, this.yCoord + 5, this.zCoord + 2);
this.setBlock(worldObj, this.xCoord + 2, this.yCoord + 2, this.zCoord);
for(int i = -1; i <= 1; i++) {
this.setBlock(worldObj, this.xCoord + 2, this.yCoord + 3, this.zCoord + i);
this.setBlock(worldObj, this.xCoord + 2, this.yCoord + 4, this.zCoord + i);
}
this.setBlock(worldObj, this.xCoord + 2, this.yCoord + 5, this.zCoord);
this.setBlock(worldObj, this.xCoord - 2, this.yCoord + 2, this.zCoord);
for(int i = -1; i <= 1; i++) {
this.setBlock(worldObj, this.xCoord - 2, this.yCoord + 3, this.zCoord + i);
this.setBlock(worldObj, this.xCoord - 2, this.yCoord + 4, this.zCoord + i);
}
this.setBlock(worldObj, this.xCoord - 2, this.yCoord + 5, this.zCoord);
}
private void setBlock(World world, int x, int y, int z) {
if(world.rand.nextInt(10) <= 8)
return;
else if(world.getBlock(x, y, z).getMaterial() == Material.air && y < 256)
world.setBlock(x, y, z, this.block, this.meta, 3);
}
public void renderHud(Minecraft mc, ScaledResolution res) {
if(!validTree)
return;
GL11.glEnable(3042);
GL11.glBlendFunc(770, 771);
ItemStack stack = getBlock() != null ? new ItemStack(block, 1, meta) : new ItemStack(Blocks.leaves);
int x = res.getScaledWidth() / 2 - 7;
int y = res.getScaledHeight() / 2 + 12;
Gui.drawRect(x - 2, y - 2, x + 18, y + 18, 1140850688);
Gui.drawRect(x, y, x + 16, y + 16, 1140850688);
RenderHelper.enableGUIStandardItemLighting();
GL11.glEnable(32826);
RenderItem.getInstance().renderItemAndEffectIntoGUI(mc.fontRenderer, mc.renderEngine, stack, x, y);
RenderHelper.disableStandardItemLighting();
GL11.glDisable(2929);
boolean unicode = mc.fontRenderer.getUnicodeFlag();
mc.fontRenderer.setUnicodeFlag(true);
if(getBlock() != null) {
mc.fontRenderer.drawStringWithShadow("\u2713", x + 10, y + 9, 19456);
mc.fontRenderer.drawStringWithShadow("\u2713", x + 10, y + 8, 774669);
} else {
mc.fontRenderer.drawStringWithShadow("\u2717", x + 10, y + 9, 4980736);
mc.fontRenderer.drawStringWithShadow("\u2717", x + 10, y + 8, 13764621);
}
mc.fontRenderer.setUnicodeFlag(unicode);
GL11.glEnable(2929);
GL11.glDisable(3042);
}
}
@@ -0,0 +1,333 @@
package ab.common.block.tile;
import cpw.mods.fml.common.gameevent.PlayerEvent.ItemCraftedEvent;
import net.minecraft.block.Block;
import net.minecraft.entity.item.EntityItem;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.inventory.IInventory;
import net.minecraft.inventory.ISidedInventory;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.nbt.NBTTagList;
import net.minecraft.network.NetworkManager;
import net.minecraft.network.Packet;
import net.minecraft.network.play.server.S35PacketUpdateTileEntity;
import net.minecraft.world.World;
import net.minecraftforge.common.MinecraftForge;
import thaumcraft.api.aspects.Aspect;
import thaumcraft.api.aspects.AspectList;
import thaumcraft.common.items.relics.ItemThaumonomicon;
import thaumcraft.common.items.wands.ItemWandCasting;
import thaumcraft.common.lib.crafting.ThaumcraftCraftingManager;
import thaumcraft.common.tiles.TileMagicWorkbench;
import vazkii.botania.api.internal.VanillaPacketDispatcher;
import vazkii.botania.common.item.ModItems;
public class TileMagicCraftCrate extends TileMagicWorkbench implements ISidedInventory, IInventory {
private static final String WAITING_TAG = "waitingStack";
private static final String PATTERN_TAG = "pattern";
private static final int[] ACCESSIBLE_SLOTS = new int[] { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 };
private boolean[][] pattern;
private EntityPlayer player;
int signal = 0;
private ItemStack waitingStack;
public TileMagicCraftCrate() {
pattern = new boolean[][] { new boolean[] { true, true, true }, new boolean[] { true, true, true }, new boolean[] { true, true, true } };
}
public void updateEntity() {
if(!worldObj.isRemote && (craft(true) && canEject() || isFull() && !isWaiting()))
ejectAll();
int newSignal = 0;
for(; newSignal < 9; newSignal++)
if(!isLocked(newSignal) && getStackInSlot(newSignal) == null)
break;
if(isWaiting())
newSignal = 14;
if(newSignal != signal) {
signal = newSignal;
worldObj.func_147453_f(xCoord, yCoord, zCoord, worldObj.getBlock(xCoord, yCoord, zCoord));
}
}
boolean craft(boolean fullCheck) {
if(fullCheck && !isFull())
return false;
if(player == null)
return false;
TileMagicWorkbench craft = new TileMagicWorkbench() {
public void setInventorySlotContents(int par1, ItemStack par2ItemStack) {
this.stackList[par1] = par2ItemStack;
}
public ItemStack decrStackSize(int par1, int par2) {
if(this.stackList[par1] == null) {
return null;
}
if(this.stackList[par1].stackSize <= par2) {
final ItemStack var3 = this.stackList[par1];
this.stackList[par1] = null;
return var3;
}
final ItemStack var3 = this.stackList[par1].splitStack(par2);
if(this.stackList[par1].stackSize == 0) {
this.stackList[par1] = null;
}
return var3;
}
};
for(int i = 0; i < 10; i++) {
ItemStack stack = getStackInSlot(i);
if(stack == null || isLocked(i) || stack.getItem() == ModItems.manaResource && stack.getItemDamage() == 11)
continue;
craft.setInventorySlotContents(i, stack.copy());
}
ItemStack result = ThaumcraftCraftingManager.findMatchingArcaneRecipe(craft, player);
if(result != null) {
final AspectList aspects = ThaumcraftCraftingManager.findMatchingArcaneRecipeAspects(craft, player);
if(aspects.size() > 0 && this.getStackInSlot(10) != null) {
final ItemWandCasting wand = (ItemWandCasting) this.getStackInSlot(10).getItem();
if (wand.consumeAllVisCrafting(this.getStackInSlot(10), player, aspects, true)) {
for(int var2 = 0; var2 < 9; ++var2) {
final ItemStack var3 = craft.getStackInSlot(var2);
if(var3 != null)
craft.decrStackSize(var2, 1);
}
for(int i = 0; i < 9; i++)
setInventorySlotContents(i, craft.getStackInSlot(i));
setInventorySlotContents(9, result);
MinecraftForge.EVENT_BUS.post(new ItemCraftedEvent(player, result, craft));
waitingStack = null;
return true;
} else {
waitingStack = result;
markDirty();
}
}
} else
waitingStack = null;
return false;
}
boolean isFull() {
for (int i = 0; i < 9; i++)
if (!isLocked(i) && getStackInSlot(i) == null)
return false;
return true;
}
public boolean[][] getPattern() {
return pattern;
}
public void setPattern(boolean[][] pattern) {
this.pattern = pattern;
}
public int getSizeInventory() {
return 12;
}
public EntityPlayer getPlayer() {
return player;
}
public void setPlayer(EntityPlayer player) {
this.player = player;
}
public int getSignal() {
return signal;
}
public ItemStack getWaitingStack() {
return waitingStack;
}
private boolean isWaiting() {
return waitingStack != null;
}
public boolean isItemValidForSlot(int i, ItemStack itemstack) {
if (i < 9 && !isLocked(i))
return true;
if (i == 9)
return false;
if (i == 10) {
if (!(itemstack.getItem() instanceof ItemWandCasting)) {
return false;
}
final ItemWandCasting wand = (ItemWandCasting) itemstack.getItem();
return !wand.isStaff(itemstack);
}
return itemstack.getItem() instanceof ItemThaumonomicon;
}
private boolean isLocked(int slot) {
return pattern != null && !pattern[slot / 3][slot % 3];
}
public void readCustomNBT(NBTTagCompound nbtt) {
super.readCustomNBT(nbtt);
NBTTagList var2 = nbtt.getTagList("Items", 10);
inventorySlots = new ItemStack[getSizeInventory()];
for(int var3 = 0; var3 < var2.tagCount(); ++var3) {
NBTTagCompound var4 = var2.getCompoundTagAt(var3);
byte var5 = var4.getByte("Slot");
if(var5 >= 0 && var5 < inventorySlots.length)
inventorySlots[var5] = ItemStack.loadItemStackFromNBT(var4);
}
for(int i = 0; i < 3; i++)
for(int j = 0; j < 3; j++)
pattern[i][j] = nbtt.getBoolean(PATTERN_TAG + i * 3 + j);
NBTTagCompound nbtt1 = nbtt.getCompoundTag(WAITING_TAG);
if(nbtt1 != null)
waitingStack = ItemStack.loadItemStackFromNBT(nbtt1);
}
public void writeCustomNBT(NBTTagCompound nbtt) {
super.writeCustomNBT(nbtt);
NBTTagList var2 = new NBTTagList();
for(int var3 = 0; var3 < inventorySlots.length; ++var3) {
if(inventorySlots[var3] != null) {
NBTTagCompound var4 = new NBTTagCompound();
var4.setByte("Slot", (byte) var3);
inventorySlots[var3].writeToNBT(var4);
var2.appendTag(var4);
}
}
nbtt.setTag("Items", var2);
for(int i = 0; i < 3; i++)
for(int j = 0; j < 3; j++)
nbtt.setBoolean(PATTERN_TAG + i * 3 + j, pattern[i][j]);
NBTTagCompound nbtt1 = new NBTTagCompound();
if(waitingStack != null) {
waitingStack.writeToNBT(nbtt1);
nbtt.setTag(WAITING_TAG, nbtt1);
}
}
public void markDirty() {
super.markDirty();
VanillaPacketDispatcher.dispatchTEToNearbyPlayers(this);
}
public void onDataPacket(NetworkManager manager, S35PacketUpdateTileEntity packet) {
super.onDataPacket(manager, packet);
worldObj.markBlockRangeForRenderUpdate(xCoord, yCoord, zCoord, xCoord, yCoord, zCoord);
}
public Packet getDescriptionPacket() {
final NBTTagCompound compound = new NBTTagCompound();
this.writeToNBT(compound);
return new S35PacketUpdateTileEntity(this.xCoord, this.yCoord, this.zCoord, 10, compound);
}
public boolean canExtractItem(int i, ItemStack itemstack, int j) {
return i == 9;
}
public int[] getAccessibleSlotsFromSide(int side) {
return ACCESSIBLE_SLOTS;
}
public boolean canInsertItem(int i, ItemStack stack, int j) {
return i < 9;
}
public int getInventoryStackLimit() {
return 1;
}
public int onWandRightClick(World world, ItemStack wandstack, EntityPlayer player, int x, int y, int z, int side, int md) {
return 0;
}
public ItemStack onWandRightClick(final World world, final ItemStack wandstack, final EntityPlayer player) {
this.player = player;
return wandstack;
}
public void onUsingWandTick(ItemStack wandstack, EntityPlayer player, int count) {}
public void onWandStoppedUsing(ItemStack wandstack, World world, EntityPlayer player, int count) {}
public void ejectAll() {
for(int i = 0; i < 10; ++i) {
ItemStack stack = getStackInSlot(i);
if(stack != null)
eject(stack, false);
setInventorySlotContents(i, null);
}
this.waitingStack = null;
markDirty();
}
public void eject(ItemStack stack, boolean redstone) {
EntityItem item = new EntityItem(worldObj, xCoord + 0.5, yCoord - 0.5, zCoord + 0.5, stack);
item.motionX = 0;
item.motionY = 0;
item.motionZ = 0;
if(redstone)
item.age = -200;
setInventorySlotContents(0, null);
if(!worldObj.isRemote)
worldObj.spawnEntityInWorld(item);
}
public boolean canEject() {
Block blockBelow = worldObj.getBlock(xCoord, yCoord - 1, zCoord);
return blockBelow.isAir(worldObj, xCoord, yCoord - 1, zCoord) || blockBelow.getCollisionBoundingBoxFromPool(worldObj, xCoord, yCoord - 1, zCoord) == null;
}
ItemStack[] inventorySlots = new ItemStack[getSizeInventory()];
@Override
public ItemStack getStackInSlot(int i) {
return inventorySlots[i];
}
public ItemStack decrStackSize(int i, int j) {
if(inventorySlots[i] != null) {
ItemStack stackAt;
if (inventorySlots[i].stackSize <= j) {
stackAt = inventorySlots[i];
inventorySlots[i] = null;
return stackAt;
} else {
stackAt = inventorySlots[i].splitStack(j);
if(inventorySlots[i].stackSize == 0)
inventorySlots[i] = null;
return stackAt;
}
}
return null;
}
// Copied from vazkii.botania.common.block.tile.TileSimpleInventory
public ItemStack getStackInSlotOnClosing(int i) {
return getStackInSlot(i);
}
public void setInventorySlotContents(int i, ItemStack itemstack) {
inventorySlots[i] = itemstack;
}
public boolean isUseableByPlayer(EntityPlayer entityplayer) {
return worldObj.getTileEntity(xCoord, yCoord, zCoord) != this ? false : entityplayer.getDistanceSq(xCoord + 0.5D, yCoord + 0.5D, zCoord + 0.5D) <= 64;
}
public boolean hasCustomInventoryName() {
return false;
}
public void openInventory() {}
public void closeInventory() {}
}
@@ -0,0 +1,279 @@
package ab.common.block.tile;
import java.awt.Color;
import java.util.List;
import java.util.Random;
import org.lwjgl.opengl.GL11;
import ab.api.IRenderHud;
import ab.client.core.ClientHelper;
import ab.common.core.handler.ConfigABHandler;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.Gui;
import net.minecraft.client.gui.ScaledResolution;
import net.minecraft.client.renderer.RenderHelper;
import net.minecraft.client.renderer.entity.RenderItem;
import net.minecraft.entity.Entity;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.player.EntityPlayerMP;
import net.minecraft.inventory.ISidedInventory;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.network.Packet;
import net.minecraft.network.play.server.S35PacketUpdateTileEntity;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.AxisAlignedBB;
import net.minecraft.util.ChunkCoordinates;
import net.minecraft.util.StatCollector;
import vazkii.botania.api.internal.VanillaPacketDispatcher;
import vazkii.botania.api.mana.IManaItem;
import vazkii.botania.api.mana.IManaReceiver;
import vazkii.botania.api.mana.spark.ISparkAttachable;
import vazkii.botania.api.mana.spark.ISparkEntity;
import vazkii.botania.api.wand.IWandBindable;
import vazkii.botania.client.core.handler.ClientTickHandler;
import vazkii.botania.client.core.handler.HUDHandler;
import vazkii.botania.common.block.ModBlocks;
import vazkii.botania.common.block.tile.TileSimpleInventory;
import vazkii.botania.common.core.helper.Vector3;
public class TileManaCharger extends TileInventory implements ISidedInventory, IRenderHud, IWandBindable {
private static final int MANA_SPEED = 11240;
public boolean requestUpdate;
int clientMana = -1;
int receiverPosX = -1;
int receiverPosY = -1;
int receiverPosZ = -1;
public int clientTick[] = new int[] {0, 0, 3, 12, 6};
public void updateEntity() {
boolean hasUpdate = false;
if(!this.worldObj.isRemote && requestUpdate)
VanillaPacketDispatcher.dispatchTEToNearbyPlayers(this.worldObj, this.xCoord, this.yCoord, this.zCoord);
ISparkAttachable receiver = this.getReceiver();
if(receiver == null)
return;
for(int i = 0; i < this.getSizeInventory(); i++) {
ItemStack stack = this.getStackInSlot(i);
if(stack == null)
continue;
else if(stack.getItem() instanceof IManaItem) {
IManaItem mana = (IManaItem)stack.getItem();
if(i == 0) {
if(mana.getMana(stack) > 0 && !receiver.isFull() && mana.canExportManaToPool(stack, (TileEntity)receiver)) {
int availableMana = ((ISparkAttachable)receiver).getAvailableSpaceForMana();
int manaVal = Math.min(Math.min(mana.getMaxMana(stack) / 256, MANA_SPEED) * 3, Math.min(availableMana, mana.getMana(stack)));
if(!this.worldObj.isRemote) {
mana.addMana(stack, -manaVal);
if(this.worldObj.getTotalWorldTime() % 15 == 0)
hasUpdate = true;
} else {
clientTick[i]++;
}
receiver.recieveMana(manaVal);
}
continue;
} else if(receiver.getCurrentMana() > 0 && mana.getMana(stack) < mana.getMaxMana(stack) && mana.canReceiveManaFromPool(stack, (TileEntity)receiver)) {
int manaVal = Math.min(Math.min(mana.getMaxMana(stack) / 256, MANA_SPEED), Math.min(receiver.getCurrentMana(), mana.getMaxMana(stack) - mana.getMana(stack)));
if(!this.worldObj.isRemote) {
mana.addMana(stack, manaVal);
if(this.worldObj.getTotalWorldTime() % 15 == 0)
hasUpdate = true;
} else {
if(ConfigABHandler.useManaChargerAnimation)
clientTick[i]++;
}
receiver.recieveMana(-manaVal);
}
}
}
requestUpdate = hasUpdate;
}
public ISparkAttachable getReceiver() {
ISparkAttachable receiver = null;
if(this.worldObj != null && this.receiverPosY != -1) {
TileEntity tile = this.worldObj.getTileEntity(receiverPosX, receiverPosY, receiverPosZ);
if(tile != null && tile instanceof ISparkAttachable) {
receiver = (ISparkAttachable)tile;
}
}
if(receiver == null) {
receiverPosX = -1;
receiverPosY = -1;
receiverPosZ = -1;
}
return receiver;
}
public boolean canSelect(EntityPlayer player, ItemStack wand, int x, int y, int z, int side) {
return true;
}
public boolean bindTo(EntityPlayer player, ItemStack wand, int x, int y, int z, int side) {
TileEntity tile = this.worldObj.getTileEntity(x, y, z);
boolean isFar = Math.abs(this.xCoord - x) >= 10 || Math.abs(this.yCoord - y) >= 10 || Math.abs(this.zCoord - z) >= 10;
if(isFar)
return false;
else if(tile instanceof ISparkAttachable && ((ISparkAttachable)tile).canRecieveManaFromBursts()) {
if(!this.worldObj.isRemote) {
this.receiverPosX = tile.xCoord;
this.receiverPosY = tile.yCoord;
this.receiverPosZ = tile.zCoord;
VanillaPacketDispatcher.dispatchTEToNearbyPlayers(this.worldObj, this.xCoord, this.yCoord, this.zCoord);
}
return true;
}
return false;
}
public ChunkCoordinates getBinding() {
IManaReceiver receiver = this.getReceiver();
if(receiver == null)
return null;
TileEntity tile = (TileEntity)receiver;
return new ChunkCoordinates(tile.xCoord, tile.yCoord, tile.zCoord);
}
public static float getManaPercent(ItemStack stack) {
if(!(stack.getItem() instanceof IManaItem))
return 0.0f;
IManaItem mana = (IManaItem)stack.getItem();
return (float)mana.getMana(stack) / (mana.getMaxMana(stack) / 100.0f);
}
public void renderHud(Minecraft mc, ScaledResolution res) {
int xc = res.getScaledWidth() / 2;
int yc = res.getScaledHeight() / 2;
int radius = 42;
int amt = 0;
for(int i = 0; i < getSizeInventory(); i++)
if(getStackInSlot(i) != null)
amt++;
float angle = -90.0f;
if(amt >= 0) {
for (int i = 0; i < getSizeInventory(); i++) {
ItemStack stack = getStackInSlot(i);
if(stack == null)
continue;
float anglePer = 360.0F / amt;
double xPos = xc + Math.cos(angle * Math.PI / 180.0D) * radius - 8.0D;
double yPos = yc + Math.sin(angle * Math.PI / 180.0D) * radius - 8.0D;
RenderHelper.enableGUIStandardItemLighting();
GL11.glPushMatrix();
GL11.glEnable(3042);
GL11.glBlendFunc(770, 771);
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
GL11.glTranslated(xPos, yPos, 0.0D);
vazkii.botania.client.core.helper.RenderHelper.renderProgressPie(0, 0, getManaPercent(stack) / 100.0f, stack);
if(i == 0) {
GL11.glScalef(0.75f, 0.75f, 0.75f);
GL11.glTranslated(11.0D, 10.0D, 0.0D);
RenderHelper.enableGUIStandardItemLighting();
RenderItem.getInstance().renderItemAndEffectIntoGUI(mc.fontRenderer, mc.renderEngine, new ItemStack(ModBlocks.pool), 0, 0);
}
GL11.glDisable(2896);
GL11.glDisable(3042);
GL11.glPopMatrix();
RenderHelper.disableStandardItemLighting();
angle += anglePer;
}
}
}
public void onWanded(EntityPlayer player, ItemStack wand) {
ISparkAttachable reciever = getReceiver();
if(player == null)
return;
if(this.worldObj.isRemote && reciever != null)
clientMana = reciever.getCurrentMana();
this.worldObj.playSoundAtEntity((Entity)player, "botania:ding", 0.11F, 1.0F);
}
public void renderHUD(Minecraft mc, ScaledResolution res) {
ISparkAttachable reciever = getReceiver();
if(reciever != null) {
String name = StatCollector.translateToLocal("ab.manaCharger.wandHud");
TileEntity receiverTile = (TileEntity)reciever;
ItemStack recieverStack = new ItemStack(this.worldObj.getBlock(receiverTile.xCoord, receiverTile.yCoord, receiverTile.zCoord), 1, receiverTile.getBlockMetadata());
GL11.glEnable(3042);
GL11.glBlendFunc(770, 771);
if(recieverStack != null && recieverStack.getItem() != null) {
String stackName = recieverStack.getDisplayName();
int width = 16 + mc.fontRenderer.getStringWidth(stackName) / 2;
int x = res.getScaledWidth() / 2 - width;
int y = res.getScaledHeight() / 2 + 48;
mc.fontRenderer.drawStringWithShadow(stackName, x + 20, y + 5, 0xf4f4f4);
RenderHelper.enableGUIStandardItemLighting();
RenderItem.getInstance().renderItemAndEffectIntoGUI(mc.fontRenderer, mc.renderEngine, recieverStack, x, y);
RenderHelper.disableStandardItemLighting();
}
GL11.glDisable(2896);
GL11.glDisable(3042);
ClientHelper.drawPoolManaHUD(res, name, clientMana, reciever.getAvailableSpaceForMana() + reciever.getCurrentMana(), 0xb9bbae);
}
}
public int getSizeInventory() {
return 5;
}
public int getInventoryStackLimit() {
return 1;
}
public String getInventoryName() {
return "ab.manaCharger";
}
public void writeCustomNBT(NBTTagCompound nbtt) {
super.writeCustomNBT(nbtt);
nbtt.setInteger("bindingX", this.receiverPosX);
nbtt.setInteger("bindingY", this.receiverPosY);
nbtt.setInteger("bindingZ", this.receiverPosZ);
nbtt.setBoolean("requestUpdate", this.requestUpdate);
}
public void readFromNBT(NBTTagCompound nbtt) {
super.readFromNBT(nbtt);
this.requestUpdate = nbtt.getBoolean("requestUpdate");
}
public void readCustomNBT(NBTTagCompound nbtt) {
super.readCustomNBT(nbtt);
this.receiverPosX = nbtt.getInteger("bindingX");
this.receiverPosY = nbtt.getInteger("bindingY");
this.receiverPosZ = nbtt.getInteger("bindingZ");
}
public int[] getAccessibleSlotsFromSide(int side) {
return new int[] {1, 2, 3, 4};
}
public boolean canInsertItem(int slot, ItemStack stack, int side) {
boolean isManaItem = false;
if(stack != null && stack.getItem() instanceof IManaItem) {
IManaItem mana = (IManaItem)stack.getItem();
ISparkAttachable receiver = this.getReceiver();
if(receiver == null)
return false;
isManaItem = mana.getMana(stack) < mana.getMaxMana(stack) && mana.canReceiveManaFromPool(stack, (TileEntity)receiver);
}
return side == 1 && slot != 0 && isManaItem;
}
public boolean canExtractItem(int slot, ItemStack stack, int side) {
boolean isManaItem = false;
if(stack != null && stack.getItem() instanceof IManaItem) {
IManaItem mana = (IManaItem)stack.getItem();
ISparkAttachable receiver = this.getReceiver();
if(receiver == null)
return false;
isManaItem = mana.getMana(stack) == mana.getMaxMana(stack);
}
return side == 0 && slot != 0 && isManaItem;
}
}
@@ -0,0 +1,130 @@
package ab.common.block.tile;
import java.awt.Color;
import java.util.List;
import org.lwjgl.opengl.GL11;
import ab.client.core.ClientHelper;
import ab.common.core.handler.ConfigABHandler;
import ab.common.lib.register.BlockListAB;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.ScaledResolution;
import net.minecraft.client.renderer.RenderHelper;
import net.minecraft.client.renderer.entity.RenderItem;
import net.minecraft.entity.Entity;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.player.EntityPlayerMP;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.network.NetworkManager;
import net.minecraft.network.Packet;
import net.minecraft.network.play.server.S35PacketUpdateTileEntity;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.AxisAlignedBB;
import net.minecraft.util.StatCollector;
import vazkii.botania.api.internal.VanillaPacketDispatcher;
import vazkii.botania.api.mana.IManaPool;
import vazkii.botania.api.mana.IManaReceiver;
import vazkii.botania.api.mana.IThrottledPacket;
import vazkii.botania.api.mana.spark.ISparkAttachable;
import vazkii.botania.api.mana.spark.ISparkEntity;
import vazkii.botania.client.core.handler.HUDHandler;
import vazkii.botania.common.Botania;
import vazkii.botania.common.block.tile.TileMod;
public class TileManaContainer extends TileMod implements IManaPool, ISparkAttachable {
protected int mana = 0;
int knownMana = -1;
public boolean canUpdate() {
return true;
}
public void updateEntity() {
if(this.worldObj.isRemote) {
double particleChance = 1.0D - getCurrentMana() / getMaxMana() * 0.1D;
Color color = new Color(50943);
if(Math.random() > particleChance)
Botania.proxy.wispFX(this.worldObj, this.xCoord + 0.5f + (Math.random() - 0.5) * 0.4f, this.yCoord + 0.81D + (Math.random() * 0.05D), this.zCoord + 0.5f + (Math.random() - 0.5) * 0.4f, color.getRed() / 255.0F, color.getGreen() / 255.0F, color.getBlue() / 255.0F, (float)Math.random() / 4.2F, (float)-Math.random() / 50.0F, 2.0F);
}
}
public void onWanded(EntityPlayer player, ItemStack wand) {
if(player == null)
return;
if(!this.worldObj.isRemote) {
NBTTagCompound nbttagcompound = new NBTTagCompound();
writeCustomNBT(nbttagcompound);
nbttagcompound.setInteger("knownMana", getCurrentMana());
if (player instanceof EntityPlayerMP)
((EntityPlayerMP)player).playerNetServerHandler.sendPacket((Packet)new S35PacketUpdateTileEntity(this.xCoord, this.yCoord, this.zCoord, -999, nbttagcompound));
}
this.worldObj.playSoundAtEntity((Entity)player, "botania:ding", 0.11F, 1.0F);
}
public void renderHUD(Minecraft mc, ScaledResolution res) {
String name = StatCollector.translateToLocal("ab.manaContainer." + worldObj.getBlockMetadata(xCoord, yCoord, zCoord) + ".hud");
int color = 0x30ead1;
ClientHelper.drawPoolManaHUD(res, name, this.knownMana, getMaxMana(), color);
}
public int getCurrentMana() {
return this.mana;
}
public boolean canRecieveManaFromBursts() {
return true;
}
public int getMaxMana() {
int meta = worldObj.getBlockMetadata(xCoord, yCoord, zCoord);
return ConfigABHandler.maxContainerMana[Math.min(Math.max(meta, 0), ConfigABHandler.maxContainerMana.length)];
}
public boolean isFull() {
return this.mana == getMaxMana();
}
public void recieveMana(int mana) {
this.mana = Math.max(0, Math.min(getCurrentMana() + mana, getMaxMana()));
}
public void writeCustomNBT(NBTTagCompound nbtt) {
nbtt.setInteger("mana", this.mana);
}
public void readCustomNBT(NBTTagCompound nbtt) {
this.mana = nbtt.getInteger("mana");
if (nbtt.hasKey("knownMana"))
this.knownMana = nbtt.getInteger("knownMana");
}
public boolean areIncomingTranfersDone() {
return false;
}
public void attachSpark(ISparkEntity entity) {}
public boolean canAttachSpark(ItemStack arg0) {
return true;
}
public ISparkEntity getAttachedSpark() {
List<ISparkEntity> sparks = this.worldObj.getEntitiesWithinAABB(ISparkEntity.class, AxisAlignedBB.getBoundingBox(this.xCoord, (this.yCoord + 1), this.zCoord, (this.xCoord + 1), (this.yCoord + 2), (this.zCoord + 1)));
if (sparks.size() == 1) {
Entity e = (Entity)sparks.get(0);
return (ISparkEntity)e;
}
return null;
}
public int getAvailableSpaceForMana() {
return Math.max(0, getMaxMana() - getCurrentMana());
}
public boolean isOutputtingPower() {
return false;
}
}
@@ -0,0 +1,64 @@
package ab.common.block.tile;
import java.util.ArrayList;
import java.util.List;
import org.lwjgl.opengl.GL11;
import ab.api.IRenderHud;
import ab.client.core.ClientHelper;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.Gui;
import net.minecraft.client.gui.ScaledResolution;
import net.minecraft.client.renderer.RenderHelper;
import net.minecraft.client.renderer.entity.RenderItem;
import net.minecraft.entity.Entity;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.player.EntityPlayerMP;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.network.Packet;
import net.minecraft.network.play.server.S35PacketUpdateTileEntity;
import net.minecraft.util.StatCollector;
import vazkii.botania.api.mana.spark.ISparkAttachable;
import vazkii.botania.api.mana.spark.ISparkEntity;
import vazkii.botania.api.mana.spark.SparkHelper;
import vazkii.botania.client.core.handler.HUDHandler;
import vazkii.botania.common.block.ModBlocks;
import vazkii.botania.common.block.tile.TileMod;
public class TileManaCrystalCube extends TileMod implements IRenderHud {
int knownMana = -1;
int knownMaxMana = -1;
public boolean canUpdate() {
return false;
}
public void updateEntity() {}
public void renderHud(Minecraft mc, ScaledResolution res) {
String name = StatCollector.translateToLocal("ab.manaCrystalCube.hud");
int color = 0x30ead1;
ClientHelper.drawPoolManaHUD(res, name, this.knownMana, this.knownMaxMana, color);
}
public int[] getManaAround() {
int[] mana = new int[] { 0, 0 };
List<ISparkEntity> allSparks = SparkHelper.getSparksAround(worldObj, xCoord, yCoord, zCoord);
for(ISparkEntity spark : allSparks) {
ISparkAttachable tileMana = spark.getAttachedTile();
mana[1] += tileMana.getCurrentMana() + tileMana.getAvailableSpaceForMana();
mana[0] += tileMana.getCurrentMana();
}
return mana;
}
public void readCustomNBT(NBTTagCompound nbtt) {
if (nbtt.hasKey("knownMana"))
this.knownMana = nbtt.getInteger("knownMana");
if (nbtt.hasKey("knownMaxMana"))
this.knownMaxMana = nbtt.getInteger("knownMaxMana");
}
}
@@ -0,0 +1,264 @@
package ab.common.block.tile;
import java.awt.Color;
import java.util.List;
import java.util.Random;
import ab.api.AdvancedBotanyAPI;
import ab.api.recipe.RecipeAdvancedPlate;
import ab.common.lib.register.BlockListAB;
import net.minecraft.block.Block;
import net.minecraft.entity.Entity;
import net.minecraft.entity.item.EntityItem;
import net.minecraft.init.Blocks;
import net.minecraft.inventory.IInventory;
import net.minecraft.inventory.ISidedInventory;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.util.AxisAlignedBB;
import scala.reflect.internal.Trees.This;
import vazkii.botania.api.internal.VanillaPacketDispatcher;
import vazkii.botania.api.lexicon.multiblock.Multiblock;
import vazkii.botania.api.lexicon.multiblock.MultiblockSet;
import vazkii.botania.api.mana.IManaPool;
import vazkii.botania.api.mana.IManaReceiver;
import vazkii.botania.api.mana.spark.ISparkAttachable;
import vazkii.botania.api.mana.spark.ISparkEntity;
import vazkii.botania.api.mana.spark.SparkHelper;
import vazkii.botania.client.core.handler.ClientTickHandler;
import vazkii.botania.common.Botania;
import vazkii.botania.common.block.ModBlocks;
import vazkii.botania.common.block.ModFluffBlocks;
import vazkii.botania.common.block.tile.TileMod;
import vazkii.botania.common.block.tile.TileSimpleInventory;
import vazkii.botania.common.item.ModItems;
public class TileNidavellirForge extends TileInventory implements ISparkAttachable, ISidedInventory {
private int mana;
public int manaToGet;
private RecipeAdvancedPlate currentRecipe;
private int recipeID;
public boolean requestUpdate;
public void updateEntity() {
if(!this.worldObj.isRemote)
updateServer();
else
updateClient();
ISparkEntity spark = getAttachedSpark();
if (spark != null) {
List<ISparkEntity> sparkEntities = SparkHelper.getSparksAround(this.worldObj, this.xCoord + 0.5D, this.yCoord + 0.5D, this.zCoord + 0.5D);
for (ISparkEntity otherSpark : sparkEntities) {
if(spark == otherSpark)
continue;
else if(otherSpark.getAttachedTile() != null && otherSpark.getAttachedTile() instanceof IManaPool)
otherSpark.registerTransfer(spark);
}
}
}
private void updateServer() {
if(requestUpdate)
VanillaPacketDispatcher.dispatchTEToNearbyPlayers(this.worldObj, this.xCoord, this.yCoord, this.zCoord);
boolean hasUpdate = false;
List<EntityItem> items = this.worldObj.getEntitiesWithinAABB(EntityItem.class, AxisAlignedBB.getBoundingBox(this.xCoord, this.yCoord, this.zCoord, (this.xCoord + 1), (this.yCoord + 1), (this.zCoord + 1)));
for(EntityItem item : items) {
if(item.getEntityItem() != null && !item.isDead) {
ItemStack stack = item.getEntityItem();
int splitCount = addItemStack(stack);
stack.stackSize -= splitCount;
if(stack.stackSize <= 0)
item.setDead();
if(splitCount > 0)
hasUpdate = true;
break;
}
}
int wasManaToGet = this.manaToGet;
boolean hasCraft = false;
int recipeID = 0;
for(RecipeAdvancedPlate recipe : AdvancedBotanyAPI.advancedPlateRecipes) {
if(recipe.matches(this)) {
this.recipeID = recipeID;
if(this.mana > 0 && this.isFull()) {
ItemStack output = recipe.getOutput().copy();
this.recieveMana(-recipe.getManaUsage());
this.manaToGet = 0;
for(int i = 1; i < this.getSizeInventory(); i++) {
if(this.getStackInSlot(i).stackSize > 1)
--this.getStackInSlot(i).stackSize;
else
this.setInventorySlotContents(i, null);
}
if(this.getStackInSlot(0) != null)
++this.getStackInSlot(0).stackSize;
else
this.setInventorySlotContents(0, output);
hasUpdate = true;
worldObj.playSoundEffect(xCoord, yCoord, zCoord, "botania:terrasteelCraft", 1.0F, 2.0F);
break;
} else {
if(this.getStackInSlot(0) == null) {
this.manaToGet = recipe.getManaUsage();
currentRecipe = recipe;
hasCraft = true;
break;
} else if(isItemEqual(recipe.getOutput(), getStackInSlot(0)) && getStackInSlot(0).stackSize < recipe.getOutput().getMaxStackSize()) {
this.manaToGet = recipe.getManaUsage();
currentRecipe = recipe;
hasCraft = true;
break;
}
}
}
recipeID++;
}
if(!hasCraft) {
currentRecipe = null;
this.mana = 0;
this.manaToGet = 0;
}
if(this.manaToGet != wasManaToGet)
hasUpdate = true;
requestUpdate = hasUpdate;
}
private void updateClient() {
if(this.mana > 0) {
double worldTime = ClientTickHandler.ticksInGame + ClientTickHandler.partialTicks;
worldTime += (new Random((this.xCoord ^ this.yCoord ^ this.zCoord))).nextInt(360);
float indetY = (float)(Math.sin(worldTime / 18.0D) / 24.0D);
float ticks = 100.0F * getCurrentMana() / this.manaToGet;
int totalSpiritCount = 3;
double tickIncrement = 360.0D / totalSpiritCount;
int speed = 5;
double wticks = (ticks * speed) - tickIncrement;
double r = Math.sin((ticks - 100) / 10.0D) * 0.5D;
double g = Math.sin(wticks * Math.PI / 180.0D * 0.55D);
float size = 0.4f;
for(int i = 0; i < totalSpiritCount; i++) {
double x = this.xCoord + Math.sin(wticks * Math.PI / 180.0D) * r + 0.5D;
double y = this.yCoord - indetY + 0.85D + Math.abs(r) * 0.7D;
double z = this.zCoord + Math.cos(wticks * Math.PI / 180.0D) * r + 0.5D;
wticks += tickIncrement;
int color = 0x24cce0;
if(currentRecipe != null)
color = currentRecipe.getColor();
float hsb[] = Color.RGBtoHSB(color & 255, color >> 8 & 255, color >> 16 & 255, null);
int color1 = Color.HSBtoRGB(hsb[0], hsb[1], ticks / 100.0F);
float[] colorsfx = { (color1 & 255) / 255.0f, (color1 >> 8 & 255) / 255.0f, (color1 >> 16 & 255) / 255.0f };
Botania.proxy.wispFX(this.worldObj, x, y, z, colorsfx[0], colorsfx[1], colorsfx[2], 0.85F * size, (float)g * 0.05F, 0.25F);
Botania.proxy.wispFX(this.worldObj, x, y, z, colorsfx[0], colorsfx[1], colorsfx[2], (float)Math.random() * 0.1F + 0.1F * size, (float)(Math.random() - 0.5D) * 0.05F, (float)(Math.random() - 0.5D) * 0.05F, (float)(Math.random() - 0.5D) * 0.05F, 0.9F);
if(ticks == 100)
for(int j = 0; j < 12; j++)
Botania.proxy.wispFX(this.worldObj, this.xCoord + 0.5D, this.yCoord + 1.1D - indetY, this.zCoord + 0.5D, colorsfx[0], colorsfx[1], colorsfx[2], (float)Math.random() * 0.15F + 0.15F * size, (float)(Math.random() - 0.5D) * 0.125F * size, (float)(Math.random() - 0.5D) * 0.125F * size, (float)(Math.random() - 0.5D) * 0.125F * size, 0.8f);
}
}
}
public static boolean isItemEqual(ItemStack stack, ItemStack stack1) {
return stack.isItemEqual(stack1) && ItemStack.areItemStackTagsEqual(stack, stack1);
}
private int addItemStack(ItemStack stack) {
for (int i = 1; i < getSizeInventory(); i++) {
if(getStackInSlot(i) == null) {
ItemStack stackToAdd = stack.copy();
setInventorySlotContents(i, stackToAdd);
return stack.stackSize;
} else if(isItemEqual(stack, getStackInSlot(i))) {
if(getStackInSlot(i).stackSize < stack.getMaxStackSize()) {
int count = Math.min(stack.stackSize, stack.getMaxStackSize() - getStackInSlot(i).stackSize);
getStackInSlot(i).stackSize += count;
return count;
}
}
}
return 0;
}
public void writeCustomNBT(NBTTagCompound cmp) {
super.writeCustomNBT(cmp);
cmp.setInteger("mana", mana);
cmp.setInteger("manaToGet", manaToGet);
cmp.setBoolean("requestUpdate", requestUpdate);
cmp.setInteger("recipeID", currentRecipe == null ? -1 : recipeID);
}
public void readCustomNBT(NBTTagCompound cmp) {
super.readCustomNBT(cmp);
this.mana = cmp.getInteger("mana");
this.manaToGet = cmp.getInteger("manaToGet");
this.requestUpdate = cmp.getBoolean("requestUpdate");
int recipeID = cmp.getInteger("recipeID");
if(recipeID == -1)
this.currentRecipe = null;
else
this.currentRecipe = AdvancedBotanyAPI.advancedPlateRecipes.get(recipeID);
}
public int getSizeInventory() {
return 4;
}
public String getInventoryName() {
return "tileAdvancedPlate";
}
public int getCurrentMana() {
return this.mana;
}
public boolean isFull() {
return this.mana >= this.manaToGet;
}
public void recieveMana(final int mana) {
this.mana = Math.min(this.mana + mana, this.manaToGet);
}
public boolean canRecieveManaFromBursts() {
return !this.isFull();
}
public boolean canAttachSpark(ItemStack stack) {
return true;
}
public void attachSpark(ISparkEntity entity) {}
public ISparkEntity getAttachedSpark() {
List<ISparkEntity> sparks = this.worldObj.getEntitiesWithinAABB(ISparkEntity.class, AxisAlignedBB.getBoundingBox(this.xCoord, (this.yCoord + 1), this.zCoord, (this.xCoord + 1), (this.yCoord + 2), (this.zCoord + 1)));
if (sparks.size() == 1) {
Entity e = (Entity)sparks.get(0);
return (ISparkEntity)e;
}
return null;
}
public boolean areIncomingTranfersDone() {
return this.isFull();
}
public int getAvailableSpaceForMana() {
return Math.max(0, this.manaToGet - getCurrentMana());
}
public int[] getAccessibleSlotsFromSide(int side) {
return new int[]{0, 1, 2, 3};
}
public boolean canInsertItem(int slot, ItemStack stack, int side) {
for(int i = 1; i < getSizeInventory(); i++) {
ItemStack slotStack = getStackInSlot(i);
if(slotStack != null && slotStack.stackSize == slotStack.getMaxStackSize() && isItemEqual(stack, slotStack))
return false;
}
return side == 1 && slot != 0;
}
public boolean canExtractItem(int slot, ItemStack stack, int side) {
return (side == 0 && slot == 0) || (side != 0 && side != 1 && slot != 0);
}
}
@@ -0,0 +1,58 @@
package ab.common.core;
import net.minecraft.block.Block;
import net.minecraft.block.BlockSapling;
import net.minecraft.block.IGrowable;
import net.minecraft.block.material.Material;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.world.World;
import net.minecraftforge.common.ForgeHooks;
import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.event.world.BlockEvent;
public class CommonHelper {
public static void fertilizer(World world, Block block, int xCoord, int yCoord, int zCoord, int count, EntityPlayer player) {
if(world.isRemote || !(block instanceof IGrowable) || block instanceof BlockSapling || world.getTileEntity(xCoord, yCoord, zCoord) != null)
return;
if(player != null) {
BlockEvent.BreakEvent event = new BlockEvent.BreakEvent(xCoord, yCoord, zCoord, world, world.getBlock(xCoord, yCoord, zCoord), world.getBlockMetadata(xCoord, yCoord, zCoord), player);
MinecraftForge.EVENT_BUS.post(event);
if(event.isCanceled())
return;
}
IGrowable igrowable = (IGrowable)block;
if(igrowable.func_149851_a(world, xCoord, yCoord, zCoord, world.isRemote))
if(igrowable.func_149852_a(world, world.rand, xCoord, yCoord, zCoord)) {
int meta = world.getBlockMetadata(xCoord, yCoord, zCoord);
for(int i = 0; i < count; i++) {
if(meta != world.getBlockMetadata(xCoord, yCoord, zCoord))
return;
igrowable.func_149853_b(world, world.rand, xCoord, yCoord, zCoord);
}
}
}
public static boolean setBlock(World world, Block block, int meta, int x, int y, int z, EntityPlayer player, boolean checkAir) {
if(!world.isRemote) {
if(checkAir && !(world.getBlock(x, y, z).getMaterial() == Material.air))
return false;
BlockEvent.BreakEvent event = new BlockEvent.BreakEvent(x, y, z, world, world.getBlock(x, y, z), world.getBlockMetadata(x, y, z), player);
MinecraftForge.EVENT_BUS.post(event);
if(event.isCanceled())
return false;
return setBlockWithY(world, block, meta, x, y, z);
}
return false;
}
private static boolean setBlockWithY(World world, Block block, int meta, int x, int y, int z) {
if(y < 256)
world.setBlock(x, y, z, block, meta, 3);
else
return false;
return true;
}
}
@@ -0,0 +1,185 @@
package ab.common.core.handler;
import java.io.File;
import ab.AdvancedBotany;
import ab.api.AdvancedBotanyAPI;
import cpw.mods.fml.client.event.ConfigChangedEvent;
import cpw.mods.fml.common.FMLCommonHandler;
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
import net.minecraft.entity.passive.EntitySheep;
import net.minecraftforge.common.config.Configuration;
import net.minecraftforge.common.config.Property;
public class ConfigABHandler {
public static Configuration config;
public static final String CATEGORY_BALANCE = "general." + "balance";
public static final String CATEGORY_BALANCE_MANA_COST = "general." + "balance.manacost";
public static final String CATEGORY_RELICS = "general." + "relics";
public static final String CATEGORY_INTEGRATION = "general." + "integration";
//Balance
public static int[] maxContainerMana = new int[] { 64000000, 8000000, 64000000 };
public static double protectionFactorNebula = 1.0f;
public static double damageFactorSpaceSword = 1.0f;
public static int nebulaWandCooldownTick = 18;
public static int spreaderMaxMana = 128000;
public static int spreaderBurstMana = 32000;
public static String[] lockWorldNameNebulaRod = new String[] {};
public static int limitXZCoords = 30000000;
public static int maxDictariusCount = 64;
public static int sprawlRodMaxArea = 64;
//Balance - mana cost
public static int nebulaRodManaCost = 180;
public static int sphereNavigationManaCost = 2500;
//Relics
public static String[] lockEntityListToHorn = new String[] {};
public static String[] relicNames = new String[] { "infiniteFruit", "kingKey", "flugelEye", "thorRing", "odinRing", "lokiRing",
"freyrSlingshot", "keyHiddenRiches", "pocketWardrobe", "sphereNavigation", "hornPlenty" };
public static boolean[] fateBoardRelicEnables = new boolean[relicNames.length];
//Integration
public static boolean hasAutoThaum = true;
//Misc
public static boolean useManaChargerAnimation = true;
public static boolean hasManaCharger = true;
static {
for(int i = 0; i < fateBoardRelicEnables.length; i++)
fateBoardRelicEnables[i] = true;
}
public static void loadConfig(File configFile) {
config = new Configuration(configFile);
config.load();
loadCategories();
load();
FMLCommonHandler.instance().bus().register(new ChangeListener());
}
public static void load() {
//Balance Settings
String desc = "Maximum mana capacity for Mana Container";
maxContainerMana[0] = loadPropInt(CATEGORY_BALANCE, "Mana Container Capacity", desc, false, maxContainerMana[0]);
desc = "Maximum mana capacity for Diluted Mana Container";
maxContainerMana[1] = loadPropInt(CATEGORY_BALANCE, "Mana Container Capacity (Diluted)", desc, false, maxContainerMana[1]);
desc = "Maximum mana capacity for Fabulous Mana Container";
maxContainerMana[2] = loadPropInt(CATEGORY_BALANCE, "Mana Container Capacity (Fabulous)", desc, false, maxContainerMana[2]);
desc = "Protection factor for nebula armour";
protectionFactorNebula = loadPropDouble(CATEGORY_BALANCE, "Nebula Armor Protection Factor", desc, false, protectionFactorNebula);
desc = "Damage factor for Space Blade";
damageFactorSpaceSword = loadPropDouble(CATEGORY_BALANCE, "Space Sword Damage Factor", desc, false, damageFactorSpaceSword);
desc = "The number of ticks needed to restore 1 unit of the Rod of Nebula strength.";
nebulaWandCooldownTick = loadPropInt(CATEGORY_BALANCE, "Rod of Nebula Cooldown", desc, false, nebulaWandCooldownTick);
desc = "Maximum amount of mana held in a mana spreader";
spreaderMaxMana = loadPropInt(CATEGORY_BALANCE, "Spreader Max Mana", desc, false, spreaderMaxMana);
desc = "Amount of Mana in a Mana Burst";
spreaderBurstMana = loadPropInt(CATEGORY_BALANCE, "Spreader Burst Mana", desc, false, spreaderBurstMana);
desc = "To block a creature, type it's class name";
lockWorldNameNebulaRod = loadPropString(CATEGORY_BALANCE, "Locking Worlds for Teleportation with Nebula Rod", desc, false, lockWorldNameNebulaRod);
desc = "Limitation on X Z coordinates for teleportation, do not increase the default value";
limitXZCoords = loadPropInt(CATEGORY_BALANCE, "Restriction on X Z coordinates for Rod of Nebula", desc, false, limitXZCoords);
desc = "Limit the number of flowers next to each other";
maxDictariusCount = loadPropInt(CATEGORY_BALANCE, "Max Dictarius Count", desc, false, maxDictariusCount);
desc = "Changes the area of effect of a projectile created with Rod of Sprawl";
sprawlRodMaxArea = loadPropInt(CATEGORY_BALANCE, "Rod of Sprawl Max Area", desc, false, sprawlRodMaxArea);
//Balance Settings - mana cost
desc = "Mana cost to restore one unit of strength";
nebulaRodManaCost = loadPropInt(CATEGORY_BALANCE_MANA_COST, "Rod of Nebula repair Mana cost", desc, false, nebulaRodManaCost);
desc = "Mana cost to try to find the specified block";
sphereNavigationManaCost = loadPropInt(CATEGORY_BALANCE_MANA_COST, "Sphere of Navigation Mana cost", desc, false, sphereNavigationManaCost);
//Relics Settings
lockEntityListToHorn = loadPropString(CATEGORY_RELICS, "Blocked creatures for double drop", desc, false, lockEntityListToHorn);
desc = "Enter the name of the World you want to add to the blacklist";
desc = "Enable or disable relic drop on the Fate Playing Board";
for(int i = 0; i < fateBoardRelicEnables.length; i++)
fateBoardRelicEnables[i] = loadPropBool(CATEGORY_RELICS, "Enable relic: " + relicNames[i], desc, false, fateBoardRelicEnables[i]);
//Misc Settings
desc = "Activating the charging animation for the Mana Charger";
useManaChargerAnimation = loadPropBool("general", "Mana Charger lighting", desc, false, useManaChargerAnimation);
desc = "Switching the Mana Charger on or off in the game";
hasManaCharger = loadPropBool("general", "Enable Mana Charger", desc, true, hasManaCharger);
// Integration Settings
desc = "Switching the Thaumim Crafty Crate on or off in the game";
hasAutoThaum = loadPropBool(CATEGORY_INTEGRATION, "Enable Thaumim Crafty Crate", desc, true, hasAutoThaum);
if(config.hasChanged())
config.save();
}
public static void loadCategories() {
addCategory(CATEGORY_BALANCE, "Advanced Botany: balance settings");
addCategory(CATEGORY_BALANCE_MANA_COST, "Advanced Botany: balance settings (mana cost)");
addCategory(CATEGORY_RELICS, "Advanced Botany: relics settings");
addCategory(CATEGORY_INTEGRATION, "Advanced Botany: integration settings");
}
public static void addCategory(String name, String comment) {
config.addCustomCategoryComment(name, comment);
config.getCategory(name).setLanguageKey(name);
}
public static void loadPostInit() {
if(config.hasChanged())
config.save();
}
public static String[] loadPropString(String category, String propName, String desc, boolean hasRestart, String[] default_) {
Property prop = config.get(category, propName, default_);
prop.comment = desc;
prop.setRequiresMcRestart(hasRestart);
return prop.getStringList();
}
public static boolean loadPropBool(String category, String propName, String desc, boolean hasRestart, boolean default_) {
Property prop = config.get(category, propName, default_);
prop.comment = desc;
prop.setRequiresMcRestart(hasRestart);
return prop.getBoolean(default_);
}
public static int loadPropInt(String category, String propName, String desc, boolean hasRestart, int default_) {
Property prop = config.get(category, propName, default_);
prop.comment = desc;
prop.setRequiresMcRestart(hasRestart);
return prop.getInt(default_);
}
public static double loadPropDouble(String category, String propName, String desc, boolean hasRestart, double default_) {
Property prop = config.get(category, propName, default_);
prop.comment = desc;
prop.setRequiresMcRestart(hasRestart);
return prop.getDouble(default_);
}
public static class ChangeListener {
@SubscribeEvent
public void onConfigChanged(ConfigChangedEvent.OnConfigChangedEvent eventArgs) {
if(eventArgs.modID.equals(AdvancedBotany.modid))
ConfigABHandler.load();
}
}
}
@@ -0,0 +1,26 @@
package ab.common.core.handler;
import ab.client.gui.GuiItemChest;
import ab.client.gui.ContainerItemChest;
import cpw.mods.fml.common.network.IGuiHandler;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.world.World;
public class GuiHandler implements IGuiHandler {
public Object getServerGuiElement(int ID, EntityPlayer player, World world, int x, int y, int z) {
switch (ID) {
case 0:
return new ContainerItemChest(player);
}
return null;
}
public Object getClientGuiElement(int ID, EntityPlayer player, World world, int x, int y, int z) {
switch (ID) {
case 0:
return new GuiItemChest(player);
}
return null;
}
}
@@ -0,0 +1,35 @@
package ab.common.core.handler;
import ab.common.core.proxy.packet.S00PacketHornChargeHud;
import ab.common.core.proxy.packet.S01PacketFindNearBlocks;
import ab.common.core.proxy.packet.S02PacketSpaceBladeDash;
import cpw.mods.fml.common.network.NetworkRegistry;
import cpw.mods.fml.common.network.simpleimpl.IMessage;
import cpw.mods.fml.common.network.simpleimpl.SimpleNetworkWrapper;
import cpw.mods.fml.relauncher.Side;
import net.minecraft.block.Block;
import net.minecraft.entity.player.EntityPlayerMP;
public class NetworkHandler {
public static final SimpleNetworkWrapper NETWORK = NetworkRegistry.INSTANCE.newSimpleChannel("advancedBotanyChanel");
public static void registerPackets() {
int id = 0;
NETWORK.registerMessage(S00PacketHornChargeHud.class, S00PacketHornChargeHud.class, id++, Side.CLIENT);
NETWORK.registerMessage(S01PacketFindNearBlocks.class, S01PacketFindNearBlocks.class, id++, Side.CLIENT);
NETWORK.registerMessage(S02PacketSpaceBladeDash.class, S02PacketSpaceBladeDash.class, id++, Side.CLIENT);
}
public static void sendPacketToSpaceDash(EntityPlayerMP playerMP) {
NETWORK.sendTo(new S02PacketSpaceBladeDash(), playerMP);
}
public static void sendPacketToFindBlocks(EntityPlayerMP playerMP, Block block, int meta) {
NETWORK.sendTo(new S01PacketFindNearBlocks(block, meta), playerMP);
}
public static void sendPacketToHornHud(EntityPlayerMP playerMP, short chargeLoot) {
NETWORK.sendTo(new S00PacketHornChargeHud(chargeLoot), playerMP);
}
}
@@ -0,0 +1,46 @@
package ab.common.core.proxy;
import ab.AdvancedBotany;
import ab.api.AdvancedBotanyAPI;
import ab.common.core.handler.ConfigABHandler;
import ab.common.core.handler.GuiHandler;
import ab.common.core.handler.NetworkHandler;
import ab.common.lib.register.AchievementRegister;
import ab.common.lib.register.BlockListAB;
import ab.common.lib.register.EntityListAB;
import ab.common.lib.register.FlowerRegister;
import ab.common.lib.register.ItemListAB;
import ab.common.lib.register.RecipeListAB;
import ab.common.minetweaker.MineTweakerConfig;
import cpw.mods.fml.common.Loader;
import cpw.mods.fml.common.event.FMLInitializationEvent;
import cpw.mods.fml.common.event.FMLPostInitializationEvent;
import cpw.mods.fml.common.event.FMLPreInitializationEvent;
import cpw.mods.fml.common.network.NetworkRegistry;
import net.minecraft.item.ItemStack;
import net.minecraftforge.common.MinecraftForge;
import vazkii.botania.common.item.ModItems;
public class CommonProxy {
public void preInit(FMLPreInitializationEvent event) {
BlockListAB.init();
ItemListAB.init();
AchievementRegister.init();
EntityListAB.init();
FlowerRegister.init();
ConfigABHandler.loadConfig(event.getSuggestedConfigurationFile());
}
public void init(FMLInitializationEvent event) {
NetworkRegistry.INSTANCE.registerGuiHandler(AdvancedBotany.instance, new GuiHandler());
RecipeListAB.init();
NetworkHandler.registerPackets();
}
public void postInit(FMLPostInitializationEvent event) {
ConfigABHandler.loadPostInit();
if(Loader.isModLoaded("MineTweaker3"))
MineTweakerConfig.registerMT();
}
}
@@ -0,0 +1,37 @@
package ab.common.core.proxy.packet;
import ab.client.core.handler.ItemsRemainingRender;
import ab.common.lib.register.ItemListAB;
import cpw.mods.fml.common.network.simpleimpl.IMessage;
import cpw.mods.fml.common.network.simpleimpl.IMessageHandler;
import cpw.mods.fml.common.network.simpleimpl.MessageContext;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import io.netty.buffer.ByteBuf;
import net.minecraft.item.ItemStack;
public class S00PacketHornChargeHud implements IMessage, IMessageHandler<S00PacketHornChargeHud, IMessage> {
private static final ItemStack horn = new ItemStack(ItemListAB.itemHornPlenty);
private short chargeLoot;
public S00PacketHornChargeHud() {};
public S00PacketHornChargeHud(short chargeLoot) {
this.chargeLoot = chargeLoot;
}
public void toBytes(ByteBuf buf) {
buf.writeShort(chargeLoot);
}
public void fromBytes(ByteBuf buf) {
this.chargeLoot = buf.readShort();
}
@SideOnly(Side.CLIENT)
public IMessage onMessage(S00PacketHornChargeHud message, MessageContext ctx) {
ItemsRemainingRender.set(horn, "" + message.chargeLoot);
return null;
}
}
@@ -0,0 +1,45 @@
package ab.common.core.proxy.packet;
import ab.client.core.handler.ItemsRemainingRender;
import ab.common.item.relic.ItemSphereNavigation;
import cpw.mods.fml.common.network.ByteBufUtils;
import cpw.mods.fml.common.network.simpleimpl.IMessage;
import cpw.mods.fml.common.network.simpleimpl.IMessageHandler;
import cpw.mods.fml.common.network.simpleimpl.MessageContext;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import io.netty.buffer.ByteBuf;
import net.minecraft.block.Block;
import net.minecraft.client.Minecraft;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.world.WorldServer;
import net.minecraftforge.common.DimensionManager;
public class S01PacketFindNearBlocks implements IMessage, IMessageHandler<S01PacketFindNearBlocks, IMessage> {
private int blockID;
private int meta;
public S01PacketFindNearBlocks() {};
public S01PacketFindNearBlocks(Block block, int meta) {
this.blockID = Block.getIdFromBlock(block);
this.meta = meta;
}
public void toBytes(ByteBuf buf) {
buf.writeInt(this.blockID);
buf.writeInt(this.meta);
}
public void fromBytes(ByteBuf buf) {
this.blockID = buf.readInt();
this.meta = buf.readInt();
}
@SideOnly(Side.CLIENT)
public IMessage onMessage(S01PacketFindNearBlocks message, MessageContext ctx) {
ItemSphereNavigation.findBlocks(Minecraft.getMinecraft().theWorld, Block.getBlockById(message.blockID), message.meta, Minecraft.getMinecraft().thePlayer);
return null;
}
}
@@ -0,0 +1,23 @@
package ab.common.core.proxy.packet;
import ab.common.item.equipment.ItemSpaceBlade;
import cpw.mods.fml.common.network.simpleimpl.IMessage;
import cpw.mods.fml.common.network.simpleimpl.IMessageHandler;
import cpw.mods.fml.common.network.simpleimpl.MessageContext;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import io.netty.buffer.ByteBuf;
import net.minecraft.client.Minecraft;
public class S02PacketSpaceBladeDash implements IMessage, IMessageHandler<S02PacketSpaceBladeDash, IMessage> {
public void fromBytes(ByteBuf buf) {}
public void toBytes(ByteBuf buf) {}
@SideOnly(Side.CLIENT)
public IMessage onMessage(S02PacketSpaceBladeDash message, MessageContext ctx) {
ItemSpaceBlade.onPlayerSpaceDash(Minecraft.getMinecraft().thePlayer);
return null;
}
}
@@ -0,0 +1,324 @@
package ab.common.entity;
import java.awt.Color;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
import java.util.Collections;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.WeakHashMap;
import ab.common.lib.register.ItemListAB;
import baubles.common.lib.PlayerHandler;
import net.minecraft.entity.Entity;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.MathHelper;
import net.minecraft.world.World;
import vazkii.botania.api.mana.IManaItem;
import vazkii.botania.api.mana.spark.ISparkAttachable;
import vazkii.botania.api.mana.spark.ISparkEntity;
import vazkii.botania.api.mana.spark.SparkHelper;
import vazkii.botania.common.Botania;
import vazkii.botania.common.core.helper.Vector3;
import vazkii.botania.common.entity.EntitySpark;
import vazkii.botania.common.item.ModItems;
public class EntityAdvancedSpark extends Entity implements ISparkEntity {
Set<ISparkEntity> transfers = Collections.newSetFromMap(new WeakHashMap<ISparkEntity, Boolean>());
public int transferSpeed = 48000;
public int removeTransferants = 2;
public boolean firstTick = false;
public EntityAdvancedSpark(World world) {
super(world);
this.isImmuneToFire = true;
}
protected void entityInit() {
setSize(0.1F, 0.5F);
this.dataWatcher.addObject(27, Integer.valueOf(0));
this.dataWatcher.addObject(28, Integer.valueOf(0));
this.dataWatcher.setObjectWatched(27);
this.dataWatcher.setObjectWatched(28);
}
public void onUpdate() {
super.onUpdate();
ISparkAttachable tile = getAttachedTile();
if (tile == null) {
if (!this.worldObj.isRemote)
setDead();
return;
}
boolean first = (this.worldObj.isRemote && !this.firstTick);
int upgrade = getUpgrade();
List<ISparkEntity> allSparks = null;
if (first || upgrade == 2 || upgrade == 3)
allSparks = SparkHelper.getSparksAround(this.worldObj, this.posX, this.posY, this.posZ);
if (first)
first = true;
Collection<ISparkEntity> transfers = getTransfers();
if (upgrade != 0) {
List<EntityPlayer> players;
List<ISparkEntity> validSparks;
Map<EntityPlayer, Map<ItemStack, Integer>> receivingPlayers;
ItemStack input;
switch (upgrade) {
case 1:
players = SparkHelper.getEntitiesAround(EntityPlayer.class, this.worldObj, this.posX, this.posY, this.posZ);
receivingPlayers = new HashMap<EntityPlayer, Map<ItemStack, Integer>>();
input = new ItemStack(ModItems.spark);
for (EntityPlayer player : players) {
List<ItemStack> stacks = new ArrayList<ItemStack>();
stacks.addAll(Arrays.asList(player.inventory.mainInventory));
stacks.addAll(Arrays.asList(player.inventory.armorInventory));
stacks.addAll(Arrays.asList((PlayerHandler.getPlayerBaubles(player)).stackList));
for (ItemStack stack : stacks) {
if (stack == null || !(stack.getItem() instanceof IManaItem))
continue;
IManaItem manaItem = (IManaItem) stack.getItem();
if (manaItem.canReceiveManaFromItem(stack, input)) {
Map<ItemStack, Integer> receivingStacks;
boolean add = false;
if (!receivingPlayers.containsKey(player)) {
add = true;
receivingStacks = (Map) new HashMap<Object, Object>();
} else {
receivingStacks = receivingPlayers.get(player);
}
int recv = Math.min(getAttachedTile().getCurrentMana(), Math.min(transferSpeed, manaItem.getMaxMana(stack) - manaItem.getMana(stack)));
if (recv > 0) {
receivingStacks.put(stack, Integer.valueOf(recv));
if (add)
receivingPlayers.put(player, receivingStacks);
}
}
}
}
if (!receivingPlayers.isEmpty()) {
List<EntityPlayer> keys = new ArrayList<EntityPlayer>(receivingPlayers.keySet());
Collections.shuffle(keys);
EntityPlayer player = keys.iterator().next();
Map<ItemStack, Integer> items = receivingPlayers.get(player);
ItemStack stack = items.keySet().iterator().next();
int cost = ((Integer) items.get(stack)).intValue();
int manaToPut = Math.min(getAttachedTile().getCurrentMana(), cost);
((IManaItem) stack.getItem()).addMana(stack, manaToPut);
getAttachedTile().recieveMana(-manaToPut);
particlesTowards((Entity) player);
}
break;
case 2:
validSparks = new ArrayList<ISparkEntity>();
for (ISparkEntity spark : allSparks) {
if (spark == this)
continue;
int upgrade_ = spark.getUpgrade();
if (upgrade_ == 0 && spark.getAttachedTile() instanceof vazkii.botania.api.mana.IManaPool)
validSparks.add(spark);
}
if (validSparks.size() > 0)
((ISparkEntity) validSparks.get(this.worldObj.rand.nextInt(validSparks.size()))).registerTransfer(this);
break;
case 3:
for (ISparkEntity spark : allSparks) {
if (spark == this)
continue;
int upgrade_ = spark.getUpgrade();
if (upgrade_ != 2 && upgrade_ != 3 && upgrade_ != 4)
transfers.add(spark);
}
break;
}
}
if (!transfers.isEmpty()) {
int manaTotal = Math.min(transferSpeed * transfers.size(), tile.getCurrentMana());
int manaForEach = manaTotal / transfers.size();
int manaSpent = 0;
if (manaForEach > transfers.size()) {
for (ISparkEntity spark : transfers) {
if (spark.getAttachedTile() == null || spark.getAttachedTile().isFull() || spark.areIncomingTransfersDone()) {
manaTotal -= manaForEach;
continue;
}
ISparkAttachable attached = spark.getAttachedTile();
int spend = Math.min(attached.getAvailableSpaceForMana(), manaForEach);
attached.recieveMana(spend);
manaSpent += spend;
particlesTowards((Entity) spark);
}
tile.recieveMana(-manaSpent);
}
}
if (this.removeTransferants > 0)
this.removeTransferants--;
getTransfers();
}
public void particlesTowards(Entity e) {
Vector3 thisVec = Vector3.fromEntityCenter(this).add(0.0D, 0.0D, 0.0D);
Vector3 receiverVec = Vector3.fromEntityCenter(e).add(0.0D, 0.0D, 0.0D);
double rc = 0.45D;
thisVec.add((Math.random() - 0.5D) * rc, (Math.random() - 0.5D) * rc, (Math.random() - 0.5D) * rc);
receiverVec.add((Math.random() - 0.5D) * rc, (Math.random() - 0.5D) * rc, (Math.random() - 0.5D) * rc);
Vector3 motion = receiverVec.copy().sub(thisVec);
motion.multiply(0.03999999910593033D);
float r = 0.4F + 0.3F * (float) Math.random();
float g = 0.4F + 0.3F * (float) Math.random();
float b = 0.4F + 0.3F * (float) Math.random();
float size = 0.125F + 0.125F * (float) Math.random();
Botania.proxy.wispFX(this.worldObj, thisVec.x, thisVec.y, thisVec.z, r, g, b, size, (float) motion.x,
(float) motion.y, (float) motion.z);
}
public static void particleBeam(Entity e1, Entity e2) {
if (e1 == null || e2 == null)
return;
Vector3 orig = new Vector3(e1.posX, e1.posY + 0.25D, e1.posZ);
Vector3 end = new Vector3(e2.posX, e2.posY + 0.25D, e2.posZ);
Vector3 diff = end.copy().sub(orig);
Vector3 movement = diff.copy().normalize().multiply(0.1D);
int iters = (int) (diff.mag() / movement.mag());
float huePer = 1.0F / iters;
float hueSum = (float) Math.random();
Vector3 currentPos = orig.copy();
for (int i = 0; i < iters; i++) {
float hue = i * huePer + hueSum;
Color color = Color.getHSBColor(hue, 1.0F, 1.0F);
float r = Math.min(1.0F, color.getRed() / 255.0F + 0.4F);
float g = Math.min(1.0F, color.getGreen() / 255.0F + 0.4F);
float b = Math.min(1.0F, color.getBlue() / 255.0F + 0.4F);
Botania.proxy.setSparkleFXNoClip(true);
Botania.proxy.sparkleFX(e1.worldObj, currentPos.x, currentPos.y, currentPos.z, r, g, b, 1.0F, 12);
Botania.proxy.setSparkleFXNoClip(false);
currentPos.add(movement);
}
}
public boolean canBeCollidedWith() {
return true;
}
public boolean interactFirst(EntityPlayer player) {
ItemStack stack = player.getCurrentEquippedItem();
if (stack != null) {
int upgrade = getUpgrade();
if (stack.getItem() == ModItems.twigWand) {
if (player.isSneaking()) {
if (upgrade > 0) {
if (!this.worldObj.isRemote)
entityDropItem(new ItemStack(ModItems.sparkUpgrade, 1, upgrade - 1), 0.0F);
setUpgrade(0);
this.transfers.clear();
this.removeTransferants = 2;
} else {
setDead();
}
if (player.worldObj.isRemote)
player.swingItem();
return true;
}
List<ISparkEntity> allSparks = SparkHelper.getSparksAround(this.worldObj, this.posX, this.posY, this.posZ);
for (ISparkEntity spark : allSparks)
particleBeam(this, (Entity) spark);
return true;
}
if (stack.getItem() == ModItems.sparkUpgrade && upgrade == 0) {
int newUpgrade = stack.getItemDamage() + 1;
setUpgrade(newUpgrade);
stack.stackSize--;
if (player.worldObj.isRemote)
player.swingItem();
return true;
}
}
return doPhantomInk(stack);
}
public boolean doPhantomInk(ItemStack stack) {
if (stack != null && stack.getItem() == ModItems.phantomInk && !this.worldObj.isRemote) {
int invis = this.dataWatcher.getWatchableObjectInt(27);
this.dataWatcher.updateObject(27, Integer.valueOf((invis ^ 0xFFFFFFFF) & 0x1));
return true;
}
return false;
}
protected void readEntityFromNBT(NBTTagCompound cmp) {
setUpgrade(cmp.getInteger("upgrade"));
this.dataWatcher.updateObject(27, Integer.valueOf(cmp.getInteger("invis")));
}
protected void writeEntityToNBT(NBTTagCompound cmp) {
cmp.setInteger("upgrade", getUpgrade());
cmp.setInteger("invis", this.dataWatcher.getWatchableObjectInt(27));
}
public void setDead() {
super.setDead();
if (!this.worldObj.isRemote) {
int upgrade = getUpgrade();
entityDropItem(new ItemStack(ItemListAB.itemAdvancedSpark), 0.0F);
if (upgrade > 0)
entityDropItem(new ItemStack(ModItems.sparkUpgrade, 1, upgrade - 1), 0.0F);
}
}
public ISparkAttachable getAttachedTile() {
int x = MathHelper.floor_double(this.posX);
int y = MathHelper.floor_double(this.posY) - 1;
int z = MathHelper.floor_double(this.posZ);
TileEntity tile = this.worldObj.getTileEntity(x, y, z);
if (tile != null && tile instanceof ISparkAttachable)
return (ISparkAttachable) tile;
return null;
}
public Collection<ISparkEntity> getTransfers() {
Collection<ISparkEntity> removals = new ArrayList<ISparkEntity>();
for (ISparkEntity e : this.transfers) {
ISparkEntity spark = e;
int upgr = getUpgrade();
int supgr = spark.getUpgrade();
ISparkAttachable atile = spark.getAttachedTile();
if (spark == this || spark.areIncomingTransfersDone() || atile == null || atile.isFull()
|| ((upgr != 0 || supgr != 2) && (upgr != 3 || (supgr != 0 && supgr != 1))
&& atile instanceof vazkii.botania.api.mana.IManaPool))
removals.add(e);
}
if (!removals.isEmpty())
this.transfers.removeAll(removals);
return this.transfers;
}
private boolean hasTransfer(ISparkEntity entity) {
return this.transfers.contains(entity);
}
public void registerTransfer(ISparkEntity entity) {
if (hasTransfer(entity))
return;
this.transfers.add(entity);
}
public int getUpgrade() {
return this.dataWatcher.getWatchableObjectInt(28);
}
public void setUpgrade(int upgrade) {
this.dataWatcher.updateObject(28, Integer.valueOf(upgrade));
}
public boolean areIncomingTransfersDone() {
ISparkAttachable tile = getAttachedTile();
if (tile instanceof vazkii.botania.api.mana.IManaPool)
return (this.removeTransferants > 0);
return (tile != null && tile.areIncomingTranfersDone());
}
}
@@ -0,0 +1,59 @@
package ab.common.entity;
import net.minecraft.entity.Entity;
import net.minecraft.entity.item.EntityItem;
import net.minecraft.init.Blocks;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.world.World;
import vazkii.botania.common.Botania;
public class EntityAlphirinePortal extends Entity {
private static final ItemStack itemStack = new ItemStack(Blocks.air);
public EntityAlphirinePortal(World world) {
super(world);
this.dataWatcher.addObject(27, itemStack.copy());
this.dataWatcher.setObjectWatched(27);
}
protected void entityInit() {}
public void onUpdate() {
super.onUpdate();
if(this.ticksExisted >= 40) {
if(this.getStack() == itemStack)
this.setDead();
if(!this.worldObj.isRemote) {
EntityItem itemResult = new EntityItem(this.worldObj, this.posX, this.posY, this.posZ, this.getStack());
this.worldObj.spawnEntityInWorld(itemResult);
this.setDead();
}
}
}
protected void readEntityFromNBT(NBTTagCompound nbtt) {
this.ticksExisted = nbtt.getInteger("portalTick");
NBTTagCompound stackCmp = nbtt.getCompoundTag("dropStack");
ItemStack stack = ItemStack.loadItemStackFromNBT(stackCmp);
setStack(stack);
}
protected void writeEntityToNBT(NBTTagCompound nbtt) {
nbtt.setInteger("portalTick", this.ticksExisted);
ItemStack stack = getStack();
NBTTagCompound stackNbt = new NBTTagCompound();
if(stack != null)
stack.writeToNBT(stackNbt);
nbtt.setTag("dropStack", stackNbt);
}
public ItemStack getStack() {
return this.dataWatcher.getWatchableObjectItemStack(27);
}
public void setStack(ItemStack stack) {
this.dataWatcher.updateObject(27, stack);
}
}
@@ -0,0 +1,36 @@
package ab.common.entity;
import com.mojang.authlib.GameProfile;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import net.minecraft.client.entity.AbstractClientPlayer;
import net.minecraft.util.ChunkCoordinates;
import net.minecraft.util.IChatComponent;
import net.minecraft.world.World;
public class EntityAnonymousSteve extends AbstractClientPlayer {
public EntityAnonymousSteve(World world) {
super(world, new GameProfile(null, "abSteveForRenderer"));
}
public boolean canCommandSenderUseCommand(int i, String s) {
return false;
}
public ChunkCoordinates getPlayerCoordinates() {
return null;
}
@SideOnly(Side.CLIENT)
public int getBrightnessForRender(float par1) {
return 15728880;
}
public boolean isInvisible() {
return true;
}
public void addChatMessage(IChatComponent var1) {}
}
@@ -0,0 +1,167 @@
package ab.common.entity;
import java.awt.Color;
import java.util.List;
import java.util.Random;
import ab.client.core.ClientHelper;
import ab.common.core.CommonHelper;
import ab.common.lib.register.BlockListAB;
import cpw.mods.fml.relauncher.ReflectionHelper;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import net.minecraft.block.Block;
import net.minecraft.block.BlockBush;
import net.minecraft.block.BlockCrops;
import net.minecraft.block.BlockGrass;
import net.minecraft.block.BlockSapling;
import net.minecraft.block.IGrowable;
import net.minecraft.block.material.Material;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.passive.EntityAnimal;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.player.EntityPlayerMP;
import net.minecraft.entity.projectile.EntityThrowable;
import net.minecraft.init.Blocks;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.potion.PotionEffect;
import net.minecraft.util.AxisAlignedBB;
import net.minecraft.util.DamageSource;
import net.minecraft.util.MathHelper;
import net.minecraft.util.MovingObjectPosition;
import net.minecraft.util.Vec3;
import net.minecraft.world.World;
import vazkii.botania.common.Botania;
import vazkii.botania.common.core.handler.ConfigHandler;
import vazkii.botania.common.lib.LibObfuscation;
public class EntityManaVine extends EntityThrowable {
public EntityManaVine(World world) {
super(world);
}
public EntityManaVine(World world, EntityLivingBase entity) {
super(world, entity);
}
protected void entityInit() {
super.entityInit();
this.dataWatcher.addObject(28, "");
this.dataWatcher.setObjectWatched(28);
}
public String getAttacker() {
return this.dataWatcher.getWatchableObjectString(28);
}
public void setAttacker(String str) {
this.dataWatcher.updateObject(28, str);
}
public void onUpdate() {
super.onUpdate();
ticksExisted++;
if(ticksExisted >= 240)
setDead();
if(this.worldObj.isRemote) {
float m = 0.02F;
float f1 = 6.0f;
for(int i = 0; i < 4; i++) {
double posX = this.posX + (Math.random() / f1 - (0.5f / f1));
double posY = this.posY + (Math.random() / f1 - (0.5f / f1));
double posZ = this.posZ + (Math.random() / f1 - (0.5f / f1));
float mx = (float)(Math.random() - 0.5D) * m;
float my = (float)(Math.random() - 0.5D) * m;
float mz = (float)(Math.random() - 0.5D) * m;
Color color = ClientHelper.getCorporeaRuneColor((int)posX, (int)posY, (int)posZ, 3);
Botania.proxy.wispFX(worldObj, posX, posY, posZ, color.getRed() / 255.0f, color.getGreen() / 255.0f, color.getBlue() / 255.0f, (float) (0.15f + (Math.random() * 0.12f)), mx, my, mz, 0.7f);
}
}
}
protected void onImpact(MovingObjectPosition pos) {
EntityPlayer player = worldObj.getPlayerEntityByName(getAttacker());
if(pos != null && pos.entityHit == null && player != null) {
World world = this.worldObj;
int x = pos.blockX;
int y = pos.blockY;
int z = pos.blockZ;
List<EntityLivingBase> list = (List<EntityLivingBase>) (world.getEntitiesWithinAABB(EntityLivingBase.class, AxisAlignedBB.getBoundingBox(x - 10, y - 10, z - 10, x + 10, y + 10, z + 10)));
for(EntityLivingBase target : list) {
if(target instanceof EntityAnimal && target.attackEntityFrom(DamageSource.causePlayerDamage(player), 0.0f)) {
EntityAnimal animal = (EntityAnimal) target;
ReflectionHelper.setPrivateValue(EntityAnimal.class, animal, 1200, LibObfuscation.IN_LOVE);
animal.setTarget(null);
this.worldObj.setEntityState(animal, (byte) 18);
}
}
for(int k = 0; k < 7; k++)
for(int k1 = 0; k1 < 7; k1++)
for(int k2 = 0; k2 < 7; k2++) {
int xCoord = x + k - 3;
int yCoord = y + k1 - 1;
int zCoord = z + k2 - 3;
Block block = this.worldObj.getBlock(xCoord, yCoord, zCoord);
if(block instanceof IGrowable && !(block instanceof BlockGrass)) {
CommonHelper.fertilizer(world, block, xCoord, yCoord, zCoord, 12, player);
if(ConfigHandler.blockBreakParticles) {
worldObj.playAuxSFX(2005, xCoord, yCoord, zCoord, 6 + this.worldObj.rand.nextInt(4));
worldObj.playSoundEffect(x, y, z, "botania:agricarnation", 0.01F, 0.5F + (float) Math.random() * 0.5F);
}
} else if(!world.isRemote && BlockListAB.blockFreyrLiana.canBlockStay(world, xCoord, yCoord - 1, zCoord)) {
Vec3 vec = Vec3.createVectorHelper(xCoord, yCoord, zCoord);
int distant = (int)vec.squareDistanceTo(Vec3.createVectorHelper(x, y, z));
yCoord--;
if(this.worldObj.rand.nextInt(distant + 1) == 0)
while(yCoord > 0) {
block = worldObj.getBlock(xCoord, yCoord, zCoord);
if(block.isAir(worldObj, xCoord, yCoord, zCoord)) {
if(world.rand.nextInt(4) < 3)
CommonHelper.setBlock(world, BlockListAB.blockFreyrLiana, 0, xCoord, yCoord, zCoord, player, false);
else
CommonHelper.setBlock(world, BlockListAB.blockLuminousFreyrLiana, 0, xCoord, yCoord, zCoord, player, false);
worldObj.playAuxSFX(2001, xCoord, yCoord, zCoord, Block.getIdFromBlock(BlockListAB.blockFreyrLiana));
yCoord--;
} else
break;
}
}
}
this.setDead();
}
}
@SideOnly(Side.CLIENT)
public void setPositionAndRotation2(double p_70056_1_, double p_70056_3_, double p_70056_5_, float p_70056_7_, float p_70056_8_, int p_70056_9_) {}
protected float getGravityVelocity() {
return 0.0f;
}
public void setDead() {
if(this.worldObj.isRemote) {
float m = 0.175F;
for(int i = 0; i < 32; i++) {
float mx = (float)(Math.random() - 0.5D) * m;
float my = (float)(Math.random() - 0.5D) * m;
float mz = (float)(Math.random() - 0.5D) * m;
Color color = ClientHelper.getCorporeaRuneColor((int)posX, (int)posY, (int)posZ, 3);
Botania.proxy.wispFX(worldObj, posX, posY, posZ, color.getRed() / 255.0f, color.getGreen() / 255.0f, color.getBlue() / 255.0f, (float) (0.2f + (Math.random() * 0.12f)), mx, my, mz, 2.0f);
}
}
super.setDead();
}
public void readEntityFromNBT(NBTTagCompound nbtt) {
super.readEntityFromNBT(nbtt);
ticksExisted = nbtt.getInteger("ticks");
setAttacker(nbtt.getString("attacker"));
}
public void writeEntityToNBT(NBTTagCompound nbtt) {
super.writeEntityToNBT(nbtt);
nbtt.setInteger("ticks", ticksExisted);
nbtt.setString("attacker", getAttacker());
}
}
Loaded 100 of 1429 files, more files were not shown because too many files have changed in this diff. Show more