Jump to content
View in the app

A better way to browse. Learn more.

Forge Forums

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Featured Replies

Posted

I have a work bench, I have that would put the tube back BuildCraft items. What do I need to use from BuildCraft API?

 

[Google translate] I am from Russia

  • Author

I believe all you need for simple interaction with pipes is ISidedInventory, from vanilla. You don't even need the BuildCraftAPI and you will get compatibility with most if not all pipes.

It did not work. I even had to put the connection code

@Override
public ConnectOverride overridePipeConnection(PipeType type, ForgeDirection with) 
{
	return ConnectOverride.CONNECT;
}

And it must implement a tile?

Here is my tile, but nothing happened

package com.svk.industrialGuns.Tile;

import buildcraft.api.gates.IGate;
import buildcraft.api.transport.IPipe;
import buildcraft.api.transport.IPipeConnection;
import buildcraft.api.transport.IPipeTile;
import buildcraft.api.transport.IPipeTile.PipeType;
import buildcraft.api.transport.PipeWire;

import com.svk.industrialGuns.base.CommonProxy;

import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.inventory.ISidedInventory;
import net.minecraft.inventory.Slot;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.nbt.NBTTagList;
import net.minecraft.tileentity.TileEntity;
import net.minecraftforge.common.util.ForgeDirection;

public class TileTableGunCreate extends TileEntity implements ISidedInventory, IPipeConnection
{
private ItemStack[] slots = new ItemStack[10];

public void updateEntity()
{
}

public void readFromNBT(NBTTagCompound nbt)
{
	super.readFromNBT(nbt);

	NBTTagList list = nbt.getTagList("Slots", 10);
	this.slots = new ItemStack[getSizeInventory()];

	for(int i = 0; i < list.tagCount(); i++)
	{
		NBTTagCompound item = list.getCompoundTagAt(i);
		byte b = item.getByte("Item");

		if(b >= 0 && b < this.slots.length)
		{
			this.slots[b] = ItemStack.loadItemStackFromNBT(item);
			System.out.println(ItemStack.loadItemStackFromNBT(item));
		}

		if(nbt.hasKey("CustomName"))
		{
			this.setInventoryName(nbt.getString("CustomName"));
		}
	}
}

public void writeToNBT(NBTTagCompound nbt)
{
	super.writeToNBT(nbt);

	NBTTagList list = new NBTTagList();

	for(int i = 0; i < this.slots.length; i++)
	{
		if(this.slots[i] != null)
		{
			NBTTagCompound item = new NBTTagCompound();
			item.setByte("Item", (byte) i);
			this.slots[i].writeToNBT(item);
			list.appendTag(item);
		}
	}

	nbt.setTag("Slots", list);

	if(this.hasCustomInventoryName())
	{
		nbt.setString("CustomName", this.getInventoryName());
	}
}

@Override
public int getSizeInventory() 
{
	return this.slots.length;
}

@Override
public ItemStack getStackInSlot(int i) 
{
	return this.slots[i]; 
}

public ItemStack decrStackSize(int i, int j) 
{
	if(this.slots[i] != null)
	{
		ItemStack itemstack;

		if(this.slots[i].stackSize < j)
		{
			itemstack = this.slots[i];
			this.slots[i] = null;
			return itemstack;
		}
		else
		{
			itemstack = this.slots[i].splitStack(j);

			if(this.slots[i].stackSize == 0)
			{
				this.slots[i] = null;
			}

			return itemstack;
		}
	}
	return null;
}

public ItemStack getStackInSlotOnClosing(int i) 
{
	if(this.slots[i] != null)
	{
		ItemStack itemstack = this.slots[i];
		this.slots[i] = null;
		return itemstack;
	}
	return null;
}

@Override
public void setInventorySlotContents(int i, ItemStack itemstack) 
{
	this.slots[i] = itemstack;

	if(itemstack != null && itemstack.stackSize > this.getInventoryStackLimit())
	{
		itemstack.stackSize = this.getInventoryStackLimit();
	}
}


public void setInventoryName(String string)
{
}

public String getInventoryName() 
{
	return null;
}

@Override
public boolean hasCustomInventoryName() {
	// TODO Auto-generated method stub
	return false;
}

@Override
public int getInventoryStackLimit() {
	// TODO Auto-generated method stub
	return 64;
}

@Override
public boolean isUseableByPlayer(EntityPlayer p_70300_1_) {
	// TODO Auto-generated method stub
	return false;
}

@Override
public void openInventory() {
	//??

}

@Override
public void closeInventory() {
	// TODO Auto-generated method stub

}

@Override
public boolean isItemValidForSlot(int p_94041_1_, ItemStack p_94041_2_) {
	// TODO Auto-generated method stub
	return false;
}

@Override
public int[] getAccessibleSlotsFromSide(int p_94128_1_) {
	// TODO Auto-generated method stub
	return null;
}

@Override
public boolean canInsertItem(int slot, ItemStack stack, int side) 
{
	return isItemValidForSlot(slot, stack);
}

@Override
public boolean canExtractItem(int p_102008_1_, ItemStack p_102008_2_,
		int p_102008_3_) {
	// TODO Auto-generated method stub
	return false;
}

@Override
public ConnectOverride overridePipeConnection(PipeType type, ForgeDirection with) 
{
	return ConnectOverride.CONNECT;
}


}

  • Author

Yeah, maybe try actually doing something witht the methods  :o

Did you mean that it is necessary to use methods BuildCraft?

Yeah, maybe try actually doing something witht the methods  :o

Did you mean that it is necessary to use methods BuildCraft?

Well, atleast try to implements these methods:

public boolean isItemValidForSlot(int p_94041_1_, ItemStack p_94041_2_) {
	// TODO Auto-generated method stub
	return false;
}

@Override
public int[] getAccessibleSlotsFromSide(int p_94128_1_) {
	// TODO Auto-generated method stub
	return null;
}

@Override
public boolean canExtractItem(int p_102008_1_, ItemStack p_102008_2_,
		int p_102008_3_) {
	// TODO Auto-generated method stub
	return false;
}

Don't PM me with questions. They will be ignored! Make a thread on the appropriate board for support.

 

1.12 -> 1.13 primer by williewillus.

 

1.7.10 and older versions of Minecraft are no longer supported due to it's age! Update to the latest version for support.

 

http://www.howoldisminecraft1710.today/

OMG, ti daje ne pereopredilil metodi...

Ny tebe je pomogli na mcmodding, nah suda pista'? :)

This is an english forum, so let's keep it that way.

Don't PM me with questions. They will be ignored! Make a thread on the appropriate board for support.

 

1.12 -> 1.13 primer by williewillus.

 

1.7.10 and older versions of Minecraft are no longer supported due to it's age! Update to the latest version for support.

 

http://www.howoldisminecraft1710.today/

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

Important Information

By using this site, you agree to our Terms of Use.

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.