Skip to content

Commit

Permalink
Update GTNHG, update versioning logic again
Browse files Browse the repository at this point in the history
Also contains some unfinished stuff that I can't stash because it's interweaved with some new stuff

Signed-off-by: roadhog360 <[email protected]>
  • Loading branch information
Roadhog360 committed Nov 10, 2024
1 parent 69e4ae5 commit 38cc2c0
Show file tree
Hide file tree
Showing 16 changed files with 118 additions and 39 deletions.
6 changes: 4 additions & 2 deletions .github/workflows/build-and-test.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@

name: Build without test
name: Build and test

on:
pull_request:
Expand All @@ -9,5 +9,7 @@ on:

jobs:
build-and-test:
uses: Roadhog360/Hog-Actions-Workflows/.github/workflows/build-without-test.yml@master
uses: Roadhog360/Hog-Actions-Workflows/.github/workflows/build-and-test.yml@master
secrets: inherit
with:
client-only: true
22 changes: 19 additions & 3 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,13 @@ def NEXT_VERSION = ext.modVersion
// If we have a clean tag (or manually specified), this is a production release.
// No need for the commit hash!
def details = versionDetails()
def isPlainTag = details.getCommitDistance() == 0
def noCommitHash = providers.gradleProperty("noCommitHash").isPresent()
def isPlainTag = details.getCommitDistance() == 0 && details.getLastTag().isEmpty()
boolean noCommitHash = providers.gradleProperty("noCommitHash").isPresent() || details.gitHash.isEmpty()
if (!isPlainTag && !noCommitHash) {
NEXT_VERSION += "-nightly-" + details.gitHash
if(!NEXT_VERSION.isEmpty()) {
NEXT_VERSION += "-"
}
NEXT_VERSION += details.gitHash
}

// If we have uncommitted changes, say so.
Expand All @@ -33,4 +36,17 @@ minecraft {
//Creates a tag in Tags with the above generated mod version, instead of the "clean" one
injectedTags.put("RAW_VERSION", NEXT_VERSION)
injectedTags.put("MOD_ID", project.modId)
injectedTags.put("MOD_NAME", project.modName)
injectedTags.put("MOD_GROUP", project.modGroup)

//Returns true if this build is in a dev env or has a commit hash (typically used by CI), false if otherwise
injectedTags.put("CI_BUILD", !noCommitHash)
//Returns true if this build is the above or has key words in its name that indicate it may not be a release build
injectedTags.put("SNAPSHOT_BUILD", !noCommitHash
|| NEXT_VERSION.contains("snapshot")
|| NEXT_VERSION.contains("nightly")
|| NEXT_VERSION.contains("alpha")
|| NEXT_VERSION.contains("beta")
|| NEXT_VERSION.contains("rc")
|| (NEXT_VERSION.contains("release") && NEXT_VERSION.contains("candidate")))
}
13 changes: 4 additions & 9 deletions gradle.properties
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
#We don't (entirely) use git versioning so we override it here to make some tweaks to the way version numbers are defined.
gtnh.modules.gitVersion = false
#Planned name for next release
modVersion = 0.0.0
#Planned name for next release, can be blank for no version. (Uses commit hash as version) Delete or comment for tag-based versioning
modVersion =

# ExampleMod tag to use as Blowdryer (Spotless, etc.) settings version, leave empty to disable.
# LOCAL to test local config updates.
Expand Down Expand Up @@ -40,10 +38,8 @@ mappingsVersion = 12
# Defines other MCP mappings for dependency deobfuscation.
remoteMappings = https\://raw.githubusercontent.com/MinecraftForge/FML/1.7.10/conf/

# Don't use this, if you want to change your username, create a file named "addon.local.gradle"
# in the project root, and modify that to have your arguments, that way it doesn't get staged or committed.
# We don't want people using this because then that stages the file for commit and makes
# everyone have your username.
# Select a default username for testing your mod. You can always override this per-run by running
# `./gradlew runClient --username=AnotherPlayer`, or configuring this command in your IDE.
developmentEnvironmentUserName = Developer

