Skip to content
Open
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ Compiled binaries can be found in `build/libs`.

### Setting Up Eclipse ###
1. Install Eclipse JDK.
2. If your PC uses Java newer than 8 by default, update your `JAVA_HOME` environment variable to point to JDK 8.
2. Run the command `gradlew setupDecompWorkspace --refresh-dependencies eclipse`
3. In Eclipse, go to `File > Import... > General > Existing Projects into Workspace`
4. Hit Next. Click Browse... in the top right, and select the directory you cloned Additional Pipes into. Check the box next to AdditionalPipesBC in the Projects list.
Expand Down
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ buildscript {
}
apply plugin: 'net.minecraftforge.gradle.forge'

version = "6.0.0.8"
version = "6.0.1"
group= "com.buildcraft.additionalpipes"
archivesBaseName = "additionalpipes"

Expand Down
3 changes: 2 additions & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
org.gradle.jvmargs=-Xmx4096M
mc_version=1.12.2
jei_version=4.8.5.142
jei_version=4.8.5.142
net.minecraftforge.gradle.disableUpdateChecker=true
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,8 @@ public ActionResult<ItemStack> onItemRightClick(World world, EntityPlayer player
{
//this code adapted from EntityAIHurtByTarget.startExecuting()
double horizontalRange = 16;
List<EntityWolf> list = world.getEntitiesWithinAABB(EntityWolf.class, new AxisAlignedBB(player.posX, player.posY, player.posZ,
player.posX + 1.0D, player.posY + 1.0D, player.posZ + 1.0D).grow(horizontalRange, 10.0D, horizontalRange));
List<EntityWolf> list = world.getEntitiesWithinAABB(EntityWolf.class, new AxisAlignedBB(player.posX, player.posY + 1.0D, player.posZ,
Copy link
Collaborator Author

@multiplemonomials multiplemonomials Oct 16, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Randomly noticed that this logic is slightly broken. If we want to create the bounding box centered on the player, then it should be initially created with size of 0 and centered on the player's coordinates.

player.posX, player.posY + 1.0D, player.posZ).grow(horizontalRange, 10.0D, horizontalRange));
Iterator<EntityWolf> iterator = list.iterator();
int wolfCounter = 0;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,25 @@ public int getTextureIndex(EnumFacing connection)
return connection.ordinal();
}

/**
* @brief Event handler for the SideCheck event, which is called before the Split event.
*/
@PipeEventHandler
public void sideCheck(PipeEventItem.SideCheck sideCheckEvent)
{
// Disallow all sides that have a distData value of 0 (all items disallowed).
// This is important to do so that if all distData values for connected sides are 0, we will just drop the item as it has nowhere to go.
// Note that we could also "bounce" the item back out of the distribution pipe by handling the TryBounce event, but dropping them
// seems simpler for now.
for(int o = 0; o < distData.length; ++o)
{
if(distData[o] == 0)
{
sideCheckEvent.disallow(EnumFacing.VALUES[o]);
}
}
}

@PipeEventHandler
public void splitStacks(PipeEventItem.Split splitEvent)
{
Expand Down Expand Up @@ -96,7 +115,13 @@ public void splitStacks(PipeEventItem.Split splitEvent)
{
if(getItemsLeftThisSide() <= 0)
{
toNextOpenSide();
if(!toNextOpenSide())
{
Log.error("Failed to distribute itemstack. Allowing it to be routed randomly.");
entry.to.clear();
newDistribution.add(entry);
break;
}
}

ItemEntry stackPartThisSide = new ItemEntry(null, entry.stack.copy(), entry.from);
Expand All @@ -116,13 +141,14 @@ public void splitStacks(PipeEventItem.Split splitEvent)
splitEvent.items.clear();
splitEvent.items.addAll(newDistribution);
}



/**
* Moves the pipe to the next open side.
*
* @return true if there is another open side that can accept an item stack, false otherwise.
*/
private void toNextOpenSide()
private boolean toNextOpenSide()
{
EnumFacing lastDistSide = distSide;

Expand All @@ -133,9 +159,11 @@ private void toNextOpenSide()
if(distData[distSide.ordinal()] > 0 && pipe.isConnected(distSide))
{
Log.debug("toNextOpenSide(): distSide changed: " + lastDistSide + "-> " + distSide);
return;
return true;
}
}

return false;
}

/**
Expand Down