Skip to content

Commit

Permalink
Fix holder class name in common module for key mapping
Browse files Browse the repository at this point in the history
  • Loading branch information
HyCraftHD committed Jul 27, 2023
1 parent b853c6b commit f727ab5
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -11,28 +11,28 @@

public abstract class CommonKeyMappingRegister implements KeyMappingRegister {

protected final Map<ForgeKeyMappingSimpleEntry, Supplier<KeyMapping>> entries;
protected final Map<KeyMappingLazyEntry, Supplier<KeyMapping>> entries;

protected CommonKeyMappingRegister() {
entries = new LinkedHashMap<>();
}

@Override
public LazyEntry<KeyMapping> register(Supplier<KeyMapping> supplier) {
final ForgeKeyMappingSimpleEntry entry = new ForgeKeyMappingSimpleEntry();
final KeyMappingLazyEntry entry = new KeyMappingLazyEntry();
entries.put(entry, supplier);
return entry;
}

protected void updateReference(ForgeKeyMappingSimpleEntry entry, KeyMapping key) {
protected void updateReference(KeyMappingLazyEntry entry, KeyMapping key) {
entry.updateReference(key);
}

public static class ForgeKeyMappingSimpleEntry implements LazyEntry<KeyMapping> {
public static class KeyMappingLazyEntry implements LazyEntry<KeyMapping> {

private KeyMapping value;

ForgeKeyMappingSimpleEntry() {
KeyMappingLazyEntry() {
}

void updateReference(KeyMapping key) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ public class FabricKeyMappingRegister extends CommonKeyMappingRegister {

@Override
public void register() {
for (final Entry<ForgeKeyMappingSimpleEntry, Supplier<KeyMapping>> entry : entries.entrySet()) {
final ForgeKeyMappingSimpleEntry registryEntry = entry.getKey();
for (final Entry<KeyMappingLazyEntry, Supplier<KeyMapping>> entry : entries.entrySet()) {
final KeyMappingLazyEntry registryEntry = entry.getKey();
final KeyMapping keyMapping = entry.getValue().get();
KeyBindingHelper.registerKeyBinding(keyMapping);
updateReference(registryEntry, keyMapping);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@ public void register() {
}

private void registerKeyMapping(RegisterKeyMappingsEvent event) {
for (final Entry<ForgeKeyMappingSimpleEntry, Supplier<KeyMapping>> entry : entries.entrySet()) {
final ForgeKeyMappingSimpleEntry registryEntry = entry.getKey();
for (final Entry<KeyMappingLazyEntry, Supplier<KeyMapping>> entry : entries.entrySet()) {
final KeyMappingLazyEntry registryEntry = entry.getKey();
final KeyMapping keyMapping = entry.getValue().get();
event.register(keyMapping);
updateReference(registryEntry, keyMapping);
Expand Down

0 comments on commit f727ab5

Please sign in to comment.