Skip to content

Commit

Permalink
Fix merge behavior not respecting stackability (#20)
Browse files Browse the repository at this point in the history
* Update dependencies

* Fix merge behavior not respecting stackability

* updateBuildScript & spotlessApply
  • Loading branch information
miozune authored May 12, 2023
1 parent 3beafa4 commit e82a2bb
Show file tree
Hide file tree
Showing 38 changed files with 186 additions and 202 deletions.
233 changes: 105 additions & 128 deletions build.gradle

Large diffs are not rendered by default.

10 changes: 4 additions & 6 deletions dependencies.gradle
Original file line number Diff line number Diff line change
@@ -1,12 +1,10 @@
// Add your dependencies here

dependencies {
compileOnly('com.github.GTNewHorizons:Applied-Energistics-2-Unofficial:rv3-beta-76-GTNH:api')
compileOnly('com.github.GTNewHorizons:GT5-Unofficial:5.09.41.254:dev') {transitive=false}
compileOnly('com.github.GTNewHorizons:NotEnoughItems:2.2.6-GTNH:dev') {transitive=false}
compileOnly('com.github.GTNewHorizons:waila:1.5.18:dev') {transitive=false}
compileOnly('com.github.GTNewHorizons:Avaritia:1.30:dev') {transitive=false}

compileOnly('com.github.GTNewHorizons:Applied-Energistics-2-Unofficial:rv3-beta-211-GTNH:api') {transitive=false}
compileOnly('com.github.GTNewHorizons:GT5-Unofficial:5.09.43.29:dev') {transitive=false}
compileOnly('com.github.GTNewHorizons:NotEnoughItems:2.3.52-GTNH:dev') {transitive=false}
compileOnly('com.github.GTNewHorizons:waila:1.6.0:dev') {transitive=false}
compileOnly('thaumcraft:Thaumcraft:1.7.10-4.2.3.5:dev')
compileOnly('curse.maven:refined-relocation-75811:2262970')
compileOnly('curse.maven:minetweaker3-224029:2255759')
Expand Down
Binary file modified gradle/wrapper/gradle-wrapper.jar
Binary file not shown.
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.0.1-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.1.1-bin.zip
networkTimeout=10000
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
10 changes: 0 additions & 10 deletions repositories.gradle
Original file line number Diff line number Diff line change
@@ -1,14 +1,4 @@
// Add any additional repositories for your dependencies here

repositories {
maven {
name = "GTNH"
url = "http://jenkins.usrv.eu:8081/nexus/content/groups/public/"
}
maven {
url "https://cursemaven.com"
}
maven {
url = "https://jitpack.io"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,5 @@
package com.jaquadro.minecraft.storagedrawers.api.config;

import com.jaquadro.minecraft.storagedrawers.api.StorageDrawersApi;

import cpw.mods.fml.common.API;
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package com.jaquadro.minecraft.storagedrawers.api.event;

import com.jaquadro.minecraft.storagedrawers.api.storage.IDrawer;

import cpw.mods.fml.common.eventhandler.Event;

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,5 @@
package com.jaquadro.minecraft.storagedrawers.api.event;

import com.jaquadro.minecraft.storagedrawers.api.StorageDrawersApi;

import cpw.mods.fml.common.API;
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,5 @@
package com.jaquadro.minecraft.storagedrawers.api.inventory;

import com.jaquadro.minecraft.storagedrawers.api.StorageDrawersApi;

import cpw.mods.fml.common.API;
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,5 @@
package com.jaquadro.minecraft.storagedrawers.api.pack;

import com.jaquadro.minecraft.storagedrawers.api.StorageDrawersApi;

import cpw.mods.fml.common.API;
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,5 @@
package com.jaquadro.minecraft.storagedrawers.api.registry;

import com.jaquadro.minecraft.storagedrawers.api.StorageDrawersApi;

import cpw.mods.fml.common.API;
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,5 @@
package com.jaquadro.minecraft.storagedrawers.api.render;

import com.jaquadro.minecraft.storagedrawers.api.StorageDrawersApi;

import cpw.mods.fml.common.API;
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,5 @@
package com.jaquadro.minecraft.storagedrawers.api.storage.attribute;

import com.jaquadro.minecraft.storagedrawers.api.StorageDrawersApi;

import cpw.mods.fml.common.API;
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,5 @@
package com.jaquadro.minecraft.storagedrawers.api.storage;

import com.jaquadro.minecraft.storagedrawers.api.StorageDrawersApi;

import cpw.mods.fml.common.API;
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
import java.util.ArrayList;
import java.util.List;
import java.util.Random;
import java.util.function.Consumer;

import net.minecraft.block.*;
import net.minecraft.block.material.Material;
Expand Down Expand Up @@ -598,7 +599,13 @@ public void breakBlock(World world, int x, int y, int z, Block block, int meta)
/* Only a minimum number of ItemStack are dropped */
for (int i = 0; i < tile.getDrawerCount(); i++) {
if (!tile.isDrawerEnabled(i)) continue;
dropBigStackInWord(world, x, y, z, tile.getDrawer(i).getStoredItemCopy());

final ItemStack rawStoredItem = tile.getDrawer(i).getStoredItemPrototype();
if (rawStoredItem != null && rawStoredItem.isStackable()) {
dropBigStackInWord(world, x, y, z, tile.getDrawer(i).getStoredItemCopy());
} else {
forEachSplitStack(tile, i, stack -> dropStackInBatches(world, x, y, z, stack));
}
}
break;
case "destroy":
Expand All @@ -608,12 +615,8 @@ public void breakBlock(World world, int x, int y, int z, Block block, int meta)
if (!tile.isDrawerEnabled(i)) continue;
IDrawer drawer = tile.getDrawer(i);
if (drawer.getStoredItemCount() > maxDropNum) drawer.setStoredItemCount(maxDropNum);
while (drawer.getStoredItemCount() > 0) {
ItemStack stack = tile.takeItemsFromSlot(i, drawer.getStoredItemStackSize());
if (stack == null || stack.stackSize == 0) break;

dropStackInBatches(world, x, y, z, stack);
}
forEachSplitStack(tile, i, stack -> dropStackInBatches(world, x, y, z, stack));
}
break;
case "cluster":
Expand All @@ -625,14 +628,8 @@ public void breakBlock(World world, int x, int y, int z, Block block, int meta)
Method method = itemMatterClusterClass.getMethod("makeClusters", List.class);
/* May not be used */
for (int i = 0; i < tile.getDrawerCount(); i++) {
IDrawer drawer = tile.getDrawer(i);
List<ItemStack> stacks = new ArrayList<>();
while (drawer.getStoredItemCount() > 0) {
ItemStack stack = tile.takeItemsFromSlot(i, drawer.getStoredItemStackSize());
if (stack == null || stack.stackSize == 0) break;

stacks.add(stack);
}
forEachSplitStack(tile, i, stacks::add);

List<ItemStack> clusters = (List<ItemStack>) method
.invoke(itemMatterClusterClass, stacks);
Expand All @@ -656,15 +653,7 @@ public void breakBlock(World world, int x, int y, int z, Block block, int meta)
case "default":
default:
for (int i = 0; i < tile.getDrawerCount(); i++) {
if (!tile.isDrawerEnabled(i)) continue;

IDrawer drawer = tile.getDrawer(i);
while (drawer.getStoredItemCount() > 0) {
ItemStack stack = tile.takeItemsFromSlot(i, drawer.getStoredItemStackSize());
if (stack == null || stack.stackSize == 0) break;

dropStackInBatches(world, x, y, z, stack);
}
forEachSplitStack(tile, i, stack -> dropStackInBatches(world, x, y, z, stack));
}
}
}
Expand All @@ -675,6 +664,18 @@ public void breakBlock(World world, int x, int y, int z, Block block, int meta)
super.breakBlock(world, x, y, z, block, meta);
}

private void forEachSplitStack(TileEntityDrawers tile, int index, Consumer<ItemStack> forEachStack) {
if (!tile.isDrawerEnabled(index)) return;
IDrawer drawer = tile.getDrawer(index);

while (drawer.getStoredItemCount() > 0) {
ItemStack stack = tile.takeItemsFromSlot(index, drawer.getStoredItemStackSize());
if (stack == null || stack.stackSize == 0) break;

forEachStack.accept(stack);
}
}

private void dropStackInBatches(World world, int x, int y, int z, ItemStack stack) {
Random rand = world.rand;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
import org.apache.logging.log4j.Level;

import com.jaquadro.minecraft.storagedrawers.StorageDrawers;

import cpw.mods.fml.common.FMLLog;

public class BaseTileEntity extends TileEntity {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
import com.jaquadro.minecraft.storagedrawers.block.tile.TileEntityController;
import com.jaquadro.minecraft.storagedrawers.util.RenderHelper;
import com.jaquadro.minecraft.storagedrawers.util.RenderHelperState;

import cpw.mods.fml.client.registry.ISimpleBlockRenderingHandler;

public class ControllerRenderer implements ISimpleBlockRenderingHandler {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
import com.jaquadro.minecraft.storagedrawers.block.tile.TileEntityDrawers;
import com.jaquadro.minecraft.storagedrawers.util.RenderHelper;
import com.jaquadro.minecraft.storagedrawers.util.RenderHelperState;

import cpw.mods.fml.client.registry.ISimpleBlockRenderingHandler;

public class DrawersRenderer implements ISimpleBlockRenderingHandler {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
import com.jaquadro.minecraft.storagedrawers.client.renderer.common.CommonFramingRenderer;
import com.jaquadro.minecraft.storagedrawers.core.ClientProxy;
import com.jaquadro.minecraft.storagedrawers.util.RenderHelper;

import cpw.mods.fml.client.registry.ISimpleBlockRenderingHandler;

public class FramingTableRenderer implements ISimpleBlockRenderingHandler {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
import com.jaquadro.minecraft.storagedrawers.block.BlockTrimCustom;
import com.jaquadro.minecraft.storagedrawers.block.tile.TileEntityTrim;
import com.jaquadro.minecraft.storagedrawers.client.renderer.common.CommonTrimRenderer;

import cpw.mods.fml.client.registry.ISimpleBlockRenderingHandler;

public class TrimCustomRenderer implements ISimpleBlockRenderingHandler {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import net.minecraftforge.event.entity.player.PlayerInteractEvent;

import com.jaquadro.minecraft.storagedrawers.block.tile.TileEntityDrawers;

import cpw.mods.fml.common.eventhandler.SubscribeEvent;

public class ForgeEventHandler {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
import net.minecraft.client.gui.GuiScreen;

import com.jaquadro.minecraft.storagedrawers.config.ModConfigGui;

import cpw.mods.fml.client.IModGuiFactory;

public class ModGuiFactory implements IModGuiFactory {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

import com.jaquadro.minecraft.storagedrawers.StorageDrawers;
import com.jaquadro.minecraft.storagedrawers.item.*;

import cpw.mods.fml.common.registry.GameRegistry;

public class ModItems {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
import com.jaquadro.minecraft.storagedrawers.core.recipe.TemplateRecipe;
import com.jaquadro.minecraft.storagedrawers.integration.ChiselIntegrationModule;
import com.jaquadro.minecraft.storagedrawers.integration.GTNHIntegrationModule;

import cpw.mods.fml.common.registry.GameRegistry;

public class ModRecipes {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
import com.jaquadro.minecraft.storagedrawers.client.gui.GuiDrawers;
import com.jaquadro.minecraft.storagedrawers.client.gui.GuiFraming;
import com.jaquadro.minecraft.storagedrawers.inventory.*;

import cpw.mods.fml.common.network.IGuiHandler;

public class GuiHandler implements IGuiHandler {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,16 @@

import java.lang.reflect.Constructor;

import com.jaquadro.minecraft.storagedrawers.StorageDrawers;
import com.jaquadro.minecraft.storagedrawers.integration.ae2.*;

import appeng.api.AEApi;
import appeng.api.networking.security.BaseActionSource;
import appeng.api.recipes.IIngredient;
import appeng.api.storage.IMEInventory;
import appeng.api.storage.IMEMonitor;
import appeng.api.storage.data.IAEItemStack;

import com.jaquadro.minecraft.storagedrawers.StorageDrawers;
import com.jaquadro.minecraft.storagedrawers.integration.ae2.*;

public class AppliedEnergistics extends IntegrationModule {

private static class ReflectionFactory implements IStorageBusMonitorFactory {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import com.jaquadro.minecraft.storagedrawers.StorageDrawers;
import com.jaquadro.minecraft.storagedrawers.integration.gtnh.ModRecipes;

import cpw.mods.fml.common.Loader;

public class GTNHIntegrationModule extends IntegrationModule {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
package com.jaquadro.minecraft.storagedrawers.integration;

import minetweaker.MineTweakerAPI;

import com.jaquadro.minecraft.storagedrawers.integration.minetweaker.Compaction;
import com.jaquadro.minecraft.storagedrawers.integration.minetweaker.OreDictionaryBlacklist;
import com.jaquadro.minecraft.storagedrawers.integration.minetweaker.OreDictionaryWhitelist;

import minetweaker.MineTweakerAPI;

public class MineTweaker extends IntegrationModule {

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,6 @@

import org.lwjgl.opengl.GL11;

import thaumcraft.api.ThaumcraftApiHelper;
import thaumcraft.api.aspects.Aspect;
import thaumcraft.api.aspects.AspectList;

import com.jaquadro.minecraft.storagedrawers.api.StorageDrawersApi;
import com.jaquadro.minecraft.storagedrawers.api.event.DrawerPopulatedEvent;
import com.jaquadro.minecraft.storagedrawers.api.registry.IWailaTooltipHandler;
Expand All @@ -29,6 +25,9 @@

import cpw.mods.fml.common.eventhandler.SubscribeEvent;
import cpw.mods.fml.common.registry.GameRegistry;
import thaumcraft.api.ThaumcraftApiHelper;
import thaumcraft.api.aspects.Aspect;
import thaumcraft.api.aspects.AspectList;

public class Thaumcraft extends IntegrationModule {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
import com.jaquadro.minecraft.storagedrawers.core.ModItems;
import com.jaquadro.minecraft.storagedrawers.integration.thermalfoundation.CoFHSecurityProvider;
import com.mojang.authlib.GameProfile;

import cpw.mods.fml.common.registry.GameRegistry;

public class ThermalFoundation extends IntegrationModule {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,6 @@

import java.util.List;

import mcp.mobius.waila.api.IWailaConfigHandler;
import mcp.mobius.waila.api.IWailaDataAccessor;
import mcp.mobius.waila.api.IWailaDataProvider;
import mcp.mobius.waila.api.IWailaRegistrar;

import net.minecraft.client.Minecraft;
import net.minecraft.entity.player.EntityPlayerMP;
import net.minecraft.item.ItemStack;
Expand All @@ -23,7 +18,12 @@
import com.jaquadro.minecraft.storagedrawers.block.BlockDrawers;
import com.jaquadro.minecraft.storagedrawers.block.tile.TileEntityDrawers;
import com.jaquadro.minecraft.storagedrawers.security.SecurityManager;

import cpw.mods.fml.common.event.FMLInterModComms;
import mcp.mobius.waila.api.IWailaConfigHandler;
import mcp.mobius.waila.api.IWailaDataAccessor;
import mcp.mobius.waila.api.IWailaDataProvider;
import mcp.mobius.waila.api.IWailaRegistrar;

/**
* @author dmillerw
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,13 @@
import net.minecraft.tileentity.TileEntity;
import net.minecraftforge.common.util.ForgeDirection;

import com.jaquadro.minecraft.storagedrawers.api.storage.IDrawerGroup;

import appeng.api.networking.security.BaseActionSource;
import appeng.api.storage.IExternalStorageHandler;
import appeng.api.storage.IMEInventory;
import appeng.api.storage.StorageChannel;

import com.jaquadro.minecraft.storagedrawers.api.storage.IDrawerGroup;

public class DrawerExternalStorageHandler implements IExternalStorageHandler {

private IStorageBusMonitorFactory sbmFactory;
Expand Down
Loading

0 comments on commit e82a2bb

Please sign in to comment.