Recycler output is now a random chance
This commit is contained in:
parent
f170f9a418
commit
007f9266e5
3 changed files with 42 additions and 27 deletions
|
@ -38,7 +38,7 @@ public class GuiRecycler extends GuiContainer {
|
|||
|
||||
int j = 0;
|
||||
|
||||
j = compressor.gaugeProgressScaled(1);
|
||||
j = compressor.gaugeProgressScaled(24);
|
||||
if (j > 0) {
|
||||
this.drawTexturedModalRect(k + 78, l + 35, 176, 14, j + 1, 16);
|
||||
}
|
||||
|
@ -54,5 +54,4 @@ public class GuiRecycler extends GuiContainer {
|
|||
this.fontRendererObj.drawString(name, this.xSize / 2 - this.fontRendererObj.getStringWidth(name) / 2, 6, 4210752);
|
||||
this.fontRendererObj.drawString(I18n.format("container.inventory", new Object[0]), 8, this.ySize - 96 + 2, 4210752);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -62,7 +62,7 @@ public class RecipeCompact implements IRecipeCompact {
|
|||
recipes.put("hvTransformer", ItemParts.getPartByName("hvTransformer"));
|
||||
recipes.put("windMill", new ItemStack(ModBlocks.windMill));
|
||||
recipes.put("energyCrystal", new ItemStack(ModItems.energyCrystal));
|
||||
recipes.put("lapotronCrystal", new ItemStack(ModItems.lapotronCrystal));
|
||||
// recipes.put("lapotronCrystal", new ItemStack(ModItems.lapotronCrystal));
|
||||
inited = false;
|
||||
}
|
||||
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
package techreborn.tiles.teir1;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
import ic2.api.tile.IWrenchable;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
|
@ -18,13 +20,15 @@ import techreborn.init.ModItems;
|
|||
import techreborn.items.ItemParts;
|
||||
import techreborn.lib.Reference;
|
||||
|
||||
public class TileRecycler extends TilePowerAcceptor implements IWrenchable, IInventory, ISidedInventory{
|
||||
public class TileRecycler extends TilePowerAcceptor implements IWrenchable, IInventory, ISidedInventory {
|
||||
|
||||
public Inventory inventory = new Inventory(6, "TileRecycler", 64, this);
|
||||
public int capacity = 1000;
|
||||
public int cost = 20;
|
||||
public int progress;
|
||||
public int time = 100;
|
||||
public int time = 800;
|
||||
public int chance = 4;
|
||||
public int random;
|
||||
|
||||
public TileRecycler() {
|
||||
super(1);
|
||||
|
@ -38,40 +42,52 @@ public class TileRecycler extends TilePowerAcceptor implements IWrenchable, IInv
|
|||
@Override
|
||||
public void updateEntity()
|
||||
{
|
||||
if(!worldObj.isRemote)
|
||||
boolean updateInventory = false;
|
||||
if(getEnergy() > cost)
|
||||
{
|
||||
if(getEnergy() > cost)
|
||||
{
|
||||
if(getStackInSlot(0) != null)
|
||||
{
|
||||
if(progress == 0)
|
||||
{
|
||||
if(getStackInSlot(0).stackSize > 1)
|
||||
{
|
||||
decrStackSize(0, 1);
|
||||
}
|
||||
if(getStackInSlot(0).stackSize == 1)
|
||||
{
|
||||
setInventorySlotContents(0, null);
|
||||
}
|
||||
}
|
||||
progress++;
|
||||
if(getStackInSlot(0) != null)
|
||||
{
|
||||
if(progress == 0)
|
||||
{
|
||||
int randchance = worldObj.rand.nextInt(chance);
|
||||
random = randchance;
|
||||
|
||||
if(progress >= cost)
|
||||
if(getStackInSlot(0).stackSize > 1)
|
||||
{
|
||||
decrStackSize(0, 1);
|
||||
}
|
||||
if(getStackInSlot(0).stackSize == 1)
|
||||
{
|
||||
setInventorySlotContents(0, null);
|
||||
}
|
||||
updateInventory = true;
|
||||
}
|
||||
progress++;
|
||||
|
||||
if(progress >= time)
|
||||
{
|
||||
if(random == 1)
|
||||
{
|
||||
if(getStackInSlot(1) == null)
|
||||
{
|
||||
setInventorySlotContents(1, ItemParts.getPartByName("scrap"));
|
||||
progress = 0;
|
||||
updateInventory = true;
|
||||
}
|
||||
if(getStackInSlot(1).stackSize >= 1)
|
||||
else if(getStackInSlot(1).stackSize >= 1)
|
||||
{
|
||||
getStackInSlot(1).stackSize++;
|
||||
progress = 0;
|
||||
updateInventory = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if(random != 1)
|
||||
{
|
||||
progress = 0;
|
||||
updateInventory = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue