Skip to content

Commit

Permalink
keep fixing pipes
Browse files Browse the repository at this point in the history
  • Loading branch information
multiplemonomials committed Apr 8, 2016
1 parent 6097ca2 commit d6d8e23
Show file tree
Hide file tree
Showing 22 changed files with 73 additions and 60 deletions.
14 changes: 1 addition & 13 deletions AdditionalPipesBC_Client.launch
Original file line number Diff line number Diff line change
@@ -1,13 +1 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<launchConfiguration type="org.eclipse.jdt.launching.localJavaApplication">
<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_PATHS">
<listEntry value="/AdditionalPipesBC"/>
</listAttribute>
<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_TYPES">
<listEntry value="4"/>
</listAttribute>
<stringAttribute key="org.eclipse.jdt.launching.MAIN_TYPE" value="GradleStart"/>
<stringAttribute key="org.eclipse.jdt.launching.PROJECT_ATTR" value="AdditionalPipesBC"/>
<stringAttribute key="org.eclipse.jdt.launching.VM_ARGUMENTS" value="-DFORGE_FORCE_FRAME_RECALC=true"/>
<stringAttribute key="org.eclipse.jdt.launching.WORKING_DIRECTORY" value="C:\Users\Jamie\workspace\AdditionalPipesBC\eclipse\assets"/>
</launchConfiguration>
<?xml version="1.0" encoding="UTF-8" standalone="no"?><launchConfiguration type="org.eclipse.jdt.launching.localJavaApplication"><stringAttribute key="org.eclipse.jdt.launching.MAIN_TYPE" value="GradleStart"/><stringAttribute key="org.eclipse.jdt.launching.PROJECT_ATTR" value="AdditionalPipesBC"/><stringAttribute key="org.eclipse.jdt.launching.WORKING_DIRECTORY" value="C:\Users\Jamie\workspace\AdditionalPipesBC\eclipse\assets"/><stringAttribute key="org.eclipse.jdt.launching.VM_ARGUMENTS" value=" -DFORGE_FORCE_FRAME_RECALC=true"/></launchConfiguration>
4 changes: 2 additions & 2 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,14 @@ group= "com.buildcraft.additionalpipes" // http://maven.apache.org/guides/mini/g
archivesBaseName = "additionalpipes"

minecraft {
version = "1.8.9-11.15.1.1722"
version = "1.8.9-11.15.1.1764"
runDir = "eclipse/assets"
mappings = "stable_20"

}

dependencies {
compile files('lib/buildcraft-7.2.0-pre12.jar')
deobf files('lib/buildcraft-7.2.0-dev.jar')
}

sourceSets {
Expand Down
1 change: 1 addition & 0 deletions lib/.gradle/2.4/taskArtifacts/cache.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
#Mon Mar 14 07:29:46 PDT 2016
Binary file added lib/.gradle/2.4/taskArtifacts/cache.properties.lock
Binary file not shown.
Binary file added lib/.gradle/2.4/taskArtifacts/fileSnapshots.bin
Binary file not shown.
Binary file added lib/.gradle/2.4/taskArtifacts/taskArtifacts.bin
Binary file not shown.
Binary file removed lib/buildcraft-7.2.0-alpha-11-src.zip
Binary file not shown.
Binary file added lib/buildcraft-7.2.0-dev.jar
Binary file not shown.
Binary file added lib/buildcraft-7.2.0-sources.jar
Binary file not shown.
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,8 @@ public interface ITeleportPipe
public boolean canSend();

public UUID getOwnerUUID();


public String getOwnerName();

public TileGenericPipe getContainer();
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,16 @@
import net.minecraft.inventory.IInventory;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;

import org.lwjgl.opengl.GL11;

import buildcraft.additionalpipes.network.PacketHandler;
import buildcraft.additionalpipes.network.message.MessageTelePipeUpdate;
import buildcraft.additionalpipes.pipes.PipeTeleport;
import buildcraft.additionalpipes.textures.Textures;
import buildcraft.core.client.CoreIconProvider;
import buildcraft.core.lib.gui.GuiBuildCraft;
import buildcraft.core.lib.gui.Ledger;

@SideOnly(Side.CLIENT)
public class GuiTeleportPipe extends GuiBuildCraft {
Expand All @@ -24,6 +28,7 @@ protected class TeleportPipeLedger extends Ledger {
String networkTitle;

public TeleportPipeLedger() {
super(GuiTeleportPipe.this);
maxHeight = 99;
overlayColor = 0xd46c1f;
}
Expand Down Expand Up @@ -175,8 +180,9 @@ protected void initLedgers(IInventory inventory) {
protected void drawGuiContainerBackgroundLayer(float partialTicks,
int mouseX, int mouseY)
{
// do nothing
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
mc.renderEngine.bindTexture(texture);
drawTexturedModalRect(guiLeft, guiTop, 0, 0, xSize, ySize);
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ public IMessage onMessage(MessagePriorityPipe message, MessageContext ctx)
{

World world = ctx.getServerHandler().playerEntity.worldObj;
TileEntity te = world.getTileEntity(position);
TileEntity te = world.getTileEntity(message.position);
if(te instanceof TileGenericPipe)
{
PipeItemsPriorityInsertion pipe = (PipeItemsPriorityInsertion) ((TileGenericPipe) te).pipe;
Expand Down
20 changes: 20 additions & 0 deletions src/main/java/buildcraft/additionalpipes/pipes/APPipe.java
Original file line number Diff line number Diff line change
@@ -1,10 +1,16 @@
package buildcraft.additionalpipes.pipes;

import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.Vec3;
import buildcraft.additionalpipes.textures.Textures;
import buildcraft.api.core.IIconProvider;
import buildcraft.core.lib.utils.Utils;
import buildcraft.transport.Pipe;
import buildcraft.transport.PipeTransport;
import buildcraft.transport.PipeTransportItems;
import buildcraft.transport.TravelingItem;

public abstract class APPipe<pipeType extends PipeTransport> extends Pipe<pipeType>
{
Expand All @@ -17,4 +23,18 @@ public IIconProvider getIconProvider()
{
return Textures.pipeIconProvider;
}

/**
* Inject an item into the pipe. Don't call this if the pipe isn't an item pipe!
*
* @param toInject the ItemStack to inject
* @param fromSide the side that the item should come from.
*/
protected void injectItem(ItemStack toInject, EnumFacing fromSide)
{
Vec3 entPos = Utils.convertMiddle(container.getPos().offset(fromSide)).add(Utils.convert(fromSide, -0.6));

TravelingItem entity = TravelingItem.make(entPos, toInject);
((PipeTransportItems) transport).injectItem(entity, fromSide.getOpposite());
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,8 @@ public void eventHandler(PipeEventItem.FindDest event)

if(InventoryUtils.containsItem(true, false, event.item.getItemStack(), inventory))
{
ITransactor transactor = Transactor.getTransactorFor(entity);
if (transactor.add(event.item.getItemStack(), orientation.getOpposite(), false).stackSize > 0)
ITransactor transactor = Transactor.getTransactorFor(entity, orientation.getOpposite());
if (transactor.add(event.item.getItemStack(), false).stackSize > 0)
{
newOris.add(orientation);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,8 @@ public void eventHandler(PipeEventItem.FindDest event)
{
// continue;
}
ITransactor transactor = Transactor.getTransactorFor(entity);
if (transactor.add(event.item.getItemStack(), orientation.getOpposite(), false).stackSize > 0)
ITransactor transactor = Transactor.getTransactorFor(entity, orientation.getOpposite());
if (transactor.add(event.item.getItemStack(), false).stackSize > 0)
{
newOris.add(orientation);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,16 +17,13 @@
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.MathHelper;
import net.minecraft.util.Vec3;
import buildcraft.additionalpipes.APConfiguration;
import buildcraft.additionalpipes.AdditionalPipes;
import buildcraft.additionalpipes.gui.GuiHandler;
import buildcraft.api.tools.IToolWrench;
import buildcraft.core.lib.RFBattery;
import buildcraft.core.lib.inventory.InvUtils;
import buildcraft.core.lib.utils.Utils;
import buildcraft.transport.PipeTransportItems;
import buildcraft.transport.TravelingItem;
import cofh.api.energy.IEnergyHandler;

public class PipeItemsAdvancedWood extends APPipe<PipeTransportAdvancedWood> implements IEnergyHandler
Expand Down Expand Up @@ -91,10 +88,7 @@ public void updateEntity()
return;
}

Vec3 entPos = Utils.convertMiddle(tile.getPos()).add(Utils.convert(side, -0.6));

TravelingItem entity = TravelingItem.make(entPos, extracted);
((PipeTransportItems) transport).injectItem(entity, side);
injectItem(extracted, side);
}

battery.setEnergy(0);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,8 @@ public void dropContents() {

public void eventHandler(PipeEventItem.DropItem event)
{
Transactor transactor = new TransactorSimple(this);
transactor.add(event.item.getItemStack().copy(), event.direction, true);
Transactor transactor = new TransactorSimple(this, event.direction);
transactor.add(event.item.getItemStack().copy(), true);
if(inventory[inventory.length - 1] != null)
{
for(int i = 1; i < inventory.length; i++)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,11 @@
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.Vec3;
import net.minecraft.world.World;
import buildcraft.additionalpipes.APConfiguration;
import buildcraft.core.lib.inventory.InvUtils;
import buildcraft.core.lib.utils.Utils;
import buildcraft.transport.PipeTransportItems;
import buildcraft.transport.TravelingItem;

public class PipeItemsGravityFeed extends APPipe<PipeTransportItems>
{
Expand Down Expand Up @@ -58,11 +56,7 @@ public void updateEntity()
return;
}

Vec3 entityPos = new Vec3(container.getPos());
entityPos.subtract(0, .5, 0);

TravelingItem entity = TravelingItem.make(entityPos, extracted);
((PipeTransportItems) transport).injectItem(entity, EnumFacing.DOWN);
injectItem(extracted, EnumFacing.UP);
}

}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,8 +73,8 @@ public void eventHandler(PipeEventItem.FindDest event)
TileEntity entity = container.getTile(side);
if (entity instanceof IInventory)
{
ITransactor transactor = Transactor.getTransactorFor(entity);
if (transactor.add(event.item.getItemStack(), side.getOpposite(), false).stackSize > 0)
ITransactor transactor = Transactor.getTransactorFor(entity, side.getOpposite());
if (transactor.add(event.item.getItemStack(), true).stackSize > 0)
{
result.add(side);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,10 @@

import net.minecraft.item.Item;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.Vec3;
import buildcraft.additionalpipes.api.PipeType;
import buildcraft.additionalpipes.utils.Log;
import buildcraft.transport.PipeTransportItems;
import buildcraft.transport.TravelingItem;
import buildcraft.transport.pipes.events.PipeEventItem;
import buildcraft.transport.utils.TransportUtils;

public class PipeItemsTeleport extends PipeTeleport<PipeTransportItems> {
private static final int ICON = 0;
Expand Down Expand Up @@ -90,15 +87,12 @@ public void eventHandler(PipeEventItem.Entered event)
{
return;
}

Vec3 insertPoint = new Vec3(otherPipe.getPosition());
insertPoint.addVector(.5, TransportUtils.getPipeFloorOf(event.item.getItemStack()), .5);

//can no longer set position of TravelingItems as of BC 7.2, so we have to make a new one

EnumFacing newOrientation = otherPipe.getOpenOrientation().getOpposite();
((PipeTransportItems)otherPipe.transport).injectItem(TravelingItem.make(insertPoint, event.item.getItemStack()), newOrientation);

otherPipe.injectItem(event.item.getItemStack(), newOrientation);

Log.debug(event.item + " from " + getPosition() + " to " + otherPipe.getPosition() + ": " + newOrientation.getName2());
event.cancelled = true;
Expand Down
36 changes: 25 additions & 11 deletions src/main/java/buildcraft/additionalpipes/pipes/PipeTeleport.java
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.BlockPos;
import net.minecraft.util.ChatComponentText;
import net.minecraft.util.EnumFacing;
import buildcraft.additionalpipes.APConfiguration;
import buildcraft.additionalpipes.AdditionalPipes;
Expand Down Expand Up @@ -70,16 +71,19 @@ public PipeTeleport(pipeType transport, Item item, PipeType type)
}
}

@Override
public byte getState()
{
return state;
}

@Override
public void setState(byte state)
{
this.state = state;
}

@Override
public UUID getOwnerUUID()
{
return ownerUUID;
Expand All @@ -90,6 +94,7 @@ public void setOwnerUUID(UUID ownerUUID)
this.ownerUUID = ownerUUID;
}

@Override
public String getOwnerName()
{
return ownerName;
Expand All @@ -100,16 +105,19 @@ public void setOwnerName(String ownerName)
this.ownerName = ownerName;
}

@Override
public boolean isPublic()
{
return isPublic;
}

@Override
public void setPublic(boolean isPublic)
{
this.isPublic = isPublic;
}


@Override
public PipeType getType()
{
return type;
Expand All @@ -136,26 +144,32 @@ public void onChunkUnload() {
@Override
public boolean blockActivated(EntityPlayer player, EnumFacing direction) {
if(player.worldObj.isRemote)
{
return true;
}

if(ownerUUID == null)
{
// getUUIDFromProfile()
ownerUUID = PlayerUtils.getUUID(player);
ownerName = player.getName();
}

//test for player name change
if(PlayerUtils.getUUID(player).equals(ownerUUID))
if(!isPublic)
{
if(!player.getName().equals(ownerName))
//test for player name change
if(PlayerUtils.getUUID(player).equals(ownerUUID))
{
ownerName = player.getName();
if(!player.getName().equals(ownerName))
{
ownerName = player.getName();
}
}
else
{
//access denied
player.addChatMessage(new ChatComponentText("Access denied! This pipe belongs to " + ownerName));
return false;
}
}
else
{
//access denied
return false;
}

if(APConfiguration.filterRightclicks)
Expand Down

0 comments on commit d6d8e23

Please sign in to comment.