Skip to content

Commit

Permalink
More work on ShapeGen. Disable terraformer wands for release. Fix #37.…
Browse files Browse the repository at this point in the history
… Rewrite ender inventory to be more reliable in saving and otherwise being there. Backwards compatible so no worries.
  • Loading branch information
da3dsoul committed Nov 7, 2015
1 parent 1420250 commit dc6e19c
Show file tree
Hide file tree
Showing 9 changed files with 2,828 additions and 1,361 deletions.
828 changes: 409 additions & 419 deletions src/main/java/abo/ABO.java

Large diffs are not rendered by default.

86 changes: 64 additions & 22 deletions src/main/java/abo/pipes/power/PipePowerDirected.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
package abo.pipes.power;

import buildcraft.BuildCraftTransport;
import buildcraft.api.statements.IActionInternal;
import buildcraft.api.statements.StatementSlot;
import buildcraft.transport.statements.ActionPipeDirection;
import cofh.api.energy.IEnergyConnection;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.Item;
Expand All @@ -15,6 +19,10 @@
import buildcraft.transport.pipes.PipePowerWood;
import buildcraft.transport.pipes.PipeStructureCobblestone;

import java.util.Collection;
import java.util.Iterator;
import java.util.LinkedList;

public class PipePowerDirected extends ABOPipe<PipeTransportPower> implements IPipeTransportPowerHook {

private final int baseTexture = PipeIcons.PipePowerIron.ordinal();
Expand Down Expand Up @@ -81,26 +89,60 @@ public int getIconIndex(ForgeDirection direction) {
}
}

@Override
public int receiveEnergy(ForgeDirection from, int val) {
int metadata = container.getBlockMetadata();

if (metadata != from.ordinal() && val > 0.0) {
transport.internalNextPower[from.ordinal()] += val;

if (transport.internalNextPower[from.ordinal()] > transport.maxPower) {
val = (int) transport.internalNextPower[from.ordinal()] - transport.maxPower;
transport.internalNextPower[from.ordinal()] = transport.maxPower;
}
}
return val;
}

@Override
public int requestEnergy(ForgeDirection from, int amount) {
int metadata = container.getBlockMetadata();

if (metadata == from.ordinal()) { return amount; }
return 0;
}
@Override
public boolean outputOpen(ForgeDirection to) {
return container.getBlockMetadata() == to.ordinal();
}

protected void actionsActivated(Collection<StatementSlot> actions) {
super.actionsActivated(actions);
Iterator var2 = actions.iterator();

while(var2.hasNext()) {
StatementSlot action = (StatementSlot)var2.next();
if(action.statement instanceof ActionPipeDirection) {
this.logic.setFacing(((ActionPipeDirection)action.statement).direction);
break;
}
}

}

public LinkedList<IActionInternal> getActions() {
LinkedList action = super.getActions();
ForgeDirection[] var2 = ForgeDirection.VALID_DIRECTIONS;
int var3 = var2.length;

for(int var4 = 0; var4 < var3; ++var4) {
ForgeDirection direction = var2[var4];
if(this.container.isPipeConnected(direction)) {
action.add(BuildCraftTransport.actionPipeDirection[direction.ordinal()]);
}
}

return action;
}

@Override
public int receiveEnergy(ForgeDirection from, int val) {
int metadata = container.getBlockMetadata();

if (metadata != from.ordinal() && val > 0.0) {
transport.internalNextPower[from.ordinal()] += val;

if (transport.internalNextPower[from.ordinal()] > transport.maxPower) {
val = (int) transport.internalNextPower[from.ordinal()] - transport.maxPower;
transport.internalNextPower[from.ordinal()] = transport.maxPower;
}
}
return val;
}

@Override
public int requestEnergy(ForgeDirection from, int amount) {
int metadata = container.getBlockMetadata();

if (metadata == from.ordinal()) { return amount; }
return 0;
}
}
26 changes: 26 additions & 0 deletions src/main/java/da3dsoul/ShapeGen/RunnableGenerator.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
package da3dsoul.ShapeGen;

/**
* Created by Tom on 11/7/2015.
*/
public abstract class RunnableGenerator implements Runnable {

protected final int X;
protected final int Y;
protected final int Z;

public RunnableGenerator(int x, int y, int z) {
X = x;
Y = y;
Z = z;
}

public void run() {
synchronized (this) {
generate();
notify();
}
}

public abstract void generate();
}
Loading

0 comments on commit dc6e19c

Please sign in to comment.