Upgraded to 1.7.2. List of currently-known issues are in CURRENT_ISSUES.txt file.

This commit is contained in:
Ken 'Minalien' Murray committed 2014-04-08 12:39:01 -07:00
1 parent 02655f092e
commit 02659b2816
227 files changed
+1350 -1222

No files matched your search

@@ -0,0 +1,123 @@
package magicbees.client.gui;
import cpw.mods.fml.common.registry.GameRegistry;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import magicbees.tileentity.TileEntityEffectJar;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.inventory.Container;
import net.minecraft.inventory.ICrafting;
import net.minecraft.inventory.Slot;
import net.minecraft.item.ItemStack;
public class ContainerEffectJar extends Container
{
public TileEntityEffectJar jar;
public int lastBeeHealth = 0;
public int speciesColour = 0xffffff;
public ContainerEffectJar(TileEntityEffectJar tileEntityEffectJar, EntityPlayer player)
{
this.jar = tileEntityEffectJar;
this.addSlotToContainer(new SlotCustomItems(this.jar, 0, 80, 22, GameRegistry.findItemStack
("forestry", "beeDroneGE", 1)));
for (int i = 0; i < 3; ++i)
{
for (int j = 0; j < 9; ++j)
{
this.addSlotToContainer(new Slot(player.inventory, j + i * 9 + 9, 8 + j * 18, 74 + i * 18));
}
}
for (int i = 0; i < 9; ++i)
{
this.addSlotToContainer(new Slot(player.inventory, i, 8 + i * 18, 132));
}
}
@Override
public void addCraftingToCrafters(ICrafting crafting)
{
super.addCraftingToCrafters(crafting);
crafting.sendProgressBarUpdate(this, 0, this.jar.currentBeeHealth);
crafting.sendProgressBarUpdate(this, 1, this.jar.currentBeeColour);
}
@Override
public void detectAndSendChanges()
{
super.detectAndSendChanges();
for (int i = 0; i < this.crafters.size(); ++i)
{
ICrafting crafting = (ICrafting)this.crafters.get(i);
if (this.lastBeeHealth != this.jar.currentBeeHealth)
{
crafting.sendProgressBarUpdate(this, 0, this.jar.currentBeeHealth);
this.lastBeeHealth = this.jar.currentBeeHealth;
}
if (this.speciesColour != this.jar.currentBeeColour)
{
crafting.sendProgressBarUpdate(this, 1, this.jar.currentBeeColour);
this.speciesColour = this.jar.currentBeeColour;
}
}
}
@Override
@SideOnly(Side.CLIENT)
public void updateProgressBar(int craftingId, int value)
{
if (craftingId == 0)
{
this.jar.currentBeeHealth = value;
}
else if (craftingId == 1)
{
this.jar.currentBeeColour = value;
}
}
@Override
public boolean canInteractWith(EntityPlayer entityplayer)
{
return this.jar.isUseableByPlayer(entityplayer);
}
@Override
public ItemStack transferStackInSlot(EntityPlayer player, int slot)
{
Slot itemSlot = this.getSlot(slot);
boolean clearSlot = false;
if (itemSlot != null && itemSlot.getHasStack())
{
ItemStack srcStack = itemSlot.getStack();
if (slot == 0 && srcStack != null)
{
clearSlot = this.mergeItemStack(srcStack, 1, 36 + 1, false);
}
else
{
if (this.getSlot(0).isItemValid(srcStack))
{
clearSlot = this.mergeItemStack(srcStack, 0, 1, false);
}
}
}
if (clearSlot)
{
itemSlot.putStack(null);
}
itemSlot.onSlotChanged();
player.inventory.markDirty();
return null;
}
}
@@ -0,0 +1,67 @@
package magicbees.client.gui;
import magicbees.main.CommonProxy;
import magicbees.tileentity.TileEntityEffectJar;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.inventory.GuiContainer;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.util.ResourceLocation;
import org.lwjgl.opengl.GL11;
public class GUIEffectJar extends GuiContainer
{
public static final String BACKGROUND_FILE = "jarScreen.png";
public static final ResourceLocation BACKGROUND_LOCATION = new ResourceLocation(CommonProxy.DOMAIN, CommonProxy.GUI_TEXTURE + "jarScreen.png");
private static final int WIDTH = 176;
private static final int HEIGHT = 156;
private static final int SLOT_JAR_X = 80;
private static final int SLOT_JAR_Y = 22;
private static final int SLOT_INVENTORY_X = 8;
private static final int SLOT_INVENTORY_Y = 74;
private static final int BAR_DEST_X = 117;
private static final int BAR_DEST_Y = 10;
private static final int BAR_SRC_X = 176;
private static final int BAR_SRC_Y = 0;
private static final int BAR_WIDTH = 10;
private static final int BAR_HEIGHT = 40;
public GUIEffectJar(TileEntityEffectJar jar, EntityPlayer player)
{
super(new ContainerEffectJar(jar, player));
this.xSize = WIDTH;
this.ySize = HEIGHT;
}
@Override
protected void drawGuiContainerForegroundLayer(int par1, int par2)
{
fontRendererObj.drawString("Inventory", 9, 63, 0);
}
@Override
protected void drawGuiContainerBackgroundLayer(float f, int i, int j)
{
GL11.glColor4f(1f, 1f, 1f, 1f);
GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_SRC_ALPHA);
this.mc.getTextureManager().bindTexture(BACKGROUND_LOCATION);
this.drawTexturedModalRect(this.guiLeft, this.guiTop, 0, 0, xSize, ySize);
TileEntityEffectJar jar = ((ContainerEffectJar)this.inventorySlots).jar;
float r = ((jar.currentBeeColour >> 16) & 255) / 255f;
float g = ((jar.currentBeeColour >> 8) & 255) / 255f;
float b = (jar.currentBeeColour & 255) / 255f;
GL11.glColor3f(r, g, b);
int value = BAR_HEIGHT - (jar.currentBeeHealth * BAR_HEIGHT) / 100;
this.drawTexturedModalRect(this.guiLeft + BAR_DEST_X, this.guiTop + value + BAR_DEST_Y, BAR_SRC_X, BAR_SRC_Y, BAR_WIDTH, BAR_HEIGHT - value);
}
}
@@ -0,0 +1,37 @@
package magicbees.client.gui;
import magicbees.tileentity.TileEntityEffectJar;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.world.World;
import cpw.mods.fml.common.network.IGuiHandler;
public class GUIHandler implements IGuiHandler
{
@Override
public Object getServerGuiElement(int ID, EntityPlayer player, World world, int x, int y, int z)
{
Object value = null;
if (ID == UIScreens.EFFECT_JAR.ordinal())
{
value = new ContainerEffectJar((TileEntityEffectJar)world.getTileEntity(x, y, z), player);
}
return value;
}
@Override
public Object getClientGuiElement(int ID, EntityPlayer player, World world, int x, int y, int z)
{
Object value = null;
if (ID == UIScreens.EFFECT_JAR.ordinal())
{
value = new GUIEffectJar((TileEntityEffectJar)world.getTileEntity(x, y, z), player);
}
return value;
}
}
@@ -0,0 +1,119 @@
package magicbees.client.gui;
import java.util.ArrayList;
import java.util.List;
import net.minecraft.inventory.IInventory;
import net.minecraft.inventory.Slot;
import net.minecraft.item.ItemStack;
import net.minecraftforge.oredict.OreDictionary;
/**
*
* @author MysteriousAges
*
*/
public class SlotCustomItems extends Slot
{
private List<ItemStack> items;
public SlotCustomItems(IInventory inventory, int slotIndex, int xPos, int yPos)
{
this(inventory, slotIndex, xPos, yPos, new ItemStack[0]);
}
public SlotCustomItems(IInventory inventory, int slotIndex, int xPos, int yPos, ItemStack... items)
{
super(inventory, slotIndex, xPos, yPos);
this.items = new ArrayList<ItemStack>();
for (ItemStack i : items)
{
this.items.add(i);
}
}
/**
*
* @return List of valid ItemStacks
*/
public List<ItemStack> getValidItems()
{
return this.items;
}
public void addValidItem(ItemStack newItem)
{
boolean contains = false;
for (int i = 0; i < this.items.size(); ++i)
{
ItemStack s = this.items.get(i);
if (s.getItem() == newItem.getItem())
{
if (s.getItemDamage() == OreDictionary.WILDCARD_VALUE)
{
contains = true;
break;
}
else if (s.getItemDamage() == newItem.getItemDamage())
{
contains = true;
break;
}
}
}
if (!contains)
{
this.items.add(newItem);
}
}
/**
*
* @param removeItem ItemStack to remove.
*/
public void removeValidItem(ItemStack removeItem)
{
for (int i = 0; i < this.items.size(); ++i)
{
ItemStack s = this.items.get(i);
if (s.getItem() == removeItem.getItem())
{
if (s.getItemDamage() == OreDictionary.WILDCARD_VALUE)
{
this.items.remove(i);
break;
}
else if (s.getItemDamage() == removeItem.getItemDamage())
{
this.items.remove(i);
break;
}
}
}
}
@Override
public boolean isItemValid(ItemStack itemStack)
{
boolean flag = false;
for (int i = 0; i < this.items.size(); ++i)
{
if (this.items.get(i).getItem() == itemStack.getItem())
{
if (this.items.get(i).getItemDamage() == itemStack.getItemDamage())
{
flag = true;
break;
}
else
{
flag = this.items.get(i).getItemDamage() ==OreDictionary.WILDCARD_VALUE;
break;
}
}
}
return flag;
}
}
@@ -0,0 +1,7 @@
package magicbees.client.gui;
public enum UIScreens
{
EFFECT_JAR,
;
}
@@ -0,0 +1,41 @@
package magicbees.client.model;
import magicbees.main.CommonProxy;
import net.minecraft.util.ResourceLocation;
import net.minecraftforge.client.model.AdvancedModelLoader;
import net.minecraftforge.client.model.IModelCustom;
import org.lwjgl.opengl.GL11;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
@SideOnly(Side.CLIENT)
public class ModelEffectJar
{
public static final String objFile = CommonProxy.MODEL_PATH + "effectJar.obj";
public static final ResourceLocation textureLocation = new ResourceLocation(CommonProxy.DOMAIN, CommonProxy.MODEL + "jarTexture.png");
public static final ModelEffectJar model = new ModelEffectJar();
private IModelCustom effectJarObj;
public ModelEffectJar()
{
this.effectJarObj = AdvancedModelLoader.loadModel(new ResourceLocation("magicbees", "model/effectJar.obj"));
}
public void render()
{
this.effectJarObj.renderPart("jarLid");
GL11.glPushAttrib(GL11.GL_ENABLE_BIT);
GL11.glEnable(GL11.GL_CULL_FACE);
GL11.glDisable(GL11.GL_LIGHTING);
GL11.glEnable(GL11.GL_BLEND);
GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
this.effectJarObj.renderPart("jarBase");
GL11.glPopAttrib();
}
}
@@ -0,0 +1,80 @@
package magicbees.client.render;
import magicbees.client.model.ModelEffectJar;
import magicbees.tileentity.TileEntityEffectJar;
import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.world.World;
import net.minecraftforge.client.IItemRenderer;
import org.lwjgl.opengl.GL11;
import cpw.mods.fml.client.FMLClientHandler;
public class EffectJarRenderer extends TileEntitySpecialRenderer implements IItemRenderer
{
public static EffectJarRenderer instance = new EffectJarRenderer();
@Override
public void renderTileEntityAt(TileEntity tileEntity, double x, double y, double z, float tick)
{
if (tileEntity instanceof TileEntityEffectJar)
{
this.doRender(x, y, z, 1f);
}
}
@Override
public boolean handleRenderType(ItemStack item, ItemRenderType type)
{
return true;
}
@Override
public boolean shouldUseRenderHelper(ItemRenderType type, ItemStack item, ItemRendererHelper helper)
{
return true;
}
@Override
public void renderItem(ItemRenderType type, ItemStack item, Object... data)
{
switch (type)
{
default:
case ENTITY:
doRender(0, 0, 0, 1.8f);
break;
case EQUIPPED:
doRender(0, 0, 0, 1.5f);
break;
case EQUIPPED_FIRST_PERSON:
doRender(-.5, .5, 0.25, 1f);
break;
case INVENTORY:
doRender(0.3, 0.25, 0.3, 1.5f);
break;
}
}
private void doRender(double x, double y, double z, float scale)
{
GL11.glPushMatrix();
GL11.glDisable(GL11.GL_LIGHTING);
GL11.glScaled(scale, scale, scale);
GL11.glTranslated(x, y, z);
FMLClientHandler.instance().getClient().renderEngine.bindTexture(ModelEffectJar.textureLocation);
ModelEffectJar.model.render();
GL11.glEnable(GL11.GL_LIGHTING);
GL11.glPopMatrix();
}
}