Skip to content

Commit

Permalink
Update to more recent forge, and make the first slot in the rift be a…
Browse files Browse the repository at this point in the history
…n always-empty slot, for quicker insertions.
  • Loading branch information
gigaherz committed Dec 13, 2016
1 parent a5aa65e commit 2f055d5
Show file tree
Hide file tree
Showing 7 changed files with 67 additions and 17 deletions.
16 changes: 7 additions & 9 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -33,15 +33,15 @@ repositories {

apply plugin: 'net.minecraftforge.gradle.forge'

version = "2.0.1"
version = "2.0.2"
group= "gigaherz.enderRift"
archivesBaseName = "EnderRift-1.11.0"

minecraft {
version = "1.11-13.19.0.2153"
version = "1.11-13.19.1.2189"
runDir = "run"

mappings = "snapshot_20161119"
mappings = "snapshot_20161210"

replace "@VERSION@", project.version
replaceIn "EnderRiftMod.java"
Expand Down Expand Up @@ -74,12 +74,12 @@ artifacts {
dependencies {
deobfCompile "gigaherz.commons:Commons:1.11.0-0.4.5"
deobfCompile "gigaherz.graph:GraphLib:1.3.0"
deobfCompile "gigaherz.guidebook:Guidebook:1.11.0-1.2.4"
deobfCompile "gigaherz.guidebook:Guidebook-1.11.0:1.3.0"

//deobfCompile "mcjty.theoneprobe:TheOneProbe:1.10-1.2.0-40"
//deobfCompile "net.darkhax.tesla:Tesla:1.10.2-1.2.1.49"
deobfCompile "mezz.jei:jei_1.11:4.0.1.193:api"
runtime "mezz.jei:jei_1.11:4.0.1.193"
deobfCompile "net.darkhax.tesla:Tesla:1.11-1.3.0.51"
deobfCompile "mezz.jei:jei_1.11:4.0.5.203:api"
runtime "mezz.jei:jei_1.11:4.0.5.203"
}

compileJava {
Expand Down Expand Up @@ -107,5 +107,3 @@ processResources
exclude 'mcmod.info'
}
}

idea { module.inheritOutputDirs = true }
Original file line number Diff line number Diff line change
Expand Up @@ -89,4 +89,19 @@ public ItemStack extractItem(int index, int amount, boolean simulate)
return ItemStack.EMPTY;
}

@Override
public int getSlotLimit(int index)
{
for (IItemHandler inv : aggregated)
{
int size = inv.getSlots();
if (index < size)
{
return inv.getSlotLimit(index);
}

index -= size;
}
return 0;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -677,6 +677,12 @@ public ItemStack extractItem(int slot, int amount, boolean simulate)
return ItemStack.EMPTY;
}

@Override
public int getSlotLimit(int slot)
{
return 64;
}

@Override
public void setStackInSlot(int slot, ItemStack stack)
{
Expand Down Expand Up @@ -791,6 +797,12 @@ public ItemStack extractItem(int slot, int amount, boolean simulate)
return ItemStack.EMPTY;
}

@Override
public int getSlotLimit(int slot)
{
return 64;
}

@Override
public void setStackInSlot(int slot, ItemStack stack)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -281,6 +281,12 @@ public ItemStack extractItem(int slot, int amount, boolean simulate)
return ItemStack.EMPTY;
}

@Override
public int getSlotLimit(int slot)
{
return 1;
}

@Override
public void setStackInSlot(int index, ItemStack stack)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -132,4 +132,10 @@ public ItemStack extractItem(int slot, int wanted, boolean simulate)

return extracted;
}

@Override
public int getSlotLimit(int slot)
{
return 64;
}
}
9 changes: 7 additions & 2 deletions src/main/java/gigaherz/enderRift/rift/TileEnderRift.java
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package gigaherz.enderRift.rift;

import gigaherz.enderRift.EnderRiftMod;
import gigaherz.enderRift.automation.TileAggregator;
import gigaherz.enderRift.common.EnergyBuffer;
import gigaherz.enderRift.rift.storage.RiftInventory;
import gigaherz.enderRift.rift.storage.RiftStorageWorldData;
Expand All @@ -22,7 +21,6 @@
import net.minecraftforge.items.IItemHandler;

import javax.annotation.Nullable;
import java.util.List;
import java.util.Random;

public class TileEnderRift
Expand Down Expand Up @@ -285,6 +283,7 @@ public int getSlots()
IItemHandler handler = getInventory();
if (handler == null)
return 0;

return handler.getSlots();
}

Expand Down Expand Up @@ -320,5 +319,11 @@ public ItemStack extractItem(int slot, int amount, boolean simulate)
return ItemStack.EMPTY;
return handler.extractItem(slot, amount, simulate);
}

@Override
public int getSlotLimit(int slot)
{
return 64;
}
}
}
20 changes: 14 additions & 6 deletions src/main/java/gigaherz/enderRift/rift/storage/RiftInventory.java
Original file line number Diff line number Diff line change
Expand Up @@ -93,28 +93,28 @@ public void writeToNBT(NBTTagCompound nbtTagCompound)
@Override
public int getSlots()
{
return inventorySlots.size() + 1;
return inventorySlots.size() + 2;
}

@Override
public ItemStack getStackInSlot(int index)
{
if (index >= inventorySlots.size())
if (index <= 0 || (index-1) >= inventorySlots.size())
return ItemStack.EMPTY;
return inventorySlots.get(index);
return inventorySlots.get(index - 1);
}

@Override
public ItemStack insertItem(int index, ItemStack stack, boolean simulate)
{
if (index >= inventorySlots.size())
if (index <= 0 || (index-1) >= inventorySlots.size())
{
inventorySlots.add(stack.copy());
return ItemStack.EMPTY;
}

ItemStack remaining = stack.copy();
ItemStack slot = inventorySlots.get(index);
ItemStack slot = inventorySlots.get(index - 1);
if (slot != null)
{
int max = Math.min(remaining.getMaxStackSize(), 64);
Expand All @@ -136,11 +136,13 @@ public ItemStack insertItem(int index, ItemStack stack, boolean simulate)
@Override
public ItemStack extractItem(int index, int wanted, boolean simulate)
{
if (index >= inventorySlots.size())
if (index <= 0 || (index-1) >= inventorySlots.size())
{
return ItemStack.EMPTY;
}

index--;

ItemStack slot = inventorySlots.get(index);
if (slot == null)
return ItemStack.EMPTY;
Expand Down Expand Up @@ -169,4 +171,10 @@ public ItemStack extractItem(int index, int wanted, boolean simulate)
_extracted.setCount(extractedCount);
return _extracted;
}

@Override
public int getSlotLimit(int slot)
{
return 64;
}
}

0 comments on commit 2f055d5

Please sign in to comment.