Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added Buffers (item and power) #455

Open
wants to merge 13 commits into
base: dev/1.20.1
Choose a base branch
from
Open
8 changes: 8 additions & 0 deletions src/core/java/com/enderio/core/CoreNBTKeys.java
Original file line number Diff line number Diff line change
Expand Up @@ -39,4 +39,12 @@ public class CoreNBTKeys {
public static final String ANCHOR_VISIBILITY = "AnchorVisibility";

//endregion

//region Buffer data

public static final String BUFFER_MAX_INPUT = "BufferMaxInput";

public static final String BUFFER_MAX_OUTPUT = "BufferMaxOutput";
Comment on lines +45 to +47
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use Generic ENERGY_MAX_RECEIVE and ENERGY_MAX_EXTRACT instead.


//endregion
}
35 changes: 35 additions & 0 deletions src/core/java/com/enderio/core/common/util/NumberUtils.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
package com.enderio.core.common.util;

public class NumberUtils {

public static int getInteger(String value) {
String integerValue = value.replaceAll("[., ]", "");

try {
return Integer.parseInt(integerValue);
} catch(Exception e) {
return 0;
}
}

public static long getLong(String value) {
String longValue = value.replaceAll("[., ]", "");
try {
return Long.parseLong(longValue);
} catch(Exception e) {
return 0;
}
}

public static String formatWithPrefix(int number) {
if (number < 100_000) {
return Long.toString(number);
} else if (number < 1_000_000) {
return String.format("%.1fk", number / 1_000.0);
} else if (number < 1_000_000_000) {
return String.format("%.3fM", number / 1_000_000.0);
} else {
return String.format("%.3fB", number / 1_000_000_000.0);
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
{
"variants": {
"facing=east": {
"model": "enderio:block/item_buffer_combined",
"y": 90
},
"facing=north": {
"model": "enderio:block/item_buffer_combined"
},
"facing=south": {
"model": "enderio:block/item_buffer_combined",
"y": 180
},
"facing=west": {
"model": "enderio:block/item_buffer_combined",
"y": 270
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
{
"variants": {
"facing=east": {
"model": "enderio:block/omni_buffer_combined",
"y": 90
},
"facing=north": {
"model": "enderio:block/omni_buffer_combined"
},
"facing=south": {
"model": "enderio:block/omni_buffer_combined",
"y": 180
},
"facing=west": {
"model": "enderio:block/omni_buffer_combined",
"y": 270
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
{
"variants": {
"facing=east": {
"model": "enderio:block/power_buffer_combined",
"y": 90
},
"facing=north": {
"model": "enderio:block/power_buffer_combined"
},
"facing=south": {
"model": "enderio:block/power_buffer_combined",
"y": 180
},
"facing=west": {
"model": "enderio:block/power_buffer_combined",
"y": 270
}
}
}
5 changes: 5 additions & 0 deletions src/generated/resources/assets/enderio/lang/en_ud.json
Original file line number Diff line number Diff line change
Expand Up @@ -140,11 +140,13 @@
"block.enderio.hootch": "ɥɔʇooH",
"block.enderio.impulse_hopper": "ɹǝddoH ǝsןndɯI",
"block.enderio.industrial_insulation_block": "uoıʇɐןnsuI ןɐıɹʇsnpuI",
"block.enderio.item_buffer": "ɹǝɟɟnᗺ ɯǝʇI",
"block.enderio.light": "ʇɥbıꞀ",
"block.enderio.light_inverted": "pǝʇɹǝʌuI ʇɥbıꞀ",
"block.enderio.light_node": "ǝpoN ʇɥbıꞀ",
"block.enderio.liquid_sunshine": "ǝuıɥsunS pınbıꞀ",
"block.enderio.nutrient_distillation": "uoıʇɐןןıʇsıᗡ ʇuǝıɹʇnN",
"block.enderio.omni_buffer": "ɹǝɟɟnᗺ ıuɯO",
"block.enderio.painted_crafting_table": "ǝןqɐ⟘ buıʇɟɐɹƆ pǝʇuıɐԀ",
"block.enderio.painted_fence": "ǝɔuǝℲ pǝʇuıɐԀ",
"block.enderio.painted_fence_gate": "ǝʇɐ⅁ ǝɔuǝℲ pǝʇuıɐԀ",
Expand All @@ -156,6 +158,7 @@
"block.enderio.painted_trapdoor": "ɹoopdɐɹ⟘ pǝʇuıɐԀ",
"block.enderio.painted_wooden_pressure_plate": "ǝʇɐןԀ ǝɹnssǝɹԀ uǝpooM pǝʇuıɐԀ",
"block.enderio.painting_machine": "ǝuıɥɔɐW buıʇuıɐԀ",
"block.enderio.power_buffer": "ɹǝɟɟnᗺ ɹǝʍoԀ",
"block.enderio.powered_light": "ʇɥbıꞀ pǝɹǝʍoԀ",
"block.enderio.powered_light_inverted": "pǝʇɹǝʌuI ʇɥbıꞀ pǝɹǝʍoԀ",
"block.enderio.powered_light_inverted_wireless": "ssǝןǝɹıM pǝʇɹǝʌuI ʇɥbıꞀ pǝɹǝʍoԀ",
Expand Down Expand Up @@ -267,6 +270,7 @@
"gui.enderio.full_power": "ןןnɟ sı ǝbɐɹoʇs ʎbɹǝuǝ ǝɥ⟘",
"gui.enderio.full_tank": "ןןnɟ sı ʞuɐʇ ǝɥ⟘",
"gui.enderio.idle": "ʞɹoʍ oʇ ʎpɐǝɹ sı ǝuıɥɔɐɯ ǝɥ⟘",
"gui.enderio.input": "ʇnduI",
"gui.enderio.input_empty": "ʇnduı ǝɥʇ uı ɯǝʇı ou sı ǝɹǝɥ⟘",
"gui.enderio.ioconfig": "uoıʇɐɹnbıɟuoƆ OI",
"gui.enderio.ioconfig.both": "ןןnԀ / ɥsnԀ",
Expand All @@ -281,6 +285,7 @@
"gui.enderio.no_source": "ʞɹoʍ oʇ ʇı ɹǝpun ʞɔoןq ǝɔɹnos ɐ spǝǝu uıɐɹᗡ ǝɥ⟘",
"gui.enderio.nocap.desc": "¡ʞɹoʍ uɐɔ ǝuıɥɔɐɯ sıɥʇ \n os ɹoʇıɔɐdɐɔ ʎuɐ ʇɹǝsuI",
"gui.enderio.nocap.title": "buıssıW ɹoʇıɔɐdɐƆ",
"gui.enderio.output": "ʇndʇnO",
"gui.enderio.output_full": "ʇndʇno ǝɥʇ ɹoɟ ɯooɹ ɥbnouǝ ʇou sı ǝɹǝɥ⟘",
"gui.enderio.progress": "%s%% ssǝɹboɹԀ",
"gui.enderio.range": "ǝbuɐᴚ",
Expand Down
5 changes: 5 additions & 0 deletions src/generated/resources/assets/enderio/lang/en_us.json
Original file line number Diff line number Diff line change
Expand Up @@ -140,11 +140,13 @@
"block.enderio.hootch": "Hootch",
"block.enderio.impulse_hopper": "Impulse Hopper",
"block.enderio.industrial_insulation_block": "Industrial Insulation",
"block.enderio.item_buffer": "Item Buffer",
"block.enderio.light": "Light",
"block.enderio.light_inverted": "Light Inverted",
"block.enderio.light_node": "Light Node",
"block.enderio.liquid_sunshine": "Liquid Sunshine",
"block.enderio.nutrient_distillation": "Nutrient Distillation",
"block.enderio.omni_buffer": "Omni Buffer",
"block.enderio.painted_crafting_table": "Painted Crafting Table",
"block.enderio.painted_fence": "Painted Fence",
"block.enderio.painted_fence_gate": "Painted Fence Gate",
Expand All @@ -156,6 +158,7 @@
"block.enderio.painted_trapdoor": "Painted Trapdoor",
"block.enderio.painted_wooden_pressure_plate": "Painted Wooden Pressure Plate",
"block.enderio.painting_machine": "Painting Machine",
"block.enderio.power_buffer": "Power Buffer",
"block.enderio.powered_light": "Powered Light",
"block.enderio.powered_light_inverted": "Powered Light Inverted",
"block.enderio.powered_light_inverted_wireless": "Powered Light Inverted Wireless",
Expand Down Expand Up @@ -267,6 +270,7 @@
"gui.enderio.full_power": "The energy storage is full",
"gui.enderio.full_tank": "The tank is full",
"gui.enderio.idle": "The machine is ready to work",
"gui.enderio.input": "Input",
"gui.enderio.input_empty": "There is no item in the input",
"gui.enderio.ioconfig": "IO Configuration",
"gui.enderio.ioconfig.both": "Push / Pull",
Expand All @@ -281,6 +285,7 @@
"gui.enderio.no_source": "The Drain needs a source block under it to work",
"gui.enderio.nocap.desc": "Insert any capacitor so \n this machine can work!",
"gui.enderio.nocap.title": "Capacitor Missing",
"gui.enderio.output": "Output",
"gui.enderio.output_full": "There is not enough room for the output",
"gui.enderio.progress": "Progress %s%%",
"gui.enderio.range": "Range",
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
{
"parent": "minecraft:block/block",
"children": {
"machine": {
"parent": "enderio:block/item_buffer"
},
"overlay": {
"parent": "enderio:block/io_overlay"
}
},
"item_render_order": [
"machine",
"overlay"
],
"loader": "forge:composite",
"textures": {
"particle": "enderio:block/item_buffer_front"
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
{
"parent": "minecraft:block/block",
"children": {
"machine": {
"parent": "enderio:block/omni_buffer"
},
"overlay": {
"parent": "enderio:block/io_overlay"
}
},
"item_render_order": [
"machine",
"overlay"
],
"loader": "forge:composite",
"textures": {
"particle": "enderio:block/omni_buffer_front"
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
{
"parent": "minecraft:block/block",
"children": {
"machine": {
"parent": "enderio:block/power_buffer"
},
"overlay": {
"parent": "enderio:block/io_overlay"
}
},
"item_render_order": [
"machine",
"overlay"
],
"loader": "forge:composite",
"textures": {
"particle": "enderio:block/power_buffer_front"
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"parent": "enderio:block/item_buffer"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"parent": "enderio:block/omni_buffer"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"parent": "enderio:block/power_buffer"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
{
"parent": "minecraft:recipes/root",
"criteria": {
"has_ingredient": {
"conditions": {
"items": [
{
"tag": "forge:ingots/iron"
}
]
},
"trigger": "minecraft:inventory_changed"
},
"has_the_recipe": {
"conditions": {
"recipe": "enderio:item_buffer"
},
"trigger": "minecraft:recipe_unlocked"
}
},
"requirements": [
[
"has_ingredient",
"has_the_recipe"
]
],
"rewards": {
"recipes": [
"enderio:item_buffer"
]
},
"sends_telemetry_event": false
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
{
"parent": "minecraft:recipes/root",
"criteria": {
"has_ingredient": {
"conditions": {
"items": [
{
"items": [
"enderio:power_buffer"
]
}
]
},
"trigger": "minecraft:inventory_changed"
},
"has_the_recipe": {
"conditions": {
"recipe": "enderio:omni_buffer"
},
"trigger": "minecraft:recipe_unlocked"
}
},
"requirements": [
[
"has_ingredient",
"has_the_recipe"
]
],
"rewards": {
"recipes": [
"enderio:omni_buffer"
]
},
"sends_telemetry_event": false
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
{
"parent": "minecraft:recipes/root",
"criteria": {
"has_ingredient": {
"conditions": {
"items": [
{
"items": [
"enderio:void_chassis"
]
}
]
},
"trigger": "minecraft:inventory_changed"
},
"has_the_recipe": {
"conditions": {
"recipe": "enderio:power_buffer"
},
"trigger": "minecraft:recipe_unlocked"
}
},
"requirements": [
[
"has_ingredient",
"has_the_recipe"
]
],
"rewards": {
"recipes": [
"enderio:power_buffer"
]
},
"sends_telemetry_event": false
}
Loading
Loading