It compiles, disable JEI as it needs redoing
This commit is contained in:
parent
a0e6a2dc34
commit
65e651f402
97 changed files with 246 additions and 1111 deletions
|
@ -39,7 +39,7 @@ public abstract class BaseRecipeWrapper<T extends BaseRecipe> extends BlankRecip
|
|||
String oreName = OreDictionary.getOreName(oreId);
|
||||
List<ItemStack> ores = OreDictionary.getOres(oreName);
|
||||
for (ItemStack ore : ores) {
|
||||
if (ore.stackSize != itemStack.stackSize) {
|
||||
if (ore.getCount() != itemStack.stackSize) {
|
||||
ItemStack oreCopy = ore.copy();
|
||||
oreCopy.stackSize = itemStack.stackSize;
|
||||
itemStackSet.add(oreCopy);
|
|
@ -48,7 +48,7 @@ import techreborn.world.VeinWorldGenerator;
|
|||
|
||||
import java.io.File;
|
||||
|
||||
@Mod(modid = ModInfo.MOD_ID, name = ModInfo.MOD_NAME, version = ModInfo.MOD_VERSION, dependencies = ModInfo.MOD_DEPENDENCIES, guiFactory = ModInfo.GUI_FACTORY_CLASS, acceptedMinecraftVersions = "[1.9.4]")
|
||||
@Mod(modid = ModInfo.MOD_ID, name = ModInfo.MOD_NAME, version = ModInfo.MOD_VERSION, dependencies = ModInfo.MOD_DEPENDENCIES, guiFactory = ModInfo.GUI_FACTORY_CLASS, acceptedMinecraftVersions = "[1.11]")
|
||||
public class Core {
|
||||
|
||||
public Core() {
|
||||
|
@ -99,7 +99,7 @@ public class Core {
|
|||
// Register ModItems
|
||||
ModItems.init();
|
||||
// Entitys
|
||||
EntityRegistry.registerModEntity(EntityNukePrimed.class, "nuke", 0, INSTANCE, 160, 5, true);
|
||||
// EntityRegistry.registerModEntity(EntityNukePrimed.class, "nuke", 0, INSTANCE, 160, 5, true);
|
||||
|
||||
proxy.preInit(event);
|
||||
|
||||
|
|
|
@ -91,7 +91,7 @@ public class BlockFlare extends BlockContainer {
|
|||
}
|
||||
|
||||
@Override
|
||||
public AxisAlignedBB getCollisionBoundingBox(IBlockState blockState, World worldIn, BlockPos pos) {
|
||||
public AxisAlignedBB getCollisionBoundingBox(IBlockState blockState, IBlockAccess worldIn, BlockPos pos) {
|
||||
return FLARE_BB;
|
||||
}
|
||||
|
||||
|
|
|
@ -11,6 +11,7 @@ import net.minecraft.item.Item;
|
|||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.util.NonNullList;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraft.world.World;
|
||||
|
@ -69,7 +70,7 @@ public class BlockMachineCasing extends BlockMultiblockBase implements ITextured
|
|||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void getSubBlocks(Item item, CreativeTabs creativeTabs, List<ItemStack> list) {
|
||||
public void getSubBlocks(Item item, CreativeTabs creativeTabs, NonNullList<ItemStack> list) {
|
||||
for (int meta = 0; meta < types.length; meta++) {
|
||||
list.add(new ItemStack(item, 1, meta));
|
||||
}
|
||||
|
|
|
@ -9,6 +9,7 @@ import net.minecraft.creativetab.CreativeTabs;
|
|||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.util.NonNullList;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
import reborncore.common.BaseBlock;
|
||||
|
@ -41,7 +42,7 @@ public class BlockMachineFrame extends BaseBlock implements ITexturedBlock {
|
|||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void getSubBlocks(Item item, CreativeTabs creativeTabs, List<ItemStack> list) {
|
||||
public void getSubBlocks(Item item, CreativeTabs creativeTabs, NonNullList<ItemStack> list) {
|
||||
for (int meta = 0; meta < types.length; meta++) {
|
||||
list.add(new ItemStack(item, 1, meta));
|
||||
}
|
||||
|
|
|
@ -39,7 +39,7 @@ public class BlockNuke extends BaseBlock implements ITexturedBlock {
|
|||
if (!worldIn.isRemote) {
|
||||
EntityNukePrimed entitynukeprimed = new EntityNukePrimed(worldIn, (double) ((float) pos.getX() + 0.5F),
|
||||
(double) pos.getY(), (double) ((float) pos.getZ() + 0.5F), igniter);
|
||||
worldIn.spawnEntityInWorld(entitynukeprimed);
|
||||
worldIn.spawnEntity(entitynukeprimed);
|
||||
// worldIn.playSoundAtEntity(entitynukeprimed, "game.tnt.primed",
|
||||
// 1.0F, 1.0F);
|
||||
}
|
||||
|
@ -51,7 +51,7 @@ public class BlockNuke extends BaseBlock implements ITexturedBlock {
|
|||
EntityNukePrimed entitynukeprimed = new EntityNukePrimed(worldIn, (double) ((float) pos.getX() + 0.5F),
|
||||
(double) pos.getY(), (double) ((float) pos.getZ() + 0.5F), explosionIn.getExplosivePlacedBy());
|
||||
entitynukeprimed.fuse = worldIn.rand.nextInt(entitynukeprimed.fuse / 4) + entitynukeprimed.fuse / 8;
|
||||
worldIn.spawnEntityInWorld(entitynukeprimed);
|
||||
worldIn.spawnEntity(entitynukeprimed);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -87,7 +87,7 @@ public class BlockNuke extends BaseBlock implements ITexturedBlock {
|
|||
|
||||
@Override
|
||||
public boolean onBlockActivated(World worldIn, BlockPos pos, IBlockState state, EntityPlayer playerIn,
|
||||
EnumHand hand, ItemStack heldItem, EnumFacing side, float hitX, float hitY, float hitZ) {
|
||||
EnumHand hand, EnumFacing side, float hitX, float hitY, float hitZ) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
|
@ -11,6 +11,7 @@ import net.minecraft.init.Items;
|
|||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.util.NonNullList;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.math.RayTraceResult;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
|
@ -151,7 +152,7 @@ public class BlockOre extends BaseBlock implements ITexturedBlock, IOreNameProvi
|
|||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void getSubBlocks(Item item, CreativeTabs creativeTabs, List list) {
|
||||
public void getSubBlocks(Item item, CreativeTabs creativeTabs, NonNullList<ItemStack> list) {
|
||||
for (int meta = 0; meta < ores.length; meta++) {
|
||||
list.add(new ItemStack(item, 1, meta));
|
||||
}
|
||||
|
|
|
@ -10,6 +10,7 @@ import net.minecraft.entity.player.EntityPlayer;
|
|||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.util.NonNullList;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.math.RayTraceResult;
|
||||
import net.minecraft.world.World;
|
||||
|
@ -75,7 +76,7 @@ public class BlockOre2 extends BaseBlock implements ITexturedBlock, IOreNameProv
|
|||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void getSubBlocks(Item item, CreativeTabs creativeTabs, List list) {
|
||||
public void getSubBlocks(Item item, CreativeTabs creativeTabs, NonNullList<ItemStack> list) {
|
||||
for (int meta = 0; meta < ores.length; meta++) {
|
||||
list.add(new ItemStack(item, 1, meta));
|
||||
}
|
||||
|
|
|
@ -12,6 +12,7 @@ import net.minecraft.item.ItemStack;
|
|||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.util.EnumHand;
|
||||
import net.minecraft.util.NonNullList;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.text.TextComponentString;
|
||||
import net.minecraft.util.text.TextFormatting;
|
||||
|
@ -53,7 +54,7 @@ public class BlockPlayerDetector extends BlockMachineBase implements ITexturedBl
|
|||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void getSubBlocks(Item item, CreativeTabs creativeTabs, List list) {
|
||||
public void getSubBlocks(Item item, CreativeTabs creativeTabs, NonNullList<ItemStack> list) {
|
||||
for (int meta = 0; meta < types.length; meta++) {
|
||||
list.add(new ItemStack(item, 1, meta));
|
||||
}
|
||||
|
@ -104,7 +105,7 @@ public class BlockPlayerDetector extends BlockMachineBase implements ITexturedBl
|
|||
|
||||
@Override
|
||||
public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer entityPlayer,
|
||||
EnumHand hand, ItemStack heldItem, EnumFacing side, float hitX, float hitY, float hitZ) {
|
||||
EnumHand hand, EnumFacing side, float hitX, float hitY, float hitZ) {
|
||||
String type = state.getValue(TYPE);
|
||||
String newType = type;
|
||||
TextFormatting color = TextFormatting.GREEN;
|
||||
|
|
|
@ -33,7 +33,7 @@ public class BlockQuantumChest extends BlockMachineBase implements IAdvancedRota
|
|||
|
||||
@Override
|
||||
public boolean onBlockActivated(World worldIn, BlockPos pos, IBlockState state, EntityPlayer playerIn,
|
||||
EnumHand hand, ItemStack heldItem, EnumFacing side, float hitX, float hitY, float hitZ) {
|
||||
EnumHand hand, EnumFacing side, float hitX, float hitY, float hitZ) {
|
||||
if (!playerIn.isSneaking())
|
||||
playerIn.openGui(Core.INSTANCE, GuiHandler.quantumChestID, worldIn, pos.getX(), pos.getY(), pos.getZ());
|
||||
return true;
|
||||
|
|
|
@ -64,13 +64,14 @@ public class BlockRubberLeaves extends BlockLeaves implements ITexturedBlock, IO
|
|||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected ItemStack createStackedBlock(IBlockState state) {
|
||||
IBlockState newState = state.withProperty(CHECK_DECAY, false).withProperty(DECAYABLE,
|
||||
false);
|
||||
|
||||
return super.createStackedBlock(newState);
|
||||
}
|
||||
//TODO 1.11: what is this?
|
||||
// @Override
|
||||
// protected ItemStack createStackedBlock(IBlockState state) {
|
||||
// IBlockState newState = state.withProperty(CHECK_DECAY, false).withProperty(DECAYABLE,
|
||||
// false);
|
||||
//
|
||||
// return super.createStackedBlock(newState);
|
||||
// }
|
||||
|
||||
@Override
|
||||
public String getTextureNameFromState(IBlockState IBlockState, EnumFacing enumFacing) {
|
||||
|
|
|
@ -147,8 +147,8 @@ public class BlockRubberLog extends Block implements ITexturedBlock {
|
|||
|
||||
@Override
|
||||
public boolean onBlockActivated(World worldIn, BlockPos pos, IBlockState state, EntityPlayer playerIn,
|
||||
EnumHand hand, ItemStack heldItem, EnumFacing side, float hitX, float hitY, float hitZ) {
|
||||
super.onBlockActivated(worldIn, pos, state, playerIn, hand, heldItem, side, hitX, hitY, hitZ);
|
||||
EnumHand hand, EnumFacing side, float hitX, float hitY, float hitZ) {
|
||||
super.onBlockActivated(worldIn, pos, state, playerIn, hand, side, hitX, hitY, hitZ);
|
||||
ItemStack stack = playerIn.getHeldItem(EnumHand.MAIN_HAND);
|
||||
if (stack != null)
|
||||
if ((stack.getItem() instanceof ItemElectricTreetap && PoweredItem.canUseEnergy(20, stack)) || stack.getItem() instanceof ItemTreeTap)
|
||||
|
@ -174,7 +174,7 @@ public class BlockRubberLog extends Block implements ITexturedBlock {
|
|||
item.motionX = rand.nextGaussian() * factor;
|
||||
item.motionY = rand.nextGaussian() * factor + 0.2F;
|
||||
item.motionZ = rand.nextGaussian() * factor;
|
||||
worldIn.spawnEntityInWorld(item);
|
||||
worldIn.spawnEntity(item);
|
||||
}
|
||||
}
|
||||
return true;
|
||||
|
|
|
@ -6,6 +6,7 @@ import net.minecraft.block.state.IBlockState;
|
|||
import net.minecraft.creativetab.CreativeTabs;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.NonNullList;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.World;
|
||||
import techreborn.client.TechRebornCreativeTabMisc;
|
||||
|
@ -39,7 +40,7 @@ public class BlockRubberSapling extends BlockSapling {
|
|||
}
|
||||
|
||||
@Override
|
||||
public void getSubBlocks(Item itemIn, CreativeTabs tab, List<ItemStack> list) {
|
||||
public void getSubBlocks(Item itemIn, CreativeTabs tab, NonNullList<ItemStack> list) {
|
||||
list.add(new ItemStack(itemIn, 1, 0));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -9,6 +9,7 @@ import net.minecraft.creativetab.CreativeTabs;
|
|||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.util.NonNullList;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
import reborncore.common.BaseBlock;
|
||||
|
@ -52,7 +53,7 @@ public class BlockStorage extends BaseBlock implements ITexturedBlock {
|
|||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void getSubBlocks(Item item, CreativeTabs creativeTabs, List list) {
|
||||
public void getSubBlocks(Item item, CreativeTabs creativeTabs, NonNullList list) {
|
||||
for (int meta = 0; meta < types.length; meta++) {
|
||||
list.add(new ItemStack(item, 1, meta));
|
||||
}
|
||||
|
|
|
@ -9,6 +9,7 @@ import net.minecraft.creativetab.CreativeTabs;
|
|||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.util.NonNullList;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
import reborncore.common.BaseBlock;
|
||||
|
@ -50,7 +51,7 @@ public class BlockStorage2 extends BaseBlock implements ITexturedBlock {
|
|||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void getSubBlocks(Item item, CreativeTabs creativeTabs, List list) {
|
||||
public void getSubBlocks(Item item, CreativeTabs creativeTabs, NonNullList list) {
|
||||
for (int meta = 0; meta < types.length; meta++) {
|
||||
list.add(new ItemStack(item, 1, meta));
|
||||
}
|
||||
|
|
|
@ -65,7 +65,7 @@ public class BlockSolarPanel extends BaseTileBlock implements ITexturedBlock {
|
|||
}
|
||||
|
||||
@Override
|
||||
public IBlockState onBlockPlaced(World worldIn, BlockPos pos, EnumFacing facing, float hitX, float hitY,
|
||||
public IBlockState getStateForPlacement(World worldIn, BlockPos pos, EnumFacing facing, float hitX, float hitY,
|
||||
float hitZ, int meta, EntityLivingBase placer) {
|
||||
if (!worldIn.isRemote) {
|
||||
if (worldIn.canBlockSeeSky(pos.up()) && !worldIn.isRaining() && !worldIn.isThundering() && worldIn.isDaytime()) {
|
||||
|
|
|
@ -32,7 +32,7 @@ public class BlockVacuumFreezer extends BlockMachineBase implements IAdvancedRot
|
|||
}
|
||||
|
||||
@Override
|
||||
public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumHand hand, ItemStack heldItem, EnumFacing side, float hitX, float hitY, float hitZ) {
|
||||
public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumHand hand, EnumFacing side, float hitX, float hitY, float hitZ) {
|
||||
if (!player.isSneaking()) {
|
||||
player.openGui(Core.INSTANCE, GuiHandler.vacuumFreezerID, world, pos.getX(), pos.getY(), pos.getZ());
|
||||
return true;
|
||||
|
|
|
@ -43,7 +43,7 @@ public abstract class BlockEnergyStorage extends BaseTileBlock implements IRotat
|
|||
|
||||
@Override
|
||||
public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumHand hand,
|
||||
ItemStack heldItem, EnumFacing side, float hitX, float hitY, float hitZ) {
|
||||
EnumFacing side, float hitX, float hitY, float hitZ) {
|
||||
if (!player.isSneaking())
|
||||
player.openGui(Core.INSTANCE, guiID, world, pos.getX(), pos.getY(), pos.getZ());
|
||||
return true;
|
||||
|
|
|
@ -25,7 +25,7 @@ public class BlockIDSU extends BlockEnergyStorage {
|
|||
}
|
||||
|
||||
@Override
|
||||
public IBlockState onBlockPlaced(World world, BlockPos pos, EnumFacing facing, float hitX, float hitY,
|
||||
public IBlockState getStateForPlacement(World world, BlockPos pos, EnumFacing facing, float hitX, float hitY,
|
||||
float hitZ, int meta, EntityLivingBase placer) {
|
||||
TileEntity tile = world.getTileEntity(pos);
|
||||
if (tile instanceof TileIDSU) {
|
||||
|
|
|
@ -119,7 +119,7 @@ public abstract class BlockTransformer extends BaseTileBlock implements IRotatio
|
|||
if (itemStack == null) {
|
||||
continue;
|
||||
}
|
||||
if (itemStack != null && itemStack.stackSize > 0) {
|
||||
if (itemStack != null && itemStack.getCount() > 0) {
|
||||
if (itemStack.getItem() instanceof ItemBlock) {
|
||||
if (((ItemBlock) itemStack.getItem()).block instanceof BlockFluidBase
|
||||
|| ((ItemBlock) itemStack.getItem()).block instanceof BlockStaticLiquid
|
||||
|
|
|
@ -8,7 +8,6 @@ import net.minecraftforge.fml.common.eventhandler.EventPriority;
|
|||
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
import techreborn.parts.fluidPipes.EnumFluidPipeTypes;
|
||||
import techreborn.parts.powerCables.EnumCableType;
|
||||
|
||||
/**
|
||||
|
@ -24,11 +23,6 @@ public class ClientPartModelBakery {
|
|||
new ModelResourceLocation("techreborn:cable", "type=" + type.getName().toLowerCase()),
|
||||
new RenderCablePart(type));
|
||||
}
|
||||
for (EnumFluidPipeTypes type : EnumFluidPipeTypes.values()) {
|
||||
event.getModelRegistry().putObject(
|
||||
new ModelResourceLocation("techreborn:fluidpipe#type=" + type.getName().toLowerCase()),
|
||||
new RenderFluidPipePart(type));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
@ -37,9 +31,6 @@ public class ClientPartModelBakery {
|
|||
for (EnumCableType type : EnumCableType.values()) {
|
||||
event.getMap().registerSprite(new ResourceLocation(type.textureName));
|
||||
}
|
||||
for (EnumFluidPipeTypes type : EnumFluidPipeTypes.values()) {
|
||||
event.getMap().registerSprite(new ResourceLocation(type.textureName));
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -1,145 +0,0 @@
|
|||
package techreborn.client.render.parts;
|
||||
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.renderer.block.model.*;
|
||||
import net.minecraft.client.renderer.texture.TextureAtlasSprite;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraftforge.common.property.IExtendedBlockState;
|
||||
import org.lwjgl.util.vector.Vector3f;
|
||||
import reborncore.client.models.BakedModelUtils;
|
||||
import reborncore.common.misc.vecmath.Vecs3dCube;
|
||||
import techreborn.parts.fluidPipes.EnumFluidPipeTypes;
|
||||
import techreborn.parts.fluidPipes.MultipartFluidPipe;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Created by modmuss50 on 09/05/2016.
|
||||
*/
|
||||
public class RenderFluidPipePart implements IBakedModel {
|
||||
|
||||
private FaceBakery faceBakery = new FaceBakery();
|
||||
private TextureAtlasSprite texture;
|
||||
EnumFluidPipeTypes type;
|
||||
|
||||
public RenderFluidPipePart(EnumFluidPipeTypes type) {
|
||||
texture = Minecraft.getMinecraft().getTextureMapBlocks().getAtlasSprite(type.textureName);
|
||||
this.type = type;
|
||||
}
|
||||
|
||||
public static void addCubeToList(Vecs3dCube cube, ArrayList<BakedQuad> list, BlockPartFace face,
|
||||
ModelRotation modelRotation, TextureAtlasSprite cubeTexture, EnumFacing dir, FaceBakery faceBakery) {
|
||||
BlockFaceUV uv = new BlockFaceUV(new float[] { (float) cube.getMinX(), (float) cube.getMinY(),
|
||||
(float) cube.getMaxX(), (float) cube.getMaxY() }, 0);
|
||||
face = new BlockPartFace(null, 0, "", uv);
|
||||
list.add(faceBakery.makeBakedQuad(
|
||||
new Vector3f((float) cube.getMinX(), (float) cube.getMinY(), (float) cube.getMinZ()),
|
||||
new Vector3f((float) cube.getMaxX(), (float) cube.getMinY(), (float) cube.getMaxZ()), face, cubeTexture,
|
||||
EnumFacing.DOWN, modelRotation, null, true, true));// down
|
||||
list.add(faceBakery.makeBakedQuad(
|
||||
new Vector3f((float) cube.getMinX(), (float) cube.getMaxY(), (float) cube.getMinZ()),
|
||||
new Vector3f((float) cube.getMaxX(), (float) cube.getMaxY(), (float) cube.getMaxZ()), face, cubeTexture,
|
||||
EnumFacing.UP, modelRotation, null, true, true));// up
|
||||
list.add(faceBakery.makeBakedQuad(
|
||||
new Vector3f((float) cube.getMinX(), (float) cube.getMinY(), (float) cube.getMinZ()),
|
||||
new Vector3f((float) cube.getMaxX(), (float) cube.getMaxY(), (float) cube.getMaxZ()), face, cubeTexture,
|
||||
EnumFacing.NORTH, modelRotation, null, true, true));// north
|
||||
list.add(faceBakery.makeBakedQuad(
|
||||
new Vector3f((float) cube.getMinX(), (float) cube.getMinY(), (float) cube.getMaxZ()),
|
||||
new Vector3f((float) cube.getMaxX(), (float) cube.getMaxY(), (float) cube.getMaxZ()), face, cubeTexture,
|
||||
EnumFacing.SOUTH, modelRotation, null, true, true));// south
|
||||
list.add(faceBakery.makeBakedQuad(
|
||||
new Vector3f((float) cube.getMaxX(), (float) cube.getMinY(), (float) cube.getMinZ()),
|
||||
new Vector3f((float) cube.getMaxX(), (float) cube.getMaxY(), (float) cube.getMaxZ()), face, cubeTexture,
|
||||
EnumFacing.EAST, modelRotation, null, true, true));// east
|
||||
list.add(faceBakery.makeBakedQuad(
|
||||
new Vector3f((float) cube.getMinX(), (float) cube.getMinY(), (float) cube.getMinZ()),
|
||||
new Vector3f((float) cube.getMinX(), (float) cube.getMaxY(), (float) cube.getMaxZ()), face, cubeTexture,
|
||||
EnumFacing.WEST, modelRotation, null, true, true));// west
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<BakedQuad> getQuads(IBlockState blockState, EnumFacing side, long rand) {
|
||||
ArrayList<BakedQuad> list = new ArrayList<>();
|
||||
BlockFaceUV uv = new BlockFaceUV(new float[] { 0.0F, 0.0F, 16.0F, 16.0F }, 0);
|
||||
BlockPartFace face = new BlockPartFace(null, 0, "", uv);
|
||||
double thickness = MultipartFluidPipe.thickness;
|
||||
double lastThickness = 16 - thickness;
|
||||
IExtendedBlockState state = (IExtendedBlockState) blockState;
|
||||
if (side != null) {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
boolean renderedConnection = false;
|
||||
if (state != null) {
|
||||
if (state.getValue(MultipartFluidPipe.UP)) {
|
||||
BakedModelUtils.addCubeToList(new Vecs3dCube(thickness, lastThickness, thickness, lastThickness, 16.0, lastThickness),
|
||||
list, face, ModelRotation.X0_Y0, texture, EnumFacing.UP, faceBakery);
|
||||
renderedConnection = true;
|
||||
}
|
||||
if (state.getValue(MultipartFluidPipe.DOWN)) {
|
||||
BakedModelUtils.addCubeToList(new Vecs3dCube(thickness, 0.0, thickness, lastThickness, thickness, lastThickness), list,
|
||||
face, ModelRotation.X0_Y0, texture, EnumFacing.DOWN, faceBakery);
|
||||
renderedConnection = true;
|
||||
}
|
||||
if (state.getValue(MultipartFluidPipe.NORTH)) {
|
||||
BakedModelUtils.addCubeToList(new Vecs3dCube(thickness, thickness, 0.0, lastThickness, lastThickness, lastThickness), list,
|
||||
face, ModelRotation.X0_Y0, texture, EnumFacing.NORTH, faceBakery);
|
||||
renderedConnection = true;
|
||||
}
|
||||
if (state.getValue(MultipartFluidPipe.SOUTH)) {
|
||||
BakedModelUtils.addCubeToList(new Vecs3dCube(thickness, thickness, thickness, lastThickness, lastThickness, 16.0),
|
||||
list, face, ModelRotation.X0_Y0, texture, EnumFacing.SOUTH, faceBakery);
|
||||
renderedConnection = false;
|
||||
}
|
||||
if (state.getValue(MultipartFluidPipe.EAST)) {
|
||||
BakedModelUtils.addCubeToList(new Vecs3dCube(thickness, thickness, thickness, 16, lastThickness, lastThickness),
|
||||
list, face, ModelRotation.X0_Y0, texture, EnumFacing.EAST, faceBakery);
|
||||
renderedConnection = false;
|
||||
}
|
||||
if (state.getValue(MultipartFluidPipe.WEST)) {
|
||||
BakedModelUtils.addCubeToList(new Vecs3dCube(0.0, thickness, thickness, thickness, lastThickness, lastThickness), list,
|
||||
face, ModelRotation.X0_Y0, texture, EnumFacing.WEST, faceBakery);
|
||||
renderedConnection = true;
|
||||
}
|
||||
if (!renderedConnection) {
|
||||
BakedModelUtils.addCubeToList(new Vecs3dCube(thickness, thickness, thickness, lastThickness, lastThickness, lastThickness),
|
||||
list, face, ModelRotation.X0_Y0, texture, null, faceBakery);
|
||||
}
|
||||
}
|
||||
|
||||
return list;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isAmbientOcclusion() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isGui3d() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isBuiltInRenderer() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public TextureAtlasSprite getParticleTexture() {
|
||||
return texture;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemCameraTransforms getItemCameraTransforms() {
|
||||
return ItemCameraTransforms.DEFAULT;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemOverrideList getOverrides() {
|
||||
return null;
|
||||
}
|
||||
}
|
|
@ -1,16 +1,6 @@
|
|||
package techreborn.init;
|
||||
|
||||
import ic2.core.block.BlockIC2Fence;
|
||||
import ic2.core.block.BlockTexGlass;
|
||||
import ic2.core.block.type.ResourceBlock;
|
||||
import ic2.core.item.type.CraftingItemType;
|
||||
import ic2.core.item.type.MiscResourceType;
|
||||
import ic2.core.item.type.NuclearResourceType;
|
||||
import ic2.core.ref.BlockName;
|
||||
import ic2.core.ref.ItemName;
|
||||
import ic2.core.ref.TeBlock;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraftforge.oredict.OreDictionary;
|
||||
|
||||
import techreborn.Core;
|
||||
|
||||
/**
|
||||
|
@ -18,54 +8,55 @@ import techreborn.Core;
|
|||
*/
|
||||
public class IC2Dict {
|
||||
|
||||
//TODO IC2
|
||||
public static void init() {
|
||||
try {
|
||||
CraftingItemType.circuit.getName();
|
||||
|
||||
OreDictionary.registerOre("reBattery", ItemName.re_battery.getItemStack());
|
||||
|
||||
OreDictionary.registerOre("circuitBasic", ItemName.crafting.getItemStack(CraftingItemType.circuit));
|
||||
OreDictionary.registerOre("circuitAdvanced", ItemName.crafting.getItemStack(CraftingItemType.advanced_circuit));
|
||||
|
||||
OreDictionary.registerOre("machineBlockBasic", BlockName.resource.getItemStack(ResourceBlock.machine));
|
||||
OreDictionary.registerOre("machineBlockAdvanced", BlockName.resource.getItemStack(ResourceBlock.advanced_machine));
|
||||
|
||||
OreDictionary.registerOre("lapotronCrystal", ItemName.lapotron_crystal.getItemStack());
|
||||
OreDictionary.registerOre("energyCrystal", ItemName.lapotron_crystal.getItemStack());
|
||||
|
||||
OreDictionary.registerOre("drillBasic", ItemName.drill.getItemStack());
|
||||
OreDictionary.registerOre("drillDiamond", ItemName.diamond_drill.getItemStack());
|
||||
OreDictionary.registerOre("drillAdvanced", ItemName.iridium_drill.getItemStack());
|
||||
|
||||
ItemStack industrialTnt = BlockName.te.getItemStack(TeBlock.itnt);
|
||||
industrialTnt.setItemDamage(1);
|
||||
OreDictionary.registerOre("industrialTnt", industrialTnt);
|
||||
|
||||
OreDictionary.registerOre("craftingIndustrialDiamond", ItemName.crafting.getItemStack(CraftingItemType.industrial_diamond));
|
||||
OreDictionary.registerOre("fertilizer", ItemName.crafting.getItemStack(CraftingItemType.bio_chaff));
|
||||
OreDictionary.registerOre("hvTransformer", BlockName.te.getItemStack(TeBlock.hv_transformer));
|
||||
|
||||
//TODO:
|
||||
|
||||
//OreDictionary.registerOre("insulatedGoldCableItem", BlockName.te.getItemStack(CableType.gold));
|
||||
|
||||
//OreDictionary.registerOre("ic2Generator", ModBlocks.Generator);
|
||||
//OreDictionary.registerOre("ic2SolarPanel", ModBlocks.solarPanel);
|
||||
//OreDictionary.registerOre("ic2Macerator", ModBlocks.Grinder);
|
||||
//OreDictionary.registerOre("ic2Extractor", ModBlocks.Extractor);
|
||||
//OreDictionary.registerOre("ic2Windmill", ModBlocks.windMill);
|
||||
//OreDictionary.registerOre("ic2Watermill", ModBlocks.waterMill);
|
||||
|
||||
OreDictionary.registerOre("uran235", ItemName.nuclear.getItemStack(NuclearResourceType.uranium_235));
|
||||
OreDictionary.registerOre("uran238", ItemName.nuclear.getItemStack(NuclearResourceType.uranium_238));
|
||||
OreDictionary.registerOre("smallUran238", ItemName.nuclear.getItemStack(NuclearResourceType.small_uranium_238));
|
||||
OreDictionary.registerOre("smallUran235", ItemName.nuclear.getItemStack(NuclearResourceType.small_uranium_235));
|
||||
|
||||
OreDictionary.registerOre("fenceIron", BlockName.fence.getItemStack(BlockIC2Fence.IC2FenceType.iron));
|
||||
OreDictionary.registerOre("rubberWood", BlockName.rubber_wood.getItemStack());
|
||||
OreDictionary.registerOre("glassReinforced", BlockName.glass.getItemStack(BlockTexGlass.GlassType.reinforced));
|
||||
|
||||
OreDictionary.registerOre("oreIridium", ItemName.misc_resource.getItemStack(MiscResourceType.iridium_ore));
|
||||
// CraftingItemType.circuit.getName();
|
||||
//
|
||||
// OreDictionary.registerOre("reBattery", ItemName.re_battery.getItemStack());
|
||||
//
|
||||
// OreDictionary.registerOre("circuitBasic", ItemName.crafting.getItemStack(CraftingItemType.circuit));
|
||||
// OreDictionary.registerOre("circuitAdvanced", ItemName.crafting.getItemStack(CraftingItemType.advanced_circuit));
|
||||
//
|
||||
// OreDictionary.registerOre("machineBlockBasic", BlockName.resource.getItemStack(ResourceBlock.machine));
|
||||
// OreDictionary.registerOre("machineBlockAdvanced", BlockName.resource.getItemStack(ResourceBlock.advanced_machine));
|
||||
//
|
||||
// OreDictionary.registerOre("lapotronCrystal", ItemName.lapotron_crystal.getItemStack());
|
||||
// OreDictionary.registerOre("energyCrystal", ItemName.lapotron_crystal.getItemStack());
|
||||
//
|
||||
// OreDictionary.registerOre("drillBasic", ItemName.drill.getItemStack());
|
||||
// OreDictionary.registerOre("drillDiamond", ItemName.diamond_drill.getItemStack());
|
||||
// OreDictionary.registerOre("drillAdvanced", ItemName.iridium_drill.getItemStack());
|
||||
//
|
||||
// ItemStack industrialTnt = BlockName.te.getItemStack(TeBlock.itnt);
|
||||
// industrialTnt.setItemDamage(1);
|
||||
// OreDictionary.registerOre("industrialTnt", industrialTnt);
|
||||
//
|
||||
// OreDictionary.registerOre("craftingIndustrialDiamond", ItemName.crafting.getItemStack(CraftingItemType.industrial_diamond));
|
||||
// OreDictionary.registerOre("fertilizer", ItemName.crafting.getItemStack(CraftingItemType.bio_chaff));
|
||||
// OreDictionary.registerOre("hvTransformer", BlockName.te.getItemStack(TeBlock.hv_transformer));
|
||||
//
|
||||
// //TODO:
|
||||
//
|
||||
// //OreDictionary.registerOre("insulatedGoldCableItem", BlockName.te.getItemStack(CableType.gold));
|
||||
//
|
||||
// //OreDictionary.registerOre("ic2Generator", ModBlocks.Generator);
|
||||
// //OreDictionary.registerOre("ic2SolarPanel", ModBlocks.solarPanel);
|
||||
// //OreDictionary.registerOre("ic2Macerator", ModBlocks.Grinder);
|
||||
// //OreDictionary.registerOre("ic2Extractor", ModBlocks.Extractor);
|
||||
// //OreDictionary.registerOre("ic2Windmill", ModBlocks.windMill);
|
||||
// //OreDictionary.registerOre("ic2Watermill", ModBlocks.waterMill);
|
||||
//
|
||||
// OreDictionary.registerOre("uran235", ItemName.nuclear.getItemStack(NuclearResourceType.uranium_235));
|
||||
// OreDictionary.registerOre("uran238", ItemName.nuclear.getItemStack(NuclearResourceType.uranium_238));
|
||||
// OreDictionary.registerOre("smallUran238", ItemName.nuclear.getItemStack(NuclearResourceType.small_uranium_238));
|
||||
// OreDictionary.registerOre("smallUran235", ItemName.nuclear.getItemStack(NuclearResourceType.small_uranium_235));
|
||||
//
|
||||
// OreDictionary.registerOre("fenceIron", BlockName.fence.getItemStack(BlockIC2Fence.IC2FenceType.iron));
|
||||
// OreDictionary.registerOre("rubberWood", BlockName.rubber_wood.getItemStack());
|
||||
// OreDictionary.registerOre("glassReinforced", BlockName.glass.getItemStack(BlockTexGlass.GlassType.reinforced));
|
||||
//
|
||||
// OreDictionary.registerOre("oreIridium", ItemName.misc_resource.getItemStack(MiscResourceType.iridium_ore));
|
||||
} catch (NoClassDefFoundError notFound) {
|
||||
Core.logHelper.warn(
|
||||
"Can't enable integration: IC2 installed but cannot be hooked\n" +
|
||||
|
|
|
@ -6,7 +6,7 @@ public class ModInfo implements IModInfo {
|
|||
public static final String MOD_NAME = "TechReborn";
|
||||
public static final String MOD_ID = "techreborn";
|
||||
public static final String MOD_VERSION = "@MODVERSION@";
|
||||
public static final String MOD_DEPENDENCIES = "required-after:Forge@[11.15.0.1609,);required-after:reborncore;after:JEI@[3.13,);after:IC2";
|
||||
public static final String MOD_DEPENDENCIES = "required-after:forge;required-after:reborncore;after:jei@[3.13,);after:ic2";
|
||||
public static final String SERVER_PROXY_CLASS = "techreborn.proxies.CommonProxy";
|
||||
public static final String CLIENT_PROXY_CLASS = "techreborn.proxies.ClientProxy";
|
||||
public static final String GUI_FACTORY_CLASS = "techreborn.config.TechRebornGUIFactory";
|
||||
|
|
|
@ -6,6 +6,7 @@ import net.minecraftforge.fml.common.event.FMLPreInitializationEvent;
|
|||
import net.minecraftforge.fml.common.event.FMLServerStartingEvent;
|
||||
import net.minecraftforge.fml.common.registry.GameRegistry;
|
||||
import techreborn.compat.ICompatModule;
|
||||
import techreborn.init.ModItems;
|
||||
import techreborn.parts.powerCables.ItemStandaloneCables;
|
||||
|
||||
/**
|
||||
|
@ -23,7 +24,7 @@ public class StandalonePartCompact implements ICompatModule {
|
|||
@Override
|
||||
public void init(FMLInitializationEvent event) {
|
||||
itemStandaloneCable = new ItemStandaloneCables();
|
||||
GameRegistry.registerItem(itemStandaloneCable, "cables");
|
||||
ModItems.registerItem(itemStandaloneCable, "cables");
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -1,11 +0,0 @@
|
|||
package techreborn.parts.fluidPipes;
|
||||
|
||||
/**
|
||||
* Created by modmuss50 on 12/05/2016.
|
||||
*/
|
||||
public class EmptyFluidPipe extends MultipartFluidPipe {
|
||||
@Override
|
||||
public EnumFluidPipeTypes getPipeType() {
|
||||
return EnumFluidPipeTypes.EMPTY;
|
||||
}
|
||||
}
|
|
@ -1,33 +0,0 @@
|
|||
package techreborn.parts.fluidPipes;
|
||||
|
||||
import net.minecraft.util.IStringSerializable;
|
||||
import net.minecraft.util.text.TextFormatting;
|
||||
|
||||
/**
|
||||
* Created by modmuss50 on 09/05/2016.
|
||||
*/
|
||||
public enum EnumFluidPipeTypes implements IStringSerializable {
|
||||
|
||||
EMPTY("empty", "techreborn:blocks/fluidPipes/fluidpipe", false, false, TextFormatting.DARK_GRAY),
|
||||
INSERT("insert", "techreborn:blocks/fluidPipes/fluidpipe_insert", false, true, TextFormatting.BLUE),
|
||||
EXTRACT("extract", "techreborn:blocks/fluidPipes/fluidpipe_extract", true, false, TextFormatting.GOLD);
|
||||
|
||||
public String textureName = "minecraft:blocks/iron_block";
|
||||
public boolean extract = false;
|
||||
public boolean insert = false;
|
||||
public TextFormatting colour = TextFormatting.WHITE;
|
||||
private String name;
|
||||
|
||||
EnumFluidPipeTypes(String name, String textureName, boolean extract, boolean insert, TextFormatting colour) {
|
||||
this.name = name;
|
||||
this.textureName = textureName;
|
||||
this.extract = extract;
|
||||
this.insert = insert;
|
||||
this.colour = colour;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
}
|
|
@ -1,11 +0,0 @@
|
|||
package techreborn.parts.fluidPipes;
|
||||
|
||||
/**
|
||||
* Created by modmuss50 on 12/05/2016.
|
||||
*/
|
||||
public class ExtractingFluidPipe extends MultipartFluidPipe {
|
||||
@Override
|
||||
public EnumFluidPipeTypes getPipeType() {
|
||||
return EnumFluidPipeTypes.EXTRACT;
|
||||
}
|
||||
}
|
|
@ -1,10 +0,0 @@
|
|||
package techreborn.parts.fluidPipes;
|
||||
|
||||
/**
|
||||
* Created by modmuss50 on 12/05/2016.
|
||||
*/
|
||||
public interface IPartType {
|
||||
|
||||
EnumFluidPipeTypes getPipeType();
|
||||
|
||||
}
|
|
@ -1,11 +0,0 @@
|
|||
package techreborn.parts.fluidPipes;
|
||||
|
||||
/**
|
||||
* Created by modmuss50 on 12/05/2016.
|
||||
*/
|
||||
public class InsertingFluidPipe extends MultipartFluidPipe {
|
||||
@Override
|
||||
public EnumFluidPipeTypes getPipeType() {
|
||||
return EnumFluidPipeTypes.INSERT;
|
||||
}
|
||||
}
|
|
@ -1,29 +0,0 @@
|
|||
package techreborn.parts.fluidPipes;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.math.Vec3d;
|
||||
import net.minecraft.world.World;
|
||||
import reborncore.RebornCore;
|
||||
import reborncore.mcmultipart.item.ItemMultiPart;
|
||||
import reborncore.mcmultipart.multipart.IMultipart;
|
||||
import techreborn.client.TechRebornCreativeTab;
|
||||
|
||||
/**
|
||||
* Created by modmuss50 on 09/05/2016.
|
||||
*/
|
||||
public class ItemFluidPipe extends ItemMultiPart {
|
||||
|
||||
public ItemFluidPipe() {
|
||||
setCreativeTab(TechRebornCreativeTab.instance);
|
||||
setUnlocalizedName("techreborn.fluidpipe");
|
||||
RebornCore.jsonDestroyer.registerObject(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public IMultipart createPart(World world, BlockPos pos, EnumFacing side, Vec3d hit, ItemStack stack, EntityPlayer player) {
|
||||
return new EmptyFluidPipe();
|
||||
}
|
||||
}
|
|
@ -1,430 +0,0 @@
|
|||
package techreborn.parts.fluidPipes;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.block.properties.IProperty;
|
||||
import net.minecraft.block.properties.PropertyBool;
|
||||
import net.minecraft.block.properties.PropertyEnum;
|
||||
import net.minecraft.block.state.BlockStateContainer;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.*;
|
||||
import net.minecraft.util.math.AxisAlignedBB;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.text.TextComponentString;
|
||||
import net.minecraft.util.text.TextFormatting;
|
||||
import net.minecraft.util.text.translation.I18n;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.property.ExtendedBlockState;
|
||||
import net.minecraftforge.common.property.IExtendedBlockState;
|
||||
import net.minecraftforge.common.property.IUnlistedProperty;
|
||||
import net.minecraftforge.common.property.Properties;
|
||||
import net.minecraftforge.fluids.FluidStack;
|
||||
import net.minecraftforge.fluids.FluidTankInfo;
|
||||
import net.minecraftforge.fluids.IFluidHandler;
|
||||
import reborncore.common.misc.Functions;
|
||||
import reborncore.common.misc.vecmath.Vecs3dCube;
|
||||
import reborncore.common.util.ChatUtils;
|
||||
import reborncore.common.util.Tank;
|
||||
import reborncore.common.util.WorldUtils;
|
||||
import reborncore.mcmultipart.MCMultiPartMod;
|
||||
import reborncore.mcmultipart.microblock.IMicroblock;
|
||||
import reborncore.mcmultipart.multipart.*;
|
||||
import reborncore.mcmultipart.raytrace.PartMOP;
|
||||
import techreborn.lib.MessageIDs;
|
||||
import techreborn.parts.TechRebornParts;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
/**
|
||||
* Created by modmuss50 on 09/05/2016.
|
||||
*/
|
||||
public abstract class MultipartFluidPipe extends Multipart implements INormallyOccludingPart, ISlottedPart, ITickable, IPartType {
|
||||
|
||||
public static final IUnlistedProperty<Boolean> UP = Properties.toUnlisted(PropertyBool.create("up"));
|
||||
public static final IUnlistedProperty<Boolean> DOWN = Properties.toUnlisted(PropertyBool.create("down"));
|
||||
public static final IUnlistedProperty<Boolean> NORTH = Properties.toUnlisted(PropertyBool.create("north"));
|
||||
public static final IUnlistedProperty<Boolean> EAST = Properties.toUnlisted(PropertyBool.create("east"));
|
||||
public static final IUnlistedProperty<Boolean> SOUTH = Properties.toUnlisted(PropertyBool.create("south"));
|
||||
public static final IUnlistedProperty<Boolean> WEST = Properties.toUnlisted(PropertyBool.create("west"));
|
||||
public static final IProperty<EnumFluidPipeTypes> TYPE = PropertyEnum.create("type", EnumFluidPipeTypes.class);
|
||||
public static final double thickness = 11;
|
||||
public static int mbt = 20;
|
||||
public Vecs3dCube[] boundingBoxes = new Vecs3dCube[14];
|
||||
public float center = 0.6F;
|
||||
public float offset = 0.10F;
|
||||
public Map<EnumFacing, BlockPos> connectedSides;
|
||||
Tank tank = new Tank("MultipartFluidPipe", 1000, null);
|
||||
|
||||
public MultipartFluidPipe() {
|
||||
connectedSides = new HashMap<>();
|
||||
refreshBounding();
|
||||
}
|
||||
|
||||
public static MultipartFluidPipe getPartFromWorld(World world, BlockPos pos, EnumFacing side) {
|
||||
if (world == null || pos == null) {
|
||||
return null;
|
||||
}
|
||||
IMultipartContainer container = MultipartHelper.getPartContainer(world, pos);
|
||||
if (side != null && container != null) {
|
||||
ISlottedPart slottedPart = container.getPartInSlot(PartSlot.getFaceSlot(side));
|
||||
if (slottedPart instanceof IMicroblock.IFaceMicroblock && !((IMicroblock.IFaceMicroblock) slottedPart)
|
||||
.isFaceHollow()) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
if (container == null) {
|
||||
return null;
|
||||
}
|
||||
ISlottedPart part = container.getPartInSlot(PartSlot.CENTER);
|
||||
if (part instanceof MultipartFluidPipe) {
|
||||
return (MultipartFluidPipe) part;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public void refreshBounding() {
|
||||
float centerFirst = center - offset;
|
||||
double w = (thickness / 16) - 0.5;
|
||||
boundingBoxes[6] = new Vecs3dCube(centerFirst - w, centerFirst - w, centerFirst - w, centerFirst + w,
|
||||
centerFirst + w, centerFirst + w);
|
||||
|
||||
int i = 0;
|
||||
for (EnumFacing dir : EnumFacing.VALUES) {
|
||||
double xMin1 = (dir.getFrontOffsetX() < 0 ?
|
||||
0.0 :
|
||||
(dir.getFrontOffsetX() == 0 ? centerFirst - w : centerFirst + w));
|
||||
double xMax1 = (dir.getFrontOffsetX() > 0 ?
|
||||
1.0 :
|
||||
(dir.getFrontOffsetX() == 0 ? centerFirst + w : centerFirst - w));
|
||||
|
||||
double yMin1 = (dir.getFrontOffsetY() < 0 ?
|
||||
0.0 :
|
||||
(dir.getFrontOffsetY() == 0 ? centerFirst - w : centerFirst + w));
|
||||
double yMax1 = (dir.getFrontOffsetY() > 0 ?
|
||||
1.0 :
|
||||
(dir.getFrontOffsetY() == 0 ? centerFirst + w : centerFirst - w));
|
||||
|
||||
double zMin1 = (dir.getFrontOffsetZ() < 0 ?
|
||||
0.0 :
|
||||
(dir.getFrontOffsetZ() == 0 ? centerFirst - w : centerFirst + w));
|
||||
double zMax1 = (dir.getFrontOffsetZ() > 0 ?
|
||||
1.0 :
|
||||
(dir.getFrontOffsetZ() == 0 ? centerFirst + w : centerFirst - w));
|
||||
|
||||
boundingBoxes[i] = new Vecs3dCube(xMin1, yMin1, zMin1, xMax1, yMax1, zMax1);
|
||||
i++;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addCollisionBoxes(AxisAlignedBB mask, List<AxisAlignedBB> list, Entity collidingEntity) {
|
||||
|
||||
for (EnumFacing dir : EnumFacing.VALUES) {
|
||||
if (connectedSides.containsKey(dir) && mask
|
||||
.intersectsWith(boundingBoxes[Functions.getIntDirFromDirection(dir)].toAABB()))
|
||||
list.add(boundingBoxes[Functions.getIntDirFromDirection(dir)].toAABB());
|
||||
}
|
||||
if (mask.intersectsWith(boundingBoxes[6].toAABB())) {
|
||||
list.add(boundingBoxes[6].toAABB());
|
||||
}
|
||||
super.addCollisionBoxes(mask, list, collidingEntity);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addSelectionBoxes(List<AxisAlignedBB> list) {
|
||||
|
||||
for (EnumFacing dir : EnumFacing.VALUES) {
|
||||
if (connectedSides.containsKey(dir))
|
||||
list.add(boundingBoxes[Functions.getIntDirFromDirection(dir)].toAABB());
|
||||
}
|
||||
list.add(boundingBoxes[6].toAABB());
|
||||
super.addSelectionBoxes(list);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onRemoved() {
|
||||
super.onRemoved();
|
||||
for (EnumFacing dir : EnumFacing.VALUES) {
|
||||
MultipartFluidPipe multipart = getPartFromWorld(getWorld(), getPos().offset(dir), dir);
|
||||
if (multipart != null) {
|
||||
multipart.nearByChange();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addOcclusionBoxes(List<AxisAlignedBB> list) {
|
||||
for (EnumFacing dir : EnumFacing.VALUES) {
|
||||
if (connectedSides.containsKey(dir))
|
||||
list.add(boundingBoxes[Functions.getIntDirFromDirection(dir)].toAABB());
|
||||
}
|
||||
list.add(boundingBoxes[6].toAABB());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onNeighborBlockChange(Block block) {
|
||||
super.onNeighborBlockChange(block);
|
||||
nearByChange();
|
||||
|
||||
}
|
||||
|
||||
public void nearByChange() {
|
||||
checkConnectedSides();
|
||||
for (EnumFacing direction : EnumFacing.VALUES) {
|
||||
BlockPos blockPos = getPos().offset(direction);
|
||||
WorldUtils.updateBlock(getWorld(), blockPos);
|
||||
MultipartFluidPipe part = getPartFromWorld(getWorld(), blockPos, direction);
|
||||
if (part != null) {
|
||||
part.checkConnectedSides();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onAdded() {
|
||||
nearByChange();
|
||||
}
|
||||
|
||||
public boolean shouldConnectTo(EnumFacing dir) {
|
||||
if (dir != null) {
|
||||
if (internalShouldConnectTo(dir)) {
|
||||
MultipartFluidPipe multipartFluidPipe = getPartFromWorld(getWorld(), getPos().offset(dir), dir);
|
||||
if (multipartFluidPipe != null && multipartFluidPipe.internalShouldConnectTo(dir.getOpposite())) {
|
||||
return true;
|
||||
}
|
||||
} else {
|
||||
TileEntity tile = getNeighbourTile(dir);
|
||||
|
||||
if (tile instanceof IFluidHandler && (getPipeType() == EnumFluidPipeTypes.EXTRACT
|
||||
|| getPipeType() == EnumFluidPipeTypes.INSERT)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public boolean internalShouldConnectTo(EnumFacing dir) {
|
||||
ISlottedPart part = getContainer().getPartInSlot(PartSlot.getFaceSlot(dir));
|
||||
if (part instanceof IMicroblock.IFaceMicroblock) {
|
||||
if (!((IMicroblock.IFaceMicroblock) part).isFaceHollow()) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
if (!OcclusionHelper.occlusionTest(getContainer().getParts(), p -> p == this,
|
||||
boundingBoxes[Functions.getIntDirFromDirection(dir)].toAABB())) {
|
||||
return false;
|
||||
}
|
||||
|
||||
MultipartFluidPipe multipartFluidPipe = getPartFromWorld(getWorld(), getPos().offset(dir), dir.getOpposite());
|
||||
|
||||
return multipartFluidPipe != null;
|
||||
}
|
||||
|
||||
public TileEntity getNeighbourTile(EnumFacing side) {
|
||||
return side != null ? getWorld().getTileEntity(getPos().offset(side)) : null;
|
||||
}
|
||||
|
||||
public void checkConnectedSides() {
|
||||
refreshBounding();
|
||||
connectedSides = new HashMap<>();
|
||||
for (EnumFacing dir : EnumFacing.values()) {
|
||||
int d = Functions.getIntDirFromDirection(dir);
|
||||
if (getWorld() == null) {
|
||||
return;
|
||||
}
|
||||
TileEntity te = getNeighbourTile(dir);
|
||||
if (shouldConnectTo(dir)) {
|
||||
connectedSides.put(dir, te.getPos());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public EnumSet<PartSlot> getSlotMask() {
|
||||
return EnumSet.of(PartSlot.CENTER);
|
||||
}
|
||||
|
||||
@Override
|
||||
public IBlockState getExtendedState(IBlockState state) {
|
||||
IExtendedBlockState extendedBlockState = (IExtendedBlockState) state;
|
||||
return extendedBlockState.withProperty(DOWN, shouldConnectTo(EnumFacing.DOWN))
|
||||
.withProperty(UP, shouldConnectTo(EnumFacing.UP)).withProperty(NORTH, shouldConnectTo(EnumFacing.NORTH))
|
||||
.withProperty(SOUTH, shouldConnectTo(EnumFacing.SOUTH))
|
||||
.withProperty(WEST, shouldConnectTo(EnumFacing.WEST))
|
||||
.withProperty(EAST, shouldConnectTo(EnumFacing.EAST)).withProperty(TYPE, getPipeType());
|
||||
}
|
||||
|
||||
@Override
|
||||
public BlockStateContainer createBlockState() {
|
||||
return new ExtendedBlockState(MCMultiPartMod.multipart, new IProperty[] { TYPE },
|
||||
new IUnlistedProperty[] { DOWN, UP, NORTH, SOUTH, WEST, EAST });
|
||||
}
|
||||
|
||||
@Override
|
||||
public float getHardness(PartMOP hit) {
|
||||
return 0.5F;
|
||||
}
|
||||
|
||||
public Material getMaterial() {
|
||||
return Material.CLOTH;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<ItemStack> getDrops() {
|
||||
List<ItemStack> list = new ArrayList<>();
|
||||
list.add(new ItemStack(TechRebornParts.fluidPipe, 1, 0));
|
||||
return list;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResourceLocation getModelPath() {
|
||||
return new ResourceLocation("techreborn:fluidpipe");
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canRenderInLayer(BlockRenderLayer layer) {
|
||||
return layer == BlockRenderLayer.CUTOUT;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void update() {
|
||||
if (!getWorld().isRemote) {
|
||||
for (EnumFacing dir : EnumFacing.VALUES) {
|
||||
//if (connectedSides.containsKey(dir)) {
|
||||
MultipartFluidPipe fluidPipe = getPartFromWorld(getWorld(), getPos().offset(dir), dir);
|
||||
if (fluidPipe != null) {
|
||||
if (!tank.isEmpty()) {
|
||||
if (fluidPipe.tank.isEmpty() || fluidPipe.tank.getFluid().getFluid() == tank.getFluid()
|
||||
.getFluid()) {
|
||||
if (fluidPipe.tank.getFluidAmount() < tank.getFluidAmount()) {
|
||||
int freeSpace = fluidPipe.tank.getCapacity();
|
||||
if (!fluidPipe.tank.isEmpty()) {
|
||||
freeSpace = fluidPipe.tank.getCapacity() - fluidPipe.tank.getFluidAmount();
|
||||
}
|
||||
int difference = tank.getFluidAmount() - freeSpace;
|
||||
int amountToChange = difference / 2;
|
||||
fluidPipe.tank.setFluid(tank.getFluid());
|
||||
fluidPipe.tank.setFluidAmount(fluidPipe.tank.getFluidAmount() + amountToChange);
|
||||
tank.setFluidAmount(tank.getFluidAmount() - amountToChange);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
// }
|
||||
TileEntity tileEntity = getNeighbourTile(dir);
|
||||
if (tileEntity != null) {
|
||||
if (tileEntity instanceof IFluidHandler) {
|
||||
IFluidHandler handler = (IFluidHandler) tileEntity;
|
||||
if (getPipeType() == EnumFluidPipeTypes.EXTRACT) {
|
||||
if (!tank.isFull()) {
|
||||
FluidTankInfo[] fluidTankInfos = handler.getTankInfo(dir.getOpposite());
|
||||
if (fluidTankInfos.length != 0) {
|
||||
FluidTankInfo info = fluidTankInfos[0];
|
||||
if (info != null & info.fluid != null) {
|
||||
if (tank.isEmpty() || info.fluid.getFluid() == tank.getFluid().getFluid()) {
|
||||
if (handler.canDrain(dir.getOpposite(), info.fluid.getFluid())) {
|
||||
int amountToMove = Math
|
||||
.min(mbt, tank.getCapacity() - tank.getFluidAmount());
|
||||
int fluidAmount = tank.getFluidAmount();
|
||||
FluidStack fluidStack = handler
|
||||
.drain(dir.getOpposite(), amountToMove, true);
|
||||
tank.fill(fluidStack, true);
|
||||
tank.setFluid(fluidStack);
|
||||
tank.setFluidAmount(fluidAmount + amountToMove);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
} else if (getPipeType() == EnumFluidPipeTypes.INSERT) {
|
||||
if (!tank.isEmpty()) {
|
||||
FluidTankInfo[] fluidTankInfos = handler.getTankInfo(dir.getOpposite());
|
||||
if (fluidTankInfos.length != 0) {
|
||||
FluidTankInfo info = fluidTankInfos[0];
|
||||
if (info.fluid == null || info.fluid.getFluid() == null
|
||||
|| info.fluid.getFluid() == tank.getFluid().getFluid() && handler
|
||||
.canFill(dir.getOpposite(), tank.getFluid().getFluid())) {
|
||||
int infoSpace = info.capacity;
|
||||
if (info.fluid != null) {
|
||||
infoSpace = info.capacity - info.fluid.amount;
|
||||
}
|
||||
int amountToMove = Math.min(mbt, infoSpace);
|
||||
FluidStack fluidStack = tank.drain(amountToMove, true);
|
||||
handler.fill(dir.getOpposite(), fluidStack, true);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onActivated(EntityPlayer player, EnumHand hand, PartMOP hit) {
|
||||
//TODO make only wrench able to change mode, shift-click with wrench picks up pipe, and click with empty hand displays current mode in chat (doesn't change it)
|
||||
|
||||
System.out.println(getWorld().isRemote);
|
||||
|
||||
if (!getWorld().isRemote) {
|
||||
if (getPipeType() == EnumFluidPipeTypes.EMPTY) {
|
||||
setPartType(EnumFluidPipeTypes.EXTRACT, this);
|
||||
} else if (getPipeType() == EnumFluidPipeTypes.EXTRACT) {
|
||||
setPartType(EnumFluidPipeTypes.INSERT, this);
|
||||
} else if (getPipeType() == EnumFluidPipeTypes.INSERT) {
|
||||
setPartType(EnumFluidPipeTypes.EMPTY, this);
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public void setPartType(EnumFluidPipeTypes type, MultipartFluidPipe pipe) {
|
||||
World world = pipe.getWorld();
|
||||
BlockPos pos = pipe.getPos();
|
||||
Tank tank = pipe.tank;
|
||||
pipe.getContainer().removePart(pipe);
|
||||
MultipartFluidPipe newPipe = null;
|
||||
switch (type) {
|
||||
case EMPTY:
|
||||
newPipe = new EmptyFluidPipe();
|
||||
break;
|
||||
case INSERT:
|
||||
newPipe = new InsertingFluidPipe();
|
||||
break;
|
||||
case EXTRACT:
|
||||
newPipe = new ExtractingFluidPipe();
|
||||
break;
|
||||
}
|
||||
newPipe.tank = tank;
|
||||
MultipartHelper.addPart(world, pos, newPipe);
|
||||
|
||||
ChatUtils.sendNoSpamMessages(MessageIDs.fluidPipeID, new TextComponentString(
|
||||
TextFormatting.GRAY + I18n.translateToLocal("techreborn.message.setTo") + " " +
|
||||
type.colour + reborncore.common.util.StringUtils.toFirstCapital(type.getName())));
|
||||
}
|
||||
|
||||
@Override
|
||||
public NBTTagCompound writeToNBT(NBTTagCompound tag) {
|
||||
super.writeToNBT(tag);
|
||||
tank.writeToNBT(tag);
|
||||
return tag;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void readFromNBT(NBTTagCompound tag) {
|
||||
super.readFromNBT(tag);
|
||||
tank.readFromNBT(tag);
|
||||
}
|
||||
|
||||
}
|
|
@ -23,7 +23,7 @@ public class TileDigitalChest extends TileLegacyMachineBase implements IInventor
|
|||
// Slot 1 = Output
|
||||
// Slot 2 = Fake Item
|
||||
|
||||
public ItemStack storedItem;
|
||||
public ItemStack storedItem = ItemStack.EMPTY;
|
||||
// TODO use long so we can have 9,223,372,036,854,775,807 items instead of
|
||||
// 2,147,483,647
|
||||
int storage = 32767;
|
||||
|
@ -34,11 +34,11 @@ public class TileDigitalChest extends TileLegacyMachineBase implements IInventor
|
|||
if (!world.isRemote) {
|
||||
if (storedItem != null) {
|
||||
ItemStack fakeStack = storedItem.copy();
|
||||
fakeStack.getCount() = 1;
|
||||
fakeStack.setCount(1);
|
||||
setInventorySlotContents(2, fakeStack);
|
||||
} else if (storedItem == null && getStackInSlot(1) != null) {
|
||||
} else if (storedItem == ItemStack.EMPTY && getStackInSlot(1) != ItemStack.EMPTY) {
|
||||
ItemStack fakeStack = getStackInSlot(1).copy();
|
||||
fakeStack.getCount() = 1;
|
||||
fakeStack.setCount(1);
|
||||
setInventorySlotContents(2, fakeStack);
|
||||
} else {
|
||||
setInventorySlotContents(2, null);
|
||||
|
@ -47,10 +47,10 @@ public class TileDigitalChest extends TileLegacyMachineBase implements IInventor
|
|||
if (getStackInSlot(0) != null) {
|
||||
if (storedItem == null) {
|
||||
storedItem = getStackInSlot(0);
|
||||
setInventorySlotContents(0, null);
|
||||
setInventorySlotContents(0, ItemStack.EMPTY);
|
||||
} else if (ItemUtils.isItemEqual(storedItem, getStackInSlot(0), true, true)) {
|
||||
if (storedItem.getCount() <= storage - getStackInSlot(0).getCount()) {
|
||||
storedItem.getCount() += getStackInSlot(0).getCount();
|
||||
storedItem.grow(getStackInSlot(0).getCount());
|
||||
decrStackSize(0, getStackInSlot(0).getCount());
|
||||
}
|
||||
}
|
||||
|
@ -58,14 +58,14 @@ public class TileDigitalChest extends TileLegacyMachineBase implements IInventor
|
|||
|
||||
if (storedItem != null && getStackInSlot(1) == null) {
|
||||
ItemStack itemStack = storedItem.copy();
|
||||
itemStack.getCount() = itemStack.getMaxStackSize();
|
||||
itemStack.setCount(itemStack.getMaxStackSize());
|
||||
setInventorySlotContents(1, itemStack);
|
||||
storedItem.getCount() -= itemStack.getMaxStackSize();
|
||||
storedItem.shrink(itemStack.getMaxStackSize());
|
||||
} else if (ItemUtils.isItemEqual(getStackInSlot(1), storedItem, true, true)) {
|
||||
int wanted = getStackInSlot(1).getMaxStackSize() - getStackInSlot(1).getCount();
|
||||
if (storedItem.getCount() >= wanted) {
|
||||
decrStackSize(1, -wanted);
|
||||
storedItem.getCount() -= wanted;
|
||||
storedItem.shrink(wanted);
|
||||
} else {
|
||||
decrStackSize(1, -storedItem.getCount());
|
||||
storedItem = null;
|
||||
|
@ -92,11 +92,11 @@ public class TileDigitalChest extends TileLegacyMachineBase implements IInventor
|
|||
storedItem = null;
|
||||
|
||||
if (tagCompound.hasKey("storedStack")) {
|
||||
storedItem = ItemStack.loadItemStackFromNBT((NBTTagCompound) tagCompound.getTag("storedStack"));
|
||||
storedItem = new ItemStack((NBTTagCompound) tagCompound.getTag("storedStack"));
|
||||
}
|
||||
|
||||
if (storedItem != null) {
|
||||
storedItem.getCount() = tagCompound.getInteger("storedQuantity");
|
||||
storedItem.setCount(tagCompound.getInteger("storedQuantity"));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -86,7 +86,7 @@ public class TileIronFurnace extends TileLegacyMachineBase implements IInventory
|
|||
if (getStackInSlot(output) == null) {
|
||||
setInventorySlotContents(output, itemstack.copy());
|
||||
} else if (getStackInSlot(output).isItemEqual(itemstack)) {
|
||||
getStackInSlot(output).getCount() += itemstack.getCount();
|
||||
getStackInSlot(output).grow(itemstack.getCount());
|
||||
}
|
||||
if (getStackInSlot(input1).getCount() > 1) {
|
||||
this.decrStackSize(input1, 1);
|
||||
|
|
|
@ -130,7 +130,7 @@ public class TileMatterFabricator extends TilePowerAcceptor implements IWrenchab
|
|||
if (inventory.getStackInSlot(6) == null) {
|
||||
inventory.setInventorySlotContents(6, new ItemStack(ModItems.uuMatter));
|
||||
} else if (ItemUtils.isItemEqual(inventory.getStackInSlot(6), new ItemStack(ModItems.uuMatter), true, true)) {
|
||||
inventory.getStackInSlot(6).getCount() = Math.min(64, 1 + inventory.getStackInSlot(6).getCount());
|
||||
inventory.getStackInSlot(6).setCount(Math.min(64, 1 + inventory.getStackInSlot(6).getCount()));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -81,7 +81,7 @@ public class TilePlayerDectector extends TilePowerAcceptor {
|
|||
}
|
||||
if (lastRedstone != redstone) {
|
||||
WorldUtils.updateBlock(world, getPos());
|
||||
world.notifyNeighborsOfStateChange(getPos(), world.getBlockState(getPos()).getBlock());
|
||||
world.notifyNeighborsOfStateChange(getPos(), world.getBlockState(getPos()).getBlock(), true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -8,7 +8,9 @@ import net.minecraft.util.EnumFacing;
|
|||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.text.TextFormatting;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.capabilities.Capability;
|
||||
import net.minecraftforge.fluids.*;
|
||||
import net.minecraftforge.fluids.capability.CapabilityFluidHandler;
|
||||
import reborncore.api.power.EnumPowerTier;
|
||||
import reborncore.common.powerSystem.PowerSystem;
|
||||
import reborncore.common.powerSystem.TilePowerAcceptor;
|
||||
|
@ -20,7 +22,7 @@ import java.util.List;
|
|||
/**
|
||||
* Created by modmuss50 on 08/05/2016.
|
||||
*/
|
||||
public class TilePump extends TilePowerAcceptor implements IFluidHandler {
|
||||
public class TilePump extends TilePowerAcceptor {
|
||||
|
||||
public Tank tank = new Tank("TilePump", 10000, this);
|
||||
|
||||
|
@ -130,40 +132,19 @@ public class TilePump extends TilePowerAcceptor implements IFluidHandler {
|
|||
return tagCompound;
|
||||
}
|
||||
|
||||
// IFluidHandler
|
||||
@Override
|
||||
public int fill(EnumFacing from, FluidStack resource, boolean doFill) {
|
||||
int fill = tank.fill(resource, doFill);
|
||||
tank.compareAndUpdate();
|
||||
return fill;
|
||||
public boolean hasCapability(Capability<?> capability, EnumFacing facing) {
|
||||
if(capability == CapabilityFluidHandler.FLUID_HANDLER_CAPABILITY){
|
||||
return true;
|
||||
}
|
||||
return super.hasCapability(capability, facing);
|
||||
}
|
||||
|
||||
@Override
|
||||
public FluidStack drain(EnumFacing from, FluidStack resource, boolean doDrain) {
|
||||
FluidStack drain = tank.drain(resource.amount, doDrain);
|
||||
tank.compareAndUpdate();
|
||||
return drain;
|
||||
}
|
||||
|
||||
@Override
|
||||
public FluidStack drain(EnumFacing from, int maxDrain, boolean doDrain) {
|
||||
FluidStack drain = tank.drain(maxDrain, doDrain);
|
||||
tank.compareAndUpdate();
|
||||
return drain;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canFill(EnumFacing from, Fluid fluid) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canDrain(EnumFacing from, Fluid fluid) {
|
||||
return tank.getFluid() == null || tank.getFluid().getFluid() == fluid;
|
||||
}
|
||||
|
||||
@Override
|
||||
public FluidTankInfo[] getTankInfo(EnumFacing from) {
|
||||
return new FluidTankInfo[] { tank.getInfo() };
|
||||
public <T> T getCapability(Capability<T> capability, EnumFacing facing) {
|
||||
if(capability == CapabilityFluidHandler.FLUID_HANDLER_CAPABILITY){
|
||||
return (T) tank;
|
||||
}
|
||||
return super.getCapability(capability, facing);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -36,11 +36,11 @@ public class TileQuantumChest extends TileLegacyMachineBase
|
|||
if (!world.isRemote) {
|
||||
if (storedItem != null) {
|
||||
ItemStack fakeStack = storedItem.copy();
|
||||
fakeStack.getCount() = 1;
|
||||
fakeStack.setCount(1);
|
||||
setInventorySlotContents(2, fakeStack);
|
||||
} else if (storedItem == null && getStackInSlot(1) != null) {
|
||||
} else if (storedItem == ItemStack.EMPTY && getStackInSlot(1) != ItemStack.EMPTY) {
|
||||
ItemStack fakeStack = getStackInSlot(1).copy();
|
||||
fakeStack.getCount() = 1;
|
||||
fakeStack.setCount(1);
|
||||
setInventorySlotContents(2, fakeStack);
|
||||
} else {
|
||||
setInventorySlotContents(2, null);
|
||||
|
@ -49,10 +49,10 @@ public class TileQuantumChest extends TileLegacyMachineBase
|
|||
if (getStackInSlot(0) != null) {
|
||||
if (storedItem == null) {
|
||||
storedItem = getStackInSlot(0);
|
||||
setInventorySlotContents(0, null);
|
||||
setInventorySlotContents(0, ItemStack.EMPTY);
|
||||
} else if (ItemUtils.isItemEqual(storedItem, getStackInSlot(0), true, true)) {
|
||||
if (storedItem.getCount() <= storage - getStackInSlot(0).getCount()) {
|
||||
storedItem.getCount() += getStackInSlot(0).getCount();
|
||||
storedItem.grow(getStackInSlot(0).getCount());
|
||||
decrStackSize(0, getStackInSlot(0).getCount());
|
||||
}
|
||||
}
|
||||
|
@ -60,14 +60,14 @@ public class TileQuantumChest extends TileLegacyMachineBase
|
|||
|
||||
if (storedItem != null && getStackInSlot(1) == null) {
|
||||
ItemStack itemStack = storedItem.copy();
|
||||
itemStack.getCount() = itemStack.getMaxStackSize();
|
||||
itemStack.setCount(itemStack.getMaxStackSize());
|
||||
setInventorySlotContents(1, itemStack);
|
||||
storedItem.getCount() -= itemStack.getMaxStackSize();
|
||||
storedItem.shrink(itemStack.getMaxStackSize());
|
||||
} else if (ItemUtils.isItemEqual(getStackInSlot(1), storedItem, true, true)) {
|
||||
int wanted = getStackInSlot(1).getMaxStackSize() - getStackInSlot(1).getCount();
|
||||
if (storedItem.getCount() >= wanted) {
|
||||
decrStackSize(1, -wanted);
|
||||
storedItem.getCount() -= wanted;
|
||||
storedItem.shrink(wanted);
|
||||
} else {
|
||||
decrStackSize(1, -storedItem.getCount());
|
||||
storedItem = null;
|
||||
|
@ -94,11 +94,11 @@ public class TileQuantumChest extends TileLegacyMachineBase
|
|||
storedItem = null;
|
||||
|
||||
if (tagCompound.hasKey("storedStack")) {
|
||||
storedItem = ItemStack.loadItemStackFromNBT((NBTTagCompound) tagCompound.getTag("storedStack"));
|
||||
storedItem = new ItemStack((NBTTagCompound) tagCompound.getTag("storedStack"));
|
||||
}
|
||||
|
||||
if (storedItem != null) {
|
||||
storedItem.getCount() = tagCompound.getInteger("storedQuantity");
|
||||
storedItem.setCount(tagCompound.getInteger("storedQuantity"));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -161,15 +161,14 @@ public class TileQuantumChest extends TileLegacyMachineBase
|
|||
|
||||
@Override
|
||||
public void setStoredItemCount(int amount) {
|
||||
this.storedItem.getCount() = 0;
|
||||
this.storedItem.getCount() += (amount);
|
||||
storedItem.grow(amount);
|
||||
this.markDirty();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setStoredItemType(ItemStack type, int amount) {
|
||||
this.storedItem = type;
|
||||
this.storedItem.getCount() = amount;
|
||||
storedItem.setCount(amount);
|
||||
this.markDirty();
|
||||
}
|
||||
|
||||
|
|
|
@ -6,10 +6,8 @@ import net.minecraft.nbt.NBTTagCompound;
|
|||
import net.minecraft.network.NetworkManager;
|
||||
import net.minecraft.network.play.server.SPacketUpdateTileEntity;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraftforge.fluids.Fluid;
|
||||
import net.minecraftforge.fluids.FluidStack;
|
||||
import net.minecraftforge.fluids.FluidTankInfo;
|
||||
import net.minecraftforge.fluids.IFluidHandler;
|
||||
import net.minecraftforge.common.capabilities.Capability;
|
||||
import net.minecraftforge.fluids.capability.CapabilityFluidHandler;
|
||||
import reborncore.api.IListInfoProvider;
|
||||
import reborncore.api.tile.IInventoryProvider;
|
||||
import reborncore.common.IWrenchable;
|
||||
|
@ -23,7 +21,7 @@ import techreborn.init.ModBlocks;
|
|||
import java.util.List;
|
||||
|
||||
public class TileQuantumTank extends TileLegacyMachineBase
|
||||
implements IFluidHandler, IInventoryProvider, IWrenchable, IListInfoProvider {
|
||||
implements IInventoryProvider, IWrenchable, IListInfoProvider {
|
||||
|
||||
public Tank tank = new Tank("TileQuantumTank", Integer.MAX_VALUE, this);
|
||||
public Inventory inventory = new Inventory(3, "TileQuantumTank", 64, this);
|
||||
|
@ -61,8 +59,8 @@ public class TileQuantumTank extends TileLegacyMachineBase
|
|||
public void updateEntity() {
|
||||
super.updateEntity();
|
||||
if (!world.isRemote) {
|
||||
FluidUtils.drainContainers(this, inventory, 0, 1);
|
||||
FluidUtils.fillContainers(this, inventory, 0, 1, tank.getFluidType());
|
||||
FluidUtils.drainContainers(tank, inventory, 0, 1);
|
||||
FluidUtils.fillContainers(tank, inventory, 0, 1, tank.getFluidType());
|
||||
if (tank.getFluidType() != null && getStackInSlot(2) == null) {
|
||||
// inventory.setInventorySlotContents(2, new ItemStack(tank.getFluidType().getBlock()));
|
||||
} else if (tank.getFluidType() == null && getStackInSlot(2) != null) {
|
||||
|
@ -72,41 +70,20 @@ public class TileQuantumTank extends TileLegacyMachineBase
|
|||
}
|
||||
}
|
||||
|
||||
// IFluidHandler
|
||||
@Override
|
||||
public int fill(EnumFacing from, FluidStack resource, boolean doFill) {
|
||||
int fill = tank.fill(resource, doFill);
|
||||
tank.compareAndUpdate();
|
||||
return fill;
|
||||
public boolean hasCapability(Capability<?> capability, EnumFacing facing) {
|
||||
if(capability == CapabilityFluidHandler.FLUID_HANDLER_CAPABILITY){
|
||||
return true;
|
||||
}
|
||||
return super.hasCapability(capability, facing);
|
||||
}
|
||||
|
||||
@Override
|
||||
public FluidStack drain(EnumFacing from, FluidStack resource, boolean doDrain) {
|
||||
FluidStack drain = tank.drain(resource.amount, doDrain);
|
||||
tank.compareAndUpdate();
|
||||
return drain;
|
||||
}
|
||||
|
||||
@Override
|
||||
public FluidStack drain(EnumFacing from, int maxDrain, boolean doDrain) {
|
||||
FluidStack drain = tank.drain(maxDrain, doDrain);
|
||||
tank.compareAndUpdate();
|
||||
return drain;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canFill(EnumFacing from, Fluid fluid) {
|
||||
return tank.getFluid() == null || tank.getFluid().getFluid() == fluid;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canDrain(EnumFacing from, Fluid fluid) {
|
||||
return tank.getFluid() == null || tank.getFluid().getFluid() == fluid;
|
||||
}
|
||||
|
||||
@Override
|
||||
public FluidTankInfo[] getTankInfo(EnumFacing from) {
|
||||
return new FluidTankInfo[] { tank.getInfo() };
|
||||
public <T> T getCapability(Capability<T> capability, EnumFacing facing) {
|
||||
if(capability == CapabilityFluidHandler.FLUID_HANDLER_CAPABILITY){
|
||||
return (T) tank;
|
||||
}
|
||||
return super.getCapability(capability, facing);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -80,7 +80,7 @@ public class TileRollingMachine extends TilePowerAcceptor implements IWrenchable
|
|||
if (inventory.getStackInSlot(0).getCount() + currentRecipe.getCount() <= currentRecipe
|
||||
.getMaxStackSize()) {
|
||||
ItemStack stack = inventory.getStackInSlot(0);
|
||||
stack.getCount() = stack.getCount() + currentRecipe.getCount();
|
||||
stack.setCount(stack.getCount() + currentRecipe.getCount());
|
||||
inventory.setInventorySlotContents(0, stack);
|
||||
tickTime = -1;
|
||||
hasCrafted = true;
|
||||
|
|
|
@ -6,7 +6,9 @@ import net.minecraft.nbt.NBTTagCompound;
|
|||
import net.minecraft.network.NetworkManager;
|
||||
import net.minecraft.network.play.server.SPacketUpdateTileEntity;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraftforge.common.capabilities.Capability;
|
||||
import net.minecraftforge.fluids.*;
|
||||
import net.minecraftforge.fluids.capability.CapabilityFluidHandler;
|
||||
import reborncore.api.fuel.FluidPowerManager;
|
||||
import reborncore.api.power.EnumPowerTier;
|
||||
import reborncore.api.tile.IInventoryProvider;
|
||||
|
@ -18,10 +20,10 @@ import reborncore.common.util.Tank;
|
|||
import techreborn.config.ConfigTechReborn;
|
||||
import techreborn.init.ModBlocks;
|
||||
|
||||
public class TileDieselGenerator extends TilePowerAcceptor implements IWrenchable, IFluidHandler, IInventoryProvider {
|
||||
public class TileDieselGenerator extends TilePowerAcceptor implements IWrenchable, IInventoryProvider {
|
||||
|
||||
public static final int euTick = ConfigTechReborn.ThermalGeneratorOutput;
|
||||
public Tank tank = new Tank("TileDieselGenerator", FluidContainerRegistry.BUCKET_VOLUME * 10, this);
|
||||
public Tank tank = new Tank("TileDieselGenerator", 1000 * 10, this);
|
||||
public Inventory inventory = new Inventory(3, "TileDieselGenerator", 64, this);
|
||||
|
||||
public TileDieselGenerator() {
|
||||
|
@ -54,42 +56,19 @@ public class TileDieselGenerator extends TilePowerAcceptor implements IWrenchabl
|
|||
}
|
||||
|
||||
@Override
|
||||
public int fill(EnumFacing from, FluidStack resource, boolean doFill) {
|
||||
int filled = tank.fill(resource, doFill);
|
||||
tank.compareAndUpdate();
|
||||
return filled;
|
||||
}
|
||||
|
||||
@Override
|
||||
public FluidStack drain(EnumFacing from, FluidStack resource, boolean doDrain) {
|
||||
if (resource == null || !resource.isFluidEqual(tank.getFluid())) {
|
||||
return null;
|
||||
public boolean hasCapability(Capability<?> capability, EnumFacing facing) {
|
||||
if(capability == CapabilityFluidHandler.FLUID_HANDLER_CAPABILITY){
|
||||
return true;
|
||||
}
|
||||
FluidStack fluidStack = tank.drain(resource.amount, doDrain);
|
||||
tank.compareAndUpdate();
|
||||
return fluidStack;
|
||||
return super.hasCapability(capability, facing);
|
||||
}
|
||||
|
||||
@Override
|
||||
public FluidStack drain(EnumFacing from, int maxDrain, boolean doDrain) {
|
||||
FluidStack drained = tank.drain(maxDrain, doDrain);
|
||||
tank.compareAndUpdate();
|
||||
return drained;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canFill(EnumFacing from, Fluid fluid) {
|
||||
return FluidPowerManager.fluidPowerValues.containsKey(fluid);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canDrain(EnumFacing from, Fluid fluid) {
|
||||
return tank.getFluid() == null || tank.getFluid().getFluid() == fluid;
|
||||
}
|
||||
|
||||
@Override
|
||||
public FluidTankInfo[] getTankInfo(EnumFacing from) {
|
||||
return new FluidTankInfo[] { tank.getInfo() };
|
||||
public <T> T getCapability(Capability<T> capability, EnumFacing facing) {
|
||||
if(capability == CapabilityFluidHandler.FLUID_HANDLER_CAPABILITY){
|
||||
return (T) tank;
|
||||
}
|
||||
return super.getCapability(capability, facing);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -116,8 +95,8 @@ public class TileDieselGenerator extends TilePowerAcceptor implements IWrenchabl
|
|||
public void updateEntity() {
|
||||
super.updateEntity();
|
||||
if (!world.isRemote) {
|
||||
FluidUtils.drainContainers(this, inventory, 0, 1);
|
||||
FluidUtils.fillContainers(this, inventory, 0, 1, tank.getFluidType());
|
||||
FluidUtils.drainContainers(tank, inventory, 0, 1);
|
||||
FluidUtils.fillContainers(tank, inventory, 0, 1, tank.getFluidType());
|
||||
if (tank.getFluidType() != null && getStackInSlot(2) == null) {
|
||||
inventory.setInventorySlotContents(2, new ItemStack(tank.getFluidType().getBlock()));
|
||||
syncWithAll();
|
||||
|
|
|
@ -6,7 +6,9 @@ import net.minecraft.nbt.NBTTagCompound;
|
|||
import net.minecraft.network.NetworkManager;
|
||||
import net.minecraft.network.play.server.SPacketUpdateTileEntity;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraftforge.common.capabilities.Capability;
|
||||
import net.minecraftforge.fluids.*;
|
||||
import net.minecraftforge.fluids.capability.CapabilityFluidHandler;
|
||||
import reborncore.api.power.EnumPowerTier;
|
||||
import reborncore.api.tile.IInventoryProvider;
|
||||
import reborncore.common.IWrenchable;
|
||||
|
@ -20,11 +22,11 @@ import techreborn.init.ModBlocks;
|
|||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
public class TileGasTurbine extends TilePowerAcceptor implements IWrenchable, IFluidHandler, IInventoryProvider {
|
||||
public class TileGasTurbine extends TilePowerAcceptor implements IWrenchable, IInventoryProvider {
|
||||
|
||||
// TODO: run this off config
|
||||
public static final int euTick = 16;
|
||||
public Tank tank = new Tank("TileGasTurbine", FluidContainerRegistry.BUCKET_VOLUME * 10, this);
|
||||
public Tank tank = new Tank("TileGasTurbine", 1000 * 10, this);
|
||||
public Inventory inventory = new Inventory(3, "TileGasTurbine", 64, this);
|
||||
Map<String, Integer> fluids = new HashMap<>();
|
||||
|
||||
|
@ -67,42 +69,19 @@ public class TileGasTurbine extends TilePowerAcceptor implements IWrenchable, IF
|
|||
}
|
||||
|
||||
@Override
|
||||
public int fill(EnumFacing from, FluidStack resource, boolean doFill) {
|
||||
int fill = tank.fill(resource, doFill);
|
||||
tank.compareAndUpdate();
|
||||
return fill;
|
||||
}
|
||||
|
||||
@Override
|
||||
public FluidStack drain(EnumFacing from, FluidStack resource, boolean doDrain) {
|
||||
FluidStack drain = tank.drain(resource.amount, doDrain);
|
||||
tank.compareAndUpdate();
|
||||
return drain;
|
||||
}
|
||||
|
||||
@Override
|
||||
public FluidStack drain(EnumFacing from, int maxDrain, boolean doDrain) {
|
||||
FluidStack drain = tank.drain(maxDrain, doDrain);
|
||||
tank.compareAndUpdate();
|
||||
return drain;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canFill(EnumFacing from, Fluid fluid) {
|
||||
if (fluid != null) {
|
||||
return fluids.containsKey(FluidRegistry.getFluidName(fluid));
|
||||
public boolean hasCapability(Capability<?> capability, EnumFacing facing) {
|
||||
if(capability == CapabilityFluidHandler.FLUID_HANDLER_CAPABILITY){
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
return super.hasCapability(capability, facing);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canDrain(EnumFacing from, Fluid fluid) {
|
||||
return tank.getFluid() == null || tank.getFluid().getFluid() == fluid;
|
||||
}
|
||||
|
||||
@Override
|
||||
public FluidTankInfo[] getTankInfo(EnumFacing from) {
|
||||
return new FluidTankInfo[] { tank.getInfo() };
|
||||
public <T> T getCapability(Capability<T> capability, EnumFacing facing) {
|
||||
if(capability == CapabilityFluidHandler.FLUID_HANDLER_CAPABILITY){
|
||||
return (T) tank;
|
||||
}
|
||||
return super.getCapability(capability, facing);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -129,7 +108,7 @@ public class TileGasTurbine extends TilePowerAcceptor implements IWrenchable, IF
|
|||
public void updateEntity() {
|
||||
super.updateEntity();
|
||||
if (!world.isRemote) {
|
||||
FluidUtils.drainContainers(this, inventory, 0, 1);
|
||||
FluidUtils.drainContainers(tank, inventory, 0, 1);
|
||||
tank.compareAndUpdate();
|
||||
}
|
||||
|
||||
|
|
|
@ -6,7 +6,9 @@ import net.minecraft.nbt.NBTTagCompound;
|
|||
import net.minecraft.network.NetworkManager;
|
||||
import net.minecraft.network.play.server.SPacketUpdateTileEntity;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraftforge.common.capabilities.Capability;
|
||||
import net.minecraftforge.fluids.*;
|
||||
import net.minecraftforge.fluids.capability.CapabilityFluidHandler;
|
||||
import reborncore.api.power.EnumPowerTier;
|
||||
import reborncore.api.tile.IInventoryProvider;
|
||||
import reborncore.common.IWrenchable;
|
||||
|
@ -20,11 +22,11 @@ import techreborn.init.ModBlocks;
|
|||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
public class TileSemifluidGenerator extends TilePowerAcceptor implements IWrenchable, IFluidHandler, IInventoryProvider {
|
||||
public class TileSemifluidGenerator extends TilePowerAcceptor implements IWrenchable, IInventoryProvider {
|
||||
|
||||
// TODO: run this off config
|
||||
public static final int euTick = 8;
|
||||
public Tank tank = new Tank("TileSemifluidGenerator", FluidContainerRegistry.BUCKET_VOLUME * 10, this);
|
||||
public Tank tank = new Tank("TileSemifluidGenerator", 1000 * 10, this);
|
||||
public Inventory inventory = new Inventory(3, "TileSemifluidGenerator", 64, this);
|
||||
Map<String, Integer> fluids = new HashMap<>();
|
||||
|
||||
|
@ -73,42 +75,19 @@ public class TileSemifluidGenerator extends TilePowerAcceptor implements IWrench
|
|||
}
|
||||
|
||||
@Override
|
||||
public int fill(EnumFacing from, FluidStack resource, boolean doFill) {
|
||||
int fill = tank.fill(resource, doFill);
|
||||
tank.compareAndUpdate();
|
||||
return fill;
|
||||
}
|
||||
|
||||
@Override
|
||||
public FluidStack drain(EnumFacing from, FluidStack resource, boolean doDrain) {
|
||||
FluidStack drain = tank.drain(resource.amount, doDrain);
|
||||
tank.compareAndUpdate();
|
||||
return drain;
|
||||
}
|
||||
|
||||
@Override
|
||||
public FluidStack drain(EnumFacing from, int maxDrain, boolean doDrain) {
|
||||
FluidStack drain = tank.drain(maxDrain, doDrain);
|
||||
tank.compareAndUpdate();
|
||||
return drain;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canFill(EnumFacing from, Fluid fluid) {
|
||||
if (fluid != null) {
|
||||
return fluids.containsKey(FluidRegistry.getFluidName(fluid));
|
||||
public boolean hasCapability(Capability<?> capability, EnumFacing facing) {
|
||||
if(capability == CapabilityFluidHandler.FLUID_HANDLER_CAPABILITY){
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
return super.hasCapability(capability, facing);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canDrain(EnumFacing from, Fluid fluid) {
|
||||
return tank.getFluid() == null || tank.getFluid().getFluid() == fluid;
|
||||
}
|
||||
|
||||
@Override
|
||||
public FluidTankInfo[] getTankInfo(EnumFacing from) {
|
||||
return new FluidTankInfo[] { tank.getInfo() };
|
||||
public <T> T getCapability(Capability<T> capability, EnumFacing facing) {
|
||||
if(capability == CapabilityFluidHandler.FLUID_HANDLER_CAPABILITY){
|
||||
return (T) tank;
|
||||
}
|
||||
return super.getCapability(capability, facing);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -135,7 +114,7 @@ public class TileSemifluidGenerator extends TilePowerAcceptor implements IWrench
|
|||
public void updateEntity() {
|
||||
super.updateEntity();
|
||||
if (!world.isRemote)
|
||||
FluidUtils.drainContainers(this, inventory, 0, 1);
|
||||
FluidUtils.drainContainers(tank, inventory, 0, 1);
|
||||
|
||||
if (tank.getFluidAmount() > 0 && getMaxPower() - getEnergy() >= euTick && tank.getFluidType() != null && fluids.containsKey(tank.getFluidType().getName())) {
|
||||
Integer euPerBucket = fluids.get(tank.getFluidType().getName());
|
||||
|
|
|
@ -8,7 +8,9 @@ import net.minecraft.network.NetworkManager;
|
|||
import net.minecraft.network.play.server.SPacketUpdateTileEntity;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraftforge.common.capabilities.Capability;
|
||||
import net.minecraftforge.fluids.*;
|
||||
import net.minecraftforge.fluids.capability.CapabilityFluidHandler;
|
||||
import reborncore.api.power.EnumPowerTier;
|
||||
import reborncore.api.tile.IInventoryProvider;
|
||||
import reborncore.common.IWrenchable;
|
||||
|
@ -20,10 +22,10 @@ import reborncore.common.util.Tank;
|
|||
import techreborn.config.ConfigTechReborn;
|
||||
import techreborn.init.ModBlocks;
|
||||
|
||||
public class TileThermalGenerator extends TilePowerAcceptor implements IWrenchable, IFluidHandler, IInventoryProvider {
|
||||
public class TileThermalGenerator extends TilePowerAcceptor implements IWrenchable, IInventoryProvider {
|
||||
|
||||
public static final int euTick = ConfigTechReborn.ThermalGeneratorOutput;
|
||||
public Tank tank = new Tank("TileThermalGenerator", FluidContainerRegistry.BUCKET_VOLUME * 10, this);
|
||||
public Tank tank = new Tank("TileThermalGenerator", 1000 * 10, this);
|
||||
public Inventory inventory = new Inventory(3, "TileThermalGenerator", 64, this);
|
||||
|
||||
public TileThermalGenerator() {
|
||||
|
@ -56,44 +58,19 @@ public class TileThermalGenerator extends TilePowerAcceptor implements IWrenchab
|
|||
}
|
||||
|
||||
@Override
|
||||
public int fill(EnumFacing from, FluidStack resource, boolean doFill) {
|
||||
int fill = tank.fill(resource, doFill);
|
||||
tank.compareAndUpdate();
|
||||
return fill;
|
||||
}
|
||||
|
||||
@Override
|
||||
public FluidStack drain(EnumFacing from, FluidStack resource, boolean doDrain) {
|
||||
FluidStack drain = tank.drain(resource.amount, doDrain);
|
||||
tank.compareAndUpdate();
|
||||
return drain;
|
||||
}
|
||||
|
||||
@Override
|
||||
public FluidStack drain(EnumFacing from, int maxDrain, boolean doDrain) {
|
||||
FluidStack drain = tank.drain(maxDrain, doDrain);
|
||||
tank.compareAndUpdate();
|
||||
return drain;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canFill(EnumFacing from, Fluid fluid) {
|
||||
if (fluid != null) {
|
||||
if (fluid == FluidRegistry.LAVA) {
|
||||
return true;
|
||||
}
|
||||
public boolean hasCapability(Capability<?> capability, EnumFacing facing) {
|
||||
if(capability == CapabilityFluidHandler.FLUID_HANDLER_CAPABILITY){
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
return super.hasCapability(capability, facing);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canDrain(EnumFacing from, Fluid fluid) {
|
||||
return tank.getFluid() == null || tank.getFluid().getFluid() == fluid;
|
||||
}
|
||||
|
||||
@Override
|
||||
public FluidTankInfo[] getTankInfo(EnumFacing from) {
|
||||
return new FluidTankInfo[] { tank.getInfo() };
|
||||
public <T> T getCapability(Capability<T> capability, EnumFacing facing) {
|
||||
if(capability == CapabilityFluidHandler.FLUID_HANDLER_CAPABILITY){
|
||||
return (T) tank;
|
||||
}
|
||||
return super.getCapability(capability, facing);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -121,7 +98,7 @@ public class TileThermalGenerator extends TilePowerAcceptor implements IWrenchab
|
|||
public void updateEntity() {
|
||||
super.updateEntity();
|
||||
if (!world.isRemote) {
|
||||
FluidUtils.drainContainers(this, inventory, 0, 1);
|
||||
FluidUtils.drainContainers(tank, inventory, 0, 1);
|
||||
for (EnumFacing direction : EnumFacing.values()) {
|
||||
if (world.getBlockState(new BlockPos(getPos().getX() + direction.getFrontOffsetX(),
|
||||
getPos().getY() + direction.getFrontOffsetY(), getPos().getZ() + direction.getFrontOffsetZ()))
|
||||
|
|
|
@ -9,7 +9,9 @@ import net.minecraft.nbt.NBTTagCompound;
|
|||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraftforge.common.capabilities.Capability;
|
||||
import net.minecraftforge.fluids.*;
|
||||
import net.minecraftforge.fluids.capability.CapabilityFluidHandler;
|
||||
import reborncore.api.power.EnumPowerTier;
|
||||
import reborncore.api.recipe.IRecipeCrafterProvider;
|
||||
import reborncore.api.tile.IInventoryProvider;
|
||||
|
@ -31,7 +33,7 @@ import static techreborn.tiles.multiblock.MultiblockChecker.CASING_REINFORCED;
|
|||
import static techreborn.tiles.multiblock.MultiblockChecker.ZERO_OFFSET;
|
||||
|
||||
public class TileIndustrialGrinder extends TilePowerAcceptor
|
||||
implements IWrenchable, IFluidHandler, IInventoryProvider, ISidedInventory, ITileRecipeHandler<IndustrialGrinderRecipe>, IRecipeCrafterProvider {
|
||||
implements IWrenchable, IInventoryProvider, ISidedInventory, ITileRecipeHandler<IndustrialGrinderRecipe>, IRecipeCrafterProvider {
|
||||
public static final int TANK_CAPACITY = 16000;
|
||||
|
||||
public Inventory inventory = new Inventory(6, "TileGrinder", 64, this);
|
||||
|
@ -100,7 +102,7 @@ public class TileIndustrialGrinder extends TilePowerAcceptor
|
|||
if (getMutliBlock()) {
|
||||
crafter.updateEntity();
|
||||
}
|
||||
FluidUtils.drainContainers(this, inventory, 1, 5);
|
||||
FluidUtils.drainContainers(tank, inventory, 1, 5);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -128,48 +130,20 @@ public class TileIndustrialGrinder extends TilePowerAcceptor
|
|||
super.onChunkUnload();
|
||||
}
|
||||
|
||||
/* IFluidHandler */
|
||||
@Override
|
||||
public int fill(EnumFacing from, FluidStack resource, boolean doFill) {
|
||||
if (resource.getFluid() == FluidRegistry.WATER || resource.getFluid() == ModFluids.fluidMercury
|
||||
|| resource.getFluid() == ModFluids.fluidSodiumpersulfate) {
|
||||
int filled = tank.fill(resource, doFill);
|
||||
tank.compareAndUpdate();
|
||||
return filled;
|
||||
public boolean hasCapability(Capability<?> capability, EnumFacing facing) {
|
||||
if(capability == CapabilityFluidHandler.FLUID_HANDLER_CAPABILITY){
|
||||
return true;
|
||||
}
|
||||
return 0;
|
||||
return super.hasCapability(capability, facing);
|
||||
}
|
||||
|
||||
@Override
|
||||
public FluidStack drain(EnumFacing from, FluidStack resource, boolean doDrain) {
|
||||
if (resource == null || !resource.isFluidEqual(tank.getFluid())) {
|
||||
return null;
|
||||
public <T> T getCapability(Capability<T> capability, EnumFacing facing) {
|
||||
if(capability == CapabilityFluidHandler.FLUID_HANDLER_CAPABILITY){
|
||||
return (T) tank;
|
||||
}
|
||||
FluidStack fluidStack = tank.drain(resource.amount, doDrain);
|
||||
tank.compareAndUpdate();
|
||||
return fluidStack;
|
||||
}
|
||||
|
||||
@Override
|
||||
public FluidStack drain(EnumFacing from, int maxDrain, boolean doDrain) {
|
||||
FluidStack drained = tank.drain(maxDrain, doDrain);
|
||||
tank.compareAndUpdate();
|
||||
return drained;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canFill(EnumFacing from, Fluid fluid) {
|
||||
return fluid == FluidRegistry.WATER || fluid == ModFluids.fluidMercury || fluid == ModFluids.fluidSodiumpersulfate;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canDrain(EnumFacing from, Fluid fluid) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public FluidTankInfo[] getTankInfo(EnumFacing from) {
|
||||
return new FluidTankInfo[] { tank.getInfo() };
|
||||
return super.getCapability(capability, facing);
|
||||
}
|
||||
|
||||
// ISidedInventory
|
||||
|
|
|
@ -9,7 +9,9 @@ import net.minecraft.item.ItemStack;
|
|||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraftforge.common.capabilities.Capability;
|
||||
import net.minecraftforge.fluids.*;
|
||||
import net.minecraftforge.fluids.capability.CapabilityFluidHandler;
|
||||
import net.minecraftforge.oredict.OreDictionary;
|
||||
import reborncore.api.IListInfoProvider;
|
||||
import reborncore.api.power.EnumPowerTier;
|
||||
|
@ -29,7 +31,7 @@ import static techreborn.tiles.multiblock.MultiblockChecker.CASING_NORMAL;
|
|||
import static techreborn.tiles.multiblock.MultiblockChecker.CASING_REINFORCED;
|
||||
import static techreborn.tiles.multiblock.MultiblockChecker.ZERO_OFFSET;
|
||||
|
||||
public class TileIndustrialSawmill extends TilePowerAcceptor implements IWrenchable, IFluidHandler, IInventoryProvider, ISidedInventory, IListInfoProvider {
|
||||
public class TileIndustrialSawmill extends TilePowerAcceptor implements IWrenchable, IInventoryProvider, ISidedInventory, IListInfoProvider {
|
||||
|
||||
public Inventory inventory = new Inventory(5, "Sawmill", 64, this);
|
||||
public Tank tank = new Tank("Sawmill", 16000, this);
|
||||
|
@ -57,8 +59,9 @@ public class TileIndustrialSawmill extends TilePowerAcceptor implements IWrencha
|
|||
canUseEnergy(128.0F) &&
|
||||
!tank.isEmpty() &&
|
||||
tank.getFluid().amount >= 1000) {
|
||||
if (--wood.getCount() == 0)
|
||||
setInventorySlotContents(0, null);
|
||||
wood.shrink(1);
|
||||
if (wood.getCount() == 0)
|
||||
setInventorySlotContents(0, ItemStack.EMPTY);
|
||||
tank.drain(1000, true);
|
||||
useEnergy(128.0F);
|
||||
tickTime = 1;
|
||||
|
@ -79,13 +82,13 @@ public class TileIndustrialSawmill extends TilePowerAcceptor implements IWrencha
|
|||
tickTime = 0;
|
||||
}
|
||||
}
|
||||
FluidUtils.drainContainers(this, inventory, 1, 4);
|
||||
FluidUtils.drainContainers(tank, inventory, 1, 4);
|
||||
}
|
||||
|
||||
public void addOutput(int slot, ItemStack stack) {
|
||||
if (getStackInSlot(slot) == null)
|
||||
setInventorySlotContents(slot, stack);
|
||||
getStackInSlot(slot).getCount() += stack.getCount();
|
||||
getStackInSlot(slot).grow(stack.getCount());
|
||||
}
|
||||
|
||||
public boolean canAddOutput(int slot, int amount) {
|
||||
|
@ -148,48 +151,20 @@ public class TileIndustrialSawmill extends TilePowerAcceptor implements IWrencha
|
|||
return tagCompound;
|
||||
}
|
||||
|
||||
/* IFluidHandler */
|
||||
@Override
|
||||
public int fill(EnumFacing from, FluidStack resource, boolean doFill) {
|
||||
if (resource.getFluid() == FluidRegistry.WATER || resource.getFluid() == ModFluids.fluidMercury
|
||||
|| resource.getFluid() == ModFluids.fluidSodiumpersulfate) {
|
||||
int filled = tank.fill(resource, doFill);
|
||||
tank.compareAndUpdate();
|
||||
return filled;
|
||||
public boolean hasCapability(Capability<?> capability, EnumFacing facing) {
|
||||
if(capability == CapabilityFluidHandler.FLUID_HANDLER_CAPABILITY){
|
||||
return true;
|
||||
}
|
||||
return 0;
|
||||
return super.hasCapability(capability, facing);
|
||||
}
|
||||
|
||||
@Override
|
||||
public FluidStack drain(EnumFacing from, FluidStack resource, boolean doDrain) {
|
||||
if (resource == null || !resource.isFluidEqual(tank.getFluid())) {
|
||||
return null;
|
||||
public <T> T getCapability(Capability<T> capability, EnumFacing facing) {
|
||||
if(capability == CapabilityFluidHandler.FLUID_HANDLER_CAPABILITY){
|
||||
return (T) tank;
|
||||
}
|
||||
FluidStack fluidStack = tank.drain(resource.amount, doDrain);
|
||||
tank.compareAndUpdate();
|
||||
return fluidStack;
|
||||
}
|
||||
|
||||
@Override
|
||||
public FluidStack drain(EnumFacing from, int maxDrain, boolean doDrain) {
|
||||
FluidStack drained = tank.drain(maxDrain, doDrain);
|
||||
tank.compareAndUpdate();
|
||||
return drained;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canFill(EnumFacing from, Fluid fluid) {
|
||||
return fluid == FluidRegistry.WATER;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canDrain(EnumFacing from, Fluid fluid) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public FluidTankInfo[] getTankInfo(EnumFacing from) {
|
||||
return new FluidTankInfo[] { tank.getInfo() };
|
||||
return super.getCapability(capability, facing);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -80,7 +80,7 @@ public class TileRecycler extends TilePowerAcceptor implements IWrenchable, IInv
|
|||
} else if (getStackInSlot(output).isItemEqual(itemstack)) {
|
||||
useEnergy(cost);
|
||||
if (randomchance == 1) {
|
||||
getStackInSlot(output).getCount() += itemstack.getCount();
|
||||
getStackInSlot(output).setCount(itemstack.getCount());
|
||||
}
|
||||
}
|
||||
if (getStackInSlot(input1).getCount() > 1) {
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
package techreborn.utils;
|
||||
|
||||
import ic2.api.item.IC2Items;
|
||||
import ic2.core.item.tool.ItemToolWrench;
|
||||
//import ic2.core.item.tool.ItemToolWrench;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.EnumActionResult;
|
||||
|
@ -10,22 +10,25 @@ import net.minecraft.util.EnumHand;
|
|||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
//TODO IC2
|
||||
public class IC2WrenchHelper {
|
||||
|
||||
static ItemToolWrench wrench;
|
||||
//static ItemToolWrench wrench;
|
||||
|
||||
public static EnumActionResult onItemUseFirst(ItemStack stack, EntityPlayer player, World world, BlockPos pos,
|
||||
EnumFacing side, float hitX, float hitY, float hitZ, EnumHand hand) {
|
||||
if (wrench == null) {
|
||||
wrench = (ItemToolWrench) IC2Items.getItem("wrench").getItem();
|
||||
}
|
||||
return wrench.onItemUseFirst(stack, player, world, pos, side, hitX, hitY, hitZ, hand);
|
||||
// if (wrench == null) {
|
||||
// wrench = (ItemToolWrench) IC2Items.getItem("wrench").getItem();
|
||||
// }
|
||||
// return wrench.onItemUseFirst(stack, player, world, pos, side, hitX, hitY, hitZ, hand);
|
||||
return EnumActionResult.FAIL;
|
||||
}
|
||||
|
||||
public static EnumActionResult onItemUse(ItemStack stack, EntityPlayer playerIn, World worldIn, BlockPos pos, EnumHand hand, EnumFacing facing, float hitX, float hitY, float hitZ) {
|
||||
if (wrench == null) {
|
||||
wrench = (ItemToolWrench) IC2Items.getItem("wrench").getItem();
|
||||
}
|
||||
return wrench.onItemUse(stack, playerIn, worldIn, pos, hand, facing, hitX, hitY, hitZ);
|
||||
// if (wrench == null) {
|
||||
// wrench = (ItemToolWrench) IC2Items.getItem("wrench").getItem();
|
||||
// }
|
||||
// return wrench.onItemUse(stack, playerIn, worldIn, pos, hand, facing, hitX, hitY, hitZ);
|
||||
return EnumActionResult.FAIL;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue