More configs and ISidedInventory

This commit is contained in:
modmuss50 2015-04-14 21:23:45 +01:00
parent a6451e7946
commit bdea893392
3 changed files with 64 additions and 8 deletions

View file

@ -26,6 +26,7 @@ public class ConfigTechReborn {
//Power //Power
public static int ThermalGenertaorOutput; public static int ThermalGenertaorOutput;
public static int CentrifugeInputTick;
//Charge //Charge
public static int AdvancedDrillCharge; public static int AdvancedDrillCharge;
public static int LapotronPackCharge; public static int LapotronPackCharge;
@ -33,6 +34,8 @@ public class ConfigTechReborn {
public static int OmniToolCharge; public static int OmniToolCharge;
public static int RockCutterCharge; public static int RockCutterCharge;
public static int GravityCharge; public static int GravityCharge;
public static int CentrifugeCharge;
public static int ThermalGeneratorCharge;
//Teir //Teir
public static int AdvancedDrillTier; public static int AdvancedDrillTier;
public static int LapotronPackTier; public static int LapotronPackTier;
@ -40,7 +43,8 @@ public class ConfigTechReborn {
public static int OmniToolTier; public static int OmniToolTier;
public static int RockCutterTier; public static int RockCutterTier;
public static int GravityTier; public static int GravityTier;
public static int CentrifugeTier;
public static int ThermalGeneratorTier;
//Crafting //Crafting
public static boolean ExpensiveMacerator; public static boolean ExpensiveMacerator;
public static boolean ExpensiveDrill; public static boolean ExpensiveDrill;
@ -142,6 +146,10 @@ public class ConfigTechReborn {
"Thermal Generator Power", 30, "Thermal Generator Power", 30,
"The amount of power that the thermal generator makes for 1mb of lava") "The amount of power that the thermal generator makes for 1mb of lava")
.getInt(); .getInt();
CentrifugeInputTick = config.get(CATEGORY_POWER,
"Centrifuge power usage", 5,
"The amount of eu per tick that the Centrifuge uses.")
.getInt();
//Charge //Charge
AdvancedDrillCharge = config.get(CATEGORY_POWER, AdvancedDrillCharge = config.get(CATEGORY_POWER,
"Advanced drill max charge", 60000, "Advanced drill max charge", 60000,
@ -167,6 +175,14 @@ public class ConfigTechReborn {
"Gravity Chestplate max charge", 100000, "Gravity Chestplate max charge", 100000,
"The amount of power that the Gravity Chestplate can hold") "The amount of power that the Gravity Chestplate can hold")
.getInt(); .getInt();
CentrifugeCharge = config.get(CATEGORY_POWER,
"Centrifuge max charge", 1000000,
"The amount of power that the Centrifuge can hold")
.getInt();
ThermalGeneratorCharge = config.get(CATEGORY_POWER,
"Thermal Generator max charge", 1000000,
"The amount of power that the Thermal Generator can hold")
.getInt();
//Teir //Teir
AdvancedDrillTier = config.get(CATEGORY_POWER, AdvancedDrillTier = config.get(CATEGORY_POWER,
"Advanced drill Tier", 2, "Advanced drill Tier", 2,
@ -192,8 +208,14 @@ public class ConfigTechReborn {
"GravityChestplate tier", 3, "GravityChestplate tier", 3,
"The tier of the GravityChestplate") "The tier of the GravityChestplate")
.getInt(); .getInt();
CentrifugeTier = config.get(CATEGORY_POWER,
"Centrifuge tier", 1,
"The tier of the Centrifuge")
.getInt();
ThermalGeneratorTier = config.get(CATEGORY_POWER,
"Thermal Generator tier", 1,
"The tier of the Thermal Generator")
.getInt();
//Crafting //Crafting
ExpensiveMacerator = config.get(CATEGORY_CRAFTING, ExpensiveMacerator = config.get(CATEGORY_CRAFTING,

View file

@ -4,6 +4,7 @@ import ic2.api.energy.prefab.BasicSink;
import ic2.api.tile.IWrenchable; import ic2.api.tile.IWrenchable;
import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.inventory.IInventory; import net.minecraft.inventory.IInventory;
import net.minecraft.inventory.ISidedInventory;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound; import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.network.NetworkManager; import net.minecraft.network.NetworkManager;
@ -11,11 +12,12 @@ import net.minecraft.network.Packet;
import net.minecraft.network.play.server.S35PacketUpdateTileEntity; import net.minecraft.network.play.server.S35PacketUpdateTileEntity;
import techreborn.api.CentrifugeRecipie; import techreborn.api.CentrifugeRecipie;
import techreborn.api.TechRebornAPI; import techreborn.api.TechRebornAPI;
import techreborn.config.ConfigTechReborn;
import techreborn.init.ModBlocks; import techreborn.init.ModBlocks;
import techreborn.util.Inventory; import techreborn.util.Inventory;
import techreborn.util.ItemUtils; import techreborn.util.ItemUtils;
public class TileCentrifuge extends TileMachineBase implements IInventory, IWrenchable { public class TileCentrifuge extends TileMachineBase implements IInventory, IWrenchable, ISidedInventory {
public BasicSink energy; public BasicSink energy;
public Inventory inventory = new Inventory(6, "TileCentrifuge", 64); public Inventory inventory = new Inventory(6, "TileCentrifuge", 64);
@ -26,11 +28,10 @@ public class TileCentrifuge extends TileMachineBase implements IInventory, IWren
public boolean hasTakenCells = false; public boolean hasTakenCells = false;
public boolean hasTakenItem = false; public boolean hasTakenItem = false;
public int euTick = 5; public int euTick = ConfigTechReborn.CentrifugeInputTick;
public TileCentrifuge() { public TileCentrifuge() {
//TODO check values, + config energy = new BasicSink(this, ConfigTechReborn.CentrifugeCharge, ConfigTechReborn.CentrifugeTier);
energy = new BasicSink(this, 100000, 1);
} }
@Override @Override
@ -312,4 +313,37 @@ public class TileCentrifuge extends TileMachineBase implements IInventory, IWren
public ItemStack getWrenchDrop(EntityPlayer entityPlayer) { public ItemStack getWrenchDrop(EntityPlayer entityPlayer) {
return new ItemStack(ModBlocks.centrifuge, 1); return new ItemStack(ModBlocks.centrifuge, 1);
} }
@Override
public int[] getAccessibleSlotsFromSide(int side) {
//Top
if(side == 1){
return new int[]{0};
}
//Bottom
if(side == 0){
return new int[]{1};
}
//Not bottom or top
return new int[]{2, 3, 4, 5};
}
@Override
public boolean canInsertItem(int slot, ItemStack stack, int side) {
//Bottom
if(side == 0){
return stack.getUnlocalizedName().equals("ic2.itemFluidCell");
}
//Not bottom or top
if(side >= 2){
return false;
}
return true;
}
@Override
public boolean canExtractItem(int slot, ItemStack stack, int side) {
//Only output slots and sides
return slot >= 2 && side >= 2;
}
} }

View file

@ -31,7 +31,7 @@ public class TileThermalGenerator extends TileEntity implements IWrenchable, IFl
public static final int euTick = ConfigTechReborn.ThermalGenertaorOutput; public static final int euTick = ConfigTechReborn.ThermalGenertaorOutput;
public TileThermalGenerator() { public TileThermalGenerator() {
this.energySource = new BasicSource(this, 1000000, 1); this.energySource = new BasicSource(this, ConfigTechReborn.ThermalGeneratorCharge, ConfigTechReborn.ThermalGeneratorTier);
} }
@Override @Override