Skip to content

Commit

Permalink
Update to 1.19.1 and fix #2
Browse files Browse the repository at this point in the history
  • Loading branch information
AlphaMode committed Jul 30, 2022
1 parent b092f5d commit effa6d9
Show file tree
Hide file tree
Showing 38 changed files with 117 additions and 234 deletions.
10 changes: 5 additions & 5 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -130,15 +130,15 @@ dependencies {
mappings loom.officialMojangMappings()
modImplementation("net.fabricmc:fabric-loader:${project.loader_version}")
modImplementation("net.fabricmc.fabric-api:fabric-api:${project.fabric_version}")
modImplementation(include("io.github.fabricators_of_create:Porting-Lib:${project.port_lib_version}+${project.minecraft_version}.${project.port_lib_hash}"))
modImplementation(include("io.github.fabricators_of_create:Porting-Lib:${project.port_lib_version}+${project.minecraft_version}"))
modImplementation(include("me.alphamode:ForgeTags:${project.forge_tags_version}"))

// REI
modCompileOnly("me.shedaniel:RoughlyEnoughItems-api-fabric:${project.rei_version}")
modImplementation("me.shedaniel:RoughlyEnoughItems-fabric:${project.rei_version}")
modCompileOnly("me.shedaniel:RoughlyEnoughItems-fabric:${project.rei_version}")

// JEI
modCompileOnly("mezz.jei:jei-${project.minecraft_version}-fabric:${project.jei_version}") { transitive = false }
modImplementation("mezz.jei:jei-${project.minecraft_version}-fabric:${project.jei_version}") { transitive = false }

include modApi('teamreborn:energy:2.2.0') {
exclude(group: "net.fabricmc.fabric-api")
Expand All @@ -153,7 +153,7 @@ dependencies {
// runtimeOnly fg.deobf("mcjty.theoneprobe:TheOneProbe-1.16:${top_version}")

// Nicephore - Screenshots and Stuff
modRuntimeOnly("curse.maven:nicephore-fabric-405990:3848375")
// modRuntimeOnly("curse.maven:nicephore-fabric-405990:3848375")

// Shut up Experimental Settings - so we don't have to deal with that CONSTANTLY
modRuntimeOnly("curse.maven:fabric-disable-custom-worlds-advice-401978:3827588")
Expand Down Expand Up @@ -199,7 +199,7 @@ processResources {
properties.put("loader_version", project.loader_version)
properties.put("fabric_version", project.fabric_version)
properties.put("minecraft_version", project.minecraft_version)
properties.put("port_lib_version", "${project.port_lib_version}+${project.minecraft_version}.${project.port_lib_hash}")
properties.put("port_lib_version", "${project.port_lib_version}+${project.minecraft_version}")

properties.forEach((k, v) -> inputs.property(k, v))

Expand Down
5 changes: 2 additions & 3 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,9 @@ mod_id=compactmachines
# Dependencies and Libs
jei_mc_version=1.19.1
jei_version=11.2.0.241
rei_version=9.1.517
rei_version=9.1.518
top_version=1.19-6.0.0
port_lib_version=2.0.422
port_lib_hash=26b170a
port_lib_version=2.0.437
forge_tags_version=2.2
night_config_toml_version=3.6.3
night_config_core_version=3.6.3
Expand Down
2 changes: 2 additions & 0 deletions src/api/java/dev/compactmods/machines/api/core/Constants.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
package dev.compactmods.machines.api.core;

import net.minecraft.resources.ResourceLocation;

public abstract class Constants {
public static final String MOD_ID = "compactmachines";

Expand Down

This file was deleted.

66 changes: 28 additions & 38 deletions src/main/java/dev/compactmods/machines/CompactMachines.java
Original file line number Diff line number Diff line change
@@ -1,17 +1,21 @@
package dev.compactmods.machines;

import dev.compactmods.machines.api.core.Constants;
import dev.compactmods.machines.api.tunnels.capability.CapabilityTunnel;
import dev.compactmods.machines.command.Commands;
import dev.compactmods.machines.config.CommonConfig;
import dev.compactmods.machines.config.EnableVanillaRecipesConfigCondition;
import dev.compactmods.machines.config.ServerConfig;
import dev.compactmods.machines.core.Registries;
import dev.compactmods.machines.core.UIRegistration;
import dev.compactmods.machines.core.*;
import dev.compactmods.machines.dimension.Dimension;
import dev.compactmods.machines.graph.Graph;
import dev.compactmods.machines.machine.CompactMachineBlockEntity;
import dev.compactmods.machines.machine.Machines;
import dev.compactmods.machines.room.RoomEventHandler;
import dev.compactmods.machines.room.data.LootFunctions;
import dev.compactmods.machines.room.network.RoomNetworkHandler;
import dev.compactmods.machines.shrinking.Shrinking;
import dev.compactmods.machines.tunnel.TunnelWallEntity;
import dev.compactmods.machines.tunnel.Tunnels;
import dev.compactmods.machines.upgrade.MachineRoomUpgrades;
import dev.compactmods.machines.wall.Walls;
Expand Down Expand Up @@ -62,28 +66,18 @@ public void onInitialize() {
doRegistration();

// Configuration
ModLoadingContext mlCtx = ModLoadingContext.get();
mlCtx.registerConfig(ModConfig.Type.COMMON, CommonConfig.CONFIG);
mlCtx.registerConfig(ModConfig.Type.SERVER, ServerConfig.CONFIG);
ModLoadingContext.registerConfig(Constants.MOD_ID, ModConfig.Type.COMMON, CommonConfig.CONFIG);
ModLoadingContext.registerConfig(Constants.MOD_ID, ModConfig.Type.SERVER, ServerConfig.CONFIG);

EnableVanillaRecipesConfigCondition.register();

// UIRegistration.init(); TODO: PORT
// Tunnels.init();
// CMGraphRegistration.init();
// MachineRoomUpgrades.init();
// CompactMachinesCommands.init();
// CompactMachinesLootFunctions.init();
//
// ModLoadingContext.registerConfig(MOD_ID, ModConfig.Type.COMMON, CommonConfig.CONFIG);
// ModLoadingContext.registerConfig(MOD_ID, ModConfig.Type.SERVER, ServerConfig.CONFIG);
// ModConfigEvent.LOADING.register(CommonConfig::onLoaded);
// ServerWorldEvents.LOAD.register(ServerEventHandler::onWorldLoaded);
// ServerEntityWorldChangeEvents.AFTER_PLAYER_CHANGE_WORLD.register(ServerEventHandler::onPlayerDimChange);
// ServerPlayConnectionEvents.JOIN.register(ServerEventHandler::onPlayerLogin);
// CommonEventHandler.init();
// RoomEventHandler.init();
// ModBusEvents.setup();
ModConfigEvent.LOADING.register(CommonConfig::onLoaded);
ServerWorldEvents.LOAD.register(ServerEventHandler::onWorldLoaded);
ServerEntityWorldChangeEvents.AFTER_PLAYER_CHANGE_WORLD.register(ServerEventHandler::onPlayerDimChange);
ServerPlayConnectionEvents.JOIN.register(ServerEventHandler::onPlayerLogin);
CommonEventHandler.init();
RoomEventHandler.init();
ModBusEvents.setup();

CompactMachinesNet.CHANNEL.initServerListener();
RoomNetworkHandler.CHANNEL.initServerListener();
Expand All @@ -92,47 +86,43 @@ public void onInitialize() {
RoomNetworkHandler.CHANNEL.initClientListener();
}

Registration.init();

ItemStorage.SIDED.registerForBlockEntities((blockEntity, context) -> {
if (blockEntity instanceof CompactMachineBlockEntity machine)
return machine.getTunnelContext(CapabilityTunnel.ITEM, context);
if (blockEntity instanceof TunnelWallEntity tunnel)
return tunnel.getCapability(CapabilityTunnel.ITEM, context);
return null;
}, Registration.MACHINE_TILE_ENTITY.get(), Tunnels.TUNNEL_BLOCK_ENTITY.get());
}, Machines.MACHINE_TILE_ENTITY.get(), Tunnels.TUNNEL_BLOCK_ENTITY.get());
FluidStorage.SIDED.registerForBlockEntities((blockEntity, context) -> {
if (blockEntity instanceof CompactMachineBlockEntity machine)
return machine.getTunnelContext(CapabilityTunnel.FLUID, context);
if (blockEntity instanceof TunnelWallEntity tunnel)
return tunnel.getCapability(CapabilityTunnel.FLUID, context);
return null;
}, Registration.MACHINE_TILE_ENTITY.get(), Tunnels.TUNNEL_BLOCK_ENTITY.get());
}, Machines.MACHINE_TILE_ENTITY.get(), Tunnels.TUNNEL_BLOCK_ENTITY.get());
EnergyStorage.SIDED.registerForBlockEntities((blockEntity, context) -> {
if (blockEntity instanceof CompactMachineBlockEntity machine)
return machine.getTunnelContext(CapabilityTunnel.ENERGY, context);
if (blockEntity instanceof TunnelWallEntity tunnel)
return tunnel.getCapability(CapabilityTunnel.ENERGY, context);
return null;
}, Registration.MACHINE_TILE_ENTITY.get(), Tunnels.TUNNEL_BLOCK_ENTITY.get());
}, Machines.MACHINE_TILE_ENTITY.get(), Tunnels.TUNNEL_BLOCK_ENTITY.get());
}

