-
Notifications
You must be signed in to change notification settings - Fork 0
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
feat: wireless crafting grid
- Loading branch information
Showing
51 changed files
with
1,644 additions
and
50 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 was deleted.
Oops, something went wrong.
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,27 @@ | ||
plugins { | ||
id("refinedarchitect.common") | ||
} | ||
|
||
repositories { | ||
maven { | ||
url = uri("https://maven.pkg.github.com/refinedmods/refinedstorage2") | ||
credentials { | ||
username = "anything" | ||
password = "\u0067hp_oGjcDFCn8jeTzIj4Ke9pLoEVtpnZMP4VQgaX" | ||
} | ||
} | ||
} | ||
|
||
refinedarchitect { | ||
common() | ||
} | ||
|
||
base { | ||
archivesName.set("refinedstorage-quartz-arsenal-common") | ||
} | ||
|
||
val refinedstorageVersion: String by project | ||
|
||
dependencies { | ||
api("com.refinedmods.refinedstorage:refinedstorage-common:${refinedstorageVersion}") | ||
} |
24 changes: 24 additions & 0 deletions
24
...ava/com/refinedmods/refinedstorage/quartzarsenal/common/AbstractClientModInitializer.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,24 @@ | ||
package com.refinedmods.refinedstorage.quartzarsenal.common; | ||
|
||
import com.refinedmods.refinedstorage.common.api.RefinedStorageApi; | ||
|
||
import net.minecraft.client.KeyMapping; | ||
import net.minecraft.client.Minecraft; | ||
import net.minecraft.world.entity.player.Player; | ||
|
||
public abstract class AbstractClientModInitializer { | ||
protected static void handleInputEvents() { | ||
final Player player = Minecraft.getInstance().player; | ||
if (player == null) { | ||
return; | ||
} | ||
final KeyMapping openWirelessCraftingGrid = KeyMappings.INSTANCE.getOpenWirelessCraftingGrid(); | ||
while (openWirelessCraftingGrid != null && openWirelessCraftingGrid.consumeClick()) { | ||
RefinedStorageApi.INSTANCE.useSlotReferencedItem( | ||
player, | ||
Items.INSTANCE.getWirelessCraftingGrid(), | ||
Items.INSTANCE.getCreativeWirelessCraftingGrid() | ||
); | ||
} | ||
} | ||
} |
39 changes: 39 additions & 0 deletions
39
...main/java/com/refinedmods/refinedstorage/quartzarsenal/common/AbstractModInitializer.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,39 @@ | ||
package com.refinedmods.refinedstorage.quartzarsenal.common; | ||
|
||
import com.refinedmods.refinedstorage.common.content.ExtendedMenuTypeFactory; | ||
import com.refinedmods.refinedstorage.common.content.RegistryCallback; | ||
import com.refinedmods.refinedstorage.quartzarsenal.common.wirelesscraftinggrid.WirelessCraftingGridContainerMenu; | ||
import com.refinedmods.refinedstorage.quartzarsenal.common.wirelesscraftinggrid.WirelessCraftingGridData; | ||
import com.refinedmods.refinedstorage.quartzarsenal.common.wirelesscraftinggrid.WirelessCraftingGridState; | ||
|
||
import net.minecraft.core.component.DataComponentType; | ||
import net.minecraft.world.inventory.MenuType; | ||
import net.minecraft.world.item.ItemStack; | ||
|
||
import static com.refinedmods.refinedstorage.quartzarsenal.common.QuartzArsenalIdentifierUtil.createQuartzArsenalIdentifier; | ||
|
||
public abstract class AbstractModInitializer { | ||
protected static boolean allowComponentsUpdateAnimation(final ItemStack oldStack, final ItemStack newStack) { | ||
return oldStack.getItem() != newStack.getItem(); | ||
} | ||
|
||
protected final void registerMenus(final RegistryCallback<MenuType<?>> callback, | ||
final ExtendedMenuTypeFactory extendedMenuTypeFactory) { | ||
Menus.INSTANCE.setWirelessCraftingGrid(callback.register( | ||
ContentIds.WIRELESS_CRAFTING_GRID, | ||
() -> extendedMenuTypeFactory.create( | ||
WirelessCraftingGridContainerMenu::new, | ||
WirelessCraftingGridData.STREAM_CODEC | ||
) | ||
)); | ||
} | ||
|
||
protected final void registerDataComponents(final RegistryCallback<DataComponentType<?>> callback) { | ||
DataComponents.INSTANCE.setWirelessCraftingGridState(callback.register( | ||
createQuartzArsenalIdentifier("wireless_crafting_grid_state"), | ||
() -> DataComponentType.<WirelessCraftingGridState>builder() | ||
.persistent(WirelessCraftingGridState.CODEC) | ||
.networkSynchronized(WirelessCraftingGridState.STREAM_CODEC) | ||
.build())); | ||
} | ||
} |
15 changes: 0 additions & 15 deletions
15
...enal-common/src/main/java/com/refinedmods/refinedstorage/quartzarsenal/common/Common.java
This file was deleted.
Oops, something went wrong.
19 changes: 19 additions & 0 deletions
19
...enal-common/src/main/java/com/refinedmods/refinedstorage/quartzarsenal/common/Config.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,19 @@ | ||
package com.refinedmods.refinedstorage.quartzarsenal.common; | ||
|
||
public interface Config { | ||
WirelessCraftingGridEntry getWirelessCraftingGrid(); | ||
|
||
interface WirelessCraftingGridEntry { | ||
long getEnergyCapacity(); | ||
|
||
long getOpenEnergyUsage(); | ||
|
||
long getCraftingEnergyUsage(); | ||
|
||
long getAutocraftingEnergyUsage(); | ||
|
||
long getClearMatrixEnergyUsage(); | ||
|
||
long getRecipeTransferEnergyUsage(); | ||
} | ||
} |
15 changes: 15 additions & 0 deletions
15
...-common/src/main/java/com/refinedmods/refinedstorage/quartzarsenal/common/ContentIds.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,15 @@ | ||
package com.refinedmods.refinedstorage.quartzarsenal.common; | ||
|
||
import net.minecraft.resources.ResourceLocation; | ||
|
||
import static com.refinedmods.refinedstorage.quartzarsenal.common.QuartzArsenalIdentifierUtil.createQuartzArsenalIdentifier; | ||
|
||
public final class ContentIds { | ||
public static final ResourceLocation WIRELESS_CRAFTING_GRID = | ||
createQuartzArsenalIdentifier("wireless_crafting_grid"); | ||
public static final ResourceLocation CREATIVE_WIRELESS_CRAFTING_GRID = | ||
createQuartzArsenalIdentifier("creative_wireless_crafting_grid"); | ||
|
||
private ContentIds() { | ||
} | ||
} |
23 changes: 23 additions & 0 deletions
23
...ommon/src/main/java/com/refinedmods/refinedstorage/quartzarsenal/common/ContentNames.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,23 @@ | ||
package com.refinedmods.refinedstorage.quartzarsenal.common; | ||
|
||
import net.minecraft.network.chat.MutableComponent; | ||
|
||
import static com.refinedmods.refinedstorage.quartzarsenal.common.QuartzArsenalIdentifierUtil.QUARTZ_ARSENAL_MOD_ID; | ||
import static com.refinedmods.refinedstorage.quartzarsenal.common.QuartzArsenalIdentifierUtil.createQuartzArsenalTranslation; | ||
import static com.refinedmods.refinedstorage.quartzarsenal.common.QuartzArsenalIdentifierUtil.createQuartzArsenalTranslationKey; | ||
|
||
public final class ContentNames { | ||
public static final String MOD_TRANSLATION_KEY = "mod." + QUARTZ_ARSENAL_MOD_ID; | ||
public static final String OPEN_WIRELESS_CRAFTING_GRID_TRANSLATION_KEY = createQuartzArsenalTranslationKey( | ||
"key", "open_wireless_crafting_grid" | ||
); | ||
public static final MutableComponent WIRELESS_CRAFTING_GRID = createQuartzArsenalTranslation( | ||
"item", "wireless_crafting_grid" | ||
); | ||
public static final MutableComponent CREATIVE_WIRELESS_CRAFTING_GRID = createQuartzArsenalTranslation( | ||
"item", "creative_wireless_crafting_grid" | ||
); | ||
|
||
private ContentNames() { | ||
} | ||
} |
16 changes: 16 additions & 0 deletions
16
...c/main/java/com/refinedmods/refinedstorage/quartzarsenal/common/CreativeModeTabItems.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,16 @@ | ||
package com.refinedmods.refinedstorage.quartzarsenal.common; | ||
|
||
import java.util.function.Consumer; | ||
|
||
import net.minecraft.world.item.ItemStack; | ||
|
||
public final class CreativeModeTabItems { | ||
private CreativeModeTabItems() { | ||
} | ||
|
||
public static void addItems(final Consumer<ItemStack> consumer) { | ||
consumer.accept(Items.INSTANCE.getWirelessCraftingGrid().getDefaultInstance()); | ||
consumer.accept(Items.INSTANCE.getWirelessCraftingGrid().createAtEnergyCapacity()); | ||
consumer.accept(Items.INSTANCE.getCreativeWirelessCraftingGrid().getDefaultInstance()); | ||
} | ||
} |
30 changes: 30 additions & 0 deletions
30
...mon/src/main/java/com/refinedmods/refinedstorage/quartzarsenal/common/DataComponents.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,30 @@ | ||
package com.refinedmods.refinedstorage.quartzarsenal.common; | ||
|
||
import com.refinedmods.refinedstorage.quartzarsenal.common.wirelesscraftinggrid.WirelessCraftingGridState; | ||
|
||
import java.util.function.Supplier; | ||
import javax.annotation.Nullable; | ||
|
||
import net.minecraft.core.component.DataComponentType; | ||
|
||
import static java.util.Objects.requireNonNull; | ||
|
||
public final class DataComponents { | ||
public static final DataComponents INSTANCE = new DataComponents(); | ||
|
||
@Nullable | ||
private Supplier<DataComponentType<WirelessCraftingGridState>> wirelessCraftingGridState; | ||
|
||
private DataComponents() { | ||
} | ||
|
||
public DataComponentType<WirelessCraftingGridState> getWirelessCraftingGridState() { | ||
return requireNonNull(wirelessCraftingGridState).get(); | ||
} | ||
|
||
public void setWirelessCraftingGridState( | ||
@Nullable final Supplier<DataComponentType<WirelessCraftingGridState>> supplier | ||
) { | ||
this.wirelessCraftingGridState = supplier; | ||
} | ||
} |
13 changes: 13 additions & 0 deletions
13
...src/main/java/com/refinedmods/refinedstorage/quartzarsenal/common/DefaultEnergyUsage.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,13 @@ | ||
package com.refinedmods.refinedstorage.quartzarsenal.common; | ||
|
||
public final class DefaultEnergyUsage { | ||
public static final long WIRELESS_CRAFTING_GRID_CAPACITY = 1000; | ||
public static final long WIRELESS_CRAFTING_GRID_OPEN = 5; | ||
public static final long WIRELESS_CRAFTING_GRID_CRAFTING = 5; | ||
public static final long WIRELESS_CRAFTING_GRID_AUTOCRAFTING = 10; | ||
public static final long WIRELESS_CRAFTING_GRID_CLEAR_MATRIX = 5; | ||
public static final long WIRELESS_CRAFTING_GRID_RECIPE_TRANSFER = 5; | ||
|
||
private DefaultEnergyUsage() { | ||
} | ||
} |
36 changes: 36 additions & 0 deletions
36
...senal-common/src/main/java/com/refinedmods/refinedstorage/quartzarsenal/common/Items.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,36 @@ | ||
package com.refinedmods.refinedstorage.quartzarsenal.common; | ||
|
||
import com.refinedmods.refinedstorage.quartzarsenal.common.wirelesscraftinggrid.WirelessCraftingGridItem; | ||
|
||
import java.util.function.Supplier; | ||
import javax.annotation.Nullable; | ||
|
||
import static java.util.Objects.requireNonNull; | ||
|
||
public final class Items { | ||
public static final Items INSTANCE = new Items(); | ||
|
||
@Nullable | ||
private Supplier<WirelessCraftingGridItem> wirelessCraftingGrid; | ||
@Nullable | ||
private Supplier<WirelessCraftingGridItem> creativeWirelessCraftingGrid; | ||
|
||
private Items() { | ||
} | ||
|
||
public WirelessCraftingGridItem getWirelessCraftingGrid() { | ||
return requireNonNull(wirelessCraftingGrid).get(); | ||
} | ||
|
||
public void setWirelessCraftingGrid(final Supplier<WirelessCraftingGridItem> supplier) { | ||
this.wirelessCraftingGrid = supplier; | ||
} | ||
|
||
public WirelessCraftingGridItem getCreativeWirelessCraftingGrid() { | ||
return requireNonNull(creativeWirelessCraftingGrid).get(); | ||
} | ||
|
||
public void setCreativeWirelessCraftingGrid(final Supplier<WirelessCraftingGridItem> supplier) { | ||
this.creativeWirelessCraftingGrid = supplier; | ||
} | ||
} |
24 changes: 24 additions & 0 deletions
24
...common/src/main/java/com/refinedmods/refinedstorage/quartzarsenal/common/KeyMappings.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,24 @@ | ||
package com.refinedmods.refinedstorage.quartzarsenal.common; | ||
|
||
import javax.annotation.Nullable; | ||
|
||
import net.minecraft.client.KeyMapping; | ||
|
||
public final class KeyMappings { | ||
public static final KeyMappings INSTANCE = new KeyMappings(); | ||
|
||
@Nullable | ||
private KeyMapping openWirelessCraftingGrid; | ||
|
||
private KeyMappings() { | ||
} | ||
|
||
public void setOpenWirelessCraftingGrid(final KeyMapping openWirelessCraftingGrid) { | ||
this.openWirelessCraftingGrid = openWirelessCraftingGrid; | ||
} | ||
|
||
@Nullable | ||
public KeyMapping getOpenWirelessCraftingGrid() { | ||
return openWirelessCraftingGrid; | ||
} | ||
} |
28 changes: 28 additions & 0 deletions
28
...senal-common/src/main/java/com/refinedmods/refinedstorage/quartzarsenal/common/Menus.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,28 @@ | ||
package com.refinedmods.refinedstorage.quartzarsenal.common; | ||
|
||
import com.refinedmods.refinedstorage.quartzarsenal.common.wirelesscraftinggrid.WirelessCraftingGridContainerMenu; | ||
|
||
import java.util.function.Supplier; | ||
import javax.annotation.Nullable; | ||
|
||
import net.minecraft.world.inventory.MenuType; | ||
|
||
import static java.util.Objects.requireNonNull; | ||
|
||
public final class Menus { | ||
public static final Menus INSTANCE = new Menus(); | ||
|
||
@Nullable | ||
private Supplier<MenuType<WirelessCraftingGridContainerMenu>> wirelessCraftingGrid; | ||
|
||
private Menus() { | ||
} | ||
|
||
public void setWirelessCraftingGrid(final Supplier<MenuType<WirelessCraftingGridContainerMenu>> supplier) { | ||
this.wirelessCraftingGrid = supplier; | ||
} | ||
|
||
public MenuType<WirelessCraftingGridContainerMenu> getWirelessCraftingGrid() { | ||
return requireNonNull(wirelessCraftingGrid).get(); | ||
} | ||
} |
22 changes: 22 additions & 0 deletions
22
...al-common/src/main/java/com/refinedmods/refinedstorage/quartzarsenal/common/Platform.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,22 @@ | ||
package com.refinedmods.refinedstorage.quartzarsenal.common; | ||
|
||
import java.util.function.Supplier; | ||
import javax.annotation.Nullable; | ||
|
||
import static java.util.Objects.requireNonNull; | ||
|
||
public final class Platform { | ||
@Nullable | ||
private static Supplier<Config> configProvider = null; | ||
|
||
private Platform() { | ||
} | ||
|
||
public static void setConfigProvider(final Supplier<Config> configProvider) { | ||
Platform.configProvider = configProvider; | ||
} | ||
|
||
public static Config getConfig() { | ||
return requireNonNull(configProvider, "Config isn't loaded yet").get(); | ||
} | ||
} |
Oops, something went wrong.