Skip to content

Commit

Permalink
Update to 1.19
Browse files Browse the repository at this point in the history
  • Loading branch information
ramidzkh committed Aug 4, 2022
1 parent b105387 commit d9c4b2e
Show file tree
Hide file tree
Showing 28 changed files with 142 additions and 169 deletions.
5 changes: 3 additions & 2 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,9 @@ jobs:
with:
files: build/libs/Applied-Mekanistics-${{ github.event.release.tag_name }}.jar
tag_name: ${{ github.event.release.tag_name }}
- name: Upload to CurseForge
run: ./gradlew curseforge --max-workers 1
- name: Upload to external sites
run: ./gradlew curseforge modrinth --max-workers 1
env:
APPMEK_VERSION: ${{ github.event.release.tag_name }}
CURSEFORGE: ${{ secrets.CURSEFORGE }}
MODRINTH: ${{ secrets.MODRINTH }}
3 changes: 0 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,3 @@
.vscode/
build/
run/

# Temporary solution to the Mekanism question @ 9ec9ae8
# libs/
54 changes: 34 additions & 20 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,25 +1,10 @@
buildscript {
repositories {
maven {
name = "MinecraftForge"
url = uri("https://files.minecraftforge.net/maven/")
}

mavenCentral()
}

dependencies {
classpath(group: "net.minecraftforge.gradle", name: "ForgeGradle", version: "5.1.+", changing: true)
}
}

plugins {
id("net.minecraftforge.gradle") version "5.1.+"
id("com.matthewprenger.cursegradle") version "1.4.0"
id("com.diffplug.spotless") version "6.4.1"
id("com.diffplug.spotless") version "6.7.2"
id("com.modrinth.minotaur") version "2.3.3"
}

apply(plugin: "net.minecraftforge.gradle")

group = "me.ramidzkh"
version = System.getenv("APPMEK_VERSION") ?: "0.0.0"

Expand Down Expand Up @@ -58,8 +43,8 @@ dependencies {
compileOnly(fg.deobf("mekanism:Mekanism:${minecraft_version}-${mekanism_version}:api"))
runtimeOnly(fg.deobf("mekanism:Mekanism:${minecraft_version}-${mekanism_version}:all"))

compileOnly(fg.deobf("mezz.jei:jei-${minecraft_version}:${jei_version}:api"))
runtimeOnly(fg.deobf("mezz.jei:jei-${minecraft_version}:${jei_version}"))
compileOnly(fg.deobf("mezz.jei:jei-${minecraft_version}-common-api:${jei_version}"))
runtimeOnly(fg.deobf("mezz.jei:jei-${minecraft_version}-forge:${jei_version}"))
}

sourceSets {
Expand Down Expand Up @@ -210,3 +195,32 @@ System.getenv("CURSEFORGE")?.with { String key ->
}
}
}

////////////////
// Modrinth
modrinth {
token.set(System.getenv("MODRINTH"))
projectId.set("applied-mekanistics")
changelog.set("View changelog at [the release page](https://github.com/AppliedEnergistics/Applied-Mekanistics/releases/tag/${version})")
versionNumber.set(project.version)

if (version.contains("alpha")) {
versionType.set("alpha")
} else if (version.contains("beta")) {
versionType.set("beta")
} else {
versionType.set("release")
}

uploadFile.set(jar)
gameVersions.add(minecraft_version)

dependencies {
required.project("ae2")
required.project("mekanism")
}
}

tasks.modrinth.onlyIf {
System.getenv("MODRINTH")
}
10 changes: 5 additions & 5 deletions gradle.properties
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
minecraft_version=1.18.2
forge_version=40.1.18
ae2_version=11.0.0
mekanism_version=10.2.1.461
jei_version=9.7.0.180
minecraft_version=1.19
forge_version=41.1.0
ae2_version=12.0.1-alpha
mekanism_version=10.3.0.467
jei_version=11.1.1.239

org.gradle.daemon=false

Expand Down
7 changes: 7 additions & 0 deletions settings.gradle
Original file line number Diff line number Diff line change
@@ -1 +1,8 @@
pluginManagement {
repositories {
gradlePluginPortal()
maven { url = 'https://maven.minecraftforge.net/' }
}
}

rootProject.name = "Applied-Mekanistics"
6 changes: 0 additions & 6 deletions src/main/java/me/ramidzkh/mekae2/AMItems.java
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
package me.ramidzkh.mekae2;

