mirror of
https://github.com/HbmMods/Hbm-s-Nuclear-Tech-GIT.git
synced 2026-01-25 10:32:49 +00:00
none may enter the orb
This commit is contained in:
parent
ad7032c74d
commit
f89697665c
@ -70,7 +70,7 @@ public class ContainerMachineWoodBurner extends Container {
|
||||
return null;
|
||||
}
|
||||
} else if(TileEntityFurnace.isItemFuel(stack)) {
|
||||
if(!this.mergeItemStack(originalStack, 2, 3, false)) {
|
||||
if(!this.mergeItemStack(originalStack, 0, 1, false)) {
|
||||
return null;
|
||||
}
|
||||
} else {
|
||||
|
||||
@ -1,5 +1,8 @@
|
||||
package com.hbm.inventory.gui;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import com.hbm.inventory.container.ContainerMachineWoodBurner;
|
||||
@ -12,7 +15,9 @@ import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.audio.PositionedSoundRecord;
|
||||
import net.minecraft.client.resources.I18n;
|
||||
import net.minecraft.entity.player.InventoryPlayer;
|
||||
import net.minecraft.inventory.Slot;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.util.EnumChatFormatting;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
|
||||
public class GUIMachineWoodBurner extends GuiInfoContainer {
|
||||
@ -33,7 +38,26 @@ public class GUIMachineWoodBurner extends GuiInfoContainer {
|
||||
super.drawScreen(mouseX, mouseY, f);
|
||||
this.drawElectricityInfo(this, mouseX, mouseY, guiLeft + 143, guiTop + 18, 16, 34, burner.power, burner.maxPower);
|
||||
|
||||
if(this.mc.thePlayer.inventory.getItemStack() == null) {
|
||||
|
||||
Slot slot = (Slot) this.inventorySlots.inventorySlots.get(0);
|
||||
if(this.isMouseOverSlot(slot, mouseX, mouseY) && !slot.getHasStack()) {
|
||||
List<String> bonuses = burner.burnModule.getDesc();
|
||||
if(!bonuses.isEmpty()) {
|
||||
this.func_146283_a(bonuses, mouseX, mouseY);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(burner.liquidBurn) burner.tank.renderTankInfo(this, mouseX, mouseY, guiLeft + 70, guiTop + 28, 34, 52);
|
||||
|
||||
if(!burner.liquidBurn && guiLeft + 16 <= mouseX && guiLeft + 16 + 8 > mouseX && guiTop + 17 < mouseY && guiTop + 17 + 54 >= mouseY) {
|
||||
func_146283_a(Arrays.asList(new String[] { (burner.burnTime / 20) + "s" }), mouseX, mouseY);
|
||||
}
|
||||
|
||||
if(guiLeft + 53 <= mouseX && guiLeft + 53 + 16 > mouseX && guiTop + 17 < mouseY && guiTop + 17 + 15 >= mouseY) {
|
||||
func_146283_a(Arrays.asList(new String[] { burner.isOn ? EnumChatFormatting.GREEN + "ON" : EnumChatFormatting.RED + "OFF" }), mouseX, mouseY);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -81,6 +105,11 @@ public class GUIMachineWoodBurner extends GuiInfoContainer {
|
||||
int p = (int) (burner.power * 34 / burner.maxPower);
|
||||
drawTexturedModalRect(guiLeft + 143, guiTop + 52 - p, 176, 52 - p, 16, p);
|
||||
|
||||
if(burner.maxBurnTime > 0 && !burner.liquidBurn) {
|
||||
int b = (int) (burner.burnTime * 52 / burner.maxBurnTime);
|
||||
drawTexturedModalRect(guiLeft + 17, guiTop + 70 - b, 192, 52 - b, 4, b);
|
||||
}
|
||||
|
||||
if(burner.liquidBurn) burner.tank.renderTank(guiLeft + 70, guiTop + 80, this.zLevel, 34, 52);
|
||||
}
|
||||
}
|
||||
|
||||
@ -151,7 +151,7 @@ public abstract class TileEntityFireboxBase extends TileEntityMachinePolluting i
|
||||
}
|
||||
}
|
||||
|
||||
public EnumAshType getAshFromFuel(ItemStack stack) {
|
||||
public static EnumAshType getAshFromFuel(ItemStack stack) {
|
||||
|
||||
List<String> names = ItemStackUtil.getOreDictNames(stack);
|
||||
|
||||
|
||||
@ -3,11 +3,14 @@ package com.hbm.tileentity.machine;
|
||||
import com.hbm.handler.pollution.PollutionHandler;
|
||||
import com.hbm.handler.pollution.PollutionHandler.PollutionType;
|
||||
import com.hbm.interfaces.IControlReceiver;
|
||||
import com.hbm.inventory.OreDictManager.DictFrame;
|
||||
import com.hbm.inventory.container.ContainerMachineWoodBurner;
|
||||
import com.hbm.inventory.fluid.Fluids;
|
||||
import com.hbm.inventory.fluid.tank.FluidTank;
|
||||
import com.hbm.inventory.fluid.trait.FT_Flammable;
|
||||
import com.hbm.inventory.gui.GUIMachineWoodBurner;
|
||||
import com.hbm.items.ModItems;
|
||||
import com.hbm.items.ItemEnums.EnumAshType;
|
||||
import com.hbm.lib.Library;
|
||||
import com.hbm.module.ModuleBurnTime;
|
||||
import com.hbm.tileentity.IGUIProvider;
|
||||
@ -19,8 +22,10 @@ import cpw.mods.fml.relauncher.SideOnly;
|
||||
import net.minecraft.client.gui.GuiScreen;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.inventory.Container;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
public class TileEntityMachineWoodBurner extends TileEntityMachineBase implements IFluidStandardReceiver, IControlReceiver, IGUIProvider {
|
||||
|
||||
@ -33,7 +38,7 @@ public class TileEntityMachineWoodBurner extends TileEntityMachineBase implement
|
||||
|
||||
public FluidTank tank;
|
||||
|
||||
public static ModuleBurnTime burnModule = new ModuleBurnTime().setLogTimeMod(3).setWoodTimeMod(2);
|
||||
public static ModuleBurnTime burnModule = new ModuleBurnTime().setLogTimeMod(4).setWoodTimeMod(2);
|
||||
|
||||
public int ashLevelWood;
|
||||
public int ashLevelCoal;
|
||||
@ -65,13 +70,22 @@ public class TileEntityMachineWoodBurner extends TileEntityMachineBase implement
|
||||
if(slots[0] != null) {
|
||||
int burn = this.burnModule.getBurnTime(slots[0]);
|
||||
if(burn > 0) {
|
||||
this.maxBurnTime = burn;
|
||||
EnumAshType type = TileEntityFireboxBase.getAshFromFuel(slots[0]);
|
||||
if(type == EnumAshType.WOOD) ashLevelWood += burn;
|
||||
if(type == EnumAshType.COAL) ashLevelCoal += burn;
|
||||
if(type == EnumAshType.MISC) ashLevelMisc += burn;
|
||||
int threshold = 2000;
|
||||
if(processAsh(ashLevelWood, EnumAshType.WOOD, threshold)) ashLevelWood -= threshold;
|
||||
if(processAsh(ashLevelCoal, EnumAshType.COAL, threshold)) ashLevelCoal -= threshold;
|
||||
if(processAsh(ashLevelMisc, EnumAshType.MISC, threshold)) ashLevelMisc -= threshold;
|
||||
|
||||
this.maxBurnTime = this.burnTime = burn;
|
||||
this.decrStackSize(0, 1);
|
||||
this.markChanged();
|
||||
}
|
||||
}
|
||||
|
||||
} else if(this.power < this.maxPower){
|
||||
} else if(this.power < this.maxPower && isOn){
|
||||
this.burnTime--;
|
||||
this.power += 100;
|
||||
if(power > maxPower) this.power = this.maxPower;
|
||||
@ -80,7 +94,7 @@ public class TileEntityMachineWoodBurner extends TileEntityMachineBase implement
|
||||
|
||||
} else {
|
||||
|
||||
if(this.power < this.maxPower && tank.getFill() > 0) {
|
||||
if(this.power < this.maxPower && tank.getFill() > 0 && isOn) {
|
||||
FT_Flammable trait = tank.getTankType().getTrait(FT_Flammable.class);
|
||||
|
||||
if(trait != null) {
|
||||
@ -98,6 +112,13 @@ public class TileEntityMachineWoodBurner extends TileEntityMachineBase implement
|
||||
data.setBoolean("isOn", isOn);
|
||||
data.setBoolean("liquidBurn", liquidBurn);
|
||||
this.networkPack(data, 25);
|
||||
} else {
|
||||
|
||||
if(this.isOn && ((!this.liquidBurn && this.burnTime > 0) || (this.liquidBurn && this.tank.getTankType().hasTrait(FT_Flammable.class) && tank.getFill() > 0))) {
|
||||
ForgeDirection dir = ForgeDirection.getOrientation(this.getBlockMetadata() - 10);
|
||||
ForgeDirection rot = dir.getRotation(ForgeDirection.UP);
|
||||
worldObj.spawnParticle("smoke", xCoord + 0.5 - dir.offsetX + rot.offsetX, yCoord + 4, zCoord + 0.5 - dir.offsetZ + rot.offsetZ, 0, 0.05, 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -110,6 +131,22 @@ public class TileEntityMachineWoodBurner extends TileEntityMachineBase implement
|
||||
this.liquidBurn = nbt.getBoolean("liquidBurn");
|
||||
}
|
||||
|
||||
protected boolean processAsh(int level, EnumAshType type, int threshold) {
|
||||
|
||||
if(level >= threshold) {
|
||||
if(slots[1] == null) {
|
||||
slots[1] = DictFrame.fromOne(ModItems.powder_ash, type);
|
||||
ashLevelWood -= threshold;
|
||||
return true;
|
||||
} else if(slots[1].stackSize < slots[1].getMaxStackSize() && slots[1].getItem() == ModItems.powder_ash && slots[1].getItemDamage() == type.ordinal()) {
|
||||
slots[1].stackSize++;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void receiveControl(NBTTagCompound data) {
|
||||
if(data.hasKey("toggle")) {
|
||||
@ -138,6 +175,21 @@ public class TileEntityMachineWoodBurner extends TileEntityMachineBase implement
|
||||
return new GUIMachineWoodBurner(player.inventory, this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int[] getAccessibleSlotsFromSide(int meta) {
|
||||
return new int[] { 0, 1 };
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isItemValidForSlot(int i, ItemStack itemStack) {
|
||||
return i == 0 && burnModule.getBurnTime(itemStack) > 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canExtractItem(int slot, ItemStack itemStack, int side) {
|
||||
return slot == 1;
|
||||
}
|
||||
|
||||
@Override
|
||||
public FluidTank[] getAllTanks() {
|
||||
return new FluidTank[] {tank};
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user