add config option for single use cardbox #79

This commit is contained in:
maggi373 committed 2023-01-19 15:46:01 +01:00
1 parent b4b0f70205
commit 8f02f5a952
4 files changed
+14 -7

No files matched your search

@@ -77,6 +77,7 @@ public class MekanismConfig
public static int IC2SinkTier;
public static int IC2SourceTier;
public static int digitalMinerMaxRadius;
public static boolean enableSingleUseCardboxes;
}
public static class client
@@ -311,6 +311,8 @@ public class CommonProxy implements IGuiProvider
general.OreDictPlatinum = Mekanism.configuration.get(Configuration.CATEGORY_GENERAL, "OreDictPlatinum", false).getBoolean();
general.enableSiliconCompat = Mekanism.configuration.get(Configuration.CATEGORY_GENERAL, "EnableSiliconCompat", true).getBoolean();
general.digitalMinerMaxRadius = Mekanism.configuration.get(Configuration.CATEGORY_GENERAL, "DigitalMinerMaxRadius", 32, "Select range from 1 to 64, we do not recommend going over 32", 1, 64).getInt();
general.enableSingleUseCardboxes = Mekanism.configuration.get(Configuration.CATEGORY_GENERAL, "EnableSingleUseCardboxes", true).getBoolean();
general.IC2SinkTier = Mekanism.configuration.get(Configuration.CATEGORY_GENERAL, "IC2SinkTier", 4, "Tier level for machines, we recommend setting it to tier 2 for ic2 classic", 1, 4).getInt();
general.IC2SourceTier = Mekanism.configuration.get(Configuration.CATEGORY_GENERAL, "IC2SourceTier", 4, "Tier level for generators, we recommend setting it to tier 2 for ic2 classic", 1, 4).getInt();
@@ -2,6 +2,7 @@ package mekanism.common.block;
import java.util.Random;
import mekanism.api.MekanismConfig;
import mekanism.common.Mekanism;
import mekanism.common.MekanismBlocks;
import mekanism.common.item.ItemBlockCardboardBox;
@@ -105,15 +106,16 @@ public class BlockCardboardBox extends BlockContainer
data.block.onBlockPlacedBy(world, x, y, z, entityplayer, new ItemStack(data.block, 1, data.meta));
data.block.onPostBlockPlaced(world, x, y, z, data.meta);
}
// float motion = 0.7F;
// double motionX = (world.rand.nextFloat() * motion) + (1.0F - motion) * 0.5D;
// double motionY = (world.rand.nextFloat() * motion) + (1.0F - motion) * 0.5D;
// double motionZ = (world.rand.nextFloat() * motion) + (1.0F - motion) * 0.5D;
if(!MekanismConfig.general.enableSingleUseCardboxes) {
float motion = 0.7F;
double motionX = (world.rand.nextFloat() * motion) + (1.0F - motion) * 0.5D;
double motionY = (world.rand.nextFloat() * motion) + (1.0F - motion) * 0.5D;
double motionZ = (world.rand.nextFloat() * motion) + (1.0F - motion) * 0.5D;
// EntityItem entityItem = new EntityItem(world, x + motionX, y + motionY, z + motionZ, itemStack);
EntityItem entityItem = new EntityItem(world, x + motionX, y + motionY, z + motionZ, itemStack);
// world.spawnEntityInWorld(entityItem);
world.spawnEntityInWorld(entityItem);
}
}
}
@@ -83,6 +83,7 @@ public class PacketConfigSync implements IMessageHandler<ConfigSyncMessage, IMes
dataStream.writeInt(general.IC2SinkTier);
dataStream.writeInt(general.IC2SourceTier);
dataStream.writeInt(general.digitalMinerMaxRadius);
dataStream.writeBoolean(general.enableSingleUseCardboxes);
for(MachineType type : MachineType.getValidMachines())
{
@@ -276,6 +277,7 @@ public class PacketConfigSync implements IMessageHandler<ConfigSyncMessage, IMes
general.IC2SinkTier = dataStream.readInt();
general.IC2SourceTier = dataStream.readInt();
general.digitalMinerMaxRadius = dataStream.readInt();
general.enableSingleUseCardboxes = dataStream.readBoolean();
for(MachineType type : MachineType.getValidMachines())
{