mirror of
https://github.com/GTNewHorizons/MagicBees.git
synced 2026-11-21 12:42:20 +00:00
Spotless
This commit is contained in:
156 files changed
+14896
-13422
No files matched your search
@@ -10,113 +10,91 @@ 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)));
|
||||
public class ContainerEffectJar extends Container {
|
||||
public TileEntityEffectJar jar;
|
||||
|
||||
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));
|
||||
}
|
||||
}
|
||||
public int lastBeeHealth = 0;
|
||||
public int speciesColour = 0xffffff;
|
||||
|
||||
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);
|
||||
}
|
||||
public ContainerEffectJar(TileEntityEffectJar tileEntityEffectJar, EntityPlayer player) {
|
||||
this.jar = tileEntityEffectJar;
|
||||
this.addSlotToContainer(
|
||||
new SlotCustomItems(this.jar, 0, 80, 22, GameRegistry.findItemStack("Forestry", "beeDroneGE", 1)));
|
||||
|
||||
@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;
|
||||
}
|
||||
}
|
||||
}
|
||||
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));
|
||||
}
|
||||
}
|
||||
|
||||
@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;
|
||||
}
|
||||
}
|
||||
for (int i = 0; i < 9; ++i) {
|
||||
this.addSlotToContainer(new Slot(player.inventory, i, 8 + i * 18, 132));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canInteractWith(EntityPlayer entityplayer)
|
||||
{
|
||||
return this.jar.isUseableByPlayer(entityplayer);
|
||||
}
|
||||
@Override
|
||||
public void addCraftingToCrafters(ICrafting crafting) {
|
||||
super.addCraftingToCrafters(crafting);
|
||||
|
||||
@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;
|
||||
}
|
||||
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;
|
||||
}
|
||||
}
|
||||
@@ -5,19 +5,18 @@ import net.minecraft.entity.player.InventoryPlayer;
|
||||
import net.minecraft.inventory.Container;
|
||||
import net.minecraft.inventory.Slot;
|
||||
|
||||
public class ContainerMB extends Container
|
||||
{
|
||||
public class ContainerMB extends Container {
|
||||
protected final int PLAYER_INVENTORY_ROWS = 3;
|
||||
protected final int PLAYER_INVENTORY_COLUMNS = 9;
|
||||
|
||||
public void addPlayerInventory(InventoryPlayer inventoryPlayer, int xStart, int yStart)
|
||||
{
|
||||
for (int x = 0; x < PLAYER_INVENTORY_COLUMNS; x++){
|
||||
addSlotToContainer(new Slot(inventoryPlayer, x, xStart + 8 + 18 * x, yStart + 4 + PLAYER_INVENTORY_ROWS * 18));
|
||||
public void addPlayerInventory(InventoryPlayer inventoryPlayer, int xStart, int yStart) {
|
||||
for (int x = 0; x < PLAYER_INVENTORY_COLUMNS; x++) {
|
||||
addSlotToContainer(
|
||||
new Slot(inventoryPlayer, x, xStart + 8 + 18 * x, yStart + 4 + PLAYER_INVENTORY_ROWS * 18));
|
||||
}
|
||||
|
||||
for (int y = 0; y < PLAYER_INVENTORY_ROWS; y++){
|
||||
for (int x = 0; x < PLAYER_INVENTORY_COLUMNS; x++){
|
||||
for (int y = 0; y < PLAYER_INVENTORY_ROWS; y++) {
|
||||
for (int x = 0; x < PLAYER_INVENTORY_COLUMNS; x++) {
|
||||
addSlotToContainer(new Slot(inventoryPlayer, x + y * 9 + 9, xStart + 8 + 18 * x, yStart + y * 18));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -19,39 +19,46 @@ public class ContainerMagicApiary extends ContainerMB {
|
||||
private static final int SLOT_QUEEN = 0;
|
||||
private static final int SLOT_DRONE = 1;
|
||||
private static final int SLOT_FRAME_START = 2;
|
||||
private static final int SLOT_INVENTORY_START = 5;
|
||||
private static final int SLOT_INVENTORY_START = 5;
|
||||
private static final int SLOT_FRAME_COUNT = 3;
|
||||
private static final int SLOT_INVENTORY_COUNT = 7;
|
||||
|
||||
public ContainerMagicApiary(InventoryPlayer inventoryPlayer, TileEntityMagicApiary thaumicApiary){
|
||||
public ContainerMagicApiary(InventoryPlayer inventoryPlayer, TileEntityMagicApiary thaumicApiary) {
|
||||
this.apiary = thaumicApiary;
|
||||
|
||||
// Queen/Princess slot
|
||||
addSlotToContainer(new SlotCustomItems(this.apiary, 0, 29, 39, ItemInterface.getItemStack("Forestry", "beeQueenGE", 1), ItemInterface.getItemStack("Forestry", "beePrincessGE", 1)));
|
||||
addSlotToContainer(new SlotCustomItems(
|
||||
this.apiary,
|
||||
0,
|
||||
29,
|
||||
39,
|
||||
ItemInterface.getItemStack("Forestry", "beeQueenGE", 1),
|
||||
ItemInterface.getItemStack("Forestry", "beePrincessGE", 1)));
|
||||
// Drone slot
|
||||
addSlotToContainer(new SlotCustomItems(this.apiary, 1, 29, 65, ItemInterface.getItemStack("Forestry", "beeDroneGE", 64)));
|
||||
addSlotToContainer(
|
||||
new SlotCustomItems(this.apiary, 1, 29, 65, ItemInterface.getItemStack("Forestry", "beeDroneGE", 64)));
|
||||
|
||||
int currentSlot = 1;
|
||||
|
||||
// Frame slots
|
||||
for (int x = 0; x < 3; x++){
|
||||
for (int x = 0; x < 3; x++) {
|
||||
currentSlot++;
|
||||
addSlotToContainer(new SlotFrame(thaumicApiary, currentSlot, 66, 23 + x * 29));
|
||||
//LogHelper.info("[1] CURRENTSLOT: " + currentSlot);
|
||||
// LogHelper.info("[1] CURRENTSLOT: " + currentSlot);
|
||||
}
|
||||
|
||||
for (int x = 0; x < 3; x++){
|
||||
for (int x = 0; x < 3; x++) {
|
||||
currentSlot++;
|
||||
addSlotToContainer(new Slot(thaumicApiary, currentSlot, 116, 26 + x * 26));
|
||||
//LogHelper.info("[2] CURRENTSLOT: " + currentSlot);
|
||||
// LogHelper.info("[2] CURRENTSLOT: " + currentSlot);
|
||||
}
|
||||
|
||||
int j = 0;
|
||||
for (int y = 0; y < 2; y++){
|
||||
for (int x = 0; x < 2; x++){
|
||||
for (int y = 0; y < 2; y++) {
|
||||
for (int x = 0; x < 2; x++) {
|
||||
currentSlot++;
|
||||
addSlotToContainer(new Slot(thaumicApiary, currentSlot, 95 + x * 42, 39 + j * 26));
|
||||
//LogHelper.info("[3] CURRENTSLOT: " + currentSlot);
|
||||
// LogHelper.info("[3] CURRENTSLOT: " + currentSlot);
|
||||
}
|
||||
j++;
|
||||
}
|
||||
@@ -59,41 +66,39 @@ public class ContainerMagicApiary extends ContainerMB {
|
||||
addPlayerInventory(inventoryPlayer, 0, 110);
|
||||
|
||||
maxSlot = currentSlot;
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack transferStackInSlot(EntityPlayer player, int slotIndex){
|
||||
public ItemStack transferStackInSlot(EntityPlayer player, int slotIndex) {
|
||||
Slot itemSlot = this.getSlot(slotIndex);
|
||||
boolean clearSlot = false;
|
||||
|
||||
if (itemSlot != null && itemSlot.getHasStack()) {
|
||||
ItemStack srcStack = itemSlot.getStack();
|
||||
|
||||
if (slotIndex <= maxSlot && srcStack != null){
|
||||
if (slotIndex <= maxSlot && srcStack != null) {
|
||||
clearSlot = this.mergeItemStack(srcStack, maxSlot + 1, maxSlot + 36, false);
|
||||
}else{
|
||||
if (slotIndex > maxSlot && srcStack != null){
|
||||
if (BeeManager.beeRoot.isMember(srcStack)){
|
||||
if (!BeeManager.beeRoot.isDrone(srcStack)){
|
||||
if (this.getSlot(SLOT_QUEEN).getHasStack() == false) {
|
||||
clearSlot = this.mergeItemStack(srcStack, SLOT_QUEEN, SLOT_QUEEN + 1, false);
|
||||
}
|
||||
}else{
|
||||
if (this.getSlot(SLOT_DRONE).isItemValid(srcStack)){
|
||||
clearSlot = this.mergeItemStack(srcStack, SLOT_DRONE, SLOT_DRONE + 1, false);
|
||||
}
|
||||
} else {
|
||||
if (slotIndex > maxSlot && srcStack != null) {
|
||||
if (BeeManager.beeRoot.isMember(srcStack)) {
|
||||
if (!BeeManager.beeRoot.isDrone(srcStack)) {
|
||||
if (this.getSlot(SLOT_QUEEN).getHasStack() == false) {
|
||||
clearSlot = this.mergeItemStack(srcStack, SLOT_QUEEN, SLOT_QUEEN + 1, false);
|
||||
}
|
||||
}else if(srcStack.getItem() instanceof IHiveFrame){
|
||||
clearSlot = this.mergeItemStack(srcStack, SLOT_FRAME_START, SLOT_FRAME_START + SLOT_FRAME_COUNT, false);
|
||||
} else {
|
||||
if (this.getSlot(SLOT_DRONE).isItemValid(srcStack)) {
|
||||
clearSlot = this.mergeItemStack(srcStack, SLOT_DRONE, SLOT_DRONE + 1, false);
|
||||
}
|
||||
}
|
||||
} else if (srcStack.getItem() instanceof IHiveFrame) {
|
||||
clearSlot = this.mergeItemStack(
|
||||
srcStack, SLOT_FRAME_START, SLOT_FRAME_START + SLOT_FRAME_COUNT, false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
if (clearSlot){
|
||||
if (clearSlot) {
|
||||
itemSlot.putStack(null);
|
||||
}
|
||||
|
||||
@@ -108,7 +113,6 @@ public class ContainerMagicApiary extends ContainerMB {
|
||||
return apiary.isUseableByPlayer(entityPlayer);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void updateProgressBar(int i, int j) {
|
||||
apiary.getGUINetworkData(i, j);
|
||||
|
||||
@@ -7,59 +7,60 @@ 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");
|
||||
|
||||
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;
|
||||
}
|
||||
private static final int WIDTH = 176;
|
||||
private static final int HEIGHT = 156;
|
||||
|
||||
@Override
|
||||
protected void drawGuiContainerForegroundLayer(int par1, int par2)
|
||||
{
|
||||
fontRendererObj.drawString("Inventory", 9, 63, 0);
|
||||
}
|
||||
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;
|
||||
|
||||
@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);
|
||||
}
|
||||
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);
|
||||
}
|
||||
}
|
||||
@@ -1,46 +1,36 @@
|
||||
package magicbees.client.gui;
|
||||
|
||||
import cpw.mods.fml.common.network.IGuiHandler;
|
||||
import magicbees.tileentity.TileEntityEffectJar;
|
||||
import magicbees.tileentity.TileEntityMagicApiary;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.world.World;
|
||||
import cpw.mods.fml.common.network.IGuiHandler;
|
||||
|
||||
public class GUIHandler implements 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;
|
||||
@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);
|
||||
}
|
||||
else if (ID == UIScreens.THAUMIC_APIARY.ordinal())
|
||||
{
|
||||
if (ID == UIScreens.EFFECT_JAR.ordinal()) {
|
||||
value = new ContainerEffectJar((TileEntityEffectJar) world.getTileEntity(x, y, z), player);
|
||||
} else if (ID == UIScreens.THAUMIC_APIARY.ordinal()) {
|
||||
TileEntityMagicApiary tileEntityThaumicApiary = (TileEntityMagicApiary) world.getTileEntity(x, y, z);
|
||||
value = new ContainerMagicApiary(player.inventory, tileEntityThaumicApiary);
|
||||
}
|
||||
|
||||
return value;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getClientGuiElement(int ID, EntityPlayer player, World world, int x, int y, int z)
|
||||
{
|
||||
if (ID == UIScreens.EFFECT_JAR.ordinal())
|
||||
{
|
||||
return new GUIEffectJar((TileEntityEffectJar)world.getTileEntity(x, y, z), player);
|
||||
}else if (ID == UIScreens.THAUMIC_APIARY.ordinal())
|
||||
{
|
||||
return value;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getClientGuiElement(int ID, EntityPlayer player, World world, int x, int y, int z) {
|
||||
if (ID == UIScreens.EFFECT_JAR.ordinal()) {
|
||||
return new GUIEffectJar((TileEntityEffectJar) world.getTileEntity(x, y, z), player);
|
||||
} else if (ID == UIScreens.THAUMIC_APIARY.ordinal()) {
|
||||
TileEntityMagicApiary tileEntityThaumicApiary = (TileEntityMagicApiary) world.getTileEntity(x, y, z);
|
||||
return new GuiMagicApiary(player.inventory, tileEntityThaumicApiary);
|
||||
return new GuiMagicApiary(player.inventory, tileEntityThaumicApiary);
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,35 +1,27 @@
|
||||
package magicbees.client.gui;
|
||||
|
||||
import java.util.Set;
|
||||
|
||||
import cpw.mods.fml.client.IModGuiFactory;
|
||||
import java.util.Set;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.gui.GuiScreen;
|
||||
|
||||
public class GuiFactory implements IModGuiFactory
|
||||
{
|
||||
public class GuiFactory implements IModGuiFactory {
|
||||
|
||||
@Override
|
||||
public void initialize(Minecraft minecraftInstance)
|
||||
{
|
||||
@Override
|
||||
public void initialize(Minecraft minecraftInstance) {}
|
||||
|
||||
}
|
||||
@Override
|
||||
public Class<? extends GuiScreen> mainConfigGuiClass() {
|
||||
return ModGuiConfig.class;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Class<? extends GuiScreen> mainConfigGuiClass()
|
||||
{
|
||||
return ModGuiConfig.class;
|
||||
}
|
||||
@Override
|
||||
public Set<RuntimeOptionCategoryElement> runtimeGuiCategories() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Set<RuntimeOptionCategoryElement> runtimeGuiCategories()
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public RuntimeOptionGuiHandler getHandlerFor(RuntimeOptionCategoryElement element)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
@Override
|
||||
public RuntimeOptionGuiHandler getHandlerFor(RuntimeOptionCategoryElement element) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
@@ -1,59 +1,57 @@
|
||||
package magicbees.client.gui;
|
||||
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import magicbees.main.CommonProxy;
|
||||
import magicbees.tileentity.TileEntityMagicApiary;
|
||||
import net.minecraft.client.gui.GuiButton;
|
||||
import net.minecraft.client.gui.inventory.GuiContainer;
|
||||
import net.minecraft.entity.player.InventoryPlayer;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public class GuiMagicApiary extends GuiContainer
|
||||
{
|
||||
public static final ResourceLocation BACKGROUND_LOCATION = new ResourceLocation(CommonProxy.DOMAIN, CommonProxy.GUI_TEXTURE + "apiary.png");
|
||||
public class GuiMagicApiary extends GuiContainer {
|
||||
public static final ResourceLocation BACKGROUND_LOCATION =
|
||||
new ResourceLocation(CommonProxy.DOMAIN, CommonProxy.GUI_TEXTURE + "apiary.png");
|
||||
|
||||
private static final int WIDTH = 176;
|
||||
private static final int HEIGHT = 190;
|
||||
|
||||
|
||||
private static final int LIFEBAR_WIDTH = 2;
|
||||
private static final int LIFEBAR_HEIGHT = 46;
|
||||
|
||||
|
||||
private static final int LIFEBAR_DEST_X = 21;
|
||||
private static final int LIFEBAR_DEST_Y = 37;
|
||||
|
||||
|
||||
private static final int LIFEBAR_SRC_Y = 0;
|
||||
private static final int LIFEBAR_SRC_STAGE1_X = 184;
|
||||
private static final int LIFEBAR_SRC_STAGE2_X = 182;
|
||||
private static final int LIFEBAR_SRC_STAGE3_X = 180;
|
||||
private static final int LIFEBAR_SRC_STAGE4_X = 178;
|
||||
private static final int LIFEBAR_SRC_STAGE5_X = 176;
|
||||
|
||||
|
||||
private static final int WORKBOOST_WIDTH = 16;
|
||||
private static final int WORKBOOST_HEIGHT = 12;
|
||||
private static final int WORKBOOST_DEST_X = 37;
|
||||
private static final int WORKBOOST_DEST_Y = 18;
|
||||
private static final int WORKBOOST_SRC_X = 176;
|
||||
private static final int WORKBOOST_SRC_Y = 46;
|
||||
|
||||
|
||||
private static final int DEATHBOOST_WIDTH = 11;
|
||||
private static final int DEATHBOOST_HEIGHT = 13;
|
||||
private static final int DEATHBOOST_DEST_X = 25;
|
||||
private static final int DEATHBOOST_DEST_Y = 17;
|
||||
private static final int DEATHBOOST_SRC_X = 176;
|
||||
private static final int DEATHBOOST_SRC_Y = 58;
|
||||
|
||||
|
||||
private static final int MUTATIONBOOST_WIDTH = 9;
|
||||
private static final int MUTATIONBOOST_HEIGHT = 13;
|
||||
private static final int MUTATIONBOOST_DEST_X = 15;
|
||||
private static final int MUTATIONBOOST_DEST_Y = 17;
|
||||
private static final int MUTATIONBOOST_SRC_X = 176;
|
||||
private static final int MUTATIONBOOST_SRC_Y = 71;
|
||||
|
||||
|
||||
private GuiButton mutationButton;
|
||||
|
||||
public GuiMagicApiary(InventoryPlayer inventoryPlayer, TileEntityMagicApiary thaumicApiary) {
|
||||
@@ -61,14 +59,12 @@ public class GuiMagicApiary extends GuiContainer
|
||||
|
||||
this.xSize = WIDTH;
|
||||
this.ySize = HEIGHT;
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void drawGuiContainerForegroundLayer(int par1, int par2)
|
||||
{
|
||||
fontRendererObj.drawString("Inventory", 9, 99, 0);
|
||||
}
|
||||
@Override
|
||||
protected void drawGuiContainerForegroundLayer(int par1, int par2) {
|
||||
fontRendererObj.drawString("Inventory", 9, 99, 0);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void drawGuiContainerBackgroundLayer(float opacity, int x, int y) {
|
||||
@@ -76,9 +72,9 @@ public class GuiMagicApiary extends GuiContainer
|
||||
this.mc.getTextureManager().bindTexture(BACKGROUND_LOCATION);
|
||||
|
||||
this.drawTexturedModalRect(guiLeft, guiTop, 0, 0, xSize, ySize);
|
||||
|
||||
TileEntityMagicApiary apiary = ((ContainerMagicApiary)this.inventorySlots).apiary;
|
||||
|
||||
|
||||
TileEntityMagicApiary apiary = ((ContainerMagicApiary) this.inventorySlots).apiary;
|
||||
|
||||
drawLifebar(apiary);
|
||||
|
||||
drawWorkBoostIcon(apiary);
|
||||
@@ -86,56 +82,72 @@ public class GuiMagicApiary extends GuiContainer
|
||||
drawMutationIcon(apiary);
|
||||
}
|
||||
|
||||
private void drawMutationIcon(TileEntityMagicApiary apiary) {
|
||||
if (apiary.isMutationBoosted()) {
|
||||
this.drawTexturedModalRect(this.guiLeft + MUTATIONBOOST_DEST_X, this.guiTop + MUTATIONBOOST_DEST_Y,
|
||||
MUTATIONBOOST_SRC_X, MUTATIONBOOST_SRC_Y, MUTATIONBOOST_WIDTH, MUTATIONBOOST_HEIGHT);
|
||||
private void drawMutationIcon(TileEntityMagicApiary apiary) {
|
||||
if (apiary.isMutationBoosted()) {
|
||||
this.drawTexturedModalRect(
|
||||
this.guiLeft + MUTATIONBOOST_DEST_X,
|
||||
this.guiTop + MUTATIONBOOST_DEST_Y,
|
||||
MUTATIONBOOST_SRC_X,
|
||||
MUTATIONBOOST_SRC_Y,
|
||||
MUTATIONBOOST_WIDTH,
|
||||
MUTATIONBOOST_HEIGHT);
|
||||
}
|
||||
}
|
||||
|
||||
private void drawDeathRateIcon(TileEntityMagicApiary apiary) {
|
||||
if (apiary.isDeathRateBoosted()) {
|
||||
this.drawTexturedModalRect(this.guiLeft + DEATHBOOST_DEST_X, this.guiTop + DEATHBOOST_DEST_Y,
|
||||
DEATHBOOST_SRC_X, DEATHBOOST_SRC_Y, DEATHBOOST_WIDTH, DEATHBOOST_HEIGHT);
|
||||
}
|
||||
}
|
||||
|
||||
private void drawWorkBoostIcon(TileEntityMagicApiary apiary) {
|
||||
if (apiary.isProductionBoosted()) {
|
||||
this.drawTexturedModalRect(this.guiLeft + WORKBOOST_DEST_X, this.guiTop + WORKBOOST_DEST_Y,
|
||||
WORKBOOST_SRC_X, WORKBOOST_SRC_Y, WORKBOOST_WIDTH, WORKBOOST_HEIGHT);
|
||||
}
|
||||
}
|
||||
|
||||
private void drawLifebar(TileEntityMagicApiary apiary) {
|
||||
int value = LIFEBAR_HEIGHT - apiary.getHealthScaled(LIFEBAR_HEIGHT);
|
||||
int lifebarSrc = getLifebarSrc(apiary);
|
||||
this.drawTexturedModalRect(this.guiLeft + LIFEBAR_DEST_X, this.guiTop + value + LIFEBAR_DEST_Y,
|
||||
lifebarSrc, LIFEBAR_SRC_Y, LIFEBAR_WIDTH, LIFEBAR_HEIGHT - value);
|
||||
}
|
||||
|
||||
private int getLifebarSrc(TileEntityMagicApiary apiary) {
|
||||
int value = apiary.getHealthScaled(5);
|
||||
if (value >= 5) {
|
||||
return LIFEBAR_SRC_STAGE1_X;
|
||||
}
|
||||
else if (value >= 4) {
|
||||
return LIFEBAR_SRC_STAGE2_X;
|
||||
}
|
||||
else if (value >= 3) {
|
||||
return LIFEBAR_SRC_STAGE3_X;
|
||||
}
|
||||
else if (value >= 2) {
|
||||
return LIFEBAR_SRC_STAGE4_X;
|
||||
}
|
||||
else {
|
||||
return LIFEBAR_SRC_STAGE5_X;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void mouseClicked(int p_73864_1_, int p_73864_2_, int p_73864_3_) {
|
||||
// TODO Auto-generated method stub
|
||||
super.mouseClicked(p_73864_1_, p_73864_2_, p_73864_3_);
|
||||
}
|
||||
private void drawDeathRateIcon(TileEntityMagicApiary apiary) {
|
||||
if (apiary.isDeathRateBoosted()) {
|
||||
this.drawTexturedModalRect(
|
||||
this.guiLeft + DEATHBOOST_DEST_X,
|
||||
this.guiTop + DEATHBOOST_DEST_Y,
|
||||
DEATHBOOST_SRC_X,
|
||||
DEATHBOOST_SRC_Y,
|
||||
DEATHBOOST_WIDTH,
|
||||
DEATHBOOST_HEIGHT);
|
||||
}
|
||||
}
|
||||
|
||||
private void drawWorkBoostIcon(TileEntityMagicApiary apiary) {
|
||||
if (apiary.isProductionBoosted()) {
|
||||
this.drawTexturedModalRect(
|
||||
this.guiLeft + WORKBOOST_DEST_X,
|
||||
this.guiTop + WORKBOOST_DEST_Y,
|
||||
WORKBOOST_SRC_X,
|
||||
WORKBOOST_SRC_Y,
|
||||
WORKBOOST_WIDTH,
|
||||
WORKBOOST_HEIGHT);
|
||||
}
|
||||
}
|
||||
|
||||
private void drawLifebar(TileEntityMagicApiary apiary) {
|
||||
int value = LIFEBAR_HEIGHT - apiary.getHealthScaled(LIFEBAR_HEIGHT);
|
||||
int lifebarSrc = getLifebarSrc(apiary);
|
||||
this.drawTexturedModalRect(
|
||||
this.guiLeft + LIFEBAR_DEST_X,
|
||||
this.guiTop + value + LIFEBAR_DEST_Y,
|
||||
lifebarSrc,
|
||||
LIFEBAR_SRC_Y,
|
||||
LIFEBAR_WIDTH,
|
||||
LIFEBAR_HEIGHT - value);
|
||||
}
|
||||
|
||||
private int getLifebarSrc(TileEntityMagicApiary apiary) {
|
||||
int value = apiary.getHealthScaled(5);
|
||||
if (value >= 5) {
|
||||
return LIFEBAR_SRC_STAGE1_X;
|
||||
} else if (value >= 4) {
|
||||
return LIFEBAR_SRC_STAGE2_X;
|
||||
} else if (value >= 3) {
|
||||
return LIFEBAR_SRC_STAGE3_X;
|
||||
} else if (value >= 2) {
|
||||
return LIFEBAR_SRC_STAGE4_X;
|
||||
} else {
|
||||
return LIFEBAR_SRC_STAGE5_X;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void mouseClicked(int p_73864_1_, int p_73864_2_, int p_73864_3_) {
|
||||
// TODO Auto-generated method stub
|
||||
super.mouseClicked(p_73864_1_, p_73864_2_, p_73864_3_);
|
||||
}
|
||||
}
|
||||
@@ -1,38 +1,39 @@
|
||||
package magicbees.client.gui;
|
||||
|
||||
import cpw.mods.fml.client.config.DummyConfigElement;
|
||||
import cpw.mods.fml.client.config.GuiConfig;
|
||||
import cpw.mods.fml.client.config.IConfigElement;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import magicbees.main.Config;
|
||||
import magicbees.main.utils.VersionInfo;
|
||||
import net.minecraft.client.gui.GuiScreen;
|
||||
import net.minecraftforge.common.config.ConfigElement;
|
||||
import net.minecraftforge.common.config.Configuration;
|
||||
import cpw.mods.fml.client.config.DummyConfigElement;
|
||||
import cpw.mods.fml.client.config.GuiConfig;
|
||||
import cpw.mods.fml.client.config.IConfigElement;
|
||||
|
||||
public class ModGuiConfig extends GuiConfig
|
||||
{
|
||||
public ModGuiConfig(GuiScreen guiScreen)
|
||||
{
|
||||
super(guiScreen, configElements(), VersionInfo.ModName, false, false,
|
||||
GuiConfig.getAbridgedConfigPath(Config.configuration.toString()));
|
||||
}
|
||||
|
||||
private static List<IConfigElement> configElements() {
|
||||
List<IConfigElement> list = new ArrayList<IConfigElement>();
|
||||
public class ModGuiConfig extends GuiConfig {
|
||||
public ModGuiConfig(GuiScreen guiScreen) {
|
||||
super(
|
||||
guiScreen,
|
||||
configElements(),
|
||||
VersionInfo.ModName,
|
||||
false,
|
||||
false,
|
||||
GuiConfig.getAbridgedConfigPath(Config.configuration.toString()));
|
||||
}
|
||||
|
||||
list.add(categoryElement(Config.CATEGORY_GENERAL, "General", "magicbees.config.category.general"));
|
||||
list.add(categoryElement(Config.CATEGORY_DEBUG, "Debug", "magicbees.config.category.debug"));
|
||||
list.add(categoryElement(Config.CATEGORY_MODULES, "Modules", "magicbees.config.category.modules"));
|
||||
list.add(categoryElement(Config.CATEGORY_BOTANIA, "Botania Plugin", "magicbees.config.category.botania"));
|
||||
|
||||
return list;
|
||||
}
|
||||
|
||||
private static IConfigElement categoryElement(String category, String name, String tooltip_key) {
|
||||
return new DummyConfigElement.DummyCategoryElement(name, tooltip_key,
|
||||
new ConfigElement(Config.configuration.getCategory(category)).getChildElements());
|
||||
}
|
||||
private static List<IConfigElement> configElements() {
|
||||
List<IConfigElement> list = new ArrayList<IConfigElement>();
|
||||
|
||||
list.add(categoryElement(Config.CATEGORY_GENERAL, "General", "magicbees.config.category.general"));
|
||||
list.add(categoryElement(Config.CATEGORY_DEBUG, "Debug", "magicbees.config.category.debug"));
|
||||
list.add(categoryElement(Config.CATEGORY_MODULES, "Modules", "magicbees.config.category.modules"));
|
||||
list.add(categoryElement(Config.CATEGORY_BOTANIA, "Botania Plugin", "magicbees.config.category.botania"));
|
||||
|
||||
return list;
|
||||
}
|
||||
|
||||
private static IConfigElement categoryElement(String category, String name, String tooltip_key) {
|
||||
return new DummyConfigElement.DummyCategoryElement(
|
||||
name, tooltip_key, new ConfigElement(Config.configuration.getCategory(category)).getChildElements());
|
||||
}
|
||||
}
|
||||
@@ -3,7 +3,6 @@ package magicbees.client.gui;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.inventory.IInventory;
|
||||
import net.minecraft.inventory.Slot;
|
||||
import net.minecraft.item.ItemStack;
|
||||
@@ -12,90 +11,70 @@ import net.minecraftforge.oredict.OreDictionary;
|
||||
/**
|
||||
* @author MysteriousAges
|
||||
*/
|
||||
public class SlotCustomItems extends Slot
|
||||
{
|
||||
private List<ItemStack> items;
|
||||
public class SlotCustomItems extends Slot {
|
||||
private List<ItemStack> items;
|
||||
|
||||
public SlotCustomItems(IInventory inventory, int slotIndex, int xPos, int yPos, ItemStack... items)
|
||||
{
|
||||
super(inventory, slotIndex, xPos, yPos);
|
||||
this.items = new ArrayList<ItemStack>(items.length);
|
||||
public SlotCustomItems(IInventory inventory, int slotIndex, int xPos, int yPos, ItemStack... items) {
|
||||
super(inventory, slotIndex, xPos, yPos);
|
||||
this.items = new ArrayList<ItemStack>(items.length);
|
||||
|
||||
Collections.addAll(this.items, items);
|
||||
}
|
||||
|
||||
/**
|
||||
* @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;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Collections.addAll(this.items, items);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isItemValid(ItemStack itemStack)
|
||||
{
|
||||
for (ItemStack item : this.items)
|
||||
{
|
||||
if (item != null && item.getItem() == itemStack.getItem())
|
||||
{
|
||||
if (item.getItemDamage() == itemStack.getItemDamage() || item.getItemDamage() == OreDictionary.WILDCARD_VALUE)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
/**
|
||||
* @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) {
|
||||
for (ItemStack item : this.items) {
|
||||
if (item != null && item.getItem() == itemStack.getItem()) {
|
||||
if (item.getItemDamage() == itemStack.getItemDamage()
|
||||
|| item.getItemDamage() == OreDictionary.WILDCARD_VALUE) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -10,17 +10,17 @@ public class SlotFrame extends SlotCustomItems {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isItemValid(ItemStack itemStack){
|
||||
if (itemStack == null){
|
||||
public boolean isItemValid(ItemStack itemStack) {
|
||||
if (itemStack == null) {
|
||||
return false;
|
||||
}
|
||||
if (!inventory.isItemValidForSlot(getSlotIndex(), itemStack)){
|
||||
if (!inventory.isItemValidForSlot(getSlotIndex(), itemStack)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
boolean flag = false;
|
||||
|
||||
if(itemStack.getItem() instanceof IHiveFrame){
|
||||
if (itemStack.getItem() instanceof IHiveFrame) {
|
||||
flag = true;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
package magicbees.client.gui;
|
||||
|
||||
public enum UIScreens
|
||||
{
|
||||
EFFECT_JAR,
|
||||
THAUMIC_APIARY,;
|
||||
public enum UIScreens {
|
||||
EFFECT_JAR,
|
||||
THAUMIC_APIARY,
|
||||
;
|
||||
}
|
||||
@@ -9,31 +9,29 @@ import net.minecraftforge.client.model.IModelCustom;
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public class ModelEffectJar
|
||||
{
|
||||
public static final ResourceLocation objFile = new ResourceLocation(CommonProxy.DOMAIN, CommonProxy.MODEL + "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(objFile);
|
||||
}
|
||||
|
||||
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();
|
||||
|
||||
}
|
||||
public class ModelEffectJar {
|
||||
public static final ResourceLocation objFile =
|
||||
new ResourceLocation(CommonProxy.DOMAIN, CommonProxy.MODEL + "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(objFile);
|
||||
}
|
||||
|
||||
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();
|
||||
}
|
||||
}
|
||||
@@ -1,40 +1,42 @@
|
||||
package magicbees.client.model;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import magicbees.main.CommonProxy;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraftforge.client.model.AdvancedModelLoader;
|
||||
import net.minecraftforge.client.model.IModelCustom;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public class ModelVisAuraProvider {
|
||||
public static final ResourceLocation objFile = new ResourceLocation(CommonProxy.DOMAIN, CommonProxy.MODEL + "visAuraConverter.obj");
|
||||
public static final ResourceLocation textureLocation = new ResourceLocation(CommonProxy.DOMAIN, CommonProxy.MODEL + "visAuraProvider.png");
|
||||
|
||||
public static final ModelVisAuraProvider model = new ModelVisAuraProvider();
|
||||
|
||||
private IModelCustom visAuraProviderObj;
|
||||
|
||||
public ModelVisAuraProvider() {
|
||||
this.visAuraProviderObj = AdvancedModelLoader.loadModel(objFile);
|
||||
}
|
||||
public static final ResourceLocation objFile =
|
||||
new ResourceLocation(CommonProxy.DOMAIN, CommonProxy.MODEL + "visAuraConverter.obj");
|
||||
public static final ResourceLocation textureLocation =
|
||||
new ResourceLocation(CommonProxy.DOMAIN, CommonProxy.MODEL + "visAuraProvider.png");
|
||||
|
||||
public void render(long tick) {
|
||||
GL11.glPushMatrix();
|
||||
GL11.glRotated(Math.sin(tick * Math.PI * 2 / 80) * 0.7, 0, 1, 0);
|
||||
GL11.glRotated(Math.sin((tick + 25) * Math.PI * 2 / 150) * 0.75, 0.5, 0, 0.5);
|
||||
GL11.glTranslated(Math.sin(tick * Math.PI * 2 / 1000) * 0.025, 0, Math.sin((tick + 30) * Math.PI * 2 / 650) * 0.03);
|
||||
float red = (float)(Math.sin(tick * Math.PI * 2 / 130) * 0.2 + 0.8);
|
||||
float green = (float)(Math.cos((tick + 2) * Math.PI * 2 / 140) * 0.2 + 0.8);
|
||||
float blue = (float)(Math.sin((tick + 5) * Math.PI * 2 / 99) * 0.2 + 0.8);
|
||||
GL11.glColor3f(red, green, blue);
|
||||
this.visAuraProviderObj.renderPart("centre");
|
||||
GL11.glPopMatrix();
|
||||
|
||||
GL11.glColor3f(1f, 1f, 1f);
|
||||
this.visAuraProviderObj.renderPart("frame");
|
||||
}
|
||||
public static final ModelVisAuraProvider model = new ModelVisAuraProvider();
|
||||
|
||||
private IModelCustom visAuraProviderObj;
|
||||
|
||||
public ModelVisAuraProvider() {
|
||||
this.visAuraProviderObj = AdvancedModelLoader.loadModel(objFile);
|
||||
}
|
||||
|
||||
public void render(long tick) {
|
||||
GL11.glPushMatrix();
|
||||
GL11.glRotated(Math.sin(tick * Math.PI * 2 / 80) * 0.7, 0, 1, 0);
|
||||
GL11.glRotated(Math.sin((tick + 25) * Math.PI * 2 / 150) * 0.75, 0.5, 0, 0.5);
|
||||
GL11.glTranslated(
|
||||
Math.sin(tick * Math.PI * 2 / 1000) * 0.025, 0, Math.sin((tick + 30) * Math.PI * 2 / 650) * 0.03);
|
||||
float red = (float) (Math.sin(tick * Math.PI * 2 / 130) * 0.2 + 0.8);
|
||||
float green = (float) (Math.cos((tick + 2) * Math.PI * 2 / 140) * 0.2 + 0.8);
|
||||
float blue = (float) (Math.sin((tick + 5) * Math.PI * 2 / 99) * 0.2 + 0.8);
|
||||
GL11.glColor3f(red, green, blue);
|
||||
this.visAuraProviderObj.renderPart("centre");
|
||||
GL11.glPopMatrix();
|
||||
|
||||
GL11.glColor3f(1f, 1f, 1f);
|
||||
this.visAuraProviderObj.renderPart("frame");
|
||||
}
|
||||
}
|
||||
@@ -9,69 +9,60 @@ import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraftforge.client.IItemRenderer;
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
public class RendererEffectJar extends TileEntitySpecialRenderer implements IItemRenderer
|
||||
{
|
||||
public static RendererEffectJar instance = new RendererEffectJar();
|
||||
public class RendererEffectJar extends TileEntitySpecialRenderer implements IItemRenderer {
|
||||
public static RendererEffectJar instance = new RendererEffectJar();
|
||||
|
||||
@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 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 handleRenderType(ItemStack item, ItemRenderType type) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean shouldUseRenderHelper(ItemRenderType type, ItemStack item, ItemRendererHelper helper)
|
||||
{
|
||||
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();
|
||||
}
|
||||
@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();
|
||||
}
|
||||
}
|
||||
@@ -1,50 +1,47 @@
|
||||
package magicbees.client.render;
|
||||
|
||||
import cpw.mods.fml.client.FMLClientHandler;
|
||||
import magicbees.client.model.ModelVisAuraProvider;
|
||||
import magicbees.tileentity.TileEntityVisAuraProvider;
|
||||
import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraftforge.client.IItemRenderer;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import cpw.mods.fml.client.FMLClientHandler;
|
||||
|
||||
public class RendererVisAuraProvider extends TileEntitySpecialRenderer implements IItemRenderer {
|
||||
public static RendererVisAuraProvider instance = new RendererVisAuraProvider();
|
||||
public static RendererVisAuraProvider instance = new RendererVisAuraProvider();
|
||||
|
||||
@Override
|
||||
public void renderTileEntityAt(TileEntity entity, double x, double y, double z, float tick) {
|
||||
if (entity instanceof TileEntityVisAuraProvider) {
|
||||
this.doRender(x, y, z, 1f, entity.getWorldObj().getTotalWorldTime());
|
||||
}
|
||||
}
|
||||
@Override
|
||||
public void renderTileEntityAt(TileEntity entity, double x, double y, double z, float tick) {
|
||||
if (entity instanceof TileEntityVisAuraProvider) {
|
||||
this.doRender(x, y, z, 1f, entity.getWorldObj().getTotalWorldTime());
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean handleRenderType(ItemStack item, ItemRenderType type) {
|
||||
return true;
|
||||
}
|
||||
@Override
|
||||
public boolean handleRenderType(ItemStack item, ItemRenderType type) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean shouldUseRenderHelper(ItemRenderType type, ItemStack item, ItemRendererHelper helper) {
|
||||
return true;
|
||||
}
|
||||
@Override
|
||||
public boolean shouldUseRenderHelper(ItemRenderType type, ItemStack item, ItemRendererHelper helper) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void renderItem(ItemRenderType type, ItemStack item, Object... data) {
|
||||
doRender(0, 0, 0, 1f, 0);
|
||||
}
|
||||
|
||||
private void doRender(double x, double y, double z, float scale, long tick) {
|
||||
GL11.glPushMatrix();
|
||||
GL11.glScaled(scale, scale, scale);
|
||||
GL11.glTranslated(x, y, z);
|
||||
|
||||
FMLClientHandler.instance().getClient().renderEngine.bindTexture(ModelVisAuraProvider.textureLocation);
|
||||
ModelVisAuraProvider.model.render(tick);
|
||||
|
||||
GL11.glPopMatrix();
|
||||
}
|
||||
@Override
|
||||
public void renderItem(ItemRenderType type, ItemStack item, Object... data) {
|
||||
doRender(0, 0, 0, 1f, 0);
|
||||
}
|
||||
|
||||
private void doRender(double x, double y, double z, float scale, long tick) {
|
||||
GL11.glPushMatrix();
|
||||
GL11.glScaled(scale, scale, scale);
|
||||
GL11.glTranslated(x, y, z);
|
||||
|
||||
FMLClientHandler.instance().getClient().renderEngine.bindTexture(ModelVisAuraProvider.textureLocation);
|
||||
ModelVisAuraProvider.model.render(tick);
|
||||
|
||||
GL11.glPopMatrix();
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user