mirror of
https://github.com/GTNewHorizons/Binnie.git
synced 2026-11-22 05:02:34 +00:00
port to forestry 4.2
This commit is contained in:
1 parent
dbc5c1a564
commit
f969f63b66
3697 files changed
+78372
No files matched your search
@@ -0,0 +1,131 @@
|
||||
//
|
||||
// Decompiled by Procyon v0.5.30
|
||||
//
|
||||
|
||||
package binnie.core.util;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.Iterator;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import net.minecraftforge.fluids.FluidStack;
|
||||
import java.util.Set;
|
||||
|
||||
class FluidStackSet implements Set<FluidStack>
|
||||
{
|
||||
List<FluidStack> itemStacks;
|
||||
|
||||
FluidStackSet() {
|
||||
this.itemStacks = new ArrayList<FluidStack>();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return this.itemStacks.toString();
|
||||
}
|
||||
|
||||
protected FluidStack getExisting(final FluidStack stack) {
|
||||
for (final FluidStack stack2 : this.itemStacks) {
|
||||
if (stack2.isFluidEqual(stack)) {
|
||||
return stack2;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean add(final FluidStack e) {
|
||||
if (e != null) {
|
||||
if (this.getExisting(e) == null) {
|
||||
return this.itemStacks.add(e.copy());
|
||||
}
|
||||
final FluidStack existing = this.getExisting(e);
|
||||
existing.amount += e.amount;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean addAll(final Collection<? extends FluidStack> c) {
|
||||
boolean addedAll = true;
|
||||
for (final FluidStack stack : c) {
|
||||
addedAll = (this.add(stack) && addedAll);
|
||||
}
|
||||
return addedAll;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void clear() {
|
||||
this.itemStacks.clear();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean contains(final Object o) {
|
||||
return o instanceof FluidStack && this.getExisting((FluidStack) o) != null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean containsAll(final Collection<?> c) {
|
||||
boolean addedAll = true;
|
||||
for (final Object o : c) {
|
||||
addedAll = (addedAll && this.contains(o));
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isEmpty() {
|
||||
return this.itemStacks.isEmpty();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Iterator<FluidStack> iterator() {
|
||||
return this.itemStacks.iterator();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean remove(final Object o) {
|
||||
if (this.contains(o)) {
|
||||
final FluidStack r = (FluidStack) o;
|
||||
final FluidStack existing = this.getExisting(r);
|
||||
if (existing.amount > r.amount) {
|
||||
final FluidStack fluidStack = existing;
|
||||
fluidStack.amount -= r.amount;
|
||||
}
|
||||
else {
|
||||
this.itemStacks.remove(existing);
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean removeAll(final Collection<?> c) {
|
||||
boolean addedAll = true;
|
||||
for (final Object o : c) {
|
||||
final boolean removed = this.remove(o);
|
||||
addedAll = (removed && addedAll);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean retainAll(final Collection<?> c) {
|
||||
return this.itemStacks.retainAll(c);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int size() {
|
||||
return this.itemStacks.size();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object[] toArray() {
|
||||
return this.itemStacks.toArray();
|
||||
}
|
||||
|
||||
@Override
|
||||
public <T> T[] toArray(final T[] a) {
|
||||
return this.itemStacks.toArray(a);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
//
|
||||
// Decompiled by Procyon v0.5.30
|
||||
//
|
||||
|
||||
package binnie.core.util;
|
||||
|
||||
public interface IValidator<T>
|
||||
{
|
||||
boolean isValid(final T p0);
|
||||
}
|
||||
@@ -0,0 +1,131 @@
|
||||
//
|
||||
// Decompiled by Procyon v0.5.30
|
||||
//
|
||||
|
||||
package binnie.core.util;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.Iterator;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import java.util.Set;
|
||||
|
||||
public class ItemStackSet implements Set<ItemStack>
|
||||
{
|
||||
List<ItemStack> itemStacks;
|
||||
|
||||
public ItemStackSet() {
|
||||
this.itemStacks = new ArrayList<ItemStack>();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return this.itemStacks.toString();
|
||||
}
|
||||
|
||||
protected ItemStack getExisting(final ItemStack stack) {
|
||||
for (final ItemStack stack2 : this.itemStacks) {
|
||||
if (stack2.isItemEqual(stack)) {
|
||||
return stack2;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean add(final ItemStack e) {
|
||||
if (e != null) {
|
||||
if (this.getExisting(e) == null) {
|
||||
return this.itemStacks.add(e.copy());
|
||||
}
|
||||
final ItemStack existing = this.getExisting(e);
|
||||
existing.stackSize += e.stackSize;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean addAll(final Collection<? extends ItemStack> c) {
|
||||
boolean addedAll = true;
|
||||
for (final ItemStack stack : c) {
|
||||
addedAll = (this.add(stack) && addedAll);
|
||||
}
|
||||
return addedAll;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void clear() {
|
||||
this.itemStacks.clear();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean contains(final Object o) {
|
||||
return o instanceof ItemStack && this.getExisting((ItemStack) o) != null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean containsAll(final Collection<?> c) {
|
||||
boolean addedAll = true;
|
||||
for (final Object o : c) {
|
||||
addedAll = (addedAll && this.contains(o));
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isEmpty() {
|
||||
return this.itemStacks.isEmpty();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Iterator<ItemStack> iterator() {
|
||||
return this.itemStacks.iterator();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean remove(final Object o) {
|
||||
if (this.contains(o)) {
|
||||
final ItemStack r = (ItemStack) o;
|
||||
final ItemStack existing = this.getExisting(r);
|
||||
if (existing.stackSize > r.stackSize) {
|
||||
final ItemStack itemStack = existing;
|
||||
itemStack.stackSize -= r.stackSize;
|
||||
}
|
||||
else {
|
||||
this.itemStacks.remove(existing);
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean removeAll(final Collection<?> c) {
|
||||
boolean addedAll = true;
|
||||
for (final Object o : c) {
|
||||
final boolean removed = this.remove(o);
|
||||
addedAll = (removed && addedAll);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean retainAll(final Collection<?> c) {
|
||||
return this.itemStacks.retainAll(c);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int size() {
|
||||
return this.itemStacks.size();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object[] toArray() {
|
||||
return this.itemStacks.toArray();
|
||||
}
|
||||
|
||||
@Override
|
||||
public <T> T[] toArray(final T[] a) {
|
||||
return this.itemStacks.toArray(a);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
//
|
||||
// Decompiled by Procyon v0.5.30
|
||||
//
|
||||
|
||||
package binnie.core.util;
|
||||
|
||||
import net.minecraftforge.fluids.FluidStack;
|
||||
|
||||
public class UniqueFluidStackSet extends FluidStackSet
|
||||
{
|
||||
@Override
|
||||
public boolean add(final FluidStack e) {
|
||||
return e != null && this.getExisting(e) == null && this.itemStacks.add(e.copy());
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean remove(final Object o) {
|
||||
if (this.contains(o)) {
|
||||
final FluidStack r = (FluidStack) o;
|
||||
final FluidStack existing = this.getExisting(r);
|
||||
this.itemStacks.remove(existing);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
//
|
||||
// Decompiled by Procyon v0.5.30
|
||||
//
|
||||
|
||||
package binnie.core.util;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
public class UniqueItemStackSet extends ItemStackSet
|
||||
{
|
||||
@Override
|
||||
public boolean add(final ItemStack e) {
|
||||
return e != null && this.getExisting(e) == null && this.itemStacks.add(e.copy());
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean remove(final Object o) {
|
||||
if (this.contains(o)) {
|
||||
final ItemStack r = (ItemStack) o;
|
||||
final ItemStack existing = this.getExisting(r);
|
||||
this.itemStacks.remove(existing);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user