-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
bb23715
commit f57f41d
Showing
61 changed files
with
391 additions
and
15,315 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,44 +1,29 @@ | ||
# Done to increase the memory available to gradle. | ||
org.gradle.jvmargs=-Xmx1G | ||
|
||
# Fabric Properties | ||
# check these on https://modmuss50.me/fabric.html | ||
minecraft_version=1.21.1 | ||
yarn_mappings=1.21.1+build.3 | ||
loader_version=0.16.9 | ||
|
||
# Mod Properties | ||
mod_version=0.4.1 | ||
maven_group=me.justahuman | ||
archives_base_name=Slimefun Essentials | ||
|
||
# Dependencies | ||
# check this on https://modmuss50.me/fabric.html | ||
fabric_version=0.108.0+1.21.1 | ||
|
||
# https://modrinth.com/mod/patchouli/versions?l=fabric | ||
patchouli_version=1.21-87-fabric | ||
|
||
# https://github.com/emilyploszaj/emi/releases | ||
emi_version=1.1.18+1.21.1 | ||
|
||
# https://www.curseforge.com/minecraft/mc-mods/jei/files?page=1&pageSize=20&gameVersionTypeId=4&showAlphaFiles=show | ||
jei_version=1.21.1-fabric:19.21.0.247 | ||
|
||
# https://linkie.shedaniel.dev/dependencies?loader=fabric | ||
rei_version=16.0.788 | ||
|
||
# https://www.curseforge.com/minecraft/mc-mods/jade/files?page=1&pageSize=20&gameVersionTypeId=4 | ||
jade_version=5884237 | ||
|
||
# https://maven.terraformersmc.com/releases/com/terraformersmc/modmenu/ | ||
mod_menu_version=10.0.0 | ||
|
||
# https://modrinth.com/mod/cloth-config/versions | ||
cloth_config_version=15.0.140 | ||
|
||
# https://github.com/shedaniel/cloth-basic-math | ||
cloth_math_version=0.6.1 | ||
lombok_version=1.18.34 | ||
|
||
# https://projectlombok.org/setup/gradle | ||
lombok_version=1.18.34 | ||
# https://modmuss50.me/fabric.html | ||
# https://github.com/emilyploszaj/emi/releases | ||
# https://www.curseforge.com/minecraft/mc-mods/jei/files?page=1&pageSize=20&gameVersionTypeId=4&showAlphaFiles=show | ||
# https://linkie.shedaniel.dev/dependencies?loader=fabric | ||
# https://www.curseforge.com/minecraft/mc-mods/jade/files?page=1&pageSize=20&gameVersionTypeId=4 | ||
# https://maven.terraformersmc.com/releases/com/terraformersmc/modmenu/ | ||
# https://modrinth.com/mod/cloth-config/versions | ||
# https://github.com/shedaniel/cloth-basic-math | ||
# https://projectlombok.org/setup/gradle |
127 changes: 33 additions & 94 deletions
127
src/main/java/me/justahuman/slimefun_essentials/SlimefunEssentials.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,129 +1,68 @@ | ||
package me.justahuman.slimefun_essentials; | ||
|
||
import me.justahuman.slimefun_essentials.client.ResourceLoader; | ||
import me.justahuman.slimefun_essentials.client.payloads.DisabledItemPayload; | ||
import me.justahuman.slimefun_essentials.client.payloads.SlimefunAddonPayload; | ||
import me.justahuman.slimefun_essentials.client.payloads.SlimefunBlockPayload; | ||
import me.justahuman.slimefun_essentials.client.SlimefunRegistry; | ||
import me.justahuman.slimefun_essentials.client.payloads.ItemGroupsPayload; | ||
import me.justahuman.slimefun_essentials.client.payloads.ItemsPayload; | ||
import me.justahuman.slimefun_essentials.client.payloads.RecipeCategoryPayload; | ||
import me.justahuman.slimefun_essentials.client.payloads.RecipeDisplayPayload; | ||
import me.justahuman.slimefun_essentials.compat.cloth_config.ConfigScreen; | ||
import me.justahuman.slimefun_essentials.config.ModConfig; | ||
import me.justahuman.slimefun_essentials.utils.Payloads; | ||
import me.justahuman.slimefun_essentials.utils.CompatUtils; | ||
import me.justahuman.slimefun_essentials.utils.Utils; | ||
import net.fabricmc.api.ClientModInitializer; | ||
import net.fabricmc.fabric.api.client.event.lifecycle.v1.ClientChunkEvents; | ||
import net.fabricmc.fabric.api.client.event.lifecycle.v1.ClientTickEvents; | ||
import net.fabricmc.fabric.api.client.keybinding.v1.KeyBindingHelper; | ||
import net.fabricmc.fabric.api.client.networking.v1.ClientPlayConnectionEvents; | ||
import net.fabricmc.fabric.api.client.networking.v1.ClientPlayNetworking; | ||
import net.fabricmc.fabric.api.networking.v1.PacketByteBufs; | ||
import net.fabricmc.fabric.api.networking.v1.PayloadTypeRegistry; | ||
import net.fabricmc.fabric.api.resource.ResourceManagerHelper; | ||
import net.fabricmc.fabric.api.resource.SimpleSynchronousResourceReloadListener; | ||
import net.minecraft.client.MinecraftClient; | ||
import net.minecraft.client.option.KeyBinding; | ||
import net.minecraft.network.PacketByteBuf; | ||
import net.minecraft.resource.ResourceManager; | ||
import net.minecraft.resource.ResourceType; | ||
import net.minecraft.util.Identifier; | ||
import net.minecraft.util.math.ChunkPos; | ||
import org.lwjgl.glfw.GLFW; | ||
import org.slf4j.Logger; | ||
import org.slf4j.LoggerFactory; | ||
|
||
import java.util.ArrayList; | ||
import java.util.List; | ||
|
||
public class SlimefunEssentials implements ClientModInitializer { | ||
public static final String MOD_ID = "slimefun_essentials"; | ||
public static final Logger LOGGER = LoggerFactory.getLogger(MOD_ID); | ||
|
||
@Override | ||
public void onInitializeClient() { | ||
PayloadTypeRegistry.playS2C().register(Payloads.ADDON_CHANNEL, SlimefunAddonPayload.CODEC); | ||
PayloadTypeRegistry.playS2C().register(Payloads.BLOCK_CHANNEL, SlimefunBlockPayload.CODEC); | ||
PayloadTypeRegistry.playS2C().register(Payloads.ITEM_CHANNEL, DisabledItemPayload.CODEC); | ||
PayloadTypeRegistry.playS2C().register(Payloads.ITEM_CHANNEL, ItemsPayload.CODEC); | ||
PayloadTypeRegistry.playS2C().register(Payloads.ITEM_GROUPS_CHANNEL, ItemGroupsPayload.CODEC); | ||
PayloadTypeRegistry.playS2C().register(Payloads.RECIPE_CATEGORY_CHANNEL, RecipeCategoryPayload.CODEC); | ||
PayloadTypeRegistry.playS2C().register(Payloads.RECIPE_DISPLAY_CHANNEL, RecipeDisplayPayload.CODEC); | ||
ModConfig.loadConfig(); | ||
|
||
/*if (CompatUtils.isPatchouliLoaded()) { | ||
PatchouliIntegration.init(); | ||
}*/ | ||
|
||
if (CompatUtils.isClothConfigLoaded()) { | ||
final KeyBinding keyBinding = KeyBindingHelper.registerKeyBinding(new KeyBinding("slimefun_essentials.key_bind.open_config", GLFW.GLFW_KEY_F6, "slimefun_essentials.title")); | ||
ClientTickEvents.END_CLIENT_TICK.register(client -> { | ||
if (keyBinding.isPressed()) { | ||
client.setScreen(ConfigScreen.buildScreen(client.currentScreen)); | ||
} | ||
}); | ||
} | ||
|
||
ResourceManagerHelper.get(ResourceType.CLIENT_RESOURCES).registerReloadListener(new SimpleSynchronousResourceReloadListener() { | ||
@Override | ||
public Identifier getFabricId() { | ||
return Utils.id("reload_listener"); | ||
} | ||
|
||
@Override | ||
public void reload(ResourceManager manager) { | ||
if (MinecraftClient.getInstance().world == null) { | ||
return; | ||
} | ||
ResourceLoader.clear(); | ||
ResourceLoader.loadResources(manager); | ||
ClientPlayNetworking.registerGlobalReceiver(Payloads.ITEM_CHANNEL, (payload, context) -> { | ||
if (ModConfig.recipeFeatures() && payload != ItemsPayload.EMPTY) { | ||
payload.load(); | ||
SlimefunRegistry.loadItemModels(); | ||
} | ||
}); | ||
|
||
if (ModConfig.blockFeatures()) { | ||
ClientChunkEvents.CHUNK_LOAD.register(((world, chunk) -> { | ||
final PacketByteBuf packetByteBuf = PacketByteBufs.create(); | ||
final ChunkPos chunkPos = chunk.getPos(); | ||
packetByteBuf.writeInt(chunkPos.x); | ||
packetByteBuf.writeInt(chunkPos.z); | ||
|
||
})); | ||
|
||
ClientChunkEvents.CHUNK_UNLOAD.register((world, chunk) -> ResourceLoader.removePlacedChunk(chunk.getPos())); | ||
|
||
ClientPlayNetworking.registerGlobalReceiver(Payloads.BLOCK_CHANNEL, (payload, context) -> { | ||
// If the id is a space that means it's no longer a slimefun block | ||
if (payload.id().equals(" ")) { | ||
ResourceLoader.removePlacedBlock(payload.pos()); | ||
return; | ||
} | ||
|
||
ResourceLoader.addPlacedBlock(payload.pos(), payload.id().toLowerCase()); | ||
}); | ||
|
||
ClientPlayConnectionEvents.DISCONNECT.register((handler, minecraftClient) -> ResourceLoader.clearPlacedBlocks()); | ||
} | ||
ClientPlayNetworking.registerGlobalReceiver(Payloads.ITEM_CHANNEL, (payload, context) -> { | ||
if (ModConfig.recipeFeatures() && payload != ItemsPayload.EMPTY) { | ||
payload.load(); | ||
} | ||
}); | ||
|
||
if (ModConfig.autoToggleAddons()) { | ||
final List<String> normalAddons = new ArrayList<>(); | ||
ClientPlayNetworking.registerGlobalReceiver(Payloads.ADDON_CHANNEL, (payload, context) -> { | ||
if (payload.addon().equals("clear")) { | ||
normalAddons.addAll(ModConfig.getAddons()); | ||
ModConfig.getAddons().clear(); | ||
return; | ||
} | ||
ClientPlayNetworking.registerGlobalReceiver(Payloads.ITEM_CHANNEL, (payload, context) -> { | ||
if (ModConfig.recipeFeatures() && payload != ItemsPayload.EMPTY) { | ||
payload.load(); | ||
} | ||
}); | ||
|
||
ModConfig.getAddons().add(payload.addon()); | ||
}); | ||
ClientPlayNetworking.registerGlobalReceiver(Payloads.ITEM_CHANNEL, (payload, context) -> { | ||
if (ModConfig.recipeFeatures() && payload != ItemsPayload.EMPTY) { | ||
payload.load(); | ||
} | ||
}); | ||
|
||
ClientPlayConnectionEvents.DISCONNECT.register(((handler, client) -> { | ||
if (!normalAddons.isEmpty()) { | ||
ModConfig.getAddons().clear(); | ||
ModConfig.getAddons().addAll(normalAddons); | ||
normalAddons.clear(); | ||
if (CompatUtils.isClothConfigLoaded()) { | ||
final KeyBinding keyBinding = KeyBindingHelper.registerKeyBinding(new KeyBinding("slimefun_essentials.key_bind.open_config", GLFW.GLFW_KEY_F6, "slimefun_essentials.title")); | ||
ClientTickEvents.END_CLIENT_TICK.register(client -> { | ||
if (keyBinding.isPressed()) { | ||
client.setScreen(ConfigScreen.buildScreen(client.currentScreen)); | ||
} | ||
})); | ||
} | ||
|
||
if (ModConfig.autoManageItems()) { | ||
ClientPlayNetworking.registerGlobalReceiver(Payloads.ITEM_CHANNEL, (payload, context) -> { | ||
ResourceLoader.blacklistItem(payload.id()); | ||
}); | ||
|
||
ClientPlayConnectionEvents.DISCONNECT.register(((handler, client) -> ResourceLoader.clearItemBlacklist())); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
9 changes: 9 additions & 0 deletions
9
src/main/java/me/justahuman/slimefun_essentials/client/RecipeDisplay.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
package me.justahuman.slimefun_essentials.client; | ||
|
||
import com.google.gson.JsonObject; | ||
|
||
public class RecipeDisplay { | ||
public static void deserialize(String type, JsonObject displayObject) { | ||
|
||
} | ||
} |
Oops, something went wrong.