-
Notifications
You must be signed in to change notification settings - Fork 624
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
33 changed files
with
395 additions
and
161 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
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
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 |
---|---|---|
@@ -0,0 +1,54 @@ | ||
package appeng.helpers; | ||
|
||
import javax.annotation.Nullable; | ||
|
||
import net.minecraft.resources.ResourceLocation; | ||
import net.minecraft.world.item.ItemStack; | ||
|
||
import appeng.api.inventories.InternalInventory; | ||
import appeng.api.networking.security.IActionHost; | ||
import appeng.api.storage.ITerminalHost; | ||
import appeng.util.inv.InternalInventoryHost; | ||
|
||
public interface IPatternTerminalHost extends ITerminalHost, IActionHost, InternalInventoryHost { | ||
|
||
/** | ||
* Identifies the sub-inventory used by the pattern terminal to encode the inputs of crafting or processing | ||
* patterns. | ||
*/ | ||
ResourceLocation INV_CRAFTING = new ResourceLocation( | ||
"appliedenergistics2:pattern_terminal_crafting"); | ||
|
||
/** | ||
* Identifies the sub-inventory used by the pattern terminal to encode the outputs of crafting or processing | ||
* patterns. | ||
*/ | ||
ResourceLocation INV_OUTPUT = new ResourceLocation( | ||
"appliedenergistics2:pattern_terminal_output"); | ||
|
||
@Nullable | ||
InternalInventory getSubInventory(ResourceLocation id); | ||
|
||
boolean isCraftingRecipe(); | ||
|
||
void setCraftingRecipe(final boolean craftingMode); | ||
|
||
boolean isSubstitution(); | ||
|
||
void setSubstitution(final boolean canSubstitute); | ||
|
||
boolean isFluidSubstitution(); | ||
|
||
void setFluidSubstitution(boolean canSubstitute); | ||
|
||
default void fixCraftingRecipes() { | ||
if (this.isCraftingRecipe()) { | ||
for (int x = 0; x < this.getSubInventory(INV_CRAFTING).size(); x++) { | ||
final ItemStack is = this.getSubInventory(INV_CRAFTING).getStackInSlot(x); | ||
if (!is.isEmpty()) { | ||
is.setCount(1); | ||
} | ||
} | ||
} | ||
} | ||
} |
50 changes: 50 additions & 0 deletions
50
src/main/java/appeng/helpers/WirelessCraftingTerminalGuiObject.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,50 @@ | ||
package appeng.helpers; | ||
|
||
import org.jetbrains.annotations.Nullable; | ||
|
||
import net.minecraft.resources.ResourceLocation; | ||
import net.minecraft.server.level.ServerPlayer; | ||
import net.minecraft.world.entity.player.Player; | ||
import net.minecraft.world.item.ItemStack; | ||
|
||
import appeng.api.features.IWirelessTerminalHandler; | ||
import appeng.api.inventories.ISegmentedInventory; | ||
import appeng.api.inventories.InternalInventory; | ||
import appeng.parts.reporting.CraftingTerminalPart; | ||
import appeng.util.inv.AppEngInternalInventory; | ||
import appeng.util.inv.InternalInventoryHost; | ||
|
||
public class WirelessCraftingTerminalGuiObject extends WirelessTerminalGuiObject | ||
implements ISegmentedInventory, InternalInventoryHost {// TODO maybe implement InternalInventoryHost elsewhere? | ||
private final AppEngInternalInventory craftingGrid = new AppEngInternalInventory(this, 9); | ||
private final Player player; | ||
|
||
public WirelessCraftingTerminalGuiObject(IWirelessTerminalHandler wh, ItemStack is, Player ep, int inventorySlot) { | ||
super(wh, is, ep, inventorySlot); | ||
player = ep; | ||
} | ||
|
||
@Nullable | ||
@Override | ||
public InternalInventory getSubInventory(ResourceLocation id) { | ||
if (id.equals(CraftingTerminalPart.INV_CRAFTING)) { | ||
return craftingGrid; | ||
} else | ||
return null; | ||
} | ||
|
||
@Override | ||
public void saveChanges() {// TODO save the content of the crafting grid | ||
|
||
} | ||
|
||
@Override | ||
public void onChangeInventory(InternalInventory inv, int slot, ItemStack removedStack, ItemStack newStack) { | ||
|
||
} | ||
|
||
@Override | ||
public boolean isRemote() { | ||
return !(player instanceof ServerPlayer); | ||
} | ||
} |
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
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
Oops, something went wrong.