mirror of
https://github.com/SquidDev-CC/CC-Tweaked
synced 2025-01-28 01:44:48 +00:00
Rename Registry to ModRegistry
Avoids the conflict with Minecraft's built-in registry class
This commit is contained in:
parent
9cd728fea9
commit
6d665ad841
@ -6,7 +6,7 @@
|
||||
package dan200.computercraft;
|
||||
|
||||
import dan200.computercraft.shared.Config;
|
||||
import dan200.computercraft.shared.Registry;
|
||||
import dan200.computercraft.shared.ModRegistry;
|
||||
import dan200.computercraft.shared.peripheral.monitor.MonitorRenderer;
|
||||
import net.minecraftforge.fml.common.Mod;
|
||||
import org.slf4j.Logger;
|
||||
@ -56,6 +56,6 @@ public final class ComputerCraft {
|
||||
|
||||
public ComputerCraft() {
|
||||
Config.setup();
|
||||
Registry.setup();
|
||||
ModRegistry.setup();
|
||||
}
|
||||
}
|
||||
|
@ -14,7 +14,7 @@ import dan200.computercraft.client.render.TileEntityMonitorRenderer;
|
||||
import dan200.computercraft.client.render.TileEntityTurtleRenderer;
|
||||
import dan200.computercraft.client.render.TurtleModelLoader;
|
||||
import dan200.computercraft.client.turtle.TurtleModemModeller;
|
||||
import dan200.computercraft.shared.Registry;
|
||||
import dan200.computercraft.shared.ModRegistry;
|
||||
import dan200.computercraft.shared.common.IColouredItem;
|
||||
import dan200.computercraft.shared.computer.inventory.ContainerComputerBase;
|
||||
import dan200.computercraft.shared.computer.inventory.ContainerViewComputer;
|
||||
@ -81,19 +81,19 @@ public final class ClientRegistry {
|
||||
|
||||
@SubscribeEvent
|
||||
public static void onItemColours(RegisterColorHandlersEvent.Item event) {
|
||||
if (Registry.ModItems.DISK == null || Registry.ModBlocks.TURTLE_NORMAL == null) {
|
||||
if (ModRegistry.Items.DISK == null || ModRegistry.Blocks.TURTLE_NORMAL == null) {
|
||||
ComputerCraft.log.warn("Block/item registration has failed. Skipping registration of item colours.");
|
||||
return;
|
||||
}
|
||||
|
||||
event.register(
|
||||
(stack, layer) -> layer == 1 ? ((ItemDisk) stack.getItem()).getColour(stack) : 0xFFFFFF,
|
||||
Registry.ModItems.DISK.get()
|
||||
ModRegistry.Items.DISK.get()
|
||||
);
|
||||
|
||||
event.register(
|
||||
(stack, layer) -> layer == 1 ? ItemTreasureDisk.getColour(stack) : 0xFFFFFF,
|
||||
Registry.ModItems.TREASURE_DISK.get()
|
||||
ModRegistry.Items.TREASURE_DISK.get()
|
||||
);
|
||||
|
||||
event.register((stack, layer) -> {
|
||||
@ -108,45 +108,45 @@ public final class ClientRegistry {
|
||||
return light == -1 ? Colour.BLACK.getHex() : light;
|
||||
}
|
||||
}
|
||||
}, Registry.ModItems.POCKET_COMPUTER_NORMAL.get(), Registry.ModItems.POCKET_COMPUTER_ADVANCED.get());
|
||||
}, ModRegistry.Items.POCKET_COMPUTER_NORMAL.get(), ModRegistry.Items.POCKET_COMPUTER_ADVANCED.get());
|
||||
|
||||
// Setup turtle colours
|
||||
event.register(
|
||||
(stack, tintIndex) -> tintIndex == 0 ? ((IColouredItem) stack.getItem()).getColour(stack) : 0xFFFFFF,
|
||||
Registry.ModBlocks.TURTLE_NORMAL.get(), Registry.ModBlocks.TURTLE_ADVANCED.get()
|
||||
ModRegistry.Blocks.TURTLE_NORMAL.get(), ModRegistry.Blocks.TURTLE_ADVANCED.get()
|
||||
);
|
||||
}
|
||||
|
||||
@SubscribeEvent
|
||||
public static void setupClient(FMLClientSetupEvent event) {
|
||||
// Setup TESRs
|
||||
BlockEntityRenderers.register(Registry.ModBlockEntities.MONITOR_NORMAL.get(), TileEntityMonitorRenderer::new);
|
||||
BlockEntityRenderers.register(Registry.ModBlockEntities.MONITOR_ADVANCED.get(), TileEntityMonitorRenderer::new);
|
||||
BlockEntityRenderers.register(Registry.ModBlockEntities.TURTLE_NORMAL.get(), TileEntityTurtleRenderer::new);
|
||||
BlockEntityRenderers.register(Registry.ModBlockEntities.TURTLE_ADVANCED.get(), TileEntityTurtleRenderer::new);
|
||||
BlockEntityRenderers.register(ModRegistry.BlockEntities.MONITOR_NORMAL.get(), TileEntityMonitorRenderer::new);
|
||||
BlockEntityRenderers.register(ModRegistry.BlockEntities.MONITOR_ADVANCED.get(), TileEntityMonitorRenderer::new);
|
||||
BlockEntityRenderers.register(ModRegistry.BlockEntities.TURTLE_NORMAL.get(), TileEntityTurtleRenderer::new);
|
||||
BlockEntityRenderers.register(ModRegistry.BlockEntities.TURTLE_ADVANCED.get(), TileEntityTurtleRenderer::new);
|
||||
|
||||
ComputerCraftAPIClient.registerTurtleUpgradeModeller(Registry.ModTurtleSerialisers.SPEAKER.get(), TurtleUpgradeModeller.sided(
|
||||
ComputerCraftAPIClient.registerTurtleUpgradeModeller(ModRegistry.TurtleSerialisers.SPEAKER.get(), TurtleUpgradeModeller.sided(
|
||||
new ResourceLocation(ComputerCraft.MOD_ID, "block/turtle_speaker_left"),
|
||||
new ResourceLocation(ComputerCraft.MOD_ID, "block/turtle_speaker_right")
|
||||
));
|
||||
ComputerCraftAPIClient.registerTurtleUpgradeModeller(Registry.ModTurtleSerialisers.WORKBENCH.get(), TurtleUpgradeModeller.sided(
|
||||
ComputerCraftAPIClient.registerTurtleUpgradeModeller(ModRegistry.TurtleSerialisers.WORKBENCH.get(), TurtleUpgradeModeller.sided(
|
||||
new ResourceLocation(ComputerCraft.MOD_ID, "block/turtle_crafting_table_left"),
|
||||
new ResourceLocation(ComputerCraft.MOD_ID, "block/turtle_crafting_table_right")
|
||||
));
|
||||
ComputerCraftAPIClient.registerTurtleUpgradeModeller(Registry.ModTurtleSerialisers.WIRELESS_MODEM_NORMAL.get(), new TurtleModemModeller(false));
|
||||
ComputerCraftAPIClient.registerTurtleUpgradeModeller(Registry.ModTurtleSerialisers.WIRELESS_MODEM_ADVANCED.get(), new TurtleModemModeller(true));
|
||||
ComputerCraftAPIClient.registerTurtleUpgradeModeller(Registry.ModTurtleSerialisers.TOOL.get(), TurtleUpgradeModeller.flatItem());
|
||||
ComputerCraftAPIClient.registerTurtleUpgradeModeller(ModRegistry.TurtleSerialisers.WIRELESS_MODEM_NORMAL.get(), new TurtleModemModeller(false));
|
||||
ComputerCraftAPIClient.registerTurtleUpgradeModeller(ModRegistry.TurtleSerialisers.WIRELESS_MODEM_ADVANCED.get(), new TurtleModemModeller(true));
|
||||
ComputerCraftAPIClient.registerTurtleUpgradeModeller(ModRegistry.TurtleSerialisers.TOOL.get(), TurtleUpgradeModeller.flatItem());
|
||||
|
||||
event.enqueueWork(() -> {
|
||||
registerContainers();
|
||||
|
||||
registerItemProperty("state",
|
||||
(stack, world, player, random) -> ClientPocketComputers.get(stack).getState().ordinal(),
|
||||
Registry.ModItems.POCKET_COMPUTER_NORMAL, Registry.ModItems.POCKET_COMPUTER_ADVANCED
|
||||
ModRegistry.Items.POCKET_COMPUTER_NORMAL, ModRegistry.Items.POCKET_COMPUTER_ADVANCED
|
||||
);
|
||||
registerItemProperty("coloured",
|
||||
(stack, world, player, random) -> IColouredItem.getColourBasic(stack) != -1 ? 1 : 0,
|
||||
Registry.ModItems.POCKET_COMPUTER_NORMAL, Registry.ModItems.POCKET_COMPUTER_ADVANCED
|
||||
ModRegistry.Items.POCKET_COMPUTER_NORMAL, ModRegistry.Items.POCKET_COMPUTER_ADVANCED
|
||||
);
|
||||
});
|
||||
}
|
||||
@ -163,15 +163,15 @@ public final class ClientRegistry {
|
||||
private static void registerContainers() {
|
||||
// My IDE doesn't think so, but we do actually need these generics.
|
||||
|
||||
MenuScreens.<ContainerComputerBase, GuiComputer<ContainerComputerBase>>register(Registry.ModContainers.COMPUTER.get(), GuiComputer::new);
|
||||
MenuScreens.<ContainerComputerBase, GuiComputer<ContainerComputerBase>>register(Registry.ModContainers.POCKET_COMPUTER.get(), GuiComputer::new);
|
||||
MenuScreens.<ContainerComputerBase, NoTermComputerScreen<ContainerComputerBase>>register(Registry.ModContainers.POCKET_COMPUTER_NO_TERM.get(), NoTermComputerScreen::new);
|
||||
MenuScreens.register(Registry.ModContainers.TURTLE.get(), GuiTurtle::new);
|
||||
MenuScreens.<ContainerComputerBase, GuiComputer<ContainerComputerBase>>register(ModRegistry.Menus.COMPUTER.get(), GuiComputer::new);
|
||||
MenuScreens.<ContainerComputerBase, GuiComputer<ContainerComputerBase>>register(ModRegistry.Menus.POCKET_COMPUTER.get(), GuiComputer::new);
|
||||
MenuScreens.<ContainerComputerBase, NoTermComputerScreen<ContainerComputerBase>>register(ModRegistry.Menus.POCKET_COMPUTER_NO_TERM.get(), NoTermComputerScreen::new);
|
||||
MenuScreens.register(ModRegistry.Menus.TURTLE.get(), GuiTurtle::new);
|
||||
|
||||
MenuScreens.register(Registry.ModContainers.PRINTER.get(), GuiPrinter::new);
|
||||
MenuScreens.register(Registry.ModContainers.DISK_DRIVE.get(), GuiDiskDrive::new);
|
||||
MenuScreens.register(Registry.ModContainers.PRINTOUT.get(), GuiPrintout::new);
|
||||
MenuScreens.register(ModRegistry.Menus.PRINTER.get(), GuiPrinter::new);
|
||||
MenuScreens.register(ModRegistry.Menus.DISK_DRIVE.get(), GuiDiskDrive::new);
|
||||
MenuScreens.register(ModRegistry.Menus.PRINTOUT.get(), GuiPrintout::new);
|
||||
|
||||
MenuScreens.<ContainerViewComputer, GuiComputer<ContainerViewComputer>>register(Registry.ModContainers.VIEW_COMPUTER.get(), GuiComputer::new);
|
||||
MenuScreens.<ContainerViewComputer, GuiComputer<ContainerViewComputer>>register(ModRegistry.Menus.VIEW_COMPUTER.get(), GuiComputer::new);
|
||||
}
|
||||
}
|
||||
|
@ -6,7 +6,7 @@
|
||||
package dan200.computercraft.client.render;
|
||||
|
||||
import dan200.computercraft.ComputerCraft;
|
||||
import dan200.computercraft.shared.Registry;
|
||||
import dan200.computercraft.shared.ModRegistry;
|
||||
import dan200.computercraft.shared.peripheral.modem.wired.BlockCable;
|
||||
import dan200.computercraft.shared.peripheral.modem.wired.CableShapes;
|
||||
import dan200.computercraft.shared.util.WorldUtil;
|
||||
@ -38,7 +38,7 @@ public final class CableHighlightRenderer {
|
||||
var state = world.getBlockState(pos);
|
||||
|
||||
// We only care about instances with both cable and modem.
|
||||
if (state.getBlock() != Registry.ModBlocks.CABLE.get() || state.getValue(BlockCable.MODEM).getFacing() == null || !state.getValue(BlockCable.CABLE)) {
|
||||
if (state.getBlock() != ModRegistry.Blocks.CABLE.get() || state.getValue(BlockCable.MODEM).getFacing() == null || !state.getValue(BlockCable.CABLE)) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -7,7 +7,7 @@ package dan200.computercraft.data;
|
||||
|
||||
import com.google.gson.JsonObject;
|
||||
import dan200.computercraft.ComputerCraft;
|
||||
import dan200.computercraft.shared.Registry;
|
||||
import dan200.computercraft.shared.ModRegistry;
|
||||
import dan200.computercraft.shared.computer.blocks.BlockComputer;
|
||||
import dan200.computercraft.shared.peripheral.diskdrive.BlockDiskDrive;
|
||||
import dan200.computercraft.shared.peripheral.modem.wired.BlockCable;
|
||||
@ -65,22 +65,22 @@ class BlockModelGenerator {
|
||||
);
|
||||
|
||||
public static void addBlockModels(BlockModelGenerators generators) {
|
||||
registerComputer(generators, Registry.ModBlocks.COMPUTER_NORMAL.get());
|
||||
registerComputer(generators, Registry.ModBlocks.COMPUTER_ADVANCED.get());
|
||||
registerComputer(generators, Registry.ModBlocks.COMPUTER_COMMAND.get());
|
||||
registerComputer(generators, ModRegistry.Blocks.COMPUTER_NORMAL.get());
|
||||
registerComputer(generators, ModRegistry.Blocks.COMPUTER_ADVANCED.get());
|
||||
registerComputer(generators, ModRegistry.Blocks.COMPUTER_COMMAND.get());
|
||||
|
||||
registerTurtle(generators, Registry.ModBlocks.TURTLE_NORMAL.get());
|
||||
registerTurtle(generators, Registry.ModBlocks.TURTLE_ADVANCED.get());
|
||||
registerTurtle(generators, ModRegistry.Blocks.TURTLE_NORMAL.get());
|
||||
registerTurtle(generators, ModRegistry.Blocks.TURTLE_ADVANCED.get());
|
||||
|
||||
registerWirelessModem(generators, Registry.ModBlocks.WIRELESS_MODEM_NORMAL.get());
|
||||
registerWirelessModem(generators, Registry.ModBlocks.WIRELESS_MODEM_ADVANCED.get());
|
||||
registerWirelessModem(generators, ModRegistry.Blocks.WIRELESS_MODEM_NORMAL.get());
|
||||
registerWirelessModem(generators, ModRegistry.Blocks.WIRELESS_MODEM_ADVANCED.get());
|
||||
|
||||
registerWiredModems(generators);
|
||||
|
||||
registerMonitor(generators, Registry.ModBlocks.MONITOR_NORMAL.get());
|
||||
registerMonitor(generators, Registry.ModBlocks.MONITOR_ADVANCED.get());
|
||||
registerMonitor(generators, ModRegistry.Blocks.MONITOR_NORMAL.get());
|
||||
registerMonitor(generators, ModRegistry.Blocks.MONITOR_ADVANCED.get());
|
||||
|
||||
generators.createHorizontallyRotatedBlock(Registry.ModBlocks.SPEAKER.get(), TexturedModel.ORIENTABLE_ONLY_TOP);
|
||||
generators.createHorizontallyRotatedBlock(ModRegistry.Blocks.SPEAKER.get(), TexturedModel.ORIENTABLE_ONLY_TOP);
|
||||
registerDiskDrive(generators);
|
||||
registerPrinter(generators);
|
||||
|
||||
@ -93,7 +93,7 @@ class BlockModelGenerator {
|
||||
}
|
||||
|
||||
private static void registerDiskDrive(BlockModelGenerators generators) {
|
||||
var diskDrive = Registry.ModBlocks.DISK_DRIVE.get();
|
||||
var diskDrive = ModRegistry.Blocks.DISK_DRIVE.get();
|
||||
generators.blockStateOutput.accept(MultiVariantGenerator.multiVariant(diskDrive)
|
||||
.with(createHorizontalFacingDispatch())
|
||||
.with(createModelDispatch(BlockDiskDrive.STATE, value -> {
|
||||
@ -113,7 +113,7 @@ class BlockModelGenerator {
|
||||
}
|
||||
|
||||
private static void registerPrinter(BlockModelGenerators generators) {
|
||||
var printer = Registry.ModBlocks.PRINTER.get();
|
||||
var printer = ModRegistry.Blocks.PRINTER.get();
|
||||
generators.blockStateOutput.accept(MultiVariantGenerator.multiVariant(printer)
|
||||
.with(createHorizontalFacingDispatch())
|
||||
.with(createModelDispatch(BlockPrinter.TOP, BlockPrinter.BOTTOM, (top, bottom) -> {
|
||||
@ -177,7 +177,7 @@ class BlockModelGenerator {
|
||||
}
|
||||
|
||||
private static void registerWiredModems(BlockModelGenerators generators) {
|
||||
var fullBlock = Registry.ModBlocks.WIRED_MODEM_FULL.get();
|
||||
var fullBlock = ModRegistry.Blocks.WIRED_MODEM_FULL.get();
|
||||
generators.blockStateOutput.accept(MultiVariantGenerator.multiVariant(fullBlock)
|
||||
.with(createModelDispatch(BlockWiredModemFull.MODEM_ON, BlockWiredModemFull.PERIPHERAL_ON, (on, peripheral) -> {
|
||||
var suffix = (on ? "_on" : "_off") + (peripheral ? "_peripheral" : "");
|
||||
@ -194,7 +194,7 @@ class BlockModelGenerator {
|
||||
})));
|
||||
|
||||
generators.delegateItemModel(fullBlock, getModelLocation(fullBlock, "_off"));
|
||||
generators.delegateItemModel(Registry.ModItems.WIRED_MODEM.get(), new ResourceLocation(ComputerCraft.MOD_ID, "block/wired_modem_off"));
|
||||
generators.delegateItemModel(ModRegistry.Items.WIRED_MODEM.get(), new ResourceLocation(ComputerCraft.MOD_ID, "block/wired_modem_off"));
|
||||
}
|
||||
|
||||
private static ResourceLocation modemModel(BlockModelGenerators generators, ResourceLocation name, ResourceLocation texture) {
|
||||
@ -246,7 +246,7 @@ class BlockModelGenerator {
|
||||
}
|
||||
|
||||
private static void registerCable(BlockModelGenerators generators) {
|
||||
var generator = MultiPartGenerator.multiPart(Registry.ModBlocks.CABLE.get());
|
||||
var generator = MultiPartGenerator.multiPart(ModRegistry.Blocks.CABLE.get());
|
||||
|
||||
// When a cable only has a neighbour in a single direction, we redirect the core to face that direction.
|
||||
var coreFacing = new ResourceLocation(ComputerCraft.MOD_ID, "block/cable_core_facing");
|
||||
|
@ -6,11 +6,10 @@
|
||||
package dan200.computercraft.data;
|
||||
|
||||
import dan200.computercraft.ComputerCraft;
|
||||
import dan200.computercraft.shared.Registry;
|
||||
import dan200.computercraft.shared.ModRegistry;
|
||||
import net.minecraft.data.DataGenerator;
|
||||
import net.minecraft.data.tags.BlockTagsProvider;
|
||||
import net.minecraft.tags.BlockTags;
|
||||
import net.minecraft.world.level.block.Blocks;
|
||||
import net.minecraftforge.common.data.ExistingFileHelper;
|
||||
|
||||
import static dan200.computercraft.api.ComputerCraftTags.Blocks.*;
|
||||
@ -25,53 +24,53 @@ class BlockTagsGenerator extends BlockTagsProvider {
|
||||
protected void addTags() {
|
||||
// Items
|
||||
tag(COMPUTER).add(
|
||||
Registry.ModBlocks.COMPUTER_NORMAL.get(),
|
||||
Registry.ModBlocks.COMPUTER_ADVANCED.get(),
|
||||
Registry.ModBlocks.COMPUTER_COMMAND.get()
|
||||
ModRegistry.Blocks.COMPUTER_NORMAL.get(),
|
||||
ModRegistry.Blocks.COMPUTER_ADVANCED.get(),
|
||||
ModRegistry.Blocks.COMPUTER_COMMAND.get()
|
||||
);
|
||||
tag(TURTLE).add(Registry.ModBlocks.TURTLE_NORMAL.get(), Registry.ModBlocks.TURTLE_ADVANCED.get());
|
||||
tag(WIRED_MODEM).add(Registry.ModBlocks.CABLE.get(), Registry.ModBlocks.WIRED_MODEM_FULL.get());
|
||||
tag(MONITOR).add(Registry.ModBlocks.MONITOR_NORMAL.get(), Registry.ModBlocks.MONITOR_ADVANCED.get());
|
||||
tag(TURTLE).add(ModRegistry.Blocks.TURTLE_NORMAL.get(), ModRegistry.Blocks.TURTLE_ADVANCED.get());
|
||||
tag(WIRED_MODEM).add(ModRegistry.Blocks.CABLE.get(), ModRegistry.Blocks.WIRED_MODEM_FULL.get());
|
||||
tag(MONITOR).add(ModRegistry.Blocks.MONITOR_NORMAL.get(), ModRegistry.Blocks.MONITOR_ADVANCED.get());
|
||||
|
||||
tag(TURTLE_ALWAYS_BREAKABLE).addTags(BlockTags.LEAVES).add(
|
||||
Blocks.BAMBOO, Blocks.BAMBOO_SAPLING // Bamboo isn't instabreak for some odd reason.
|
||||
net.minecraft.world.level.block.Blocks.BAMBOO, net.minecraft.world.level.block.Blocks.BAMBOO_SAPLING // Bamboo isn't instabreak for some odd reason.
|
||||
);
|
||||
|
||||
tag(TURTLE_SHOVEL_BREAKABLE).addTag(BlockTags.MINEABLE_WITH_SHOVEL).add(
|
||||
Blocks.MELON,
|
||||
Blocks.PUMPKIN,
|
||||
Blocks.CARVED_PUMPKIN,
|
||||
Blocks.JACK_O_LANTERN
|
||||
net.minecraft.world.level.block.Blocks.MELON,
|
||||
net.minecraft.world.level.block.Blocks.PUMPKIN,
|
||||
net.minecraft.world.level.block.Blocks.CARVED_PUMPKIN,
|
||||
net.minecraft.world.level.block.Blocks.JACK_O_LANTERN
|
||||
);
|
||||
|
||||
tag(TURTLE_HOE_BREAKABLE).addTags(
|
||||
BlockTags.CROPS,
|
||||
BlockTags.MINEABLE_WITH_HOE
|
||||
).add(
|
||||
Blocks.CACTUS,
|
||||
Blocks.MELON,
|
||||
Blocks.PUMPKIN,
|
||||
Blocks.CARVED_PUMPKIN,
|
||||
Blocks.JACK_O_LANTERN
|
||||
net.minecraft.world.level.block.Blocks.CACTUS,
|
||||
net.minecraft.world.level.block.Blocks.MELON,
|
||||
net.minecraft.world.level.block.Blocks.PUMPKIN,
|
||||
net.minecraft.world.level.block.Blocks.CARVED_PUMPKIN,
|
||||
net.minecraft.world.level.block.Blocks.JACK_O_LANTERN
|
||||
);
|
||||
|
||||
tag(TURTLE_SWORD_BREAKABLE).addTags(BlockTags.WOOL).add(Blocks.COBWEB);
|
||||
tag(TURTLE_SWORD_BREAKABLE).addTags(BlockTags.WOOL).add(net.minecraft.world.level.block.Blocks.COBWEB);
|
||||
|
||||
// Make all blocks aside from command computer mineable.
|
||||
tag(BlockTags.MINEABLE_WITH_PICKAXE).add(
|
||||
Registry.ModBlocks.COMPUTER_NORMAL.get(),
|
||||
Registry.ModBlocks.COMPUTER_ADVANCED.get(),
|
||||
Registry.ModBlocks.TURTLE_NORMAL.get(),
|
||||
Registry.ModBlocks.TURTLE_ADVANCED.get(),
|
||||
Registry.ModBlocks.SPEAKER.get(),
|
||||
Registry.ModBlocks.DISK_DRIVE.get(),
|
||||
Registry.ModBlocks.PRINTER.get(),
|
||||
Registry.ModBlocks.MONITOR_NORMAL.get(),
|
||||
Registry.ModBlocks.MONITOR_ADVANCED.get(),
|
||||
Registry.ModBlocks.WIRELESS_MODEM_NORMAL.get(),
|
||||
Registry.ModBlocks.WIRELESS_MODEM_ADVANCED.get(),
|
||||
Registry.ModBlocks.WIRED_MODEM_FULL.get(),
|
||||
Registry.ModBlocks.CABLE.get()
|
||||
ModRegistry.Blocks.COMPUTER_NORMAL.get(),
|
||||
ModRegistry.Blocks.COMPUTER_ADVANCED.get(),
|
||||
ModRegistry.Blocks.TURTLE_NORMAL.get(),
|
||||
ModRegistry.Blocks.TURTLE_ADVANCED.get(),
|
||||
ModRegistry.Blocks.SPEAKER.get(),
|
||||
ModRegistry.Blocks.DISK_DRIVE.get(),
|
||||
ModRegistry.Blocks.PRINTER.get(),
|
||||
ModRegistry.Blocks.MONITOR_NORMAL.get(),
|
||||
ModRegistry.Blocks.MONITOR_ADVANCED.get(),
|
||||
ModRegistry.Blocks.WIRELESS_MODEM_NORMAL.get(),
|
||||
ModRegistry.Blocks.WIRELESS_MODEM_ADVANCED.get(),
|
||||
ModRegistry.Blocks.WIRED_MODEM_FULL.get(),
|
||||
ModRegistry.Blocks.CABLE.get()
|
||||
);
|
||||
}
|
||||
}
|
||||
|
@ -5,7 +5,7 @@
|
||||
*/
|
||||
package dan200.computercraft.data;
|
||||
|
||||
import dan200.computercraft.shared.Registry;
|
||||
import dan200.computercraft.shared.ModRegistry;
|
||||
import net.minecraftforge.data.event.GatherDataEvent;
|
||||
import net.minecraftforge.eventbus.api.SubscribeEvent;
|
||||
import net.minecraftforge.fml.common.Mod;
|
||||
@ -14,7 +14,7 @@ import net.minecraftforge.fml.common.Mod;
|
||||
public class Generators {
|
||||
@SubscribeEvent
|
||||
public static void gather(GatherDataEvent event) {
|
||||
Registry.registerLoot();
|
||||
ModRegistry.registerLoot();
|
||||
|
||||
var generator = event.getGenerator();
|
||||
var existingFiles = event.getExistingFileHelper();
|
||||
|
@ -6,7 +6,7 @@
|
||||
package dan200.computercraft.data;
|
||||
|
||||
import dan200.computercraft.ComputerCraft;
|
||||
import dan200.computercraft.shared.Registry;
|
||||
import dan200.computercraft.shared.ModRegistry;
|
||||
import net.minecraft.data.models.ItemModelGenerators;
|
||||
import net.minecraft.data.models.model.ModelTemplate;
|
||||
import net.minecraft.data.models.model.ModelTemplates;
|
||||
@ -24,16 +24,16 @@ public final class ItemModelGenerator {
|
||||
}
|
||||
|
||||
public static void addItemModels(ItemModelGenerators generators) {
|
||||
registerDisk(generators, Registry.ModItems.DISK.get());
|
||||
registerDisk(generators, Registry.ModItems.TREASURE_DISK.get());
|
||||
registerDisk(generators, ModRegistry.Items.DISK.get());
|
||||
registerDisk(generators, ModRegistry.Items.TREASURE_DISK.get());
|
||||
|
||||
registerPocketComputer(generators, getModelLocation(Registry.ModItems.POCKET_COMPUTER_NORMAL.get()), false);
|
||||
registerPocketComputer(generators, getModelLocation(Registry.ModItems.POCKET_COMPUTER_ADVANCED.get()), false);
|
||||
registerPocketComputer(generators, getModelLocation(ModRegistry.Items.POCKET_COMPUTER_NORMAL.get()), false);
|
||||
registerPocketComputer(generators, getModelLocation(ModRegistry.Items.POCKET_COMPUTER_ADVANCED.get()), false);
|
||||
registerPocketComputer(generators, new ResourceLocation(ComputerCraft.MOD_ID, "item/pocket_computer_colour"), true);
|
||||
|
||||
generators.generateFlatItem(Registry.ModItems.PRINTED_BOOK.get(), ModelTemplates.FLAT_ITEM);
|
||||
generators.generateFlatItem(Registry.ModItems.PRINTED_PAGE.get(), ModelTemplates.FLAT_ITEM);
|
||||
generators.generateFlatItem(Registry.ModItems.PRINTED_PAGES.get(), ModelTemplates.FLAT_ITEM);
|
||||
generators.generateFlatItem(ModRegistry.Items.PRINTED_BOOK.get(), ModelTemplates.FLAT_ITEM);
|
||||
generators.generateFlatItem(ModRegistry.Items.PRINTED_PAGE.get(), ModelTemplates.FLAT_ITEM);
|
||||
generators.generateFlatItem(ModRegistry.Items.PRINTED_PAGES.get(), ModelTemplates.FLAT_ITEM);
|
||||
}
|
||||
|
||||
private static void registerPocketComputer(ItemModelGenerators generators, ResourceLocation id, boolean off) {
|
||||
|
@ -7,7 +7,7 @@ package dan200.computercraft.data;
|
||||
|
||||
import dan200.computercraft.ComputerCraft;
|
||||
import dan200.computercraft.api.ComputerCraftTags.Blocks;
|
||||
import dan200.computercraft.shared.Registry;
|
||||
import dan200.computercraft.shared.ModRegistry;
|
||||
import net.minecraft.data.DataGenerator;
|
||||
import net.minecraft.data.tags.ItemTagsProvider;
|
||||
import net.minecraft.tags.ItemTags;
|
||||
@ -24,13 +24,13 @@ class ItemTagsGenerator extends ItemTagsProvider {
|
||||
protected void addTags() {
|
||||
copy(Blocks.COMPUTER, COMPUTER);
|
||||
copy(Blocks.TURTLE, TURTLE);
|
||||
tag(WIRED_MODEM).add(Registry.ModItems.WIRED_MODEM.get(), Registry.ModItems.WIRED_MODEM_FULL.get());
|
||||
tag(WIRED_MODEM).add(ModRegistry.Items.WIRED_MODEM.get(), ModRegistry.Items.WIRED_MODEM_FULL.get());
|
||||
copy(Blocks.MONITOR, MONITOR);
|
||||
|
||||
tag(ItemTags.PIGLIN_LOVED).add(
|
||||
Registry.ModItems.COMPUTER_ADVANCED.get(), Registry.ModItems.TURTLE_ADVANCED.get(),
|
||||
Registry.ModItems.WIRELESS_MODEM_ADVANCED.get(), Registry.ModItems.POCKET_COMPUTER_ADVANCED.get(),
|
||||
Registry.ModItems.MONITOR_ADVANCED.get()
|
||||
ModRegistry.Items.COMPUTER_ADVANCED.get(), ModRegistry.Items.TURTLE_ADVANCED.get(),
|
||||
ModRegistry.Items.WIRELESS_MODEM_ADVANCED.get(), ModRegistry.Items.POCKET_COMPUTER_ADVANCED.get(),
|
||||
ModRegistry.Items.MONITOR_ADVANCED.get()
|
||||
);
|
||||
}
|
||||
}
|
||||
|
@ -8,7 +8,7 @@ package dan200.computercraft.data;
|
||||
import com.mojang.datafixers.util.Pair;
|
||||
import dan200.computercraft.ComputerCraft;
|
||||
import dan200.computercraft.shared.CommonHooks;
|
||||
import dan200.computercraft.shared.Registry;
|
||||
import dan200.computercraft.shared.ModRegistry;
|
||||
import dan200.computercraft.shared.data.BlockNamedEntityLootCondition;
|
||||
import dan200.computercraft.shared.data.HasComputerIdLootCondition;
|
||||
import dan200.computercraft.shared.data.PlayerCreativeLootCondition;
|
||||
@ -62,36 +62,36 @@ class LootTableGenerator extends LootTableProvider {
|
||||
}
|
||||
|
||||
private static void registerBlocks(BiConsumer<ResourceLocation, LootTable.Builder> add) {
|
||||
namedBlockDrop(add, Registry.ModBlocks.DISK_DRIVE);
|
||||
selfDrop(add, Registry.ModBlocks.MONITOR_NORMAL);
|
||||
selfDrop(add, Registry.ModBlocks.MONITOR_ADVANCED);
|
||||
namedBlockDrop(add, Registry.ModBlocks.PRINTER);
|
||||
selfDrop(add, Registry.ModBlocks.SPEAKER);
|
||||
selfDrop(add, Registry.ModBlocks.WIRED_MODEM_FULL);
|
||||
selfDrop(add, Registry.ModBlocks.WIRELESS_MODEM_NORMAL);
|
||||
selfDrop(add, Registry.ModBlocks.WIRELESS_MODEM_ADVANCED);
|
||||
namedBlockDrop(add, ModRegistry.Blocks.DISK_DRIVE);
|
||||
selfDrop(add, ModRegistry.Blocks.MONITOR_NORMAL);
|
||||
selfDrop(add, ModRegistry.Blocks.MONITOR_ADVANCED);
|
||||
namedBlockDrop(add, ModRegistry.Blocks.PRINTER);
|
||||
selfDrop(add, ModRegistry.Blocks.SPEAKER);
|
||||
selfDrop(add, ModRegistry.Blocks.WIRED_MODEM_FULL);
|
||||
selfDrop(add, ModRegistry.Blocks.WIRELESS_MODEM_NORMAL);
|
||||
selfDrop(add, ModRegistry.Blocks.WIRELESS_MODEM_ADVANCED);
|
||||
|
||||
computerDrop(add, Registry.ModBlocks.COMPUTER_NORMAL);
|
||||
computerDrop(add, Registry.ModBlocks.COMPUTER_ADVANCED);
|
||||
computerDrop(add, Registry.ModBlocks.COMPUTER_COMMAND);
|
||||
computerDrop(add, Registry.ModBlocks.TURTLE_NORMAL);
|
||||
computerDrop(add, Registry.ModBlocks.TURTLE_ADVANCED);
|
||||
computerDrop(add, ModRegistry.Blocks.COMPUTER_NORMAL);
|
||||
computerDrop(add, ModRegistry.Blocks.COMPUTER_ADVANCED);
|
||||
computerDrop(add, ModRegistry.Blocks.COMPUTER_COMMAND);
|
||||
computerDrop(add, ModRegistry.Blocks.TURTLE_NORMAL);
|
||||
computerDrop(add, ModRegistry.Blocks.TURTLE_ADVANCED);
|
||||
|
||||
add.accept(Registry.ModBlocks.CABLE.get().getLootTable(), LootTable
|
||||
add.accept(ModRegistry.Blocks.CABLE.get().getLootTable(), LootTable
|
||||
.lootTable()
|
||||
.withPool(LootPool.lootPool()
|
||||
.setRolls(ConstantValue.exactly(1))
|
||||
.add(LootItem.lootTableItem(Registry.ModItems.CABLE.get()))
|
||||
.add(LootItem.lootTableItem(ModRegistry.Items.CABLE.get()))
|
||||
.when(ExplosionCondition.survivesExplosion())
|
||||
.when(LootItemBlockStatePropertyCondition.hasBlockStateProperties(Registry.ModBlocks.CABLE.get())
|
||||
.when(LootItemBlockStatePropertyCondition.hasBlockStateProperties(ModRegistry.Blocks.CABLE.get())
|
||||
.setProperties(StatePropertiesPredicate.Builder.properties().hasProperty(BlockCable.CABLE, true))
|
||||
)
|
||||
)
|
||||
.withPool(LootPool.lootPool()
|
||||
.setRolls(ConstantValue.exactly(1))
|
||||
.add(LootItem.lootTableItem(Registry.ModItems.WIRED_MODEM.get()))
|
||||
.add(LootItem.lootTableItem(ModRegistry.Items.WIRED_MODEM.get()))
|
||||
.when(ExplosionCondition.survivesExplosion())
|
||||
.when(LootItemBlockStatePropertyCondition.hasBlockStateProperties(Registry.ModBlocks.CABLE.get())
|
||||
.when(LootItemBlockStatePropertyCondition.hasBlockStateProperties(ModRegistry.Blocks.CABLE.get())
|
||||
.setProperties(StatePropertiesPredicate.Builder.properties().hasProperty(BlockCable.MODEM, CableModemVariant.None))
|
||||
.invert()
|
||||
)
|
||||
|
@ -14,8 +14,8 @@ import net.minecraft.resources.ResourceLocation;
|
||||
import javax.annotation.Nonnull;
|
||||
import java.util.function.Consumer;
|
||||
|
||||
import static dan200.computercraft.shared.Registry.ModItems;
|
||||
import static dan200.computercraft.shared.Registry.ModPocketUpgradeSerialisers;
|
||||
import static dan200.computercraft.shared.ModRegistry.Items;
|
||||
import static dan200.computercraft.shared.ModRegistry.PocketUpgradeSerialisers;
|
||||
|
||||
class PocketUpgradeGenerator extends PocketUpgradeDataProvider {
|
||||
PocketUpgradeGenerator(DataGenerator generator) {
|
||||
@ -24,9 +24,9 @@ class PocketUpgradeGenerator extends PocketUpgradeDataProvider {
|
||||
|
||||
@Override
|
||||
protected void addUpgrades(@Nonnull Consumer<Upgrade<PocketUpgradeSerialiser<?>>> addUpgrade) {
|
||||
addUpgrade.accept(simpleWithCustomItem(id("speaker"), ModPocketUpgradeSerialisers.SPEAKER.get(), ModItems.SPEAKER.get()));
|
||||
simpleWithCustomItem(id("wireless_modem_normal"), ModPocketUpgradeSerialisers.WIRELESS_MODEM_NORMAL.get(), ModItems.WIRELESS_MODEM_NORMAL.get()).add(addUpgrade);
|
||||
simpleWithCustomItem(id("wireless_modem_advanced"), ModPocketUpgradeSerialisers.WIRELESS_MODEM_ADVANCED.get(), ModItems.WIRELESS_MODEM_ADVANCED.get()).add(addUpgrade);
|
||||
addUpgrade.accept(simpleWithCustomItem(id("speaker"), PocketUpgradeSerialisers.SPEAKER.get(), Items.SPEAKER.get()));
|
||||
simpleWithCustomItem(id("wireless_modem_normal"), PocketUpgradeSerialisers.WIRELESS_MODEM_NORMAL.get(), Items.WIRELESS_MODEM_NORMAL.get()).add(addUpgrade);
|
||||
simpleWithCustomItem(id("wireless_modem_advanced"), PocketUpgradeSerialisers.WIRELESS_MODEM_ADVANCED.get(), Items.WIRELESS_MODEM_ADVANCED.get()).add(addUpgrade);
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
|
@ -9,7 +9,7 @@ import com.google.gson.JsonObject;
|
||||
import dan200.computercraft.ComputerCraft;
|
||||
import dan200.computercraft.api.pocket.PocketUpgradeDataProvider;
|
||||
import dan200.computercraft.api.turtle.TurtleUpgradeDataProvider;
|
||||
import dan200.computercraft.shared.Registry;
|
||||
import dan200.computercraft.shared.ModRegistry;
|
||||
import dan200.computercraft.shared.common.ColourableRecipe;
|
||||
import dan200.computercraft.shared.common.IColouredItem;
|
||||
import dan200.computercraft.shared.computer.core.ComputerFamily;
|
||||
@ -35,7 +35,6 @@ import net.minecraft.world.item.*;
|
||||
import net.minecraft.world.item.crafting.RecipeSerializer;
|
||||
import net.minecraft.world.item.crafting.SimpleRecipeSerializer;
|
||||
import net.minecraft.world.level.ItemLike;
|
||||
import net.minecraft.world.level.block.Blocks;
|
||||
import net.minecraftforge.common.Tags;
|
||||
import net.minecraftforge.registries.ForgeRegistries;
|
||||
|
||||
@ -79,12 +78,12 @@ class RecipeGenerator extends RecipeProvider {
|
||||
private void diskColours(@Nonnull Consumer<FinishedRecipe> add) {
|
||||
for (var colour : Colour.VALUES) {
|
||||
ShapelessRecipeBuilder
|
||||
.shapeless(Registry.ModItems.DISK.get())
|
||||
.shapeless(ModRegistry.Items.DISK.get())
|
||||
.requires(Tags.Items.DUSTS_REDSTONE)
|
||||
.requires(Items.PAPER)
|
||||
.requires(net.minecraft.world.item.Items.PAPER)
|
||||
.requires(DyeItem.byColor(ofColour(colour)))
|
||||
.group("computercraft:disk")
|
||||
.unlockedBy("has_drive", inventoryChange(Registry.ModBlocks.DISK_DRIVE.get()))
|
||||
.unlockedBy("has_drive", inventoryChange(ModRegistry.Blocks.DISK_DRIVE.get()))
|
||||
.save(
|
||||
RecipeWrapper.wrap(ImpostorShapelessRecipe.SERIALIZER, add)
|
||||
.withResultTag(x -> x.putInt(IColouredItem.NBT_COLOUR, colour.getHex())),
|
||||
@ -160,7 +159,7 @@ class RecipeGenerator extends RecipeProvider {
|
||||
|
||||
private void basicRecipes(@Nonnull Consumer<FinishedRecipe> add) {
|
||||
ShapedRecipeBuilder
|
||||
.shaped(Registry.ModItems.CABLE.get(), 6)
|
||||
.shaped(ModRegistry.Items.CABLE.get(), 6)
|
||||
.pattern(" # ")
|
||||
.pattern("#R#")
|
||||
.pattern(" # ")
|
||||
@ -171,7 +170,7 @@ class RecipeGenerator extends RecipeProvider {
|
||||
.save(add);
|
||||
|
||||
ShapedRecipeBuilder
|
||||
.shaped(Registry.ModBlocks.COMPUTER_NORMAL.get())
|
||||
.shaped(ModRegistry.Blocks.COMPUTER_NORMAL.get())
|
||||
.pattern("###")
|
||||
.pattern("#R#")
|
||||
.pattern("#G#")
|
||||
@ -182,78 +181,78 @@ class RecipeGenerator extends RecipeProvider {
|
||||
.save(add);
|
||||
|
||||
ShapedRecipeBuilder
|
||||
.shaped(Registry.ModBlocks.COMPUTER_ADVANCED.get())
|
||||
.shaped(ModRegistry.Blocks.COMPUTER_ADVANCED.get())
|
||||
.pattern("###")
|
||||
.pattern("#R#")
|
||||
.pattern("#G#")
|
||||
.define('#', Tags.Items.INGOTS_GOLD)
|
||||
.define('R', Tags.Items.DUSTS_REDSTONE)
|
||||
.define('G', Tags.Items.GLASS_PANES)
|
||||
.unlockedBy("has_components", inventoryChange(Items.REDSTONE, Items.GOLD_INGOT))
|
||||
.unlockedBy("has_components", inventoryChange(net.minecraft.world.item.Items.REDSTONE, net.minecraft.world.item.Items.GOLD_INGOT))
|
||||
.save(add);
|
||||
|
||||
ShapedRecipeBuilder
|
||||
.shaped(Registry.ModItems.COMPUTER_ADVANCED.get())
|
||||
.shaped(ModRegistry.Items.COMPUTER_ADVANCED.get())
|
||||
.pattern("###")
|
||||
.pattern("#C#")
|
||||
.pattern("# #")
|
||||
.define('#', Tags.Items.INGOTS_GOLD)
|
||||
.define('C', Registry.ModItems.COMPUTER_ADVANCED.get())
|
||||
.unlockedBy("has_components", inventoryChange(itemPredicate(Registry.ModItems.COMPUTER_NORMAL.get()), itemPredicate(Tags.Items.INGOTS_GOLD)))
|
||||
.define('C', ModRegistry.Items.COMPUTER_ADVANCED.get())
|
||||
.unlockedBy("has_components", inventoryChange(itemPredicate(ModRegistry.Items.COMPUTER_NORMAL.get()), itemPredicate(Tags.Items.INGOTS_GOLD)))
|
||||
.save(
|
||||
RecipeWrapper.wrap(ComputerUpgradeRecipe.SERIALIZER, add).withExtraData(family(ComputerFamily.ADVANCED)),
|
||||
new ResourceLocation(ComputerCraft.MOD_ID, "computer_advanced_upgrade")
|
||||
);
|
||||
|
||||
ShapedRecipeBuilder
|
||||
.shaped(Registry.ModBlocks.COMPUTER_COMMAND.get())
|
||||
.shaped(ModRegistry.Blocks.COMPUTER_COMMAND.get())
|
||||
.pattern("###")
|
||||
.pattern("#R#")
|
||||
.pattern("#G#")
|
||||
.define('#', Tags.Items.INGOTS_GOLD)
|
||||
.define('R', Blocks.COMMAND_BLOCK)
|
||||
.define('R', net.minecraft.world.level.block.Blocks.COMMAND_BLOCK)
|
||||
.define('G', Tags.Items.GLASS_PANES)
|
||||
.unlockedBy("has_components", inventoryChange(Blocks.COMMAND_BLOCK))
|
||||
.unlockedBy("has_components", inventoryChange(net.minecraft.world.level.block.Blocks.COMMAND_BLOCK))
|
||||
.save(add);
|
||||
|
||||
ShapedRecipeBuilder
|
||||
.shaped(Registry.ModBlocks.TURTLE_NORMAL.get())
|
||||
.shaped(ModRegistry.Blocks.TURTLE_NORMAL.get())
|
||||
.pattern("###")
|
||||
.pattern("#C#")
|
||||
.pattern("#I#")
|
||||
.define('#', Tags.Items.INGOTS_IRON)
|
||||
.define('C', Registry.ModItems.COMPUTER_NORMAL.get())
|
||||
.define('C', ModRegistry.Items.COMPUTER_NORMAL.get())
|
||||
.define('I', Tags.Items.CHESTS_WOODEN)
|
||||
.unlockedBy("has_computer", inventoryChange(Registry.ModItems.COMPUTER_NORMAL.get()))
|
||||
.unlockedBy("has_computer", inventoryChange(ModRegistry.Items.COMPUTER_NORMAL.get()))
|
||||
.save(RecipeWrapper.wrap(TurtleRecipe.SERIALIZER, add).withExtraData(family(ComputerFamily.NORMAL)));
|
||||
|
||||
ShapedRecipeBuilder
|
||||
.shaped(Registry.ModBlocks.TURTLE_ADVANCED.get())
|
||||
.shaped(ModRegistry.Blocks.TURTLE_ADVANCED.get())
|
||||
.pattern("###")
|
||||
.pattern("#C#")
|
||||
.pattern("#I#")
|
||||
.define('#', Tags.Items.INGOTS_GOLD)
|
||||
.define('C', Registry.ModItems.COMPUTER_ADVANCED.get())
|
||||
.define('C', ModRegistry.Items.COMPUTER_ADVANCED.get())
|
||||
.define('I', Tags.Items.CHESTS_WOODEN)
|
||||
.unlockedBy("has_computer", inventoryChange(Registry.ModItems.COMPUTER_NORMAL.get()))
|
||||
.unlockedBy("has_computer", inventoryChange(ModRegistry.Items.COMPUTER_NORMAL.get()))
|
||||
.save(RecipeWrapper.wrap(TurtleRecipe.SERIALIZER, add).withExtraData(family(ComputerFamily.ADVANCED)));
|
||||
|
||||
ShapedRecipeBuilder
|
||||
.shaped(Registry.ModBlocks.TURTLE_ADVANCED.get())
|
||||
.shaped(ModRegistry.Blocks.TURTLE_ADVANCED.get())
|
||||
.pattern("###")
|
||||
.pattern("#C#")
|
||||
.pattern(" B ")
|
||||
.define('#', Tags.Items.INGOTS_GOLD)
|
||||
.define('C', Registry.ModItems.COMPUTER_ADVANCED.get())
|
||||
.define('C', ModRegistry.Items.COMPUTER_ADVANCED.get())
|
||||
.define('B', Tags.Items.STORAGE_BLOCKS_GOLD)
|
||||
.unlockedBy("has_components", inventoryChange(itemPredicate(Registry.ModItems.TURTLE_NORMAL.get()), itemPredicate(Tags.Items.INGOTS_GOLD)))
|
||||
.unlockedBy("has_components", inventoryChange(itemPredicate(ModRegistry.Items.TURTLE_NORMAL.get()), itemPredicate(Tags.Items.INGOTS_GOLD)))
|
||||
.save(
|
||||
RecipeWrapper.wrap(ComputerUpgradeRecipe.SERIALIZER, add).withExtraData(family(ComputerFamily.ADVANCED)),
|
||||
new ResourceLocation(ComputerCraft.MOD_ID, "turtle_advanced_upgrade")
|
||||
);
|
||||
|
||||
ShapedRecipeBuilder
|
||||
.shaped(Registry.ModBlocks.DISK_DRIVE.get())
|
||||
.shaped(ModRegistry.Blocks.DISK_DRIVE.get())
|
||||
.pattern("###")
|
||||
.pattern("#R#")
|
||||
.pattern("#R#")
|
||||
@ -263,7 +262,7 @@ class RecipeGenerator extends RecipeProvider {
|
||||
.save(add);
|
||||
|
||||
ShapedRecipeBuilder
|
||||
.shaped(Registry.ModBlocks.MONITOR_NORMAL.get())
|
||||
.shaped(ModRegistry.Blocks.MONITOR_NORMAL.get())
|
||||
.pattern("###")
|
||||
.pattern("#G#")
|
||||
.pattern("###")
|
||||
@ -273,7 +272,7 @@ class RecipeGenerator extends RecipeProvider {
|
||||
.save(add);
|
||||
|
||||
ShapedRecipeBuilder
|
||||
.shaped(Registry.ModBlocks.MONITOR_ADVANCED.get(), 4)
|
||||
.shaped(ModRegistry.Blocks.MONITOR_ADVANCED.get(), 4)
|
||||
.pattern("###")
|
||||
.pattern("#G#")
|
||||
.pattern("###")
|
||||
@ -283,44 +282,44 @@ class RecipeGenerator extends RecipeProvider {
|
||||
.save(add);
|
||||
|
||||
ShapedRecipeBuilder
|
||||
.shaped(Registry.ModItems.POCKET_COMPUTER_NORMAL.get())
|
||||
.shaped(ModRegistry.Items.POCKET_COMPUTER_NORMAL.get())
|
||||
.pattern("###")
|
||||
.pattern("#A#")
|
||||
.pattern("#G#")
|
||||
.define('#', Tags.Items.STONE)
|
||||
.define('A', Items.GOLDEN_APPLE)
|
||||
.define('A', net.minecraft.world.item.Items.GOLDEN_APPLE)
|
||||
.define('G', Tags.Items.GLASS_PANES)
|
||||
.unlockedBy("has_computer", inventoryChange(COMPUTER))
|
||||
.unlockedBy("has_apple", inventoryChange(Items.GOLDEN_APPLE))
|
||||
.unlockedBy("has_apple", inventoryChange(net.minecraft.world.item.Items.GOLDEN_APPLE))
|
||||
.save(add);
|
||||
|
||||
ShapedRecipeBuilder
|
||||
.shaped(Registry.ModItems.POCKET_COMPUTER_ADVANCED.get())
|
||||
.shaped(ModRegistry.Items.POCKET_COMPUTER_ADVANCED.get())
|
||||
.pattern("###")
|
||||
.pattern("#A#")
|
||||
.pattern("#G#")
|
||||
.define('#', Tags.Items.INGOTS_GOLD)
|
||||
.define('A', Items.GOLDEN_APPLE)
|
||||
.define('A', net.minecraft.world.item.Items.GOLDEN_APPLE)
|
||||
.define('G', Tags.Items.GLASS_PANES)
|
||||
.unlockedBy("has_computer", inventoryChange(COMPUTER))
|
||||
.unlockedBy("has_apple", inventoryChange(Items.GOLDEN_APPLE))
|
||||
.unlockedBy("has_apple", inventoryChange(net.minecraft.world.item.Items.GOLDEN_APPLE))
|
||||
.save(add);
|
||||
|
||||
ShapedRecipeBuilder
|
||||
.shaped(Registry.ModItems.POCKET_COMPUTER_ADVANCED.get())
|
||||
.shaped(ModRegistry.Items.POCKET_COMPUTER_ADVANCED.get())
|
||||
.pattern("###")
|
||||
.pattern("#C#")
|
||||
.pattern("# #")
|
||||
.define('#', Tags.Items.INGOTS_GOLD)
|
||||
.define('C', Registry.ModItems.POCKET_COMPUTER_NORMAL.get())
|
||||
.unlockedBy("has_components", inventoryChange(itemPredicate(Registry.ModItems.POCKET_COMPUTER_NORMAL.get()), itemPredicate(Tags.Items.INGOTS_GOLD)))
|
||||
.define('C', ModRegistry.Items.POCKET_COMPUTER_NORMAL.get())
|
||||
.unlockedBy("has_components", inventoryChange(itemPredicate(ModRegistry.Items.POCKET_COMPUTER_NORMAL.get()), itemPredicate(Tags.Items.INGOTS_GOLD)))
|
||||
.save(
|
||||
RecipeWrapper.wrap(ComputerUpgradeRecipe.SERIALIZER, add).withExtraData(family(ComputerFamily.ADVANCED)),
|
||||
new ResourceLocation(ComputerCraft.MOD_ID, "pocket_computer_advanced_upgrade")
|
||||
);
|
||||
|
||||
ShapedRecipeBuilder
|
||||
.shaped(Registry.ModBlocks.PRINTER.get())
|
||||
.shaped(ModRegistry.Blocks.PRINTER.get())
|
||||
.pattern("###")
|
||||
.pattern("#R#")
|
||||
.pattern("#D#")
|
||||
@ -331,40 +330,40 @@ class RecipeGenerator extends RecipeProvider {
|
||||
.save(add);
|
||||
|
||||
ShapedRecipeBuilder
|
||||
.shaped(Registry.ModBlocks.SPEAKER.get())
|
||||
.shaped(ModRegistry.Blocks.SPEAKER.get())
|
||||
.pattern("###")
|
||||
.pattern("#N#")
|
||||
.pattern("#R#")
|
||||
.define('#', Tags.Items.STONE)
|
||||
.define('N', Blocks.NOTE_BLOCK)
|
||||
.define('N', net.minecraft.world.level.block.Blocks.NOTE_BLOCK)
|
||||
.define('R', Tags.Items.DUSTS_REDSTONE)
|
||||
.unlockedBy("has_computer", inventoryChange(COMPUTER))
|
||||
.save(add);
|
||||
|
||||
ShapedRecipeBuilder
|
||||
.shaped(Registry.ModItems.WIRED_MODEM.get())
|
||||
.shaped(ModRegistry.Items.WIRED_MODEM.get())
|
||||
.pattern("###")
|
||||
.pattern("#R#")
|
||||
.pattern("###")
|
||||
.define('#', Tags.Items.STONE)
|
||||
.define('R', Tags.Items.DUSTS_REDSTONE)
|
||||
.unlockedBy("has_computer", inventoryChange(COMPUTER))
|
||||
.unlockedBy("has_cable", inventoryChange(Registry.ModItems.CABLE.get()))
|
||||
.unlockedBy("has_cable", inventoryChange(ModRegistry.Items.CABLE.get()))
|
||||
.save(add);
|
||||
|
||||
ShapelessRecipeBuilder
|
||||
.shapeless(Registry.ModBlocks.WIRED_MODEM_FULL.get())
|
||||
.requires(Registry.ModItems.WIRED_MODEM.get())
|
||||
.shapeless(ModRegistry.Blocks.WIRED_MODEM_FULL.get())
|
||||
.requires(ModRegistry.Items.WIRED_MODEM.get())
|
||||
.unlockedBy("has_modem", inventoryChange(WIRED_MODEM))
|
||||
.save(add, new ResourceLocation(ComputerCraft.MOD_ID, "wired_modem_full_from"));
|
||||
ShapelessRecipeBuilder
|
||||
.shapeless(Registry.ModItems.WIRED_MODEM.get())
|
||||
.requires(Registry.ModBlocks.WIRED_MODEM_FULL.get())
|
||||
.shapeless(ModRegistry.Items.WIRED_MODEM.get())
|
||||
.requires(ModRegistry.Blocks.WIRED_MODEM_FULL.get())
|
||||
.unlockedBy("has_modem", inventoryChange(WIRED_MODEM))
|
||||
.save(add, new ResourceLocation(ComputerCraft.MOD_ID, "wired_modem_full_to"));
|
||||
|
||||
ShapedRecipeBuilder
|
||||
.shaped(Registry.ModBlocks.WIRELESS_MODEM_NORMAL.get())
|
||||
.shaped(ModRegistry.Blocks.WIRELESS_MODEM_NORMAL.get())
|
||||
.pattern("###")
|
||||
.pattern("#E#")
|
||||
.pattern("###")
|
||||
@ -374,21 +373,21 @@ class RecipeGenerator extends RecipeProvider {
|
||||
.save(add);
|
||||
|
||||
ShapedRecipeBuilder
|
||||
.shaped(Registry.ModBlocks.WIRELESS_MODEM_ADVANCED.get())
|
||||
.shaped(ModRegistry.Blocks.WIRELESS_MODEM_ADVANCED.get())
|
||||
.pattern("###")
|
||||
.pattern("#E#")
|
||||
.pattern("###")
|
||||
.define('#', Tags.Items.INGOTS_GOLD)
|
||||
.define('E', Items.ENDER_EYE)
|
||||
.define('E', net.minecraft.world.item.Items.ENDER_EYE)
|
||||
.unlockedBy("has_computer", inventoryChange(COMPUTER))
|
||||
.unlockedBy("has_wireless", inventoryChange(Registry.ModBlocks.WIRELESS_MODEM_NORMAL.get()))
|
||||
.unlockedBy("has_wireless", inventoryChange(ModRegistry.Blocks.WIRELESS_MODEM_NORMAL.get()))
|
||||
.save(add);
|
||||
|
||||
ShapelessRecipeBuilder
|
||||
.shapeless(Items.PLAYER_HEAD)
|
||||
.shapeless(net.minecraft.world.item.Items.PLAYER_HEAD)
|
||||
.requires(Tags.Items.HEADS)
|
||||
.requires(Registry.ModItems.MONITOR_NORMAL.get())
|
||||
.unlockedBy("has_monitor", inventoryChange(Registry.ModItems.MONITOR_NORMAL.get()))
|
||||
.requires(ModRegistry.Items.MONITOR_NORMAL.get())
|
||||
.unlockedBy("has_monitor", inventoryChange(ModRegistry.Items.MONITOR_NORMAL.get()))
|
||||
.save(
|
||||
RecipeWrapper.wrap(RecipeSerializer.SHAPELESS_RECIPE, add)
|
||||
.withResultTag(playerHead("Cloudhunter", "6d074736-b1e9-4378-a99b-bd8777821c9c")),
|
||||
@ -396,10 +395,10 @@ class RecipeGenerator extends RecipeProvider {
|
||||
);
|
||||
|
||||
ShapelessRecipeBuilder
|
||||
.shapeless(Items.PLAYER_HEAD)
|
||||
.shapeless(net.minecraft.world.item.Items.PLAYER_HEAD)
|
||||
.requires(Tags.Items.HEADS)
|
||||
.requires(Registry.ModItems.COMPUTER_ADVANCED.get())
|
||||
.unlockedBy("has_computer", inventoryChange(Registry.ModItems.COMPUTER_ADVANCED.get()))
|
||||
.requires(ModRegistry.Items.COMPUTER_ADVANCED.get())
|
||||
.unlockedBy("has_computer", inventoryChange(ModRegistry.Items.COMPUTER_ADVANCED.get()))
|
||||
.save(
|
||||
RecipeWrapper.wrap(RecipeSerializer.SHAPELESS_RECIPE, add)
|
||||
.withResultTag(playerHead("dan200", "f3c8d69b-0776-4512-8434-d1b2165909eb")),
|
||||
@ -407,18 +406,18 @@ class RecipeGenerator extends RecipeProvider {
|
||||
);
|
||||
|
||||
ShapelessRecipeBuilder
|
||||
.shapeless(Registry.ModItems.PRINTED_PAGES.get())
|
||||
.requires(Registry.ModItems.PRINTED_PAGE.get(), 2)
|
||||
.shapeless(ModRegistry.Items.PRINTED_PAGES.get())
|
||||
.requires(ModRegistry.Items.PRINTED_PAGE.get(), 2)
|
||||
.requires(Tags.Items.STRING)
|
||||
.unlockedBy("has_printer", inventoryChange(Registry.ModBlocks.PRINTER.get()))
|
||||
.unlockedBy("has_printer", inventoryChange(ModRegistry.Blocks.PRINTER.get()))
|
||||
.save(RecipeWrapper.wrap(ImpostorShapelessRecipe.SERIALIZER, add));
|
||||
|
||||
ShapelessRecipeBuilder
|
||||
.shapeless(Registry.ModItems.PRINTED_BOOK.get())
|
||||
.shapeless(ModRegistry.Items.PRINTED_BOOK.get())
|
||||
.requires(Tags.Items.LEATHER)
|
||||
.requires(Registry.ModItems.PRINTED_PAGE.get(), 1)
|
||||
.requires(ModRegistry.Items.PRINTED_PAGE.get(), 1)
|
||||
.requires(Tags.Items.STRING)
|
||||
.unlockedBy("has_printer", inventoryChange(Registry.ModBlocks.PRINTER.get()))
|
||||
.unlockedBy("has_printer", inventoryChange(ModRegistry.Blocks.PRINTER.get()))
|
||||
.save(RecipeWrapper.wrap(ImpostorShapelessRecipe.SERIALIZER, add));
|
||||
}
|
||||
|
||||
|
@ -11,13 +11,12 @@ import dan200.computercraft.api.turtle.TurtleUpgradeDataProvider;
|
||||
import dan200.computercraft.api.turtle.TurtleUpgradeSerialiser;
|
||||
import net.minecraft.data.DataGenerator;
|
||||
import net.minecraft.resources.ResourceLocation;
|
||||
import net.minecraft.world.item.Items;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
import java.util.function.Consumer;
|
||||
|
||||
import static dan200.computercraft.shared.Registry.ModItems;
|
||||
import static dan200.computercraft.shared.Registry.ModTurtleSerialisers;
|
||||
import static dan200.computercraft.shared.ModRegistry.Items;
|
||||
import static dan200.computercraft.shared.ModRegistry.TurtleSerialisers;
|
||||
|
||||
class TurtleUpgradeGenerator extends TurtleUpgradeDataProvider {
|
||||
TurtleUpgradeGenerator(DataGenerator generator) {
|
||||
@ -26,16 +25,16 @@ class TurtleUpgradeGenerator extends TurtleUpgradeDataProvider {
|
||||
|
||||
@Override
|
||||
protected void addUpgrades(@Nonnull Consumer<Upgrade<TurtleUpgradeSerialiser<?>>> addUpgrade) {
|
||||
simpleWithCustomItem(id("speaker"), ModTurtleSerialisers.SPEAKER.get(), ModItems.SPEAKER.get()).add(addUpgrade);
|
||||
simpleWithCustomItem(vanilla("crafting_table"), ModTurtleSerialisers.WORKBENCH.get(), Items.CRAFTING_TABLE).add(addUpgrade);
|
||||
simpleWithCustomItem(id("wireless_modem_normal"), ModTurtleSerialisers.WIRELESS_MODEM_NORMAL.get(), ModItems.WIRELESS_MODEM_NORMAL.get()).add(addUpgrade);
|
||||
simpleWithCustomItem(id("wireless_modem_advanced"), ModTurtleSerialisers.WIRELESS_MODEM_ADVANCED.get(), ModItems.WIRELESS_MODEM_ADVANCED.get()).add(addUpgrade);
|
||||
simpleWithCustomItem(id("speaker"), TurtleSerialisers.SPEAKER.get(), Items.SPEAKER.get()).add(addUpgrade);
|
||||
simpleWithCustomItem(vanilla("crafting_table"), TurtleSerialisers.WORKBENCH.get(), net.minecraft.world.item.Items.CRAFTING_TABLE).add(addUpgrade);
|
||||
simpleWithCustomItem(id("wireless_modem_normal"), TurtleSerialisers.WIRELESS_MODEM_NORMAL.get(), Items.WIRELESS_MODEM_NORMAL.get()).add(addUpgrade);
|
||||
simpleWithCustomItem(id("wireless_modem_advanced"), TurtleSerialisers.WIRELESS_MODEM_ADVANCED.get(), Items.WIRELESS_MODEM_ADVANCED.get()).add(addUpgrade);
|
||||
|
||||
tool(vanilla("diamond_axe"), Items.DIAMOND_AXE).damageMultiplier(6.0f).add(addUpgrade);
|
||||
tool(vanilla("diamond_pickaxe"), Items.DIAMOND_PICKAXE).add(addUpgrade);
|
||||
tool(vanilla("diamond_hoe"), Items.DIAMOND_HOE).breakable(Blocks.TURTLE_HOE_BREAKABLE).add(addUpgrade);
|
||||
tool(vanilla("diamond_shovel"), Items.DIAMOND_SHOVEL).breakable(Blocks.TURTLE_SHOVEL_BREAKABLE).add(addUpgrade);
|
||||
tool(vanilla("diamond_sword"), Items.DIAMOND_SWORD).breakable(Blocks.TURTLE_SWORD_BREAKABLE).damageMultiplier(9.0f).add(addUpgrade);
|
||||
tool(vanilla("diamond_axe"), net.minecraft.world.item.Items.DIAMOND_AXE).damageMultiplier(6.0f).add(addUpgrade);
|
||||
tool(vanilla("diamond_pickaxe"), net.minecraft.world.item.Items.DIAMOND_PICKAXE).add(addUpgrade);
|
||||
tool(vanilla("diamond_hoe"), net.minecraft.world.item.Items.DIAMOND_HOE).breakable(Blocks.TURTLE_HOE_BREAKABLE).add(addUpgrade);
|
||||
tool(vanilla("diamond_shovel"), net.minecraft.world.item.Items.DIAMOND_SHOVEL).breakable(Blocks.TURTLE_SHOVEL_BREAKABLE).add(addUpgrade);
|
||||
tool(vanilla("diamond_sword"), net.minecraft.world.item.Items.DIAMOND_SWORD).breakable(Blocks.TURTLE_SWORD_BREAKABLE).damageMultiplier(9.0f).add(addUpgrade);
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
|
@ -7,7 +7,7 @@ package dan200.computercraft.mixin;
|
||||
|
||||
import com.mojang.blaze3d.vertex.PoseStack;
|
||||
import com.mojang.blaze3d.vertex.VertexConsumer;
|
||||
import dan200.computercraft.shared.Registry;
|
||||
import dan200.computercraft.shared.ModRegistry;
|
||||
import dan200.computercraft.shared.peripheral.modem.wired.BlockCable;
|
||||
import dan200.computercraft.shared.peripheral.modem.wired.CableModemVariant;
|
||||
import dan200.computercraft.shared.peripheral.modem.wired.CableShapes;
|
||||
@ -61,7 +61,7 @@ public class BlockRenderDispatcherMixin {
|
||||
CallbackInfo info
|
||||
) {
|
||||
// Only apply to cables which have both a cable and modem
|
||||
if (state.getBlock() != Registry.ModBlocks.CABLE.get()
|
||||
if (state.getBlock() != ModRegistry.Blocks.CABLE.get()
|
||||
|| !state.getValue(BlockCable.CABLE)
|
||||
|| state.getValue(BlockCable.MODEM) == CableModemVariant.None
|
||||
) {
|
||||
|
@ -83,6 +83,7 @@ import dan200.computercraft.shared.util.ImpostorShapelessRecipe;
|
||||
import net.minecraft.commands.synchronization.ArgumentTypeInfo;
|
||||
import net.minecraft.commands.synchronization.ArgumentTypeInfos;
|
||||
import net.minecraft.commands.synchronization.SingletonArgumentInfo;
|
||||
import net.minecraft.core.Registry;
|
||||
import net.minecraft.core.cauldron.CauldronInteraction;
|
||||
import net.minecraft.resources.ResourceLocation;
|
||||
import net.minecraft.world.inventory.MenuType;
|
||||
@ -107,14 +108,14 @@ import net.minecraftforge.registries.*;
|
||||
import java.util.function.BiFunction;
|
||||
|
||||
@Mod.EventBusSubscriber(modid = ComputerCraft.MOD_ID, bus = Mod.EventBusSubscriber.Bus.MOD)
|
||||
public final class Registry {
|
||||
public final class ModRegistry {
|
||||
private static final CreativeModeTab mainItemGroup = new CreativeTabMain();
|
||||
|
||||
private Registry() {
|
||||
private ModRegistry() {
|
||||
}
|
||||
|
||||
public static final class ModBlocks {
|
||||
static final DeferredRegister<Block> BLOCKS = DeferredRegister.create(ForgeRegistries.BLOCKS, ComputerCraft.MOD_ID);
|
||||
public static final class Blocks {
|
||||
static final DeferredRegister<Block> REGISTRY = DeferredRegister.create(ForgeRegistries.BLOCKS, ComputerCraft.MOD_ID);
|
||||
|
||||
private static BlockBehaviour.Properties properties() {
|
||||
return BlockBehaviour.Properties.of(Material.STONE).strength(2);
|
||||
@ -128,190 +129,190 @@ public final class Registry {
|
||||
return BlockBehaviour.Properties.of(Material.STONE).strength(1.5f);
|
||||
}
|
||||
|
||||
public static final RegistryObject<BlockComputer<TileComputer>> COMPUTER_NORMAL = BLOCKS.register("computer_normal",
|
||||
() -> new BlockComputer<>(properties(), ComputerFamily.NORMAL, ModBlockEntities.COMPUTER_NORMAL));
|
||||
public static final RegistryObject<BlockComputer<TileComputer>> COMPUTER_ADVANCED = BLOCKS.register("computer_advanced",
|
||||
() -> new BlockComputer<>(properties(), ComputerFamily.ADVANCED, ModBlockEntities.COMPUTER_ADVANCED));
|
||||
public static final RegistryObject<BlockComputer<TileComputer>> COMPUTER_NORMAL = REGISTRY.register("computer_normal",
|
||||
() -> new BlockComputer<>(properties(), ComputerFamily.NORMAL, BlockEntities.COMPUTER_NORMAL));
|
||||
public static final RegistryObject<BlockComputer<TileComputer>> COMPUTER_ADVANCED = REGISTRY.register("computer_advanced",
|
||||
() -> new BlockComputer<>(properties(), ComputerFamily.ADVANCED, BlockEntities.COMPUTER_ADVANCED));
|
||||
|
||||
public static final RegistryObject<BlockComputer<TileCommandComputer>> COMPUTER_COMMAND = BLOCKS.register("computer_command", () -> new BlockComputer<>(
|
||||
public static final RegistryObject<BlockComputer<TileCommandComputer>> COMPUTER_COMMAND = REGISTRY.register("computer_command", () -> new BlockComputer<>(
|
||||
BlockBehaviour.Properties.of(Material.STONE).strength(-1, 6000000.0F),
|
||||
ComputerFamily.COMMAND, ModBlockEntities.COMPUTER_COMMAND
|
||||
ComputerFamily.COMMAND, BlockEntities.COMPUTER_COMMAND
|
||||
));
|
||||
|
||||
public static final RegistryObject<BlockTurtle> TURTLE_NORMAL = BLOCKS.register("turtle_normal",
|
||||
() -> new BlockTurtle(turtleProperties(), ComputerFamily.NORMAL, ModBlockEntities.TURTLE_NORMAL));
|
||||
public static final RegistryObject<BlockTurtle> TURTLE_ADVANCED = BLOCKS.register("turtle_advanced",
|
||||
() -> new BlockTurtle(turtleProperties(), ComputerFamily.ADVANCED, ModBlockEntities.TURTLE_ADVANCED));
|
||||
public static final RegistryObject<BlockTurtle> TURTLE_NORMAL = REGISTRY.register("turtle_normal",
|
||||
() -> new BlockTurtle(turtleProperties(), ComputerFamily.NORMAL, BlockEntities.TURTLE_NORMAL));
|
||||
public static final RegistryObject<BlockTurtle> TURTLE_ADVANCED = REGISTRY.register("turtle_advanced",
|
||||
() -> new BlockTurtle(turtleProperties(), ComputerFamily.ADVANCED, BlockEntities.TURTLE_ADVANCED));
|
||||
|
||||
public static final RegistryObject<BlockSpeaker> SPEAKER = BLOCKS.register("speaker", () -> new BlockSpeaker(properties()));
|
||||
public static final RegistryObject<BlockDiskDrive> DISK_DRIVE = BLOCKS.register("disk_drive", () -> new BlockDiskDrive(properties()));
|
||||
public static final RegistryObject<BlockPrinter> PRINTER = BLOCKS.register("printer", () -> new BlockPrinter(properties()));
|
||||
public static final RegistryObject<BlockSpeaker> SPEAKER = REGISTRY.register("speaker", () -> new BlockSpeaker(properties()));
|
||||
public static final RegistryObject<BlockDiskDrive> DISK_DRIVE = REGISTRY.register("disk_drive", () -> new BlockDiskDrive(properties()));
|
||||
public static final RegistryObject<BlockPrinter> PRINTER = REGISTRY.register("printer", () -> new BlockPrinter(properties()));
|
||||
|
||||
public static final RegistryObject<BlockMonitor> MONITOR_NORMAL = BLOCKS.register("monitor_normal",
|
||||
() -> new BlockMonitor(properties(), ModBlockEntities.MONITOR_NORMAL));
|
||||
public static final RegistryObject<BlockMonitor> MONITOR_ADVANCED = BLOCKS.register("monitor_advanced",
|
||||
() -> new BlockMonitor(properties(), ModBlockEntities.MONITOR_ADVANCED));
|
||||
public static final RegistryObject<BlockMonitor> MONITOR_NORMAL = REGISTRY.register("monitor_normal",
|
||||
() -> new BlockMonitor(properties(), BlockEntities.MONITOR_NORMAL));
|
||||
public static final RegistryObject<BlockMonitor> MONITOR_ADVANCED = REGISTRY.register("monitor_advanced",
|
||||
() -> new BlockMonitor(properties(), BlockEntities.MONITOR_ADVANCED));
|
||||
|
||||
public static final RegistryObject<BlockWirelessModem> WIRELESS_MODEM_NORMAL = BLOCKS.register("wireless_modem_normal",
|
||||
() -> new BlockWirelessModem(properties(), ModBlockEntities.WIRELESS_MODEM_NORMAL));
|
||||
public static final RegistryObject<BlockWirelessModem> WIRELESS_MODEM_ADVANCED = BLOCKS.register("wireless_modem_advanced",
|
||||
() -> new BlockWirelessModem(properties(), ModBlockEntities.WIRELESS_MODEM_ADVANCED));
|
||||
public static final RegistryObject<BlockWirelessModem> WIRELESS_MODEM_NORMAL = REGISTRY.register("wireless_modem_normal",
|
||||
() -> new BlockWirelessModem(properties(), BlockEntities.WIRELESS_MODEM_NORMAL));
|
||||
public static final RegistryObject<BlockWirelessModem> WIRELESS_MODEM_ADVANCED = REGISTRY.register("wireless_modem_advanced",
|
||||
() -> new BlockWirelessModem(properties(), BlockEntities.WIRELESS_MODEM_ADVANCED));
|
||||
|
||||
public static final RegistryObject<BlockWiredModemFull> WIRED_MODEM_FULL = BLOCKS.register("wired_modem_full",
|
||||
public static final RegistryObject<BlockWiredModemFull> WIRED_MODEM_FULL = REGISTRY.register("wired_modem_full",
|
||||
() -> new BlockWiredModemFull(modemProperties()));
|
||||
public static final RegistryObject<BlockCable> CABLE = BLOCKS.register("cable", () -> new BlockCable(modemProperties()));
|
||||
public static final RegistryObject<BlockCable> CABLE = REGISTRY.register("cable", () -> new BlockCable(modemProperties()));
|
||||
}
|
||||
|
||||
public static class ModBlockEntities {
|
||||
static final DeferredRegister<BlockEntityType<?>> TILES = DeferredRegister.create(ForgeRegistries.BLOCK_ENTITY_TYPES, ComputerCraft.MOD_ID);
|
||||
public static class BlockEntities {
|
||||
static final DeferredRegister<BlockEntityType<?>> REGISTRY = DeferredRegister.create(ForgeRegistries.BLOCK_ENTITY_TYPES, ComputerCraft.MOD_ID);
|
||||
|
||||
private static <T extends BlockEntity> RegistryObject<BlockEntityType<T>> ofBlock(RegistryObject<? extends Block> block, FixedPointTileEntityType.FixedPointBlockEntitySupplier<T> factory) {
|
||||
return TILES.register(block.getId().getPath(), () -> FixedPointTileEntityType.create(block, factory));
|
||||
return REGISTRY.register(block.getId().getPath(), () -> FixedPointTileEntityType.create(block, factory));
|
||||
}
|
||||
|
||||
public static final RegistryObject<BlockEntityType<TileMonitor>> MONITOR_NORMAL =
|
||||
ofBlock(ModBlocks.MONITOR_NORMAL, (f, p, s) -> new TileMonitor(f, p, s, false));
|
||||
ofBlock(Blocks.MONITOR_NORMAL, (f, p, s) -> new TileMonitor(f, p, s, false));
|
||||
public static final RegistryObject<BlockEntityType<TileMonitor>> MONITOR_ADVANCED =
|
||||
ofBlock(ModBlocks.MONITOR_ADVANCED, (f, p, s) -> new TileMonitor(f, p, s, true));
|
||||
ofBlock(Blocks.MONITOR_ADVANCED, (f, p, s) -> new TileMonitor(f, p, s, true));
|
||||
|
||||
public static final RegistryObject<BlockEntityType<TileComputer>> COMPUTER_NORMAL =
|
||||
ofBlock(ModBlocks.COMPUTER_NORMAL, (f, p, s) -> new TileComputer(f, p, s, ComputerFamily.NORMAL));
|
||||
ofBlock(Blocks.COMPUTER_NORMAL, (f, p, s) -> new TileComputer(f, p, s, ComputerFamily.NORMAL));
|
||||
public static final RegistryObject<BlockEntityType<TileComputer>> COMPUTER_ADVANCED =
|
||||
ofBlock(ModBlocks.COMPUTER_ADVANCED, (f, p, s) -> new TileComputer(f, p, s, ComputerFamily.ADVANCED));
|
||||
ofBlock(Blocks.COMPUTER_ADVANCED, (f, p, s) -> new TileComputer(f, p, s, ComputerFamily.ADVANCED));
|
||||
public static final RegistryObject<BlockEntityType<TileCommandComputer>> COMPUTER_COMMAND =
|
||||
ofBlock(ModBlocks.COMPUTER_COMMAND, TileCommandComputer::new);
|
||||
ofBlock(Blocks.COMPUTER_COMMAND, TileCommandComputer::new);
|
||||
|
||||
public static final RegistryObject<BlockEntityType<TileTurtle>> TURTLE_NORMAL =
|
||||
ofBlock(ModBlocks.TURTLE_NORMAL, (f, p, s) -> new TileTurtle(f, p, s, ComputerFamily.NORMAL));
|
||||
ofBlock(Blocks.TURTLE_NORMAL, (f, p, s) -> new TileTurtle(f, p, s, ComputerFamily.NORMAL));
|
||||
public static final RegistryObject<BlockEntityType<TileTurtle>> TURTLE_ADVANCED =
|
||||
ofBlock(ModBlocks.TURTLE_ADVANCED, (f, p, s) -> new TileTurtle(f, p, s, ComputerFamily.ADVANCED));
|
||||
ofBlock(Blocks.TURTLE_ADVANCED, (f, p, s) -> new TileTurtle(f, p, s, ComputerFamily.ADVANCED));
|
||||
|
||||
public static final RegistryObject<BlockEntityType<TileSpeaker>> SPEAKER = ofBlock(ModBlocks.SPEAKER, TileSpeaker::new);
|
||||
public static final RegistryObject<BlockEntityType<TileDiskDrive>> DISK_DRIVE = ofBlock(ModBlocks.DISK_DRIVE, TileDiskDrive::new);
|
||||
public static final RegistryObject<BlockEntityType<TilePrinter>> PRINTER = ofBlock(ModBlocks.PRINTER, TilePrinter::new);
|
||||
public static final RegistryObject<BlockEntityType<TileWiredModemFull>> WIRED_MODEM_FULL = ofBlock(ModBlocks.WIRED_MODEM_FULL, TileWiredModemFull::new);
|
||||
public static final RegistryObject<BlockEntityType<TileCable>> CABLE = ofBlock(ModBlocks.CABLE, TileCable::new);
|
||||
public static final RegistryObject<BlockEntityType<TileSpeaker>> SPEAKER = ofBlock(Blocks.SPEAKER, TileSpeaker::new);
|
||||
public static final RegistryObject<BlockEntityType<TileDiskDrive>> DISK_DRIVE = ofBlock(Blocks.DISK_DRIVE, TileDiskDrive::new);
|
||||
public static final RegistryObject<BlockEntityType<TilePrinter>> PRINTER = ofBlock(Blocks.PRINTER, TilePrinter::new);
|
||||
public static final RegistryObject<BlockEntityType<TileWiredModemFull>> WIRED_MODEM_FULL = ofBlock(Blocks.WIRED_MODEM_FULL, TileWiredModemFull::new);
|
||||
public static final RegistryObject<BlockEntityType<TileCable>> CABLE = ofBlock(Blocks.CABLE, TileCable::new);
|
||||
|
||||
public static final RegistryObject<BlockEntityType<TileWirelessModem>> WIRELESS_MODEM_NORMAL =
|
||||
ofBlock(ModBlocks.WIRELESS_MODEM_NORMAL, (f, p, s) -> new TileWirelessModem(f, p, s, false));
|
||||
ofBlock(Blocks.WIRELESS_MODEM_NORMAL, (f, p, s) -> new TileWirelessModem(f, p, s, false));
|
||||
public static final RegistryObject<BlockEntityType<TileWirelessModem>> WIRELESS_MODEM_ADVANCED =
|
||||
ofBlock(ModBlocks.WIRELESS_MODEM_ADVANCED, (f, p, s) -> new TileWirelessModem(f, p, s, true));
|
||||
ofBlock(Blocks.WIRELESS_MODEM_ADVANCED, (f, p, s) -> new TileWirelessModem(f, p, s, true));
|
||||
}
|
||||
|
||||
public static final class ModItems {
|
||||
static final DeferredRegister<Item> ITEMS = DeferredRegister.create(ForgeRegistries.ITEMS, ComputerCraft.MOD_ID);
|
||||
public static final class Items {
|
||||
static final DeferredRegister<Item> REGISTRY = DeferredRegister.create(ForgeRegistries.ITEMS, ComputerCraft.MOD_ID);
|
||||
|
||||
private static Item.Properties properties() {
|
||||
return new Item.Properties().tab(mainItemGroup);
|
||||
}
|
||||
|
||||
private static <B extends Block, I extends Item> RegistryObject<I> ofBlock(RegistryObject<B> parent, BiFunction<B, Item.Properties, I> supplier) {
|
||||
return ITEMS.register(parent.getId().getPath(), () -> supplier.apply(parent.get(), properties()));
|
||||
return REGISTRY.register(parent.getId().getPath(), () -> supplier.apply(parent.get(), properties()));
|
||||
}
|
||||
|
||||
public static final RegistryObject<ItemComputer> COMPUTER_NORMAL = ofBlock(ModBlocks.COMPUTER_NORMAL, ItemComputer::new);
|
||||
public static final RegistryObject<ItemComputer> COMPUTER_ADVANCED = ofBlock(ModBlocks.COMPUTER_ADVANCED, ItemComputer::new);
|
||||
public static final RegistryObject<ItemComputer> COMPUTER_COMMAND = ofBlock(ModBlocks.COMPUTER_COMMAND, ItemComputer::new);
|
||||
public static final RegistryObject<ItemComputer> COMPUTER_NORMAL = ofBlock(Blocks.COMPUTER_NORMAL, ItemComputer::new);
|
||||
public static final RegistryObject<ItemComputer> COMPUTER_ADVANCED = ofBlock(Blocks.COMPUTER_ADVANCED, ItemComputer::new);
|
||||
public static final RegistryObject<ItemComputer> COMPUTER_COMMAND = ofBlock(Blocks.COMPUTER_COMMAND, ItemComputer::new);
|
||||
|
||||
public static final RegistryObject<ItemPocketComputer> POCKET_COMPUTER_NORMAL = ITEMS.register("pocket_computer_normal",
|
||||
public static final RegistryObject<ItemPocketComputer> POCKET_COMPUTER_NORMAL = REGISTRY.register("pocket_computer_normal",
|
||||
() -> new ItemPocketComputer(properties().stacksTo(1), ComputerFamily.NORMAL));
|
||||
public static final RegistryObject<ItemPocketComputer> POCKET_COMPUTER_ADVANCED = ITEMS.register("pocket_computer_advanced",
|
||||
public static final RegistryObject<ItemPocketComputer> POCKET_COMPUTER_ADVANCED = REGISTRY.register("pocket_computer_advanced",
|
||||
() -> new ItemPocketComputer(properties().stacksTo(1), ComputerFamily.ADVANCED));
|
||||
|
||||
public static final RegistryObject<ItemTurtle> TURTLE_NORMAL = ofBlock(ModBlocks.TURTLE_NORMAL, ItemTurtle::new);
|
||||
public static final RegistryObject<ItemTurtle> TURTLE_ADVANCED = ofBlock(ModBlocks.TURTLE_ADVANCED, ItemTurtle::new);
|
||||
public static final RegistryObject<ItemTurtle> TURTLE_NORMAL = ofBlock(Blocks.TURTLE_NORMAL, ItemTurtle::new);
|
||||
public static final RegistryObject<ItemTurtle> TURTLE_ADVANCED = ofBlock(Blocks.TURTLE_ADVANCED, ItemTurtle::new);
|
||||
|
||||
public static final RegistryObject<ItemDisk> DISK =
|
||||
ITEMS.register("disk", () -> new ItemDisk(properties().stacksTo(1)));
|
||||
REGISTRY.register("disk", () -> new ItemDisk(properties().stacksTo(1)));
|
||||
public static final RegistryObject<ItemTreasureDisk> TREASURE_DISK =
|
||||
ITEMS.register("treasure_disk", () -> new ItemTreasureDisk(properties().stacksTo(1)));
|
||||
REGISTRY.register("treasure_disk", () -> new ItemTreasureDisk(properties().stacksTo(1)));
|
||||
|
||||
public static final RegistryObject<ItemPrintout> PRINTED_PAGE = ITEMS.register("printed_page",
|
||||
public static final RegistryObject<ItemPrintout> PRINTED_PAGE = REGISTRY.register("printed_page",
|
||||
() -> new ItemPrintout(properties().stacksTo(1), ItemPrintout.Type.PAGE));
|
||||
public static final RegistryObject<ItemPrintout> PRINTED_PAGES = ITEMS.register("printed_pages",
|
||||
public static final RegistryObject<ItemPrintout> PRINTED_PAGES = REGISTRY.register("printed_pages",
|
||||
() -> new ItemPrintout(properties().stacksTo(1), ItemPrintout.Type.PAGES));
|
||||
public static final RegistryObject<ItemPrintout> PRINTED_BOOK = ITEMS.register("printed_book",
|
||||
public static final RegistryObject<ItemPrintout> PRINTED_BOOK = REGISTRY.register("printed_book",
|
||||
() -> new ItemPrintout(properties().stacksTo(1), ItemPrintout.Type.BOOK));
|
||||
|
||||
public static final RegistryObject<BlockItem> SPEAKER = ofBlock(ModBlocks.SPEAKER, BlockItem::new);
|
||||
public static final RegistryObject<BlockItem> DISK_DRIVE = ofBlock(ModBlocks.DISK_DRIVE, BlockItem::new);
|
||||
public static final RegistryObject<BlockItem> PRINTER = ofBlock(ModBlocks.PRINTER, BlockItem::new);
|
||||
public static final RegistryObject<BlockItem> MONITOR_NORMAL = ofBlock(ModBlocks.MONITOR_NORMAL, BlockItem::new);
|
||||
public static final RegistryObject<BlockItem> MONITOR_ADVANCED = ofBlock(ModBlocks.MONITOR_ADVANCED, BlockItem::new);
|
||||
public static final RegistryObject<BlockItem> WIRELESS_MODEM_NORMAL = ofBlock(ModBlocks.WIRELESS_MODEM_NORMAL, BlockItem::new);
|
||||
public static final RegistryObject<BlockItem> WIRELESS_MODEM_ADVANCED = ofBlock(ModBlocks.WIRELESS_MODEM_ADVANCED, BlockItem::new);
|
||||
public static final RegistryObject<BlockItem> WIRED_MODEM_FULL = ofBlock(ModBlocks.WIRED_MODEM_FULL, BlockItem::new);
|
||||
public static final RegistryObject<BlockItem> SPEAKER = ofBlock(Blocks.SPEAKER, BlockItem::new);
|
||||
public static final RegistryObject<BlockItem> DISK_DRIVE = ofBlock(Blocks.DISK_DRIVE, BlockItem::new);
|
||||
public static final RegistryObject<BlockItem> PRINTER = ofBlock(Blocks.PRINTER, BlockItem::new);
|
||||
public static final RegistryObject<BlockItem> MONITOR_NORMAL = ofBlock(Blocks.MONITOR_NORMAL, BlockItem::new);
|
||||
public static final RegistryObject<BlockItem> MONITOR_ADVANCED = ofBlock(Blocks.MONITOR_ADVANCED, BlockItem::new);
|
||||
public static final RegistryObject<BlockItem> WIRELESS_MODEM_NORMAL = ofBlock(Blocks.WIRELESS_MODEM_NORMAL, BlockItem::new);
|
||||
public static final RegistryObject<BlockItem> WIRELESS_MODEM_ADVANCED = ofBlock(Blocks.WIRELESS_MODEM_ADVANCED, BlockItem::new);
|
||||
public static final RegistryObject<BlockItem> WIRED_MODEM_FULL = ofBlock(Blocks.WIRED_MODEM_FULL, BlockItem::new);
|
||||
|
||||
public static final RegistryObject<ItemBlockCable.Cable> CABLE = ITEMS.register("cable",
|
||||
() -> new ItemBlockCable.Cable(ModBlocks.CABLE.get(), properties()));
|
||||
public static final RegistryObject<ItemBlockCable.WiredModem> WIRED_MODEM = ITEMS.register("wired_modem",
|
||||
() -> new ItemBlockCable.WiredModem(ModBlocks.CABLE.get(), properties()));
|
||||
public static final RegistryObject<ItemBlockCable.Cable> CABLE = REGISTRY.register("cable",
|
||||
() -> new ItemBlockCable.Cable(Blocks.CABLE.get(), properties()));
|
||||
public static final RegistryObject<ItemBlockCable.WiredModem> WIRED_MODEM = REGISTRY.register("wired_modem",
|
||||
() -> new ItemBlockCable.WiredModem(Blocks.CABLE.get(), properties()));
|
||||
}
|
||||
|
||||
public static class ModTurtleSerialisers {
|
||||
static final DeferredRegister<TurtleUpgradeSerialiser<?>> SERIALISERS = DeferredRegister.create(TurtleUpgradeSerialiser.REGISTRY_ID.location(), ComputerCraft.MOD_ID);
|
||||
public static class TurtleSerialisers {
|
||||
static final DeferredRegister<TurtleUpgradeSerialiser<?>> REGISTRY = DeferredRegister.create(TurtleUpgradeSerialiser.REGISTRY_ID.location(), ComputerCraft.MOD_ID);
|
||||
|
||||
public static final RegistryObject<TurtleUpgradeSerialiser<TurtleSpeaker>> SPEAKER =
|
||||
SERIALISERS.register("speaker", () -> TurtleUpgradeSerialiser.simpleWithCustomItem(TurtleSpeaker::new));
|
||||
REGISTRY.register("speaker", () -> TurtleUpgradeSerialiser.simpleWithCustomItem(TurtleSpeaker::new));
|
||||
public static final RegistryObject<TurtleUpgradeSerialiser<TurtleCraftingTable>> WORKBENCH =
|
||||
SERIALISERS.register("workbench", () -> TurtleUpgradeSerialiser.simpleWithCustomItem(TurtleCraftingTable::new));
|
||||
REGISTRY.register("workbench", () -> TurtleUpgradeSerialiser.simpleWithCustomItem(TurtleCraftingTable::new));
|
||||
public static final RegistryObject<TurtleUpgradeSerialiser<TurtleModem>> WIRELESS_MODEM_NORMAL =
|
||||
SERIALISERS.register("wireless_modem_normal", () -> TurtleUpgradeSerialiser.simpleWithCustomItem((id, item) -> new TurtleModem(id, item, false)));
|
||||
REGISTRY.register("wireless_modem_normal", () -> TurtleUpgradeSerialiser.simpleWithCustomItem((id, item) -> new TurtleModem(id, item, false)));
|
||||
public static final RegistryObject<TurtleUpgradeSerialiser<TurtleModem>> WIRELESS_MODEM_ADVANCED =
|
||||
SERIALISERS.register("wireless_modem_advanced", () -> TurtleUpgradeSerialiser.simpleWithCustomItem((id, item) -> new TurtleModem(id, item, true)));
|
||||
REGISTRY.register("wireless_modem_advanced", () -> TurtleUpgradeSerialiser.simpleWithCustomItem((id, item) -> new TurtleModem(id, item, true)));
|
||||
|
||||
public static final RegistryObject<TurtleUpgradeSerialiser<TurtleTool>> TOOL = SERIALISERS.register("tool", () -> TurtleToolSerialiser.INSTANCE);
|
||||
public static final RegistryObject<TurtleUpgradeSerialiser<TurtleTool>> TOOL = REGISTRY.register("tool", () -> TurtleToolSerialiser.INSTANCE);
|
||||
}
|
||||
|
||||
public static class ModPocketUpgradeSerialisers {
|
||||
static final DeferredRegister<PocketUpgradeSerialiser<?>> SERIALISERS = DeferredRegister.create(PocketUpgradeSerialiser.REGISTRY_ID, ComputerCraft.MOD_ID);
|
||||
public static class PocketUpgradeSerialisers {
|
||||
static final DeferredRegister<PocketUpgradeSerialiser<?>> REGISTRY = DeferredRegister.create(PocketUpgradeSerialiser.REGISTRY_ID, ComputerCraft.MOD_ID);
|
||||
|
||||
public static final RegistryObject<PocketUpgradeSerialiser<PocketSpeaker>> SPEAKER =
|
||||
SERIALISERS.register("speaker", () -> PocketUpgradeSerialiser.simpleWithCustomItem(PocketSpeaker::new));
|
||||
REGISTRY.register("speaker", () -> PocketUpgradeSerialiser.simpleWithCustomItem(PocketSpeaker::new));
|
||||
public static final RegistryObject<PocketUpgradeSerialiser<PocketModem>> WIRELESS_MODEM_NORMAL =
|
||||
SERIALISERS.register("wireless_modem_normal", () -> PocketUpgradeSerialiser.simpleWithCustomItem((id, item) -> new PocketModem(id, item, false)));
|
||||
REGISTRY.register("wireless_modem_normal", () -> PocketUpgradeSerialiser.simpleWithCustomItem((id, item) -> new PocketModem(id, item, false)));
|
||||
public static final RegistryObject<PocketUpgradeSerialiser<PocketModem>> WIRELESS_MODEM_ADVANCED =
|
||||
SERIALISERS.register("wireless_modem_advanced", () -> PocketUpgradeSerialiser.simpleWithCustomItem((id, item) -> new PocketModem(id, item, true)));
|
||||
REGISTRY.register("wireless_modem_advanced", () -> PocketUpgradeSerialiser.simpleWithCustomItem((id, item) -> new PocketModem(id, item, true)));
|
||||
}
|
||||
|
||||
public static class ModContainers {
|
||||
static final DeferredRegister<MenuType<?>> CONTAINERS = DeferredRegister.create(ForgeRegistries.MENU_TYPES, ComputerCraft.MOD_ID);
|
||||
public static class Menus {
|
||||
static final DeferredRegister<MenuType<?>> REGISTRY = DeferredRegister.create(ForgeRegistries.MENU_TYPES, ComputerCraft.MOD_ID);
|
||||
|
||||
public static final RegistryObject<MenuType<ContainerComputerBase>> COMPUTER = CONTAINERS.register("computer",
|
||||
public static final RegistryObject<MenuType<ContainerComputerBase>> COMPUTER = REGISTRY.register("computer",
|
||||
() -> ContainerData.toType(ComputerContainerData::new, ComputerMenuWithoutInventory::new));
|
||||
|
||||
public static final RegistryObject<MenuType<ContainerComputerBase>> POCKET_COMPUTER = CONTAINERS.register("pocket_computer",
|
||||
public static final RegistryObject<MenuType<ContainerComputerBase>> POCKET_COMPUTER = REGISTRY.register("pocket_computer",
|
||||
() -> ContainerData.toType(ComputerContainerData::new, ComputerMenuWithoutInventory::new));
|
||||
|
||||
public static final RegistryObject<MenuType<ContainerComputerBase>> POCKET_COMPUTER_NO_TERM = CONTAINERS.register("pocket_computer_no_term",
|
||||
public static final RegistryObject<MenuType<ContainerComputerBase>> POCKET_COMPUTER_NO_TERM = REGISTRY.register("pocket_computer_no_term",
|
||||
() -> ContainerData.toType(ComputerContainerData::new, ComputerMenuWithoutInventory::new));
|
||||
|
||||
public static final RegistryObject<MenuType<ContainerTurtle>> TURTLE = CONTAINERS.register("turtle",
|
||||
public static final RegistryObject<MenuType<ContainerTurtle>> TURTLE = REGISTRY.register("turtle",
|
||||
() -> ContainerData.toType(ComputerContainerData::new, ContainerTurtle::ofMenuData));
|
||||
|
||||
public static final RegistryObject<MenuType<ContainerDiskDrive>> DISK_DRIVE = CONTAINERS.register("disk_drive",
|
||||
public static final RegistryObject<MenuType<ContainerDiskDrive>> DISK_DRIVE = REGISTRY.register("disk_drive",
|
||||
() -> new MenuType<>(ContainerDiskDrive::new));
|
||||
|
||||
public static final RegistryObject<MenuType<ContainerPrinter>> PRINTER = CONTAINERS.register("printer",
|
||||
public static final RegistryObject<MenuType<ContainerPrinter>> PRINTER = REGISTRY.register("printer",
|
||||
() -> new MenuType<>(ContainerPrinter::new));
|
||||
|
||||
public static final RegistryObject<MenuType<ContainerHeldItem>> PRINTOUT = CONTAINERS.register("printout",
|
||||
public static final RegistryObject<MenuType<ContainerHeldItem>> PRINTOUT = REGISTRY.register("printout",
|
||||
() -> ContainerData.toType(HeldItemContainerData::new, ContainerHeldItem::createPrintout));
|
||||
|
||||
public static final RegistryObject<MenuType<ContainerViewComputer>> VIEW_COMPUTER = CONTAINERS.register("view_computer",
|
||||
public static final RegistryObject<MenuType<ContainerViewComputer>> VIEW_COMPUTER = REGISTRY.register("view_computer",
|
||||
() -> ContainerData.toType(ComputerContainerData::new, ContainerViewComputer::new));
|
||||
}
|
||||
|
||||
static class ModArgumentTypes {
|
||||
static final DeferredRegister<ArgumentTypeInfo<?, ?>> ARGUMENT_TYPES = DeferredRegister.create(net.minecraft.core.Registry.COMMAND_ARGUMENT_TYPE_REGISTRY, ComputerCraft.MOD_ID);
|
||||
static class ArgumentTypes {
|
||||
static final DeferredRegister<ArgumentTypeInfo<?, ?>> REGISTRY = DeferredRegister.create(Registry.COMMAND_ARGUMENT_TYPE_REGISTRY, ComputerCraft.MOD_ID);
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
private static <T extends ArgumentType<?>> void registerUnsafe(String name, Class<T> type, ArgumentTypeInfo<?, ?> serializer) {
|
||||
ARGUMENT_TYPES.register(name, () -> ArgumentTypeInfos.registerByClass(type, (ArgumentTypeInfo<T, ?>) serializer));
|
||||
REGISTRY.register(name, () -> ArgumentTypeInfos.registerByClass(type, (ArgumentTypeInfo<T, ?>) serializer));
|
||||
}
|
||||
|
||||
private static <T extends ArgumentType<?>> void register(String name, Class<T> type, ArgumentTypeInfo<T, ?> serializer) {
|
||||
ARGUMENT_TYPES.register(name, () -> ArgumentTypeInfos.registerByClass(type, serializer));
|
||||
REGISTRY.register(name, () -> ArgumentTypeInfos.registerByClass(type, serializer));
|
||||
}
|
||||
|
||||
private static <T extends ArgumentType<?>> void register(String name, Class<T> type, T instance) {
|
||||
@ -397,8 +398,8 @@ public final class Registry {
|
||||
VanillaDetailRegistries.BLOCK_IN_WORLD.addProvider(BlockData::fill);
|
||||
ForgeDetailRegistries.FLUID_STACK.addProvider(FluidData::fill);
|
||||
|
||||
CauldronInteraction.WATER.put(ModItems.TURTLE_NORMAL.get(), ItemTurtle.CAULDRON_INTERACTION);
|
||||
CauldronInteraction.WATER.put(ModItems.TURTLE_ADVANCED.get(), ItemTurtle.CAULDRON_INTERACTION);
|
||||
CauldronInteraction.WATER.put(Items.TURTLE_NORMAL.get(), ItemTurtle.CAULDRON_INTERACTION);
|
||||
CauldronInteraction.WATER.put(Items.TURTLE_ADVANCED.get(), ItemTurtle.CAULDRON_INTERACTION);
|
||||
}
|
||||
|
||||
public static void registerLoot() {
|
||||
@ -408,20 +409,20 @@ public final class Registry {
|
||||
}
|
||||
|
||||
private static void registerCondition(String name, LootItemConditionType serializer) {
|
||||
net.minecraft.core.Registry.register(
|
||||
net.minecraft.core.Registry.LOOT_CONDITION_TYPE,
|
||||
Registry.register(
|
||||
Registry.LOOT_CONDITION_TYPE,
|
||||
new ResourceLocation(ComputerCraft.MOD_ID, name), serializer
|
||||
);
|
||||
}
|
||||
|
||||
public static void setup() {
|
||||
var bus = FMLJavaModLoadingContext.get().getModEventBus();
|
||||
ModBlocks.BLOCKS.register(bus);
|
||||
ModBlockEntities.TILES.register(bus);
|
||||
ModItems.ITEMS.register(bus);
|
||||
ModTurtleSerialisers.SERIALISERS.register(bus);
|
||||
ModPocketUpgradeSerialisers.SERIALISERS.register(bus);
|
||||
ModContainers.CONTAINERS.register(bus);
|
||||
ModArgumentTypes.ARGUMENT_TYPES.register(bus);
|
||||
Blocks.REGISTRY.register(bus);
|
||||
BlockEntities.REGISTRY.register(bus);
|
||||
Items.REGISTRY.register(bus);
|
||||
TurtleSerialisers.REGISTRY.register(bus);
|
||||
PocketUpgradeSerialisers.REGISTRY.register(bus);
|
||||
Menus.REGISTRY.register(bus);
|
||||
ArgumentTypes.REGISTRY.register(bus);
|
||||
}
|
||||
}
|
@ -5,7 +5,7 @@
|
||||
*/
|
||||
package dan200.computercraft.shared.common;
|
||||
|
||||
import dan200.computercraft.shared.Registry;
|
||||
import dan200.computercraft.shared.ModRegistry;
|
||||
import dan200.computercraft.shared.network.container.HeldItemContainerData;
|
||||
import net.minecraft.network.chat.Component;
|
||||
import net.minecraft.world.InteractionHand;
|
||||
@ -31,7 +31,7 @@ public class ContainerHeldItem extends AbstractContainerMenu {
|
||||
}
|
||||
|
||||
public static ContainerHeldItem createPrintout(int id, Inventory inventory, HeldItemContainerData data) {
|
||||
return new ContainerHeldItem(Registry.ModContainers.PRINTOUT.get(), id, inventory.player, data.getHand());
|
||||
return new ContainerHeldItem(ModRegistry.Menus.PRINTOUT.get(), id, inventory.player, data.getHand());
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
|
@ -8,7 +8,7 @@ package dan200.computercraft.shared.computer.blocks;
|
||||
import dan200.computercraft.ComputerCraft;
|
||||
import dan200.computercraft.api.peripheral.IPeripheral;
|
||||
import dan200.computercraft.core.computer.ComputerSide;
|
||||
import dan200.computercraft.shared.Registry;
|
||||
import dan200.computercraft.shared.ModRegistry;
|
||||
import dan200.computercraft.shared.computer.core.ComputerFamily;
|
||||
import dan200.computercraft.shared.computer.core.ComputerState;
|
||||
import dan200.computercraft.shared.computer.core.ServerComputer;
|
||||
@ -78,7 +78,7 @@ public class TileComputer extends TileComputerBase {
|
||||
@Nullable
|
||||
@Override
|
||||
public AbstractContainerMenu createMenu(int id, @Nonnull Inventory inventory, @Nonnull Player player) {
|
||||
return new ComputerMenuWithoutInventory(Registry.ModContainers.COMPUTER.get(), id, inventory, this::isUsableByPlayer, createServerComputer(), getFamily());
|
||||
return new ComputerMenuWithoutInventory(ModRegistry.Menus.COMPUTER.get(), id, inventory, this::isUsableByPlayer, createServerComputer(), getFamily());
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
|
@ -5,7 +5,7 @@
|
||||
*/
|
||||
package dan200.computercraft.shared.computer.inventory;
|
||||
|
||||
import dan200.computercraft.shared.Registry;
|
||||
import dan200.computercraft.shared.ModRegistry;
|
||||
import dan200.computercraft.shared.computer.blocks.TileCommandComputer;
|
||||
import dan200.computercraft.shared.computer.core.ComputerFamily;
|
||||
import dan200.computercraft.shared.computer.core.ServerComputer;
|
||||
@ -18,11 +18,11 @@ import javax.annotation.Nonnull;
|
||||
|
||||
public class ContainerViewComputer extends ComputerMenuWithoutInventory {
|
||||
public ContainerViewComputer(int id, Inventory player, ServerComputer computer) {
|
||||
super(Registry.ModContainers.VIEW_COMPUTER.get(), id, player, p -> canInteractWith(computer, p), computer, computer.getFamily());
|
||||
super(ModRegistry.Menus.VIEW_COMPUTER.get(), id, player, p -> canInteractWith(computer, p), computer, computer.getFamily());
|
||||
}
|
||||
|
||||
public ContainerViewComputer(int id, Inventory player, ComputerContainerData data) {
|
||||
super(Registry.ModContainers.VIEW_COMPUTER.get(), id, player, data);
|
||||
super(ModRegistry.Menus.VIEW_COMPUTER.get(), id, player, data);
|
||||
}
|
||||
|
||||
private static boolean canInteractWith(@Nonnull ServerComputer computer, @Nonnull Player player) {
|
||||
|
@ -5,7 +5,7 @@
|
||||
*/
|
||||
package dan200.computercraft.shared.computer.items;
|
||||
|
||||
import dan200.computercraft.shared.Registry;
|
||||
import dan200.computercraft.shared.ModRegistry;
|
||||
import dan200.computercraft.shared.computer.blocks.TileComputer;
|
||||
import dan200.computercraft.shared.computer.core.ComputerFamily;
|
||||
import net.minecraft.world.item.ItemStack;
|
||||
@ -24,9 +24,9 @@ public final class ComputerItemFactory {
|
||||
@Nonnull
|
||||
public static ItemStack create(int id, String label, ComputerFamily family) {
|
||||
return switch (family) {
|
||||
case NORMAL -> Registry.ModItems.COMPUTER_NORMAL.get().create(id, label);
|
||||
case ADVANCED -> Registry.ModItems.COMPUTER_ADVANCED.get().create(id, label);
|
||||
case COMMAND -> Registry.ModItems.COMPUTER_COMMAND.get().create(id, label);
|
||||
case NORMAL -> ModRegistry.Items.COMPUTER_NORMAL.get().create(id, label);
|
||||
case ADVANCED -> ModRegistry.Items.COMPUTER_ADVANCED.get().create(id, label);
|
||||
case COMMAND -> ModRegistry.Items.COMPUTER_COMMAND.get().create(id, label);
|
||||
};
|
||||
}
|
||||
}
|
||||
|
@ -7,7 +7,7 @@ package dan200.computercraft.shared.integration.jei;
|
||||
|
||||
import dan200.computercraft.ComputerCraft;
|
||||
import dan200.computercraft.api.turtle.TurtleSide;
|
||||
import dan200.computercraft.shared.Registry;
|
||||
import dan200.computercraft.shared.ModRegistry;
|
||||
import dan200.computercraft.shared.integration.RecipeModHelpers;
|
||||
import dan200.computercraft.shared.media.items.ItemDisk;
|
||||
import dan200.computercraft.shared.pocket.items.ItemPocketComputer;
|
||||
@ -36,13 +36,13 @@ public class JEIComputerCraft implements IModPlugin {
|
||||
|
||||
@Override
|
||||
public void registerItemSubtypes(ISubtypeRegistration subtypeRegistry) {
|
||||
subtypeRegistry.registerSubtypeInterpreter(VanillaTypes.ITEM_STACK, Registry.ModItems.TURTLE_NORMAL.get(), turtleSubtype);
|
||||
subtypeRegistry.registerSubtypeInterpreter(VanillaTypes.ITEM_STACK, Registry.ModItems.TURTLE_ADVANCED.get(), turtleSubtype);
|
||||
subtypeRegistry.registerSubtypeInterpreter(VanillaTypes.ITEM_STACK, ModRegistry.Items.TURTLE_NORMAL.get(), turtleSubtype);
|
||||
subtypeRegistry.registerSubtypeInterpreter(VanillaTypes.ITEM_STACK, ModRegistry.Items.TURTLE_ADVANCED.get(), turtleSubtype);
|
||||
|
||||
subtypeRegistry.registerSubtypeInterpreter(VanillaTypes.ITEM_STACK, Registry.ModItems.POCKET_COMPUTER_NORMAL.get(), pocketSubtype);
|
||||
subtypeRegistry.registerSubtypeInterpreter(VanillaTypes.ITEM_STACK, Registry.ModItems.POCKET_COMPUTER_ADVANCED.get(), pocketSubtype);
|
||||
subtypeRegistry.registerSubtypeInterpreter(VanillaTypes.ITEM_STACK, ModRegistry.Items.POCKET_COMPUTER_NORMAL.get(), pocketSubtype);
|
||||
subtypeRegistry.registerSubtypeInterpreter(VanillaTypes.ITEM_STACK, ModRegistry.Items.POCKET_COMPUTER_ADVANCED.get(), pocketSubtype);
|
||||
|
||||
subtypeRegistry.registerSubtypeInterpreter(VanillaTypes.ITEM_STACK, Registry.ModItems.DISK.get(), diskSubtype);
|
||||
subtypeRegistry.registerSubtypeInterpreter(VanillaTypes.ITEM_STACK, ModRegistry.Items.DISK.get(), diskSubtype);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -9,7 +9,7 @@ import dan200.computercraft.ComputerCraft;
|
||||
import dan200.computercraft.api.ComputerCraftAPI;
|
||||
import dan200.computercraft.api.filesystem.IMount;
|
||||
import dan200.computercraft.api.media.IMedia;
|
||||
import dan200.computercraft.shared.Registry;
|
||||
import dan200.computercraft.shared.ModRegistry;
|
||||
import dan200.computercraft.shared.common.IColouredItem;
|
||||
import dan200.computercraft.core.util.Colour;
|
||||
import net.minecraft.ChatFormatting;
|
||||
@ -37,9 +37,9 @@ public class ItemDisk extends Item implements IMedia, IColouredItem {
|
||||
|
||||
@Nonnull
|
||||
public static ItemStack createFromIDAndColour(int id, String label, int colour) {
|
||||
var stack = new ItemStack(Registry.ModItems.DISK.get());
|
||||
var stack = new ItemStack(ModRegistry.Items.DISK.get());
|
||||
setDiskID(stack, id);
|
||||
Registry.ModItems.DISK.get().setLabel(stack, label);
|
||||
ModRegistry.Items.DISK.get().setLabel(stack, label);
|
||||
IColouredItem.setColourBasic(stack, colour);
|
||||
return stack;
|
||||
}
|
||||
|
@ -5,7 +5,7 @@
|
||||
*/
|
||||
package dan200.computercraft.shared.media.items;
|
||||
|
||||
import dan200.computercraft.shared.Registry;
|
||||
import dan200.computercraft.shared.ModRegistry;
|
||||
import dan200.computercraft.shared.common.ContainerHeldItem;
|
||||
import dan200.computercraft.shared.network.container.HeldItemContainerData;
|
||||
import net.minecraft.network.chat.Component;
|
||||
@ -55,7 +55,7 @@ public class ItemPrintout extends Item {
|
||||
public InteractionResultHolder<ItemStack> use(Level world, @Nonnull Player player, @Nonnull InteractionHand hand) {
|
||||
if (!world.isClientSide) {
|
||||
new HeldItemContainerData(hand)
|
||||
.open(player, new ContainerHeldItem.Factory(Registry.ModContainers.PRINTOUT.get(), player.getItemInHand(hand), hand));
|
||||
.open(player, new ContainerHeldItem.Factory(ModRegistry.Menus.PRINTOUT.get(), player.getItemInHand(hand), hand));
|
||||
}
|
||||
return new InteractionResultHolder<>(InteractionResult.SUCCESS, player.getItemInHand(hand));
|
||||
}
|
||||
@ -86,17 +86,17 @@ public class ItemPrintout extends Item {
|
||||
|
||||
@Nonnull
|
||||
public static ItemStack createSingleFromTitleAndText(String title, String[] text, String[] colours) {
|
||||
return Registry.ModItems.PRINTED_PAGE.get().createFromTitleAndText(title, text, colours);
|
||||
return ModRegistry.Items.PRINTED_PAGE.get().createFromTitleAndText(title, text, colours);
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
public static ItemStack createMultipleFromTitleAndText(String title, String[] text, String[] colours) {
|
||||
return Registry.ModItems.PRINTED_PAGES.get().createFromTitleAndText(title, text, colours);
|
||||
return ModRegistry.Items.PRINTED_PAGES.get().createFromTitleAndText(title, text, colours);
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
public static ItemStack createBookFromTitleAndText(String title, String[] text, String[] colours) {
|
||||
return Registry.ModItems.PRINTED_BOOK.get().createFromTitleAndText(title, text, colours);
|
||||
return ModRegistry.Items.PRINTED_BOOK.get().createFromTitleAndText(title, text, colours);
|
||||
}
|
||||
|
||||
public Type getType() {
|
||||
|
@ -9,7 +9,7 @@ import dan200.computercraft.api.ComputerCraftAPI;
|
||||
import dan200.computercraft.api.filesystem.IMount;
|
||||
import dan200.computercraft.api.media.IMedia;
|
||||
import dan200.computercraft.core.filesystem.SubMount;
|
||||
import dan200.computercraft.shared.Registry;
|
||||
import dan200.computercraft.shared.ModRegistry;
|
||||
import dan200.computercraft.core.util.Colour;
|
||||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.core.NonNullList;
|
||||
@ -76,7 +76,7 @@ public class ItemTreasureDisk extends Item implements IMedia {
|
||||
}
|
||||
|
||||
public static ItemStack create(String subPath, int colourIndex) {
|
||||
var result = new ItemStack(Registry.ModItems.TREASURE_DISK.get());
|
||||
var result = new ItemStack(ModRegistry.Items.TREASURE_DISK.get());
|
||||
var nbt = result.getOrCreateTag();
|
||||
nbt.putString(NBT_SUB_PATH, subPath);
|
||||
|
||||
|
@ -5,7 +5,7 @@
|
||||
*/
|
||||
package dan200.computercraft.shared.peripheral.diskdrive;
|
||||
|
||||
import dan200.computercraft.shared.Registry;
|
||||
import dan200.computercraft.shared.ModRegistry;
|
||||
import dan200.computercraft.shared.common.BlockGeneric;
|
||||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.core.Direction;
|
||||
@ -39,7 +39,7 @@ public class BlockDiskDrive extends BlockGeneric {
|
||||
private static final BlockEntityTicker<TileDiskDrive> serverTicker = (level, pos, state, drive) -> drive.serverTick();
|
||||
|
||||
public BlockDiskDrive(Properties settings) {
|
||||
super(settings, Registry.ModBlockEntities.DISK_DRIVE);
|
||||
super(settings, ModRegistry.BlockEntities.DISK_DRIVE);
|
||||
registerDefaultState(getStateDefinition().any()
|
||||
.setValue(FACING, Direction.NORTH)
|
||||
.setValue(STATE, DiskDriveState.EMPTY));
|
||||
@ -95,6 +95,6 @@ public class BlockDiskDrive extends BlockGeneric {
|
||||
@Override
|
||||
@Nullable
|
||||
public <U extends BlockEntity> BlockEntityTicker<U> getTicker(@Nonnull Level level, @Nonnull BlockState state, @Nonnull BlockEntityType<U> type) {
|
||||
return level.isClientSide ? null : BaseEntityBlock.createTickerHelper(type, Registry.ModBlockEntities.DISK_DRIVE.get(), serverTicker);
|
||||
return level.isClientSide ? null : BaseEntityBlock.createTickerHelper(type, ModRegistry.BlockEntities.DISK_DRIVE.get(), serverTicker);
|
||||
}
|
||||
}
|
||||
|
@ -5,7 +5,7 @@
|
||||
*/
|
||||
package dan200.computercraft.shared.peripheral.diskdrive;
|
||||
|
||||
import dan200.computercraft.shared.Registry;
|
||||
import dan200.computercraft.shared.ModRegistry;
|
||||
import net.minecraft.world.Container;
|
||||
import net.minecraft.world.SimpleContainer;
|
||||
import net.minecraft.world.entity.player.Inventory;
|
||||
@ -20,7 +20,7 @@ public class ContainerDiskDrive extends AbstractContainerMenu {
|
||||
private final Container inventory;
|
||||
|
||||
public ContainerDiskDrive(int id, Inventory player, Container inventory) {
|
||||
super(Registry.ModContainers.DISK_DRIVE.get(), id);
|
||||
super(ModRegistry.Menus.DISK_DRIVE.get(), id);
|
||||
|
||||
this.inventory = inventory;
|
||||
|
||||
|
@ -7,7 +7,7 @@ package dan200.computercraft.shared.peripheral.modem.wired;
|
||||
|
||||
import com.google.common.collect.ImmutableMap;
|
||||
import dan200.computercraft.api.ForgeComputerCraftAPI;
|
||||
import dan200.computercraft.shared.Registry;
|
||||
import dan200.computercraft.shared.ModRegistry;
|
||||
import dan200.computercraft.shared.common.BlockGeneric;
|
||||
import dan200.computercraft.shared.util.WaterloggableHelpers;
|
||||
import dan200.computercraft.shared.util.WorldUtil;
|
||||
@ -55,7 +55,7 @@ public class BlockCable extends BlockGeneric implements SimpleWaterloggedBlock {
|
||||
.build());
|
||||
|
||||
public BlockCable(Properties settings) {
|
||||
super(settings, Registry.ModBlockEntities.CABLE);
|
||||
super(settings, ModRegistry.BlockEntities.CABLE);
|
||||
|
||||
registerDefaultState(getStateDefinition().any()
|
||||
.setValue(MODEM, CableModemVariant.None)
|
||||
@ -105,10 +105,10 @@ public class BlockCable extends BlockGeneric implements SimpleWaterloggedBlock {
|
||||
|
||||
if (WorldUtil.isVecInside(CableShapes.getModemShape(state), hit.getLocation().subtract(pos.getX(), pos.getY(), pos.getZ()))) {
|
||||
newState = state.setValue(MODEM, CableModemVariant.None);
|
||||
item = new ItemStack(Registry.ModItems.WIRED_MODEM.get());
|
||||
item = new ItemStack(ModRegistry.Items.WIRED_MODEM.get());
|
||||
} else {
|
||||
newState = state.setValue(CABLE, false);
|
||||
item = new ItemStack(Registry.ModItems.CABLE.get());
|
||||
item = new ItemStack(ModRegistry.Items.CABLE.get());
|
||||
}
|
||||
|
||||
world.setBlock(pos, correctConnections(world, pos, newState), 3);
|
||||
@ -134,13 +134,13 @@ public class BlockCable extends BlockGeneric implements SimpleWaterloggedBlock {
|
||||
boolean cable = state.getValue(CABLE);
|
||||
|
||||
// If we've only got one, just use that.
|
||||
if (!cable) return new ItemStack(Registry.ModItems.WIRED_MODEM.get());
|
||||
if (modem == null) return new ItemStack(Registry.ModItems.CABLE.get());
|
||||
if (!cable) return new ItemStack(ModRegistry.Items.WIRED_MODEM.get());
|
||||
if (modem == null) return new ItemStack(ModRegistry.Items.CABLE.get());
|
||||
|
||||
// We've a modem and cable, so try to work out which one we're interacting with
|
||||
return hit != null && WorldUtil.isVecInside(CableShapes.getModemShape(state), hit.getLocation().subtract(pos.getX(), pos.getY(), pos.getZ()))
|
||||
? new ItemStack(Registry.ModItems.WIRED_MODEM.get())
|
||||
: new ItemStack(Registry.ModItems.CABLE.get());
|
||||
? new ItemStack(ModRegistry.Items.WIRED_MODEM.get())
|
||||
: new ItemStack(ModRegistry.Items.CABLE.get());
|
||||
|
||||
}
|
||||
|
||||
|
@ -5,7 +5,7 @@
|
||||
*/
|
||||
package dan200.computercraft.shared.peripheral.modem.wired;
|
||||
|
||||
import dan200.computercraft.shared.Registry;
|
||||
import dan200.computercraft.shared.ModRegistry;
|
||||
import dan200.computercraft.shared.common.BlockGeneric;
|
||||
import net.minecraft.world.level.block.Block;
|
||||
import net.minecraft.world.level.block.state.BlockState;
|
||||
@ -17,7 +17,7 @@ public class BlockWiredModemFull extends BlockGeneric {
|
||||
public static final BooleanProperty PERIPHERAL_ON = BooleanProperty.create("peripheral");
|
||||
|
||||
public BlockWiredModemFull(Properties settings) {
|
||||
super(settings, Registry.ModBlockEntities.WIRED_MODEM_FULL);
|
||||
super(settings, ModRegistry.BlockEntities.WIRED_MODEM_FULL);
|
||||
registerDefaultState(getStateDefinition().any()
|
||||
.setValue(MODEM_ON, false)
|
||||
.setValue(PERIPHERAL_ON, false)
|
||||
|
@ -5,7 +5,7 @@
|
||||
*/
|
||||
package dan200.computercraft.shared.peripheral.modem.wired;
|
||||
|
||||
import dan200.computercraft.shared.Registry;
|
||||
import dan200.computercraft.shared.ModRegistry;
|
||||
import net.minecraft.Util;
|
||||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.core.NonNullList;
|
||||
@ -82,7 +82,7 @@ public abstract class ItemBlockCable extends BlockItem {
|
||||
var existingState = world.getBlockState(pos);
|
||||
|
||||
// Try to add a modem to a cable
|
||||
if (existingState.getBlock() == Registry.ModBlocks.CABLE.get() && existingState.getValue(MODEM) == CableModemVariant.None) {
|
||||
if (existingState.getBlock() == ModRegistry.Blocks.CABLE.get() && existingState.getValue(MODEM) == CableModemVariant.None) {
|
||||
var side = context.getClickedFace().getOpposite();
|
||||
var newState = existingState
|
||||
.setValue(MODEM, CableModemVariant.from(side))
|
||||
@ -114,7 +114,7 @@ public abstract class ItemBlockCable extends BlockItem {
|
||||
// Try to add a cable to a modem inside the block we're clicking on.
|
||||
var insidePos = pos.relative(context.getClickedFace().getOpposite());
|
||||
var insideState = world.getBlockState(insidePos);
|
||||
if (insideState.getBlock() == Registry.ModBlocks.CABLE.get() && !insideState.getValue(BlockCable.CABLE)
|
||||
if (insideState.getBlock() == ModRegistry.Blocks.CABLE.get() && !insideState.getValue(BlockCable.CABLE)
|
||||
&& placeAtCorrected(world, insidePos, insideState.setValue(BlockCable.CABLE, true))) {
|
||||
stack.shrink(1);
|
||||
return InteractionResult.SUCCESS;
|
||||
@ -122,7 +122,7 @@ public abstract class ItemBlockCable extends BlockItem {
|
||||
|
||||
// Try to add a cable to a modem adjacent to this block
|
||||
var existingState = world.getBlockState(pos);
|
||||
if (existingState.getBlock() == Registry.ModBlocks.CABLE.get() && !existingState.getValue(BlockCable.CABLE)
|
||||
if (existingState.getBlock() == ModRegistry.Blocks.CABLE.get() && !existingState.getValue(BlockCable.CABLE)
|
||||
&& placeAtCorrected(world, pos, existingState.setValue(BlockCable.CABLE, true))) {
|
||||
stack.shrink(1);
|
||||
return InteractionResult.SUCCESS;
|
||||
|
@ -10,7 +10,7 @@ import dan200.computercraft.api.ForgeComputerCraftAPI;
|
||||
import dan200.computercraft.api.network.wired.IWiredElement;
|
||||
import dan200.computercraft.api.network.wired.IWiredNode;
|
||||
import dan200.computercraft.api.peripheral.IPeripheral;
|
||||
import dan200.computercraft.shared.Registry;
|
||||
import dan200.computercraft.shared.ModRegistry;
|
||||
import dan200.computercraft.shared.command.text.ChatHelpers;
|
||||
import dan200.computercraft.shared.common.TileGeneric;
|
||||
import dan200.computercraft.shared.peripheral.modem.ModemState;
|
||||
@ -181,13 +181,13 @@ public class TileCable extends TileGeneric {
|
||||
if (neighbour.equals(getBlockPos().relative(dir)) && hasModem() && !getBlockState().canSurvive(getLevel(), getBlockPos())) {
|
||||
if (hasCable()) {
|
||||
// Drop the modem and convert to cable
|
||||
Block.popResource(getLevel(), getBlockPos(), new ItemStack(Registry.ModItems.WIRED_MODEM.get()));
|
||||
Block.popResource(getLevel(), getBlockPos(), new ItemStack(ModRegistry.Items.WIRED_MODEM.get()));
|
||||
getLevel().setBlockAndUpdate(getBlockPos(), getBlockState().setValue(BlockCable.MODEM, CableModemVariant.None));
|
||||
modemChanged();
|
||||
connectionsChanged();
|
||||
} else {
|
||||
// Drop everything and remove block
|
||||
Block.popResource(getLevel(), getBlockPos(), new ItemStack(Registry.ModItems.WIRED_MODEM.get()));
|
||||
Block.popResource(getLevel(), getBlockPos(), new ItemStack(ModRegistry.Items.WIRED_MODEM.get()));
|
||||
getLevel().removeBlock(getBlockPos(), false);
|
||||
// This'll call #destroy(), so we don't need to reset the network here.
|
||||
}
|
||||
|
@ -7,7 +7,7 @@ package dan200.computercraft.shared.peripheral.modem.wired;
|
||||
|
||||
import dan200.computercraft.api.peripheral.IPeripheral;
|
||||
import dan200.computercraft.shared.Peripherals;
|
||||
import dan200.computercraft.shared.Registry;
|
||||
import dan200.computercraft.shared.ModRegistry;
|
||||
import dan200.computercraft.shared.computer.core.ServerContext;
|
||||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.core.Direction;
|
||||
@ -124,7 +124,7 @@ public final class WiredModemLocalPeripheral {
|
||||
var offset = pos.relative(direction);
|
||||
|
||||
var block = world.getBlockState(offset).getBlock();
|
||||
if (block == Registry.ModBlocks.WIRED_MODEM_FULL.get() || block == Registry.ModBlocks.CABLE.get()) return null;
|
||||
if (block == ModRegistry.Blocks.WIRED_MODEM_FULL.get() || block == ModRegistry.Blocks.CABLE.get()) return null;
|
||||
|
||||
var peripheral = Peripherals.getPeripheral(world, offset, direction.getOpposite(), invalidate);
|
||||
return peripheral instanceof WiredModemPeripheral ? null : peripheral;
|
||||
|
@ -5,7 +5,7 @@
|
||||
*/
|
||||
package dan200.computercraft.shared.peripheral.printer;
|
||||
|
||||
import dan200.computercraft.shared.Registry;
|
||||
import dan200.computercraft.shared.ModRegistry;
|
||||
import dan200.computercraft.shared.common.BlockGeneric;
|
||||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.core.Direction;
|
||||
@ -35,7 +35,7 @@ public class BlockPrinter extends BlockGeneric {
|
||||
public static final BooleanProperty BOTTOM = BooleanProperty.create("bottom");
|
||||
|
||||
public BlockPrinter(Properties settings) {
|
||||
super(settings, Registry.ModBlockEntities.PRINTER);
|
||||
super(settings, ModRegistry.BlockEntities.PRINTER);
|
||||
registerDefaultState(getStateDefinition().any()
|
||||
.setValue(FACING, Direction.NORTH)
|
||||
.setValue(TOP, false)
|
||||
|
@ -5,7 +5,7 @@
|
||||
*/
|
||||
package dan200.computercraft.shared.peripheral.printer;
|
||||
|
||||
import dan200.computercraft.shared.Registry;
|
||||
import dan200.computercraft.shared.ModRegistry;
|
||||
import dan200.computercraft.shared.util.SingleIntArray;
|
||||
import dan200.computercraft.shared.util.ValidatingSlot;
|
||||
import net.minecraft.world.Container;
|
||||
@ -25,7 +25,7 @@ public class ContainerPrinter extends AbstractContainerMenu {
|
||||
private final ContainerData properties;
|
||||
|
||||
private ContainerPrinter(int id, Inventory player, Container inventory, ContainerData properties) {
|
||||
super(Registry.ModContainers.PRINTER.get(), id);
|
||||
super(ModRegistry.Menus.PRINTER.get(), id);
|
||||
this.properties = properties;
|
||||
this.inventory = inventory;
|
||||
|
||||
|
@ -5,7 +5,7 @@
|
||||
*/
|
||||
package dan200.computercraft.shared.peripheral.speaker;
|
||||
|
||||
import dan200.computercraft.shared.Registry;
|
||||
import dan200.computercraft.shared.ModRegistry;
|
||||
import dan200.computercraft.shared.common.BlockGeneric;
|
||||
import net.minecraft.core.Direction;
|
||||
import net.minecraft.world.item.context.BlockPlaceContext;
|
||||
@ -31,7 +31,7 @@ public class BlockSpeaker extends BlockGeneric {
|
||||
private static final BlockEntityTicker<TileSpeaker> serverTicker = (level, pos, state, drive) -> drive.serverTick();
|
||||
|
||||
public BlockSpeaker(Properties settings) {
|
||||
super(settings, Registry.ModBlockEntities.SPEAKER);
|
||||
super(settings, ModRegistry.BlockEntities.SPEAKER);
|
||||
registerDefaultState(getStateDefinition().any()
|
||||
.setValue(FACING, Direction.NORTH));
|
||||
}
|
||||
@ -64,6 +64,6 @@ public class BlockSpeaker extends BlockGeneric {
|
||||
@Override
|
||||
@Nullable
|
||||
public <U extends BlockEntity> BlockEntityTicker<U> getTicker(@Nonnull Level level, @Nonnull BlockState state, @Nonnull BlockEntityType<U> type) {
|
||||
return level.isClientSide ? null : BaseEntityBlock.createTickerHelper(type, Registry.ModBlockEntities.SPEAKER.get(), serverTicker);
|
||||
return level.isClientSide ? null : BaseEntityBlock.createTickerHelper(type, ModRegistry.BlockEntities.SPEAKER.get(), serverTicker);
|
||||
}
|
||||
}
|
||||
|
@ -5,7 +5,7 @@
|
||||
*/
|
||||
package dan200.computercraft.shared.pocket.inventory;
|
||||
|
||||
import dan200.computercraft.shared.Registry;
|
||||
import dan200.computercraft.shared.ModRegistry;
|
||||
import dan200.computercraft.shared.computer.core.ServerComputer;
|
||||
import dan200.computercraft.shared.computer.inventory.ComputerMenuWithoutInventory;
|
||||
import dan200.computercraft.shared.pocket.items.ItemPocketComputer;
|
||||
@ -46,7 +46,7 @@ public class PocketComputerMenuProvider implements MenuProvider {
|
||||
@Override
|
||||
public AbstractContainerMenu createMenu(int id, @Nonnull Inventory inventory, @Nonnull Player entity) {
|
||||
return new ComputerMenuWithoutInventory(
|
||||
isTypingOnly ? Registry.ModContainers.POCKET_COMPUTER_NO_TERM.get() : Registry.ModContainers.POCKET_COMPUTER.get(), id, inventory,
|
||||
isTypingOnly ? ModRegistry.Menus.POCKET_COMPUTER_NO_TERM.get() : ModRegistry.Menus.POCKET_COMPUTER.get(), id, inventory,
|
||||
p -> {
|
||||
var stack = p.getItemInHand(hand);
|
||||
return stack.getItem() == item && ItemPocketComputer.getServerComputer(entity.level.getServer(), stack) == computer;
|
||||
|
@ -6,7 +6,7 @@
|
||||
package dan200.computercraft.shared.pocket.items;
|
||||
|
||||
import dan200.computercraft.api.pocket.IPocketUpgrade;
|
||||
import dan200.computercraft.shared.Registry;
|
||||
import dan200.computercraft.shared.ModRegistry;
|
||||
import dan200.computercraft.shared.computer.core.ComputerFamily;
|
||||
import net.minecraft.world.item.ItemStack;
|
||||
|
||||
@ -19,8 +19,8 @@ public final class PocketComputerItemFactory {
|
||||
@Nonnull
|
||||
public static ItemStack create(int id, String label, int colour, ComputerFamily family, IPocketUpgrade upgrade) {
|
||||
return switch (family) {
|
||||
case NORMAL -> Registry.ModItems.POCKET_COMPUTER_NORMAL.get().create(id, label, colour, upgrade);
|
||||
case ADVANCED -> Registry.ModItems.POCKET_COMPUTER_ADVANCED.get().create(id, label, colour, upgrade);
|
||||
case NORMAL -> ModRegistry.Items.POCKET_COMPUTER_NORMAL.get().create(id, label, colour, upgrade);
|
||||
case ADVANCED -> ModRegistry.Items.POCKET_COMPUTER_ADVANCED.get().create(id, label, colour, upgrade);
|
||||
default -> ItemStack.EMPTY;
|
||||
};
|
||||
}
|
||||
|
@ -6,7 +6,7 @@
|
||||
package dan200.computercraft.shared.turtle.inventory;
|
||||
|
||||
import dan200.computercraft.client.gui.widgets.ComputerSidebar;
|
||||
import dan200.computercraft.shared.Registry;
|
||||
import dan200.computercraft.shared.ModRegistry;
|
||||
import dan200.computercraft.shared.computer.core.ComputerFamily;
|
||||
import dan200.computercraft.shared.computer.core.ServerComputer;
|
||||
import dan200.computercraft.shared.computer.inventory.ContainerComputerBase;
|
||||
@ -39,7 +39,7 @@ public final class ContainerTurtle extends ContainerComputerBase {
|
||||
int id, Predicate<Player> canUse, ComputerFamily family, @Nullable ServerComputer computer, @Nullable ComputerContainerData menuData,
|
||||
Inventory playerInventory, Container inventory, ContainerData data
|
||||
) {
|
||||
super(Registry.ModContainers.TURTLE.get(), id, canUse, family, computer, menuData);
|
||||
super(ModRegistry.Menus.TURTLE.get(), id, canUse, family, computer, menuData);
|
||||
this.data = data;
|
||||
addDataSlots(data);
|
||||
|
||||
|
@ -7,7 +7,7 @@ package dan200.computercraft.shared.turtle.items;
|
||||
|
||||
import dan200.computercraft.api.turtle.ITurtleUpgrade;
|
||||
import dan200.computercraft.api.turtle.TurtleSide;
|
||||
import dan200.computercraft.shared.Registry;
|
||||
import dan200.computercraft.shared.ModRegistry;
|
||||
import dan200.computercraft.shared.computer.core.ComputerFamily;
|
||||
import dan200.computercraft.shared.turtle.blocks.ITurtleTile;
|
||||
import net.minecraft.resources.ResourceLocation;
|
||||
@ -34,9 +34,9 @@ public final class TurtleItemFactory {
|
||||
public static ItemStack create(int id, String label, int colour, ComputerFamily family, ITurtleUpgrade leftUpgrade, ITurtleUpgrade rightUpgrade, int fuelLevel, ResourceLocation overlay) {
|
||||
return switch (family) {
|
||||
case NORMAL ->
|
||||
Registry.ModItems.TURTLE_NORMAL.get().create(id, label, colour, leftUpgrade, rightUpgrade, fuelLevel, overlay);
|
||||
ModRegistry.Items.TURTLE_NORMAL.get().create(id, label, colour, leftUpgrade, rightUpgrade, fuelLevel, overlay);
|
||||
case ADVANCED ->
|
||||
Registry.ModItems.TURTLE_ADVANCED.get().create(id, label, colour, leftUpgrade, rightUpgrade, fuelLevel, overlay);
|
||||
ModRegistry.Items.TURTLE_ADVANCED.get().create(id, label, colour, leftUpgrade, rightUpgrade, fuelLevel, overlay);
|
||||
default -> ItemStack.EMPTY;
|
||||
};
|
||||
}
|
||||
|
@ -6,7 +6,7 @@
|
||||
package dan200.computercraft.shared.util;
|
||||
|
||||
import dan200.computercraft.ComputerCraft;
|
||||
import dan200.computercraft.shared.Registry;
|
||||
import dan200.computercraft.shared.ModRegistry;
|
||||
import net.minecraft.world.item.CreativeModeTab;
|
||||
import net.minecraft.world.item.ItemStack;
|
||||
|
||||
@ -20,6 +20,6 @@ public class CreativeTabMain extends CreativeModeTab {
|
||||
@Nonnull
|
||||
@Override
|
||||
public ItemStack makeIcon() {
|
||||
return new ItemStack(Registry.ModBlocks.COMPUTER_NORMAL.get());
|
||||
return new ItemStack(ModRegistry.Blocks.COMPUTER_NORMAL.get());
|
||||
}
|
||||
}
|
||||
|
@ -8,7 +8,7 @@ package dan200.computercraft.gametest
|
||||
import dan200.computercraft.gametest.api.GameTestHolder
|
||||
import dan200.computercraft.gametest.api.Structures
|
||||
import dan200.computercraft.gametest.api.sequence
|
||||
import dan200.computercraft.shared.Registry
|
||||
import dan200.computercraft.shared.ModRegistry
|
||||
import net.minecraft.core.BlockPos
|
||||
import net.minecraft.gametest.framework.GameTest
|
||||
import net.minecraft.gametest.framework.GameTestHelper
|
||||
@ -31,7 +31,7 @@ class Loot_Test {
|
||||
chest.setLootTable(BuiltInLootTables.SIMPLE_DUNGEON, 123)
|
||||
chest.unpackLootTable(null)
|
||||
|
||||
context.assertContainerContains(pos, Registry.ModItems.TREASURE_DISK.get())
|
||||
context.assertContainerContains(pos, ModRegistry.Items.TREASURE_DISK.get())
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -9,6 +9,7 @@ import dan200.computercraft.api.lua.ObjectArguments
|
||||
import dan200.computercraft.core.apis.PeripheralAPI
|
||||
import dan200.computercraft.core.computer.ComputerSide
|
||||
import dan200.computercraft.gametest.api.*
|
||||
import dan200.computercraft.shared.ModRegistry
|
||||
import dan200.computercraft.shared.peripheral.modem.wired.BlockCable
|
||||
import dan200.computercraft.test.core.assertArrayEquals
|
||||
import dan200.computercraft.test.core.computer.LuaTaskContext
|
||||
@ -40,7 +41,7 @@ class Modem_Test {
|
||||
BlockCable.correctConnections(
|
||||
helper.level,
|
||||
helper.absolutePos(position),
|
||||
dan200.computercraft.shared.Registry.ModBlocks.CABLE.get().defaultBlockState().setValue(BlockCable.CABLE, true),
|
||||
ModRegistry.Blocks.CABLE.get().defaultBlockState().setValue(BlockCable.CABLE, true),
|
||||
),
|
||||
)
|
||||
}
|
||||
|
@ -9,7 +9,7 @@ import dan200.computercraft.gametest.api.GameTestHolder
|
||||
import dan200.computercraft.gametest.api.getBlockEntity
|
||||
import dan200.computercraft.gametest.api.sequence
|
||||
import dan200.computercraft.gametest.api.setBlock
|
||||
import dan200.computercraft.shared.Registry
|
||||
import dan200.computercraft.shared.ModRegistry
|
||||
import net.minecraft.commands.arguments.blocks.BlockInput
|
||||
import net.minecraft.core.BlockPos
|
||||
import net.minecraft.gametest.framework.GameTest
|
||||
@ -30,7 +30,7 @@ class Monitor_Test {
|
||||
tag.putInt("Height", 2)
|
||||
|
||||
val toSet = BlockInput(
|
||||
Registry.ModBlocks.MONITOR_ADVANCED.get().defaultBlockState(),
|
||||
ModRegistry.Blocks.MONITOR_ADVANCED.get().defaultBlockState(),
|
||||
Collections.emptySet(),
|
||||
tag,
|
||||
)
|
||||
@ -40,7 +40,7 @@ class Monitor_Test {
|
||||
}
|
||||
thenIdle(2)
|
||||
thenExecute {
|
||||
val tile = context.getBlockEntity(pos, Registry.ModBlockEntities.MONITOR_ADVANCED.get())
|
||||
val tile = context.getBlockEntity(pos, ModRegistry.BlockEntities.MONITOR_ADVANCED.get())
|
||||
|
||||
if (tile.width != 1 || tile.height != 1) {
|
||||
context.fail("Tile has width and height of ${tile.width}x${tile.height}, but should be 1x1", pos)
|
||||
|
@ -8,7 +8,7 @@ package dan200.computercraft.gametest
|
||||
import dan200.computercraft.gametest.api.GameTestHolder
|
||||
import dan200.computercraft.gametest.api.Structures
|
||||
import dan200.computercraft.gametest.api.sequence
|
||||
import dan200.computercraft.shared.Registry
|
||||
import dan200.computercraft.shared.ModRegistry
|
||||
import net.minecraft.gametest.framework.GameTest
|
||||
import net.minecraft.gametest.framework.GameTestAssertException
|
||||
import net.minecraft.gametest.framework.GameTestHelper
|
||||
@ -36,7 +36,7 @@ class Recipe_Test {
|
||||
thenExecute {
|
||||
val container = CraftingContainer(DummyMenu, 3, 3)
|
||||
container.setItem(0, ItemStack(Items.SKELETON_SKULL))
|
||||
container.setItem(1, ItemStack(Registry.ModItems.COMPUTER_ADVANCED.get()))
|
||||
container.setItem(1, ItemStack(ModRegistry.Items.COMPUTER_ADVANCED.get()))
|
||||
|
||||
val recipe: Optional<CraftingRecipe> = context.level.server.recipeManager
|
||||
.getRecipeFor(RecipeType.CRAFTING, container, context.level)
|
||||
|
@ -10,7 +10,7 @@ import dan200.computercraft.api.detail.VanillaDetailRegistries
|
||||
import dan200.computercraft.api.lua.ObjectArguments
|
||||
import dan200.computercraft.core.apis.PeripheralAPI
|
||||
import dan200.computercraft.gametest.api.*
|
||||
import dan200.computercraft.shared.Registry
|
||||
import dan200.computercraft.shared.ModRegistry
|
||||
import dan200.computercraft.shared.media.items.ItemPrintout
|
||||
import dan200.computercraft.shared.peripheral.monitor.BlockMonitor
|
||||
import dan200.computercraft.shared.peripheral.monitor.MonitorEdgeState
|
||||
@ -204,7 +204,7 @@ class Turtle_Test {
|
||||
}
|
||||
thenWaitUntil { helper.assertEntityNotPresent(EntityType.TNT) }
|
||||
thenExecute {
|
||||
helper.assertBlockPresent(Registry.ModBlocks.TURTLE_ADVANCED.get(), BlockPos(2, 2, 2))
|
||||
helper.assertBlockPresent(ModRegistry.Blocks.TURTLE_ADVANCED.get(), BlockPos(2, 2, 2))
|
||||
helper.assertBlockPresent(Blocks.AIR, BlockPos(2, 2, 1))
|
||||
}
|
||||
}
|
||||
@ -217,8 +217,8 @@ class Turtle_Test {
|
||||
thenExecute { helper.getEntity(EntityType.CREEPER).ignite() }
|
||||
thenWaitUntil { helper.assertEntityNotPresent(EntityType.CREEPER) }
|
||||
thenExecute {
|
||||
helper.assertBlockPresent(Registry.ModBlocks.TURTLE_ADVANCED.get(), BlockPos(2, 2, 2))
|
||||
helper.assertBlockPresent(Registry.ModBlocks.TURTLE_NORMAL.get(), BlockPos(2, 2, 1))
|
||||
helper.assertBlockPresent(ModRegistry.Blocks.TURTLE_ADVANCED.get(), BlockPos(2, 2, 2))
|
||||
helper.assertBlockPresent(ModRegistry.Blocks.TURTLE_NORMAL.get(), BlockPos(2, 2, 1))
|
||||
}
|
||||
}
|
||||
|
||||
@ -311,7 +311,7 @@ class Turtle_Test {
|
||||
@GameTest
|
||||
fun Move_replace(helper: GameTestHelper) = helper.sequence {
|
||||
thenOnComputer { turtle.forward().await().assertArrayEquals(true, message = "Turtle moved forward") }
|
||||
thenExecute { helper.assertBlockPresent(Registry.ModBlocks.TURTLE_NORMAL.get(), BlockPos(2, 2, 3)) }
|
||||
thenExecute { helper.assertBlockPresent(ModRegistry.Blocks.TURTLE_NORMAL.get(), BlockPos(2, 2, 3)) }
|
||||
}
|
||||
|
||||
/**
|
||||
@ -339,7 +339,7 @@ class Turtle_Test {
|
||||
fun Move_obstruct(helper: GameTestHelper) = helper.sequence {
|
||||
thenOnComputer { turtle.forward().await().assertArrayEquals(false, "Movement obstructed") }
|
||||
thenExecute {
|
||||
helper.assertBlockPresent(Registry.ModBlocks.TURTLE_NORMAL.get(), BlockPos(2, 2, 2))
|
||||
helper.assertBlockPresent(ModRegistry.Blocks.TURTLE_NORMAL.get(), BlockPos(2, 2, 2))
|
||||
helper.assertBlockPresent(Blocks.DIRT, BlockPos(2, 2, 3))
|
||||
}
|
||||
}
|
||||
@ -355,7 +355,7 @@ class Turtle_Test {
|
||||
}
|
||||
thenExecute {
|
||||
helper.assertEntityNotPresent(EntityType.SHEEP)
|
||||
val count = helper.getBlockEntity(turtlePos, Registry.ModBlockEntities.TURTLE_NORMAL.get()).countItem(Items.WHITE_WOOL)
|
||||
val count = helper.getBlockEntity(turtlePos, ModRegistry.BlockEntities.TURTLE_NORMAL.get()).countItem(Items.WHITE_WOOL)
|
||||
if (count == 0) helper.fail("Expected turtle to have white wool", turtlePos)
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user