/**
* Sets up the deferred registration for usage in package/module setup.
*/
private static void doRegistration() {
var bus = FMLJavaModLoadingContext.get().getModEventBus();

Registries.BLOCKS.register(bus);
Registries.ITEMS.register(bus);
Registries.BLOCK_ENTITIES.register(bus);
Registries.TUNNEL_DEFINITIONS.register(bus);
Registries.CONTAINERS.register(bus);
Registries.UPGRADES.register(bus);
Registries.NODE_TYPES.register(bus);
Registries.EDGE_TYPES.register(bus);
Registries.COMMAND_ARGUMENT_TYPES.register(bus);
Registries.LOOT_FUNCS.register(bus);
Registries.BLOCKS.register();
Registries.ITEMS.register();
Registries.BLOCK_ENTITIES.register();
Registries.TUNNEL_DEFINITIONS.register();
Registries.CONTAINERS.register();
Registries.UPGRADES.register();
Registries.NODE_TYPES.register();
Registries.EDGE_TYPES.register();
Registries.COMMAND_ARGUMENT_TYPES.register();
Registries.LOOT_FUNCS.register();
}

private static void preparePackages() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,10 @@

public class ClientEventHandler implements ClientModInitializer {

@SubscribeEvent
public static void onItemColors() {
ColorProviderRegistry.ITEM.register(new TunnelItemColor(), Tunnels.ITEM_TUNNEL.get());
}

@SubscribeEvent
public static void onBlockColors() {
ColorProviderRegistry.BLOCK.register(new TunnelColors(), Tunnels.BLOCK_TUNNEL_WALL.get());
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
import dev.compactmods.machines.room.client.MachineRoomScreen;
import dev.compactmods.machines.room.network.PlayerRequestedTeleportPacket;
import dev.compactmods.machines.shrinking.Shrinking;
import io.github.fabricators_of_create.porting_lib.util.client.ExtendedButton;
import net.fabricmc.fabric.api.client.screen.v1.Screens;
import net.minecraft.client.gui.components.Button;
import net.minecraft.network.chat.Component;
import net.minecraft.world.item.ItemStack;
Expand All @@ -23,7 +25,7 @@ public PSDIconButton(MachineRoomScreen parent, int xPos, int yPos) {
public void render(@NotNull PoseStack pose, int mouseX, int mouseY, float partialTicks) {
super.render(pose, mouseX, mouseY, partialTicks);

((ScreenAccessor)this.parent).port_lib$getMinecraft().getItemRenderer().renderAndDecorateItem(
Screens.getItemRenderer(this.parent).renderAndDecorateItem(
new ItemStack(Shrinking.PERSONAL_SHRINKING_DEVICE.get()),
x + 2, y + 2, 40);
}
Expand Down
5 changes: 3 additions & 2 deletions src/main/java/dev/compactmods/machines/command/Commands.java
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
import net.fabricmc.fabric.api.command.v2.CommandRegistrationCallback;
import net.minecraft.commands.CommandBuildContext;
import net.minecraft.commands.CommandSourceStack;
import net.minecraft.commands.synchronization.ArgumentTypeInfo;
import net.minecraft.commands.synchronization.ArgumentTypeInfos;
import net.minecraft.commands.synchronization.SingletonArgumentInfo;

Expand All @@ -37,10 +38,10 @@ public static <A extends ArgumentType<?>, T extends ArgumentTypeInfo.Template<A>


public static void init() {
CommandRegistrationCallback.EVENT.register(CompactMachinesCommands::onCommandsRegister);
CommandRegistrationCallback.EVENT.register(Commands::onCommandsRegister);
}

public static void onCommandsRegister(CommandDispatcher<CommandSourceStack> dispatcher, CommandBuildContext registryAccess, Commands.CommandSelection environment) {
public static void onCommandsRegister(CommandDispatcher<CommandSourceStack> dispatcher, CommandBuildContext registryAccess, net.minecraft.commands.Commands.CommandSelection environment) {
final LiteralArgumentBuilder<CommandSourceStack> root = LiteralArgumentBuilder.literal(CompactMachines.MOD_ID);
root.then(CMEjectSubcommand.make());
root.then(CMSummarySubcommand.make());
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
package dev.compactmods.machines.compat.rei;

import dev.compactmods.machines.api.core.JeiInfo;
import dev.compactmods.machines.core.Registration;
import dev.compactmods.machines.core.Tunnels;
import dev.compactmods.machines.api.room.RoomSize;
import dev.compactmods.machines.i18n.TranslationUtil;
import dev.compactmods.machines.machine.CompactMachineItem;
import dev.compactmods.machines.room.RoomSize;
import dev.compactmods.machines.shrinking.Shrinking;
import dev.compactmods.machines.tunnel.Tunnels;
import me.shedaniel.rei.api.client.plugins.REIClientPlugin;
import me.shedaniel.rei.api.client.registry.display.DisplayRegistry;
import me.shedaniel.rei.api.common.entry.comparison.ItemComparatorRegistry;
Expand All @@ -27,7 +27,7 @@ public void registerDisplays(DisplayRegistry registry) {


registry.add(DefaultInformationDisplay.createFromEntry(
EntryStacks.of(Registration.PERSONAL_SHRINKING_DEVICE.get()),
EntryStacks.of(Shrinking.PERSONAL_SHRINKING_DEVICE.get()),
Component.empty())
.lines(TranslationUtil.jeiInfo(JeiInfo.SHRINKING_DEVICE)));

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ public void addProbeInfo(ProbeMode probeMode, IProbeInfo info, Player playerEnti

if (probeMode == ProbeMode.EXTENDED) {
TunnelDefinition definition = tile.getTunnelType();
final var tunnelReg = Tunnels.TUNNEL_DEF_REGISTRY;
final var tunnelReg = Tunnels.TUNNEL_DEF_REGISTRY.get();
MutableComponent tunType = Component.literal(tunnelReg.getKey(definition).toString())
.withStyle(ChatFormatting.GRAY);

Expand Down
Loading

0 comments on commit effa6d9

Please sign in to comment.