Skip to content

Commit

Permalink
Removing some state params, issue #231.
Browse files Browse the repository at this point in the history
  • Loading branch information
AfterLifeLochie committed Aug 17, 2014
1 parent bcf2118 commit d7bdff7
Show file tree
Hide file tree
Showing 2 changed files with 49 additions and 35 deletions.
3 changes: 3 additions & 0 deletions src/main/java/pcl/lc/api/EnumStargateState.java
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,13 @@
*/
public enum EnumStargateState {
/** Stargate is idle. */
@Deprecated
Idle,
/** Stargate is dialling to a chevron. */
@Deprecated
Dialling,
/** Stargate has paused after dialling a chevron. */
@Deprecated
InterDialling,
/** Stargate is waiting for the connection to establish (visual only). */
PendingTransient,
Expand Down
81 changes: 46 additions & 35 deletions src/main/java/pcl/lc/module/stargate/tile/TileStargateBase.java
Original file line number Diff line number Diff line change
Expand Up @@ -156,14 +156,56 @@ public String getDeathMessage(EntityPlayer player) {
}
}

/**
* Stargate inventory stub.
*
* @author AfterLifeLochie
*/
private static class StargateInventoryStub extends FilteredInventory {
public StargateInventoryStub() {
super(1);
setFilterRule(0, new FilterRule(new ItemStack[] { new ItemStack(ModuleStargates.Items.iris, 1) }, null,
true, false));
}

@Override
public String getInventoryName() {
return "stargate";
}

@Override
public int[] getAccessibleSlotsFromSide(int var1) {
return new int[] { 0 };
}

@Override
public boolean canInsertItem(int i, ItemStack itemstack, int j) {
if (0 > i || i > items.length)
return false;
return items[i] == null || ItemStack.areItemStacksEqual(items[i], itemstack);
}

@Override
public boolean canExtractItem(int i, ItemStack itemstack, int j) {
if (0 > i || i > items.length)
return false;
return true;
}

@Override
public boolean hasCustomInventoryName() {
return false;
}
}

public final static Random random = new Random();
public final static TransientDamageSource transientDamage = new TransientDamageSource();
public final static IrisDamageSource irisDamage = new IrisDamageSource();

public static int secondsToStayOpen = 5 * 60;
public static int ticksToStayOpen = 20 * secondsToStayOpen;
public static boolean oneWayTravel = true;
public static boolean closeFromEitherEnd = true;
public static int ticksToStayOpen;

public static void configure(ModuleConfig cfg) {
secondsToStayOpen = Integer.parseInt(ConfigHelper.getOrSetParam(cfg, "Option", "secondsToStayOpen", "time",
Expand All @@ -188,40 +230,7 @@ public static void configure(ModuleConfig cfg) {
private double ehGrid[][][];

public TileStargateBase() {
inventory = new FilteredInventory(1) {

@Override
public String getInventoryName() {
return "stargate";
}

@Override
public int[] getAccessibleSlotsFromSide(int var1) {
return new int[] { 0 };
}

@Override
public boolean canInsertItem(int i, ItemStack itemstack, int j) {
if (0 > i || i > items.length)
return false;
return items[i] == null || ItemStack.areItemStacksEqual(items[i], itemstack);
}

@Override
public boolean canExtractItem(int i, ItemStack itemstack, int j) {
if (0 > i || i > items.length)
return false;
return true;
}

@Override
public boolean hasCustomInventoryName() {
return false;
}
};

inventory.setFilterRule(0, new FilterRule(new ItemStack[] { new ItemStack(ModuleStargates.Items.iris, 1) },
null, true, false));
inventory = new StargateInventoryStub();
getAsStructure().invalidate();
}

Expand Down Expand Up @@ -413,6 +422,7 @@ private void checkForEntitiesInPortal() {
}

@Override
@Deprecated
public boolean connect(String address) {
if (isBusy() || isConnected())
return false;
Expand All @@ -436,6 +446,7 @@ public boolean connect(String address) {
}
}

@Deprecated
public void connectOrDisconnect(String address) {
if (connection == null || connection.state.get() == EnumStargateState.Idle)
connect(address);
Expand Down

0 comments on commit d7bdff7

Please sign in to comment.