mirror of
https://github.com/Creators-of-Create/Create.git
synced 2024-12-27 07:27:15 +01:00
commit
fc33e93a4d
17 changed files with 144 additions and 103 deletions
|
@ -140,7 +140,7 @@ de8a40b7daf1497d5aecee47a43b3e0b1d030b00 assets/create/blockstates/fancy_scoria_
|
|||
fc9ac0a7e7191b93516719455a17177fa6524ecc assets/create/blockstates/fancy_weathered_limestone_bricks_slab.json
|
||||
b2a7c321b1795f20e7433f81a55ce4683de081b8 assets/create/blockstates/fancy_weathered_limestone_bricks_stairs.json
|
||||
6372fe02ba0065acb0758121c45a15a1a8fdc5de assets/create/blockstates/fancy_weathered_limestone_bricks_wall.json
|
||||
499aade14db59f62b46e8a266998feb41e1922a1 assets/create/blockstates/fluid_pipe.json
|
||||
ddf31e35edba4572e4b916e654794c2fc9355c76 assets/create/blockstates/fluid_pipe.json
|
||||
f0eaab18e16c4f3f65ebf3b55b08f0dc445720fe assets/create/blockstates/fluid_tank.json
|
||||
5408d92ab02af86539ac42971d4033545970bb3a assets/create/blockstates/fluid_valve.json
|
||||
e9da1794b6ece7f9aa8bcb43d42c23a55446133b assets/create/blockstates/flywheel.json
|
||||
|
@ -335,7 +335,7 @@ e8b0a401c10d1ba67ed71ba31bd5f9bc28571b65 assets/create/blockstates/powered_toggl
|
|||
d06cd9a1101b18d306a786320aab12018b1325d6 assets/create/blockstates/purple_sail.json
|
||||
92957119abd5fbcca36a113b2a80255fd70fc303 assets/create/blockstates/purple_seat.json
|
||||
61035f8afe75ff7bbd291da5d8690bcbebe679eb assets/create/blockstates/purple_valve_handle.json
|
||||
9e7ea57c58889fa0021e3c4f19da3f763108399f assets/create/blockstates/radial_chassis.json
|
||||
100eedce1711b9eea00a4540ebef8a19e834df3a assets/create/blockstates/radial_chassis.json
|
||||
45877c4d90a7185c2f304edbd67379d800920439 assets/create/blockstates/red_sail.json
|
||||
da1b08387af7afa0855ee8d040f620c01f20660a assets/create/blockstates/red_seat.json
|
||||
722fc77bbf387af8a4016e42cbf9501d2b968881 assets/create/blockstates/red_valve_handle.json
|
||||
|
@ -398,16 +398,16 @@ a3a11524cd3515fc01d905767b4b7ea782adaf03 assets/create/blockstates/yellow_seat.j
|
|||
7f39521b211441f5c3e06d60c5978cebe16cacfb assets/create/blockstates/zinc_block.json
|
||||
b7181bcd8182b2f17088e5aa881f374c9c65470c assets/create/blockstates/zinc_ore.json
|
||||
efb6e419a2b1181541032daefc9420a1b0426ba3 assets/create/lang/en_ud.json
|
||||
36140c5c0a5f593dc6470d659e8b809f7bf90513 assets/create/lang/en_us.json
|
||||
c3fd899caa2854d0bd8f01042b5161a68e2fb11d assets/create/lang/unfinished/de_de.json
|
||||
97367216e3c29a93ba41e5e68b3ef1e62eb7bed0 assets/create/lang/unfinished/fr_fr.json
|
||||
e2b3409d52c793eb15329a2fa191437a04314f25 assets/create/lang/unfinished/it_it.json
|
||||
b6893bae7bb205eab270596891dfe20cc114037c assets/create/lang/unfinished/ja_jp.json
|
||||
82537573c3af93df36afff886260fb68d2bc288b assets/create/lang/unfinished/ko_kr.json
|
||||
ea6569036e30d262da26560123817cf3182d7e62 assets/create/lang/unfinished/nl_nl.json
|
||||
0ee15746838cb6ea83054d28e598c7f89e44b136 assets/create/lang/unfinished/pt_br.json
|
||||
0f9d3389ff1598a74ea9739c51b1a309274f46f5 assets/create/lang/unfinished/ru_ru.json
|
||||
149450cea09a1cf7757a880b1238cbbdea74aee9 assets/create/lang/unfinished/zh_cn.json
|
||||
d5345200a404fbc824d92656f6b1a543bfaf635d assets/create/lang/en_us.json
|
||||
b43244225f07231c9fb8b71bbd3b945bd30a5ab8 assets/create/lang/unfinished/de_de.json
|
||||
3472564e14b7728ee96df813eb49ad3b11a092c3 assets/create/lang/unfinished/fr_fr.json
|
||||
9074e0c4d47f2e97c112f6897b74c202f2c734c6 assets/create/lang/unfinished/it_it.json
|
||||
c369058cdfacd8f437d0caea277925db6f8ed6f8 assets/create/lang/unfinished/ja_jp.json
|
||||
338ea41c2550c80ac304a03713e368d34c737b5c assets/create/lang/unfinished/ko_kr.json
|
||||
95fbf8d08213878f113ea9875d2d62d712d524f7 assets/create/lang/unfinished/nl_nl.json
|
||||
d6ab20d3494560ef09708f5ef9b72ee4a9e2c5a0 assets/create/lang/unfinished/pt_br.json
|
||||
249d647fcf8f5ad45161a992620eebd81821eccc assets/create/lang/unfinished/ru_ru.json
|
||||
2ac7dee1d72427a557c30d2cab6054ff877ae27e assets/create/lang/unfinished/zh_cn.json
|
||||
846200eb548d3bfa2e77b41039de159b4b6cfb45 assets/create/models/block/acacia_window.json
|
||||
1930fa3a3c98d53dd19e4ee7f55bc27fd47aa281 assets/create/models/block/acacia_window_pane_noside.json
|
||||
1763ea2c9b981d187f5031ba608f3d5d3be3986a assets/create/models/block/acacia_window_pane_noside_alt.json
|
||||
|
|
|
@ -875,6 +875,9 @@
|
|||
"create.schematicannon.status.schematicNotPlaced": "Schematic Not Deployed",
|
||||
"create.schematicannon.status.schematicExpired": "Schematic File Expired",
|
||||
|
||||
"create.materialChecklist": "Material Checklist",
|
||||
"create.materialChecklist.blocksNotLoaded": "* Disclaimer *\n\nMaterial List may be inaccurate due to relevant chunks not being loaded.",
|
||||
|
||||
"create.gui.filter.deny_list": "Deny-List",
|
||||
"create.gui.filter.deny_list.description": "Items pass if they do NOT match any of the above. An empty Deny-List accepts everything.",
|
||||
"create.gui.filter.allow_list": "Allow-List",
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
{
|
||||
"_": "Missing Localizations: 1128",
|
||||
"_": "Missing Localizations: 1130",
|
||||
|
||||
"_": "->------------------------] Game Elements [------------------------<-",
|
||||
|
||||
|
@ -876,6 +876,9 @@
|
|||
"create.schematicannon.status.schematicNotPlaced": "Bauplan nicht positioniert",
|
||||
"create.schematicannon.status.schematicExpired": "Bauplandatei abgelaufen",
|
||||
|
||||
"create.materialChecklist": "UNLOCALIZED: Material Checklist",
|
||||
"create.materialChecklist.blocksNotLoaded": "UNLOCALIZED: * Disclaimer *\n\nMaterial List may be inaccurate due to relevant chunks not being loaded.",
|
||||
|
||||
"create.gui.filter.deny_list": "UNLOCALIZED: Deny-List",
|
||||
"create.gui.filter.deny_list.description": "UNLOCALIZED: Items pass if they do NOT match any of the above. An empty Deny-List accepts everything.",
|
||||
"create.gui.filter.allow_list": "UNLOCALIZED: Allow-List",
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
{
|
||||
"_": "Missing Localizations: 779",
|
||||
"_": "Missing Localizations: 781",
|
||||
|
||||
"_": "->------------------------] Game Elements [------------------------<-",
|
||||
|
||||
|
@ -876,6 +876,9 @@
|
|||
"create.schematicannon.status.schematicNotPlaced": "Schéma non déployé",
|
||||
"create.schematicannon.status.schematicExpired": "Fichier de schéma arrivé à expiration",
|
||||
|
||||
"create.materialChecklist": "UNLOCALIZED: Material Checklist",
|
||||
"create.materialChecklist.blocksNotLoaded": "UNLOCALIZED: * Disclaimer *\n\nMaterial List may be inaccurate due to relevant chunks not being loaded.",
|
||||
|
||||
"create.gui.filter.deny_list": "Liste noire",
|
||||
"create.gui.filter.deny_list.description": "Les articles réussissent s'ils ne correspondent à AUCUN des éléments ci-dessus. Une liste noire vide accepte tout.",
|
||||
"create.gui.filter.allow_list": "Liste blanche",
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
{
|
||||
"_": "Missing Localizations: 763",
|
||||
"_": "Missing Localizations: 765",
|
||||
|
||||
"_": "->------------------------] Game Elements [------------------------<-",
|
||||
|
||||
|
@ -876,6 +876,9 @@
|
|||
"create.schematicannon.status.schematicNotPlaced": "Schematica Non Implementata",
|
||||
"create.schematicannon.status.schematicExpired": "File Schematica Scaduto",
|
||||
|
||||
"create.materialChecklist": "UNLOCALIZED: Material Checklist",
|
||||
"create.materialChecklist.blocksNotLoaded": "UNLOCALIZED: * Disclaimer *\n\nMaterial List may be inaccurate due to relevant chunks not being loaded.",
|
||||
|
||||
"create.gui.filter.deny_list": "Lista Nera",
|
||||
"create.gui.filter.deny_list.description": "Gli oggetti passano se NON corrispondono a nessuno dei precedenti. Una Lista Nera vuota accetta tutto.",
|
||||
"create.gui.filter.allow_list": "Lista Bianca",
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
{
|
||||
"_": "Missing Localizations: 762",
|
||||
"_": "Missing Localizations: 764",
|
||||
|
||||
"_": "->------------------------] Game Elements [------------------------<-",
|
||||
|
||||
|
@ -876,6 +876,9 @@
|
|||
"create.schematicannon.status.schematicNotPlaced": "配置されていない概略図です",
|
||||
"create.schematicannon.status.schematicExpired": "概略図ファイルが期限切れです",
|
||||
|
||||
"create.materialChecklist": "UNLOCALIZED: Material Checklist",
|
||||
"create.materialChecklist.blocksNotLoaded": "UNLOCALIZED: * Disclaimer *\n\nMaterial List may be inaccurate due to relevant chunks not being loaded.",
|
||||
|
||||
"create.gui.filter.deny_list": "ブラックリスト",
|
||||
"create.gui.filter.deny_list.description": "上記のいずれにも一致しない場合、アイテムは通り抜けます。 空のブラックリストはすべてを受け入れます。",
|
||||
"create.gui.filter.allow_list": "ホワイトリスト",
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
{
|
||||
"_": "Missing Localizations: 763",
|
||||
"_": "Missing Localizations: 765",
|
||||
|
||||
"_": "->------------------------] Game Elements [------------------------<-",
|
||||
|
||||
|
@ -876,6 +876,9 @@
|
|||
"create.schematicannon.status.schematicNotPlaced": "청사진이 전개되지 않음",
|
||||
"create.schematicannon.status.schematicExpired": "청사진 파일이 제거됨",
|
||||
|
||||
"create.materialChecklist": "UNLOCALIZED: Material Checklist",
|
||||
"create.materialChecklist.blocksNotLoaded": "UNLOCALIZED: * Disclaimer *\n\nMaterial List may be inaccurate due to relevant chunks not being loaded.",
|
||||
|
||||
"create.gui.filter.deny_list": "블랙리스트",
|
||||
"create.gui.filter.deny_list.description": "위 목록에 맞지않는 아이템이면 통과합니다. 빈 블랙리스트는 모두 통과시킵니다.",
|
||||
"create.gui.filter.allow_list": "화이트리스트",
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
{
|
||||
"_": "Missing Localizations: 1069",
|
||||
"_": "Missing Localizations: 1071",
|
||||
|
||||
"_": "->------------------------] Game Elements [------------------------<-",
|
||||
|
||||
|
@ -876,6 +876,9 @@
|
|||
"create.schematicannon.status.schematicNotPlaced": "Bouwtekening niet geplaatst",
|
||||
"create.schematicannon.status.schematicExpired": "Bouwtekening verlopen",
|
||||
|
||||
"create.materialChecklist": "UNLOCALIZED: Material Checklist",
|
||||
"create.materialChecklist.blocksNotLoaded": "UNLOCALIZED: * Disclaimer *\n\nMaterial List may be inaccurate due to relevant chunks not being loaded.",
|
||||
|
||||
"create.gui.filter.deny_list": "UNLOCALIZED: Deny-List",
|
||||
"create.gui.filter.deny_list.description": "UNLOCALIZED: Items pass if they do NOT match any of the above. An empty Deny-List accepts everything.",
|
||||
"create.gui.filter.allow_list": "UNLOCALIZED: Allow-List",
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
{
|
||||
"_": "Missing Localizations: 1135",
|
||||
"_": "Missing Localizations: 1137",
|
||||
|
||||
"_": "->------------------------] Game Elements [------------------------<-",
|
||||
|
||||
|
@ -876,6 +876,9 @@
|
|||
"create.schematicannon.status.schematicNotPlaced": "Esquema não Colocado",
|
||||
"create.schematicannon.status.schematicExpired": "Arquivo de Esquema Expirado",
|
||||
|
||||
"create.materialChecklist": "UNLOCALIZED: Material Checklist",
|
||||
"create.materialChecklist.blocksNotLoaded": "UNLOCALIZED: * Disclaimer *\n\nMaterial List may be inaccurate due to relevant chunks not being loaded.",
|
||||
|
||||
"create.gui.filter.deny_list": "UNLOCALIZED: Deny-List",
|
||||
"create.gui.filter.deny_list.description": "UNLOCALIZED: Items pass if they do NOT match any of the above. An empty Deny-List accepts everything.",
|
||||
"create.gui.filter.allow_list": "UNLOCALIZED: Allow-List",
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
{
|
||||
"_": "Missing Localizations: 436",
|
||||
"_": "Missing Localizations: 438",
|
||||
|
||||
"_": "->------------------------] Game Elements [------------------------<-",
|
||||
|
||||
|
@ -876,6 +876,9 @@
|
|||
"create.schematicannon.status.schematicNotPlaced": "Схема не загружена",
|
||||
"create.schematicannon.status.schematicExpired": "Срок действия файла схемы истек",
|
||||
|
||||
"create.materialChecklist": "UNLOCALIZED: Material Checklist",
|
||||
"create.materialChecklist.blocksNotLoaded": "UNLOCALIZED: * Disclaimer *\n\nMaterial List may be inaccurate due to relevant chunks not being loaded.",
|
||||
|
||||
"create.gui.filter.deny_list": "Чёрный список",
|
||||
"create.gui.filter.deny_list.description": "Предметы проходят, если они не соответствуют ни одному из вышеперечисленных. Пустой черный список принимает все.",
|
||||
"create.gui.filter.allow_list": "Белый список",
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
{
|
||||
"_": "Missing Localizations: 445",
|
||||
"_": "Missing Localizations: 446",
|
||||
|
||||
"_": "->------------------------] Game Elements [------------------------<-",
|
||||
|
||||
|
@ -876,6 +876,9 @@
|
|||
"create.schematicannon.status.schematicNotPlaced": "蓝图未部署",
|
||||
"create.schematicannon.status.schematicExpired": "蓝图文件已过期",
|
||||
|
||||
"create.materialChecklist": "材料清单",
|
||||
"create.materialChecklist.blocksNotLoaded": "UNLOCALIZED: * Disclaimer *\n\nMaterial List may be inaccurate due to relevant chunks not being loaded.",
|
||||
|
||||
"create.gui.filter.deny_list": "黑名单",
|
||||
"create.gui.filter.deny_list.description": "只通过不在黑名单中的物品,如果黑名单为空,所有物品都可以通过",
|
||||
"create.gui.filter.allow_list": "白名单",
|
||||
|
|
|
@ -1,8 +1,9 @@
|
|||
package com.simibubi.create.content.logistics;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.IdentityHashMap;
|
||||
import java.util.Iterator;
|
||||
import java.util.LinkedHashSet;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
|
@ -20,14 +21,24 @@ import net.minecraft.world.World;
|
|||
|
||||
public class RedstoneLinkNetworkHandler {
|
||||
|
||||
static Map<IWorld, Map<Pair<Frequency, Frequency>, Set<LinkBehaviour>>> connections = new HashMap<>();
|
||||
static final Map<IWorld, Map<Pair<Frequency, Frequency>, Set<LinkBehaviour>>> connections = new IdentityHashMap<>();
|
||||
|
||||
public static class Frequency {
|
||||
public static final Frequency EMPTY = new Frequency(ItemStack.EMPTY);
|
||||
private static final Map<Item, Frequency> simpleFrequencies = new IdentityHashMap<>();
|
||||
private ItemStack stack;
|
||||
private Item item;
|
||||
private int color;
|
||||
|
||||
public Frequency(ItemStack stack) {
|
||||
public static Frequency of(ItemStack stack) {
|
||||
if (stack.isEmpty())
|
||||
return EMPTY;
|
||||
if (!stack.hasTag())
|
||||
return simpleFrequencies.computeIfAbsent(stack.getItem(), $ -> new Frequency(stack));
|
||||
return new Frequency(stack);
|
||||
}
|
||||
|
||||
private Frequency(ItemStack stack) {
|
||||
this.stack = stack;
|
||||
item = stack.getItem();
|
||||
CompoundNBT displayTag = stack.getChildTag("display");
|
||||
|
@ -35,7 +46,7 @@ public class RedstoneLinkNetworkHandler {
|
|||
}
|
||||
|
||||
public ItemStack getStack() {
|
||||
return stack.copy();
|
||||
return stack;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -45,6 +56,8 @@ public class RedstoneLinkNetworkHandler {
|
|||
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
if (this == obj)
|
||||
return true;
|
||||
return obj instanceof Frequency ? ((Frequency) obj).item == item && ((Frequency) obj).color == color
|
||||
: false;
|
||||
}
|
||||
|
@ -65,7 +78,7 @@ public class RedstoneLinkNetworkHandler {
|
|||
Map<Pair<Frequency, Frequency>, Set<LinkBehaviour>> networksInWorld = networksIn(actor.getWorld());
|
||||
Pair<Frequency, Frequency> key = actor.getNetworkKey();
|
||||
if (!networksInWorld.containsKey(key))
|
||||
networksInWorld.put(key, new HashSet<>());
|
||||
networksInWorld.put(key, new LinkedHashSet<>());
|
||||
return networksInWorld.get(key);
|
||||
}
|
||||
|
||||
|
@ -105,31 +118,26 @@ public class RedstoneLinkNetworkHandler {
|
|||
}
|
||||
if (!withinRange(actor, other))
|
||||
continue;
|
||||
power = Math.max(other.getTransmittedStrength(), power);
|
||||
if (power == 15)
|
||||
break;
|
||||
|
||||
if (power < 15)
|
||||
power = Math.max(other.getTransmittedStrength(), power);
|
||||
}
|
||||
|
||||
// fix one-to-one loading order problem
|
||||
if(actor.isListening()){
|
||||
if (actor.isListening()) {
|
||||
actor.newPosition = true;
|
||||
actor.updateReceiver(power);
|
||||
}
|
||||
|
||||
for (Iterator<LinkBehaviour> iterator = network.iterator(); iterator.hasNext();) {
|
||||
LinkBehaviour other = iterator.next();
|
||||
if (other.tileEntity.isRemoved()) {
|
||||
iterator.remove();
|
||||
continue;
|
||||
}
|
||||
if (!withinRange(actor, other))
|
||||
continue;
|
||||
if (other.isListening())
|
||||
for (LinkBehaviour other : network) {
|
||||
if (other != actor && other.isListening() && withinRange(actor, other))
|
||||
other.updateReceiver(power);
|
||||
}
|
||||
}
|
||||
|
||||
public static boolean withinRange(LinkBehaviour from, LinkBehaviour to) {
|
||||
if (from == to)
|
||||
return true;
|
||||
return from.getPos().withinDistance(to.getPos(), AllConfigs.SERVER.logistics.linkRange.get());
|
||||
}
|
||||
|
||||
|
|
|
@ -2,14 +2,13 @@ package com.simibubi.create.content.schematics;
|
|||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
import java.util.Map;
|
||||
|
||||
import com.google.common.collect.Sets;
|
||||
import com.simibubi.create.content.schematics.ItemRequirement.ItemUseType;
|
||||
import com.simibubi.create.foundation.utility.Lang;
|
||||
|
||||
import it.unimi.dsi.fastutil.objects.Object2IntArrayMap;
|
||||
import it.unimi.dsi.fastutil.objects.Object2IntMap;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.item.Items;
|
||||
|
@ -17,6 +16,8 @@ import net.minecraft.nbt.CompoundNBT;
|
|||
import net.minecraft.nbt.ListNBT;
|
||||
import net.minecraft.nbt.StringNBT;
|
||||
import net.minecraft.util.text.ITextComponent;
|
||||
import net.minecraft.util.text.StringTextComponent;
|
||||
import net.minecraft.util.text.Style;
|
||||
import net.minecraft.util.text.TextFormatting;
|
||||
import net.minecraft.util.text.TranslationTextComponent;
|
||||
|
||||
|
@ -24,17 +25,11 @@ public class MaterialChecklist {
|
|||
|
||||
public static final int MAX_ENTRIES_PER_PAGE = 5;
|
||||
|
||||
public Map<Item, Integer> gathered;
|
||||
public Map<Item, Integer> required;
|
||||
public Map<Item, Integer> damageRequired;
|
||||
public Object2IntMap<Item> gathered = new Object2IntArrayMap<>();
|
||||
public Object2IntMap<Item> required = new Object2IntArrayMap<>();
|
||||
public Object2IntMap<Item> damageRequired = new Object2IntArrayMap<>();
|
||||
public boolean blocksNotLoaded;
|
||||
|
||||
public MaterialChecklist() {
|
||||
required = new HashMap<>();
|
||||
damageRequired = new HashMap<>();
|
||||
gathered = new HashMap<>();
|
||||
}
|
||||
|
||||
public void warnBlockNotLoaded() {
|
||||
blocksNotLoaded = true;
|
||||
}
|
||||
|
@ -53,12 +48,12 @@ public class MaterialChecklist {
|
|||
}
|
||||
}
|
||||
|
||||
private void putOrIncrement(Map<Item, Integer> map, ItemStack stack) {
|
||||
private void putOrIncrement(Object2IntMap<Item> map, ItemStack stack) {
|
||||
Item item = stack.getItem();
|
||||
if (item == Items.AIR)
|
||||
return;
|
||||
if (map.containsKey(item))
|
||||
map.put(item, map.get(item) + stack.getCount());
|
||||
map.put(item, map.getInt(item) + stack.getCount());
|
||||
else
|
||||
map.put(item, stack.getCount());
|
||||
}
|
||||
|
@ -67,7 +62,7 @@ public class MaterialChecklist {
|
|||
Item item = stack.getItem();
|
||||
if (required.containsKey(item) || damageRequired.containsKey(item))
|
||||
if (gathered.containsKey(item))
|
||||
gathered.put(item, gathered.get(item) + stack.getCount());
|
||||
gathered.put(item, gathered.getInt(item) + stack.getCount());
|
||||
else
|
||||
gathered.put(item, stack.getCount());
|
||||
}
|
||||
|
@ -79,31 +74,30 @@ public class MaterialChecklist {
|
|||
ListNBT pages = new ListNBT();
|
||||
|
||||
int itemsWritten = 0;
|
||||
StringBuilder string = new StringBuilder("{\"text\":\"");
|
||||
ITextComponent textComponent;
|
||||
|
||||
if (blocksNotLoaded) {
|
||||
string.append("\n" + TextFormatting.RED + "* Disclaimer *\n\n");
|
||||
string.append("Material List may be inaccurate due to relevant chunks not being loaded.");
|
||||
string.append("\"}");
|
||||
pages.add(StringNBT.of(string.toString()));
|
||||
string = new StringBuilder("{\"text\":\"");
|
||||
textComponent = new StringTextComponent("\n" + TextFormatting.RED);
|
||||
textComponent = textComponent
|
||||
.appendSibling(Lang.createTranslationTextComponent(
|
||||
"materialChecklist.blocksNotLoaded"));
|
||||
pages.add(StringNBT
|
||||
.of(ITextComponent.Serializer.toJson(textComponent)));
|
||||
}
|
||||
|
||||
List<Item> keys = new ArrayList<>(Sets.union(required.keySet(), damageRequired.keySet()));
|
||||
Collections.sort(keys, (item1, item2) -> {
|
||||
Locale locale = Locale.ENGLISH;
|
||||
String name1 =
|
||||
new TranslationTextComponent(((Item) item1).getTranslationKey()).getFormattedText().toLowerCase(locale);
|
||||
String name2 =
|
||||
new TranslationTextComponent(((Item) item2).getTranslationKey()).getFormattedText().toLowerCase(locale);
|
||||
String name1 = item1.getRegistryName().getPath();
|
||||
String name2 = item2.getRegistryName().getPath();
|
||||
return name1.compareTo(name2);
|
||||
});
|
||||
|
||||
textComponent = new StringTextComponent("");
|
||||
List<Item> completed = new ArrayList<>();
|
||||
for (Item item : keys) {
|
||||
int amount = getRequiredAmount(item);
|
||||
if (gathered.containsKey(item))
|
||||
amount -= gathered.get(item);
|
||||
amount -= gathered.getInt(item);
|
||||
|
||||
if (amount <= 0) {
|
||||
completed.add(item);
|
||||
|
@ -112,59 +106,63 @@ public class MaterialChecklist {
|
|||
|
||||
if (itemsWritten == MAX_ENTRIES_PER_PAGE) {
|
||||
itemsWritten = 0;
|
||||
string.append("\"}");
|
||||
pages.add(StringNBT.of(string.toString()));
|
||||
string = new StringBuilder("{\"text\":\"");
|
||||
pages.add(StringNBT
|
||||
.of(ITextComponent.Serializer.toJson(textComponent)));
|
||||
textComponent = new StringTextComponent("");
|
||||
}
|
||||
|
||||
itemsWritten++;
|
||||
string.append(unfinishedEntry(new ItemStack(item), amount));
|
||||
textComponent
|
||||
.appendSibling(entry(new ItemStack(item), amount, true));
|
||||
}
|
||||
|
||||
for (Item item : completed) {
|
||||
if (itemsWritten == MAX_ENTRIES_PER_PAGE) {
|
||||
itemsWritten = 0;
|
||||
string.append("\"}");
|
||||
pages.add(StringNBT.of(string.toString()));
|
||||
string = new StringBuilder("{\"text\":\"");
|
||||
pages.add(StringNBT
|
||||
.of(ITextComponent.Serializer.toJson(textComponent)));
|
||||
textComponent = new StringTextComponent("");
|
||||
}
|
||||
|
||||
itemsWritten++;
|
||||
string.append(gatheredEntry(new ItemStack(item), getRequiredAmount(item)));
|
||||
textComponent.appendSibling(
|
||||
entry(new ItemStack(item), getRequiredAmount(item), false));
|
||||
}
|
||||
|
||||
string.append("\"}");
|
||||
pages.add(StringNBT.of(string.toString()));
|
||||
pages.add(
|
||||
StringNBT.of(ITextComponent.Serializer.toJson(textComponent)));
|
||||
|
||||
tag.put("pages", pages);
|
||||
tag.putString("author", "Schematicannon");
|
||||
tag.putString("title", TextFormatting.BLUE + "Material Checklist");
|
||||
textComponent = Lang.createTranslationTextComponent("materialChecklist")
|
||||
.setStyle(new Style().setColor(TextFormatting.BLUE)
|
||||
.setItalic(Boolean.FALSE));
|
||||
book.getOrCreateChildTag("display").putString("Name",
|
||||
ITextComponent.Serializer.toJson(textComponent));
|
||||
book.setTag(tag);
|
||||
|
||||
return book;
|
||||
}
|
||||
|
||||
public Integer getRequiredAmount(Item item) {
|
||||
public int getRequiredAmount(Item item) {
|
||||
int amount = required.getOrDefault(item, 0);
|
||||
if (damageRequired.containsKey(item))
|
||||
amount += Math.ceil(damageRequired.get(item) / (float) new ItemStack(item).getMaxDamage());
|
||||
amount += Math.ceil(damageRequired.getInt(item) / (float) new ItemStack(item).getMaxDamage());
|
||||
return amount;
|
||||
}
|
||||
|
||||
private String gatheredEntry(ItemStack item, int amount) {
|
||||
private ITextComponent entry(ItemStack item, int amount, boolean unfinished) {
|
||||
int stacks = amount / 64;
|
||||
int remainder = amount % 64;
|
||||
ITextComponent tc = new TranslationTextComponent(item.getTranslationKey());
|
||||
return TextFormatting.DARK_GREEN + tc.getFormattedText() + " \\u2714\n x" + amount + TextFormatting.GRAY + " | "
|
||||
+ stacks + "\\u25A4 +" + remainder + "\n";
|
||||
}
|
||||
|
||||
private String unfinishedEntry(ItemStack item, int amount) {
|
||||
int stacks = amount / 64;
|
||||
int remainder = amount % 64;
|
||||
ITextComponent tc = new TranslationTextComponent(item.getTranslationKey());
|
||||
return TextFormatting.BLUE + tc.getFormattedText() + "\n x" + amount + TextFormatting.GRAY + " | " + stacks
|
||||
+ "\\u25A4 +" + remainder + "\n";
|
||||
ITextComponent tc = new TranslationTextComponent(
|
||||
item.getTranslationKey());
|
||||
if (!unfinished)
|
||||
tc.appendText(" \u2714");
|
||||
tc.applyTextStyle(
|
||||
unfinished ? TextFormatting.BLUE : TextFormatting.DARK_GREEN);
|
||||
return tc.appendText("\n" + TextFormatting.BLACK + " x" + amount
|
||||
+ TextFormatting.GRAY + " | " + stacks + "\u25A4 +" + remainder + "\n");
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -162,8 +162,8 @@ public class LangMerger implements IDataProvider {
|
|||
if (key.endsWith(".tooltip"))
|
||||
return true;
|
||||
|
||||
key = new String(key).replaceFirst("\\.", "");
|
||||
previousKey = new String(previousKey).replaceFirst("\\.", "");
|
||||
key = key.replaceFirst("\\.", "");
|
||||
previousKey = previousKey.replaceFirst("\\.", "");
|
||||
|
||||
String[] split = key.split("\\.");
|
||||
String[] split2 = previousKey.split("\\.");
|
||||
|
@ -243,7 +243,7 @@ public class LangMerger implements IDataProvider {
|
|||
}
|
||||
|
||||
private class LangEntry {
|
||||
static final String ENTRY_FORMAT = "\t\"%s\": \"%s\",\n";
|
||||
static final String ENTRY_FORMAT = "\t\"%s\": %s,\n";
|
||||
|
||||
private String key;
|
||||
private String value;
|
||||
|
@ -255,7 +255,7 @@ public class LangMerger implements IDataProvider {
|
|||
|
||||
@Override
|
||||
public String toString() {
|
||||
return String.format(ENTRY_FORMAT, key, value);
|
||||
return String.format(ENTRY_FORMAT, key, GSON.toJson(value, String.class));
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -39,8 +39,8 @@ public class LinkBehaviour extends TileEntityBehaviour {
|
|||
|
||||
protected LinkBehaviour(SmartTileEntity te, Pair<ValueBoxTransform, ValueBoxTransform> slots) {
|
||||
super(te);
|
||||
frequencyFirst = new Frequency(ItemStack.EMPTY);
|
||||
frequencyLast = new Frequency(ItemStack.EMPTY);
|
||||
frequencyFirst = Frequency.EMPTY;
|
||||
frequencyLast = Frequency.EMPTY;
|
||||
firstSlot = slots.getLeft();
|
||||
secondSlot = slots.getRight();
|
||||
textShift = Vec3d.ZERO;
|
||||
|
@ -133,8 +133,8 @@ public class LinkBehaviour extends TileEntityBehaviour {
|
|||
newPosition = positionInTag != positionKey;
|
||||
|
||||
super.read(nbt, clientPacket);
|
||||
frequencyFirst = new Frequency(ItemStack.read(nbt.getCompound("FrequencyFirst")));
|
||||
frequencyLast = new Frequency(ItemStack.read(nbt.getCompound("FrequencyLast")));
|
||||
frequencyFirst = Frequency.of(ItemStack.read(nbt.getCompound("FrequencyFirst")));
|
||||
frequencyLast = Frequency.of(ItemStack.read(nbt.getCompound("FrequencyLast")));
|
||||
}
|
||||
|
||||
public void setFrequency(boolean first, ItemStack stack) {
|
||||
|
@ -148,9 +148,9 @@ public class LinkBehaviour extends TileEntityBehaviour {
|
|||
getHandler().removeFromNetwork(this);
|
||||
|
||||
if (first)
|
||||
frequencyFirst = new Frequency(stack);
|
||||
frequencyFirst = Frequency.of(stack);
|
||||
else
|
||||
frequencyLast = new Frequency(stack);
|
||||
frequencyLast = Frequency.of(stack);
|
||||
|
||||
if (!changed)
|
||||
return;
|
||||
|
|
|
@ -314,7 +314,10 @@
|
|||
"create.schematicannon.status.schematicInvalid": "Schematic Invalid",
|
||||
"create.schematicannon.status.schematicNotPlaced": "Schematic Not Deployed",
|
||||
"create.schematicannon.status.schematicExpired": "Schematic File Expired",
|
||||
|
||||
|
||||
"create.materialChecklist": "Material Checklist",
|
||||
"create.materialChecklist.blocksNotLoaded": "* Disclaimer *\n\nMaterial List may be inaccurate due to relevant chunks not being loaded.",
|
||||
|
||||
"create.gui.filter.deny_list": "Deny-List",
|
||||
"create.gui.filter.deny_list.description": "Items pass if they do NOT match any of the above. An empty Deny-List accepts everything.",
|
||||
"create.gui.filter.allow_list": "Allow-List",
|
||||
|
|
|
@ -743,7 +743,9 @@
|
|||
"create.schematicannon.status.schematicInvalid": "蓝图无效",
|
||||
"create.schematicannon.status.schematicNotPlaced": "蓝图未部署",
|
||||
"create.schematicannon.status.schematicExpired": "蓝图文件已过期",
|
||||
|
||||
|
||||
"create.materialChecklist": "材料清单",
|
||||
|
||||
"create.gui.filter.deny_list": "黑名单",
|
||||
"create.gui.filter.deny_list.description": "只通过不在黑名单中的物品,如果黑名单为空,所有物品都可以通过",
|
||||
"create.gui.filter.allow_list": "白名单",
|
||||
|
|
Loading…
Reference in a new issue