# Enables using modern Java syntax (up to version 17) via Jabel, while still targeting JVM 8.
Expand Down Expand Up @@ -198,4 +194,3 @@ disableCheckstyle = true
# Whether IDEA should run spotless checks when pressing the Build button.
# This is meant to be set in $HOME/.gradle/gradle.properties.
# ideaCheckSpotlessOnBuild = true

Binary file modified gradle/wrapper/gradle-wrapper.jar
Binary file not shown.
5 changes: 4 additions & 1 deletion gradlew
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@
# See the License for the specific language governing permissions and
# limitations under the License.
#
# SPDX-License-Identifier: Apache-2.0
#

##############################################################################
#
Expand Down Expand Up @@ -84,7 +86,8 @@ done
# shellcheck disable=SC2034
APP_BASE_NAME=${0##*/}
# Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036)
APP_HOME=$( cd "${APP_HOME:-./}" > /dev/null && pwd -P ) || exit
APP_HOME=$( cd -P "${APP_HOME:-./}" > /dev/null && printf '%s
' "$PWD" ) || exit

# Use the maximum available, or set MAX_FD != -1 to use that value.
MAX_FD=maximum
Expand Down
2 changes: 2 additions & 0 deletions gradlew.bat
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@
@rem See the License for the specific language governing permissions and
@rem limitations under the License.
@rem
@rem SPDX-License-Identifier: Apache-2.0
@rem

@if "%DEBUG%"=="" @echo off
@rem ##########################################################################
Expand Down
2 changes: 1 addition & 1 deletion settings.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -17,5 +17,5 @@ pluginManagement {
}

plugins {
id 'com.gtnewhorizons.gtnhsettingsconvention' version '1.0.26'
id 'com.gtnewhorizons.gtnhsettingsconvention' version '1.0.29'
}
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,16 @@
import cpw.mods.fml.common.event.FMLServerStartingEvent;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import roadhog360.simpleskinbackport.proxy.CommonProxy;

@Mod(modid = SimpleSkinBackport.MODID, version = Tags.VERSION, name = "SimpleSkinBackport", acceptedMinecraftVersions = "[1.7.10]")
@Mod(modid = Tags.MOD_ID, name = Tags.MOD_NAME, acceptedMinecraftVersions = "[1.7.10]")
public class SimpleSkinBackport {
public static final String MODID = "simpleskinbackport";
public static final Logger LOG = LogManager.getLogger(MODID);
public static final Logger LOG = LogManager.getLogger(Tags.MOD_ID);

@SidedProxy(clientSide = "roadhog360.simpleskinbackport.ClientProxy", serverSide = "roadhog360.simpleskinbackport.CommonProxy")
@Mod.Instance(Tags.MOD_ID)
public static SimpleSkinBackport instance;

@SidedProxy(clientSide = Tags.MOD_GROUP + ".proxy.ClientProxy", serverSide = Tags.MOD_GROUP + ".proxy.CommonProxy")
public static CommonProxy proxy;

@Mod.EventHandler
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,10 +45,12 @@ public void renderItem(ItemRenderType type, ItemStack stack, Object... data) {
}

private void renderSkull(float x, float y, float z, int meta, GameProfile name) {
GL11.glPushMatrix();
GL11.glTranslatef(x, y, z);
TileEntitySkullRenderer.field_147536_b.func_152674_a(0, 0, 0, 0, 0, meta, name);
GL11.glPopMatrix();
if(TileEntitySkullRenderer.field_147536_b != null) {
GL11.glPushMatrix();
GL11.glTranslatef(x, y, z);
TileEntitySkullRenderer.field_147536_b.func_152674_a(0, 0, 0, 0, 0, meta, name);
GL11.glPopMatrix();
}
}

private GameProfile getGameProfile(ItemStack stack) {
Expand All @@ -62,6 +64,6 @@ else if (nbt.hasKey("SkullOwner", Constants.NBT.TAG_STRING))
profile = new GameProfile(null, nbt.getString("SkullOwner"));
}

return null;
return profile;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
import net.minecraftforge.common.config.Property;
import org.apache.commons.lang3.ArrayUtils;
import org.spongepowered.asm.mixin.MixinEnvironment;
import roadhog360.simpleskinbackport.SimpleSkinBackport;
import roadhog360.simpleskinbackport.Tags;
import roadhog360.simpleskinbackport.configuration.configs.ConfigMain;
import roadhog360.simpleskinbackport.configuration.configs.ConfigModCompat;
import roadhog360.simpleskinbackport.core.DefaultPlayerSkin;
Expand All @@ -21,7 +21,7 @@ public abstract class ConfigBase extends Configuration {
protected final List<ConfigCategory> configCats = new ArrayList<>();
private static final Set<ConfigBase> CONFIGS = new HashSet<>();

public static final String configDir = "config" + File.separator + SimpleSkinBackport.MODID + File.separator;
public static final String configDir = "config" + File.separator + Tags.MOD_ID + File.separator;

public static final ConfigBase MAIN = new ConfigMain(createConfigFile("main"));
public static final ConfigBase MOD_COMPAT = new ConfigModCompat(createConfigFile("modcompat"));
Expand Down Expand Up @@ -79,7 +79,7 @@ public static void postInit() {

@SubscribeEvent
public void onConfigChanged(ConfigChangedEvent.OnConfigChangedEvent eventArgs) {
if (SimpleSkinBackport.MODID.equals(eventArgs.modID))
if (Tags.MOD_ID.equals(eventArgs.modID))
syncConfig();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import com.gtnewhorizon.gtnhmixins.IEarlyMixinLoader;
import cpw.mods.fml.relauncher.IFMLLoadingPlugin;
import org.spongepowered.asm.mixin.MixinEnvironment;
import roadhog360.simpleskinbackport.SimpleSkinBackport;
import roadhog360.simpleskinbackport.Tags;
import roadhog360.simpleskinbackport.configuration.ConfigBase;

import java.util.ArrayList;
Expand All @@ -17,7 +17,7 @@ public class SimpleSkinBackportEarlyMixins implements IFMLLoadingPlugin, IEarlyM

@Override
public String getMixinConfig() {
return "mixins." + SimpleSkinBackport.MODID + ".early.json";
return "mixins." + Tags.MOD_ID + ".early.json";
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import com.gtnewhorizon.gtnhmixins.ILateMixinLoader;
import com.gtnewhorizon.gtnhmixins.LateMixin;
import org.spongepowered.asm.mixin.MixinEnvironment;
import roadhog360.simpleskinbackport.SimpleSkinBackport;
import roadhog360.simpleskinbackport.Tags;
import roadhog360.simpleskinbackport.configuration.configs.ConfigModCompat;

import java.util.ArrayList;
Expand All @@ -17,7 +17,7 @@ public class SimpleSkinBackportLateMixins implements ILateMixinLoader {

@Override
public String getMixinConfig() {
return "mixins." + SimpleSkinBackport.MODID + ".late.json";
return "mixins." + Tags.MOD_ID + ".late.json";
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
import roadhog360.simpleskinbackport.SimpleSkinBackport;
import roadhog360.simpleskinbackport.Tags;

import java.util.List;
import java.util.UUID;
Expand All @@ -40,7 +40,7 @@ private void injectMySkull(Item p_150895_1_, CreativeTabs p_150895_2_, List<Item

@Inject(method = "registerIcons", at = @At(value = "TAIL"))
private void injectIconRegisterForHead(IIconRegister register, CallbackInfo ci) {
roadhogHeadIcon = register.registerIcon(SimpleSkinBackport.MODID + ":skull_roadhog360");
roadhogHeadIcon = register.registerIcon(Tags.MOD_ID + ":skull_roadhog360");
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
import roadhog360.simpleskinbackport.SimpleSkinBackport;
import roadhog360.simpleskinbackport.Tags;
import roadhog360.simpleskinbackport.client.ImageBufferDownloadPlayerSkin;
import roadhog360.simpleskinbackport.core.Utils;
import roadhog360.simpleskinbackport.ducks.IArmsState;
Expand All @@ -24,7 +24,7 @@ private ResourceLocation changeDownloadLocation(String p_i1293_1_, Operation<Res
@Local(argsOnly = true) final SkinManager.SkinAvailableCallback p_152789_3_
) {
if(Utils.isPlayer(p_152789_2_, p_152789_3_)) {
return new ResourceLocation(SimpleSkinBackport.MODID, p_i1293_1_);
return new ResourceLocation(Tags.MOD_ID, p_i1293_1_);
}
return original.call(p_i1293_1_);
}
Expand All @@ -47,4 +47,57 @@ private void injectCallbackSkinCheck(MinecraftProfileTexture p_152789_1_, Minecr
Utils.setSlimFromMetadata(p_152789_1_, playerData);
}
}

//Temp disabled, from LAN skin fix mod
// @Shadow
// @Final
// private static ExecutorService field_152794_b;
// @Shadow
// @Final
// private MinecraftSessionService sessionService;
//
// @Shadow
// public ResourceLocation func_152789_a(MinecraftProfileTexture p_152789_1_, final MinecraftProfileTexture.Type p_152789_2_, final SkinManager.SkinAvailableCallback p_152789_3_)
// {
// return new ResourceLocation("jss2a98aj");
// }
//
// /**
// * @author
// * @reason
// */
// @Overwrite
// public void func_152790_a(final GameProfile p_152790_1_, final SkinManager.SkinAvailableCallback p_152790_2_, final boolean p_152790_3_)
// {
// // SkinManager$3
//// METHOD INSTRUCTIONS CHANGED
// field_152794_b.submit(() -> {
// final HashMap<MinecraftProfileTexture.Type, MinecraftProfileTexture> hashmap = Maps.newHashMap();
//
// try
// {
// hashmap.putAll(sessionService.getTextures(p_152790_1_, p_152790_3_));
// }
// catch (InsecureTextureException ignored) {}
//
// if (hashmap.isEmpty() && p_152790_1_.getId().equals(Minecraft.getMinecraft().getSession().func_148256_e().getId()))
// {
// // CHANGED LINE
// // Replaced "SkinManager.this.sessionService.fillProfileProperties(p_152790_1_, false)" with "Minecraft.getMinecraft().getSession().getProfile()" below.
// hashmap.putAll(sessionService.getTextures(Minecraft.getMinecraft().getSession().func_148256_e(), false));
// }
//
// Minecraft.getMinecraft().func_152344_a(() -> {
// if (hashmap.containsKey(MinecraftProfileTexture.Type.SKIN))
// {
// func_152789_a(hashmap.get(MinecraftProfileTexture.Type.SKIN), MinecraftProfileTexture.Type.SKIN, p_152790_2_);
// }
//
// if (hashmap.containsKey(MinecraftProfileTexture.Type.CAPE))
// {
// func_152789_a(hashmap.get(MinecraftProfileTexture.Type.CAPE), MinecraftProfileTexture.Type.CAPE, p_152790_2_);
// }
// });
// });
// }
}
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
package roadhog360.simpleskinbackport;
package roadhog360.simpleskinbackport.proxy;

import cpw.mods.fml.common.FMLCommonHandler;
import cpw.mods.fml.common.event.FMLInitializationEvent;
import net.minecraft.init.Items;
import net.minecraftforge.client.MinecraftForgeClient;
import net.minecraftforge.common.MinecraftForge;
import roadhog360.simpleskinbackport.client.ClientEventHandler;
import roadhog360.simpleskinbackport.client.item.ItemSkullRenderer;

public class ClientProxy extends CommonProxy {

Expand All @@ -16,6 +19,6 @@ public void init(FMLInitializationEvent event) {
FMLCommonHandler.instance().bus().register(ClientEventHandler.INSTANCE);
MinecraftForge.EVENT_BUS.register(ClientEventHandler.INSTANCE);

// MinecraftForgeClient.registerItemRenderer(Items.skull, new ItemSkullRenderer());
MinecraftForgeClient.registerItemRenderer(Items.skull, new ItemSkullRenderer());
}
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package roadhog360.simpleskinbackport;
package roadhog360.simpleskinbackport.proxy;

import cpw.mods.fml.common.event.FMLInitializationEvent;
import cpw.mods.fml.common.event.FMLPostInitializationEvent;
Expand Down

0 comments on commit 38cc2c0

Please sign in to comment.