Merge branch '1.7.10' into 1.8.9

Conflicts:
	build.gradle
	src/main/java/techreborn/blocks/BlockOre.java
	src/main/java/techreborn/items/ItemCells.java
This commit is contained in:
modmuss50 2016-02-16 13:49:25 +00:00
commit 9a585bcfb2
9 changed files with 81 additions and 8 deletions

View file

@ -73,7 +73,7 @@ public class BlockOre extends BaseBlock implements ITexturedBlock {
this.setDefaultState(this.blockState.getBaseState().withProperty(METADATA, 0));
}
@Deprecated
public ArrayList<ItemStack> getDrops(IBlockAccess world, BlockPos pos, IBlockState state, int fortune) {

View file

@ -11,7 +11,7 @@ import techreborn.tiles.TileQuantumTank;
public class GuiQuantumTank extends GuiContainer {
private static final ResourceLocation texture = new ResourceLocation(
"techreborn", "textures/gui/ThermalGenerator.png");
"techreborn", "textures/gui/thermal_generator.png");
TileQuantumTank tile;

View file

@ -11,7 +11,7 @@ import techreborn.tiles.TileThermalGenerator;
public class GuiThermalGenerator extends GuiContainer {
private static final ResourceLocation texture = new ResourceLocation(
"techreborn", "textures/gui/ThermalGenerator.png");
"techreborn", "textures/gui/thermal_generator.png");
TileThermalGenerator tile;

View file

@ -96,6 +96,11 @@ public class ModItems {
GameRegistry.registerItem(parts, "part");
cells = new ItemCells();
GameRegistry.registerItem(cells, "cell");
for (int i = 0; i < ItemCells.types.length; i++) {
if(FluidRegistry.getFluid("fluid" + ItemCells.types[i].toLowerCase()) != null){
FluidContainerRegistry.registerFluidContainer(FluidRegistry.getFluid("fluid" + ItemCells.types[i].toLowerCase()), ItemCells.getCellByName(ItemCells.types[i]));
}
}
rockCutter = PoweredItem.createItem(ItemRockCutter.class);
GameRegistry.registerItem(rockCutter, "rockCutter");
lithiumBatpack = PoweredItem.createItem(ItemLithiumBatpack.class);

View file

@ -3,16 +3,20 @@ package techreborn.items;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraftforge.fluids.Fluid;
import net.minecraftforge.fluids.FluidRegistry;
import net.minecraftforge.fluids.FluidStack;
import net.minecraftforge.fluids.IFluidContainerItem;
import reborncore.api.IListInfoProvider;
import techreborn.Core;
import techreborn.client.TechRebornCreativeTab;
import techreborn.init.ModItems;
import techreborn.lib.ModInfo;
import java.util.List;
public class ItemCells extends ItemTextureBase {
public class ItemCells extends ItemTextureBase implements IFluidContainerItem {
public static ItemStack getCellByName(String name, int count) {
return getCellByName(name, count, true);
@ -79,10 +83,68 @@ public class ItemCells extends ItemTextureBase {
// Adds Dusts SubItems To Creative Tab
public void getSubItems(Item item, CreativeTabs creativeTabs, List list) {
for (int meta = 0; meta < types.length; ++meta) {
list.add(new ItemStack(item, 1, meta));
ItemStack stack = new ItemStack(item, 1, meta);
if(FluidRegistry.getFluid("fluid" +types[meta].toLowerCase()) != null){
this.fill(stack, new FluidStack(FluidRegistry.getFluid("fluid" +types[meta].toLowerCase()), getCapacity(stack)), true);
}
list.add(stack);
}
}
@Override
public FluidStack getFluid(ItemStack container) {
return FluidStack.loadFluidStackFromNBT(container.getTagCompound());
}
@Override
public int getCapacity(ItemStack container) {
return 1000;
}
@Override
public int fill(ItemStack container, FluidStack resource, boolean doFill) {
if (container.stackSize != 1) {
return 0;
}
if (resource == null || resource.amount != getCapacity(container)) {
return 0;
}
if(FluidRegistry.getFluid("fluid" +types[container.getItemDamage()].toLowerCase()) == null){
return 0;
}
if (doFill)
{
NBTTagCompound tag = container.getTagCompound();
if (tag == null)
{
tag = new NBTTagCompound();
}
resource.writeToNBT(tag);
container.setTagCompound(tag);
}
return getCapacity(container);
}
@Override
public FluidStack drain(ItemStack container, int maxDrain, boolean doDrain) {
if (maxDrain < getCapacity(container)) {
return null;
}
FluidStack fluidStack = getFluid(container);
if (doDrain && fluidStack != null) {
ItemStack empty = ItemCells.getCellByName("empty");
if(empty != null) {
container.setItemDamage(empty.getItemDamage());
container.setTagCompound(empty.getTagCompound());
}
else {
container.stackSize = 0;
}
}
return fluidStack;
}
@Override
public String getTextureName(int damage) {
return ModInfo.MOD_ID + ":items/cells/" + types[damage] + "Cell";