Tweaks n' configs
- Fixed ejectors stacking unstackable items - Tweaked infinite fluid source size configuration - Fixed a Schematicannon crash my code from a previous commit caused - Added config for disabling large Firework Rocket recipes - Added config for disabling movable Spawners
This commit is contained in:
parent
18af709c9b
commit
d94a7faaa5
7 changed files with 41 additions and 14 deletions
|
@ -9,6 +9,10 @@ import java.util.List;
|
|||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import java.util.function.Predicate;
|
||||
import java.util.stream.IntStream;
|
||||
|
||||
import net.minecraft.item.crafting.FireworkRocketRecipe;
|
||||
import net.minecraft.item.crafting.ICraftingRecipe;
|
||||
|
||||
import org.apache.commons.lang3.tuple.Pair;
|
||||
|
||||
|
@ -145,6 +149,7 @@ public class RecipeGridHandler {
|
|||
if (AllConfigs.SERVER.recipes.allowRegularCraftingInCrafter.get())
|
||||
result = world.getRecipeManager()
|
||||
.getRecipe(IRecipeType.CRAFTING, craftinginventory, world)
|
||||
.filter(r -> isRecipeAllowed(r, craftinginventory))
|
||||
.map(r -> r.getCraftingResult(craftinginventory))
|
||||
.orElse(null);
|
||||
if (result == null)
|
||||
|
@ -154,6 +159,17 @@ public class RecipeGridHandler {
|
|||
return result;
|
||||
}
|
||||
|
||||
public static boolean isRecipeAllowed(ICraftingRecipe recipe, CraftingInventory inventory) {
|
||||
if (!AllConfigs.SERVER.recipes.allowBiggerFireworksInCrafter.get() && recipe instanceof FireworkRocketRecipe) {
|
||||
int numItems = IntStream.range(0, inventory.getSizeInventory())
|
||||
.map(i -> inventory.getStackInSlot(i).isEmpty() ? 0 : 1)
|
||||
.sum();
|
||||
if (numItems > 9)
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
public static class GroupedItems {
|
||||
Map<Pair<Integer, Integer>, ItemStack> grid = new HashMap<>();
|
||||
int minX, minY, maxX, maxY, width, height;
|
||||
|
|
|
@ -29,6 +29,8 @@ import com.simibubi.create.content.contraptions.fluids.tank.FluidTankBlock;
|
|||
import com.simibubi.create.content.contraptions.fluids.tank.FluidTankConnectivityHandler;
|
||||
import com.simibubi.create.content.logistics.block.redstone.RedstoneLinkBlock;
|
||||
|
||||
import com.simibubi.create.foundation.config.AllConfigs;
|
||||
|
||||
import net.minecraft.block.AbstractPressurePlateBlock;
|
||||
import net.minecraft.block.AbstractRailBlock;
|
||||
import net.minecraft.block.AbstractSignBlock;
|
||||
|
@ -47,6 +49,7 @@ import net.minecraft.block.LadderBlock;
|
|||
import net.minecraft.block.RedstoneDiodeBlock;
|
||||
import net.minecraft.block.RedstoneWallTorchBlock;
|
||||
import net.minecraft.block.RedstoneWireBlock;
|
||||
import net.minecraft.block.SpawnerBlock;
|
||||
import net.minecraft.block.StandingSignBlock;
|
||||
import net.minecraft.block.TorchBlock;
|
||||
import net.minecraft.block.WallSignBlock;
|
||||
|
@ -189,6 +192,8 @@ public class BlockMovementChecks {
|
|||
return false;
|
||||
if (AllBlockTags.NON_MOVABLE.matches(state))
|
||||
return false;
|
||||
if (!AllConfigs.SERVER.kinetics.movableSpawners.get() && block instanceof SpawnerBlock)
|
||||
return false;
|
||||
|
||||
// Move controllers only when they aren't moving
|
||||
if (block instanceof MechanicalPistonBlock && state.get(MechanicalPistonBlock.STATE) != PistonState.MOVING)
|
||||
|
|
|
@ -50,6 +50,7 @@ public abstract class FluidManipulationBehaviour extends TileEntityBehaviour {
|
|||
|
||||
// Search
|
||||
static final int searchedPerTick = 256;
|
||||
static final int validationTimerMin = 160;
|
||||
List<BlockPosEntry> frontier;
|
||||
Set<BlockPos> visited;
|
||||
|
||||
|
@ -67,12 +68,10 @@ public abstract class FluidManipulationBehaviour extends TileEntityBehaviour {
|
|||
counterpartActed = true;
|
||||
}
|
||||
|
||||
private int validationTimer() {
|
||||
protected int validationTimer() {
|
||||
int maxBlocks = maxBlocks();
|
||||
return infinite || maxBlocks < 0
|
||||
? 160
|
||||
// Allow enough time for the server's infinite block threshold to be reached
|
||||
: maxBlocks / searchedPerTick;
|
||||
return maxBlocks < 0 ? validationTimerMin : Math.max(validationTimerMin, maxBlocks / searchedPerTick + 1);
|
||||
}
|
||||
|
||||
protected int setValidationTimer() {
|
||||
|
|
|
@ -11,6 +11,7 @@ import com.simibubi.create.AllSoundEvents;
|
|||
import com.simibubi.create.content.contraptions.relays.belt.BeltHelper;
|
||||
import com.simibubi.create.content.contraptions.relays.belt.transport.TransportedItemStack;
|
||||
import com.simibubi.create.content.logistics.block.funnel.AbstractFunnelBlock;
|
||||
import com.simibubi.create.foundation.item.ItemHelper;
|
||||
import com.simibubi.create.foundation.tileEntity.SmartTileEntity;
|
||||
import com.simibubi.create.foundation.tileEntity.TileEntityBehaviour;
|
||||
import com.simibubi.create.foundation.tileEntity.behaviour.BehaviourType;
|
||||
|
@ -86,7 +87,7 @@ public class DepotBehaviour extends TileEntityBehaviour {
|
|||
if (heldItem == null) {
|
||||
heldItem = ts;
|
||||
} else {
|
||||
if (!ItemHandlerHelper.canItemStacksStack(heldItem.stack, ts.stack)) {
|
||||
if (!ItemHelper.canItemStackAmountsStack(heldItem.stack, ts.stack)) {
|
||||
Vector3d vec = VecHelper.getCenterOf(tileEntity.getPos());
|
||||
InventoryHelper.spawnItemStack(tileEntity.getWorld(), vec.x, vec.y + .5f, vec.z, ts.stack);
|
||||
} else {
|
||||
|
@ -250,7 +251,7 @@ public class DepotBehaviour extends TileEntityBehaviour {
|
|||
ItemStack inserted = heldItem.stack;
|
||||
if (remainingSpace <= 0)
|
||||
return inserted;
|
||||
if (this.heldItem != null && !ItemHandlerHelper.canItemStacksStack(this.heldItem.stack, inserted))
|
||||
if (this.heldItem != null && !ItemHelper.canItemStackAmountsStack(this.heldItem.stack, inserted))
|
||||
return inserted;
|
||||
|
||||
ItemStack returned = ItemStack.EMPTY;
|
||||
|
|
|
@ -150,7 +150,7 @@ public class SchematicannonTileEntity extends SmartTileEntity implements INamedC
|
|||
inventory = new SchematicannonInventory(this);
|
||||
statusMsg = "idle";
|
||||
state = State.STOPPED;
|
||||
printingEntityIndex = 0;
|
||||
printingEntityIndex = -1;
|
||||
printStage = PrintStage.BLOCKS;
|
||||
deferredBlocks = new LinkedList<>();
|
||||
replaceMode = 2;
|
||||
|
@ -594,7 +594,7 @@ public class SchematicannonTileEntity extends SmartTileEntity implements INamedC
|
|||
schematicLoaded = true;
|
||||
state = State.PAUSED;
|
||||
statusMsg = "ready";
|
||||
printingEntityIndex = 0;
|
||||
printingEntityIndex = -1;
|
||||
printStage = PrintStage.BLOCKS;
|
||||
deferredBlocks.clear();
|
||||
updateChecklist();
|
||||
|
@ -699,9 +699,9 @@ public class SchematicannonTileEntity extends SmartTileEntity implements INamedC
|
|||
}
|
||||
|
||||
if (printStage == PrintStage.ENTITIES) {
|
||||
if (printingEntityIndex < entities.size()) {
|
||||
currentPos = entities.get(printingEntityIndex).getBlockPos().subtract(schematicAnchor);
|
||||
if (printingEntityIndex + 1 < entities.size()) {
|
||||
printingEntityIndex++;
|
||||
currentPos = entities.get(printingEntityIndex).getBlockPos().subtract(schematicAnchor);
|
||||
} else {
|
||||
finishedPrinting();
|
||||
}
|
||||
|
|
|
@ -33,6 +33,7 @@ public class CKinetics extends ConfigBase {
|
|||
public ConfigInt maxPistonPoles = i(64, 1, "maxPistonPoles", Comments.maxPistonPoles);
|
||||
public ConfigInt maxRopeLength = i(128, 1, "maxRopeLength", Comments.maxRopeLength);
|
||||
public ConfigInt maxCartCouplingLength = i(32, 1, "maxCartCouplingLength", Comments.maxCartCouplingLength);
|
||||
public ConfigBool movableSpawners = b(true, "movableSpawners", Comments.movableSpawners);
|
||||
|
||||
public CStress stressValues = nested(1, CStress::new, Comments.stress);
|
||||
|
||||
|
@ -92,9 +93,10 @@ public class CKinetics extends ConfigBase {
|
|||
static String maxEjectorDistance = "Max Distance in blocks a Weighted Ejector can throw";
|
||||
static String ejectorScanInterval =
|
||||
"Time in ticks until the next item launched by an ejector scans blocks for potential collisions";
|
||||
static String movableSpawners = "When true, allows Spawner blocks to be moved by contraptions.";
|
||||
}
|
||||
|
||||
public static enum DeployerAggroSetting {
|
||||
public enum DeployerAggroSetting {
|
||||
ALL, CREEPERS, NONE
|
||||
}
|
||||
|
||||
|
|
|
@ -7,6 +7,8 @@ public class CRecipes extends ConfigBase {
|
|||
public ConfigBool allowShapedSquareInPress = b(true, "allowShapedSquareInPress", Comments.allowShapedSquareInPress);
|
||||
public ConfigBool allowRegularCraftingInCrafter =
|
||||
b(true, "allowRegularCraftingInCrafter", Comments.allowRegularCraftingInCrafter);
|
||||
public ConfigBool allowBiggerFireworksInCrafter =
|
||||
b(false, "allowBiggerFireworksInCrafter", Comments.allowBiggerFireworksInCrafter);
|
||||
public ConfigBool allowStonecuttingOnSaw = b(true, "allowStonecuttingOnSaw", Comments.allowStonecuttingOnSaw);
|
||||
public ConfigBool allowWoodcuttingOnSaw = b(true, "allowWoodcuttingOnSaw", Comments.allowWoodcuttingOnSaw);
|
||||
public ConfigInt lightSourceCountForRefinedRadiance =
|
||||
|
@ -28,6 +30,8 @@ public class CRecipes extends ConfigBase {
|
|||
"When true, allows any single-ingredient 2x2 or 3x3 crafting recipes to be processed by a Mechanical Press + Basin.";
|
||||
static String allowRegularCraftingInCrafter =
|
||||
"When true, allows any standard crafting recipes to be processed by Mechanical Crafters.";
|
||||
static String allowBiggerFireworksInCrafter =
|
||||
"When true, allows Firework Rockets with more than 9 ingredients to be crafted using Mechanical Crafters.";
|
||||
static String allowStonecuttingOnSaw =
|
||||
"When true, allows any stonecutting recipes to be processed by a Mechanical Saw.";
|
||||
static String allowWoodcuttingOnSaw =
|
||||
|
|
Loading…
Reference in a new issue