import net.minecraft.Util;
import net.minecraft.core.Registry;
import net.minecraft.tags.TagKey;
import net.minecraft.world.item.CreativeModeTab;
import net.minecraft.world.item.Item;
import net.minecraft.world.item.ItemStack;
Expand All @@ -29,10 +27,6 @@ public class AMItems {
private static final DeferredRegister<Item> ITEMS = DeferredRegister.create(ForgeRegistries.ITEMS,
AppliedMekanistics.ID);

// These are foreign items, but idk another nice place to put these so /shrug
public static TagKey<Item> MEKANISM_TANKS = TagKey.create(Registry.ITEM_REGISTRY,
AppliedMekanistics.id("mekanism_tanks"));

public static void initialize(IEventBus bus) {
ITEMS.register(bus);
}
Expand Down
5 changes: 0 additions & 5 deletions src/main/java/me/ramidzkh/mekae2/AMMenus.java
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package me.ramidzkh.mekae2;

import net.minecraft.world.inventory.MenuType;
import net.minecraftforge.event.RegistryEvent;
import net.minecraftforge.eventbus.api.IEventBus;
import net.minecraftforge.fml.event.lifecycle.FMLClientSetupEvent;

Expand All @@ -19,10 +18,6 @@ public class AMMenus {

@SuppressWarnings("RedundantTypeArguments")
public static void initialize(IEventBus bus) {
bus.addGenericListener(MenuType.class, (RegistryEvent.Register<MenuType<?>> event) -> {
event.getRegistry().registerAll(PORTABLE_CHEMICAL_CELL_TYPE);
});

bus.addListener((FMLClientSetupEvent event) -> event.enqueueWork(() -> {
InitScreens.<MEStorageMenu, MEStorageScreen<MEStorageMenu>>register(PORTABLE_CHEMICAL_CELL_TYPE,
MEStorageScreen::new, "/screens/terminals/portable_chemical_cell.json");
Expand Down
6 changes: 3 additions & 3 deletions src/main/java/me/ramidzkh/mekae2/AMText.java
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package me.ramidzkh.mekae2;

import net.minecraft.network.chat.TranslatableComponent;
import net.minecraft.network.chat.Component;

public enum AMText {
QIO_FREQUENCY("qio_frequency"),
Expand All @@ -12,7 +12,7 @@ public enum AMText {
this.key = "text.%s.%s".formatted(AppliedMekanistics.ID, key);
}

public TranslatableComponent formatted(Object... params) {
return new TranslatableComponent(this.key, params);
public Component formatted(Object... params) {
return Component.translatable(this.key, params);
}
}
11 changes: 8 additions & 3 deletions src/main/java/me/ramidzkh/mekae2/AppliedMekanistics.java
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import org.jetbrains.annotations.Nullable;

import net.minecraft.core.Direction;
import net.minecraft.core.Registry;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.world.entity.player.Player;
import net.minecraft.world.item.ItemStack;
Expand All @@ -15,11 +16,11 @@
import net.minecraftforge.common.capabilities.ICapabilityProvider;
import net.minecraftforge.common.util.LazyOptional;
import net.minecraftforge.event.AttachCapabilitiesEvent;
import net.minecraftforge.event.RegistryEvent;
import net.minecraftforge.fml.DistExecutor;
import net.minecraftforge.fml.common.Mod;
import net.minecraftforge.fml.event.lifecycle.FMLCommonSetupEvent;
import net.minecraftforge.fml.javafmlmod.FMLJavaModLoadingContext;
import net.minecraftforge.registries.RegisterEvent;

import me.ramidzkh.mekae2.ae2.ChemicalContainerItemStrategy;
import me.ramidzkh.mekae2.ae2.GenericStackChemicalStorage;
Expand Down Expand Up @@ -65,7 +66,11 @@ public AppliedMekanistics() {

bus.addListener(MekAE2DataGenerators::onGatherData);

bus.addGenericListener(AEKeyType.class, (RegistryEvent.Register<AEKeyType> event) -> {
bus.addListener((RegisterEvent event) -> {
if (!event.getRegistryKey().equals(Registry.BLOCK_REGISTRY)) {
return;
}

AEKeyTypes.register(MekanismKeyType.TYPE);
});

Expand Down Expand Up @@ -169,6 +174,6 @@ private void initializeUpgrades() {
}

private void initializeAttunement() {
P2PTunnelAttunement.addItemByTag(AMItems.MEKANISM_TANKS, AMItems.CHEMICAL_P2P_TUNNEL::get);
P2PTunnelAttunement.registerAttunementTag(AMItems.CHEMICAL_P2P_TUNNEL::get);
}
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package me.ramidzkh.mekae2;

import net.minecraftforge.client.event.ColorHandlerEvent;
import net.minecraftforge.client.event.RegisterColorHandlersEvent;
import net.minecraftforge.fml.javafmlmod.FMLJavaModLoadingContext;

import me.ramidzkh.mekae2.ae2.AMChemicalStackRenderer;
Expand All @@ -17,10 +17,10 @@ public static void initialize() {
AMChemicalStackRenderer.initialize(bus);
}

private static void registerItemColors(ColorHandlerEvent.Item event) {
private static void registerItemColors(RegisterColorHandlersEvent.Item event) {
for (var tier : AMItems.Tier.values()) {
event.getItemColors().register(BasicStorageCell::getColor, AMItems.get(tier)::get);
event.getItemColors().register(PortableCellItem::getColor, AMItems.getPortableCell(tier)::get);
event.register(BasicStorageCell::getColor, AMItems.get(tier)::get);
event.register(PortableCellItem::getColor, AMItems.getPortableCell(tier)::get);
}
}
}
5 changes: 0 additions & 5 deletions src/main/java/me/ramidzkh/mekae2/MekCapabilities.java
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
import mekanism.api.chemical.infuse.IInfusionHandler;
import mekanism.api.chemical.pigment.IPigmentHandler;
import mekanism.api.chemical.slurry.ISlurryHandler;
import mekanism.api.heat.IHeatHandler;

public class MekCapabilities {

Expand All @@ -26,8 +25,4 @@ public class MekCapabilities {
public static final Capability<ISlurryHandler> SLURRY_HANDLER_CAPABILITY = CapabilityManager
.get(new CapabilityToken<>() {
});

public static final Capability<IHeatHandler> HEAT_HANDLER_CAPABILITY = CapabilityManager
.get(new CapabilityToken<>() {
});
}
17 changes: 10 additions & 7 deletions src/main/java/me/ramidzkh/mekae2/ae2/AMChemicalStackRenderer.java
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
import net.minecraft.client.renderer.texture.OverlayTexture;
import net.minecraft.client.renderer.texture.TextureAtlas;
import net.minecraft.network.chat.Component;
import net.minecraft.network.chat.TextComponent;
import net.minecraftforge.eventbus.api.IEventBus;
import net.minecraftforge.fml.event.lifecycle.FMLClientSetupEvent;

Expand Down Expand Up @@ -104,13 +103,17 @@ public Component getDisplayName(MekanismKey stack) {

@Override
public List<Component> getTooltip(MekanismKey stack) {
var list = new ArrayList<Component>();
list.add(getDisplayName(stack));
var tooltip = new ArrayList<Component>();
tooltip.add(getDisplayName(stack));

stack.getStack().getAttributes().forEach(attribute -> attribute.addTooltipText(list));
stack.getStack().getAttributes().forEach(attribute -> attribute.addTooltipText(tooltip));

// Append the name of the mod by default as mods such as REI would also add that
list.add(new TextComponent(Platform.formatModName(stack.getModId())));
return list;
// Heuristic: If the last line doesn't include the modname, add it ourselves
var modName = Platform.formatModName(stack.getModId());
if (tooltip.isEmpty() || !tooltip.get(tooltip.size() - 1).getString().equals(modName)) {
tooltip.add(Component.literal(modName));
}

return tooltip;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@

import net.minecraftforge.common.capabilities.Capability;

import me.ramidzkh.mekae2.AppliedMekanistics;
import me.ramidzkh.mekae2.MekCapabilities;
import me.ramidzkh.mekae2.ae2.impl.P2PModels;
import me.ramidzkh.mekae2.util.ChemicalBridge;
import mekanism.api.Action;
import mekanism.api.chemical.Chemical;
Expand All @@ -28,10 +28,11 @@
import appeng.api.parts.IPartItem;
import appeng.api.parts.IPartModel;
import appeng.items.parts.PartModels;
import appeng.parts.p2p.P2PModels;

public class ChemicalP2PTunnelPart extends MultipleCapabilityP2PTunnelPart<ChemicalP2PTunnelPart> {

private static final P2PModels MODELS = new P2PModels("part/chemical_p2p_tunnel");
private static final P2PModels MODELS = new P2PModels(AppliedMekanistics.id("part/chemical_p2p_tunnel"));

public ChemicalP2PTunnelPart(IPartItem<?> partItem) {
super(partItem, self -> List.of(
Expand Down
7 changes: 7 additions & 0 deletions src/main/java/me/ramidzkh/mekae2/ae2/MekanismKey.java
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
import net.minecraft.nbt.CompoundTag;
import net.minecraft.network.FriendlyByteBuf;
import net.minecraft.network.chat.Component;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.world.item.ItemStack;
import net.minecraft.world.level.Level;

Expand All @@ -34,6 +35,7 @@ public class MekanismKey extends AEKey {
private final ChemicalStack<?> stack;

private MekanismKey(ChemicalStack<?> stack) {
super(stack.getTextComponent());
this.stack = stack;
}

Expand Down Expand Up @@ -91,6 +93,11 @@ public String getModId() {
return stack.getTypeRegistryName().getNamespace();
}

@Override
public ResourceLocation getId() {
return stack.getTypeRegistryName();
}

@Override
public void writeToPacket(FriendlyByteBuf data) {
data.writeByte(getForm());
Expand Down
4 changes: 2 additions & 2 deletions src/main/java/me/ramidzkh/mekae2/ae2/MekanismKeyType.java
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

import net.minecraft.nbt.CompoundTag;
import net.minecraft.network.FriendlyByteBuf;
import net.minecraft.network.chat.TranslatableComponent;
import net.minecraft.network.chat.Component;

import me.ramidzkh.mekae2.AppliedMekanistics;
import mekanism.api.chemical.gas.GasStack;
Expand All @@ -22,7 +22,7 @@ public class MekanismKeyType extends AEKeyType {

private MekanismKeyType() {
super(AppliedMekanistics.id("chemical"), MekanismKey.class,
new TranslatableComponent("gui." + AppliedMekanistics.ID + ".chemical"));
Component.translatable("gui." + AppliedMekanistics.ID + ".chemical"));
}

@Nullable
Expand Down
Loading

0 comments on commit d9c4b2e

Please sign in to comment.