Merge branch 'master' of https://github.com/TechReborn/TechReborn
This commit is contained in:
commit
b08afb1d5a
11 changed files with 167 additions and 10 deletions
|
@ -33,7 +33,8 @@ public class BlockQuantumChest extends BlockContainer {
|
|||
|
||||
@Override
|
||||
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int side, float hitX, float hitY, float hitZ) {
|
||||
player.openGui(Core.INSTANCE, GuiHandler.quantumChestID, world, x, y, z);
|
||||
if(!player.isSneaking())
|
||||
player.openGui(Core.INSTANCE, GuiHandler.quantumChestID, world, x, y, z);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
|
@ -32,7 +32,8 @@ public class BlockQuantumTank extends BlockContainer {
|
|||
|
||||
@Override
|
||||
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int side, float hitX, float hitY, float hitZ) {
|
||||
player.openGui(Core.INSTANCE, GuiHandler.quantumTankID, world, x, y, z);
|
||||
if(!player.isSneaking())
|
||||
player.openGui(Core.INSTANCE, GuiHandler.quantumTankID, world, x, y, z);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
|
@ -55,7 +55,8 @@ public class BlockThermalGenerator extends BlockContainer {
|
|||
|
||||
@Override
|
||||
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int side, float hitX, float hitY, float hitZ) {
|
||||
player.openGui(Core.INSTANCE, GuiHandler.thermalGeneratorID, world, x, y, z);
|
||||
if(!player.isSneaking())
|
||||
player.openGui(Core.INSTANCE, GuiHandler.thermalGeneratorID, world, x, y, z);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
|
@ -7,6 +7,7 @@ import net.minecraftforge.common.config.Configuration;
|
|||
public class ConfigTechReborn {
|
||||
private static ConfigTechReborn instance = null;
|
||||
public static String CATEGORY_WORLD = "world";
|
||||
public static String CATEGORY_POWER = "power";
|
||||
|
||||
//WORLDGEN
|
||||
public static boolean GalenaOreTrue;
|
||||
|
@ -22,6 +23,8 @@ public class ConfigTechReborn {
|
|||
public static boolean OlivineOreTrue;
|
||||
public static boolean SodaliteOreTrue;
|
||||
|
||||
//Power
|
||||
public static int ThermalGenertaorOutput;
|
||||
|
||||
|
||||
public static Configuration config;
|
||||
|
@ -109,6 +112,11 @@ public class ConfigTechReborn {
|
|||
"Allow SodaliteOre", true,
|
||||
"Allow SodaliteOre to be generated in your world.")
|
||||
.getBoolean(true);
|
||||
|
||||
ThermalGenertaorOutput = config.get(CATEGORY_POWER,
|
||||
"Thermal Generator Power", 30,
|
||||
"The amount of power that the thermal generator makes for 1mb of lava")
|
||||
.getInt();
|
||||
|
||||
if (config.hasChanged())
|
||||
config.save();
|
||||
|
|
|
@ -27,7 +27,9 @@ public class TechRebornConfigGui extends GuiConfig{
|
|||
"tr.configgui.category.trGeneral", TRGeneral.class));
|
||||
list.add(new DummyConfigElement.DummyCategoryElement("World Gen",
|
||||
"tr.configgui.category.trWorld", TRWORLD.class));
|
||||
|
||||
list.add(new DummyConfigElement.DummyCategoryElement("Power",
|
||||
"tr.configgui.category.trPower", TRPOWER.class));
|
||||
|
||||
return list;
|
||||
}
|
||||
|
||||
|
@ -75,4 +77,28 @@ public class TechRebornConfigGui extends GuiConfig{
|
|||
.toString()));
|
||||
}
|
||||
}
|
||||
|
||||
// Power
|
||||
public static class TRPOWER extends CategoryEntry {
|
||||
public TRPOWER(GuiConfig owningScreen, GuiConfigEntries owningEntryList, IConfigElement configElement)
|
||||
{
|
||||
super(owningScreen, owningEntryList, configElement);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected GuiScreen buildChildScreen()
|
||||
{
|
||||
return new GuiConfig(this.owningScreen,
|
||||
(new ConfigElement(ConfigTechReborn.config
|
||||
.getCategory(ConfigTechReborn.CATEGORY_POWER)))
|
||||
.getChildElements(), this.owningScreen.modID,
|
||||
Configuration.CATEGORY_GENERAL,
|
||||
this.configElement.requiresWorldRestart()
|
||||
|| this.owningScreen.allRequireWorldRestart,
|
||||
this.configElement.requiresMcRestart()
|
||||
|| this.owningScreen.allRequireMcRestart,
|
||||
GuiConfig.getAbridgedConfigPath(ConfigTechReborn.config
|
||||
.toString()));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -6,6 +6,8 @@ import techreborn.blocks.BlockQuantumTank;
|
|||
import techreborn.blocks.BlockThermalGenerator;
|
||||
import techreborn.client.TechRebornCreativeTab;
|
||||
import techreborn.itemblocks.ItemBlockOre;
|
||||
import techreborn.itemblocks.ItemBlockQuantumChest;
|
||||
import techreborn.itemblocks.ItemBlockQuantumTank;
|
||||
import techreborn.tiles.TileQuantumChest;
|
||||
import techreborn.tiles.TileQuantumTank;
|
||||
import techreborn.tiles.TileThermalGenerator;
|
||||
|
@ -27,11 +29,11 @@ public class ModBlocks {
|
|||
GameRegistry.registerTileEntity(TileThermalGenerator.class, "TileThermalGenerator");
|
||||
|
||||
quantumTank = new BlockQuantumTank().setBlockName("techreborn.quantumTank").setBlockTextureName("techreborn:quantumTank").setCreativeTab(TechRebornCreativeTab.instance);
|
||||
GameRegistry.registerBlock(quantumTank, "techreborn.quantumTank");
|
||||
GameRegistry.registerBlock(quantumTank, ItemBlockQuantumTank.class, "techreborn.quantumTank");
|
||||
GameRegistry.registerTileEntity(TileQuantumTank.class, "TileQuantumTank");
|
||||
|
||||
quantumChest = new BlockQuantumChest().setBlockName("techreborn.quantumChest").setBlockTextureName("techreborn:quantumChest").setCreativeTab(TechRebornCreativeTab.instance);
|
||||
GameRegistry.registerBlock(quantumChest, "techreborn.quantumChest");
|
||||
GameRegistry.registerBlock(quantumChest, ItemBlockQuantumChest.class, "techreborn.quantumChest");
|
||||
GameRegistry.registerTileEntity(TileQuantumChest.class, "TileQuantumChest");
|
||||
|
||||
ore = new BlockOre(Material.rock);
|
||||
|
|
|
@ -0,0 +1,48 @@
|
|||
package techreborn.itemblocks;
|
||||
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemBlock;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.world.World;
|
||||
import techreborn.init.ModBlocks;
|
||||
import techreborn.tiles.TileQuantumChest;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
|
||||
public class ItemBlockQuantumChest extends ItemBlock {
|
||||
|
||||
public ItemBlockQuantumChest(Block p_i45328_1_) {
|
||||
super(p_i45328_1_);
|
||||
}
|
||||
|
||||
@SuppressWarnings({ "rawtypes", "unchecked" })
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void addInformation(ItemStack stack, EntityPlayer player, List list, boolean par4) {
|
||||
if (stack != null && stack.hasTagCompound()) {
|
||||
if (stack.getTagCompound().getCompoundTag("tileEntity") != null)
|
||||
list.add(stack.getTagCompound().getCompoundTag("tileEntity").getInteger("storedQuantity") + " items");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean placeBlockAt(ItemStack stack, EntityPlayer player, World world, int x, int y, int z, int side, float hitX, float hitY, float hitZ, int metadata)
|
||||
{
|
||||
if (!world.setBlock(x, y, z, ModBlocks.quantumChest, metadata, 3)) {
|
||||
return false;
|
||||
}
|
||||
if (world.getBlock(x, y, z) == ModBlocks.quantumChest) {
|
||||
world.getBlock(x, y, z).onBlockPlacedBy(world, x, y, z, player, stack);
|
||||
world.getBlock(x, y, z).onPostBlockPlaced(world, x, y, z, metadata);
|
||||
}
|
||||
if (stack != null && stack.hasTagCompound()) {
|
||||
((TileQuantumChest) world.getTileEntity(x, y, z)).readFromNBTWithoutCoords(stack.getTagCompound().getCompoundTag("tileEntity"));
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,34 @@
|
|||
package techreborn.itemblocks;
|
||||
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemBlock;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.world.World;
|
||||
import techreborn.init.ModBlocks;
|
||||
import techreborn.tiles.TileQuantumTank;
|
||||
|
||||
public class ItemBlockQuantumTank extends ItemBlock {
|
||||
|
||||
public ItemBlockQuantumTank(Block block) {
|
||||
super(block);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean placeBlockAt(ItemStack stack, EntityPlayer player, World world, int x, int y, int z, int side, float hitX, float hitY, float hitZ, int metadata)
|
||||
{
|
||||
if (!world.setBlock(x, y, z, ModBlocks.quantumTank, metadata, 3)) {
|
||||
return false;
|
||||
}
|
||||
if (world.getBlock(x, y, z) == ModBlocks.quantumTank) {
|
||||
world.getBlock(x, y, z).onBlockPlacedBy(world, x, y, z, player, stack);
|
||||
world.getBlock(x, y, z).onPostBlockPlaced(world, x, y, z, metadata);
|
||||
}
|
||||
if (stack != null && stack.hasTagCompound()) {
|
||||
((TileQuantumTank) world.getTileEntity(x, y, z)).readFromNBTWithoutCoords(stack.getTagCompound().getCompoundTag("tileEntity"));
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
|
@ -5,7 +5,6 @@ import net.minecraft.entity.player.EntityPlayer;
|
|||
import net.minecraft.inventory.IInventory;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.nbt.NBTTagList;
|
||||
import net.minecraft.network.NetworkManager;
|
||||
import net.minecraft.network.Packet;
|
||||
import net.minecraft.network.play.server.S35PacketUpdateTileEntity;
|
||||
|
@ -78,6 +77,10 @@ public class TileQuantumChest extends TileEntity implements IInventory ,IWrencha
|
|||
@Override
|
||||
public void readFromNBT(NBTTagCompound tagCompound) {
|
||||
super.readFromNBT(tagCompound);
|
||||
readFromNBTWithoutCoords(tagCompound);
|
||||
}
|
||||
|
||||
public void readFromNBTWithoutCoords(NBTTagCompound tagCompound) {
|
||||
inventory.readFromNBT(tagCompound);
|
||||
|
||||
storedItem = null;
|
||||
|
@ -96,6 +99,10 @@ public class TileQuantumChest extends TileEntity implements IInventory ,IWrencha
|
|||
@Override
|
||||
public void writeToNBT(NBTTagCompound tagCompound) {
|
||||
super.writeToNBT(tagCompound);
|
||||
writeToNBTWithoutCoords(tagCompound);
|
||||
}
|
||||
|
||||
public void writeToNBTWithoutCoords(NBTTagCompound tagCompound) {
|
||||
inventory.writeToNBT(tagCompound);
|
||||
if (storedItem != null)
|
||||
{
|
||||
|
@ -192,6 +199,16 @@ public class TileQuantumChest extends TileEntity implements IInventory ,IWrencha
|
|||
|
||||
@Override
|
||||
public ItemStack getWrenchDrop(EntityPlayer entityPlayer) {
|
||||
return new ItemStack(ModBlocks.quantumChest);
|
||||
return getDropWithNBT();
|
||||
}
|
||||
|
||||
public ItemStack getDropWithNBT() {
|
||||
NBTTagCompound tileEntity = new NBTTagCompound();
|
||||
ItemStack dropStack = new ItemStack(ModBlocks.quantumChest, 1);
|
||||
writeToNBTWithoutCoords(tileEntity);
|
||||
dropStack.setTagCompound(new NBTTagCompound());
|
||||
dropStack.stackTagCompound.setTag("tileEntity", tileEntity);
|
||||
return dropStack;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -27,6 +27,10 @@ public class TileQuantumTank extends TileEntity implements IFluidHandler, IInven
|
|||
@Override
|
||||
public void readFromNBT(NBTTagCompound tagCompound) {
|
||||
super.readFromNBT(tagCompound);
|
||||
readFromNBTWithoutCoords(tagCompound);
|
||||
}
|
||||
|
||||
public void readFromNBTWithoutCoords(NBTTagCompound tagCompound) {
|
||||
tank.readFromNBT(tagCompound);
|
||||
inventory.readFromNBT(tagCompound);
|
||||
}
|
||||
|
@ -34,10 +38,15 @@ public class TileQuantumTank extends TileEntity implements IFluidHandler, IInven
|
|||
@Override
|
||||
public void writeToNBT(NBTTagCompound tagCompound) {
|
||||
super.writeToNBT(tagCompound);
|
||||
writeToNBTWithoutCoords(tagCompound);
|
||||
}
|
||||
|
||||
public void writeToNBTWithoutCoords(NBTTagCompound tagCompound) {
|
||||
tank.writeToNBT(tagCompound);
|
||||
inventory.writeToNBT(tagCompound);
|
||||
}
|
||||
|
||||
|
||||
public Packet getDescriptionPacket() {
|
||||
NBTTagCompound nbtTag = new NBTTagCompound();
|
||||
writeToNBT(nbtTag);
|
||||
|
@ -180,6 +189,15 @@ public class TileQuantumTank extends TileEntity implements IFluidHandler, IInven
|
|||
|
||||
@Override
|
||||
public ItemStack getWrenchDrop(EntityPlayer entityPlayer) {
|
||||
return new ItemStack(ModBlocks.quantumTank);
|
||||
return getDropWithNBT();
|
||||
}
|
||||
|
||||
public ItemStack getDropWithNBT() {
|
||||
NBTTagCompound tileEntity = new NBTTagCompound();
|
||||
ItemStack dropStack = new ItemStack(ModBlocks.quantumTank, 1);
|
||||
writeToNBTWithoutCoords(tileEntity);
|
||||
dropStack.setTagCompound(new NBTTagCompound());
|
||||
dropStack.stackTagCompound.setTag("tileEntity", tileEntity);
|
||||
return dropStack;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -17,6 +17,7 @@ import net.minecraftforge.fluids.FluidRegistry;
|
|||
import net.minecraftforge.fluids.FluidStack;
|
||||
import net.minecraftforge.fluids.FluidTankInfo;
|
||||
import net.minecraftforge.fluids.IFluidHandler;
|
||||
import techreborn.config.ConfigTechReborn;
|
||||
import techreborn.init.ModBlocks;
|
||||
import techreborn.util.FluidUtils;
|
||||
import techreborn.util.Inventory;
|
||||
|
@ -27,7 +28,7 @@ public class TileThermalGenerator extends TileEntity implements IWrenchable, IFl
|
|||
public Tank tank = new Tank("TileThermalGenerator", FluidContainerRegistry.BUCKET_VOLUME * 10, this);
|
||||
public Inventory inventory = new Inventory(3, "TileThermalGenerator", 64);
|
||||
public BasicSource energySource;
|
||||
public static final int euTick = 30;
|
||||
public static final int euTick = ConfigTechReborn.ThermalGenertaorOutput;
|
||||
|
||||
public TileThermalGenerator() {
|
||||
this.energySource = new BasicSource(this, 1000000, 1);
|
||||
|
|
Loading…
Reference in a new issue