This commit is contained in:
kuba6000 committed 2022-10-12 21:09:45 +02:00
1 parent d993c90c3e
commit 14a712260b
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;
}
}