diff --git a/src/main/java/org/cyclops/integrateddynamics/GeneralConfig.java b/src/main/java/org/cyclops/integrateddynamics/GeneralConfig.java index a0299707536..802f9300193 100644 --- a/src/main/java/org/cyclops/integrateddynamics/GeneralConfig.java +++ b/src/main/java/org/cyclops/integrateddynamics/GeneralConfig.java @@ -157,6 +157,9 @@ public class GeneralConfig extends DummyConfig { @ConfigurableProperty(category = "machine", comment = "The distance from which part offsets should be shown.", minimalValue = 1, configLocation = ModConfig.Type.SERVER) public static int partOffsetRenderDistance = 16; + @ConfigurableProperty(category = "machine", comment = "The maximum values that Part Offset items will have when dropped from a broken part.", minimalValue = 1, configLocation = ModConfig.Type.SERVER) + public static int enchancementOffsetPartDropValue = 4; + public GeneralConfig() { super(IntegratedDynamics._instance, "general"); } diff --git a/src/main/java/org/cyclops/integrateddynamics/core/part/PartTypeBase.java b/src/main/java/org/cyclops/integrateddynamics/core/part/PartTypeBase.java index fe995bbac4e..dcdc8cfa1b0 100644 --- a/src/main/java/org/cyclops/integrateddynamics/core/part/PartTypeBase.java +++ b/src/main/java/org/cyclops/integrateddynamics/core/part/PartTypeBase.java @@ -21,19 +21,14 @@ import org.cyclops.cyclopscore.config.extendedconfig.BlockConfig; import org.cyclops.cyclopscore.datastructure.DimPos; import org.cyclops.cyclopscore.init.ModBase; +import org.cyclops.integrateddynamics.GeneralConfig; import org.cyclops.integrateddynamics.IntegratedDynamics; import org.cyclops.integrateddynamics.RegistryEntries; import org.cyclops.integrateddynamics.api.network.INetwork; import org.cyclops.integrateddynamics.api.network.INetworkElement; import org.cyclops.integrateddynamics.api.network.IPartNetworkElement; import org.cyclops.integrateddynamics.api.network.event.INetworkEvent; -import org.cyclops.integrateddynamics.api.part.IPartContainer; -import org.cyclops.integrateddynamics.api.part.IPartState; -import org.cyclops.integrateddynamics.api.part.IPartType; -import org.cyclops.integrateddynamics.api.part.PartPos; -import org.cyclops.integrateddynamics.api.part.PartRenderPosition; -import org.cyclops.integrateddynamics.api.part.PartTarget; -import org.cyclops.integrateddynamics.api.part.PartTypeAdapter; +import org.cyclops.integrateddynamics.api.part.*; import org.cyclops.integrateddynamics.core.block.IgnoredBlock; import org.cyclops.integrateddynamics.core.helper.L10NValues; import org.cyclops.integrateddynamics.core.helper.PartHelpers; @@ -173,9 +168,21 @@ public void addDrops(PartTarget target, S state, List itemStacks, boo // Save enhancements if (!saveState && state.getMaxOffset() > 0) { - ItemStack itemStack = new ItemStack(RegistryEntries.ITEM_ENHANCEMENT_OFFSET); - RegistryEntries.ITEM_ENHANCEMENT_OFFSET.setEnhancementValue(itemStack, state.getMaxOffset()); - itemStacks.add(itemStack); + // Drop Part Offset items each with as maximum the GeneralConfig.enchancementOffsetPartDropValue offset value. + int remainingOffset = state.getMaxOffset(); + while (remainingOffset > 0) { + int offset; + if (remainingOffset < GeneralConfig.enchancementOffsetPartDropValue) { + offset = remainingOffset; + } else { + offset = GeneralConfig.enchancementOffsetPartDropValue; + } + remainingOffset -= offset; + + ItemStack itemStack = new ItemStack(RegistryEntries.ITEM_ENHANCEMENT_OFFSET); + RegistryEntries.ITEM_ENHANCEMENT_OFFSET.setEnhancementValue(itemStack, offset); + itemStacks.add(itemStack); + } } }