mirror of
https://github.com/Creators-of-Create/Create.git
synced 2024-12-28 07:56:44 +01:00
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.Map;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
import java.util.function.Predicate;
|
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;
|
import org.apache.commons.lang3.tuple.Pair;
|
||||||
|
|
||||||
|
@ -145,6 +149,7 @@ public class RecipeGridHandler {
|
||||||
if (AllConfigs.SERVER.recipes.allowRegularCraftingInCrafter.get())
|
if (AllConfigs.SERVER.recipes.allowRegularCraftingInCrafter.get())
|
||||||
result = world.getRecipeManager()
|
result = world.getRecipeManager()
|
||||||
.getRecipe(IRecipeType.CRAFTING, craftinginventory, world)
|
.getRecipe(IRecipeType.CRAFTING, craftinginventory, world)
|
||||||
|
.filter(r -> isRecipeAllowed(r, craftinginventory))
|
||||||
.map(r -> r.getCraftingResult(craftinginventory))
|
.map(r -> r.getCraftingResult(craftinginventory))
|
||||||
.orElse(null);
|
.orElse(null);
|
||||||
if (result == null)
|
if (result == null)
|
||||||
|
@ -154,6 +159,17 @@ public class RecipeGridHandler {
|
||||||
return result;
|
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 {
|
public static class GroupedItems {
|
||||||
Map<Pair<Integer, Integer>, ItemStack> grid = new HashMap<>();
|
Map<Pair<Integer, Integer>, ItemStack> grid = new HashMap<>();
|
||||||
int minX, minY, maxX, maxY, width, height;
|
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.contraptions.fluids.tank.FluidTankConnectivityHandler;
|
||||||
import com.simibubi.create.content.logistics.block.redstone.RedstoneLinkBlock;
|
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.AbstractPressurePlateBlock;
|
||||||
import net.minecraft.block.AbstractRailBlock;
|
import net.minecraft.block.AbstractRailBlock;
|
||||||
import net.minecraft.block.AbstractSignBlock;
|
import net.minecraft.block.AbstractSignBlock;
|
||||||
|
@ -47,6 +49,7 @@ import net.minecraft.block.LadderBlock;
|
||||||
import net.minecraft.block.RedstoneDiodeBlock;
|
import net.minecraft.block.RedstoneDiodeBlock;
|
||||||
import net.minecraft.block.RedstoneWallTorchBlock;
|
import net.minecraft.block.RedstoneWallTorchBlock;
|
||||||
import net.minecraft.block.RedstoneWireBlock;
|
import net.minecraft.block.RedstoneWireBlock;
|
||||||
|
import net.minecraft.block.SpawnerBlock;
|
||||||
import net.minecraft.block.StandingSignBlock;
|
import net.minecraft.block.StandingSignBlock;
|
||||||
import net.minecraft.block.TorchBlock;
|
import net.minecraft.block.TorchBlock;
|
||||||
import net.minecraft.block.WallSignBlock;
|
import net.minecraft.block.WallSignBlock;
|
||||||
|
@ -189,6 +192,8 @@ public class BlockMovementChecks {
|
||||||
return false;
|
return false;
|
||||||
if (AllBlockTags.NON_MOVABLE.matches(state))
|
if (AllBlockTags.NON_MOVABLE.matches(state))
|
||||||
return false;
|
return false;
|
||||||
|
if (!AllConfigs.SERVER.kinetics.movableSpawners.get() && block instanceof SpawnerBlock)
|
||||||
|
return false;
|
||||||
|
|
||||||
// Move controllers only when they aren't moving
|
// Move controllers only when they aren't moving
|
||||||
if (block instanceof MechanicalPistonBlock && state.get(MechanicalPistonBlock.STATE) != PistonState.MOVING)
|
if (block instanceof MechanicalPistonBlock && state.get(MechanicalPistonBlock.STATE) != PistonState.MOVING)
|
||||||
|
|
|
@ -50,6 +50,7 @@ public abstract class FluidManipulationBehaviour extends TileEntityBehaviour {
|
||||||
|
|
||||||
// Search
|
// Search
|
||||||
static final int searchedPerTick = 256;
|
static final int searchedPerTick = 256;
|
||||||
|
static final int validationTimerMin = 160;
|
||||||
List<BlockPosEntry> frontier;
|
List<BlockPosEntry> frontier;
|
||||||
Set<BlockPos> visited;
|
Set<BlockPos> visited;
|
||||||
|
|
||||||
|
@ -67,12 +68,10 @@ public abstract class FluidManipulationBehaviour extends TileEntityBehaviour {
|
||||||
counterpartActed = true;
|
counterpartActed = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
private int validationTimer() {
|
protected int validationTimer() {
|
||||||
int maxBlocks = maxBlocks();
|
int maxBlocks = maxBlocks();
|
||||||
return infinite || maxBlocks < 0
|
// Allow enough time for the server's infinite block threshold to be reached
|
||||||
? 160
|
return maxBlocks < 0 ? validationTimerMin : Math.max(validationTimerMin, maxBlocks / searchedPerTick + 1);
|
||||||
// Allow enough time for the server's infinite block threshold to be reached
|
|
||||||
: maxBlocks / searchedPerTick;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
protected int setValidationTimer() {
|
protected int setValidationTimer() {
|
||||||
|
@ -184,7 +183,7 @@ public abstract class FluidManipulationBehaviour extends TileEntityBehaviour {
|
||||||
frontier.add(new BlockPosEntry(offsetPos, entry.distance + 1));
|
frontier.add(new BlockPosEntry(offsetPos, entry.distance + 1));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return fluid;
|
return fluid;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -204,7 +203,7 @@ public abstract class FluidManipulationBehaviour extends TileEntityBehaviour {
|
||||||
if (world instanceof ServerWorld)
|
if (world instanceof ServerWorld)
|
||||||
AllPackets.sendToNear(world, splooshPos, 10, new FluidSplashPacket(splooshPos, new FluidStack(fluid, 1)));
|
AllPackets.sendToNear(world, splooshPos, 10, new FluidSplashPacket(splooshPos, new FluidStack(fluid, 1)));
|
||||||
}
|
}
|
||||||
|
|
||||||
protected boolean canDrainInfinitely(Fluid fluid) {
|
protected boolean canDrainInfinitely(Fluid fluid) {
|
||||||
return maxBlocks() != -1; // && !AllFluidTags.NO_INFINITE_DRAINING.matches(fluid);
|
return maxBlocks() != -1; // && !AllFluidTags.NO_INFINITE_DRAINING.matches(fluid);
|
||||||
}
|
}
|
||||||
|
|
|
@ -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.BeltHelper;
|
||||||
import com.simibubi.create.content.contraptions.relays.belt.transport.TransportedItemStack;
|
import com.simibubi.create.content.contraptions.relays.belt.transport.TransportedItemStack;
|
||||||
import com.simibubi.create.content.logistics.block.funnel.AbstractFunnelBlock;
|
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.SmartTileEntity;
|
||||||
import com.simibubi.create.foundation.tileEntity.TileEntityBehaviour;
|
import com.simibubi.create.foundation.tileEntity.TileEntityBehaviour;
|
||||||
import com.simibubi.create.foundation.tileEntity.behaviour.BehaviourType;
|
import com.simibubi.create.foundation.tileEntity.behaviour.BehaviourType;
|
||||||
|
@ -86,7 +87,7 @@ public class DepotBehaviour extends TileEntityBehaviour {
|
||||||
if (heldItem == null) {
|
if (heldItem == null) {
|
||||||
heldItem = ts;
|
heldItem = ts;
|
||||||
} else {
|
} else {
|
||||||
if (!ItemHandlerHelper.canItemStacksStack(heldItem.stack, ts.stack)) {
|
if (!ItemHelper.canItemStackAmountsStack(heldItem.stack, ts.stack)) {
|
||||||
Vector3d vec = VecHelper.getCenterOf(tileEntity.getPos());
|
Vector3d vec = VecHelper.getCenterOf(tileEntity.getPos());
|
||||||
InventoryHelper.spawnItemStack(tileEntity.getWorld(), vec.x, vec.y + .5f, vec.z, ts.stack);
|
InventoryHelper.spawnItemStack(tileEntity.getWorld(), vec.x, vec.y + .5f, vec.z, ts.stack);
|
||||||
} else {
|
} else {
|
||||||
|
@ -250,7 +251,7 @@ public class DepotBehaviour extends TileEntityBehaviour {
|
||||||
ItemStack inserted = heldItem.stack;
|
ItemStack inserted = heldItem.stack;
|
||||||
if (remainingSpace <= 0)
|
if (remainingSpace <= 0)
|
||||||
return inserted;
|
return inserted;
|
||||||
if (this.heldItem != null && !ItemHandlerHelper.canItemStacksStack(this.heldItem.stack, inserted))
|
if (this.heldItem != null && !ItemHelper.canItemStackAmountsStack(this.heldItem.stack, inserted))
|
||||||
return inserted;
|
return inserted;
|
||||||
|
|
||||||
ItemStack returned = ItemStack.EMPTY;
|
ItemStack returned = ItemStack.EMPTY;
|
||||||
|
|
|
@ -150,7 +150,7 @@ public class SchematicannonTileEntity extends SmartTileEntity implements INamedC
|
||||||
inventory = new SchematicannonInventory(this);
|
inventory = new SchematicannonInventory(this);
|
||||||
statusMsg = "idle";
|
statusMsg = "idle";
|
||||||
state = State.STOPPED;
|
state = State.STOPPED;
|
||||||
printingEntityIndex = 0;
|
printingEntityIndex = -1;
|
||||||
printStage = PrintStage.BLOCKS;
|
printStage = PrintStage.BLOCKS;
|
||||||
deferredBlocks = new LinkedList<>();
|
deferredBlocks = new LinkedList<>();
|
||||||
replaceMode = 2;
|
replaceMode = 2;
|
||||||
|
@ -594,7 +594,7 @@ public class SchematicannonTileEntity extends SmartTileEntity implements INamedC
|
||||||
schematicLoaded = true;
|
schematicLoaded = true;
|
||||||
state = State.PAUSED;
|
state = State.PAUSED;
|
||||||
statusMsg = "ready";
|
statusMsg = "ready";
|
||||||
printingEntityIndex = 0;
|
printingEntityIndex = -1;
|
||||||
printStage = PrintStage.BLOCKS;
|
printStage = PrintStage.BLOCKS;
|
||||||
deferredBlocks.clear();
|
deferredBlocks.clear();
|
||||||
updateChecklist();
|
updateChecklist();
|
||||||
|
@ -699,9 +699,9 @@ public class SchematicannonTileEntity extends SmartTileEntity implements INamedC
|
||||||
}
|
}
|
||||||
|
|
||||||
if (printStage == PrintStage.ENTITIES) {
|
if (printStage == PrintStage.ENTITIES) {
|
||||||
if (printingEntityIndex < entities.size()) {
|
if (printingEntityIndex + 1 < entities.size()) {
|
||||||
currentPos = entities.get(printingEntityIndex).getBlockPos().subtract(schematicAnchor);
|
|
||||||
printingEntityIndex++;
|
printingEntityIndex++;
|
||||||
|
currentPos = entities.get(printingEntityIndex).getBlockPos().subtract(schematicAnchor);
|
||||||
} else {
|
} else {
|
||||||
finishedPrinting();
|
finishedPrinting();
|
||||||
}
|
}
|
||||||
|
|
|
@ -33,6 +33,7 @@ public class CKinetics extends ConfigBase {
|
||||||
public ConfigInt maxPistonPoles = i(64, 1, "maxPistonPoles", Comments.maxPistonPoles);
|
public ConfigInt maxPistonPoles = i(64, 1, "maxPistonPoles", Comments.maxPistonPoles);
|
||||||
public ConfigInt maxRopeLength = i(128, 1, "maxRopeLength", Comments.maxRopeLength);
|
public ConfigInt maxRopeLength = i(128, 1, "maxRopeLength", Comments.maxRopeLength);
|
||||||
public ConfigInt maxCartCouplingLength = i(32, 1, "maxCartCouplingLength", Comments.maxCartCouplingLength);
|
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);
|
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 maxEjectorDistance = "Max Distance in blocks a Weighted Ejector can throw";
|
||||||
static String ejectorScanInterval =
|
static String ejectorScanInterval =
|
||||||
"Time in ticks until the next item launched by an ejector scans blocks for potential collisions";
|
"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
|
ALL, CREEPERS, NONE
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -7,6 +7,8 @@ public class CRecipes extends ConfigBase {
|
||||||
public ConfigBool allowShapedSquareInPress = b(true, "allowShapedSquareInPress", Comments.allowShapedSquareInPress);
|
public ConfigBool allowShapedSquareInPress = b(true, "allowShapedSquareInPress", Comments.allowShapedSquareInPress);
|
||||||
public ConfigBool allowRegularCraftingInCrafter =
|
public ConfigBool allowRegularCraftingInCrafter =
|
||||||
b(true, "allowRegularCraftingInCrafter", Comments.allowRegularCraftingInCrafter);
|
b(true, "allowRegularCraftingInCrafter", Comments.allowRegularCraftingInCrafter);
|
||||||
|
public ConfigBool allowBiggerFireworksInCrafter =
|
||||||
|
b(false, "allowBiggerFireworksInCrafter", Comments.allowBiggerFireworksInCrafter);
|
||||||
public ConfigBool allowStonecuttingOnSaw = b(true, "allowStonecuttingOnSaw", Comments.allowStonecuttingOnSaw);
|
public ConfigBool allowStonecuttingOnSaw = b(true, "allowStonecuttingOnSaw", Comments.allowStonecuttingOnSaw);
|
||||||
public ConfigBool allowWoodcuttingOnSaw = b(true, "allowWoodcuttingOnSaw", Comments.allowWoodcuttingOnSaw);
|
public ConfigBool allowWoodcuttingOnSaw = b(true, "allowWoodcuttingOnSaw", Comments.allowWoodcuttingOnSaw);
|
||||||
public ConfigInt lightSourceCountForRefinedRadiance =
|
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.";
|
"When true, allows any single-ingredient 2x2 or 3x3 crafting recipes to be processed by a Mechanical Press + Basin.";
|
||||||
static String allowRegularCraftingInCrafter =
|
static String allowRegularCraftingInCrafter =
|
||||||
"When true, allows any standard crafting recipes to be processed by Mechanical Crafters.";
|
"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 =
|
static String allowStonecuttingOnSaw =
|
||||||
"When true, allows any stonecutting recipes to be processed by a Mechanical Saw.";
|
"When true, allows any stonecutting recipes to be processed by a Mechanical Saw.";
|
||||||
static String allowWoodcuttingOnSaw =
|
static String allowWoodcuttingOnSaw =
|
||||||
|
|
Loading…
Reference in a new issue