mirror of
https://github.com/Creators-of-Create/Create.git
synced 2025-01-22 11:40:03 +01:00
Cannon Arithmetic
- Schematicannons no longer consume additional gunpowder items until the previous item is depleted - Condensed Schematicannon fuel config to a single shots-per-gunpowder value - Schematicannons can now take gunpowder from adjacent inventories if necessary - Fixed a typo in ponder
This commit is contained in:
parent
dd7eedd1f0
commit
625a1f38e6
7 changed files with 55 additions and 40 deletions
|
@ -582,8 +582,8 @@ bf2b0310500213ff853c748c236eb5d01f61658e assets/create/blockstates/yellow_toolbo
|
|||
5616dda664dd106d576848124fc0fc1de18d0fd3 assets/create/blockstates/yellow_valve_handle.json
|
||||
7f39521b211441f5c3e06d60c5978cebe16cacfb assets/create/blockstates/zinc_block.json
|
||||
b7181bcd8182b2f17088e5aa881f374c9c65470c assets/create/blockstates/zinc_ore.json
|
||||
9b0b65057342c778e8b442ad820b3400896f17ee assets/create/lang/en_ud.json
|
||||
a15459832a165e6d082d80b301e4459d3dfecd41 assets/create/lang/en_us.json
|
||||
3c04d30f0521554ade532f1662cdaf4ae2958ab3 assets/create/lang/en_ud.json
|
||||
6a0df005c7594667d9c7582a877984d25382df7b assets/create/lang/en_us.json
|
||||
487a511a01b2a4531fb672f917922312db78f958 assets/create/models/block/acacia_window.json
|
||||
b48060cba1a382f373a05bf0039054053eccf076 assets/create/models/block/acacia_window_pane_noside.json
|
||||
3066db1bf03cffa1a9c7fbacf47ae586632f4eb3 assets/create/models/block/acacia_window_pane_noside_alt.json
|
||||
|
|
|
@ -1777,7 +1777,7 @@
|
|||
"create.ponder.mechanical_arm_redstone.text_1": "\u01DD\u0287\u0250\u028C\u0131\u0287\u0254\u0250 \u0287ou \u05DF\u05DF\u0131\u028D s\u026F\u0279\u2C6F \u05DF\u0250\u0254\u0131u\u0250\u0265\u0254\u01DDW '\u01DDuo\u0287sp\u01DD\u1D1A \u028Eq p\u01DD\u0279\u01DD\u028Dod u\u01DD\u0265M",
|
||||
"create.ponder.mechanical_arm_redstone.text_2": "s\u01DD\u05DF\u0254\u028E\u0254 p\u01DD\u0287\u0279\u0250\u0287s \u028Eu\u0250 \u0265s\u0131u\u0131\u025F \u05DF\u05DF\u0131\u028D \u0287\u0131 'bu\u0131ddo\u0287s \u01DD\u0279o\u025F\u01DD\u15FA",
|
||||
"create.ponder.mechanical_arm_redstone.text_3": "\u01DD\u05DF\u0254\u028E\u0254 uo\u0131\u0287\u0250\u028C\u0131\u0287\u0254\u0250 \u01DDuo \u028E\u05DF\u0287\u0254\u0250x\u01DD \u0279\u01DDbb\u0131\u0279\u0287 o\u0287 p\u01DDsn \u01DDq u\u0250\u0254 \u01DDs\u05DFnd \u01DD\u028C\u0131\u0287\u0250b\u01DDu \u0250 'sn\u0265\u27D8",
|
||||
"create.ponder.mechanical_bearing.header": "bu\u0131\u0279\u0250\u01DD\u15FA \u05DF\u0250\u0254\u0131u\u0250\u0265\u0254\u01DDW \u01DD\u0265\u0287 bu\u0131sn s\u01DD\u0279n\u0287\u0254n\u0279\u0287S sbu\u0131\u028CoW",
|
||||
"create.ponder.mechanical_bearing.header": "bu\u0131\u0279\u0250\u01DD\u15FA \u05DF\u0250\u0254\u0131u\u0250\u0265\u0254\u01DDW \u01DD\u0265\u0287 bu\u0131sn s\u01DD\u0279n\u0287\u0254n\u0279\u0287S bu\u0131\u028CoW",
|
||||
"create.ponder.mechanical_bearing.text_1": "\u026F\u01DD\u0265\u0287 \u025Fo \u0287uo\u0279\u025F u\u0131 \u029E\u0254o\u05DFq \u01DD\u0265\u0287 o\u0287 \u0265\u0254\u0250\u0287\u0287\u0250 sbu\u0131\u0279\u0250\u01DD\u15FA \u05DF\u0250\u0254\u0131u\u0250\u0265\u0254\u01DDW",
|
||||
"create.ponder.mechanical_bearing.text_2": "uo\u0131\u0287d\u0250\u0279\u0287uo\u0186 bu\u0131\u0287\u0250\u0287o\u1D1A \u0250 o\u0287u\u0131 \u0287\u0131 \u01DD\u05DFq\u026F\u01DDss\u0250 \u05DF\u05DF\u0131\u028D \u0287\u0131 '\u01DD\u0254\u0279o\u2132 \u05DF\u0250uo\u0131\u0287\u0250\u0287o\u1D1A bu\u0131\u028C\u0131\u01DD\u0254\u01DD\u0279 uod\u2229",
|
||||
"create.ponder.mechanical_crafter.header": "s\u0279\u01DD\u0287\u025F\u0250\u0279\u0186 \u05DF\u0250\u0254\u0131u\u0250\u0265\u0254\u01DDW dn bu\u0131\u0287\u0287\u01DDS",
|
||||
|
|
|
@ -1777,7 +1777,7 @@
|
|||
"create.ponder.mechanical_arm_redstone.text_1": "When powered by Redstone, Mechanical Arms will not activate",
|
||||
"create.ponder.mechanical_arm_redstone.text_2": "Before stopping, it will finish any started cycles",
|
||||
"create.ponder.mechanical_arm_redstone.text_3": "Thus, a negative pulse can be used to trigger exactly one activation cycle",
|
||||
"create.ponder.mechanical_bearing.header": "Movings Structures using the Mechanical Bearing",
|
||||
"create.ponder.mechanical_bearing.header": "Moving Structures using the Mechanical Bearing",
|
||||
"create.ponder.mechanical_bearing.text_1": "Mechanical Bearings attach to the block in front of them",
|
||||
"create.ponder.mechanical_bearing.text_2": "Upon receiving Rotational Force, it will assemble it into a Rotating Contraption",
|
||||
"create.ponder.mechanical_crafter.header": "Setting up Mechanical Crafters",
|
||||
|
|
|
@ -91,7 +91,7 @@ public class SchematicannonBlockEntity extends SmartBlockEntity implements MenuP
|
|||
public MaterialChecklist checklist;
|
||||
|
||||
// Gui information
|
||||
public float fuelLevel;
|
||||
public int remainingFuel;
|
||||
public float bookPrintingProgress;
|
||||
public float schematicProgress;
|
||||
public String statusMsg;
|
||||
|
@ -153,7 +153,7 @@ public class SchematicannonBlockEntity extends SmartBlockEntity implements MenuP
|
|||
statusMsg = compound.getString("Status");
|
||||
schematicProgress = compound.getFloat("Progress");
|
||||
bookPrintingProgress = compound.getFloat("PaperProgress");
|
||||
fuelLevel = compound.getFloat("Fuel");
|
||||
remainingFuel = compound.getInt("RemainingFuel");
|
||||
String stateString = compound.getString("State");
|
||||
state = stateString.isEmpty() ? State.STOPPED : State.valueOf(compound.getString("State"));
|
||||
blocksPlaced = compound.getInt("AmountPlaced");
|
||||
|
@ -227,7 +227,7 @@ public class SchematicannonBlockEntity extends SmartBlockEntity implements MenuP
|
|||
// Gui information
|
||||
compound.putFloat("Progress", schematicProgress);
|
||||
compound.putFloat("PaperProgress", bookPrintingProgress);
|
||||
compound.putFloat("Fuel", fuelLevel);
|
||||
compound.putInt("RemainingFuel", remainingFuel);
|
||||
compound.putString("Status", statusMsg);
|
||||
compound.putString("State", state.name());
|
||||
compound.putInt("AmountPlaced", blocksPlaced);
|
||||
|
@ -319,7 +319,7 @@ public class SchematicannonBlockEntity extends SmartBlockEntity implements MenuP
|
|||
return;
|
||||
}
|
||||
|
||||
if (state == State.PAUSED && !positionNotLoaded && missingItem == null && fuelLevel > getFuelUsageRate())
|
||||
if (state == State.PAUSED && !positionNotLoaded && missingItem == null && remainingFuel > 0)
|
||||
return;
|
||||
|
||||
// Initialize Printer
|
||||
|
@ -335,15 +335,18 @@ public class SchematicannonBlockEntity extends SmartBlockEntity implements MenuP
|
|||
}
|
||||
|
||||
// Check Fuel
|
||||
if (fuelLevel <= 0 && !hasCreativeCrate) {
|
||||
fuelLevel = 0;
|
||||
state = State.PAUSED;
|
||||
statusMsg = "noGunpowder";
|
||||
sendUpdate = true;
|
||||
return;
|
||||
if (remainingFuel <= 0 && !hasCreativeCrate) {
|
||||
refillFuelIfPossible();
|
||||
if (remainingFuel <= 0) {
|
||||
state = State.PAUSED;
|
||||
statusMsg = "noGunpowder";
|
||||
sendUpdate = true;
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if (hasCreativeCrate) {
|
||||
remainingFuel = 0;
|
||||
if (missingItem != null) {
|
||||
missingItem = null;
|
||||
state = State.RUNNING;
|
||||
|
@ -421,13 +424,13 @@ public class SchematicannonBlockEntity extends SmartBlockEntity implements MenuP
|
|||
});
|
||||
|
||||
printerCooldown = config().schematicannonDelay.get();
|
||||
fuelLevel -= getFuelUsageRate();
|
||||
remainingFuel -= 1;
|
||||
sendUpdate = true;
|
||||
missingItem = null;
|
||||
}
|
||||
|
||||
public double getFuelUsageRate() {
|
||||
return hasCreativeCrate ? 0 : config().schematicannonFuelUsage.get() / 100f;
|
||||
public int getShotsPerGunpowder() {
|
||||
return hasCreativeCrate ? 0 : config().schematicannonShotsPerGunpowder.get();
|
||||
}
|
||||
|
||||
protected void initializePrinter(ItemStack blueprint) {
|
||||
|
@ -646,15 +649,34 @@ public class SchematicannonBlockEntity extends SmartBlockEntity implements MenuP
|
|||
protected void refillFuelIfPossible() {
|
||||
if (hasCreativeCrate)
|
||||
return;
|
||||
if (1 - fuelLevel + 1 / 128f < getFuelAddedByGunPowder())
|
||||
return;
|
||||
if (inventory.getStackInSlot(4)
|
||||
.isEmpty())
|
||||
if (remainingFuel > getShotsPerGunpowder()) {
|
||||
remainingFuel = getShotsPerGunpowder();
|
||||
sendUpdate = true;
|
||||
return;
|
||||
}
|
||||
|
||||
if (remainingFuel > 0)
|
||||
return;
|
||||
|
||||
inventory.getStackInSlot(4)
|
||||
.shrink(1);
|
||||
fuelLevel += getFuelAddedByGunPowder();
|
||||
if (!inventory.getStackInSlot(4)
|
||||
.isEmpty())
|
||||
inventory.getStackInSlot(4)
|
||||
.shrink(1);
|
||||
else {
|
||||
boolean externalGunpowderFound = false;
|
||||
for (LazyOptional<IItemHandler> cap : attachedInventories) {
|
||||
IItemHandler itemHandler = cap.orElse(EmptyHandler.INSTANCE);
|
||||
if (ItemHelper.extract(itemHandler, stack -> inventory.isItemValid(4, stack), 1, false)
|
||||
.isEmpty())
|
||||
continue;
|
||||
externalGunpowderFound = true;
|
||||
break;
|
||||
}
|
||||
if (!externalGunpowderFound)
|
||||
return;
|
||||
}
|
||||
|
||||
remainingFuel += getShotsPerGunpowder();
|
||||
if (statusMsg.equals("noGunpowder")) {
|
||||
if (blocksPlaced > 0)
|
||||
state = State.RUNNING;
|
||||
|
@ -663,10 +685,6 @@ public class SchematicannonBlockEntity extends SmartBlockEntity implements MenuP
|
|||
sendUpdate = true;
|
||||
}
|
||||
|
||||
public double getFuelAddedByGunPowder() {
|
||||
return config().schematicannonGunpowderWorth.get() / 100f;
|
||||
}
|
||||
|
||||
protected void tickPaperPrinter() {
|
||||
int BookInput = 2;
|
||||
int BookOutput = 3;
|
||||
|
|
|
@ -283,7 +283,8 @@ public class SchematicannonScreen extends AbstractSimiContainerScreen<Schematica
|
|||
|
||||
SchematicannonBlockEntity be = menu.contentHolder;
|
||||
renderPrintingProgress(ms, x, y, be.schematicProgress);
|
||||
renderFuelBar(ms, x, y, be.fuelLevel);
|
||||
float amount = be.remainingFuel / (float) be.getShotsPerGunpowder();
|
||||
renderFuelBar(ms, x, y, amount);
|
||||
renderChecklistPrinterProgress(ms, x, y, be.bookPrintingProgress);
|
||||
|
||||
if (!be.inventory.getStackInSlot(0)
|
||||
|
@ -385,10 +386,9 @@ public class SchematicannonScreen extends AbstractSimiContainerScreen<Schematica
|
|||
}
|
||||
|
||||
protected List<Component> getFuelLevelTooltip(SchematicannonBlockEntity be) {
|
||||
double fuelUsageRate = be.getFuelUsageRate();
|
||||
int shotsLeft = (int) (be.fuelLevel / fuelUsageRate);
|
||||
int shotsLeftWithItems = (int) (shotsLeft + be.inventory.getStackInSlot(4)
|
||||
.getCount() * (be.getFuelAddedByGunPowder() / fuelUsageRate));
|
||||
int shotsLeft = be.remainingFuel;
|
||||
int shotsLeftWithItems = shotsLeft + be.inventory.getStackInSlot(4)
|
||||
.getCount() * be.getShotsPerGunpowder();
|
||||
List<Component> tooltip = new ArrayList<>();
|
||||
|
||||
if (be.hasCreativeCrate) {
|
||||
|
@ -400,7 +400,7 @@ public class SchematicannonScreen extends AbstractSimiContainerScreen<Schematica
|
|||
return tooltip;
|
||||
}
|
||||
|
||||
int fillPercent = (int) (be.fuelLevel * 100);
|
||||
int fillPercent = (int) ((be.remainingFuel / (float) be.getShotsPerGunpowder()) * 100);
|
||||
tooltip.add(Lang.translateDirect(_gunpowderLevel, fillPercent));
|
||||
tooltip.add(Lang.translateDirect(_shotsRemaining, Components.literal(Integer.toString(shotsLeft)).withStyle(BLUE))
|
||||
.withStyle(GRAY));
|
||||
|
|
|
@ -13,9 +13,7 @@ public class CSchematics extends ConfigBase {
|
|||
|
||||
public final ConfigGroup schematicannon = group(0, "schematicannon", "Schematicannon");
|
||||
public final ConfigInt schematicannonDelay = i(10, 1, "schematicannonDelay", Comments.delay);
|
||||
public final ConfigFloat schematicannonGunpowderWorth =
|
||||
f(20, 0, 100, "schematicannonGunpowderWorth", Comments.gunpowderWorth);
|
||||
public final ConfigFloat schematicannonFuelUsage = f(0.05f, 0, 100, "schematicannonFuelUsage", Comments.fuelUsage);
|
||||
public final ConfigInt schematicannonShotsPerGunpowder = i(400, 1, "schematicannonShotsPerGunpowder", Comments.schematicannonShotsPerGunpowder);
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
|
@ -32,8 +30,7 @@ public class CSchematics extends ConfigBase {
|
|||
static String idleTimeout =
|
||||
"Amount of game ticks without new packets arriving until an active schematic upload process is discarded.";
|
||||
static String delay = "Amount of game ticks between shots of the cannon. Higher => Slower";
|
||||
static String gunpowderWorth = "% of Schematicannon's Fuel filled by 1 Gunpowder.";
|
||||
static String fuelUsage = "% of Schematicannon's Fuel used for each fired block.";
|
||||
static String schematicannonShotsPerGunpowder = "Amount of blocks a Schematicannon can print per Gunpowder item provided.";
|
||||
static String creativePrintIncludesAir =
|
||||
"Whether placing a Schematic directly in Creative Mode should replace world blocks with Air";
|
||||
}
|
||||
|
|
|
@ -238,7 +238,7 @@ public class BearingScenes {
|
|||
}
|
||||
|
||||
public static void mechanicalBearing(SceneBuilder scene, SceneBuildingUtil util) {
|
||||
scene.title("mechanical_bearing", "Movings Structures using the Mechanical Bearing");
|
||||
scene.title("mechanical_bearing", "Moving Structures using the Mechanical Bearing");
|
||||
scene.configureBasePlate(1, 1, 5);
|
||||
scene.setSceneOffsetY(-1);
|
||||
scene.world.showSection(util.select.layer(0), Direction.UP);
|
||||
|
|
Loading…
Add table
Reference in a new issue