no message

This commit is contained in:
Pulxes-9244 committed 2022-02-15 18:46:24 +03:00
1 parent 93f114dceb
commit f435e13882
645 files changed
-59797

No files matched your search

-42
View File
@@ -1,42 +0,0 @@
package ab;
import ab.common.core.proxy.CommonProxy;
import ab.common.integration.corporea.EventCorporeaHandler;
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")
public class AdvancedBotany {
public static final String modid = "AdvancedBotany";
public static final String version = "Beta-1";
@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);
//MinecraftForge.EVENT_BUS.register(new EventCorporeaHandler());
}
@Mod.EventHandler
public void postInit(FMLPostInitializationEvent event) {
proxy.postInit(event);
}
public static final CreativeTabs tabAB = new AdvancedBotanyTab("tabAB");
}
-24
View File
@@ -1,24 +0,0 @@
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);
}
}
@@ -1,42 +0,0 @@
package ab.api;
import java.util.ArrayList;
import java.util.List;
import ab.api.recipe.RecipeAdvancedPlate;
import ab.api.recipe.RecipeAncientAlphirine;
import net.minecraft.block.Block;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraftforge.common.util.EnumHelper;
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 Item.ToolMaterial mithrilToolMaterial = EnumHelper.addToolMaterial("MITHRIL", 7, -1, 8.0F, 8.0F, 20);
public static RecipeAdvancedPlate registerAdvancedPlateRecipe(ItemStack output, ItemStack input1, ItemStack input2, ItemStack input3, int mana) {
RecipeAdvancedPlate recipe = new RecipeAdvancedPlate(output, mana, input1, input2, input3);
advancedPlateRecipes.add(recipe);
return recipe;
}
public static RecipeAncientAlphirine registerAlphirineRecipe(ItemStack output, ItemStack input, int chance) {
if(chance > 100)
chance = 100;
else if(chance <= 0)
chance = 1;
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;
}
}
@@ -1,200 +0,0 @@
package ab.api;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Set;
import ab.common.integration.corporea.CustomWrappedIInventory;
import ab.common.lib.utils.Pair;
import net.minecraft.inventory.IInventory;
import net.minecraft.item.ItemStack;
import net.minecraftforge.common.MinecraftForge;
import vazkii.botania.api.corporea.CorporeaHelper;
import vazkii.botania.api.corporea.CorporeaRequest;
import vazkii.botania.api.corporea.CorporeaRequestEvent;
import vazkii.botania.api.corporea.ICorporeaInterceptor;
import vazkii.botania.api.corporea.ICorporeaSpark;
import vazkii.botania.api.corporea.IWrappedInventory;
public class AdvancedCorporeaHelper {
public static ItemStack getStackBySlot(IInventory inv, int slot, int itemCount, ICorporeaSpark spark,
boolean doit) {
List<ItemStack> stacks = new ArrayList<ItemStack>();
if (!CorporeaHelper.getSparkForInventory(inv).getConnections().contains(spark)
|| inv.getStackInSlot(slot) == null)
return null;
Pair pair = new Pair<IInventory, Integer>(inv, slot);
CorporeaRequestEvent event = new CorporeaRequestEvent(pair, itemCount, spark, false, doit);
if (MinecraftForge.EVENT_BUS.post(event))
return null;
Map<ICorporeaInterceptor, ICorporeaSpark> interceptors = new HashMap<ICorporeaInterceptor, ICorporeaSpark>();
IWrappedInventory invW = CustomWrappedIInventory.wrap(inv, spark);
List<IInventory> inventories = CorporeaHelper.getInventoriesOnNetwork(spark);
CorporeaRequest request = new CorporeaRequest(pair, false, itemCount);
for (IInventory inv$ : inventories) {
if (inv$ instanceof ICorporeaInterceptor) {
ICorporeaSpark spark$ = CorporeaHelper.getSparkForInventory(inv$);
ICorporeaInterceptor interceptor = (ICorporeaInterceptor) inv$;
interceptor.interceptRequest(pair, itemCount, spark$, spark, stacks, inventories, doit);
interceptors.put(interceptor, spark$);
}
}
if (doit) {
stacks.addAll(invW.extractItems(request));
} else {
stacks.addAll(invW.countItems(request));
}
for (ICorporeaInterceptor interceptor : interceptors.keySet())
interceptor.interceptRequestLast(pair, itemCount, interceptors.get(interceptor), spark, stacks, inventories,
doit);
if (stacks.isEmpty())
return null;
else
return stacks.get(0);
}
public static Object trasformateRequest(ICorporeaSpark spark, Object from, Class class$) {
ItemStack stack = null;
if (from instanceof ItemStack)
stack = (ItemStack) from;
if (from instanceof Pair) {
Pair pair = (Pair) from;
Object key = pair.getKey();
Object value = pair.getValue();
if (key instanceof IInventory && value instanceof Integer)
stack = ((IInventory) from).getStackInSlot((Integer) value);
if (key instanceof String && value instanceof ItemStack) {
int count = ((ItemStack) value).stackSize;
List<ItemStack> stacks = requestSameNamedItem((String) key, (ItemStack) value, spark, count, false);
if(stacks.isEmpty()) {
stacks = requestSameNamedItem((String) key, null, spark, count, false);
if(stacks.isEmpty())
return null;
}
stack = stacks.get(0);
}
}
if(String.class.isAssignableFrom(class$))
return stack.getDisplayName();
if(IInventory.class.isAssignableFrom(class$))
return getFirstInventoryWithStackByRequest(spark, stack);
if(ItemStack.class.isAssignableFrom(class$))
return stack;
return null;
}
public static Pair<IInventory, Integer> getFirstInventoryWithStackByRequest(ICorporeaSpark spark, ItemStack stack) {
List<IInventory> inventories = CorporeaHelper.getInventoriesOnNetwork(spark);
Pair<IInventory, Integer> pair = new Pair<IInventory, Integer>();
for (IInventory inv : inventories) {
for (int i = 0; i < inv.getSizeInventory(); i++) {
ItemStack stack$ = inv.getStackInSlot(i);
if (stack$ == null)
continue;
if (stack.getItem().equals(stack$.getItem()) && stack$.getItemDamage() == stack.getItemDamage()
&& stack.getItem().equals(stack$.getItem())
&& stack.getDisplayName().equals(stack$.getDisplayName())) {
pair.set(inv, i);
}
}
}
return pair;
}
public static List<ItemStack> requestRandomItem(ICorporeaSpark spark, int itemCount, boolean doit) {
List<ItemStack> stacks = new ArrayList<ItemStack>();
CorporeaRequestEvent event = new CorporeaRequestEvent(null, itemCount, spark, false, doit);
if (MinecraftForge.EVENT_BUS.post(event))
return stacks;
Map<ICorporeaInterceptor, ICorporeaSpark> interceptors = new HashMap<ICorporeaInterceptor, ICorporeaSpark>();
List<IInventory> inventories = CorporeaHelper.getInventoriesOnNetwork(spark);
List<IWrappedInventory> inventoriesW = wrapInventory(inventories);
CorporeaRequest request = new CorporeaRequest(null, false, itemCount);
for (IWrappedInventory inv : inventoriesW) {
ICorporeaSpark invSpark = inv.getSpark();
Object originalInventory = inv.getWrappedObject();
if (originalInventory instanceof ICorporeaInterceptor) {
ICorporeaInterceptor interceptor = (ICorporeaInterceptor) originalInventory;
interceptor.interceptRequest(null, itemCount, invSpark, spark, stacks, inventories, doit);
interceptors.put(interceptor, invSpark);
}
if (doit) {
stacks.addAll(inv.extractItems(request));
} else {
stacks.addAll(inv.countItems(request));
}
}
for (ICorporeaInterceptor interceptor : interceptors.keySet())
interceptor.interceptRequestLast(null, itemCount, interceptors.get(interceptor), spark, stacks, inventories,
doit);
return stacks;
}
public static int sumStackSizes(List<ItemStack> stacks) {
int sum = 0;
for (ItemStack stack : stacks)
sum += stack.stackSize;
return sum;
}
public static List<IWrappedInventory> wrapInventory(List<IInventory> inventories) {
ArrayList<IWrappedInventory> arrayList = new ArrayList<IWrappedInventory>();
for (IInventory inv : inventories) {
ICorporeaSpark spark = CorporeaHelper.getSparkForInventory(inv);
IWrappedInventory wrapped = CustomWrappedIInventory.wrap(inv, spark);
arrayList.add(wrapped);
}
return arrayList;
}
public static List<ItemStack> requestSameNamedItem(String name, ItemStack matcher, ICorporeaSpark spark, int count,
boolean doit) {
List<ItemStack> stacks = new ArrayList<ItemStack>();
Pair pair = new Pair<String, ItemStack>(name, matcher);
CorporeaRequestEvent event = new CorporeaRequestEvent(pair, count, spark, false, doit);
if (MinecraftForge.EVENT_BUS.post(event))
return stacks;
Map<ICorporeaInterceptor, ICorporeaSpark> interceptors = new HashMap<ICorporeaInterceptor, ICorporeaSpark>();
List<IInventory> inventories = CorporeaHelper.getInventoriesOnNetwork(spark);
List<IWrappedInventory> inventoriesW = wrapInventory(inventories);
CorporeaRequest request = new CorporeaRequest(pair, false, count);
for (IWrappedInventory inv : inventoriesW) {
ICorporeaSpark invSpark = inv.getSpark();
Object originalInventory = inv.getWrappedObject();
if (originalInventory instanceof ICorporeaInterceptor) {
ICorporeaInterceptor interceptor = (ICorporeaInterceptor) originalInventory;
interceptor.interceptRequest(pair, count, invSpark, spark, stacks, inventories, doit);
interceptors.put(interceptor, invSpark);
}
if (doit) {
stacks.addAll(inv.extractItems(request));
} else {
stacks.addAll(inv.countItems(request));
}
}
for (ICorporeaInterceptor interceptor : interceptors.keySet())
interceptor.interceptRequestLast(matcher, count, interceptors.get(interceptor), spark, stacks, inventories,
doit);
return stacks;
}
}
@@ -1,15 +0,0 @@
package ab.api;
import ab.common.block.tile.TileCorporeaCatalyst;
public interface ICorporeaModification {
public void setCatalystCoords(int x, int y, int z);
public TileCorporeaCatalyst getCatalystTile();
public boolean isModified();
public void removeModification();
}
-11
View File
@@ -1,11 +0,0 @@
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
@@ -1,9 +0,0 @@
package ab.api;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.ScaledResolution;
public interface IRenderHud {
public void renderHud(Minecraft mc, ScaledResolution res);
}
@@ -1,22 +0,0 @@
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;
}
}
@@ -1,62 +0,0 @@
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 List<ItemStack> inputs;
private int mana;
public RecipeAdvancedPlate(ItemStack output, int mana, ItemStack... inputs) {
this.output = output;
this.mana = mana;
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 boolean matches(IInventory inv) {
List<Object> 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++) {
Object input = inputsMissing.get(j);
if (input instanceof ItemStack && simpleAreStacksEqual((ItemStack)input, stack)) {
stackIndex = j;
break;
}
}
if (stackIndex != -1) {
inputsMissing.remove(stackIndex);
} else {
return false;
}
}
return inputsMissing.isEmpty();
}
boolean simpleAreStacksEqual(ItemStack stack, ItemStack stack2) {
return (stack.getItem() == stack2.getItem() && stack.getItemDamage() == stack2.getItemDamage());
}
}
@@ -1,33 +0,0 @@
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;
this.chance = chance;
}
public ItemStack getOutput() {
return output;
}
public ItemStack getInput() {
return input;
}
public int getChance() {
return chance;
}
public boolean matches(ItemStack stack) {
return stack.getItem() == input.getItem() && stack.getItemDamage() == input.getItemDamage();
}
}
@@ -1,102 +0,0 @@
package ab.api.recipe.lexicon;
import java.util.ArrayList;
import java.util.List;
import org.lwjgl.opengl.GL11;
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;
int ticksElapsed = 0;
public AdvancedPlateCraftPage(RecipeAdvancedPlate recipe) {
super(".abCraft");
this.recipe = recipe;
}
public AdvancedPlateCraftPage(RecipeAdvancedPlate recipe, String str) {
super(".abCraft" + str);
this.recipe = recipe;
}
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;
}
}
@@ -1,78 +0,0 @@
package ab.api.recipe.lexicon;
import java.util.ArrayList;
import java.util.List;
import org.lwjgl.opengl.GL11;
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;
public AlphirineCraftPage(RecipeAncientAlphirine recipe) {
super(".alphirineCraft");
this.recipe = recipe;
}
public AlphirineCraftPage(RecipeAncientAlphirine recipe, String str) {
super(".alphirineCraft" + str);
this.recipe = recipe;
}
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;
render.bindTexture(alphirineOverlay);
GL11.glEnable(3042);
GL11.glBlendFunc(770, 771);
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
((GuiScreen)gui).drawTexturedModalRect(gui.getLeft() + 40, gui.getTop() + 44, 0, 0, gui.getWidth(), gui.getHeight());
GL11.glDisable(3042);
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);
FontRenderer font = (Minecraft.getMinecraft()).fontRenderer;
String text = ClientHelper.getChanceName(recipe.getChance());
String name = EnumChatFormatting.BOLD + StatCollector.translateToLocal("ab.name.alpherine.craft");
int x = gui.getLeft() + gui.getWidth() / 2 - 50;
int y = gui.getTop() + 85;
boolean unicode = font.getUnicodeFlag();
font.setUnicodeFlag(true);
font.drawString(text, x + 50 - font.getStringWidth(text) / 2, y + 15, -1728053248);
font.drawString(name, x + 50 - font.getStringWidth(name) / 2, y - 65, -1728053248);
font.setUnicodeFlag(unicode);
}
public List<ItemStack> getDisplayedRecipes() {
ArrayList<ItemStack> list = new ArrayList<ItemStack>();
list.add(recipe.getOutput());
return list;
}
}
@@ -1,108 +0,0 @@
package ab.client.core;
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.IRankItem;
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.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.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.MovingObjectPosition;
import net.minecraft.util.StatCollector;
import net.minecraftforge.client.event.RenderGameOverlayEvent;
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();
}
}
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 : (curr / 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();
}
}
@@ -1,105 +0,0 @@
package ab.client.core;
import org.lwjgl.opengl.GL11;
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;
import net.minecraft.util.StatCollector;
import vazkii.botania.client.core.handler.HUDHandler;
import vazkii.botania.common.block.ModBlocks;
public class ClientHelper {
public static String getChanceName(int chance) {
String name = "";
switch((int)(chance / 16.6f)) {
case 0: name = "lowest";
break;
case 1: name = "veryLow";
break;
case 2: name = "low";
break;
case 3: name = "middle";
break;
case 4: name = "high";
break;
case 5: name = "veryHigh";
break;
case 6: name = "highest";
break;
}
return StatCollector.translateToLocal("ab.alphirine.change") + ": " + StatCollector.translateToLocal("ab.chance." + name);
}
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 color) {
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 = 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 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);
}
}
@@ -1,42 +0,0 @@
package ab.client.core;
import ab.api.IRenderHud;
import ab.common.block.tile.TileLebethronCore;
import ab.common.item.ItemBlackHalo;
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
import net.minecraft.block.Block;
import net.minecraft.client.Minecraft;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.profiler.Profiler;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.MovingObjectPosition;
import net.minecraftforge.client.event.RenderGameOverlayEvent;
import vazkii.botania.common.item.ItemTwigWand;
public class HudRender {
@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 isWand = equippedStack != null && equippedStack.getItem() instanceof ItemTwigWand;
if (tile != null && tile instanceof IRenderHud && !isWand) {
((IRenderHud)tile).renderHud(mc, event.resolution);
}
}
if (equippedStack != null && equippedStack.getItem() instanceof ItemBlackHalo) {
profiler.startSection("blackHalo");
ItemBlackHalo.renderHUD(event.resolution, (EntityPlayer)mc.thePlayer, equippedStack);
profiler.endSection();
}
}
}
}
@@ -1,102 +0,0 @@
package ab.client.core.proxy;
import ab.client.core.ClientHandler;
import ab.client.core.HudRender;
import ab.client.render.block.RenderBlockABSpreader;
import ab.client.render.block.RenderBlockManaCharger;
import ab.client.render.block.RenderBlockManaContainer;
import ab.client.render.block.RenderBlockManaCrystalCube;
import ab.client.render.entity.EntityNullRender;
import ab.client.render.entity.RenderEntityAdvancedSpark;
import ab.client.render.entity.RenderManaVine;
import ab.client.render.item.RenderAntigravityCharm;
import ab.client.render.tile.RenderModifiedFunnel;
import ab.client.render.tile.RenderModifiedInterrupter;
import ab.client.render.tile.RenderModifiedRetainer;
import ab.client.render.tile.RenderTileABSpreader;
import ab.client.render.tile.RenderTileAgglomerationPlate;
import ab.client.render.tile.RenderTileCorporeaCatalyst;
import ab.client.render.tile.RenderTileManaCharger;
import ab.client.render.tile.RenderTileManaContainer;
import ab.client.render.tile.RenderTileManaCrystalCube;
import ab.client.render.tile.RenderTileModifiedInterceptor;
import ab.common.block.tile.TileABSpreader;
import ab.common.block.tile.TileAgglomerationPlate;
import ab.common.block.tile.TileCorporeaCatalyst;
import ab.common.block.tile.TileCorporeaInterrupter;
import ab.common.block.tile.TileManaCharger;
import ab.common.block.tile.TileManaContainer;
import ab.common.block.tile.TileManaCrystalCube;
import ab.common.block.tile.TileModifiedCorporeaFunnel;
import ab.common.block.tile.TileModifiedInterceptor;
import ab.common.block.tile.TileModifiedRetainer;
import ab.common.core.proxy.CommonProxy;
import ab.common.entity.EntityAdvancedSpark;
import ab.common.entity.EntityManaVine;
import ab.common.entity.EntityNebulaBlaze;
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.item.ItemStack;
import net.minecraftforge.client.MinecraftForgeClient;
import net.minecraftforge.common.MinecraftForge;
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 HudRender());
ClientRegistry.bindTileEntitySpecialRenderer(TileAgglomerationPlate.class, new RenderTileAgglomerationPlate());
ClientRegistry.bindTileEntitySpecialRenderer(TileABSpreader.class, new RenderTileABSpreader());
ClientRegistry.bindTileEntitySpecialRenderer(TileManaContainer.class, new RenderTileManaContainer());
ClientRegistry.bindTileEntitySpecialRenderer(TileManaCrystalCube.class, new RenderTileManaCrystalCube());
ClientRegistry.bindTileEntitySpecialRenderer(TileManaCharger.class, new RenderTileManaCharger());
// ClientRegistry.bindTileEntitySpecialRenderer(TileCorporeaCatalyst.class, new RenderTileCorporeaCatalyst());
// ClientRegistry.bindTileEntitySpecialRenderer(TileModifiedCorporeaFunnel.class, new RenderModifiedFunnel());
// ClientRegistry.bindTileEntitySpecialRenderer(TileCorporeaInterrupter.class, new RenderModifiedInterrupter());
// ClientRegistry.bindTileEntitySpecialRenderer(TileModifiedInterceptor.class, new RenderTileModifiedInterceptor());
// ClientRegistry.bindTileEntitySpecialRenderer(TileModifiedRetainer.class, new RenderModifiedRetainer());
BlockListAB.blockABSpreaderRI = RenderingRegistry.getNextAvailableRenderId();
BlockListAB.blockManaContainerRI = RenderingRegistry.getNextAvailableRenderId();
BlockListAB.blockManaCrystalCubeRI = RenderingRegistry.getNextAvailableRenderId();
BlockListAB.blockManaChargerRI = RenderingRegistry.getNextAvailableRenderId();
// BlockListAB.blockCorporeaCatalystRI = RenderingRegistry.getNextAvailableRenderId();
// BlockListAB.blockModifiedCorporeaFunnelRI = RenderingRegistry.getNextAvailableRenderId();
// BlockListAB.blockModifiedCorporeaInterrupterRI = RenderingRegistry.getNextAvailableRenderId();
// BlockListAB.blockModifiedCorporeaInterceptorRI = RenderingRegistry.getNextAvailableRenderId();
RenderingRegistry.registerBlockHandler(new RenderBlockABSpreader());
RenderingRegistry.registerBlockHandler(new RenderBlockManaContainer());
RenderingRegistry.registerBlockHandler(new RenderBlockManaCrystalCube());
RenderingRegistry.registerBlockHandler(new RenderBlockManaCharger());
RenderingRegistry.registerEntityRenderingHandler(EntityAdvancedSpark.class, new RenderEntityAdvancedSpark());
RenderingRegistry.registerEntityRenderingHandler(EntityNebulaBlaze.class, new EntityNullRender());
RenderingRegistry.registerEntityRenderingHandler(EntityManaVine.class, (Render)new RenderManaVine());
MinecraftForgeClient.registerItemRenderer(ItemListAB.itemAntigravityCharm, new RenderAntigravityCharm());
// ItemStack error = null;
// System.out.println(error.stackSize);
}
public void postInit(FMLPostInitializationEvent event) {
super.postInit(event);
}
}
@@ -1,282 +0,0 @@
package ab.client.model;
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.monster.EntitySkeleton;
import net.minecraft.entity.monster.EntityZombie;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.EnumAction;
import net.minecraft.item.ItemStack;
import net.minecraft.util.MathHelper;
public class ModelArmorNebula extends ModelBiped {
int slot;
private ModelRenderer head;
private ModelRenderer cube_r1;
private ModelRenderer cube_r2;
private ModelRenderer cube_r3;
private ModelRenderer cube_r4;
private ModelRenderer cube_r5;
private ModelRenderer cube_r6;
private ModelRenderer cube_r7;
private ModelRenderer body;
private ModelRenderer cube_r16;
private ModelRenderer cloak;
private ModelRenderer cube_r8;
private ModelRenderer cube_r9;
private ModelRenderer cube_r10;
private ModelRenderer cube_r11;
private ModelRenderer lArm;
private ModelRenderer cube_r12;
private ModelRenderer cube_r13;
private ModelRenderer rArm;
private ModelRenderer cube_r14;
private ModelRenderer cube_r15;
private ModelRenderer lLeg;
private ModelRenderer rLeg;
private ModelRenderer lBoot;
private ModelRenderer rBoot;
public ModelArmorNebula(int slot) {
this.slot = slot;
this.textureWidth = 64;
this.textureHeight = 128;
head = new ModelRenderer(this);
head.setRotationPoint(0.0F, 0.0F, 0.0F);
head.cubeList.add(new ModelBox(head, 0, 10, -4.5F, -8.5F, -4.4F, 9, 3, 9, 0.0F));
head.cubeList.add(new ModelBox(head, 27, 10, -3.0F, -9.0F, -4.0F, 6, 1, 8, 0.0F));
head.cubeList.add(new ModelBox(head, 47, 6, -1.0F, -9.4F, -2.8F, 2, 1, 5, 0.0F));
head.cubeList.add(new ModelBox(head, 18, 0, 3.5F, -5.5F, -4.4F, 1, 1, 4, 0.0F));
head.cubeList.add(new ModelBox(head, 8, 0, -4.5F, -5.5F, -4.4F, 1, 1, 4, 0.0F));
cube_r1 = new ModelRenderer(this);
cube_r1.setRotationPoint(0.0F, 24.0F, 0.0F);
head.addChild(cube_r1);
setRotationAngle(cube_r1, -0.0436F, 0.0F, 0.0F);
cube_r1.cubeList.add(new ModelBox(cube_r1, 56, 1, -1.0F, -33.2F, -6.1F, 2, 3, 1, 0.0F));
cube_r2 = new ModelRenderer(this);
cube_r2.setRotationPoint(0.0F, 24.0F, 0.0F);
head.addChild(cube_r2);
setRotationAngle(cube_r2, 0.0F, 0.0F, -0.0436F);
cube_r2.cubeList.add(new ModelBox(cube_r2, 28, 4, 3.7F, -33.3F, -0.4F, 1, 2, 2, 0.0F));
cube_r2.cubeList.add(new ModelBox(cube_r2, 8, 7, 4.4F, -31.0F, -4.7F, 1, 1, 2, 0.0F));
cube_r2.cubeList.add(new ModelBox(cube_r2, 0, 0, 3.4F, -34.0F, -4.7F, 2, 3, 2, 0.0F));
cube_r2.cubeList.add(new ModelBox(cube_r2, 0, 12, 3.4F, -35.0F, -4.7F, 1, 1, 1, 0.0F));
cube_r2.cubeList.add(new ModelBox(cube_r2, 0, 0, 3.4F, -34.0F, -4.7F, 2, 3, 2, 0.0F));
cube_r2.cubeList.add(new ModelBox(cube_r2, 34, 0, 3.1F, -33.6F, -2.7F, 2, 3, 3, 0.0F));
cube_r3 = new ModelRenderer(this);
cube_r3.setRotationPoint(0.0F, 24.0F, 0.0F);
head.addChild(cube_r3);
setRotationAngle(cube_r3, 0.0F, 0.0F, 0.0436F);
cube_r3.cubeList.add(new ModelBox(cube_r3, 28, 0, -4.7F, -33.3F, -0.4F, 1, 2, 2, 0.0F));
cube_r3.cubeList.add(new ModelBox(cube_r3, 44, 0, -5.1F, -33.6F, -2.7F, 2, 3, 3, 0.0F));
cube_r3.cubeList.add(new ModelBox(cube_r3, 14, 7, -5.4F, -31.0F, -4.7F, 1, 1, 2, 0.0F));
cube_r3.cubeList.add(new ModelBox(cube_r3, 0, 5, -5.4F, -34.0F, -4.7F, 2, 3, 2, 0.0F));
cube_r3.cubeList.add(new ModelBox(cube_r3, 0, 10, -4.4F, -35.0F, -4.7F, 1, 1, 1, 0.0F));
cube_r3.cubeList.add(new ModelBox(cube_r3, 0, 5, -5.4F, -34.0F, -4.7F, 2, 3, 2, 0.0F));
body = new ModelRenderer(this);
body.setRotationPoint(0.0F, 0.0F, 0.0F);
body.cubeList.add(new ModelBox(body, 0, 22, -4.5F, 0.6F, -3.7F, 9, 5, 7, 0.0F));
body.cubeList.add(new ModelBox(body, 32, 19, -4.0F, 0.1F, -3.1F, 8, 11, 6, 0.0F));
body.cubeList.add(new ModelBox(body, 0, 34, -3.0F, 11.1F, -3.1F, 6, 1, 1, 0.0F));
body.cubeList.add(new ModelBox(body, 31, 89, -5.0F, 0.0F, 2.7F, 10, 3, 1, 0.0F));
cube_r16 = new ModelRenderer(this);
cube_r16.setRotationPoint(0.0F, 24.0F, 0.0F);
body.addChild(cube_r16);
setRotationAngle(cube_r16, 0.1309F, 0.0F, 0.0F);
cube_r16.cubeList.add(new ModelBox(cube_r16, 18, 99, -2.0F, -22.3F, -1.5F, 4, 6, 2, 0.0F));
cloak = new ModelRenderer(this);
cloak.setRotationPoint(0.0F, 0.0F, 0.0F);
cube_r4 = new ModelRenderer(this);
cube_r4.setRotationPoint(0.0F, 24.0F, 0.0F);
cloak.addChild(cube_r4);
setRotationAngle(cube_r4, 0.1309F, 0.0F, 0.0F);
cube_r4.cubeList.add(new ModelBox(cube_r4, 0, 89, -3.5F, -15.7F, 5.7F, 7, 5, 1, 0.0F));
cube_r5 = new ModelRenderer(this);
cube_r5.setRotationPoint(0.0F, 24.0F, 0.0F);
cloak.addChild(cube_r5);
setRotationAngle(cube_r5, 0.0873F, 0.0F, 0.0F);
cube_r5.cubeList.add(new ModelBox(cube_r5, 0, 81, -3.5F, -22.8F, 5.0F, 7, 7, 1, 0.0F));
cube_r6 = new ModelRenderer(this);
cube_r6.setRotationPoint(0.0F, 24.0F, 0.0F);
cloak.addChild(cube_r6);
setRotationAngle(cube_r6, 0.1745F, 0.0F, 0.0F);
cube_r6.cubeList.add(new ModelBox(cube_r6, 0, 95, -3.5F, -10.5F, 6.2F, 7, 5, 1, 0.0F));
rArm = new ModelRenderer(this);
rArm.setRotationPoint(5.0F, 2.0F, 0.0F);
rArm.cubeList.add(new ModelBox(rArm, 0, 41, -11.0F + 10.1f, 2.0F, -2.9F, 2, 1, 6, 0.0F));
rArm.cubeList.add(new ModelBox(rArm, 18, 36, -14.0F + 10.1f, -3.0F, -2.9F, 5, 5, 6, 0.0F));
rArm.cubeList.add(new ModelBox(rArm, 42, 38, -13.5F + 10.1f, 6.1F, -2.4F, 5, 4, 5, 0.0F));
rArm.cubeList.add(new ModelBox(rArm, 40, 77, -13.0F + 10, 0.3F, -2.0F, 4, 3, 4, 0.0F));
cube_r7 = new ModelRenderer(this);
cube_r7.setRotationPoint(5.0F, 2.0F, 0.0F);
rArm.addChild(cube_r7);
setRotationAngle(cube_r7, 0.0F, 0.0F, 0.0873F);
cube_r7.cubeList.add(new ModelBox(cube_r7, 18, 86, -15.1F + 7, -23.9F + 18, -1.4F, 3, 2, 3, 0.0F));
cube_r8 = new ModelRenderer(this);
cube_r8.setRotationPoint(5.0F, 2.0F, 0.0F);
rArm.addChild(cube_r8);
setRotationAngle(cube_r8, 0.0F, 0.0F, 0.0436F);
cube_r8.cubeList.add(new ModelBox(cube_r8, 0, 115, -15.6F + 6, -23.5F + 18, -2.4F, 4, 5, 5, 0.0F));
lArm = new ModelRenderer(this);
lArm.setRotationPoint(-5.0F, 2.0F, 0.0F);
lArm.cubeList.add(new ModelBox(lArm, 0, 48, 9.0F - 10.1f, 2.0F, -2.9F, 2, 1, 6, 0.0F));
lArm.cubeList.add(new ModelBox(lArm, 18, 47, 9.0F - 10.1f, -3.0F, -2.9F, 5, 5, 6, 0.0F));
lArm.cubeList.add(new ModelBox(lArm, 42, 47, 8.5F - 10.1f, 6.1F, -2.4F, 5, 4, 5, 0.0F));
lArm.cubeList.add(new ModelBox(lArm, 24, 77, 9.0F - 10, 0.3F, -2.0F, 4, 3, 4, 0.0F));
cube_r9 = new ModelRenderer(this);
cube_r9.setRotationPoint(-5.0F, 2.0F, 0.0F);
lArm.addChild(cube_r9);
setRotationAngle(cube_r9, 0.0F, 0.0F, -0.0873F);
cube_r9.cubeList.add(new ModelBox(cube_r9, 18, 91, 12.1F - 7, -23.9F + 18, -1.4F, 3, 2, 3, 0.0F));
cube_r10 = new ModelRenderer(this);
cube_r10.setRotationPoint(-5.0F, 2.0F, 0.0F);
lArm.addChild(cube_r10);
setRotationAngle(cube_r10, 0.0F, 0.0F, -0.0436F);
cube_r10.cubeList.add(new ModelBox(cube_r10, 0, 105, 11.6F - 6, -23.5F + 18, -2.4F, 4, 5, 5, 0.0F));
rLeg = new ModelRenderer(this);
rLeg.setRotationPoint(-1.9F, 12.0F, 0.0F);
rLeg.cubeList.add(new ModelBox(rLeg, 29, 60, -2.1F, -1.0F, -2.0F, 4, 10, 4, 0.0F));
lLeg = new ModelRenderer(this);
lLeg.setRotationPoint(1.9F, 12.0F, 0.0F);
lLeg.cubeList.add(new ModelBox(lLeg, 45, 60, -1.9F, -1.0F, -2.0F, 4, 10, 4, 0.0F));
rBoot = new ModelRenderer(this);
rBoot.setRotationPoint(0.0F, 24.0F, 0.0F);
rBoot.cubeList.add(new ModelBox(rBoot, 0, 58, -4.5F, -5.9F, -2.5F, 5, 6, 5, 0.0F));
lBoot = new ModelRenderer(this);
lBoot.setRotationPoint(0.0F, 24.0F, 0.0F);
lBoot.cubeList.add(new ModelBox(lBoot, 0, 69, -0.5F, -5.9F, -2.5F, 5, 6, 5, 0.0F));
}
public void render(Entity entity, float f, float f1, float f2, float f3, float f4, float f5) {
this.head.showModel = (this.slot == 0);
this.body.showModel = (this.slot == 1);
this.cloak.showModel = (this.slot == 1);
this.lArm.showModel = (this.slot == 1);
this.rArm.showModel = (this.slot == 1);
this.lLeg.showModel = (this.slot == 2);
this.rLeg.showModel = (this.slot == 2);
this.bipedHeadwear.showModel = false;
this.bipedHead = this.head;
this.bipedBody = this.body;
this.bipedRightArm = this.rArm;
this.bipedLeftArm = this.lArm;
this.bipedLeftLeg = this.lLeg;
this.bipedRightLeg = this.rLeg;
float a = MathHelper.cos(f * 0.6662F) * 1.4F * f1;
float b = MathHelper.cos(f * 0.6662F + 3.1415927F) * 1.4F * f1;
float c = Math.min(a, b);
this.cloak.rotateAngleX = -c / 2.0F + 0.1396263F;
this.cloak.rotateAngleY = 0.0F;
prepareForRender(entity);
if (entity instanceof EntitySkeleton || entity instanceof EntityZombie) {
setRotationAnglesZombie(f, f1, f2, f3, f4, f5, entity);
} else {
setRotationAngles(f, f1, f2, f3, f4, f5, entity);
}
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);
cloak.render(f5);
GL11.glPopMatrix();
} else {
this.bipedHead.render(f5);
this.bipedBody.render(f5);
this.bipedRightArm.render(f5);
this.bipedLeftArm.render(f5);
GL11.glPushMatrix();
GL11.glScalef(1.1F, 1.1F, 1.1F);
GL11.glTranslatef(-0.0125F, 0.0F, -0.0125F);
this.bipedRightLeg.render(f5);
this.bipedLeftLeg.render(f5);
GL11.glPopMatrix();
this.bipedHeadwear.render(f5);
cloak.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 setRotationAngle(ModelRenderer modelRenderer, float x, float y, float z) {
modelRenderer.rotateAngleX = x;
modelRenderer.rotateAngleY = y;
modelRenderer.rotateAngleZ = z;
}
public void setRotationAnglesZombie(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;
}
}
@@ -1,120 +0,0 @@
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;
}
}
@@ -1,92 +0,0 @@
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 bone;
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 bb_main;
public ModelManaContainer() {
textureWidth = 64;
textureHeight = 64;
bone = new ModelRenderer(this);
bone.setRotationPoint(0.0F, 24.0F, 0.0F);
cube_r1 = new ModelRenderer(this);
cube_r1.setRotationPoint(0.0F, -2.0F, 0.0F);
bone.addChild(cube_r1);
setRotationAngle(cube_r1, -0.1309F, 0.0F, 0.1309F);
cube_r1.cubeList.add(new ModelBox(cube_r1, 24, 47, -8.5F, -15.0F, -8.5F, 3, 5, 3, 0.0F));
cube_r2 = new ModelRenderer(this);
cube_r2.setRotationPoint(0.0F, -2.0F, 0.0F);
bone.addChild(cube_r2);
setRotationAngle(cube_r2, 0.1309F, 0.0F, 0.1309F);
cube_r2.cubeList.add(new ModelBox(cube_r2, 12, 47, -8.5F, -15.0F, 5.5F, 3, 5, 3, 0.0F));
cube_r3 = new ModelRenderer(this);
cube_r3.setRotationPoint(0.0F, -2.0F, 0.0F);
bone.addChild(cube_r3);
setRotationAngle(cube_r3, -0.1309F, 0.0F, -0.1309F);
cube_r3.cubeList.add(new ModelBox(cube_r3, 36, 47, 5.5F, -15.0F, -8.5F, 3, 5, 3, 0.0F));
cube_r4 = new ModelRenderer(this);
cube_r4.setRotationPoint(0.0F, -17.0F, 0.0F);
bone.addChild(cube_r4);
setRotationAngle(cube_r4, -0.1309F, 0.0F, 0.1309F);
cube_r4.cubeList.add(new ModelBox(cube_r4, 36, 55, 5.5F, 10.0F, 5.5F, 3, 5, 3, 0.0F));
cube_r5 = new ModelRenderer(this);
cube_r5.setRotationPoint(0.0F, -17.0F, 0.0F);
bone.addChild(cube_r5);
setRotationAngle(cube_r5, 0.1309F, 0.0F, 0.1309F);
cube_r5.cubeList.add(new ModelBox(cube_r5, 12, 55, 5.5F, 10.0F, -8.5F, 3, 5, 3, 0.0F));
cube_r6 = new ModelRenderer(this);
cube_r6.setRotationPoint(0.0F, -17.0F, 0.0F);
bone.addChild(cube_r6);
setRotationAngle(cube_r6, -0.1309F, 0.0F, -0.1309F);
cube_r6.cubeList.add(new ModelBox(cube_r6, 0, 55, -8.5F, 10.0F, 5.5F, 3, 5, 3, 0.0F));
cube_r7 = new ModelRenderer(this);
cube_r7.setRotationPoint(0.0F, -17.0F, 0.0F);
bone.addChild(cube_r7);
setRotationAngle(cube_r7, 0.1309F, 0.0F, -0.1309F);
cube_r7.cubeList.add(new ModelBox(cube_r7, 24, 55, -8.5F, 10.0F, -8.5F, 3, 5, 3, 0.0F));
cube_r8 = new ModelRenderer(this);
cube_r8.setRotationPoint(0.0F, -2.0F, 0.0F);
bone.addChild(cube_r8);
setRotationAngle(cube_r8, 0.1309F, 0.0F, -0.1309F);
cube_r8.cubeList.add(new ModelBox(cube_r8, 0, 47, 5.5F, -15.0F, 5.5F, 3, 5, 3, 0.0F));
bb_main = new ModelRenderer(this);
bb_main.setRotationPoint(0.0F, 24.0F, 0.0F);
bb_main.cubeList.add(new ModelBox(bb_main, 0, 0, -6.0F, -16.0F, -6.0F, 12, 13, 12, 0.0F));
bb_main.cubeList.add(new ModelBox(bb_main, 0, 25, -5.0F, -17.0F, -5.0F, 10, 1, 10, 0.0F));
bb_main.cubeList.add(new ModelBox(bb_main, 0, 36, -5.0F, -3.0F, -5.0F, 10, 1, 10, 0.0F));
}
public void render() {
bone.render(0.0625f);
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;
}
}
@@ -1,24 +0,0 @@
package ab.client.nei;
import ab.AdvancedBotany;
import codechicken.nei.api.API;
import codechicken.nei.api.IConfigureNEI;
import codechicken.nei.recipe.ICraftingHandler;
import codechicken.nei.recipe.IUsageHandler;
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());
}
}
@@ -1,118 +0,0 @@
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);
}
}
}
@@ -1,123 +0,0 @@
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;
FontRenderer font = (Minecraft.getMinecraft()).fontRenderer;
String s = ClientHelper.getChanceName(chance);
font.drawString(s, 82 - font.getStringWidth(s) / 2, 58, 4210752);
}
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);
}
}
}
@@ -1,36 +0,0 @@
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;
}
}
@@ -1,36 +0,0 @@
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;
}
}
@@ -1,35 +0,0 @@
package ab.client.render.block;
import org.lwjgl.opengl.GL11;
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.575F, -0.5F);
TileManaContainer container = new TileManaContainer();
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;
}
}
@@ -1,37 +0,0 @@
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;
}
}
@@ -1,15 +0,0 @@
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;
}
}
@@ -1,20 +0,0 @@
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;
}
}
@@ -1,42 +0,0 @@
package ab.client.render.entity;
import java.util.Random;
import org.lwjgl.opengl.GL11;
import ab.client.render.tile.TileRenderer;
import ab.common.lib.register.BlockListAB;
import net.minecraft.client.Minecraft;
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.init.Blocks;
import net.minecraft.util.ResourceLocation;
import net.minecraft.world.World;
import vazkii.botania.common.Botania;
public class RenderManaVine extends Render {
@Override
public void doRender(Entity entity, double x, double y, double z, float something, float pticks) {
Random rand = entity.worldObj.rand;
Minecraft.getMinecraft().renderEngine.bindTexture(TextureMap.locationBlocksTexture);
GL11.glPushMatrix();
GL11.glTranslated(x, y, z);
GL11.glEnable(GL11.GL_BLEND);
Tessellator t = new Tessellator();
t.startDrawingQuads();
t.setColorRGBA_I(0x1de30d, 200);
TileRenderer.renderCube(x, y, z, 0.3, Blocks.quartz_block.getIcon(0, 0), t);
t.draw();
GL11.glDisable(GL11.GL_BLEND);
GL11.glPopMatrix();
}
@Override
protected ResourceLocation getEntityTexture(Entity entity) {
return null;
}
}
@@ -1,59 +0,0 @@
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 RenderAntigravityCharm 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();
}
}
@@ -1,73 +0,0 @@
package ab.client.render.tile;
import org.lwjgl.opengl.GL11;
import ab.common.block.tile.TileModifiedCorporeaFunnel;
import ab.common.lib.register.BlockListAB;
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.tileentity.TileEntity;
public class RenderModifiedFunnel extends TileEntitySpecialRenderer {
@Override
public void renderTileEntityAt(TileEntity tile, double x, double y, double z, float fq) {
if(((TileModifiedCorporeaFunnel)tile).getCatalystTile() == null)
return;
Minecraft.getMinecraft().renderEngine.bindTexture(TextureMap.locationBlocksTexture);
int meta = ((TileModifiedCorporeaFunnel)tile).getCatalystTile().getBlockMetadata();
float time = Minecraft.getSystemTime() / 1400;
int brightness = 0;
if (time % 150 >= 75) {
brightness = (int) ((int) (Minecraft.getSystemTime() / 1400) % 75);
} else {
brightness = (int) (75 - (int) (Minecraft.getSystemTime() / 1400) % 75);
}
if (meta == 0) {
brightness = 25;
}
if (meta == 4) {
brightness -= 25;
}
int color = 0;
switch (meta) {
case 0:
color = 0xa5a5a5;
break;
case 1:
color = 0x2f10f4;
break;
case 2:
color = 0xff0112;
break;
case 3:
color = 0x28f314;
break;
case 4:
color = 0x6dceea;
}
GL11.glPushMatrix();
GL11.glDisable(GL11.GL_LIGHTING);
/*
* if (tile.getBlockMetadata() != 0)
* OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, 250,
* 250);
*/
Tessellator t = new Tessellator();
t.startDrawingQuads();
t.setBrightness(225 - brightness);
t.setColorOpaque_I(color);
TileRenderer.renderLateralSides(x + 0.5, y + 0.5, z + 0.5, 0.504, BlockListAB.blockModifiedCorporeaFunnel.icons[0], t);
TileRenderer.renderUpperlSide(x + 0.5, y + 0.5, z + 0.5, 0.504, BlockListAB.blockCorporeaCatalyst.icon[2], t);
TileRenderer.renderDownside(x + 0.5, y + 0.5, z + 0.5, 0.504, BlockListAB.blockCorporeaCatalyst.icon[3], t);
t.draw();
GL11.glEnable(GL11.GL_LIGHTING);
GL11.glPopMatrix();
}
}
@@ -1,66 +0,0 @@
package ab.client.render.tile;
import org.lwjgl.opengl.GL11;
import ab.common.block.tile.TileCorporeaInterrupter;
import ab.common.lib.register.BlockListAB;
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.tileentity.TileEntity;
public class RenderModifiedInterrupter extends TileEntitySpecialRenderer {
@Override
public void renderTileEntityAt(TileEntity tile, double x, double y, double z, float fq) {
if(!((TileCorporeaInterrupter)tile).isModified() || ((TileCorporeaInterrupter)tile).getCatalystTile() == null)
return;
Minecraft.getMinecraft().renderEngine.bindTexture(TextureMap.locationBlocksTexture);
int meta = ((TileCorporeaInterrupter)tile).getCatalystTile().getBlockMetadata();
float time = Minecraft.getSystemTime() / 1400;
int brightness = 0;
if (time % 150 >= 75) {
brightness = 225 - (int)((int) (Minecraft.getSystemTime() / 1400) % 75);
} else {
brightness = 225 - (int)(75 - (int) (Minecraft.getSystemTime() / 1400) % 75);
}
if (meta == 0) {
brightness = 200;
}
if (meta == 4) {
brightness += 20;
}
int color = 0;
switch (meta) {
case 0:
color = 0xa5a5a5;
break;
case 1:
color = 0x2f10f4;
break;
case 2:
color = 0xff0112;
break;
case 3:
color = 0x28f314;
break;
case 4:
color = 0x6dceea;
}
GL11.glPushMatrix();
GL11.glDisable(GL11.GL_LIGHTING);
Tessellator t = new Tessellator();
t.startDrawingQuads();
t.setBrightness(brightness);
t.setColorOpaque_I(color);
TileRenderer.renderLateralSides(x + 0.5, y + 0.5, z + 0.5, 0.504, BlockListAB.blockCorporeaInterrupter.icons[2], t);
TileRenderer.renderUpperlSide(x + 0.5, y + 0.5, z + 0.5, 0.504, BlockListAB.blockCorporeaCatalyst.icon[2], t);
TileRenderer.renderDownside(x + 0.5, y + 0.5, z + 0.5, 0.504, BlockListAB.blockCorporeaCatalyst.icon[3], t);
t.draw();
GL11.glEnable(GL11.GL_LIGHTING);
GL11.glPopMatrix();
}
}
@@ -1,64 +0,0 @@
package ab.client.render.tile;
import org.lwjgl.opengl.GL11;
import ab.common.block.tile.TileModifiedRetainer;
import ab.common.lib.register.BlockListAB;
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.tileentity.TileEntity;
public class RenderModifiedRetainer extends TileEntitySpecialRenderer {
@Override
public void renderTileEntityAt(TileEntity tile, double x, double y, double z, float fq) {
if(!((TileModifiedRetainer)tile).isModified() || ((TileModifiedRetainer)tile).getCatalystTile() == null)
return;
Minecraft.getMinecraft().renderEngine.bindTexture(TextureMap.locationBlocksTexture);
int meta = ((TileModifiedRetainer)tile).getCatalystTile().getBlockMetadata();
float time = Minecraft.getSystemTime() / 1400;
int brightness = 0;
if (time % 150 >= 75) {
brightness = 225 - (int)((int) (Minecraft.getSystemTime() / 1400) % 75);
} else {
brightness = 225 - (int)(75 - (int) (Minecraft.getSystemTime() / 1400) % 75);
}
if (meta == 0) {
brightness = 200;
}
if (meta == 4) {
brightness += 20;
}
int color = 0;
switch (meta) {
case 0:
color = 0xa5a5a5;
break;
case 1:
color = 0x2f10f4;
break;
case 2:
color = 0xff0112;
break;
case 3:
color = 0x28f314;
break;
case 4:
color = 0x6dceea;
}
GL11.glPushMatrix();
GL11.glDisable(GL11.GL_LIGHTING);
Tessellator t = new Tessellator();
t.startDrawingQuads();
t.setBrightness(brightness);
t.setColorOpaque_I(color);
TileRenderer.renderCube(x + 0.5, y + 0.5, z + 0.5, 0.504, BlockListAB.blockModifiedRetainer.icons[0], t);
t.draw();
GL11.glEnable(GL11.GL_LIGHTING);
GL11.glPopMatrix();
}
}
@@ -1,90 +0,0 @@
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();
}
}
@@ -1,116 +0,0 @@
package ab.client.render.tile;
import java.util.ArrayList;
import java.util.List;
import org.lwjgl.opengl.GL11;
import ab.common.block.tile.TileAgglomerationPlate;
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 vazkii.botania.client.core.handler.ClientTickHandler;
import vazkii.botania.client.core.helper.ShaderHelper;
import vazkii.botania.common.block.mana.BlockTerraPlate;
public class RenderTileAgglomerationPlate extends TileEntitySpecialRenderer {
private List<EntityItem> entityList = null;
public void renderTileEntityAt(TileEntity tileentity, double x, double y, double z, float f) {
TileAgglomerationPlate tile = (TileAgglomerationPlate)tileentity;
float max = 50000.0F;
float alphaMod = Math.min(max, tile.getCurrentMana()) / max;
//Botania code
GL11.glPushMatrix();
GL11.glTranslated(x, y, z);
GL11.glRotated(90.0D, 1.0D, 0.0D, 0.0D);
GL11.glTranslatef(0.0F, 0.0F, -0.1885F);
GL11.glEnable(3042);
GL11.glBlendFunc(770, 771);
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
GL11.glDisable(3008);
float alpha = (float)((Math.sin((ClientTickHandler.ticksInGame + f) / 8.0D) + 1.0D) / 5.0D + 0.6D) * alphaMod;
if (ShaderHelper.useShaders()) {
GL11.glColor4f(1.0F, 1.0F, 1.0F, alpha);
} else {
int light = 15728880;
int lightmapX = light % 65536;
int lightmapY = light / 65536;
OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, lightmapX, lightmapY);
GL11.glColor4f(0.6F + (float)((Math.cos((ClientTickHandler.ticksInGame + f) / 6.0D) + 1.0D) / 5.0D), 0.1F, 0.9F, alpha);
}
(Minecraft.getMinecraft()).renderEngine.bindTexture(TextureMap.locationBlocksTexture);
ShaderHelper.useShader(ShaderHelper.terraPlateRune);
renderIcon(0, 0, BlockTerraPlate.overlay, 1, 1, 240);
ShaderHelper.releaseShader();
GL11.glEnable(3008);
GL11.glDisable(3042);
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
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.25f, z + 0.5f);
GL11.glScalef(0.4F, 0.4F, 0.4F);
for(int i = 1; i < entityList.size(); i++) {
ItemStack stack = tile.getStackInSlot(i);
if(stack != null) {
switch(i) {
case 1:
GL11.glTranslated(0.15f, 0, 0);
break;
case 2:
GL11.glTranslated(-0.15f, 0, -0.15f);
break;
case 3:
GL11.glTranslated(-0.15f, 0, 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();
if(tile.getStackInSlot(0) != null) {
GL11.glPushMatrix();
GL11.glTranslated(x + 0.5, y + 0.65f, z + 0.5);
GL11.glScalef(0.6f, 0.6f, 0.6f);
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();
}
}
public void renderIcon(int par1, int par2, IIcon par3Icon, int par4, int par5, int brightness) {
Tessellator tessellator = Tessellator.instance;
tessellator.startDrawingQuads();
tessellator.setBrightness(brightness);
tessellator.addVertexWithUV((par1 + 0), (par2 + par5), 0.0D, par3Icon.getMinU(), par3Icon.getMaxV());
tessellator.addVertexWithUV((par1 + par4), (par2 + par5), 0.0D, par3Icon.getMaxU(), par3Icon.getMaxV());
tessellator.addVertexWithUV((par1 + par4), (par2 + 0), 0.0D, par3Icon.getMaxU(), par3Icon.getMinV());
tessellator.addVertexWithUV((par1 + 0), (par2 + 0), 0.0D, par3Icon.getMinU(), par3Icon.getMinV());
tessellator.draw();
}
}
@@ -1,113 +0,0 @@
package ab.client.render.tile;
import org.lwjgl.opengl.GL11;
import ab.common.block.tile.TileCorporeaCatalyst;
import ab.common.lib.register.BlockListAB;
import ab.common.lib.register.ItemListAB;
import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.OpenGlHelper;
import net.minecraft.client.renderer.Tessellator;
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.ItemStack;
import net.minecraft.tileentity.TileEntity;
import vazkii.botania.common.item.ModItems;
public class RenderTileCorporeaCatalyst extends TileEntitySpecialRenderer {
@Override
public void renderTileEntityAt(TileEntity tile, double x, double y, double z, float fq) {
Minecraft.getMinecraft().renderEngine.bindTexture(TextureMap.locationBlocksTexture);
float time = Minecraft.getSystemTime() / 1400;
int brightness = 0;
if (time % 150 >= 75) {
brightness = (int) ((int) (Minecraft.getSystemTime() / 1400) % 75);
} else {
brightness = (int) (75 - (int) (Minecraft.getSystemTime() / 1400) % 75);
}
if (tile.getBlockMetadata() == 0) {
brightness = 25;
}
if (tile.getBlockMetadata() == 4) {
brightness -= 25;
}
int color = 0;
switch (tile.getBlockMetadata()) {
case 0:
color = 0xa5a5a5;
break;
case 1:
color = 0x2f10f4;
break;
case 2:
color = 0xff0112;
break;
case 3:
color = 0x28f314;
break;
case 4:
color = 0x6dceea;
}
GL11.glPushMatrix();
GL11.glDisable(GL11.GL_LIGHTING);
/*
* if (tile.getBlockMetadata() != 0)
* OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, 250,
* 250);
*/
Tessellator t = new Tessellator();
t.startDrawingQuads();
t.setBrightness(225 - brightness);
t.setColorOpaque_I(color);
TileRenderer.renderCube(x + 0.5, y + 0.5, z + 0.5, 0.504, BlockListAB.blockCorporeaCatalyst.icon[0], t);
t.draw();
GL11.glEnable(GL11.GL_LIGHTING);
GL11.glPopMatrix();
if (tile.getBlockMetadata() > 0) {
this.renderRune((TileCorporeaCatalyst) tile, x, y, z, fq);
//this.renderRuneOrb((TileCorporeaCatalyst) tile, x, y, z, color);
}
}
public void renderRune(TileCorporeaCatalyst tile, double x, double y, double z, float fq) {
GL11.glPushMatrix();
GL11.glTranslated(x + 0.5, y + 0.5, z + 0.5);
switch (tile.sideRune) {
case 1:
break;
case 0:
GL11.glRotatef(180, 1, 0, 0);
break;
case 3:
GL11.glRotatef(90, 1, 0, 0);
break;
case 2:
GL11.glRotatef(-90, 1, 0, 0);
break;
case 5:
GL11.glRotatef(-90, 0, 0, 1);
break;
case 4:
GL11.glRotatef(90, 0, 0, 1);
break;
}
GL11.glPushMatrix();
GL11.glTranslated(0, 0 + 0.53, 0 - 0.27);
GL11.glScaled(1.2, 1.4, 1.2);
GL11.glRotatef(90, 1, 0, 0);
EntityItem entity = new EntityItem(tile.getWorldObj(), 0, 0, 0,
new ItemStack(ModItems.rune, 1, tile.getBlockMetadata() - 1));
entity.hoverStart = 0.0f;
RenderManager.instance.renderEntityWithPosYaw((Entity) entity, 0, 0, 0, 0.0f, 0.0f);
GL11.glPopMatrix();
GL11.glPopMatrix();
}
}
@@ -1,89 +0,0 @@
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);
}
}
}
@@ -1,37 +0,0 @@
package ab.client.render.tile;
import java.util.Random;
import org.lwjgl.opengl.GL11;
import ab.client.model.ModelManaContainer;
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 RenderTileManaContainer extends TileEntitySpecialRenderer {
private static final ResourceLocation texture = new ResourceLocation("ab:textures/model/mana_container.png");
private static final ModelManaContainer model = new ModelManaContainer();
public void renderTileEntityAt(final TileEntity tileentity, final double x, final double y, final double z, final float ticks) {
double worldTime = (tileentity.getWorldObj() == null) ? 0.0D : (ClientTickHandler.ticksInGame + ticks);
if (tileentity != null)
worldTime += (new Random((tileentity.xCoord ^ tileentity.yCoord ^ tileentity.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.3f, 0.5f);
GL11.glRotatef(180, 1.0f, 0.0f, 1.0f);
GL11.glScalef(0.8f, 0.8f, 0.8f);
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);
Minecraft.getMinecraft().renderEngine.bindTexture(texture);
model.render();
GL11.glEnable(32826);
GL11.glPopMatrix();
}
}
@@ -1,59 +0,0 @@
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();
}
}
@@ -1,73 +0,0 @@
package ab.client.render.tile;
import org.lwjgl.opengl.GL11;
import ab.common.block.tile.TileModifiedCorporeaFunnel;
import ab.common.block.tile.TileModifiedInterceptor;
import ab.common.lib.register.BlockListAB;
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.tileentity.TileEntity;
public class RenderTileModifiedInterceptor extends TileEntitySpecialRenderer {
@Override
public void renderTileEntityAt(TileEntity tile, double x, double y, double z, float fq) {
if(((TileModifiedInterceptor)tile).getCatalystTile() == null)
return;
Minecraft.getMinecraft().renderEngine.bindTexture(TextureMap.locationBlocksTexture);
int meta = ((TileModifiedInterceptor)tile).getCatalystTile().getBlockMetadata();
float time = Minecraft.getSystemTime() / 1400;
int brightness = 0;
if (time % 150 >= 75) {
brightness = (int) ((int) (Minecraft.getSystemTime() / 1400) % 75);
} else {
brightness = (int) (75 - (int) (Minecraft.getSystemTime() / 1400) % 75);
}
if (meta == 0) {
brightness = 25;
}
if (meta == 4) {
brightness -= 25;
}
int color = 0;
switch (meta) {
case 0:
color = 0xa5a5a5;
break;
case 1:
color = 0x2f10f4;
break;
case 2:
color = 0xff0112;
break;
case 3:
color = 0x28f314;
break;
case 4:
color = 0x6dceea;
}
GL11.glPushMatrix();
GL11.glDisable(GL11.GL_LIGHTING);
/*
* if (tile.getBlockMetadata() != 0)
* OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, 250,
* 250);
*/
Tessellator t = new Tessellator();
t.startDrawingQuads();
t.setBrightness(225 - brightness);
t.setColorOpaque_I(color);
TileRenderer.renderLateralSides(x + 0.5, y + 0.5, z + 0.5, 0.504, BlockListAB.blockModifiedInterceptor.icons[0], t);
TileRenderer.renderUpperlSide(x + 0.5, y + 0.5, z + 0.5, 0.504, BlockListAB.blockCorporeaCatalyst.icon[2], t);
TileRenderer.renderDownside(x + 0.5, y + 0.5, z + 0.5, 0.504, BlockListAB.blockCorporeaCatalyst.icon[3], t);
t.draw();
GL11.glEnable(GL11.GL_LIGHTING);
GL11.glPopMatrix();
}
}
@@ -1,141 +0,0 @@
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) {
float maxU = 0;
float maxV = 0;
float minU = 0;
float minV = 0;
if (icon != null) {
maxU = icon.getMaxU();
maxV = icon.getMaxV();
minU = icon.getMinU();
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, maxU, maxV);
t.addVertexWithUV(maxX, maxY, maxZ, maxU, minV);
t.addVertexWithUV(minX, maxY, maxZ, minU, minV);
t.addVertexWithUV(minX, minY, maxZ, minU, maxV);
t.addVertexWithUV(minX, minY, minZ, maxU, maxV);
t.addVertexWithUV(minX, maxY, minZ, maxU, minV);
t.addVertexWithUV(maxX, maxY, minZ, minU, minV);
t.addVertexWithUV(maxX, minY, minZ, minU, maxV);
t.addVertexWithUV(minX, minY, minZ, maxU, maxV);
t.addVertexWithUV(maxX, minY, minZ, maxU, minV);
t.addVertexWithUV(maxX, minY, maxZ, minU, minV);
t.addVertexWithUV(minX, minY, maxZ, minU, maxV);
t.addVertexWithUV(maxX, maxY, maxZ, maxU, maxV);
t.addVertexWithUV(maxX, maxY, minZ, maxU, minV);
t.addVertexWithUV(minX, maxY, minZ, minU, minV);
t.addVertexWithUV(minX, maxY, maxZ, minU, maxV);
t.addVertexWithUV(minX, minY, maxZ, maxU, maxV);
t.addVertexWithUV(minX, maxY, maxZ, maxU, minV);
t.addVertexWithUV(minX, maxY, minZ, minU, minV);
t.addVertexWithUV(minX, minY, minZ, minU, maxV);
t.addVertexWithUV(maxX, minY, minZ, maxU, maxV);
t.addVertexWithUV(maxX, maxY, minZ, maxU, minV);
t.addVertexWithUV(maxX, maxY, maxZ, minU, minV);
t.addVertexWithUV(maxX, minY, maxZ, minU, maxV);
}
public static void renderLateralSides(double xCenter, double yCenter, double zCenter, double r, IIcon icon,
Tessellator t) {
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, maxU, maxV);
t.addVertexWithUV(maxX, maxY, maxZ, maxU, minV);
t.addVertexWithUV(minX, maxY, maxZ, minU, minV);
t.addVertexWithUV(minX, minY, maxZ, minU, maxV);
t.addVertexWithUV(minX, minY, minZ, maxU, maxV);
t.addVertexWithUV(minX, maxY, minZ, maxU, minV);
t.addVertexWithUV(maxX, maxY, minZ, minU, minV);
t.addVertexWithUV(maxX, minY, minZ, minU, maxV);
t.addVertexWithUV(minX, minY, maxZ, maxU, maxV);
t.addVertexWithUV(minX, maxY, maxZ, maxU, minV);
t.addVertexWithUV(minX, maxY, minZ, minU, minV);
t.addVertexWithUV(minX, minY, minZ, minU, maxV);
t.addVertexWithUV(maxX, minY, minZ, maxU, maxV);
t.addVertexWithUV(maxX, maxY, minZ, maxU, minV);
t.addVertexWithUV(maxX, maxY, maxZ, minU, minV);
t.addVertexWithUV(maxX, minY, maxZ, minU, maxV);
}
public static void renderUpperlSide(double xCenter, double yCenter, double zCenter, double r, IIcon icon,
Tessellator t) {
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, maxZ, maxU, maxV);
t.addVertexWithUV(maxX, maxY, minZ, maxU, minV);
t.addVertexWithUV(minX, maxY, minZ, minU, minV);
t.addVertexWithUV(minX, maxY, maxZ, minU, maxV);
}
public static void renderDownside(double xCenter, double yCenter, double zCenter, double r, IIcon icon,
Tessellator t) {
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, minZ, maxU, maxV);
t.addVertexWithUV(maxX, minY, minZ, maxU, minV);
t.addVertexWithUV(maxX, minY, maxZ, minU, minV);
t.addVertexWithUV(minX, minY, maxZ, minU, maxV);
}
}
@@ -1,172 +0,0 @@
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;
}
}
@@ -1,54 +0,0 @@
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;
}
}
@@ -1,118 +0,0 @@
package ab.common.block;
import ab.AdvancedBotany;
import ab.common.block.tile.TileAgglomerationPlate;
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.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.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.tile.TileSimpleInventory;
public class BlockAgglomerationPlate extends BlockContainer implements ILexiconable {
private IIcon[] icons;
public BlockAgglomerationPlate() {
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("ABPlate");
}
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int par6, float par7, float par8, float par9) {
TileAgglomerationPlate tile = (TileAgglomerationPlate)world.getTileEntity(x, y, z);
if (player.isSneaking()) {
if(tile.getStackInSlot(0) != null) {
ItemStack copy = tile.getStackInSlot(0).copy();
if (!player.inventory.addItemStackToInventory(copy))
player.dropPlayerItemWithRandomChoice(copy, false);
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 (!player.inventory.addItemStackToInventory(copy))
player.dropPlayerItemWithRandomChoice(copy, false);
tile.setInventorySlotContents(i, null);
world.func_147453_f(x, y, z, (Block)this);
break;
}
}
}
return false;
}
public void breakBlock(World world, int x, int y, int z, Block block, int meta) {
if(!world.isRemote) {
TileSimpleInventory inv = (TileSimpleInventory)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 void registerBlockIcons(IIconRegister ir) {
this.icons = new IIcon[3];
for (int i = 0; i < this.icons.length; i++)
this.icons[i] = ir.registerIcon("ab:advancedPlate_" + i);
}
public IIcon getIcon(int par1, int par2) {
return this.icons[Math.min(2, par1)];
}
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 TileAgglomerationPlate();
}
public LexiconEntry getEntry(World arg0, int arg1, int arg2, int arg3, EntityPlayer arg4, ItemStack arg5) {
return RecipeListAB.advandedAgglomerationPlate;
}
}
@@ -1,61 +0,0 @@
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 updateTick(World world, int x, int y, int z, Random rand) {
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);
}
}
}
@@ -1,129 +0,0 @@
package ab.common.block;
import java.util.Random;
import ab.AdvancedBotany;
import ab.api.ICorporeaModification;
import ab.common.block.tile.TileCorporeaCatalyst;
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.entity.item.EntityItem;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.ChunkCoordinates;
import net.minecraft.util.IIcon;
import net.minecraft.world.World;
import vazkii.botania.api.internal.VanillaPacketDispatcher;
import vazkii.botania.api.wand.IWandable;
import vazkii.botania.common.block.ModBlocks;
import vazkii.botania.common.item.ModItems;
import vazkii.botania.common.item.material.ItemRune;
public class BlockCorporeaCatalyst extends Block implements ITileEntityProvider, IWandable {
public IIcon[] icon;
public BlockCorporeaCatalyst() {
super(Material.rock);
this.icon = new IIcon[4];
setHardness(5.5F);
this.setCreativeTab(AdvancedBotany.tabAB);
}
@SideOnly(Side.CLIENT)
public void registerBlockIcons(final IIconRegister ir) {
// this.icon[0] = ModBlocks.livingrock.getIcon(0, 0);
this.icon[0] = ir.registerIcon("ab:corporeaCatalyst");
this.icon[1] = ir.registerIcon("ab:goodPicture");
this.icon[2] = ir.registerIcon("ab:star_sign");
this.icon[3] = ir.registerIcon("ab:corporea_downside");
}
@SideOnly(Side.CLIENT)
public IIcon getIcon(final int par1, final int par2) {
return ModBlocks.livingrock.getIcon(0, 0);
}
@Override
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int side, float hitX,
float hitY, float hitZ) {
int meta = world.getBlockMetadata(x, y, z);
if (player.isSneaking() && meta != 0) {
if (!world.isRemote)
world.spawnEntityInWorld(
new EntityItem(world, x + 0.5, y + 0.5, z + 0.5, new ItemStack(ModItems.rune, 1, meta - 1)));
world.setBlockMetadataWithNotify(x, y, z, 0, 0);
return true;
}
if (player.getHeldItem() != null && player.getHeldItem().getItem() instanceof ItemRune) {
int damage = player.getHeldItem().getItemDamage();
if (meta == 0 && damage < 4) {
world.setBlockMetadataWithNotify(x, y, z, damage + 1, 1);
player.getHeldItem().stackSize--;
((TileCorporeaCatalyst) world.getTileEntity(x, y, z)).sideRune = side;
return true;
}
}
return false;
}
@Override
public void breakBlock(World world, int x, int y, int z, Block block, int meta) {
Random random = world.rand;
if (meta != 0) {
ItemStack itemstack = new ItemStack(ModItems.rune, 1, meta - 1);
float f = random.nextFloat() * 0.8F + 0.1F;
float f1 = random.nextFloat() * 0.8F + 0.1F;
float f2 = random.nextFloat() * 0.8F + 0.1F;
EntityItem entityitem;
entityitem = new EntityItem(world, x + f, y + f1, z + f2, itemstack);
float f3 = 0.05F;
entityitem.motionX = (float) random.nextGaussian() * f3;
entityitem.motionY = (float) random.nextGaussian() * f3 + 0.2F;
entityitem.motionZ = (float) random.nextGaussian() * f3;
world.spawnEntityInWorld(entityitem);
world.func_147453_f(x, y, z, block);
}
super.breakBlock(world, x, y, z, block, meta);
}
@Override
public void onBlockPreDestroy(World world, int x, int y, int z, int oldMeta) {
TileCorporeaCatalyst tile = (TileCorporeaCatalyst) world.getTileEntity(x, y, z);
for (ChunkCoordinates coords : tile.getBindings()) {
TileEntity target = world.getTileEntity(coords.posX, coords.posY, coords.posZ);
if (target instanceof ICorporeaModification) {
((ICorporeaModification) target).removeModification();
VanillaPacketDispatcher.dispatchTEToNearbyPlayers(target);
}
}
}
@Override
public boolean onUsedByWand(EntityPlayer player, ItemStack stack, World world, int x, int y, int z, int side) {
return true;
}
public boolean renderAsNormalBlock() {
return false;
}
public boolean isOpaqueCube() {
return false;
}
@Override
public TileEntity createNewTileEntity(World world, int meta) {
return new TileCorporeaCatalyst();
}
}
@@ -1,45 +0,0 @@
package ab.common.block;
import ab.AdvancedBotany;
import ab.common.block.tile.TileCorporeaInterrupter;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import net.minecraft.block.material.Material;
import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.util.IIcon;
import net.minecraft.world.World;
import vazkii.botania.common.block.corporea.BlockCorporeaBase;
import vazkii.botania.common.block.tile.corporea.TileCorporeaBase;
public class BlockCorporeaInterrupter extends BlockCorporeaBase {
public IIcon icons[];
public BlockCorporeaInterrupter() {
super(Material.iron, "CorporeaInterrupter");
this.icons = new IIcon[3];
this.setCreativeTab(AdvancedBotany.tabAB);
setHardness(5.5F);
setStepSound(soundTypeMetal);
}
@Override
public TileCorporeaBase createNewTileEntity(World world, int meta) {
return new TileCorporeaInterrupter();
}
@Override
public IIcon getIcon(int side, int meta) {
return icons[side > 1 ? 1 : 0];
}
@Override
public void registerBlockIcons(IIconRegister ir) {
for(int i = 0; i < icons.length; i++) {
this.icons[2] = ir.registerIcon("ab:interrupter_rune");
this.icons[1] = ir.registerIcon("ab:CorporeaInterrupter0");
this.icons[0] = ir.registerIcon("ab:CorporeaInterrupter1");
}
}
}
@@ -1,76 +0,0 @@
package ab.common.block;
import java.util.Random;
import net.minecraft.block.Block;
import net.minecraft.block.BlockBush;
import net.minecraft.block.IGrowable;
import net.minecraft.block.material.Material;
import net.minecraft.item.Item;
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;
import net.minecraftforge.common.util.ForgeDirection;
public class BlockFreyrLiana extends BlockBush {
public BlockFreyrLiana() {
super(Material.plants);
this.setBlockName("BlockFreyrLiana");
this.setStepSound(soundTypeGrass);
this.setBlockTextureName("ab:freyrLiana");
}
@Override
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;
}
@Override
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 < 10; i1++) {
Block block = world.getBlock(x, y - i1, z);
if (block instanceof IGrowable || block instanceof BlockBush && !(block instanceof BlockFreyrLiana)) {
for (int i = 0; i < 5 + rand.nextInt(4); i++)
block.updateTick(world, x, y - i1, z, rand);
break;
}
}
}
@Override
protected void checkAndDropBlock(World p_149855_1_, int p_149855_2_, int p_149855_3_, int p_149855_4_) {
if (!this.canBlockStay(p_149855_1_, p_149855_2_, p_149855_3_, p_149855_4_)) {
this.dropBlockAsItem(p_149855_1_, p_149855_2_, p_149855_3_, p_149855_4_,
p_149855_1_.getBlockMetadata(p_149855_2_, p_149855_3_, p_149855_4_), 0);
p_149855_1_.setBlock(p_149855_2_, p_149855_3_, p_149855_4_, getBlockById(0), 0, 3);
}
}
public Item getItemDropped(int p_149650_1_, Random p_149650_2_, int p_149650_3_) {
return null;
}
@Override
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;
}
}
@@ -1,135 +0,0 @@
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 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) {
TileEntity tile = world.getTileEntity(x, y, z);
if(!(tile instanceof TileLebethronCore)) {
return false;
}
TileLebethronCore core = (TileLebethronCore)tile;
ItemStack heldItem = player.getCurrentEquippedItem();
if(heldItem == null)
return false;
Block block = Block.getBlockFromItem(heldItem.getItem());
if(block.getMaterial() == Material.leaves) {
core.updateStructure();
if(core.getValidTree()) {
if(core.setBlock(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);
}
@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;
}
}
@@ -1,55 +0,0 @@
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;
}
@Override
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);
}
@Override
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;
}
}
@@ -1,121 +0,0 @@
package ab.common.block;
import ab.AdvancedBotany;
import ab.common.block.tile.TileManaCharger;
import ab.common.lib.register.BlockListAB;
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.world.World;
import vazkii.botania.api.internal.VanillaPacketDispatcher;
import vazkii.botania.api.mana.IManaItem;
import vazkii.botania.api.wand.IWandHUD;
import vazkii.botania.api.wand.IWandable;
import vazkii.botania.common.block.tile.TileSimpleInventory;
public class BlockManaCharger extends BlockContainer implements IWandHUD, IWandable {
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 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();
if(!player.inventory.addItemStackToInventory(copy))
player.dropPlayerItemWithRandomChoice(copy, false);
if(!world.isRemote) {
tile.setInventorySlotContents(slotSide, null);
VanillaPacketDispatcher.dispatchTEToNearbyPlayers(world, x, y, z);
}
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);
if(!world.isRemote) {
tile.setInventorySlotContents(slotSide, copy);
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) {
TileSimpleInventory inv = (TileSimpleInventory)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;
}
}
@@ -1,69 +0,0 @@
package ab.common.block;
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.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.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.setBlockBounds(0.0625F, 0.0F, 0.0625F, 0.9375F, 1.1875F, 0.9375F);
this.setHardness(9.0F);
this.setBlockName("ABManaContainer");
}
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;
}
}
@@ -1,81 +0,0 @@
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((Packet)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;
}
}
@@ -1,66 +0,0 @@
package ab.common.block;
import java.util.ArrayList;
import java.util.Random;
import ab.AdvancedBotany;
import ab.common.block.tile.TileModifiedCorporeaFunnel;
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.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.util.IIcon;
import net.minecraft.world.World;
import vazkii.botania.client.core.helper.IconHelper;
import vazkii.botania.common.block.ModBlocks;
import vazkii.botania.common.block.corporea.BlockCorporeaBase;
import vazkii.botania.common.block.tile.corporea.TileCorporeaBase;
import vazkii.botania.common.lib.LibBlockNames;
public class BlockModifiedFunnel extends BlockCorporeaBase {
public IIcon[] icons;
public BlockModifiedFunnel() {
super(Material.iron, "CorporeaFunnel");
setHardness(5.5F);
setStepSound(soundTypeMetal);
}
@SideOnly(Side.CLIENT)
public void registerBlockIcons(final IIconRegister ir) {
icons = new IIcon[1];
this.icons[0] = ir.registerIcon("ab:funnel_rune");
}
@Override
public void onNeighborBlockChange(World world, int x, int y, int z, Block block) {
boolean power = world.isBlockIndirectlyGettingPowered(x, y, z) || world.isBlockIndirectlyGettingPowered(x, y + 1, z);
int meta = world.getBlockMetadata(x, y, z);
boolean powered = (meta & 8) != 0;
if(power && !powered) {
((TileModifiedCorporeaFunnel) world.getTileEntity(x, y, z)).doRequest();
world.setBlockMetadataWithNotify(x, y, z, meta | 8, 3);
} else if(!power && powered)
world.setBlockMetadataWithNotify(x, y, z, meta & -9, 3);
}
@Override
public Item getItemDropped(int par1, Random random, int par2)
{
return Item.getItemFromBlock(ModBlocks.corporeaFunnel);
}
@Override
public TileCorporeaBase createNewTileEntity(World arg0, int arg1) {
return new TileModifiedCorporeaFunnel();
}
@Override
public IIcon getIcon(int par1, int par2) {
return ModBlocks.corporeaFunnel.getIcon(par1, par2);
}
}
@@ -1,70 +0,0 @@
package ab.common.block;
import java.util.Random;
import ab.common.block.tile.TileModifiedInterceptor;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import net.minecraft.block.material.Material;
import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.item.Item;
import net.minecraft.util.IIcon;
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;
import vazkii.botania.common.block.ModBlocks;
import vazkii.botania.common.block.corporea.BlockCorporeaBase;
import vazkii.botania.common.block.tile.corporea.TileCorporeaBase;
public class BlockModifiedInterceptor extends BlockCorporeaBase {
public IIcon[] icons;
public BlockModifiedInterceptor() {
super(Material.iron, "CorporeaInterceptor");
setHardness(5.5F);
setStepSound(soundTypeMetal);
}
@SideOnly(Side.CLIENT)
public void registerBlockIcons(final IIconRegister ir) {
icons = new IIcon[1];
this.icons[0] = ir.registerIcon("ab:interceptor_rune");
}
@Override
public void updateTick(World world, int x, int y, int z, Random rand) {
world.setBlockMetadataWithNotify(x, y, z, 0, 3);
}
@Override
public boolean canProvidePower() {
return true;
}
@Override
public int tickRate(World world) {
return 2;
}
@Override
public int isProvidingWeakPower(IBlockAccess world, int x, int y, int z, int side) {
return world.getBlockMetadata(x, y, z) != 0 ? 15 : 0;
}
@Override
public TileCorporeaBase createNewTileEntity(World world, int meta) {
return new TileModifiedInterceptor();
}
@Override
public Item getItemDropped(int par1, Random random, int par2)
{
return Item.getItemFromBlock(ModBlocks.corporeaInterceptor);
}
@Override
public IIcon getIcon(int par1, int par2) {
return ModBlocks.corporeaInterceptor.getIcon(par1, par2);
}
}
@@ -1,52 +0,0 @@
package ab.common.block;
import java.util.Random;
import ab.common.block.tile.TileModifiedRetainer;
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.item.Item;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.IIcon;
import net.minecraft.world.World;
import vazkii.botania.common.block.ModBlocks;
import vazkii.botania.common.block.corporea.BlockCorporeaRetainer;
public class BlockModifiedRetainer extends BlockCorporeaRetainer {
public IIcon[] icons;
public BlockModifiedRetainer() {
super();
}
@SideOnly(Side.CLIENT)
public void registerBlockIcons(final IIconRegister ir) {
icons = new IIcon[1];
this.icons[0] = ir.registerIcon("ab:retainer_rune");
}
@Override
public int getComparatorInputOverride(World world, int x, int y, int z, int s) {
return ((TileModifiedRetainer) world.getTileEntity(x, y, z)).hasPendingRequest() ? 15 : 0;
}
@Override
public TileEntity createNewTileEntity(World world, int meta) {
return new TileModifiedRetainer();
}
@Override
public Item getItemDropped(int par1, Random random, int par2)
{
return Item.getItemFromBlock(ModBlocks.corporeaRetainer);
}
@Override
public IIcon getIcon(int par1, int par2) {
return ModBlocks.corporeaRetainer.getIcon(par1, par2);
}
}
@@ -1,132 +0,0 @@
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.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.setLightOpacity(255);
}
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) {
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 * 3.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;
}
}
@@ -1,41 +0,0 @@
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.IIcon;
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 "ab.flower." + this.name;
}
public String getUnlocalizedLoreTextForStack(ItemStack item) {
return "tile.ab.flower." + this.name + ".lore";
}
public void addTooltip(ItemStack stack, EntityPlayer player, List<String> tooltip) {
}
}
@@ -1,93 +0,0 @@
package ab.common.block.subtile;
import java.util.List;
import ab.api.AdvancedBotanyAPI;
import ab.api.recipe.RecipeAncientAlphirine;
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.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.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();
int posX = this.supertile.xCoord;
int posY = this.supertile.yCoord;
int posZ = this.supertile.zCoord;
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) {
label48: for(EntityItem item : items) {
for(RecipeAncientAlphirine recipe : AdvancedBotanyAPI.alphirineRecipes) {
if(recipe.matches(item.getEntityItem())) {
if(this.mana >= manaRequare && item.getEntityItem().stackSize >= 1) {
if(world.isRemote) {
spawnParticle(world, item);
} else {
if(item.getEntityItem().stackSize > 1)
item.getEntityItem().stackSize -= 1;
else
item.setDead();
if(world.rand.nextInt(175) <= recipe.getChance()) {
EntityItem itemResult = new EntityItem(world, item.posX, item.posY, item.posZ);
itemResult.setEntityItemStack(recipe.getOutput().copy());
world.spawnEntityInWorld(itemResult);
}
}
this.mana -= manaRequare;
break label48;
}
}
}
if(item.getEntityItem().getItem() instanceof ItemLexicon) {
if(!((ItemLexicon)item.getEntityItem().getItem()).isKnowledgeUnlocked(item.getEntityItem(), RecipeListAB.forgotten) && this.mana >= 45000) {
((ItemLexicon)item.getEntityItem().getItem()).unlockKnowledge(item.getEntityItem(), RecipeListAB.forgotten);
this.mana -= manaRequare;
if(world.isRemote)
spawnParticle(world, item);
break label48;
}
}
}
}
}
private void spawnParticle(World world, EntityItem item) {
for(int i = 0; i < 12; i++)
Botania.proxy.wispFX(world, item.posX, item.posY, item.posZ, 232 - (int)(Math.random() * 20), 212 - (int)(Math.random() * 20), 82 - (int)(Math.random() * 20), (float)Math.random() * 0.25F, (float)(Math.random() - 0.5D) * 0.0275F, (float)(Math.random() - 0.5D) * 0.0275F, (float)(Math.random() - 0.5D) * 0.0275F);
}
public int getMaxMana() {
return 180000;
}
public int getColor() {
return 0xd0bf58;
}
public LexiconEntry getEntry() {
return RecipeListAB.ancientAlphirine;
}
}
@@ -1,94 +0,0 @@
package ab.common.block.subtile;
import java.util.List;
import net.minecraft.entity.item.EntityItem;
import net.minecraft.item.Item;
import net.minecraft.item.ItemBook;
import net.minecraft.item.ItemEditableBook;
import net.minecraft.item.ItemEnchantedBook;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.util.AxisAlignedBB;
import net.minecraft.world.World;
import thaumcraft.common.items.ItemResource;
import thaumcraft.common.items.relics.ItemThaumonomicon;
import vazkii.botania.api.subtile.SubTileGenerating;
import vazkii.botania.common.Botania;
import vazkii.botania.common.item.ItemLexicon;
public class SubTileAngryMallos extends SubTileGenerating {
int cooldown = 0;
static int workMana = 360;
public void onUpdate() {
super.onUpdate();
if(this.cooldown > 0)
this.cooldown -= 1;
int posX = this.supertile.xCoord;
int posY = this.supertile.yCoord;
int posZ = this.supertile.zCoord;
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));
for(EntityItem item : items) {
ItemStack stack = ((EntityItem)item).getEntityItem();
if(this.cooldown > 0)
break;
else if(stack == null)
continue;
else if(searchKnowledge(stack) == 0)
continue;
int mana = searchKnowledge(stack);
if(stack.stackSize > 1)
stack.stackSize -= 1;
else
item.setDead();
this.mana = Math.min(this.getMaxMana(), this.mana + mana);
this.cooldown = 18;
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;
world.spawnParticle("iconcrack_" + Item.getIdFromItem(stack.getItem()) + "_" + stack.getItemDamage(), item.posX, item.posY, item.posZ, mx, my, mz);
}
break;
}
}
public int getMaxMana() {
return 76800;
}
public int getColor() {
return 0xdbc989;
}
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");
}
static int searchKnowledge(ItemStack stack) {
if(stack.getItem() instanceof ItemBook || stack.getItem() instanceof ItemEditableBook)
return workMana;
else if(stack.getItem() instanceof ItemEnchantedBook)
return (int)(workMana * 2.5f);
else if(stack.getItem() instanceof ItemLexicon)
return workMana * 3;
if(Botania.thaumcraftLoaded) {
if(stack.getItem() instanceof ItemThaumonomicon)
return (int)(workMana * 3.2f);
else if(stack.getItem() instanceof ItemResource && stack.getItemDamage() == 9)
return workMana * 2;
}
return 0;
}
}
@@ -1,89 +0,0 @@
package ab.common.block.subtile;
import java.util.ArrayList;
import java.util.List;
import java.util.Random;
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.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 int getMaxMana() {
return 15000;
}
public int getColor() {
return 0xd0bf58;
}
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");
}
}
@@ -1,61 +0,0 @@
package ab.common.block.subtile;
import java.util.List;
import net.minecraft.block.Block;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.passive.EntityVillager;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.AxisAlignedBB;
import net.minecraft.world.World;
import vazkii.botania.api.subtile.SubTileGenerating;
public class SubTileDictarius extends SubTileGenerating {
int cooldown = 0;
int workMana = 400;
public void onUpdate() {
super.onUpdate();
int posX = this.supertile.xCoord;
int posY = this.supertile.yCoord;
int posZ = this.supertile.zCoord;
World world = this.supertile.getWorldObj();
if(this.cooldown == 0) {
List<EntityLivingBase> livs = world.getEntitiesWithinAABB(EntityLivingBase.class, AxisAlignedBB.getBoundingBox(posX, posY, posZ, (posX + 1), (posY + 1), (posZ + 1)).expand(4, 3, 4));
int workMana = 0;
for(EntityLivingBase liv : livs) {
if(liv instanceof EntityPlayer)
workMana += this.workMana;
else if(liv instanceof EntityVillager)
workMana += (int)(this.workMana / 8);
}
this.cooldown = 200;
this.mana = Math.min(this.getMaxMana(), this.mana + workMana);
sync();
}
if(this.cooldown > 0) {
this.cooldown -= 1;
}
}
public int getMaxMana() {
return 15000;
}
public int getColor() {
return 0xdbc989;
}
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");
}
}
@@ -1,123 +0,0 @@
package ab.common.block.tile;
import java.util.UUID;
import org.lwjgl.opengl.GL11;
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);
if (burst != null) {
int maxMana = 30720;
int color = 0xcdd419;
int ticksBeforeManaLoss = 35;
float manaLossPerTick = 5376;
float motionModifier = 6.5f;
float gravity = 0.0f;
BurstProperties props = new BurstProperties(maxMana, ticksBeforeManaLoss, manaLossPerTick, gravity, motionModifier, color);
ItemStack lens = this.getStackInSlot(0);
if (lens != null && lens.getItem() instanceof ILensEffect) {
((ILensEffect)lens.getItem()).apply(lens, props);
}
burst.setSourceLens(lens);
if (this.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;
}
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 192000;
}
}
@@ -1,270 +0,0 @@
package ab.common.block.tile;
import java.util.List;
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.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 TileAgglomerationPlate extends TileSimpleInventory implements ISparkAttachable, ISidedInventory {
private static final int[][] MANA_STEEL_BLOCKS = new int[][] { { 1, 0 }, { -1, 0 }, { 0, 1 }, { 0, -1 } };
private static final int[][] MANA_QUARZ_BLOCKS = new int[][] { { 0, 0 }, { 1, 1 }, { 1, -1 }, { -1, 1 }, { -1, -1 } };
int mana;
public int manaToGet;
public static MultiblockSet makeMultiblockSet() {
Multiblock mb = new Multiblock();
for (int[] l : MANA_STEEL_BLOCKS)
mb.addComponent(l[0], 0, l[1], ModBlocks.storage, 0);
for (int[] l : MANA_QUARZ_BLOCKS)
mb.addComponent(l[0], 0, l[1], ModFluffBlocks.manaQuartz, 0);
mb.addComponent(0, 1, 0, BlockListAB.blockABPlate, 0);
mb.setRenderOffset(0, 1, 0);
return mb.makeSet();
}
public void updateEntity() {
if(!this.worldObj.isRemote) {
updateServer();
} else {
updateClient();
}
if(hasValidPlatform()) {
boolean hasCraft = false;
for(RecipeAdvancedPlate recipe : AdvancedBotanyAPI.advancedPlateRecipes) {
if(recipe.matches(this)) {
if(this.getStackInSlot(0) == null) {
this.manaToGet = recipe.getManaUsage();
hasCraft = true;
break;
} else {
if(this.getStackInSlot(0).isItemEqual(recipe.getOutput()) && this.getStackInSlot(0).stackSize < 64) {
this.manaToGet = recipe.getManaUsage();
hasCraft = true;
break;
}
}
}
}
if(!hasCraft) {
this.mana = 0;
this.manaToGet = 0;
}
}
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;
if (otherSpark.getAttachedTile() != null && otherSpark.getAttachedTile() instanceof IManaPool)
otherSpark.registerTransfer(spark);
}
}
}
private void updateServer() {
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.isDead && item.getEntityItem() != null) {
ItemStack stack = item.getEntityItem();
int splitCount = addItemStack(stack);
stack.splitStack(splitCount);
if(splitCount > 0)
VanillaPacketDispatcher.dispatchTEToNearbyPlayers(this.worldObj, this.xCoord, this.yCoord, this.zCoord);
}
}
if(this.isFull() && this.mana > 0) {
ItemStack output = null;
for(RecipeAdvancedPlate recipe : AdvancedBotanyAPI.advancedPlateRecipes) {
if(recipe.matches(this)) {
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 -= 1;
} else {
this.setInventorySlotContents(i, null);
}
}
if(this.getStackInSlot(0) != null) {
this.getStackInSlot(0).stackSize += 1;
} else {
this.setInventorySlotContents(0, output);
}
VanillaPacketDispatcher.dispatchTEToNearbyPlayers(this.worldObj, this.xCoord, this.yCoord, this.zCoord);
break;
}
}
}
}
private void updateClient() {
if(this.mana > 0)
doParticles();
}
private void doParticles() {
if (this.worldObj.isRemote) {
int ticks = (int)(100.0D * 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) * 2.0D;
double g = Math.sin(wticks * Math.PI / 180.0D * 0.55D);
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 + 0.25D + Math.abs(r) * 0.7D;
double z = this.zCoord + Math.cos(wticks * Math.PI / 180.0D) * r + 0.5D;
wticks += tickIncrement;
float[] colorsfx = { 0.0F, ticks / 100.0F, ticks / 100.0F };
Botania.proxy.wispFX(this.worldObj, x, y, z, colorsfx[0], colorsfx[1], colorsfx[2], 0.85F, (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, (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 < 15; j++)
Botania.proxy.wispFX(this.worldObj, this.xCoord + 0.5D, this.yCoord + 0.5D, this.zCoord + 0.5D, colorsfx[0], colorsfx[1], colorsfx[2], (float)Math.random() * 0.15F + 0.15F, (float)(Math.random() - 0.5D) * 0.125F, (float)(Math.random() - 0.5D) * 0.125F, (float)(Math.random() - 0.5D) * 0.125F);
}
}
}
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(getStackInSlot(i).getItem() == stack.getItem() && getStackInSlot(i).getItemDamage() == stack.getItemDamage() && ItemStack.areItemStackTagsEqual(stack, getStackInSlot(i)) && stack.getMaxStackSize() > getStackInSlot(i).stackSize) {
if(getStackInSlot(i).stackSize < 64) {
int count = 64 - getStackInSlot(i).stackSize;
if(stack.stackSize <= count) {
getStackInSlot(i).stackSize += stack.stackSize;
return stack.stackSize;
} else {
getStackInSlot(i).stackSize += count;
return stack.stackSize - count;
}
}
}
}
}
return 0;
}
boolean hasValidPlatform() {
return (checkAll(MANA_STEEL_BLOCKS, ModBlocks.storage, 0, -1) && checkAll(MANA_QUARZ_BLOCKS, ModFluffBlocks.manaQuartz, 0, -1));
}
boolean checkAll(int[][] positions, Block block, int meta, int yOff) {
for (int[] position : positions) {
int[] positions_ = position;
if (!checkPlatform(positions_[0], yOff, positions_[1], block, meta))
return false;
}
return true;
}
boolean checkPlatform(int xOff, int yOff, int zOff, Block block, int meta) {
Block checkBlock = this.worldObj.getBlock(this.xCoord + xOff, this.yCoord + yOff, zOff + this.zCoord);
return checkBlock == block && this.worldObj.getBlockMetadata(this.xCoord + xOff, this.yCoord + yOff, zOff + this.zCoord) == meta;
}
public void writeCustomNBT(NBTTagCompound cmp) {
super.writeCustomNBT(cmp);
cmp.setInteger("mana", this.mana);
cmp.setInteger("manaToGet", this.manaToGet);
}
public void readCustomNBT(NBTTagCompound cmp) {
super.readCustomNBT(cmp);
this.mana = cmp.getInteger("mana");
this.manaToGet = cmp.getInteger("manaToGet");
}
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 par1) {
return new int[0];
}
public boolean canInsertItem(int p_102007_1_, ItemStack p_102007_2_, int p_102007_3_) {
return false;
}
public boolean canExtractItem(int p_102008_1_, ItemStack p_102008_2_, int p_102008_3_) {
return false;
}
}
@@ -1,162 +0,0 @@
package ab.common.block.tile;
import java.util.LinkedList;
import java.util.List;
import ab.api.ICorporeaModification;
import ab.common.lib.register.BlockListAB;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import net.minecraft.block.Block;
import net.minecraft.entity.player.EntityPlayer;
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.ChunkCoordinates;
import vazkii.botania.api.wand.IWandBindable;
import vazkii.botania.common.block.ModBlocks;
import vazkii.botania.common.block.tile.corporea.TileCorporeaCrystalCube;
import vazkii.botania.common.block.tile.corporea.TileCorporeaFunnel;
import vazkii.botania.common.block.tile.corporea.TileCorporeaInterceptor;
import vazkii.botania.common.block.tile.corporea.TileCorporeaRetainer;
public class TileCorporeaCatalyst extends TileEntity implements IWandBindable {
public int sideRune;
private List<ChunkCoordinates> bindings = new LinkedList<ChunkCoordinates>();
@Override
public ChunkCoordinates getBinding() {
return new ChunkCoordinates(0, 0, 0);
}
public List<ChunkCoordinates> getBindings() {
return this.bindings;
}
@Override
public void updateEntity() {
List<ChunkCoordinates> bindingsCopy = new LinkedList(bindings);
for (ChunkCoordinates coords : bindingsCopy) {
if (!isModified(coords.posX, coords.posY, coords.posZ)
|| ((ICorporeaModification) this.worldObj.getTileEntity(coords.posX, coords.posY, coords.posZ))
.getCatalystTile() != this) {
bindings.remove(coords);
}
}
}
private boolean isModified(int x, int y, int z) {
return this.worldObj.getTileEntity(x, y, z) instanceof ICorporeaModification
&& ((ICorporeaModification) this.worldObj.getTileEntity(x, y, z)).isModified();
}
public boolean modify(int x, int y, int z) {
Block block = this.worldObj.getBlock(x, y, z);
if (block == ModBlocks.corporeaFunnel)
this.worldObj.setBlock(x, y, z, BlockListAB.blockModifiedCorporeaFunnel);
else if ((block == ModBlocks.corporeaInterceptor))
this.worldObj.setBlock(x, y, z, BlockListAB.blockModifiedInterceptor);
else if ((block == ModBlocks.corporeaRetainer))
this.worldObj.setBlock(x, y, z, BlockListAB.blockModifiedRetainer);
else
return false;
return true;
}
@Override
public boolean canSelect(EntityPlayer player, ItemStack stack, int x, int y, int z, int side) {
return true;
}
public int getRune() {
return this.getBlockMetadata() - 1;
}
@Override
public boolean bindTo(EntityPlayer player, ItemStack stack, int x, int y, int z, int side) {
ChunkCoordinates coords = new ChunkCoordinates(x, y, z);
if (isModified(x, y, z)) {
if (this.bindings.contains(coords)) {
this.bindings.remove(coords);
((ICorporeaModification)worldObj.getTileEntity(x, y, z)).removeModification();
return true;
} else
((ICorporeaModification) this.worldObj.getTileEntity(x, y, z)).getCatalystTile().bindings
.remove(coords);
} else if (Math.abs(x - this.xCoord) < 8 && Math.abs(y - this.yCoord) < 8 && Math.abs(z - this.zCoord) < 8
&& canBeModified(this.worldObj.getTileEntity(x, y, z))) {
modify(x, y, z);
} else
return false;
bindings.add(coords);
((ICorporeaModification) this.worldObj.getTileEntity(x, y, z)).setCatalystCoords(this.xCoord, this.yCoord,
this.zCoord);
return true;
}
@Override
public void readFromNBT(NBTTagCompound nbtt) {
super.readFromNBT(nbtt);
this.sideRune = nbtt.getInteger("sideRune");
int[] xCoords = nbtt.getIntArray("xCoords");
int[] yCoords = nbtt.getIntArray("yCoords");
int[] zCoords = nbtt.getIntArray("zCoords");
int i = 0;
while (i < xCoords.length) {
bindings.add(new ChunkCoordinates(xCoords[i], yCoords[i], zCoords[i]));
i++;
}
}
@Override
@SideOnly(Side.CLIENT)
public AxisAlignedBB getRenderBoundingBox() {
return AxisAlignedBB.getBoundingBox(xCoord - 1, yCoord - 1, zCoord - 1, xCoord + 2, yCoord + 2, zCoord + 2);
}
@Override
public void writeToNBT(NBTTagCompound nbtt) {
super.writeToNBT(nbtt);
nbtt.setInteger("sideRune", sideRune);
int[] xCoords = new int[bindings.size()];
int[] yCoords = new int[bindings.size()];
int[] zCoords = new int[bindings.size()];
int i = 0;
for (ChunkCoordinates coords : bindings) {
xCoords[i] = coords.posX;
yCoords[i] = coords.posY;
zCoords[i] = coords.posZ;
i++;
}
nbtt.setIntArray("xCoords", xCoords);
nbtt.setIntArray("yCoords", yCoords);
nbtt.setIntArray("zCoords", zCoords);
}
@Override
public final void onDataPacket(final NetworkManager manager, final S35PacketUpdateTileEntity paket) {
super.onDataPacket(manager, paket);
this.readFromNBT(paket.func_148857_g());
}
@Override
public Packet getDescriptionPacket() {
final NBTTagCompound compound = new NBTTagCompound();
this.writeToNBT(compound);
return new S35PacketUpdateTileEntity(this.xCoord, this.yCoord, this.zCoord, 10, compound);
}
private boolean canBeModified(TileEntity tile) {
return tile instanceof TileCorporeaCrystalCube || tile instanceof TileCorporeaFunnel
|| tile instanceof TileCorporeaInterceptor || tile instanceof TileCorporeaRetainer
|| tile instanceof ICorporeaModification;
}
}
@@ -1,235 +0,0 @@
package ab.common.block.tile;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import ab.api.AdvancedCorporeaHelper;
import ab.api.ICorporeaModification;
import ab.common.integration.corporea.ICorporeaInterrupter;
import ab.common.lib.utils.Pair;
import net.minecraft.inventory.IInventory;
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.ChunkCoordinates;
import vazkii.botania.api.corporea.CorporeaHelper;
import vazkii.botania.api.corporea.CorporeaRequestEvent;
import vazkii.botania.api.corporea.ICorporeaInterceptor;
import vazkii.botania.api.corporea.ICorporeaSpark;
import vazkii.botania.api.corporea.IWrappedInventory;
import vazkii.botania.common.block.tile.corporea.TileCorporeaBase;
import vazkii.botania.common.core.helper.ItemNBTHelper;
public class TileCorporeaInterrupter extends TileCorporeaBase implements ICorporeaInterrupter, ICorporeaModification {
ChunkCoordinates coords = new ChunkCoordinates();;
boolean hasCatalyst = false;
@Override
public int getSizeInventory() {
return 1;
}
@Override
public String getInventoryName() {
return "CorporeaInterrupter";
}
@Override
public void onInterrupt(CorporeaRequestEvent event) {
if(this.worldObj.isBlockIndirectlyGettingPowered(this.xCoord, this.yCoord, this.zCoord))
return;
int rune = -1;
if (this.getCatalystTile() != null)
rune = this.getCatalystTile().getRune();
List<ItemStack> stacks = new ArrayList<ItemStack>();
IInventory inv$ = event.spark.getInventory();
List<IInventory> inventories = CorporeaHelper.getInventoriesOnNetwork(event.spark);
List<IWrappedInventory> inventoriesW = AdvancedCorporeaHelper.wrapInventory(inventories);
Map<ICorporeaInterceptor, ICorporeaSpark> interceptors = new HashMap<ICorporeaInterceptor, ICorporeaSpark>();
switch (rune) {
case -1:
if (this.worldObj.getTileEntity(xCoord + 1, yCoord, zCoord) == inv$
|| this.worldObj.getTileEntity(xCoord, yCoord, zCoord + 1) == inv$
|| this.worldObj.getTileEntity(xCoord - 1, yCoord, zCoord) == inv$
|| this.worldObj.getTileEntity(xCoord, yCoord, zCoord - 1) == inv$)
event.setCanceled(true);
case 1:
if (this.worldObj.getTileEntity(xCoord + 1, yCoord, zCoord) == inv$
|| this.worldObj.getTileEntity(xCoord, yCoord, zCoord + 1) == inv$
|| this.worldObj.getTileEntity(xCoord - 1, yCoord, zCoord) == inv$
|| this.worldObj.getTileEntity(xCoord, yCoord, zCoord - 1) == inv$)
for (IWrappedInventory invW : inventoriesW) {
ICorporeaSpark invSpark = invW.getSpark();
Object originalInventory = invW.getWrappedObject();
if (originalInventory instanceof ICorporeaInterceptor) {
ICorporeaInterceptor interceptor = (ICorporeaInterceptor) originalInventory;
interceptor.interceptRequest(event.request, event.count, invSpark, event.spark, stacks,
inventories, event.realRequest);
interceptors.put(interceptor, invSpark);
}
}
break;
case 2:
ItemStack stack = null;
if (event.request instanceof ItemStack)
stack = ((ItemStack) event.request).copy();
if (event.request instanceof Pair) {
Pair pair = (Pair) event.request;
if (pair.getKey() instanceof IInventory && pair.getValue() instanceof Integer)
stack = ((IInventory) pair.getKey()).getStackInSlot((Integer) pair.getValue());
else if (pair.getKey() instanceof String) {
}
}
ItemNBTHelper.initNBT(stack);
String customName = ItemNBTHelper.getNBT(stack).getCompoundTag("display").getString("Name");
if (customName.equals("")) {
return;
}
if (this.worldObj.getTileEntity(xCoord + 1, yCoord, zCoord) == inv$
|| this.worldObj.getTileEntity(xCoord, yCoord, zCoord + 1) == inv$
|| this.worldObj.getTileEntity(xCoord - 1, yCoord, zCoord) == inv$
|| this.worldObj.getTileEntity(xCoord, yCoord, zCoord - 1) == inv$) {
event.setCanceled(true);
for (IWrappedInventory invW : inventoriesW) {
ICorporeaSpark invSpark = invW.getSpark();
Object originalInventory = invW.getWrappedObject();
if (originalInventory instanceof ICorporeaInterceptor) {
ICorporeaInterceptor interceptor = (ICorporeaInterceptor) originalInventory;
interceptor.interceptRequest(event.request, event.count, invSpark, event.spark, stacks,
inventories, event.realRequest);
interceptors.put(interceptor, invSpark);
}
}
}
break;
case 3:
if (this.worldObj.getTileEntity(xCoord + 1, yCoord, zCoord) == inv$
|| this.worldObj.getTileEntity(xCoord, yCoord, zCoord + 1) == inv$
|| this.worldObj.getTileEntity(xCoord - 1, yCoord, zCoord) == inv$
|| this.worldObj.getTileEntity(xCoord, yCoord, zCoord - 1) == inv$) {
event.setCanceled(true);
TileEntity tileI = this.worldObj.getTileEntity(xCoord + 1, yCoord, zCoord);
ICorporeaSpark spark;
if (tileI instanceof ICorporeaInterceptor) {
spark = getSparkForBlock(tileI);
interceptors.put((ICorporeaInterceptor) tileI, spark);
((ICorporeaInterceptor) tileI).interceptRequest(event.request, event.count, spark, event.spark,
stacks, inventories, event.realRequest);
}
tileI = this.worldObj.getTileEntity(xCoord - 1, yCoord, zCoord);
if (tileI instanceof ICorporeaInterceptor) {
spark = getSparkForBlock(tileI);
interceptors.put((ICorporeaInterceptor) tileI, spark);
((ICorporeaInterceptor) tileI).interceptRequest(event.request, event.count, spark, event.spark,
stacks, inventories, event.realRequest);
}
tileI = this.worldObj.getTileEntity(xCoord, yCoord, zCoord - 1);
if (tileI instanceof ICorporeaInterceptor) {
spark = getSparkForBlock(tileI);
interceptors.put((ICorporeaInterceptor) tileI, spark);
((ICorporeaInterceptor) tileI).interceptRequest(event.request, event.count, spark, event.spark,
stacks, inventories, event.realRequest);
}
tileI = this.worldObj.getTileEntity(xCoord, yCoord, zCoord + 1);
if (tileI instanceof ICorporeaInterceptor) {
spark = getSparkForBlock(tileI);
interceptors.put((ICorporeaInterceptor) tileI, spark);
((ICorporeaInterceptor) tileI).interceptRequest(event.request, event.count, spark, event.spark,
stacks, inventories, event.realRequest);
}
tileI = this.worldObj.getTileEntity(xCoord, yCoord + 1, zCoord);
if (tileI instanceof ICorporeaInterceptor) {
spark = getSparkForBlock(tileI);
interceptors.put((ICorporeaInterceptor) tileI, spark);
((ICorporeaInterceptor) tileI).interceptRequest(event.request, event.count, spark, event.spark,
stacks, inventories, event.realRequest);
}
tileI = this.worldObj.getTileEntity(xCoord, yCoord - 1, zCoord);
if (tileI instanceof ICorporeaInterceptor) {
spark = getSparkForBlock(tileI);
interceptors.put((ICorporeaInterceptor) tileI, spark);
((ICorporeaInterceptor) tileI).interceptRequest(event.request, event.count, spark, event.spark,
stacks, inventories, event.realRequest);
}
}
break;
}
if (!interceptors.isEmpty())
for (ICorporeaInterceptor interceptor : interceptors.keySet())
interceptor.interceptRequestLast(event.request, event.count, interceptors.get(interceptor), event.spark,
stacks, inventories, event.realRequest);
}
private ICorporeaSpark getSparkForBlock(TileEntity tile) {
return CorporeaHelper.getSparkForBlock(worldObj, tile.xCoord, tile.yCoord, tile.zCoord);
}
@Override
public void readFromNBT(NBTTagCompound nbtt) {
super.readFromNBT(nbtt);
this.hasCatalyst = nbtt.getBoolean("hasCatalyst");
if (hasCatalyst) {
int coordsX = nbtt.getInteger("coordsX");
int coordsY = nbtt.getInteger("coordsY");
int coordsZ = nbtt.getInteger("coordsZ");
this.coords = new ChunkCoordinates(coordsX, coordsY, coordsZ);
}
}
@Override
public void writeToNBT(NBTTagCompound nbtt) {
super.writeToNBT(nbtt);
nbtt.setInteger("coordsX", this.coords.posX);
nbtt.setInteger("coordsY", this.coords.posY);
nbtt.setInteger("coordsZ", this.coords.posZ);
nbtt.setBoolean("hasCatalyst", hasCatalyst);
}
@Override
public final void onDataPacket(final NetworkManager manager, final S35PacketUpdateTileEntity paket) {
super.onDataPacket(manager, paket);
this.readFromNBT(paket.func_148857_g());
}
@Override
public Packet getDescriptionPacket() {
final NBTTagCompound compound = new NBTTagCompound();
this.writeToNBT(compound);
return new S35PacketUpdateTileEntity(this.xCoord, this.yCoord, this.zCoord, 10, compound);
}
@Override
public void setCatalystCoords(int x, int y, int z) {
coords.set(x, y, z);
this.hasCatalyst = true;
}
@Override
public TileCorporeaCatalyst getCatalystTile() {
if (this.hasCatalyst)
return (TileCorporeaCatalyst) worldObj.getTileEntity(coords.posX, coords.posY, coords.posZ);
return null;
}
@Override
public boolean isModified() {
return this.hasCatalyst;
}
@Override
public void removeModification() {
coords.set(0, 0, 0);
hasCatalyst = false;
}
}
@@ -1,213 +0,0 @@
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.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.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;
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(!this.worldObj.isRemote) {
++tick;
if(tick >= 100) {
updateStructure();
if(validTree && getBlock() != null) {
spawnLeaves();
tick = 0;
}
}
} else {
if (this.worldObj.rand.nextBoolean() && this.worldObj.isRemote)
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(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;
}
if(!this.worldObj.isRemote) {
EntityItem entity = new EntityItem(this.worldObj, this.xCoord, this.yCoord, this.zCoord);
entity.setEntityItemStack(new ItemStack(this.block, 1, this.meta));
this.worldObj.spawnEntityInWorld(entity);
}
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.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);
}
}
@@ -1,255 +0,0 @@
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 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 TileSimpleInventory implements ISidedInventory, IRenderHud, IWandBindable {
private static final int MANA_SPEED = 11240;
public boolean requestsClientUpdate = false;
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() {
if(requestsClientUpdate && !this.worldObj.isRemote && this.worldObj.getTotalWorldTime() % 15 == 0) {
VanillaPacketDispatcher.dispatchTEToNearbyPlayers(this.worldObj, this.xCoord, this.yCoord, this.zCoord);
requestsClientUpdate = false;
}
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);
requestsClientUpdate = 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);
requestsClientUpdate = true;
} else {
clientTick[i]++;
}
receiver.recieveMana(-manaVal);
}
}
}
}
public ISparkAttachable getReceiver() {
if(this.worldObj != null && this.receiverPosY != -1) {
TileEntity tile = this.worldObj.getTileEntity(receiverPosX, receiverPosY, receiverPosZ);
if(tile != null && tile instanceof ISparkAttachable) {
return (ISparkAttachable)tile;
}
}
return null;
}
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) >= 16 || Math.abs(this.yCoord - y) >= 16 || Math.abs(this.zCoord - z) >= 16;
if(isFar)
return false;
else if(tile instanceof ISparkAttachable) {
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.requestsClientUpdate);
this.requestsClientUpdate = false;
}
public void readFromNBT(NBTTagCompound nbtt) {
super.readFromNBT(nbtt);
this.requestsClientUpdate = 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[0];
}
public boolean canInsertItem(int slot, ItemStack stack, int side) {
return false;
}
public boolean canExtractItem(int slot, ItemStack stack, int side) {
return false;
}
}
@@ -1,117 +0,0 @@
package ab.common.block.tile;
import java.util.List;
import org.lwjgl.opengl.GL11;
import ab.client.core.ClientHelper;
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.block.tile.TileMod;
public class TileManaContainer extends TileMod implements IManaPool, ISparkAttachable {
private static final int MAX_MANA = 64000000;
protected int mana = 0;
int knownMana = -1;
public boolean canUpdate() {
return false;
}
public void updateEntity() {}
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.hud");
int color = 0x30ead1;
ClientHelper.drawPoolManaHUD(res, name, this.knownMana, MAX_MANA, color);
}
public int getCurrentMana() {
return this.mana;
}
public boolean canRecieveManaFromBursts() {
return true;
}
public boolean isFull() {
return this.mana == MAX_MANA;
}
public void recieveMana(int mana) {
this.mana = Math.max(0, Math.min(getCurrentMana() + mana, MAX_MANA));
}
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, MAX_MANA - getCurrentMana());
}
public boolean isOutputtingPower() {
return false;
}
}
@@ -1,68 +0,0 @@
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(this.worldObj, this.xCoord, this.yCoord, this.zCoord);
for (ISparkEntity spark : allSparks) {
ISparkAttachable tileMana = spark.getAttachedTile();
if(mana[1] + tileMana.getCurrentMana() + tileMana.getAvailableSpaceForMana() > 0) {
mana[1] += tileMana.getCurrentMana() + tileMana.getAvailableSpaceForMana();
mana[0] += tileMana.getCurrentMana();
}
else
break;
}
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");
}
}
@@ -1,252 +0,0 @@
package ab.common.block.tile;
import java.util.ArrayList;
import java.util.List;
import ab.api.AdvancedCorporeaHelper;
import ab.api.ICorporeaModification;
import ab.common.lib.register.BlockListAB;
import ab.common.lib.utils.Pair;
import net.minecraft.entity.item.EntityItem;
import net.minecraft.entity.item.EntityItemFrame;
import net.minecraft.inventory.IInventory;
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.util.AxisAlignedBB;
import net.minecraft.util.ChunkCoordinates;
import net.minecraftforge.common.util.ForgeDirection;
import vazkii.botania.api.corporea.CorporeaHelper;
import vazkii.botania.api.corporea.ICorporeaRequestor;
import vazkii.botania.api.corporea.ICorporeaSpark;
import vazkii.botania.api.internal.VanillaPacketDispatcher;
import vazkii.botania.common.block.ModBlocks;
import vazkii.botania.common.block.tile.corporea.TileCorporeaBase;
import vazkii.botania.common.block.tile.corporea.TileCorporeaFunnel;
import vazkii.botania.common.core.helper.InventoryHelper;
import vazkii.botania.common.lib.LibMisc;
public class TileModifiedCorporeaFunnel extends TileCorporeaBase implements ICorporeaRequestor, ICorporeaModification {
ChunkCoordinates coords;
public void doRequest() {
ICorporeaSpark spark = getSpark();
if (spark == null || spark.getMaster() == null)
return;
List<ItemStack> filter = getFilter();
if(filter.isEmpty())
return;
ItemStack stack = filter.get(worldObj.rand.nextInt(filter.size()));
int rune = this.getCatalystTile().getRune();
if (filter.isEmpty())
return;
switch (rune) {
case 0:
int count = AdvancedCorporeaHelper.sumStackSizes(filter);
this.doCorporeaRequest(null, count, spark);
break;
case -1:
case 1:
case 2:
case 3:
if (stack != null)
this.doCorporeaRequest(stack, stack.stackSize, spark);
break;
}
}
public List<ItemStack> getFilter() {
List<ItemStack> filter = new ArrayList();
final int[] orientationToDir = new int[] { 3, 4, 2, 5 };
final int[] rotationToStackSize = new int[] { 1, 16, 32, 64 };
for (ForgeDirection dir : LibMisc.CARDINAL_DIRECTIONS) {
List<EntityItemFrame> frames = worldObj.getEntitiesWithinAABB(EntityItemFrame.class,
AxisAlignedBB.getBoundingBox(xCoord + dir.offsetX, yCoord + dir.offsetY, zCoord + dir.offsetZ,
xCoord + dir.offsetX + 1, yCoord + dir.offsetY + 1, zCoord + dir.offsetZ + 1));
for (EntityItemFrame frame : frames) {
int orientation = frame.hangingDirection;
if (orientationToDir[orientation] == dir.ordinal()) {
ItemStack stack = frame.getDisplayedItem();
if (stack != null) {
ItemStack copy = stack.copy();
copy.stackSize = rotationToStackSize[frame.getRotation()];
filter.add(copy);
}
}
}
}
return filter;
}
@Override
public void doCorporeaRequest(Object request, int count, ICorporeaSpark spark) {
int rune = this.getCatalystTile().getRune();
IInventory inv = InventoryHelper.getInventory(worldObj, xCoord, yCoord - 1, zCoord);
if (inv == null || inv instanceof TileCorporeaFunnel)
inv = InventoryHelper.getInventory(worldObj, xCoord, yCoord - 2, zCoord);
switch (rune) {
case -1:
if (!(request instanceof ItemStack))
return;
if (inv == null || inv instanceof TileCorporeaFunnel)
inv = InventoryHelper.getInventory(worldObj, xCoord, yCoord - 2, zCoord);
List<ItemStack> stacks$ = CorporeaHelper.requestItem(request, count, spark, true, true);
spark.onItemsRequested(stacks$);
for (ItemStack reqStack : stacks$)
if (request != null) {
if (inv != null && !(inv instanceof TileCorporeaFunnel) && reqStack.stackSize == InventoryHelper
.testInventoryInsertion(inv, reqStack, ForgeDirection.UP))
InventoryHelper.insertItemIntoInventory(inv, reqStack);
else {
EntityItem item = new EntityItem(worldObj, xCoord + 0.5, yCoord + 1.5, zCoord + 0.5, reqStack);
worldObj.spawnEntityInWorld(item);
}
}
break;
case 0:
List<ItemStack> stacks = AdvancedCorporeaHelper.requestRandomItem(spark, count, true);
spark.onItemsRequested(stacks);
for (ItemStack reqStack : stacks)
if (inv != null && !(inv instanceof TileCorporeaFunnel) && reqStack.stackSize == InventoryHelper
.testInventoryInsertion(inv, reqStack, ForgeDirection.UP))
InventoryHelper.insertItemIntoInventory(inv, reqStack);
else {
EntityItem item = new EntityItem(worldObj, xCoord + 0.5, yCoord + 1.5, zCoord + 0.5, reqStack);
worldObj.spawnEntityInWorld(item);
}
break;
case 1:
if (request instanceof ItemStack) {
List<ItemStack> stacks1 = CorporeaHelper.requestItem(request, -1, spark, true, true);
for (ItemStack reqStack : stacks1)
if (inv != null && !(inv instanceof TileCorporeaFunnel) && reqStack.stackSize == InventoryHelper
.testInventoryInsertion(inv, reqStack, ForgeDirection.UP))
InventoryHelper.insertItemIntoInventory(inv, reqStack);
else {
EntityItem item = new EntityItem(worldObj, xCoord + 0.5, yCoord + 1.5, zCoord + 0.5, reqStack);
worldObj.spawnEntityInWorld(item);
}
}
break;
case 2:
String name;
List<ItemStack> stacks2;
if (request instanceof ItemStack) {
name = ((ItemStack) request).getDisplayName();
stacks2 = AdvancedCorporeaHelper.requestSameNamedItem(name, (ItemStack) request, spark,
((ItemStack) request).stackSize, true);
} else if (request instanceof String) {
name = (String) request;
stacks2 = AdvancedCorporeaHelper.requestSameNamedItem(name, null, spark, 1, true);
} else
return;
spark.onItemsRequested(stacks2);
for (ItemStack reqStack : stacks2)
if (inv != null && !(inv instanceof TileCorporeaFunnel) && reqStack.stackSize == InventoryHelper
.testInventoryInsertion(inv, reqStack, ForgeDirection.UP))
InventoryHelper.insertItemIntoInventory(inv, reqStack);
else {
EntityItem item = new EntityItem(worldObj, xCoord + 0.5, yCoord + 1.5, zCoord + 0.5, reqStack);
worldObj.spawnEntityInWorld(item);
}
break;
case 3:
ItemStack stack = null;
if (request instanceof Pair) {
Pair pair = (Pair) request;
if (pair.getKey() instanceof IInventory && pair.getValue() instanceof Integer) {
stack = AdvancedCorporeaHelper.getStackBySlot((IInventory) pair.getKey(), (Integer) pair.getValue(),
count, spark, true);
}
} else if (request instanceof ItemStack) {
Pair pair = AdvancedCorporeaHelper.getFirstInventoryWithStackByRequest(spark, (ItemStack) request);
if (pair.getKey() != null)
stack = AdvancedCorporeaHelper.getStackBySlot((IInventory) pair.getKey(),
(Integer) pair.getValue() + 1, count, spark, true);
}
if (stack != null)
if (inv != null && !(inv instanceof TileCorporeaFunnel)
&& stack.stackSize == InventoryHelper.testInventoryInsertion(inv, stack, ForgeDirection.UP))
InventoryHelper.insertItemIntoInventory(inv, stack);
else {
EntityItem item = new EntityItem(worldObj, xCoord + 0.5, yCoord + 1.5, zCoord + 0.5, stack);
worldObj.spawnEntityInWorld(item);
}
break;
}
}
@Override
public void setCatalystCoords(int x, int y, int z) {
this.coords = new ChunkCoordinates(x, y, z);
}
@Override
public void readFromNBT(NBTTagCompound nbtt) {
super.readFromNBT(nbtt);
int coordsX = nbtt.getInteger("coordsX");
int coordsY = nbtt.getInteger("coordsY");
int coordsZ = nbtt.getInteger("coordsZ");
this.coords = new ChunkCoordinates(coordsX, coordsY, coordsZ);
}
@Override
public void writeToNBT(NBTTagCompound nbtt) {
super.writeToNBT(nbtt);
nbtt.setInteger("coordsX", this.coords.posX);
nbtt.setInteger("coordsY", this.coords.posY);
nbtt.setInteger("coordsZ", this.coords.posZ);
}
@Override
public final void onDataPacket(final NetworkManager manager, final S35PacketUpdateTileEntity paket) {
super.onDataPacket(manager, paket);
this.readFromNBT(paket.func_148857_g());
}
@Override
public Packet getDescriptionPacket() {
final NBTTagCompound compound = new NBTTagCompound();
this.writeToNBT(compound);
return new S35PacketUpdateTileEntity(this.xCoord, this.yCoord, this.zCoord, 10, compound);
}
@Override
public int getSizeInventory() {
return 1;
}
@Override
public String getInventoryName() {
return "TileModifiedCorporeaFunnel";
}
@Override
public TileCorporeaCatalyst getCatalystTile() {
if (this.coords != null)
return (TileCorporeaCatalyst) this.worldObj.getTileEntity(this.coords.posX, this.coords.posY,
this.coords.posZ);
return null;
}
@Override
public boolean isModified() {
return true;
}
@Override
public void removeModification() {
this.worldObj.setBlock(xCoord, yCoord, zCoord, ModBlocks.corporeaFunnel);
}
}
@@ -1,282 +0,0 @@
package ab.common.block.tile;
import java.util.ArrayList;
import java.util.List;
import ab.api.AdvancedCorporeaHelper;
import ab.api.ICorporeaModification;
import ab.common.lib.utils.Pair;
import net.minecraft.entity.item.EntityItemFrame;
import net.minecraft.inventory.IInventory;
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.ChunkCoordinates;
import net.minecraftforge.common.util.ForgeDirection;
import vazkii.botania.api.corporea.CorporeaHelper;
import vazkii.botania.api.corporea.ICorporeaInterceptor;
import vazkii.botania.api.corporea.ICorporeaSpark;
import vazkii.botania.common.block.ModBlocks;
import vazkii.botania.common.block.tile.corporea.TileCorporeaBase;
import vazkii.botania.common.block.tile.corporea.TileCorporeaRetainer;
import vazkii.botania.common.lib.LibMisc;
public class TileModifiedInterceptor extends TileCorporeaBase implements ICorporeaInterceptor, ICorporeaModification {
ChunkCoordinates coords = new ChunkCoordinates();
@Override
public void setCatalystCoords(int x, int y, int z) {
coords.set(x, y, z);
}
@Override
public TileCorporeaCatalyst getCatalystTile() {
return (TileCorporeaCatalyst) worldObj.getTileEntity(coords.posX, coords.posY, coords.posZ);
}
@Override
public boolean isModified() {
return true;
}
@Override
public void removeModification() {
worldObj.setBlock(xCoord, yCoord, zCoord, ModBlocks.corporeaInterceptor);
}
@Override
public void interceptRequest(Object request, int count, ICorporeaSpark spark, ICorporeaSpark source,
List<ItemStack> stacks, List<IInventory> inventories, boolean doit) {
}
@Override
public void interceptRequestLast(Object request, int count, ICorporeaSpark spark, ICorporeaSpark source,
List<ItemStack> stacks, List<IInventory> inventories, boolean doit) {
int rune = this.getCatalystTile().getRune();
Object filter = getFilter();
switch (rune) {
case -1:
if (requestMatches(request, filter)) {
int missing = count;
for (ItemStack stack_ : stacks)
missing -= stack_.stackSize;
if (missing > 0 && getBlockMetadata() == 0) {
worldObj.setBlockMetadataWithNotify(xCoord, yCoord, zCoord, 1, 1 | 2);
worldObj.scheduleBlockUpdate(xCoord, yCoord, zCoord, getBlockType(), 2);
TileEntity requestor = (TileEntity) source.getInventory();
for (ForgeDirection dir : LibMisc.CARDINAL_DIRECTIONS) {
TileEntity tile = worldObj.getTileEntity(xCoord + dir.offsetX, yCoord, zCoord + dir.offsetZ);
if (tile != null && tile instanceof TileCorporeaRetainer)
((TileCorporeaRetainer) tile).setPendingRequest(requestor.xCoord, requestor.yCoord,
requestor.zCoord, request, count);
}
return;
}
}
break;
case 0:
if (requestMatches(request, filter)) {
int missing = count;
for (ItemStack stack_ : stacks)
missing -= stack_.stackSize;
if (missing > 0 && getBlockMetadata() == 0) {
worldObj.setBlockMetadataWithNotify(xCoord, yCoord, zCoord, 1, 1 | 2);
worldObj.scheduleBlockUpdate(xCoord, yCoord, zCoord, getBlockType(), 2);
TileEntity requestor = (TileEntity) source.getInventory();
for (ForgeDirection dir : LibMisc.CARDINAL_DIRECTIONS) {
TileEntity tile = worldObj.getTileEntity(xCoord + dir.offsetX, yCoord, zCoord + dir.offsetZ);
if (tile != null && tile instanceof TileCorporeaRetainer)
((TileCorporeaRetainer) tile).setPendingRequest(requestor.xCoord, requestor.yCoord,
requestor.zCoord,
AdvancedCorporeaHelper.trasformateRequest(spark, request, ItemStack.class), count);
}
return;
}
}
break;
case 1:
if (!requestMatches(request, filter)) {
int missing = count;
for (ItemStack stack_ : stacks)
missing -= stack_.stackSize;
if (missing > 0 && getBlockMetadata() == 0) {
worldObj.setBlockMetadataWithNotify(xCoord, yCoord, zCoord, 1, 1 | 2);
worldObj.scheduleBlockUpdate(xCoord, yCoord, zCoord, getBlockType(), 2);
TileEntity requestor = (TileEntity) source.getInventory();
for (ForgeDirection dir : LibMisc.CARDINAL_DIRECTIONS) {
TileEntity tile = worldObj.getTileEntity(xCoord + dir.offsetX, yCoord, zCoord + dir.offsetZ);
if (tile != null && tile instanceof TileCorporeaRetainer)
((TileCorporeaRetainer) tile).setPendingRequest(requestor.xCoord, requestor.yCoord,
requestor.zCoord, request, count);
}
return;
}
}
break;
case 2:
if (requestMatches(request, filter)) {
int missing = count;
for (ItemStack stack_ : stacks)
missing -= stack_.stackSize;
if (missing > 0 && getBlockMetadata() == 0) {
worldObj.setBlockMetadataWithNotify(xCoord, yCoord, zCoord, 1, 1 | 2);
worldObj.scheduleBlockUpdate(xCoord, yCoord, zCoord, getBlockType(), 2);
TileEntity requestor = (TileEntity) source.getInventory();
for (ForgeDirection dir : LibMisc.CARDINAL_DIRECTIONS) {
TileEntity tile = worldObj.getTileEntity(xCoord + dir.offsetX, yCoord, zCoord + dir.offsetZ);
if (tile != null && tile instanceof TileCorporeaRetainer)
((TileCorporeaRetainer) tile).setPendingRequest(requestor.xCoord, requestor.yCoord,
requestor.zCoord,
AdvancedCorporeaHelper.trasformateRequest(spark, request, IInventory.class), count);
}
return;
}
}
break;
case 3:
if (requestMatches(request, filter)) {
int missing = count;
for (ItemStack stack_ : stacks)
missing -= stack_.stackSize;
if (missing > 0 && getBlockMetadata() == 0) {
worldObj.setBlockMetadataWithNotify(xCoord, yCoord, zCoord, 1, 1 | 2);
worldObj.scheduleBlockUpdate(xCoord, yCoord, zCoord, getBlockType(), 2);
TileEntity requestor = (TileEntity) source.getInventory();
for (ForgeDirection dir : LibMisc.CARDINAL_DIRECTIONS) {
TileEntity tile = worldObj.getTileEntity(xCoord + dir.offsetX, yCoord, zCoord + dir.offsetZ);
if (tile != null && tile instanceof TileCorporeaRetainer)
((TileCorporeaRetainer) tile).setPendingRequest(requestor.xCoord, requestor.yCoord,
requestor.zCoord,
AdvancedCorporeaHelper.trasformateRequest(spark, request, String.class), count);
}
return;
}
}
break;
}
}
public Object getFilter() {
List<ItemStack> filter = new ArrayList();
final int[] orientationToDir = new int[] { 3, 4, 2, 5 };
for (ForgeDirection dir : LibMisc.CARDINAL_DIRECTIONS) {
List<EntityItemFrame> frames = worldObj.getEntitiesWithinAABB(EntityItemFrame.class,
AxisAlignedBB.getBoundingBox(xCoord + dir.offsetX, yCoord + dir.offsetY, zCoord + dir.offsetZ,
xCoord + dir.offsetX + 1, yCoord + dir.offsetY + 1, zCoord + dir.offsetZ + 1));
for (EntityItemFrame frame : frames) {
int orientation = frame.hangingDirection;
if (orientationToDir[orientation] == dir.ordinal())
if (frame.getDisplayedItem() == null)
return "anyone";
filter.add(frame.getDisplayedItem());
}
}
return filter;
}
private boolean requestMatches(Object request, Object filter) {
if (filter instanceof String)
return true;
if (filter == null)
return false;
List<ItemStack> list = (List<ItemStack>) filter;
for (ItemStack filter$ : list) {
if (request instanceof ItemStack) {
ItemStack stack = (ItemStack) request;
return stack != null && stack.isItemEqual(filter$) && ItemStack.areItemStackTagsEqual(filter$, stack);
}
if (request instanceof Pair) {
Pair pair = (Pair) request;
Object key = pair.getKey();
Object value = pair.getValue();
if (key instanceof IInventory && value instanceof Integer) {
ItemStack stack = ((IInventory) key).getStackInSlot((Integer) value);
return stack != null && stack.isItemEqual(filter$)
&& ItemStack.areItemStackTagsEqual(filter$, stack);
}
if (key instanceof String)
return filter$.getDisplayName().equals((String) key);
}
String name = (String) request;
return CorporeaHelper.stacksMatch(filter$, name);
}
return false;
}
@Override
public boolean isItemValidForSlot(int i, ItemStack itemstack) {
return false;
}
@Override
public void readFromNBT(NBTTagCompound nbtt) {
super.readFromNBT(nbtt);
int coordsX = nbtt.getInteger("coordsX");
int coordsY = nbtt.getInteger("coordsY");
int coordsZ = nbtt.getInteger("coordsZ");
this.coords = new ChunkCoordinates(coordsX, coordsY, coordsZ);
}
@Override
public void writeToNBT(NBTTagCompound nbtt) {
super.writeToNBT(nbtt);
nbtt.setInteger("coordsX", this.coords.posX);
nbtt.setInteger("coordsY", this.coords.posY);
nbtt.setInteger("coordsZ", this.coords.posZ);
}
@Override
public final void onDataPacket(final NetworkManager manager, final S35PacketUpdateTileEntity paket) {
super.onDataPacket(manager, paket);
this.readFromNBT(paket.func_148857_g());
}
@Override
public Packet getDescriptionPacket() {
final NBTTagCompound compound = new NBTTagCompound();
this.writeToNBT(compound);
return new S35PacketUpdateTileEntity(this.xCoord, this.yCoord, this.zCoord, 10, compound);
}
@Override
public int getSizeInventory() {
return 1;
}
@Override
public String getInventoryName() {
return "TileModifiedInterceptor";
}
}
@@ -1,66 +0,0 @@
package ab.common.block.tile;
import ab.api.ICorporeaModification;
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.util.ChunkCoordinates;
import vazkii.botania.common.block.ModBlocks;
import vazkii.botania.common.block.tile.corporea.TileCorporeaRetainer;
public class TileModifiedRetainer extends TileCorporeaRetainer implements ICorporeaModification {
ChunkCoordinates coords = new ChunkCoordinates();
@Override
public void setCatalystCoords(int x, int y, int z) {
coords.set(x, y, z);
}
@Override
public TileCorporeaCatalyst getCatalystTile() {
return (TileCorporeaCatalyst) worldObj.getTileEntity(coords.posX, coords.posY, coords.posZ);
}
@Override
public boolean isModified() {
return true;
}
@Override
public void removeModification() {
worldObj.setBlock(xCoord, yCoord, zCoord, ModBlocks.corporeaRetainer);
}
@Override
public void readFromNBT(NBTTagCompound nbtt) {
super.readFromNBT(nbtt);
int coordsX = nbtt.getInteger("coordsX");
int coordsY = nbtt.getInteger("coordsY");
int coordsZ = nbtt.getInteger("coordsZ");
this.coords = new ChunkCoordinates(coordsX, coordsY, coordsZ);
}
@Override
public void writeToNBT(NBTTagCompound nbtt) {
super.writeToNBT(nbtt);
nbtt.setInteger("coordsX", this.coords.posX);
nbtt.setInteger("coordsY", this.coords.posY);
nbtt.setInteger("coordsZ", this.coords.posZ);
}
@Override
public final void onDataPacket(final NetworkManager manager, final S35PacketUpdateTileEntity paket) {
super.onDataPacket(manager, paket);
this.readFromNBT(paket.func_148857_g());
}
@Override
public Packet getDescriptionPacket() {
final NBTTagCompound compound = new NBTTagCompound();
this.writeToNBT(compound);
return new S35PacketUpdateTileEntity(this.xCoord, this.yCoord, this.zCoord, 10, compound);
}
}
@@ -1,28 +0,0 @@
package ab.common.core.proxy;
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 cpw.mods.fml.common.event.FMLInitializationEvent;
import cpw.mods.fml.common.event.FMLPostInitializationEvent;
import cpw.mods.fml.common.event.FMLPreInitializationEvent;
public class CommonProxy {
public void preInit(FMLPreInitializationEvent event) {
BlockListAB.init();
ItemListAB.init();
EntityListAB.init();
FlowerRegister.init();
}
public void init(FMLInitializationEvent event) {
RecipeListAB.init();
}
public void postInit(FMLPostInitializationEvent event) {
}
}
@@ -1,324 +0,0 @@
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());
}
}
@@ -1,173 +0,0 @@
package ab.common.entity;
import java.util.List;
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.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.projectile.EntityThrowable;
import net.minecraft.init.Blocks;
import net.minecraft.potion.PotionEffect;
import net.minecraft.util.AxisAlignedBB;
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);
}
@Override
public void onUpdate() {
super.onUpdate();
if (this.worldObj.isRemote)
for (int i = 0; i < 9; i++)
Botania.proxy.wispFX(this.worldObj, this.posX, this.posY, this.posZ, (18 + rand.nextInt(60)) / 255f,
(198 + rand.nextInt(60)) / 255f, (140 + rand.nextInt(40)) / 255f, 0.09f,
(float) (Math.random() - 0.5D) * 0.03F, (float) (Math.random() - 0.5D) * 0.03F,
(float) (Math.random() - 0.5D) * 0.03F, 2);
}
@Override
protected void onImpact(MovingObjectPosition pos) {
if (pos != null) {
World world = this.worldObj;
double x = 0;
double y = 0;
double z = 0;
if (pos.entityHit != null) {
world = pos.entityHit.worldObj;
x = pos.entityHit.posX;
y = pos.entityHit.posY;
z = pos.entityHit.posZ;
((EntityLivingBase) pos.entityHit).addPotionEffect(new PotionEffect(19, 180, 8));
((EntityLivingBase) pos.entityHit).addPotionEffect(new PotionEffect(15, 30, 1));
((EntityLivingBase) pos.entityHit).addPotionEffect(new PotionEffect(2, 260, 2));
} else {
x = pos.blockX;
y = pos.blockY;
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 != this.getThrower())
if (target instanceof EntityAnimal) {
EntityAnimal animal = (EntityAnimal) target;
ReflectionHelper.setPrivateValue(EntityAnimal.class, animal, 1200, LibObfuscation.IN_LOVE);
animal.setTarget(null);
this.worldObj.setEntityState(animal, (byte) 18);
} else
target.addPotionEffect(new PotionEffect(19, 110, 4));
}
for (int k = 0; k < 13; k++)
for (int k1 = 0; k1 < 7; k1++)
for (int k2 = 0; k2 < 13; k2++) {
int xCoord = MathHelper.floor_double(x) + k - 6;
int yCoord = MathHelper.floor_double(y) + k1 - 3;
int zCoord = MathHelper.floor_double(z) + k2 - 6;
if (isPlant(xCoord, yCoord, zCoord)) {
Block block = this.worldObj.getBlock(xCoord, yCoord, zCoord);
for (int i = 0; i < 10; i++)
block.updateTick(world, xCoord, yCoord, zCoord, world.rand);
if (ConfigHandler.blockBreakParticles)
this.worldObj.playAuxSFX(2005, xCoord, yCoord, zCoord,
6 + this.worldObj.rand.nextInt(4));
this.worldObj.playSoundEffect(x, y, z, "botania:agricarnation", 0.01F,
0.5F + (float) Math.random() * 0.5F);
}
}
if (!world.isRemote)
for (int k = 0; k < 7; k++)
for (int k1 = 0; k1 < 3; k1++)
for (int k2 = 0; k2 < 7; k2++) {
int xCoord = MathHelper.floor_double(x) + k - 3;
int yCoord = MathHelper.floor_double(y) + k1 - 1;
int zCoord = MathHelper.floor_double(z) + k2 - 3;
Block block = worldObj.getBlock(xCoord, yCoord, zCoord);
if (!BlockListAB.blockFreyrLiana.canBlockStay(world, xCoord, yCoord - 1, zCoord))
continue;
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)
worldObj.setBlock(xCoord, yCoord, zCoord, BlockListAB.blockFreyrLiana);
else
worldObj.setBlock(xCoord, yCoord, zCoord,
BlockListAB.blockLuminousFreyrLiana);
worldObj.playAuxSFX(2001, xCoord, yCoord, zCoord, Block.getIdFromBlock(BlockListAB.blockFreyrLiana));
yCoord--;
} else
break;
}
}
if (!world.isRemote)
for (int i = 0; i < 100; i++) {
Botania.proxy.wispFX(world, x + Math.random() * 5 - Math.random() * 5,
y + Math.random() * 5 - Math.random() * 5, z + Math.random() * 5 - Math.random() * 5,
(18 + rand.nextInt(50)) / 255f, (198 + rand.nextInt(40)) / 255f,
(140 + rand.nextInt(20)) / 255f, 0.08f, 0, 3);
}
this.setDead();
}
}
boolean isPlant(int x, int y, int z) {
Block block = this.worldObj.getBlock(x, y, z);
if (block == Blocks.grass || block == Blocks.leaves || block == Blocks.leaves2
|| block instanceof BlockBush && !(block instanceof BlockCrops) && !(block instanceof BlockSapling))
return false;
Material mat = block.getMaterial();
return mat != null
&& (mat == Material.plants || mat == Material.cactus || mat == Material.grass || mat == Material.leaves
|| mat == Material.gourd)
&& block instanceof IGrowable
&& ((IGrowable) block).func_149851_a(this.worldObj, x, y, z, this.worldObj.isRemote);
}
@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_) {
}
@Override
protected float getGravityVelocity() {
return 0.0f;
}
@Override
public void setDead() {
for (int i = 0; i < 200; i++) {
Botania.proxy.wispFX(this.worldObj, posX, posY, posZ, (18 + rand.nextInt(50)) / 255f,
(198 + rand.nextInt(40)) / 255f, (140 + rand.nextInt(20)) / 255f, 0.08f,
(float) (-0.4 + Math.random() * 0.8), (float) (-0.4 + Math.random() * 0.8),
(float) (-0.4 + Math.random() * 0.8));
}
super.setDead();
}
}
@@ -1,94 +0,0 @@
package ab.common.entity;
import java.util.List;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import net.minecraft.block.Block;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.projectile.EntityThrowable;
import net.minecraft.server.MinecraftServer;
import net.minecraft.util.AxisAlignedBB;
import net.minecraft.util.DamageSource;
import net.minecraft.util.MovingObjectPosition;
import net.minecraft.world.World;
import vazkii.botania.common.Botania;
public class EntityNebulaBlaze extends EntityThrowable {
public EntityNebulaBlaze(World world) {
super(world);
this.dataWatcher.addObject(27, "");
this.dataWatcher.setObjectWatched(27);
}
public EntityNebulaBlaze(World world, EntityPlayer e) {
super(world, e);
this.dataWatcher.addObject(27, e.getCommandSenderName());
this.dataWatcher.setObjectWatched(27);
}
public void onUpdate() {
if(this.ticksExisted >= 240)
setDead();
double posX = this.posX;
double posY = this.posY;
double posZ = this.posZ;
super.onUpdate();
AxisAlignedBB axis = AxisAlignedBB.getBoundingBox(this.posX, this.posY, this.posZ, this.posX + 1, this.posY + 1, this.posZ + 1).expand(3.75f, 3.75f, 3.75f);
List<EntityLivingBase> livs = this.worldObj.getEntitiesWithinAABB(EntityLivingBase.class, axis);
for(EntityLivingBase liv : livs) {
if(liv instanceof EntityPlayer)
continue;
else if(liv.getHealth() <= 0.0f)
continue;
double d1 = (this.posX - liv.posX);
double d2 = (this.posY - liv.posY - liv.getEyeHeight());
double d3 = (this.posZ - liv.posZ);
double d4 = Math.sqrt(d1 * d1 + d2 * d2 + d3 * d3);
if(d4 < 3.1D)
d4 = 3.1D;
double d5 = 1.0D - d4;
this.setPosition(posX, posY, posZ);
this.motionX = d1 / d4 * d5 * 0.325D + (liv.motionX * 0.85f);
this.motionY = d2 / d4 * d5 * 0.325D + (liv.motionY * 0.85f);
this.motionZ = d3 / d4 * d5 * 0.325D + (liv.motionZ * 0.85f);
this.moveEntity(this.motionX, this.motionY, this.motionZ);
break;
}
if(this.worldObj.isRemote)
for(int i = 0; i < 9; i++)
Botania.proxy.wispFX(this.worldObj, this.posX, this.posY, this.posZ, 1.0f - (float)(Math.random() / 5.0f), 0.0f + (float)(Math.random() / 5.0f), 1.0f - (float)(Math.random() / 5.0f) , 0.2F * (float)((Math.random()) - 0.25D), (float)((Math.random() / 2) - 0.25D) * 0.03F, (float)((Math.random() / 2) - 0.25D) * 0.03F, (float)((Math.random() / 2) - 0.25D) * 0.03F);
}
@SideOnly(Side.CLIENT)
public void setPositionAndRotation2(double x, double y, double z, float help, float me, int please) {}
protected float getGravityVelocity() {
return 0.0F;
}
public String getPlayerName() {
if(this.dataWatcher.getWatchableObjectString(27) == null)
return "null";
return this.dataWatcher.getWatchableObjectString(27);
}
protected void onImpact(MovingObjectPosition mov) {
Block block = this.worldObj.getBlock(mov.blockX, mov.blockY, mov.blockZ);
if(mov.entityHit != null && mov.entityHit instanceof EntityLivingBase) {
EntityPlayer player = mov.entityHit.worldObj.getPlayerEntityByName(getPlayerName());
EntityLivingBase liv = (EntityLivingBase)mov.entityHit;
if(liv instanceof EntityPlayer && liv == player)
return;
else if(liv.getHealth() <= 0.0f)
return;
liv.hurtResistantTime = 0;
liv.attackEntityFrom((player == null) ? DamageSource.magic : DamageSource.causePlayerDamage(player), 13.0f);
}
else if(block instanceof net.minecraft.block.BlockBush || block instanceof net.minecraft.block.BlockLeaves)
return;
setDead();
}
}
@@ -1,140 +0,0 @@
package ab.common.integration.corporea;
import java.util.ArrayList;
import java.util.List;
import ab.common.lib.utils.Pair;
import net.minecraft.inventory.IInventory;
import net.minecraft.item.ItemStack;
import vazkii.botania.api.corporea.CorporeaHelper;
import vazkii.botania.api.corporea.CorporeaRequest;
import vazkii.botania.api.corporea.ICorporeaSpark;
import vazkii.botania.api.corporea.IWrappedInventory;
import vazkii.botania.common.integration.corporea.WrappedInventoryBase;
public class CustomWrappedIInventory extends WrappedInventoryBase {
private IInventory inv;
private CustomWrappedIInventory(IInventory inv, ICorporeaSpark spark) {
this.inv = inv;
this.spark = spark;
}
@Override
public IInventory getWrappedObject() {
return inv;
}
@Override
public List<ItemStack> countItems(CorporeaRequest request) {
return iterateOverSlots(request, false);
}
@Override
public List<ItemStack> extractItems(CorporeaRequest request) {
return iterateOverSlots(request, true);
}
private List<ItemStack> iterateOverSlots(CorporeaRequest request, boolean doit) {
List<ItemStack> stacks = new ArrayList<ItemStack>();
boolean removedAny = false;
boolean isRequestNamed = request.matcher instanceof Pair && ((Pair) request.matcher).getKey() instanceof String;
boolean isRequestSloted = request.matcher instanceof Pair
&& ((Pair) request.matcher).getKey() instanceof IInventory
&& ((Pair) request.matcher).getValue() instanceof Integer;
String name = null;
ItemStack stack = null;
if (isRequestNamed) {
name = (String) ((Pair) request.matcher).getKey();
stack = (ItemStack) ((Pair) request.matcher).getValue();
}
if (isRequestSloted) {
IInventory inv = (IInventory) ((Pair) request.matcher).getKey();
int slot = (Integer) ((Pair) request.matcher).getValue();
if (CorporeaHelper.isValidSlot(inv, slot)) {
ItemStack stackAt = inv.getStackInSlot(slot);
if (this.inv != ((Pair) request.matcher).getKey())
return stacks;
int rem = Math.min(stackAt.stackSize, request.count == -1 ? stackAt.stackSize : request.count);
if (rem > 0) {
ItemStack copy = stackAt.copy();
if (rem < copy.stackSize)
copy.stackSize = rem;
stacks.add(copy);
}
request.foundItems += stackAt.stackSize;
request.extractedItems += rem;
if (doit && rem > 0) {
inv.decrStackSize(slot, rem);
removedAny = true;
if (spark != null)
spark.onItemExtracted(stackAt);
}
if (request.count != -1)
request.count -= rem;
}
}
for (int i = inv.getSizeInventory() - 1; i >= 0; i--) {
if (!CorporeaHelper.isValidSlot(inv, i))
continue;
ItemStack stackAt = inv.getStackInSlot(i);
// WARNING: this code is very similar in all implementations of
// IWrappedInventory - keep it synch
if ((request.matcher == null && stackAt != null)
|| isMatchingItemStack(request.matcher, request.checkNBT, stackAt)
|| (isRequestNamed && isMatchingNames(name, stackAt, stack, request.checkNBT))) {
int rem = Math.min(stackAt.stackSize, request.count == -1 ? stackAt.stackSize : request.count);
if (rem > 0) {
ItemStack copy = stackAt.copy();
if (rem < copy.stackSize)
copy.stackSize = rem;
stacks.add(copy);
}
request.foundItems += stackAt.stackSize;
request.extractedItems += rem;
if (doit && rem > 0) {
inv.decrStackSize(i, rem);
removedAny = true;
if (spark != null)
spark.onItemExtracted(stackAt);
}
if (request.count != -1)
request.count -= rem;
}
}
if (removedAny) {
inv.markDirty();
}
return stacks;
}
protected boolean isMatchingNames(String name, ItemStack stackAt, ItemStack stack, boolean checkNBT) {
return isSameNamed(name, stackAt) && (stack == null || !isMatchingItemStack(stack, checkNBT, stackAt));
}
protected boolean isSameNamed(String name, ItemStack stack) {
if (stack != null)
System.out.println(stack.getDisplayName());
return stack != null && name.equals(stack.getDisplayName());
}
public static IWrappedInventory wrap(IInventory inv, ICorporeaSpark spark) {
return new CustomWrappedIInventory(inv, spark);
}
}
@@ -1,17 +0,0 @@
package ab.common.integration.corporea;
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
import net.minecraft.inventory.IInventory;
import vazkii.botania.api.corporea.CorporeaHelper;
import vazkii.botania.api.corporea.CorporeaRequestEvent;
public class EventCorporeaHandler {
@SubscribeEvent
public void onCorporeaRequest(CorporeaRequestEvent event) {
for(IInventory inv : CorporeaHelper.getInventoriesOnNetwork(event.spark))
if(inv instanceof ICorporeaInterrupter)
((ICorporeaInterrupter)inv).onInterrupt(event);
}
}
@@ -1,9 +0,0 @@
package ab.common.integration.corporea;
import vazkii.botania.api.corporea.CorporeaRequestEvent;
public interface ICorporeaInterrupter {
public void onInterrupt(CorporeaRequestEvent event);
}
@@ -1,65 +0,0 @@
package ab.common.item;
import java.util.List;
import ab.AdvancedBotany;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.inventory.IInventory;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.util.IIcon;
import vazkii.botania.api.recipe.IFlowerComponent;
public class ItemABResource extends Item implements IFlowerComponent {
private IIcon[] icons = new IIcon[7];
public ItemABResource() {
this.setHasSubtypes(true);
this.setCreativeTab(AdvancedBotany.tabAB);
this.setUnlocalizedName("resourceAB");
}
public void registerIcons(IIconRegister ir) {
for(int i = 0; i < icons.length; i++) {
icons[i] = ir.registerIcon("ab:resourceAB_" + i);
}
}
@SideOnly(Side.CLIENT)
public boolean hasEffect(ItemStack stack) {
return stack.getItemDamage() == 2;
}
@SideOnly(Side.CLIENT)
public void getSubItems(Item item, CreativeTabs tab, List list) {
for (int i = 0; i < icons.length; i++) {
list.add(new ItemStack((Item)this, 1, i));
}
}
@SideOnly(Side.CLIENT)
public IIcon getIconFromDamage(int par1) {
return icons[Math.min(icons.length - 1, par1)];
}
public boolean canFit(ItemStack stack, IInventory apothecary) {
int meta = stack.getItemDamage();
return (meta == 3 || meta == 2 || meta == 4);
}
public String getUnlocalizedName(final ItemStack stack) {
return "item.resourceAB_" + stack.getItemDamage();
}
public int getParticleColor(ItemStack stack) {
return 10158080;
}
public boolean isElvenItem(ItemStack stack) {
return false;
}
}
@@ -1,59 +0,0 @@
package ab.common.item;
import ab.AdvancedBotany;
import ab.common.entity.EntityAdvancedSpark;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.entity.Entity;
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.world.World;
import vazkii.botania.api.internal.VanillaPacketDispatcher;
import vazkii.botania.api.mana.IManaGivingItem;
import vazkii.botania.api.mana.spark.ISparkAttachable;
import vazkii.botania.api.mana.spark.ISparkEntity;
import vazkii.botania.common.entity.EntitySpark;
public class ItemAdvancedSpark extends ItemMod implements IManaGivingItem {
public static IIcon invIcon;
public static IIcon worldIcon;
public ItemAdvancedSpark() {
super("advancedSpark");
}
public boolean onItemUse(ItemStack stack, EntityPlayer player, World world, int x, int y, int z, int side, float xv, float yv, float zv) {
TileEntity tile = world.getTileEntity(x, y, z);
if (tile instanceof ISparkAttachable) {
ISparkAttachable attach = (ISparkAttachable)tile;
if (attach.canAttachSpark(stack) && attach.getAttachedSpark() == null) {
stack.stackSize--;
if (!world.isRemote) {
EntityAdvancedSpark spark = new EntityAdvancedSpark(world);
spark.setPosition(x + 0.5D, y + 1.5D, z + 0.5D);
world.spawnEntityInWorld((Entity)spark);
attach.attachSpark((ISparkEntity)spark);
VanillaPacketDispatcher.dispatchTEToNearbyPlayers(world, x, y, z);
}
return true;
}
}
return false;
}
@SideOnly(Side.CLIENT)
public void registerIcons(IIconRegister ir) {
invIcon = ir.registerIcon("ab:itemAB.spark_0");
worldIcon = ir.registerIcon("ab:itemAB.spark_1");
}
@SideOnly(Side.CLIENT)
public IIcon getIconFromDamage(int par1) {
return invIcon;
}
}
@@ -1,80 +0,0 @@
package ab.common.item;
import java.util.List;
import ab.common.lib.register.BlockListAB;
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.entity.Entity;
import net.minecraft.entity.item.EntityFallingBlock;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.util.AxisAlignedBB;
import net.minecraft.util.IIcon;
import net.minecraft.world.World;
import vazkii.botania.common.core.helper.ItemNBTHelper;
public class ItemAntigravityCharm extends ItemMod {
public static IIcon[] icons;
public ItemAntigravityCharm() {
super("antigravityCharm");
this.setMaxStackSize(1);
this.setNoRepair();
}
public void registerIcons(IIconRegister ir) {
icons = new IIcon[2];
for(int i = 0; i < icons.length; i++) {
icons[i] = icons[i] = ir.registerIcon("ab:" + "itemAntigravityCharm_" + i);
}
}
@SideOnly(Side.CLIENT)
public IIcon getIcon(ItemStack stack, int pass) {
int iconID = Math.min(1, pass);
return this.icons[iconID];
}
public boolean requiresMultipleRenderPasses() {
return true;
}
public ItemStack onItemRightClick(ItemStack stack, World world, EntityPlayer player) {
if(player.isSneaking())
ItemNBTHelper.setBoolean(stack, "isActive", !ItemNBTHelper.getBoolean(stack, "isActive", true));
return stack;
}
public void onUpdate(ItemStack stack, World world, Entity entity, int par4, boolean inHand) {
if(ItemNBTHelper.getBoolean(stack, "isActive", true)) {
double posX = entity.posX;
double posY = entity.posY;
double posZ = entity.posZ;
final AxisAlignedBB asis = AxisAlignedBB.getBoundingBox(posX, posY, posZ, posX + 1, posY + 1, posZ + 1).expand(8, 8, 8);
final List<EntityFallingBlock> listEntity = (List<EntityFallingBlock>)world.getEntitiesWithinAABB((Class)EntityFallingBlock.class, asis);
for(EntityFallingBlock fallBlock : listEntity) {
int x = (int) (fallBlock.posX >= 0 ? fallBlock.posX : fallBlock.posX - 1);
int y = (int) fallBlock.posY;
int z = (int) (fallBlock.posZ >= 0 ? fallBlock.posZ : fallBlock.posZ - 1);
Block block = fallBlock.func_145805_f();
fallBlock.setInvisible(true);
if(!world.isRemote) {
setBlock(world, x, y, z, block, fallBlock.field_145814_a);
setBlock(world, x, y - 1, z, BlockListAB.blockAntigravitation, 0);
}
fallBlock.setDead();
}
}
}
private void setBlock(World world, int x, int y, int z, Block block, int meta) {
if(world.getBlock(x, y, z).getMaterial() == Material.air && y < 256) {
world.setBlock(x, y, z, block, meta, 3);
}
}
}
@@ -1,354 +0,0 @@
package ab.common.item;
import java.awt.Color;
import org.lwjgl.opengl.GL11;
import ab.AdvancedBotany;
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import net.minecraft.block.Block;
import net.minecraft.client.Minecraft;
import net.minecraft.client.entity.EntityClientPlayerMP;
import net.minecraft.client.gui.Gui;
import net.minecraft.client.gui.ScaledResolution;
import net.minecraft.client.renderer.ItemRenderer;
import net.minecraft.client.renderer.RenderBlocks;
import net.minecraft.client.renderer.RenderHelper;
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.entity.Entity;
import net.minecraft.entity.EntityLivingBase;
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.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.MathHelper;
import net.minecraft.util.ResourceLocation;
import net.minecraft.util.StatCollector;
import net.minecraft.world.World;
import net.minecraftforge.client.event.RenderWorldLastEvent;
import net.minecraftforge.common.MinecraftForge;
import vazkii.botania.api.item.IBlockProvider;
import vazkii.botania.client.core.handler.ClientTickHandler;
import vazkii.botania.common.core.helper.InventoryHelper;
import vazkii.botania.common.core.helper.ItemNBTHelper;
import vazkii.botania.common.item.ItemBlackHoleTalisman;
public class ItemBlackHalo extends ItemMod implements IBlockProvider {
public static final ResourceLocation glowTexture = new ResourceLocation("ab:textures/misc/glow.png");
public ItemBlackHalo() {
super("blackHalo");
this.setMaxStackSize(1);
MinecraftForge.EVENT_BUS.register(this);
}
public ItemStack onItemRightClick(ItemStack halo, World world, EntityPlayer player) {
int segment = getSegmentLookedAt(halo, player);
if(this.getItemForSlot(halo, segment) != null) {
ItemStack stack = this.getItemForSlot(halo, segment).copy();
if(player.isSneaking()) {
if(!player.inventory.addItemStackToInventory(stack))
player.dropPlayerItemWithRandomChoice(stack, false);
this.setItemSlot(halo, null, segment);
return halo;
}
stack.setItemDamage(stack.getItemDamage() == 0 ? 1 : 0);
this.setItemSlot(halo, stack, segment);
return halo;
}
for(int i = 0; i < 9; i++) {
ItemStack stack = player.inventory.getStackInSlot(i);
if(stack != null && stack.getItem() instanceof ItemBlackHoleTalisman) {
boolean hasBlock = !Block.isEqualTo(((ItemBlackHoleTalisman)stack.getItem()).getBlock(stack), Blocks.air) && ((ItemBlackHoleTalisman)stack.getItem()).getBlock(stack) != null;
if(hasBlock) {
if(this.getItemForSlot(halo, segment) != null)
return halo;
this.setItemSlot(halo, stack, segment);
if(player.inventory.getStackInSlot(i).stackSize > 1)
player.inventory.getStackInSlot(i).stackSize =- 1;
else
player.inventory.setInventorySlotContents(i, null);
return halo;
}
}
}
return halo;
}
public void onUpdate(ItemStack halo, World world, Entity entity, int pos, boolean equipped) {
boolean eqLastTick = wasEquipped(halo);
if(!equipped && eqLastTick)
setEquipped(halo, equipped);
if (!eqLastTick && equipped && entity instanceof EntityLivingBase) {
setEquipped(halo, equipped);
int angles = 360;
int segAngles = angles / 12;
float shift = (segAngles / 2);
setRotationBase(halo, getCheckingAngle((EntityLivingBase)entity) - shift);
}
if(world.isRemote)
return;
else if(!(entity.ticksExisted % 10 == 0))
return;
for(int i = 0; i < 12; i++) {
ItemStack stack = this.getItemForSlot(halo, i);
if(stack != null) {
((ItemBlackHoleTalisman)stack.getItem()).onUpdate(stack, world, entity, pos, equipped);
}
}
}
public boolean onItemUse(ItemStack halo, EntityPlayer player, World world, int par4, int par5, int par6, int par7, float par8, float par9, float par10) {
for(int i = 0; i < 12; i++) {
ItemStack tal = this.getItemForSlot(halo, i);
if(tal == null)
continue;
ItemBlackHoleTalisman talisman = (ItemBlackHoleTalisman)tal.getItem();
Block bBlock = talisman.getBlock(tal);
int bmeta = talisman.getBlockMeta(tal);
TileEntity tile = world.getTileEntity(par4, par5, par6);
if (tile != null && tile instanceof IInventory) {
IInventory inv = (IInventory)tile;
int[] slots = (inv instanceof ISidedInventory) ? ((ISidedInventory)inv).getAccessibleSlotsFromSide(par7) : InventoryHelper.buildSlotsForLinearInventory(inv);
for (int slot : slots) {
ItemStack stackInSlot = inv.getStackInSlot(slot);
if (stackInSlot == null) {
ItemStack stack = new ItemStack(bBlock, 1, bmeta);
int maxSize = stack.getMaxStackSize();
stack.stackSize = talisman.remove(tal, maxSize);
if (stack.stackSize != 0 && inv.isItemValidForSlot(slot, stack) && (!(inv instanceof ISidedInventory) || ((ISidedInventory)inv).canInsertItem(slot, stack, par7))) {
inv.setInventorySlotContents(slot, stack);
inv.markDirty();
}
} else if (stackInSlot.getItem() == Item.getItemFromBlock(bBlock) && stackInSlot.getItemDamage() == bmeta) {
int maxSize = stackInSlot.getMaxStackSize();
int missing = maxSize - stackInSlot.stackSize;
if (inv.isItemValidForSlot(slot, stackInSlot) && (!(inv instanceof ISidedInventory) || ((ISidedInventory)inv).canInsertItem(slot, stackInSlot, par7))) {
stackInSlot.stackSize += talisman.remove(tal, missing);
inv.markDirty();
}
}
}
}
}
return true;
}
public void setItemSlot(ItemStack halo, ItemStack stack, int slot) {
NBTTagCompound cmp = new NBTTagCompound();
if(stack != null)
stack.copy().writeToNBT(cmp);
ItemNBTHelper.setCompound(halo, "itemSlot" + slot, cmp);
}
public static ItemStack getItemForSlot(ItemStack halo, int slot) {
if (slot >= 12)
return null;
NBTTagCompound cmp = ItemNBTHelper.getCompound(halo, "itemSlot" + slot, true);
if(cmp != null)
return ItemStack.loadItemStackFromNBT(cmp);
return null;
}
@SideOnly(Side.CLIENT)
public static void renderHUD(ScaledResolution resolution, EntityPlayer player, ItemStack halo) {
Minecraft mc = Minecraft.getMinecraft();
int slot = getSegmentLookedAt(halo, (EntityLivingBase)player);
GL11.glEnable(3042);
GL11.glBlendFunc(770, 771);
ItemStack stack = getItemForSlot(halo, slot);
if(stack != null) {
String name = stack.getDisplayName();
String count = "" + ((ItemBlackHoleTalisman)stack.getItem()).getBlockCount(stack);
int l = mc.fontRenderer.getStringWidth(name);
int x = resolution.getScaledWidth() / 2 - l / 2;
int y = resolution.getScaledHeight() / 2 - 65;
Gui.drawRect(x - 6, y - 6, x + l + 6, y + 43, 570425344);
Gui.drawRect(x - 4, y - 4, x + l + 4, y + 41, 570425344);
RenderHelper.enableGUIStandardItemLighting();
GL11.glEnable(32826);
RenderItem.getInstance().renderItemAndEffectIntoGUI(mc.fontRenderer, mc.renderEngine, stack, resolution.getScaledWidth() / 2 - 8, resolution.getScaledHeight() / 2 - 52);
RenderHelper.disableStandardItemLighting();
mc.fontRenderer.drawStringWithShadow(name, x, y, 16777215);
mc.fontRenderer.drawStringWithShadow(count, resolution.getScaledWidth() / 2 - mc.fontRenderer.getStringWidth(count) / 2, y + 32, 16777215);
}
}
@SideOnly(Side.CLIENT)
@SubscribeEvent
public void onRenderWorldLast(RenderWorldLastEvent event) {
EntityClientPlayerMP entityClientPlayerMP = (Minecraft.getMinecraft()).thePlayer;
ItemStack stack = entityClientPlayerMP.getCurrentEquippedItem();
if (stack != null && stack.getItem() instanceof ItemBlackHalo)
render(stack, (EntityPlayer)entityClientPlayerMP, event.partialTicks);
}
@SideOnly(Side.CLIENT)
public void render(ItemStack stack, EntityPlayer player, float partialTicks) {
Minecraft mc = Minecraft.getMinecraft();
Tessellator tess = Tessellator.instance;
Tessellator.renderingWorldRenderer = false;
GL11.glPushMatrix();
GL11.glEnable(3042);
GL11.glBlendFunc(770, 771);
float alpha = ((float)Math.sin(((ClientTickHandler.ticksInGame + partialTicks) * 0.2F)) * 0.5F + 0.5F) * 0.4F + 0.3F;
double posX = player.prevPosX + (player.posX - player.prevPosX) * partialTicks;
double posY = player.prevPosY + (player.posY - player.prevPosY) * partialTicks;
double posZ = player.prevPosZ + (player.posZ - player.prevPosZ) * partialTicks;
GL11.glTranslated(posX - RenderManager.renderPosX, posY - RenderManager.renderPosY, posZ - RenderManager.renderPosZ);
float base = getRotationBase(stack);
int angles = 360;
int segAngles = angles / 12;
float shift = base - (segAngles / 2);
float u = 1.0F;
float v = 0.25F;
float s = 3.0F;
float m = 0.8F;
float y = v * s * 2.0F;
float y0 = 0.0F;
int segmentLookedAt = getSegmentLookedAt(stack, (EntityLivingBase)player);
for (int seg = 0; seg < 12; seg++) {
boolean inside = false;
float rotationAngle = (seg + 0.5F) * segAngles + shift;
GL11.glPushMatrix();
GL11.glRotatef(rotationAngle, 0.0F, 1.0F, 0.0F);
GL11.glTranslatef(s * m, -0.75F, 0.0F);
if (segmentLookedAt == seg)
inside = true;
ItemStack slotStack = getItemForSlot(stack, seg);
if (slotStack != null) {
ItemBlackHoleTalisman talisman = (ItemBlackHoleTalisman)slotStack.getItem();
mc.renderEngine.bindTexture(TextureMap.locationBlocksTexture);
float scale = 0.6F;
GL11.glScalef(scale, scale, scale);
GL11.glRotatef(180.0F, 0.0F, 1.0F, 0.0F);
GL11.glTranslatef(0.0F, 0.6F, 0.0F);
RenderBlocks.getInstance().renderBlockAsItem(talisman.getBlock(slotStack), talisman.getBlockMeta(slotStack), 1.0F);
}
GL11.glPopMatrix();
GL11.glPushMatrix();
GL11.glRotatef(180.0F, 1.0F, 0.0F, 0.0F);
float a = alpha;
if (inside) {
a += 0.3F;
y0 = -y;
}
if (seg % 2 == 0) {
GL11.glColor4f(0.6F, 0.6F, 0.6F, a);
} else {
GL11.glColor4f(1.0F, 1.0F, 1.0F, a);
}
GL11.glDisable(2884);
mc.renderEngine.bindTexture(glowTexture);
tess.startDrawingQuads();
for (int i = 0; i < segAngles; i++) {
float ang = (i + seg * segAngles) + shift;
double xp = Math.cos(ang * Math.PI / 180.0D) * s;
double zp = Math.sin(ang * Math.PI / 180.0D) * s;
tess.addVertexWithUV(xp * m, y, zp * m, u, v);
tess.addVertexWithUV(xp, y0, zp, u, 0.0D);
xp = Math.cos((ang + 1.0F) * Math.PI / 180.0D) * s;
zp = Math.sin((ang + 1.0F) * Math.PI / 180.0D) * s;
tess.addVertexWithUV(xp, y0, zp, 0.0D, 0.0D);
tess.addVertexWithUV(xp * m, y, zp * m, 0.0D, v);
}
y0 = 0.0F;
tess.draw();
GL11.glEnable(2884);
GL11.glPopMatrix();
}
GL11.glPopMatrix();
}
private static int getSegmentLookedAt(ItemStack stack, EntityLivingBase player) {
getRotationBase(stack);
float yaw = getCheckingAngle(player, getRotationBase(stack));
int angles = 360;
int segAngles = angles / 12;
for (int seg = 0; seg < 12; seg++) {
float calcAngle = seg * segAngles;
if (yaw >= calcAngle && yaw < calcAngle + segAngles)
return seg;
}
return -1;
}
public static void setRotationBase(ItemStack stack, float rotation) {
ItemNBTHelper.setFloat(stack, "rotationBase", rotation);
}
public static float getRotationBase(ItemStack stack) {
return ItemNBTHelper.getFloat(stack, "rotationBase", 0.0F);
}
private static float getCheckingAngle(EntityLivingBase player, float base) {
float yaw = MathHelper.wrapAngleTo180_float(player.rotationYaw) + 90.0F;
int angles = 360;
int segAngles = angles / 12;
float shift = (segAngles / 2);
if (yaw < 0.0F)
yaw = 180.0F + 180.0F + yaw;
yaw -= 360.0F - base;
float angle = 360.0F - yaw + shift;
if (angle < 0.0F)
angle = 360.0F + angle;
return angle;
}
private static float getCheckingAngle(EntityLivingBase player) {
return getCheckingAngle(player, 0.0F);
}
public static void setEquipped(ItemStack stack, boolean equipped) {
ItemNBTHelper.setBoolean(stack, "equipped", equipped);
}
public static boolean wasEquipped(ItemStack stack) {
return ItemNBTHelper.getBoolean(stack, "equipped", false);
}
public boolean provideBlock(EntityPlayer player, ItemStack requestor, ItemStack halo, Block block, int meta, boolean doit) {
for(int i = 0; i < 12; i++) {
ItemStack tal = getItemForSlot(halo, i);
if(tal == null)
continue;
ItemBlackHoleTalisman talisman = (ItemBlackHoleTalisman)tal.getItem();
Block stored = talisman.getBlock(tal);
int storedMeta = talisman.getBlockMeta(tal);
if (stored == block && storedMeta == meta) {
int count = talisman.getBlockCount(tal);
if (count > 0) {
if (doit)
ItemNBTHelper.setInt(tal, "blockCount", count - 1);
return true;
}
}
}
return false;
}
public int getBlockCount(EntityPlayer player, ItemStack requestor, ItemStack halo, Block block, int meta) {
for(int i = 0; i < 12; i++) {
ItemStack tal = getItemForSlot(halo, i);
if(tal == null)
continue;
ItemBlackHoleTalisman talisman = (ItemBlackHoleTalisman)tal.getItem();
Block stored = talisman.getBlock(tal);
int storedMeta = talisman.getBlockMeta(tal);
if (stored == block && storedMeta == meta)
return talisman.getBlockCount(tal);
}
return 0;
}
}
-13
View File
@@ -1,13 +0,0 @@
package ab.common.item;
import ab.AdvancedBotany;
import net.minecraft.item.Item;
public class ItemMod extends Item {
public ItemMod(String name) {
this.setTextureName("ab:" + name);
this.setUnlocalizedName(name);
this.setCreativeTab(AdvancedBotany.tabAB);
}
}
@@ -1,16 +0,0 @@
package ab.common.item.block;
import net.minecraft.block.Block;
import net.minecraft.item.ItemBlockWithMetadata;
import net.minecraft.item.ItemStack;
public class ItemBlockBase extends ItemBlockWithMetadata {
public ItemBlockBase(Block block) {
super(block, block);
}
public String getUnlocalizedName(ItemStack stack) {
return super.getUnlocalizedName(stack) + "." + stack.getItemDamage();
}
}
@@ -1,175 +0,0 @@
package ab.common.item.equipment;
import baubles.api.BaubleType;
import baubles.api.IBauble;
import baubles.common.container.InventoryBaubles;
import baubles.common.lib.PlayerHandler;
import cpw.mods.fml.common.Optional.Interface;
import cpw.mods.fml.common.Optional.Method;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import java.util.List;
import java.util.UUID;
import ab.AdvancedBotany;
import net.minecraft.client.gui.GuiScreen;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.stats.StatBase;
import net.minecraft.util.StatCollector;
import net.minecraft.world.World;
import vazkii.botania.api.item.ICosmeticAttachable;
import vazkii.botania.api.item.IPhantomInkable;
import vazkii.botania.client.core.helper.RenderHelper;
import vazkii.botania.common.achievement.ModAchievements;
import vazkii.botania.common.core.helper.ItemNBTHelper;
import vazkii.botania.common.entity.EntityDoppleganger;
public abstract class ItemBauble extends Item implements IBauble, ICosmeticAttachable, IPhantomInkable {
public ItemBauble(String name) {
this.setMaxStackSize(1);
this.setUnlocalizedName(name);
this.setTextureName("ab:" + name);
this.setCreativeTab(AdvancedBotany.tabAB);
}
public ItemStack onItemRightClick(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer) {
if (!EntityDoppleganger.isTruePlayer((Entity)par3EntityPlayer))
return par1ItemStack;
if (canEquip(par1ItemStack, (EntityLivingBase)par3EntityPlayer)) {
InventoryBaubles baubles = PlayerHandler.getPlayerBaubles(par3EntityPlayer);
for (int i = 0; i < baubles.getSizeInventory(); i++) {
if (baubles.isItemValidForSlot(i, par1ItemStack)) {
ItemStack stackInSlot = baubles.getStackInSlot(i);
if (stackInSlot == null || ((IBauble)stackInSlot.getItem()).canUnequip(stackInSlot, (EntityLivingBase)par3EntityPlayer)) {
if (!par2World.isRemote) {
baubles.setInventorySlotContents(i, par1ItemStack.copy());
if (!par3EntityPlayer.capabilities.isCreativeMode)
par3EntityPlayer.inventory.setInventorySlotContents(par3EntityPlayer.inventory.currentItem, null);
}
if (stackInSlot != null) {
((IBauble)stackInSlot.getItem()).onUnequipped(stackInSlot, (EntityLivingBase)par3EntityPlayer);
return stackInSlot.copy();
}
break;
}
}
}
}
return par1ItemStack;
}
@SideOnly(Side.CLIENT)
public void addInformation(ItemStack par1ItemStack, EntityPlayer par2EntityPlayer, List par3List, boolean par4) {
if (GuiScreen.isShiftKeyDown()) {
addHiddenTooltip(par1ItemStack, par2EntityPlayer, par3List, par4);
} else {
addStringToTooltip(StatCollector.translateToLocal("botaniamisc.shiftinfo"), par3List);
}
}
public void addHiddenTooltip(ItemStack par1ItemStack, EntityPlayer par2EntityPlayer, List<String> par3List, boolean par4) {
BaubleType type = getBaubleType(par1ItemStack);
addStringToTooltip(StatCollector.translateToLocal("botania.baubletype." + type.name().toLowerCase()), par3List);
String key = RenderHelper.getKeyDisplayString("Baubles Inventory");
if (key != null)
addStringToTooltip(StatCollector.translateToLocal("botania.baubletooltip").replaceAll("%key%", key), par3List);
ItemStack cosmetic = getCosmeticItem(par1ItemStack);
if (cosmetic != null)
addStringToTooltip(String.format(StatCollector.translateToLocal("botaniamisc.hasCosmetic"), new Object[] { cosmetic.getDisplayName() }), par3List);
if (hasPhantomInk(par1ItemStack))
addStringToTooltip(StatCollector.translateToLocal("botaniamisc.hasPhantomInk"), par3List);
}
void addStringToTooltip(String s, List tooltip) {
tooltip.add(s.replaceAll("&", "\u00A7"));
}
public boolean canEquip(ItemStack stack, EntityLivingBase player) {
return true;
}
public boolean canUnequip(ItemStack stack, EntityLivingBase player) {
return true;
}
public void onWornTick(ItemStack stack, EntityLivingBase player) {
if (getLastPlayerHashcode(stack) != player.hashCode()) {
onEquippedOrLoadedIntoWorld(stack, player);
setLastPlayerHashcode(stack, player.hashCode());
}
}
public void onEquipped(ItemStack stack, EntityLivingBase player) {
if (player != null) {
if (!player.worldObj.isRemote)
player.worldObj.playSoundAtEntity((Entity)player, "botania:equipBauble", 0.1F, 1.3F);
if (player instanceof EntityPlayer)
((EntityPlayer)player).addStat((StatBase)ModAchievements.baubleWear, 1);
onEquippedOrLoadedIntoWorld(stack, player);
setLastPlayerHashcode(stack, player.hashCode());
}
}
public void onEquippedOrLoadedIntoWorld(ItemStack stack, EntityLivingBase player) {}
public void onUnequipped(ItemStack stack, EntityLivingBase player) {}
public ItemStack getCosmeticItem(ItemStack stack) {
NBTTagCompound cmp = ItemNBTHelper.getCompound(stack, "cosmeticItem", true);
if (cmp == null)
return null;
return ItemStack.loadItemStackFromNBT(cmp);
}
public void setCosmeticItem(ItemStack stack, ItemStack cosmetic) {
NBTTagCompound cmp = new NBTTagCompound();
if (cosmetic != null)
cosmetic.writeToNBT(cmp);
ItemNBTHelper.setCompound(stack, "cosmeticItem", cmp);
}
public boolean hasContainerItem(ItemStack stack) {
return (getContainerItem(stack) != null);
}
public ItemStack getContainerItem(ItemStack itemStack) {
return getCosmeticItem(itemStack);
}
public boolean doesContainerItemLeaveCraftingGrid(ItemStack p_77630_1_) {
return false;
}
public static UUID getBaubleUUID(ItemStack stack) {
long most = ItemNBTHelper.getLong(stack, "baubleUUIDMost", 0L);
if (most == 0L) {
UUID uuid = UUID.randomUUID();
ItemNBTHelper.setLong(stack, "baubleUUIDMost", uuid.getMostSignificantBits());
ItemNBTHelper.setLong(stack, "baubleUUIDLeast", uuid.getLeastSignificantBits());
return getBaubleUUID(stack);
}
long least = ItemNBTHelper.getLong(stack, "baubleUUIDLeast", 0L);
return new UUID(most, least);
}
public static int getLastPlayerHashcode(ItemStack stack) {
return ItemNBTHelper.getInt(stack, "playerHashcode", 0);
}
public static void setLastPlayerHashcode(ItemStack stack, int hash) {
ItemNBTHelper.setInt(stack, "playerHashcode", hash);
}
public boolean hasPhantomInk(ItemStack stack) {
return ItemNBTHelper.getBoolean(stack, "phantomInk", false);
}
public void setPhantomInk(ItemStack stack, boolean ink) {
ItemNBTHelper.setBoolean(stack, "phantomInk", ink);
}
}
@@ -1,162 +0,0 @@
package ab.common.item.equipment;
import java.util.List;
import ab.AdvancedBotany;
import ab.common.entity.EntityManaVine;
import net.minecraft.client.particle.EntityFX;
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.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.AxisAlignedBB;
import net.minecraft.world.World;
import vazkii.botania.api.mana.IManaItem;
import vazkii.botania.api.mana.IManaTooltipDisplay;
import vazkii.botania.api.mana.IManaUsingItem;
import vazkii.botania.api.mana.ManaItemHandler;
import vazkii.botania.common.core.helper.ItemNBTHelper;
public class ItemFreyrSlingshot extends Item implements IManaItem, IManaTooltipDisplay, IManaUsingItem {
protected static final int MAX_MANA = 150000;
private static final String TAG_MANA = "mana";
public ItemFreyrSlingshot() {
this.setMaxStackSize(1);
this.setCreativeTab(AdvancedBotany.tabAB);
this.setUnlocalizedName("item.freyr_slingshot");
this.setTextureName("ab:freyr_slingshot");
this.setMaxDamage(1000);
}
@Override
public void onUpdate(ItemStack stack, World world, Entity player, int par4, boolean par5) {
if(!world.isRemote && player instanceof EntityPlayer && stack.getItemDamage() > 0 && ManaItemHandler.requestManaExactForTool(stack, (EntityPlayer) player, 1500, true))
this.addMana(stack, 1000);
}
@Override
public void onPlayerStoppedUsing(ItemStack stack, World world, EntityPlayer player, int par4) {
int j = getMaxItemUseDuration(stack) - par4;
float f = j / 20.0F;
f = (f * f + f * 2.0F) / 3.0F;
if(f < 1F)
return;
if(!world.isRemote) {
EntityManaVine ball = new EntityManaVine(player.worldObj, (EntityLivingBase)player);
ball.motionX *= 0.6;
ball.motionY *= 0.6;
ball.motionZ *= 0.6;
world.spawnEntityInWorld(ball);
}
this.subMana(stack, 5000);
}
@Override
public ItemStack onItemRightClick(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer) {
if(this.getMana(par1ItemStack) >= 5000)
par3EntityPlayer.setItemInUse(par1ItemStack, getMaxItemUseDuration(par1ItemStack));
return par1ItemStack;
}
@Override
public int getMaxItemUseDuration(ItemStack par1ItemStack) {
return 42000;
}
@Override
public ItemStack onEaten(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer) {
return par1ItemStack;
}
@Override
public int getEntityLifespan(ItemStack itemStack, World world) {
return Integer.MAX_VALUE;
}
@Override
public int getDamage(ItemStack stack) {
float mana = getMana(stack);
return 1000 - (int) (mana / getMaxMana(stack) * 1000);
}
@Override
public EnumAction getItemUseAction(ItemStack par1ItemStack) {
return EnumAction.bow;
}
@Override
public int getDisplayDamage(ItemStack stack) {
return getDamage(stack);
}
public static void setMana(ItemStack stack, int mana) {
ItemNBTHelper.setInt(stack, TAG_MANA, mana);
}
@Override
public void addMana(ItemStack stack, int mana) {
setMana(stack, Math.min(getMana(stack) + mana, getMaxMana(stack)));
stack.setItemDamage(getDamage(stack));
}
public void subMana(ItemStack stack, int mana) {
setMana(stack, Math.max(getMana(stack) - mana, 0));
stack.setItemDamage(getDamage(stack));
}
@Override
public boolean canExportManaToItem(ItemStack arg0, ItemStack arg1) {
return false;
}
@Override
public boolean canExportManaToPool(ItemStack arg0, TileEntity arg1) {
return false;
}
@Override
public boolean canReceiveManaFromItem(ItemStack arg0, ItemStack arg1) {
return true;
}
@Override
public boolean canReceiveManaFromPool(ItemStack arg0, TileEntity arg1) {
return true;
}
@Override
public int getMana(ItemStack stack) {
return ItemNBTHelper.getInt(stack, TAG_MANA, 0);
}
@Override
public int getMaxMana(ItemStack arg0) {
return MAX_MANA;
}
@Override
public boolean isNoExport(ItemStack arg0) {
return true;
}
@Override
public float getManaFractionForDisplay(ItemStack stack) {
return (float) getMana(stack) / (float) getMaxMana(stack);
}
@Override
public boolean usesMana(ItemStack stack) {
return true;
}
}
@@ -1,30 +0,0 @@
package ab.common.item.equipment;
import ab.AdvancedBotany;
import ab.api.AdvancedBotanyAPI;
import baubles.api.BaubleType;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import vazkii.botania.api.mana.IManaGivingItem;
import vazkii.botania.api.mana.ManaItemHandler;
public class ItemManaFlower extends ItemBauble implements IManaGivingItem {
public ItemManaFlower() {
super("manaFlower");
this.setCreativeTab(AdvancedBotany.tabAB);
this.setNoRepair();
}
public void onWornTick(ItemStack stack, EntityLivingBase player) {
super.onWornTick(stack, player);
if (player instanceof EntityPlayer && player.ticksExisted % 5 == 0)
ManaItemHandler.dispatchManaExact(stack, (EntityPlayer)player, 54, true);
}
public BaubleType getBaubleType(ItemStack stack) {
return BaubleType.BELT;
}
}
@@ -1,80 +0,0 @@
package ab.common.item.equipment;
import java.util.Set;
import ab.AdvancedBotany;
import ab.api.AdvancedBotanyAPI;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import net.minecraft.block.Block;
import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.entity.Entity;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.init.Blocks;
import net.minecraft.item.ItemStack;
import net.minecraft.item.ItemTool;
import net.minecraft.util.IIcon;
import net.minecraft.world.World;
import net.minecraftforge.common.ForgeHooks;
import vazkii.botania.common.core.helper.ItemNBTHelper;
public class ItemMithrillMultiTool extends ItemTool {
IIcon iconTool;
IIcon iconOverlay;
public ItemMithrillMultiTool() {
super(0.0f, AdvancedBotanyAPI.mithrilToolMaterial, null);
this.setCreativeTab(AdvancedBotany.tabAB);
this.setUnlocalizedName("mithrillMultiTool");
}
public boolean canHarvestBlock(Block block, ItemStack stack) {
return (block != Blocks.bedrock);
}
public boolean func_150897_b(Block block) {
return true;
}
public float getDigSpeed(ItemStack stack, Block block, int meta) {
if(this.isEnabled(stack))
return super.getDigSpeed(stack, block, meta) + 135.0f;
else
return 0.0f;
}
public float func_150893_a(ItemStack stack, Block block) {
return 135.0f;
}
public ItemStack onItemRightClick(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer) {
setEnabled(par1ItemStack, !isEnabled(par1ItemStack));
if (!par2World.isRemote)
par2World.playSoundAtEntity((Entity)par3EntityPlayer, "botania:terraPickMode", 0.5F, 0.4F);
return par1ItemStack;
}
public boolean requiresMultipleRenderPasses() {
return true;
}
@SideOnly(Side.CLIENT)
public void registerIcons(IIconRegister ir) {
this.iconTool = ir.registerIcon("ab:item.mithrillMultiTool");
this.iconOverlay = ir.registerIcon("ab:item.mithrillMultiTool.overlay");
}
@SideOnly(Side.CLIENT)
public IIcon getIcon(ItemStack stack, int pass) {
return pass == 1 ? (isEnabled(stack) ? iconOverlay : iconTool) : iconTool;
}
boolean isEnabled(ItemStack stack) {
return ItemNBTHelper.getBoolean(stack, "enabled", false);
}
void setEnabled(ItemStack stack, boolean enabled) {
ItemNBTHelper.setBoolean(stack, "enabled", enabled);
}
}
@@ -1,84 +0,0 @@
package ab.common.item.equipment;
import java.util.List;
import baubles.api.BaubleType;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.world.World;
import vazkii.botania.api.mana.IManaItem;
import vazkii.botania.api.mana.IManaTooltipDisplay;
import vazkii.botania.common.core.helper.ItemNBTHelper;
public class ItemMithrillRing extends ItemBauble implements IManaItem, IManaTooltipDisplay {
public ItemMithrillRing(String name) {
super(name);
this.setMaxDamage(1000);
this.setNoRepair();
}
public BaubleType getBaubleType(ItemStack stack) {
return BaubleType.RING;
}
public void getSubItems(Item par1, CreativeTabs par2CreativeTabs, List par3List) {
par3List.add(new ItemStack(par1, 1, 10000));
}
public int getDamage(ItemStack stack) {
float mana = getMana(stack);
return 1000 - (int)(mana / getMaxMana(stack) * 1000.0F);
}
public int getDisplayDamage(ItemStack stack) {
return getDamage(stack);
}
public int getEntityLifespan(ItemStack itemStack, World world) {
return Integer.MAX_VALUE;
}
public static void setMana(ItemStack stack, int mana) {
ItemNBTHelper.setInt(stack, "mana", mana);
}
public int getMana(ItemStack stack) {
return ItemNBTHelper.getInt(stack, "mana", 0);
}
public int getMaxMana(ItemStack stack) {
return 8000000;
}
public void addMana(ItemStack stack, int mana) {
setMana(stack, Math.min(getMana(stack) + mana, getMaxMana(stack)));
stack.setItemDamage(getDamage(stack));
}
public boolean canReceiveManaFromPool(ItemStack stack, TileEntity pool) {
return true;
}
public boolean canReceiveManaFromItem(ItemStack stack, ItemStack otherStack) {
return true;
}
public boolean canExportManaToPool(ItemStack stack, TileEntity pool) {
return true;
}
public boolean canExportManaToItem(ItemStack stack, ItemStack otherStack) {
return true;
}
public boolean isNoExport(ItemStack stack) {
return false;
}
public float getManaFractionForDisplay(ItemStack stack) {
return getMana(stack) / getMaxMana(stack);
}
}
@@ -1,46 +0,0 @@
package ab.common.item.equipment;
import ab.common.entity.EntityNebulaBlaze;
import ab.common.item.ItemMod;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.EnumAction;
import net.minecraft.item.ItemStack;
import net.minecraft.world.World;
import vazkii.botania.api.mana.IManaUsingItem;
import vazkii.botania.api.mana.ManaItemHandler;
public class ItemNebulaBlaze extends ItemMod implements IManaUsingItem {
public ItemNebulaBlaze() {
super("nebulaBlaze");
this.setMaxStackSize(1);
}
public ItemStack onItemRightClick(ItemStack stack, World world, EntityPlayer player) {
player.setItemInUse(stack, this.getMaxItemUseDuration(stack));
return stack;
}
public void onUsingTick(ItemStack stack, EntityPlayer player, int count) {
if(player.worldObj.isRemote)
return;
else if(count % 7 == 4 && ManaItemHandler.requestManaExactForTool(stack, player, 125, true)) {
EntityNebulaBlaze blaze = new EntityNebulaBlaze(player.worldObj, player);
player.worldObj.spawnEntityInWorld(blaze);
}
}
public EnumAction getItemUseAction(ItemStack stack) {
return EnumAction.block;
}
public int getMaxItemUseDuration(ItemStack stack) {
return 72000;
}
public boolean usesMana(ItemStack stack) {
return true;
}
}
@@ -1,19 +0,0 @@
package ab.common.item.equipment;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.world.World;
public class ItemNebulaRing extends ItemMithrillRing {
public ItemNebulaRing(String name) {
super(name);
this.setMaxDamage(1000);
this.setNoRepair();
}
public int getMaxMana(ItemStack stack) {
return 48000000;
}
}
@@ -1,321 +0,0 @@
package ab.common.item.equipment;
import java.awt.Color;
import java.util.List;
import java.util.UUID;
import com.google.common.collect.Multimap;
import ab.AdvancedBotany;
import ab.api.AdvancedBotanyAPI;
import ab.api.IRankItem;
import cpw.mods.fml.relauncher.ReflectionHelper;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.GuiScreen;
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.SharedMonsterAttributes;
import net.minecraft.entity.ai.attributes.AttributeModifier;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.projectile.EntityThrowable;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.item.ItemSword;
import net.minecraft.potion.Potion;
import net.minecraft.potion.PotionEffect;
import net.minecraft.server.MinecraftServer;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.AxisAlignedBB;
import net.minecraft.util.DamageSource;
import net.minecraft.util.EnumChatFormatting;
import net.minecraft.util.IIcon;
import net.minecraft.util.MathHelper;
import net.minecraft.util.MovingObjectPosition;
import net.minecraft.util.StatCollector;
import net.minecraft.util.Vec3;
import net.minecraft.world.World;
import vazkii.botania.api.internal.IManaBurst;
import vazkii.botania.api.mana.BurstProperties;
import vazkii.botania.api.mana.ILensEffect;
import vazkii.botania.api.mana.IManaItem;
import vazkii.botania.api.mana.IManaUsingItem;
import vazkii.botania.api.mana.ManaItemHandler;
import vazkii.botania.common.Botania;
import vazkii.botania.common.core.helper.ItemNBTHelper;
import vazkii.botania.common.entity.EntityManaBurst;
public class ItemSpaceBlade extends ItemSword implements IRankItem, ILensEffect, IManaUsingItem {
private static final IIcon[] icons = new IIcon[3];
private static final int recharge = 36;
public static final int[] LEVELS = new int[] { 0, 10000, 1000000, 10000000, 100000000, 1000000000 };
private static final int[] CREATIVE_MANA = new int[] { 9999, 999999, 9999999, 99999999, 999999999, 2147483646 };
public ItemSpaceBlade() {
super(AdvancedBotanyAPI.mithrilToolMaterial);
this.setCreativeTab(AdvancedBotany.tabAB);
this.setUnlocalizedName("spaceBlade");
}
public void getSubItems(Item item, CreativeTabs tab, List list) {
for (int mana : CREATIVE_MANA) {
ItemStack stack = new ItemStack(item);
setMana(stack, mana);
list.add(stack);
}
}
public boolean onLeftClickEntity(ItemStack stack, EntityPlayer player, Entity entity) {
if(!player.worldObj.isRemote) {
ItemNBTHelper.setInt(stack, "postAttackTick", 3);
if(this.getLevel(stack) >= 3 && this.isEnabledMode(stack)) {
float size = this.getLevel(stack) >= 4 ? (this.getLevel(stack) >= 5 ? 3.2f : 2.2f) : 1.2f;
AxisAlignedBB axis = AxisAlignedBB.getBoundingBox(entity.posX, entity.posY, entity.posZ, entity.lastTickPosX, entity.lastTickPosY, entity.lastTickPosZ).expand(size, 1.0f, size);
List<EntityLivingBase> entities = entity.worldObj.getEntitiesWithinAABB(EntityLivingBase.class, axis);
for (EntityLivingBase living : entities) {
if (living instanceof EntityPlayer && (((EntityPlayer)living).getCommandSenderName().equals(player.getCommandSenderName()) || (MinecraftServer.getServer() != null && !MinecraftServer.getServer().isPVPEnabled())))
continue;
if (living.hurtTime == 0) {
float damage = 4.0F + AdvancedBotanyAPI.mithrilToolMaterial.getDamageVsEntity();
living.attackEntityFrom(DamageSource.causePlayerDamage(player), damage);
}
}
}
}
return super.onLeftClickEntity(stack, player, entity);
}
public void onUpdate(ItemStack stack, World world, Entity entity, int par4, boolean par5) {
int tick = ItemNBTHelper.getInt(stack, "tick", 0);
if(tick > 0)
ItemNBTHelper.setInt(stack, "tick", tick - 1);
if(!world.isRemote) {
int postAttackTick = ItemNBTHelper.getInt(stack, "postAttackTick", 0);
if(postAttackTick > 0)
ItemNBTHelper.setInt(stack, "postAttackTick", postAttackTick - 1);
if(entity instanceof EntityPlayer) {
EntityPlayer player = (EntityPlayer)entity;
PotionEffect haste = player.getActivePotionEffect(Potion.digSpeed);
float check = (haste == null) ? 0.16666667F : ((haste.getAmplifier() == 1) ? 0.5F : 0.4F);
if(player.getCurrentEquippedItem() == stack && player.swingProgress == check && this.getLevel(stack) >= 1 && postAttackTick == 0 && ManaItemHandler.requestManaExactForTool(stack, player, 120, true)) {
EntityManaBurst burst = getBurst(player, stack);
world.spawnEntityInWorld((Entity)burst);
}
}
} else {
if(tick > 0 && par5) {
for(int i = 0; i < 9; i++) {
float r = world.rand.nextBoolean() ? (225.0f / 255.0f) : (101.0f / 255.0f);
float g = world.rand.nextBoolean() ? (67.0f / 255.0f) : (209.0f / 255.0f);
float b = world.rand.nextBoolean() ? (240.0f / 255.0f) : (225.0f / 255.0f);
Botania.proxy.sparkleFX(world, entity.posX + (Math.random() - 0.5D), entity.posY + (Math.random() - 0.5D) - 0.4f, entity.posZ + (Math.random() - 0.5D), r + (float)(Math.random() / 4 - 0.125D), g + (float)(Math.random() / 4 - 0.125D), b + (float)(Math.random() / 4 - 0.125D), 1.2F * (float)(Math.random() - 0.5D), 2);
}
}
}
}
public ItemStack onItemRightClick(ItemStack stack, World world, EntityPlayer player) {
if(!player.isUsingItem() && !player.isSneaking() && ItemNBTHelper.getInt(stack, "tick", 0) == 0 && this.getLevel(stack) >= 2) {
double posX = player.posX;
double posY = player.posY;
double posZ = player.posZ;
Vec3 vec3 = player.getLook(1.0F).normalize();
player.motionX += vec3.xCoord * 2.5f;
player.motionY += (vec3.yCoord / 1.8f);
player.motionZ += vec3.zCoord * 2.5f;
ItemNBTHelper.setInt(stack, "tick", recharge);
return stack;
}
else if(player.isSneaking() && this.getLevel(stack) >= 3) {
ItemNBTHelper.setBoolean(stack, "isEnabledMode", !this.isEnabledMode(stack));
}
return super.onItemRightClick(stack, world, player);
}
public EntityManaBurst getBurst(EntityPlayer player, ItemStack stack) {
EntityManaBurst burst = new EntityManaBurst(player);
float motionModifier = 8.0F;
burst.setColor(player.worldObj.rand.nextBoolean() ? 0x78dde6 : 0xe143f0);
burst.setMana(100);
burst.setStartingMana(100);
burst.setMinManaLoss(40);
burst.setManaLossPerTick(5.0F);
burst.setGravity(0.0F);
burst.setMotion(burst.motionX * motionModifier, burst.motionY * motionModifier, burst.motionZ * motionModifier);
ItemStack lens = stack.copy();
ItemNBTHelper.setString(lens, "attackerUsername", player.getCommandSenderName());
burst.setSourceLens(lens);
return burst;
}
public void addInformation(ItemStack stack, EntityPlayer par2EntityPlayer, List list, boolean par4) {
String rankFormat = StatCollector.translateToLocal("botaniamisc.toolRank");
String rank = StatCollector.translateToLocal("botania.rank" + getLevel(stack));
list.add(String.format(rankFormat, new Object[] { rank }).replaceAll("&", "\u00A7"));
if (getMana(stack) == Integer.MAX_VALUE)
list.add(EnumChatFormatting.DARK_AQUA + StatCollector.translateToLocal("abmisc.swordFull"));
if (GuiScreen.isShiftKeyDown()) {
int level = (getLevel(stack));
list.add((level >= 1 ? EnumChatFormatting.GREEN : "") + StatCollector.translateToLocal("abmisc.swordInfo.1"));
list.add((level >= 2 ? EnumChatFormatting.GREEN : "") + StatCollector.translateToLocal("abmisc.swordInfo.2"));
list.add((level >= 3 ? EnumChatFormatting.GREEN : "") + StatCollector.translateToLocal(("abmisc.swordInfo.LEVEL").replaceAll("LEVEL", "" + (level >= 3 ? level : 3))));
} else {
if(this.getLevel(stack) != 0)
list.add(StatCollector.translateToLocal("botaniamisc.shiftinfo").replaceAll("&", "\u00A7"));
}
}
public int getEntityLifespan(ItemStack itemStack, World world) {
return Integer.MAX_VALUE;
}
@SideOnly(Side.CLIENT)
public int getColorFromItemStack(ItemStack stack, int par2) {
return (par2 == 1) ? Color.HSBtoRGB(0.836F, 1.0f - (float)getDurabilityForDisplay(stack), 1.0F) : 16777215;
}
public boolean requiresMultipleRenderPasses() {
return true;
}
@SideOnly(Side.CLIENT)
public boolean showDurabilityBar(ItemStack stack) {
return ItemNBTHelper.getInt(stack, "tick", 0) != 0;
}
@SideOnly(Side.CLIENT)
public double getDurabilityForDisplay(ItemStack stack) {
int tick = ItemNBTHelper.getInt(stack, "tick", 0);
return (double)(tick) / (double)recharge;
}
@SideOnly(Side.CLIENT)
public void registerIcons(IIconRegister ir) {
this.icons[0] = ir.registerIcon("ab:itemMithrillSword_mode_0");
this.icons[1] = ir.registerIcon("ab:itemMithrillSword_gem");
this.icons[2] = ir.registerIcon("ab:itemMithrillSword_mode_1");
}
@SideOnly(Side.CLIENT)
public IIcon getIcon(ItemStack stack, int pass) {
int iconID = Math.min(1, pass);
if(isEnabledMode(stack) && iconID == 0) {
iconID = 2;
}
return this.icons[iconID];
}
private boolean isEnabledMode(ItemStack stack) {
return ItemNBTHelper.getBoolean(stack, "isEnabledMode", false);
}
public int[] getLevels() {
return LEVELS;
}
public int getLevel(ItemStack stack) {
int mana = getMana_(stack);
for (int i = LEVELS.length - 1; i > 0; i--) {
if (mana >= LEVELS[i])
return i;
}
return 0;
}
public static int getMana_(ItemStack stack) {
return ItemNBTHelper.getInt(stack, "mana", 0);
}
public static void setMana(ItemStack stack, int mana) {
ItemNBTHelper.setInt(stack, "mana", mana);
}
public void addMana(ItemStack stack, int mana) {
setMana(stack, Math.min(getMana(stack) + mana, 2147483647));
}
public boolean canExportManaToItem(ItemStack stack, ItemStack stack1) {
return false;
}
public boolean canExportManaToPool(ItemStack stack, TileEntity tile) {
return false;
}
public boolean canReceiveManaFromItem(ItemStack stack, ItemStack otherStack) {
return !(otherStack.getItem() instanceof vazkii.botania.api.mana.IManaGivingItem);
}
public boolean canReceiveManaFromPool(ItemStack stack, TileEntity tile) {
return true;
}
public int getMana(ItemStack stack) {
return getMana_(stack);
}
public int getMaxMana(ItemStack stack) {
return Integer.MAX_VALUE;
}
public boolean isNoExport(ItemStack stack) {
return true;
}
public void apply(ItemStack stack, BurstProperties burst) {}
public boolean collideBurst(IManaBurst burst, MovingObjectPosition pos, boolean isManaBlock, boolean dead, ItemStack stack) {
return dead;
}
public boolean doParticles(IManaBurst burst, ItemStack stack) {
return true;
}
public void updateBurst(IManaBurst burst, ItemStack stack) {
EntityThrowable entity = (EntityThrowable)burst;
String attacker = ItemNBTHelper.getString(burst.getSourceLens(), "attackerUsername", "");
AxisAlignedBB axis = AxisAlignedBB.getBoundingBox(entity.posX, entity.posY, entity.posZ, entity.lastTickPosX, entity.lastTickPosY, entity.lastTickPosZ).expand(1.0D, 1.0D, 1.0D);
List<EntityLivingBase> entities = entity.worldObj.getEntitiesWithinAABB(EntityLivingBase.class, axis);
for (EntityLivingBase living : entities) {
if (living instanceof EntityPlayer && (((EntityPlayer)living).getCommandSenderName().equals(attacker) || (MinecraftServer.getServer() != null && !MinecraftServer.getServer().isPVPEnabled())))
continue;
if (living.hurtTime == 0) {
int cost = 33;
int mana = burst.getMana();
if (mana >= cost) {
burst.setMana(mana - cost);
float damage = getSwordDamage(stack);
if (!burst.isFake() && !entity.worldObj.isRemote) {
EntityPlayer player = living.worldObj.getPlayerEntityByName(attacker);
living.attackEntityFrom((player == null) ? DamageSource.magic : DamageSource.causePlayerDamage(player), damage);
entity.setDead();
break;
}
}
}
}
}
public boolean usesMana(ItemStack stack) {
return true;
}
private float getSwordDamage(ItemStack stack) {
int level = this.getLevel(stack);
return (float)Math.round(AdvancedBotanyAPI.mithrilToolMaterial.getDamageVsEntity() + (level * level / 1.5f));
}
public Multimap getAttributeModifiers(ItemStack stack) {
Multimap multimap = this.getItemAttributeModifiers();
multimap.clear();
multimap.put(SharedMonsterAttributes.attackDamage.getAttributeUnlocalizedName(), new AttributeModifier(field_111210_e, "Weapon modifier", getSwordDamage(stack), 0));
multimap.put(SharedMonsterAttributes.movementSpeed.getAttributeUnlocalizedName(), new AttributeModifier(field_111210_e, "Weapon speed", 0.1f, 0));
return multimap;
}
}
@@ -1,86 +0,0 @@
package ab.common.item.equipment;
import ab.AdvancedBotany;
import ab.api.AdvancedBotanyAPI;
import ab.common.lib.register.BlockListAB;
import cpw.mods.fml.common.eventhandler.Event.Result;
import net.minecraft.block.Block;
import net.minecraft.entity.Entity;
import net.minecraft.entity.item.EntityItem;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.init.Blocks;
import net.minecraft.item.ItemHoe;
import net.minecraft.item.ItemStack;
import net.minecraft.world.World;
import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.event.entity.player.UseHoeEvent;
import vazkii.botania.api.BotaniaAPI;
import vazkii.botania.api.mana.IManaUsingItem;
import vazkii.botania.api.mana.ManaItemHandler;
import vazkii.botania.common.Botania;
import vazkii.botania.common.block.ModBlocks;
import vazkii.botania.common.item.ModItems;
public class ItemTerraHoe extends ItemHoe implements IManaUsingItem {
public ItemTerraHoe() {
super(BotaniaAPI.terrasteelToolMaterial);
this.setCreativeTab(AdvancedBotany.tabAB);
this.setUnlocalizedName("terraHoe");
this.setTextureName("ab:terraHoe");
}
public boolean onItemUse(ItemStack p_77648_1_, EntityPlayer p_77648_2_, World p_77648_3_, int p_77648_4_, int p_77648_5_, int p_77648_6_, int p_77648_7_, float p_77648_8_, float p_77648_9_, float p_77648_10_) {
if (!p_77648_2_.canPlayerEdit(p_77648_4_, p_77648_5_, p_77648_6_, p_77648_7_, p_77648_1_)) {
return false;
} else {
UseHoeEvent event = new UseHoeEvent(p_77648_2_, p_77648_1_, p_77648_3_, p_77648_4_, p_77648_5_, p_77648_6_);
if (MinecraftForge.EVENT_BUS.post(event)) {
return false;
}
if (event.getResult() == Result.ALLOW) {
p_77648_1_.damageItem(1, p_77648_2_);
return true;
}
Block block = p_77648_3_.getBlock(p_77648_4_, p_77648_5_, p_77648_6_);
if (p_77648_7_ != 0 && p_77648_3_.getBlock(p_77648_4_, p_77648_5_ + 1, p_77648_6_).isAir(p_77648_3_, p_77648_4_, p_77648_5_ + 1, p_77648_6_) && (block == Blocks.grass || block == Blocks.dirt)) {
Block block1 = BlockListAB.blockTerraFarmland;
p_77648_3_.playSoundEffect((double)((float)p_77648_4_ + 0.5F), (double)((float)p_77648_5_ + 0.5F), (double)((float)p_77648_6_ + 0.5F), block1.stepSound.getStepResourcePath(), (block1.stepSound.getVolume() + 1.0F) / 2.0F, block1.stepSound.getPitch() * 0.8F);
if (p_77648_3_.isRemote) {
float velMul = 0.025F;
for (int i = 0; i < 48; i++) {
double x = (Math.random() - 0.5D) * 3.0D;
double y = Math.random() - 0.5D + 1.0D;
double z = (Math.random() - 0.5D) * 3.0D;
Botania.proxy.wispFX(p_77648_3_, p_77648_4_ + 0.5D + x, p_77648_5_ + 0.5D + y, p_77648_6_ + 0.5D + z, 0.0f, 0.4f, 0.0f, (float)Math.random() * 0.15F + 0.15F, (float)-x * velMul, (float)-y * velMul, (float)-z * velMul);
}
return true;
} else {
p_77648_3_.setBlock(p_77648_4_, p_77648_5_, p_77648_6_, block1);
p_77648_1_.damageItem(1, p_77648_2_);
return true;
}
}
else if(p_77648_2_.isSneaking() && p_77648_7_ != 0 && p_77648_3_.getBlock(p_77648_4_, p_77648_5_ + 1, p_77648_6_).isAir(p_77648_3_, p_77648_4_, p_77648_5_ + 1, p_77648_6_) && (block == ModBlocks.enchantedSoil)) {
if (p_77648_3_.isRemote)
return true;
p_77648_3_.setBlock(p_77648_4_, p_77648_5_, p_77648_6_, Blocks.dirt);
p_77648_1_.damageItem(1, p_77648_2_);
EntityItem entity = new EntityItem(p_77648_3_, p_77648_4_ + 0.5f, p_77648_5_ + 1, p_77648_6_ + 0.5f, new ItemStack(ModItems.overgrowthSeed));
p_77648_3_.spawnEntityInWorld(entity);
return true;
} else {
return false;
}
}
}
public void onUpdate(ItemStack stack, World world, Entity player, int par4, boolean par5) {
if (!world.isRemote && player instanceof EntityPlayer && stack.getItemDamage() > 0 && ManaItemHandler.requestManaExactForTool(stack, (EntityPlayer)player, 1760, true))
stack.setItemDamage(stack.getItemDamage() - 1);
}
public boolean usesMana(ItemStack stack) {
return true;
}
}
@@ -1,135 +0,0 @@
package ab.common.lib.register;
import ab.common.block.BlockABSpreader;
import ab.common.block.BlockABStorage;
import ab.common.block.BlockAgglomerationPlate;
import ab.common.block.BlockAntigravitation;
import ab.common.block.BlockCorporeaCatalyst;
import ab.common.block.BlockCorporeaInterrupter;
import ab.common.block.BlockFreyrLiana;
import ab.common.block.BlockLebethronWood;
import ab.common.block.BlockLuminousFreyrLiana;
import ab.common.block.BlockManaCharger;
import ab.common.block.BlockManaContainer;
import ab.common.block.BlockManaCrystalCube;
import ab.common.block.BlockModifiedFunnel;
import ab.common.block.BlockModifiedInterceptor;
import ab.common.block.BlockModifiedRetainer;
import ab.common.block.BlockTerraFarmland;
import ab.common.block.tile.TileABSpreader;
import ab.common.block.tile.TileAgglomerationPlate;
import ab.common.block.tile.TileCorporeaCatalyst;
import ab.common.block.tile.TileCorporeaInterrupter;
import ab.common.block.tile.TileLebethronCore;
import ab.common.block.tile.TileManaCharger;
import ab.common.block.tile.TileManaContainer;
import ab.common.block.tile.TileManaCrystalCube;
import ab.common.block.tile.TileModifiedCorporeaFunnel;
import ab.common.block.tile.TileModifiedInterceptor;
import ab.common.block.tile.TileModifiedRetainer;
import ab.common.item.block.ItemBlockBase;
import cpw.mods.fml.common.registry.GameRegistry;
import net.minecraft.block.Block;
public class BlockListAB {
public static Block blockABSpreader;
public static Block blockABPlate;
public static Block blockLebethron;
public static Block blockManaContainer;
public static Block blockABStorage;
public static Block blockManaCrystalCube;
public static Block blockTerraFarmland;
public static Block blockAntigravitation;
public static Block blockManaCharger;
public static Block blockFreyrLiana;
public static Block blockLuminousFreyrLiana;
public static BlockModifiedRetainer blockModifiedRetainer;
public static BlockModifiedInterceptor blockModifiedInterceptor;
public static BlockCorporeaCatalyst blockCorporeaCatalyst;
public static BlockModifiedFunnel blockModifiedCorporeaFunnel;
public static BlockCorporeaInterrupter blockCorporeaInterrupter;
public static int blockABSpreaderRI;
public static int blockManaContainerRI;
public static int blockManaCrystalCubeRI;
public static int blockManaChargerRI;
public static int blockCorporeaCatalystRI;
public static int blockModifiedCorporeaFunnelRI;
public static int blockModifiedCorporeaInterrupterRI;
public static int blockModifiedCorporeaInterceptorRI;
public static void init() {
initializeBlocks();
registerBlocks();
registerTileEntities();
}
private static void initializeBlocks() {
BlockListAB.blockABSpreader = new BlockABSpreader();
BlockListAB.blockABPlate = new BlockAgglomerationPlate();
BlockListAB.blockLebethron = new BlockLebethronWood();
BlockListAB.blockManaContainer = new BlockManaContainer();
BlockListAB.blockABStorage = new BlockABStorage();
BlockListAB.blockManaCrystalCube = new BlockManaCrystalCube();
BlockListAB.blockTerraFarmland = new BlockTerraFarmland();
BlockListAB.blockAntigravitation = new BlockAntigravitation();
BlockListAB.blockManaCharger = new BlockManaCharger();
//BlockListAB.blockLuminousFreyrLiana = new BlockLuminousFreyrLiana();
//BlockListAB.blockFreyrLiana = new BlockFreyrLiana();
//BlockListAB.blockModifiedCorporeaFunnel = new BlockModifiedFunnel();
//BlockListAB.blockCorporeaCatalyst = new BlockCorporeaCatalyst();
//BlockListAB.blockCorporeaInterrupter = new BlockCorporeaInterrupter();
//BlockListAB.blockModifiedInterceptor = new BlockModifiedInterceptor();
//BlockListAB.blockModifiedRetainer = new BlockModifiedRetainer();
}
private static void registerBlocks() {
GameRegistry.registerBlock(BlockListAB.blockABSpreader, "blockABSpreader");
GameRegistry.registerBlock(BlockListAB.blockABPlate, "blockABPlate");
GameRegistry.registerBlock(BlockListAB.blockManaContainer, "blockManaContainer");
GameRegistry.registerBlock(BlockListAB.blockLebethron, ItemBlockBase.class, "blockLebethron");
GameRegistry.registerBlock(BlockListAB.blockABStorage, ItemBlockBase.class, "blockABStorage");
GameRegistry.registerBlock(BlockListAB.blockManaCrystalCube, "blockManaCrystalCube");
GameRegistry.registerBlock(BlockListAB.blockTerraFarmland, "blockTerraFarmland");
GameRegistry.registerBlock(BlockListAB.blockAntigravitation, "blockAntigravitation");
GameRegistry.registerBlock(BlockListAB.blockManaCharger, "blockManaCharger");
//GameRegistry.registerBlock(BlockListAB.blockFreyrLiana, "blockFreyrLiana");
//GameRegistry.registerBlock(BlockListAB.blockLuminousFreyrLiana, "blockLuminousFreyrLiana");
//GameRegistry.registerBlock(BlockListAB.blockCorporeaCatalyst, "blockCorporeaCatalyst");
//GameRegistry.registerBlock(BlockListAB.blockModifiedCorporeaFunnel, "blockModifiedCorporeaFunnel");
}
private static void registerTileEntities() {
GameRegistry.registerTileEntity(TileABSpreader.class, "tileABSpreader");
GameRegistry.registerTileEntity(TileAgglomerationPlate.class, "tileAgglomerationPlate");
GameRegistry.registerTileEntity(TileLebethronCore.class, "tileLebethronCore");
GameRegistry.registerTileEntity(TileManaContainer.class, "tileManaContainer");
GameRegistry.registerTileEntity(TileManaCrystalCube.class, "tileManaCrystalCube");
GameRegistry.registerTileEntity(TileManaCharger.class, "tileManaCharger");
//GameRegistry.registerTileEntity(TileCorporeaCatalyst.class, "tileCorporeaCatalyst");
//GameRegistry.registerTileEntity(TileModifiedCorporeaFunnel.class, "tileModifiedCorporeaFunnel");
//GameRegistry.registerTileEntity(TileCorporeaInterrupter.class, "tileCorporeaInterrupter");
//GameRegistry.registerTileEntity(TileModifiedInterceptor.class, "tileModifiedInterceptor");
//GameRegistry.registerTileEntity(TileModifiedRetainer.class, "tileModifiedRetainer");
}
static {
BlockListAB.blockABSpreaderRI = -1;
BlockListAB.blockManaContainerRI = -1;
BlockListAB.blockManaCrystalCubeRI = -1;
BlockListAB.blockManaChargerRI = -1;
BlockListAB.blockModifiedCorporeaFunnelRI = -1;
BlockListAB.blockCorporeaCatalystRI = -1;
BlockListAB.blockModifiedCorporeaInterceptorRI = -1;
}
}
@@ -1,17 +0,0 @@
package ab.common.lib.register;
import ab.AdvancedBotany;
import ab.common.entity.EntityAdvancedSpark;
import ab.common.entity.EntityManaVine;
import ab.common.entity.EntityNebulaBlaze;
import cpw.mods.fml.common.registry.EntityRegistry;
public class EntityListAB {
public static void init() {
int id = 0;
EntityRegistry.registerModEntity(EntityAdvancedSpark.class, "ab:advancedSpark", id++, AdvancedBotany.instance, 64, 10, false);
EntityRegistry.registerModEntity(EntityNebulaBlaze.class, "ab:nebulaBlaze", id++, AdvancedBotany.instance, 64, 10, true);
EntityRegistry.registerModEntity(EntityManaVine.class, "ab:manaVineBall", id++, AdvancedBotany.instance, 64, 10, true);
}
}
@@ -1,28 +0,0 @@
package ab.common.lib.register;
import ab.common.block.subtile.ABSubTileSignature;
import ab.common.block.subtile.SubTileAncientAlphirine;
import ab.common.block.subtile.SubTileAngryMallos;
import ab.common.block.subtile.SubTileAspecolus;
import ab.common.block.subtile.SubTileDictarius;
import vazkii.botania.api.BotaniaAPI;
import vazkii.botania.api.subtile.SubTileEntity;
import vazkii.botania.common.Botania;
public class FlowerRegister {
public static void init() {
registerFlower(SubTileAncientAlphirine.class, "ancientAlphirine");
registerFlower(SubTileDictarius.class, "dictarius");
// registerFlower(SubTileAngryMallos.class, "angryMallos");
if(Botania.thaumcraftLoaded) {
registerFlower(SubTileAspecolus.class, "aspecolus");
}
}
static void registerFlower(Class <? extends SubTileEntity> subTile, String name) {
BotaniaAPI.registerSubTile(name, subTile);
BotaniaAPI.registerSubTileSignature(subTile, new ABSubTileSignature(name));
BotaniaAPI.addSubTileToCreativeMenu(name);
}
}
@@ -1,52 +0,0 @@
package ab.common.lib.register;
import ab.common.item.*;
import ab.common.item.equipment.*;
import cpw.mods.fml.common.registry.GameRegistry;
import net.minecraft.item.Item;
public class ItemListAB {
public static Item itemABResource;
public static Item itemMithrillRing;
public static Item itemMihrillMultiTool;
public static Item itemNebulaRing;
public static Item itemAdvancedSpark;
public static Item itemMithrillSword;
public static Item itemTerraHoe;
public static Item itemManaFlower;
public static Item itemBlackHalo;
public static Item itemNebulaBlaze;
public static Item itemAntigravityCharm;
public static Item itemFreyrSlingshot;
public static void init() {
ItemListAB.itemABResource = new ItemABResource();
GameRegistry.registerItem(itemABResource, "itemABResource");
ItemListAB.itemMithrillRing = new ItemMithrillRing("mithrillManaRing");
GameRegistry.registerItem(itemMithrillRing, "itemMithrillRing");
ItemListAB.itemNebulaRing = new ItemNebulaRing("nebulaManaRing");
GameRegistry.registerItem(itemNebulaRing, "itemNebulaRing");
ItemListAB.itemMihrillMultiTool = new ItemMithrillMultiTool();
GameRegistry.registerItem(itemMihrillMultiTool, "itemMihrillMultiTool");
ItemListAB.itemAdvancedSpark = new ItemAdvancedSpark();
GameRegistry.registerItem(itemAdvancedSpark, "itemAdvancedSpark");
ItemListAB.itemMithrillSword = new ItemSpaceBlade();
GameRegistry.registerItem(itemMithrillSword, "itemMithrillSword");
ItemListAB.itemTerraHoe = new ItemTerraHoe();
GameRegistry.registerItem(itemTerraHoe, "itemTerraHoe");
ItemListAB.itemManaFlower = new ItemManaFlower();
GameRegistry.registerItem(itemManaFlower, "itemManaFlower");
ItemListAB.itemBlackHalo = new ItemBlackHalo();
GameRegistry.registerItem(itemBlackHalo, "itemBlackHalo");
ItemListAB.itemNebulaBlaze = new ItemNebulaBlaze();
GameRegistry.registerItem(itemNebulaBlaze, "itemNebulaBlaze");
ItemListAB.itemAntigravityCharm = new ItemAntigravityCharm();
GameRegistry.registerItem(itemAntigravityCharm, "itemAntigravityCharm");
//ItemListAB.itemFreyrSlingshot = new ItemFreyrSlingshot();
//GameRegistry.registerItem(itemFreyrSlingshot, "itemFreyrSlingshot");
}
}
@@ -1,187 +0,0 @@
package ab.common.lib.register;
import ab.api.AdvancedBotanyAPI;
import ab.api.recipe.RecipeAdvancedPlate;
import ab.api.recipe.RecipeAncientAlphirine;
import ab.api.recipe.lexicon.AdvancedPlateCraftPage;
import ab.api.recipe.lexicon.AlphirineCraftPage;
import ab.common.block.tile.TileAgglomerationPlate;
import ab.common.block.tile.TileLebethronCore;
import cpw.mods.fml.common.registry.GameRegistry;
import net.minecraft.init.Blocks;
import net.minecraft.init.Items;
import net.minecraft.item.ItemStack;
import net.minecraft.item.crafting.CraftingManager;
import net.minecraft.item.crafting.IRecipe;
import net.minecraft.util.EnumChatFormatting;
import net.minecraftforge.oredict.ShapelessOreRecipe;
import vazkii.botania.api.BotaniaAPI;
import vazkii.botania.api.lexicon.KnowledgeType;
import vazkii.botania.api.lexicon.LexiconCategory;
import vazkii.botania.api.lexicon.LexiconEntry;
import vazkii.botania.api.lexicon.LexiconPage;
import vazkii.botania.api.recipe.RecipePetals;
import vazkii.botania.common.Botania;
import vazkii.botania.common.block.ModBlocks;
import vazkii.botania.common.item.ModItems;
import vazkii.botania.common.item.block.ItemBlockSpecialFlower;
import vazkii.botania.common.lexicon.BLexiconCategory;
import vazkii.botania.common.lexicon.BLexiconEntry;
import vazkii.botania.common.lexicon.page.PageText;
public class RecipeListAB {
public static LexiconCategory categoryForgotten;
public static RecipeAncientAlphirine lebethroneRecipe;
public static RecipeAncientAlphirine forgottenLandRecipe;
public static RecipeAncientAlphirine advancedSparkRecipe;
public static RecipeAncientAlphirine manaFlowerRecipe;
public static RecipeAdvancedPlate manaStarRecipe;
public static RecipeAdvancedPlate terrasteelRecipe;
public static RecipeAdvancedPlate mithrillRecipe;
public static RecipeAdvancedPlate nebulaRecipe;
public static RecipePetals alphirineRecipe;
public static RecipePetals dictariusRecipe;
public static RecipePetals aspecolusRecipe;
public static LexiconEntry advandedAgglomerationPlate;
public static LexiconEntry ancientAlphirine;
public static LexiconEntry lebethronWood;
public static LexiconEntry lebethronSpreader;
public static LexiconEntry mithrill;
public static LexiconEntry manaContainer;
public static LexiconEntry manaCrystalCube;
public static LexiconEntry terraHoe;
public static LexiconEntry manaRings;
public static LexiconEntry manaFlower;
public static LexiconEntry mithrillSword;
public static LexiconEntry nebula;
public static LexiconEntry blackHalo;
public static LexiconEntry antigravityCharm;
public static LexiconEntry nebulaBlaze;
public static LexiconEntry aspecolus;
public static LexiconEntry dictarius;
public static LexiconEntry manaCharger;
public static KnowledgeType forgotten;
public static void init() {
BotaniaAPI.addCategory(categoryForgotten = new BLexiconCategory("forgotten", 5));
forgotten = BotaniaAPI.registerKnowledgeType("ab_forgotten", EnumChatFormatting.BLUE, false);
lebethroneRecipe = AdvancedBotanyAPI.registerAlphirineRecipe(new ItemStack(BlockListAB.blockLebethron), new ItemStack(ModBlocks.dreamwood, 1, 0), 15);
forgottenLandRecipe = AdvancedBotanyAPI.registerAlphirineRecipe(new ItemStack(ItemListAB.itemABResource, 1, 3), new ItemStack(ModItems.manaResource, 1, 15), 75);
advancedSparkRecipe = AdvancedBotanyAPI.registerAlphirineRecipe(new ItemStack(ItemListAB.itemAdvancedSpark), new ItemStack(ModItems.spark), 11);
manaFlowerRecipe = AdvancedBotanyAPI.registerAlphirineRecipe(new ItemStack(ItemListAB.itemABResource, 1, 4), new ItemStack(ModBlocks.flower, 1, 32767), 32);
mithrillRecipe = AdvancedBotanyAPI.registerAdvancedPlateRecipe(new ItemStack(ItemListAB.itemABResource, 1, 0), new ItemStack(ModItems.manaResource, 1, 5), new ItemStack(ModBlocks.storage, 1, 0), new ItemStack(ModItems.manaResource, 1, 18), 7500000);
terrasteelRecipe = AdvancedBotanyAPI.registerAdvancedPlateRecipe(new ItemStack(ModItems.manaResource, 1, 4), new ItemStack(ModItems.manaResource, 1, 2), new ItemStack(ModItems.manaResource, 1, 0), new ItemStack(ModItems.manaResource, 1, 1), 500000);
manaStarRecipe = AdvancedBotanyAPI.registerAdvancedPlateRecipe(new ItemStack(ItemListAB.itemABResource, 1, 2), new ItemStack(ModItems.manaResource, 1, 23), new ItemStack(ModItems.manaResource, 1, 5), new ItemStack(Items.nether_star), 250000);
nebulaRecipe = AdvancedBotanyAPI.registerAdvancedPlateRecipe(new ItemStack(ItemListAB.itemABResource, 1, 5), new ItemStack(ModItems.manaResource, 1, 8), new ItemStack(ModBlocks.storage, 1, 4), new ItemStack(ItemListAB.itemABResource, 1, 1), 50000000);
ancientAlphirine = new BLexiconEntry("ancientAlphirine", categoryForgotten);
alphirineRecipe = BotaniaAPI.registerPetalRecipe(ItemBlockSpecialFlower.ofType("ancientAlphirine"), new ItemStack(ModItems.manaResource, 1, 5), new ItemStack(ModItems.manaResource, 1, 5), new ItemStack(ModItems.manaResource, 1, 5), new ItemStack(ModItems.manaResource, 1, 5), new ItemStack(ModItems.rune, 1, 8), new ItemStack(ModItems.rune, 1, 4), new ItemStack(ModItems.rune, 1, 5), new ItemStack(ModItems.rune, 1, 6), new ItemStack(ModItems.rune, 1, 7), new ItemStack(ModItems.petal, 1, 1), new ItemStack(ModItems.petal, 1, 4));
ancientAlphirine.setPriority().setKnowledgeType(BotaniaAPI.elvenKnowledge).setLexiconPages(new LexiconPage[] { new PageText("0"), new PageText("1"), BotaniaAPI.internalHandler.petalRecipePage(".petalCraft", alphirineRecipe), new AlphirineCraftPage(forgottenLandRecipe) }).setIcon(ItemBlockSpecialFlower.ofType("ancientAlphirine"));
GameRegistry.addShapedRecipe(new ItemStack(BlockListAB.blockABPlate), new Object[] { " ", "MPM", "BRB", Character.valueOf('M'), new ItemStack(ModBlocks.storage), Character.valueOf('P'), new ItemStack(ModBlocks.terraPlate), Character.valueOf('B'), new ItemStack(ItemListAB.itemABResource, 1, 3), Character.valueOf('R'), new ItemStack(ModItems.rune, 1, 3)});
advandedAgglomerationPlate = new BLexiconEntry("advancedPlate", categoryForgotten);
advandedAgglomerationPlate.setKnowledgeType(forgotten).setLexiconPages(new LexiconPage[] {new PageText("0"), BotaniaAPI.internalHandler.craftingRecipePage(".craft", getLastRecipe()), BotaniaAPI.internalHandler.multiblockPage(".structure", TileAgglomerationPlate.makeMultiblockSet()), new AdvancedPlateCraftPage(terrasteelRecipe, "0"), new AdvancedPlateCraftPage(manaStarRecipe, "1") }).setIcon(new ItemStack(BlockListAB.blockABPlate));
GameRegistry.addShapedRecipe(new ItemStack(BlockListAB.blockABSpreader), new Object[] { "WMW", "PSP", "WMW", Character.valueOf('M'), new ItemStack(ItemListAB.itemABResource, 1, 2), Character.valueOf('P'), new ItemStack(ModBlocks.pylon), Character.valueOf('S'), new ItemStack(ModBlocks.spreader, 1, 3), Character.valueOf('W'), new ItemStack(BlockListAB.blockLebethron, 1, 4)});
lebethronSpreader = new BLexiconEntry("lebethronSpreader", categoryForgotten);
lebethronSpreader.setKnowledgeType(forgotten).setLexiconPages(new LexiconPage[] { new PageText("0"), BotaniaAPI.internalHandler.craftingRecipePage(".craft", getLastRecipe()) }).setIcon(new ItemStack(BlockListAB.blockABSpreader));
addShapelessOreDictRecipe(new ItemStack(BlockListAB.blockLebethron, 4, 1), new Object[] { new ItemStack(BlockListAB.blockLebethron)});
IRecipe leb1 = getLastRecipe();
addShapelessOreDictRecipe(new ItemStack(BlockListAB.blockLebethron, 1, 2), new Object[] { new ItemStack(BlockListAB.blockLebethron, 1, 1), new ItemStack(Items.wheat_seeds)});
IRecipe leb2 = getLastRecipe();
addShapelessOreDictRecipe(new ItemStack(BlockListAB.blockLebethron, 1, 3), new Object[] { new ItemStack(BlockListAB.blockLebethron), new ItemStack(Items.glowstone_dust)});
IRecipe leb3 = getLastRecipe();
GameRegistry.addShapedRecipe(new ItemStack(BlockListAB.blockLebethron, 1, 4), new Object[] { "4W5", "WPW", "6W7", Character.valueOf('P'), new ItemStack(ModBlocks.pylon, 1, 1), Character.valueOf('W'), new ItemStack(BlockListAB.blockLebethron), Character.valueOf('4'), new ItemStack(ModItems.rune, 1, 4), Character.valueOf('5'), new ItemStack(ModItems.rune, 1, 5), Character.valueOf('6'), new ItemStack(ModItems.rune, 1, 6), Character.valueOf('7'), new ItemStack(ModItems.rune, 1, 7)});
IRecipe leb4 = getLastRecipe();
lebethronWood = new BLexiconEntry("lebethronWood", categoryForgotten);
lebethronWood.setKnowledgeType(forgotten).setLexiconPages(new LexiconPage[] { new PageText("0"), new AlphirineCraftPage(lebethroneRecipe), BotaniaAPI.internalHandler.craftingRecipePage(".craft0", leb1), BotaniaAPI.internalHandler.craftingRecipePage(".craft0", leb2), BotaniaAPI.internalHandler.craftingRecipePage(".craft0", leb3), BotaniaAPI.internalHandler.craftingRecipePage(".craft0", leb4), new PageText("1"), BotaniaAPI.internalHandler.multiblockPage(".structure", TileLebethronCore.makeMultiblockSet()) }).setIcon(new ItemStack(BlockListAB.blockLebethron));
GameRegistry.addShapedRecipe(new ItemStack(ItemListAB.itemMihrillMultiTool), new Object[] { " MB", " FM", "F ", Character.valueOf('F'), new ItemStack(ModItems.manaResource, 1, 3), Character.valueOf('B'), new ItemStack(ModBlocks.livingwood), Character.valueOf('M'), new ItemStack(ItemListAB.itemABResource)});
mithrill = new BLexiconEntry("mithrill", categoryForgotten);
mithrill.setKnowledgeType(forgotten).setLexiconPages(new LexiconPage[] { new PageText("0"), new AdvancedPlateCraftPage(mithrillRecipe), new PageText("1"), BotaniaAPI.internalHandler.craftingRecipePage(".craft", getLastRecipe()) }).setIcon(new ItemStack(ItemListAB.itemMihrillMultiTool));
GameRegistry.addShapedRecipe(new ItemStack(BlockListAB.blockManaContainer), new Object[] { "MGM", "LPL", "M3M", Character.valueOf('M'), new ItemStack(ItemListAB.itemABResource), Character.valueOf('L'), new ItemStack(ModBlocks.pool), Character.valueOf('P'), new ItemStack(ModBlocks.pylon), Character.valueOf('3'), new ItemStack(ModItems.rune, 1, 3), Character.valueOf('G'), new ItemStack(ModItems.rune, 1, 15)});
manaContainer = new BLexiconEntry("manaContainer", categoryForgotten);
manaContainer.setKnowledgeType(forgotten).setLexiconPages(new LexiconPage[] { new PageText("0"), BotaniaAPI.internalHandler.craftingRecipePage(".craft", getLastRecipe()), new PageText("1"), new AlphirineCraftPage(advancedSparkRecipe) }).setIcon(new ItemStack(BlockListAB.blockManaContainer));
GameRegistry.addShapedRecipe(new ItemStack(BlockListAB.blockManaCrystalCube), new Object[] { "TST", "GWG", "DMD", Character.valueOf('D'), new ItemStack(ModBlocks.dreamwood), Character.valueOf('W'), new ItemStack(ModItems.twigWand, 1, 32767), Character.valueOf('G'), new ItemStack(ModBlocks.manaGlass), Character.valueOf('M'), new ItemStack(ModItems.manaResource), Character.valueOf('T'), new ItemStack(ModItems.manaResource, 1, 18), Character.valueOf('S'), new ItemStack(ModItems.spark)});
manaCrystalCube = new BLexiconEntry("manaCrystalCube", BotaniaAPI.categoryMana);
manaCrystalCube.setKnowledgeType(BotaniaAPI.elvenKnowledge).setLexiconPages(new LexiconPage[] { new PageText("0"), BotaniaAPI.internalHandler.craftingRecipePage(".craft", getLastRecipe()) }).setIcon(new ItemStack(BlockListAB.blockManaCrystalCube));
GameRegistry.addShapedRecipe(new ItemStack(ItemListAB.itemTerraHoe), new Object[] { "TTL", "RW ", " W ", Character.valueOf('T'), new ItemStack(ModItems.manaResource, 1, 4), Character.valueOf('L'), new ItemStack(ModItems.manaResource, 1, 18), Character.valueOf('W'), new ItemStack(ModItems.manaResource, 1, 3), Character.valueOf('R'), new ItemStack(ModItems.rune, 1, 2)});
terraHoe = new BLexiconEntry("terraHoe", BotaniaAPI.categoryTools);
terraHoe.setLexiconPages(new LexiconPage[]{ new PageText("0"), BotaniaAPI.internalHandler.craftingRecipePage(".craft", getLastRecipe()) }).setIcon(new ItemStack(ItemListAB.itemTerraHoe));
GameRegistry.addShapedRecipe(new ItemStack(ItemListAB.itemMithrillRing), new Object[] { "LML", "MRM", "LML", Character.valueOf('M'), new ItemStack(ItemListAB.itemABResource), Character.valueOf('L'), new ItemStack(ItemListAB.itemABResource, 1, 1), Character.valueOf('R'), new ItemStack(ModItems.manaRingGreater)});
IRecipe ring1 = getLastRecipe();
GameRegistry.addShapedRecipe(new ItemStack(ItemListAB.itemNebulaRing), new Object[] { "LML", "MRM", "LML", Character.valueOf('M'), new ItemStack(ItemListAB.itemABResource, 1, 6), Character.valueOf('L'), new ItemStack(ModItems.manaResource, 1, 5), Character.valueOf('R'), new ItemStack(ItemListAB.itemMithrillRing)});
IRecipe ring2 = getLastRecipe();
manaRings = new BLexiconEntry("manaRings", categoryForgotten);
manaRings.setKnowledgeType(forgotten).setLexiconPages(new LexiconPage[]{ new PageText("0"), BotaniaAPI.internalHandler.craftingRecipePage(".craft0", ring1), BotaniaAPI.internalHandler.craftingRecipePage(".craft1", ring2)}).setIcon(new ItemStack(ItemListAB.itemMithrillRing));
AdvancedBotanyAPI.registerFarmlandSeed(Blocks.nether_wart, 3);
GameRegistry.addShapedRecipe(new ItemStack(ItemListAB.itemManaFlower), new Object[] { " F ", " M ", " R ", Character.valueOf('F'), new ItemStack(ItemListAB.itemABResource, 1, 4), Character.valueOf('M'), new ItemStack(ModItems.manaBottle), Character.valueOf('R'), new ItemStack(ModItems.rune, 1, 8)});
manaFlower = new BLexiconEntry("manaFlower", categoryForgotten);
manaFlower.setKnowledgeType(forgotten).setLexiconPages(new LexiconPage[] { new PageText("0"), new AlphirineCraftPage(manaFlowerRecipe), BotaniaAPI.internalHandler.craftingRecipePage(".craft", getLastRecipe())}).setIcon(new ItemStack(ItemListAB.itemManaFlower));
GameRegistry.addShapedRecipe(new ItemStack(ItemListAB.itemMithrillSword), new Object[] { " M", "SM ", "WS ", Character.valueOf('S'), new ItemStack(ItemListAB.itemABResource, 1, 6), Character.valueOf('T'), new ItemStack(ModItems.terraSword), Character.valueOf('M'), new ItemStack(ItemListAB.itemABResource), Character.valueOf('W'), new ItemStack(ModItems.manaResource, 1, 3)});
mithrillSword = new BLexiconEntry("mithrillSword", categoryForgotten);
mithrillSword.setKnowledgeType(forgotten).setLexiconPages(new LexiconPage[] { new PageText("0"), BotaniaAPI.internalHandler.craftingRecipePage(".craft", getLastRecipe()) }).setIcon(new ItemStack(ItemListAB.itemMithrillSword));
dictariusRecipe = BotaniaAPI.registerPetalRecipe(ItemBlockSpecialFlower.ofType("dictarius"), new ItemStack(ItemListAB.itemABResource, 1, 4), new ItemStack(ModItems.manaResource, 1, 5), new ItemStack(ModItems.manaResource, 1, 5), new ItemStack(ModItems.rune, 1, 15), new ItemStack(ModItems.petal, 1, 4), new ItemStack(ModItems.petal, 1, 4), new ItemStack(ModItems.petal, 1, 1));
dictarius = new BLexiconEntry("dictarius", BotaniaAPI.categoryGenerationFlowers);
dictarius.setKnowledgeType(forgotten).setLexiconPages(new LexiconPage[] { new PageText("0"), BotaniaAPI.internalHandler.petalRecipePage(".petalCraft", dictariusRecipe)});
nebula = new BLexiconEntry("nebula", categoryForgotten);
nebula.setKnowledgeType(forgotten).setLexiconPages(new LexiconPage[] { new PageText("0"), new AdvancedPlateCraftPage(nebulaRecipe)});
GameRegistry.addShapedRecipe(new ItemStack(ItemListAB.itemBlackHalo), new Object[] { " E ", "DHD", " E ", Character.valueOf('E'), new ItemStack(ModItems.manaResource, 1, 7), Character.valueOf('H'), new ItemStack(ModItems.autocraftingHalo), Character.valueOf('D'), new ItemStack(ModItems.blackHoleTalisman)});
blackHalo = new BLexiconEntry("blackHalo", BotaniaAPI.categoryTools);
blackHalo.setKnowledgeType(BotaniaAPI.elvenKnowledge).setLexiconPages(new LexiconPage[] { new PageText("0"), BotaniaAPI.internalHandler.craftingRecipePage(".craft", getLastRecipe())});
GameRegistry.addShapedRecipe(new ItemStack(ItemListAB.itemAntigravityCharm), new Object[] { " G ", "GDG", "ERE", Character.valueOf('E'), new ItemStack(ModItems.manaResource, 1, 7), Character.valueOf('G'), new ItemStack(ModBlocks.elfGlass), Character.valueOf('D'), new ItemStack(ModBlocks.floatingFlower, 1, 32767), Character.valueOf('R'), new ItemStack(ModItems.rune, 1, 3)});
antigravityCharm = new BLexiconEntry("antigravityCharm", BotaniaAPI.categoryTools);
antigravityCharm.setKnowledgeType(BotaniaAPI.elvenKnowledge).setLexiconPages(new LexiconPage[] { new PageText("0"), BotaniaAPI.internalHandler.craftingRecipePage(".craft", getLastRecipe())}).setIcon(new ItemStack(ItemListAB.itemAntigravityCharm));
GameRegistry.addShapedRecipe(new ItemStack(ItemListAB.itemNebulaBlaze), new Object[] { " N ", "MMN", "AMN", Character.valueOf('N'), new ItemStack(ItemListAB.itemABResource, 1, 6), Character.valueOf('A'), new ItemStack(ItemListAB.itemABResource, 1, 3), Character.valueOf('M'), new ItemStack(ModBlocks.storage)});
nebulaBlaze = new BLexiconEntry("nebulaBlaze", categoryForgotten);
nebulaBlaze.setKnowledgeType(forgotten).setLexiconPages(new LexiconPage[] { new PageText("0"), BotaniaAPI.internalHandler.craftingRecipePage(".craft", getLastRecipe())});
GameRegistry.addShapedRecipe(new ItemStack(BlockListAB.blockManaCharger), new Object[] { "NLN", "MPM", " R ", Character.valueOf('N'), new ItemStack(ItemListAB.itemABResource, 1, 1), Character.valueOf('L'), new ItemStack(ModBlocks.livingrock), Character.valueOf('M'), new ItemStack(ModBlocks.bellows), Character.valueOf('P'), new ItemStack(ModBlocks.pylon), Character.valueOf('R'), new ItemStack(ModItems.rune, 1, 8)});
manaCharger = new BLexiconEntry("manaCharger", categoryForgotten);
manaCharger.setKnowledgeType(forgotten).setLexiconPages(new LexiconPage[] { new PageText("0"), BotaniaAPI.internalHandler.craftingRecipePage(".craft", getLastRecipe())});
if(Botania.thaumcraftLoaded)
thaumcraft();
addShapelessOreDictRecipe(new ItemStack(ItemListAB.itemABResource, 9, 1), new Object[] { new ItemStack(ItemListAB.itemABResource)});
addShapelessOreDictRecipe(new ItemStack(ItemListAB.itemABResource, 9, 0), new Object[] { new ItemStack(BlockListAB.blockABStorage)});
addShapelessOreDictRecipe(new ItemStack(ItemListAB.itemABResource, 9, 6), new Object[] { new ItemStack(ItemListAB.itemABResource, 1, 5)});
GameRegistry.addShapedRecipe(new ItemStack(BlockListAB.blockABStorage), new Object[] { "III", "III", "III", Character.valueOf('I'), new ItemStack(ItemListAB.itemABResource)});
GameRegistry.addShapedRecipe(new ItemStack(ItemListAB.itemABResource, 1, 5), new Object[] { "III", "III", "III", Character.valueOf('I'), new ItemStack(ItemListAB.itemABResource, 1, 6)});
}
public static void thaumcraft() {
aspecolus = new BLexiconEntry("aspecolus", BotaniaAPI.categoryFunctionalFlowers);
aspecolusRecipe = BotaniaAPI.registerPetalRecipe(ItemBlockSpecialFlower.ofType("aspecolus"), new ItemStack(ModItems.manaResource, 1, 6), new ItemStack(ModItems.manaResource, 1, 5), new ItemStack(ModItems.rune, 1, 1), new ItemStack(ModItems.rune), new ItemStack(ItemListAB.itemABResource, 1, 2), new ItemStack(ModItems.petal, 1, 10), new ItemStack(ModItems.petal, 1, 13));
aspecolus.setKnowledgeType(forgotten).setLexiconPages(new LexiconPage[] { new PageText("0"), BotaniaAPI.internalHandler.petalRecipePage(".petalCraft", aspecolusRecipe) }).setIcon(ItemBlockSpecialFlower.ofType("aspecolus"));
}
private static IRecipe getLastRecipe() {
return (IRecipe)CraftingManager.getInstance().getRecipeList().get(CraftingManager.getInstance().getRecipeList().size() - 1);
}
private static void addShapelessOreDictRecipe(ItemStack output, Object... recipe) {
CraftingManager.getInstance().getRecipeList().add(new ShapelessOreRecipe(output, recipe));
}
}
Loaded 100 of 645 files, more files were not shown because too many files have changed in this diff. Show more