Open main menu
Home
Random
Log in
Settings
About Forge Community Wiki
Disclaimers
Forge Community Wiki
Search
Changes
← Older edit
Newer edit →
Capabilities
(view source)
Revision as of 10:00, 22 October 2021
100 bytes added
,
10:00, 22 October 2021
m
→Accessing a Capability
Line 314:
Line 314:
<syntaxhighlight lang="java">
<syntaxhighlight lang="java">
−
private final Map<Direction, LazyOptional<IEnergyStorage>> cache = new
HashMap
<>();
+
// note the use of EnumMap, which is much more performant than HashMap for enum keys
+
private final Map<Direction, LazyOptional<IEnergyStorage>> cache = new
EnumMap
<>(
Direction.class
);
private void sendPowerTo(int power, Direction direction) {
private void sendPowerTo(int power, Direction direction) {
Desht
1
edit