Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Modular tools #593

Open
wants to merge 18 commits into
base: 1.20.x
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
147 changes: 147 additions & 0 deletions docs/MODULAR_TOOLS.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,147 @@
# Modular Tools

A tool consists of:

A casing (the base ModularToolItem)
An energy storage component
An energy converter component
A head
Some number of upgrade modules

## Tiers

The following material tiers exist

- Steel (motor/pump, redstone battery)
- Aluninium (large motor/pump, silicon battery)
- Stainless Steel (advanced motor/pump, sodium battery)
- Titanium (large advanced motor/pump, cadmium battery)

## Casings

Casings determine:

- the max tier of electric energy storage component that can be installed
- the max tier of energy converter component that can be installed
- the max tier of head that can be installed
- the number of upgrade modules that can be installed

Casings:

- Steel: redstone battery, basic converter, steel heads, 2 stacks
- Aluminium: silicon battery, large converter, aluminium heads, 3 stacks
- Stainless Steel: sodium battery, advanced converter, stainless heads, 4 stacks
- Titanium: cadmium battery, large advanced converter, titanium heads, 5 stacks

## Energy

A tool may be fitted with a battery and motor, allowing it to store and use EU directly, or with a tank and pump, allowing it to store liquid fuels and burn them to generate energy, with a granularity of 1 mB

Base energy consumption is 32 EU

Converters have a max throughput

- Motor: 1024 EU
- Large Motor: 2048 EU
- Advanced Motor: 4096 EU
- Large Advanced Motor: 8192
- Pump: 1024 EU
- Large Pump: 2048 EU
- Advanced Pump: 4096 EU
- Large Advanced Pump: 8192 EU

## Heads

Heads determine the base mining speed and attack damage

There are two kinds - drill heads and rotary blades

## Modules

- Area = 9x, max 2

- Fire Aspect = 1.5x, max 2
- Looting = 2x, max 3
- Knockback = 1.25x, max 2
- Sweeping Edge = 1.5x, max 3
- Sharpness/Smite/Bane of Arthropods = 1.25x, max 5

- Efficiency = 1.25x, max 5

- Fortune = 2x, max 3
- Silk Touch = 2x, max 1

### Module Identification

Modules are crafted by choosing the placement of fine copper wires around a circuit board; each recipe has 8 slots for 4 wires, for a total of 8C4 = 70 possible modules. See the list below for current assignments (the format has 1 = wire and 0 = no wire, and starting in the top left corner going clockwise)

- 11110000 = area
- 11101000 = fire aspect
- 11100100 = looting
- 11100010 = knockback
- 11100001 = sweeping edge - temporarily disabled
- 11011000 = sharpness
- 11010100 = smite
- 11010010 = bane of arthropods
- 11010001 = efficiency
- 11001100 = fortune
- 11001010 = silk touch
- 11001001
- 11000110
- 11000101
- 11000011
- 10111000
- 10110100
- 10110010
- 10110001
- 10101100
- 10101010
- 10101001
- 10100110
- 10100101
- 10100011
- 10011100
- 10011010
- 10011001
- 10010110
- 10010101
- 10010011
- 10001110
- 10001101
- 10001011
- 10000111
- 01111000
- 01110100
- 01110010
- 01110001
- 01101100
- 01101010
- 01101001
- 01100110
- 01100101
- 01100011
- 01011100
- 01011010
- 01011001
- 01010110
- 01010101
- 01010011
- 01001110
- 01001101
- 01001011
- 01000111
- 00111100
- 00111010
- 00111001
- 00110110
- 00110101
- 00110011
- 00101110
- 00101101
- 00101011
- 00100111
- 00011110
- 00011101
- 00011011
- 00010111
- 00001111
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Done to increase the memory available to gradle.
# Also add exports for google-java-format to work in 1.16
org.gradle.jvmargs=-Xmx1G \
org.gradle.jvmargs=-Xmx8G \
--add-exports jdk.compiler/com.sun.tools.javac.api=ALL-UNNAMED \
--add-exports jdk.compiler/com.sun.tools.javac.file=ALL-UNNAMED \
--add-exports jdk.compiler/com.sun.tools.javac.parser=ALL-UNNAMED \
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
import aztech.modern_industrialization.blocks.storage.barrel.client.BarrelTooltipComponent;
import aztech.modern_industrialization.blocks.storage.barrel.client.CreativeBarrelClientSetup;
import aztech.modern_industrialization.blocks.storage.tank.creativetank.CreativeTankClientSetup;
import aztech.modern_industrialization.blocks.toolstation.ToolStationScreen;
import aztech.modern_industrialization.datagen.MIDatagenClient;
import aztech.modern_industrialization.datagen.MIDatagenServer;
import aztech.modern_industrialization.inventory.ConfigurableInventoryPackets;
Expand Down Expand Up @@ -119,14 +120,16 @@ private void setupScreens() {
(MenuType<? extends MachineMenuClient>) (MenuType) ModernIndustrialization.SCREEN_HANDLER_MACHINE,
MachineScreen::new);
MenuScreens.register(ModernIndustrialization.SCREEN_HANDLER_FORGE_HAMMER, ForgeHammerScreen::new);
MenuScreens.register(ModernIndustrialization.SCREEN_HANDLER_TOOL_STATION, ToolStationScreen::new);
}

