-
-
Notifications
You must be signed in to change notification settings - Fork 17
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
…fting-monitor Wireless Autocrafting Monitor
- Loading branch information
Showing
46 changed files
with
881 additions
and
77 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -17,4 +17,6 @@ public interface TaskStatusProvider { | |
void cancel(TaskId taskId); | ||
|
||
void cancelAll(); | ||
|
||
void testUpdate(); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
11 changes: 11 additions & 0 deletions
11
.../java/com/refinedmods/refinedstorage/common/autocrafting/monitor/AutocraftingMonitor.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
package com.refinedmods.refinedstorage.common.autocrafting.monitor; | ||
|
||
import com.refinedmods.refinedstorage.api.autocrafting.status.TaskStatusProvider; | ||
|
||
interface AutocraftingMonitor extends TaskStatusProvider { | ||
void addWatcher(AutocraftingMonitorWatcher watcher); | ||
|
||
void removeWatcher(AutocraftingMonitorWatcher watcher); | ||
|
||
boolean isAutocraftingMonitorActive(); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
20 changes: 1 addition & 19 deletions
20
...inedmods/refinedstorage/common/autocrafting/monitor/AutocraftingMonitorContainerMenu.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,48 +1,30 @@ | ||
package com.refinedmods.refinedstorage.common.autocrafting.monitor; | ||
|
||
import com.refinedmods.refinedstorage.api.autocrafting.status.TaskStatusProvider; | ||
import com.refinedmods.refinedstorage.common.content.Menus; | ||
import com.refinedmods.refinedstorage.common.support.RedstoneMode; | ||
import com.refinedmods.refinedstorage.common.support.containermenu.ClientProperty; | ||
import com.refinedmods.refinedstorage.common.support.containermenu.PropertyTypes; | ||
import com.refinedmods.refinedstorage.common.support.containermenu.ServerProperty; | ||
|
||
import javax.annotation.Nullable; | ||
|
||
import net.minecraft.world.entity.player.Inventory; | ||
import net.minecraft.world.entity.player.Player; | ||
|
||
public class AutocraftingMonitorContainerMenu extends AbstractAutocraftingMonitorContainerMenu { | ||
@Nullable | ||
private final AutocraftingMonitorBlockEntity autocraftingMonitor; | ||
|
||
public AutocraftingMonitorContainerMenu(final int syncId, | ||
final Inventory playerInventory, | ||
final AutocraftingMonitorData data) { | ||
super(Menus.INSTANCE.getAutocraftingMonitor(), syncId, playerInventory, data); | ||
registerProperty(new ClientProperty<>(PropertyTypes.REDSTONE_MODE, RedstoneMode.IGNORE)); | ||
this.autocraftingMonitor = null; | ||
} | ||
|
||
AutocraftingMonitorContainerMenu(final int syncId, | ||
final Player player, | ||
final TaskStatusProvider taskStatusProvider, | ||
final AutocraftingMonitorBlockEntity autocraftingMonitor) { | ||
super(Menus.INSTANCE.getAutocraftingMonitor(), syncId, player, taskStatusProvider); | ||
super(Menus.INSTANCE.getAutocraftingMonitor(), syncId, player, autocraftingMonitor); | ||
registerProperty(new ServerProperty<>( | ||
PropertyTypes.REDSTONE_MODE, | ||
autocraftingMonitor::getRedstoneMode, | ||
autocraftingMonitor::setRedstoneMode | ||
)); | ||
this.autocraftingMonitor = autocraftingMonitor; | ||
autocraftingMonitor.addWatcher(this); | ||
} | ||
|
||
@Override | ||
public void removed(final Player removedPlayer) { | ||
super.removed(removedPlayer); | ||
if (autocraftingMonitor != null) { | ||
autocraftingMonitor.removeWatcher(this); | ||
} | ||
} | ||
} |
Oops, something went wrong.