Basic bee ring start.

This commit is contained in:
rjnasers committed 2023-04-22 11:28:20 -05:00
1 parent bdb7a53b96
commit 951df8a632
10 files changed
+429 -23

No files matched your search

@@ -0,0 +1,65 @@
package magicbees.client.gui;
import cpw.mods.fml.common.registry.GameRegistry;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.inventory.Container;
import net.minecraft.inventory.ICrafting;
import net.minecraft.inventory.IInventory;
import net.minecraft.inventory.Slot;
import net.minecraft.item.ItemStack;
public class ContainerEffectRing extends Container {
IInventory IBR;
public ContainerEffectRing(IInventory IBR, EntityPlayer player) {
this.IBR = IBR;
this.addSlotToContainer(
new SlotCustomItems(this.IBR, 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 boolean canInteractWith(EntityPlayer player) {
return true;
}
@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;
}
@Override
public void detectAndSendChanges() {
super.detectAndSendChanges();
}
}
@@ -0,0 +1,42 @@
package magicbees.client.gui;
import magicbees.item.ItemBeeRing;
import magicbees.main.CommonProxy;
import net.minecraft.client.gui.inventory.GuiContainer;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.util.ResourceLocation;
import org.lwjgl.opengl.GL11;
public class GUIEffectRing 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;
public GUIEffectRing(ItemStack itemStack, EntityPlayer player) {
super(new ContainerEffectRing(ItemBeeRing.getInventory(player, itemStack), 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);
}
}
@@ -1,12 +1,15 @@
package magicbees.client.gui;
import magicbees.item.ItemBeeRing;
import magicbees.tileentity.TileEntityEffectJar;
import magicbees.tileentity.TileEntityMagicApiary;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.world.World;
import cpw.mods.fml.common.network.IGuiHandler;
import scala.swing.Applet;
public class GUIHandler implements IGuiHandler {
@@ -19,6 +22,8 @@ public class GUIHandler implements IGuiHandler {
} else if (ID == UIScreens.THAUMIC_APIARY.ordinal()) {
TileEntityMagicApiary tileEntityThaumicApiary = (TileEntityMagicApiary) world.getTileEntity(x, y, z);
value = new ContainerMagicApiary(player.inventory, tileEntityThaumicApiary);
} else if (ID == UIScreens.EFFECT_RING.ordinal()) {
value = new ContainerEffectRing(ItemBeeRing.getInventory(player, player.getHeldItem()),player);
}
return value;
@@ -31,8 +36,9 @@ public class GUIHandler implements IGuiHandler {
} else if (ID == UIScreens.THAUMIC_APIARY.ordinal()) {
TileEntityMagicApiary tileEntityThaumicApiary = (TileEntityMagicApiary) world.getTileEntity(x, y, z);
return new GuiMagicApiary(player.inventory, tileEntityThaumicApiary);
} else {
return null;
} else if (ID == UIScreens.EFFECT_RING.ordinal()) {
return new GUIEffectRing(player.getHeldItem() ,player);
}
return null;
}
}
@@ -2,5 +2,6 @@ package magicbees.client.gui;
public enum UIScreens {
EFFECT_JAR,
THAUMIC_APIARY,;
THAUMIC_APIARY,
EFFECT_RING
}