MCPcopy Create free account
hub / github.com/GregTech6/gregtech6 / GarbageGT

Class GarbageGT

src/main/java/gregapi/data/CS.java:1368–1502  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1366 public static final HashSetNoNulls<Block> REDSTONE_SINKS = new HashSetNoNulls<>(F, Blocks.tnt, Blocks.golden_rail, Blocks.noteblock, Blocks.trapdoor, Blocks.wooden_door, Blocks.iron_door, Blocks.piston, Blocks.sticky_piston, Blocks.dispenser, Blocks.dropper, Blocks.redstone_lamp, Blocks.lit_redstone_lamp);
1367
1368 public static class GarbageGT {
1369 public static ItemStackSet<ItemStackContainer> BLACKLIST = ST.hashset();
1370 public static ItemStackMap<ItemStackContainer, ItemStack> GARBAGE_MAP_ITEMS = new ItemStackMap<>();
1371 public static ArrayListNoNulls<ItemStack> GARBAGE_ITEMS = new ArrayListNoNulls<>();
1372 public static ArrayListNoNulls<FluidTankGT> GARBAGE_FLUIDS = new ArrayListNoNulls<>();
1373
1374 public static int trash(ItemStack aStack) {
1375 if (ST.invalid(aStack) || aStack.stackSize <= 0 || ST.meta_(aStack) == W || BLACKLIST.contains(aStack, T)) return 0;
1376 if (aStack.hasTagCompound()) {
1377 for (ItemStack tGarbage : GARBAGE_ITEMS) if (ST.equal(aStack, tGarbage)) {
1378 tGarbage.stackSize = UT.Code.bind31((long)tGarbage.stackSize + (long)aStack.stackSize);
1379 return aStack.stackSize;
1380 }
1381 GARBAGE_ITEMS.add(aStack.copy());
1382 return aStack.stackSize;
1383 }
1384 ItemStack tGarbage = GARBAGE_MAP_ITEMS.get(aStack);
1385 if (ST.valid(tGarbage)) {
1386 tGarbage.stackSize = UT.Code.bind31((long)tGarbage.stackSize + (long)aStack.stackSize);
1387 return aStack.stackSize;
1388 }
1389 aStack = aStack.copy();
1390 GARBAGE_MAP_ITEMS.put(aStack, aStack);
1391 GARBAGE_ITEMS.add(aStack);
1392 return aStack.stackSize;
1393 }
1394 public static long trash(ItemStack[] aInventory) {
1395 if (aInventory == null) return 0;
1396 long rTrashed = 0;
1397 for (int i = 0; i < aInventory.length; i++) {rTrashed += trash(aInventory[i]); aInventory[i] = NI;}
1398 return rTrashed;
1399 }
1400 public static int trash(ItemStack[] aInventory, int aIndex) {
1401 if (aInventory == null || aIndex < 0 || aIndex >= aInventory.length) return 0;
1402 int rTrashed = trash(aInventory[aIndex]);
1403 aInventory[aIndex] = NI;
1404 return rTrashed;
1405 }
1406
1407 public static int trash(OreDictMaterialStack aMaterial) {
1408 if (aMaterial == null || aMaterial.mAmount < OP.scrapGt.mAmount) return 0;
1409 return trash(OP.scrapGt.mat(aMaterial.mMaterial, aMaterial.mAmount / OP.scrapGt.mAmount));
1410 }
1411 public static long trash(Iterable<OreDictMaterialStack> aMaterials) {
1412 if (aMaterials == null) return 0;
1413 long rTrashed = 0;
1414 Iterator<OreDictMaterialStack> tIterator = aMaterials.iterator();
1415 while (tIterator.hasNext()) {rTrashed += trash(tIterator.next()); tIterator.remove();};
1416 return rTrashed;
1417 }
1418
1419 public static long trash(FluidStack aFluid) {
1420 return aFluid == null ? 0 : trash(aFluid, aFluid.amount);
1421 }
1422 public static long trash(FluidStack aFluid, long aAmount) {
1423 if (aFluid == null || aAmount <= 0) return 0;
1424 for (FluidTankGT tGarbage : GARBAGE_FLUIDS) if (tGarbage.contains(aFluid)) {
1425 tGarbage.add(aAmount);

Callers

nothing calls this directly

Calls 1

hashsetMethod · 0.95

Tested by

no test coverage detected