private void setupPackets() {
ClientPlayNetworking.registerGlobalReceiver(ConfigurableInventoryPackets.UPDATE_ITEM_SLOT,
ConfigurableInventoryS2CPacketHandlers.UPDATE_ITEM_SLOT);
ClientPlayNetworking.registerGlobalReceiver(ConfigurableInventoryPackets.UPDATE_FLUID_SLOT,
ConfigurableInventoryS2CPacketHandlers.UPDATE_FLUID_SLOT);
ClientPlayNetworking.registerGlobalReceiver(MachinePackets.S2C.COMPONENT_SYNC, ClientMachinePackets.ON_COMPONENT_SYNC);
ClientPlayNetworking.registerGlobalReceiver(MachinePackets.S2C.COMPONENT_SYNC,
ClientMachinePackets.ON_COMPONENT_SYNC);
}

private void setupTooltips() {
Expand All @@ -143,7 +146,8 @@ private void setupTooltips() {
Integer fuelTime = FuelRegistryImpl.INSTANCE.get(item);
if (fuelTime != null && fuelTime > 0) {
long totalEu = fuelTime * FuelBurningComponent.EU_PER_BURN_TICK;
lines.add(new MITooltips.Line(MIText.BaseEuTotalStored).arg(totalEu, MITooltips.EU_PARSER).build());
lines.add(new MITooltips.Line(MIText.BaseEuTotalStored).arg(totalEu, MITooltips.EU_PARSER)
.build());
}
} catch (Exception e) {
ModernIndustrialization.LOGGER.warn("Could not show MI fuel tooltip.", e);
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
/*
* MIT License
*
* Copyright (c) 2020 Azercoco & Technici4n
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
package aztech.modern_industrialization.blocks.toolstation;

import aztech.modern_industrialization.ModernIndustrialization;
import aztech.modern_industrialization.client.screen.MIHandledScreen;
import com.mojang.blaze3d.systems.RenderSystem;
import net.minecraft.client.gui.GuiGraphics;
import net.minecraft.client.renderer.GameRenderer;
import net.minecraft.network.chat.Component;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.world.entity.player.Inventory;

public class ToolStationScreen extends MIHandledScreen<ToolStationScreenHandler> {
public static final ResourceLocation TOOL_STATION_GUI = new ResourceLocation(ModernIndustrialization.MOD_ID,
"textures/gui/container/tool_station.png");

private static final int X_OFFSET = 61, Y_OFFSET = 14;

private final ToolStationScreenHandler handler;

public ToolStationScreen(ToolStationScreenHandler handler, Inventory inventory, Component title) {
super(handler, inventory, title);
this.handler = handler;
}

@Override
public void render(GuiGraphics guiGraphics, int mouseX, int mouseY, float delta) {
super.render(guiGraphics, mouseX, mouseY, delta);
this.renderTooltip(guiGraphics, mouseX, mouseY);
}

@Override
protected void renderBg(GuiGraphics guiGraphics, float delta, int mouseX, int mouseY) {
this.renderBackground(guiGraphics);
RenderSystem.setShader(GameRenderer::getPositionTexShader);
RenderSystem.setShaderColor(1.0F, 1.0F, 1.0F, 1.0F);
guiGraphics.blit(TOOL_STATION_GUI, this.leftPos, this.topPos, 0, 0, this.imageWidth, this.imageHeight);
for (int idx = handler.getNumAddonSlots(); idx < 5; ++idx) {
guiGraphics.blit(TOOL_STATION_GUI, this.leftPos + 43 + idx * 18, this.topPos + 41, 0, 166, 18, 18);
}
if (!handler.isComponentsEnabled()) {
guiGraphics.blit(TOOL_STATION_GUI, this.leftPos + 43, this.topPos + 23, 0, 166, 18 * 3, 18);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -23,33 +23,12 @@
*/
package aztech.modern_industrialization.compat.viewer.impl.rei;

import aztech.modern_industrialization.items.diesel_tools.DieselToolItem;
import aztech.modern_industrialization.machines.gui.MachineScreen;
import me.shedaniel.rei.api.client.plugins.REIClientPlugin;
import me.shedaniel.rei.api.client.registry.category.CategoryRegistry;
import me.shedaniel.rei.api.client.registry.screen.ScreenRegistry;
import me.shedaniel.rei.api.client.registry.transfer.TransferHandlerRegistry;
import me.shedaniel.rei.api.common.util.EntryStacks;
import me.shedaniel.rei.plugin.common.BuiltinPlugin;
import net.minecraft.core.registries.BuiltInRegistries;
import net.minecraft.tags.ItemTags;
import net.minecraft.world.item.Item;

public class ManualPluginRei implements REIClientPlugin {
@Override
public void registerCategories(CategoryRegistry registry) {
for (Item item : BuiltInRegistries.ITEM) {
if (item instanceof DieselToolItem) {
if (item.builtInRegistryHolder().is(ItemTags.AXES)) {
registry.addWorkstations(BuiltinPlugin.STRIPPING, EntryStacks.of(item));
}
if (item.builtInRegistryHolder().is(ItemTags.SHOVELS)) {
registry.addWorkstations(BuiltinPlugin.PATHING, EntryStacks.of(item));
}
}
}
}

@Override
public void registerTransferHandlers(TransferHandlerRegistry registry) {
registry.register(new MachineSlotLockingHandler());
Expand All @@ -62,7 +41,8 @@ public void registerScreens(ScreenRegistry registry) {
registry.registerClickArea(MachineScreen.class, new MachineClickAreaHandler());
registry.registerFocusedStack(new MachineFocusedStackProvider());
registry.exclusionZones().register(MachineScreen.class, screen -> {
return screen.getExtraBoxes().stream().map(r -> new me.shedaniel.math.Rectangle(r.x(), r.y(), r.w(), r.h())).toList();
return screen.getExtraBoxes().stream().map(r -> new me.shedaniel.math.Rectangle(r.x(), r.y(), r.w(), r.h()))
.toList();
});
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -38,16 +38,18 @@

public class FluidFuelsCategory extends ViewerCategory<Fluid> {
public FluidFuelsCategory() {
super(Fluid.class, new MIIdentifier("fluid_fuels"), MIText.FluidFuels.text(), MIFluids.DIESEL.getBucket().getDefaultInstance(), 150, 35);
super(Fluid.class, new MIIdentifier("fluid_fuels"), MIText.FluidFuels.text(),
MIFluids.DIESEL.getBucket().getDefaultInstance(), 150, 35);
}

@Override
public void buildWorkstations(WorkstationConsumer consumer) {
consumer.accept("lv_diesel_generator", "mv_diesel_generator", "hv_diesel_generator", "large_diesel_generator", "large_steam_boiler",
consumer.accept("lv_diesel_generator", "mv_diesel_generator", "hv_diesel_generator", "large_diesel_generator",
"large_steam_boiler",
"advanced_large_steam_boiler",
"high_pressure_large_steam_boiler",
"high_pressure_advanced_large_steam_boiler");
consumer.accept(MIItem.DIESEL_JETPACK, MIItem.DIESEL_CHAINSAW, MIItem.DIESEL_MINING_DRILL);
consumer.accept(MIItem.DIESEL_JETPACK);
}

@Override
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"variants": {
"": {
"model": "modern_industrialization:block/tool_station"
}
}
}
Loading
Loading