Skip to content

Commit

Permalink
Merge pull request #2 from GTNewHorizons/fix-tag
Browse files Browse the repository at this point in the history
Fix Version Replacement
  • Loading branch information
Dream-Master authored Mar 16, 2024
2 parents aa6833d + 97904b5 commit c436da6
Show file tree
Hide file tree
Showing 9 changed files with 40 additions and 47 deletions.
24 changes: 8 additions & 16 deletions gradle.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# ExampleMod tag to use as Blowdryer (Spotless, etc.) settings version, leave empty to disable.
# LOCAL to test local config updates.
gtnh.settings.blowdryerTag = 0.2.0
gtnh.settings.blowdryerTag = 0.2.2

# Human-readable mod name, available for mcmod.info population.
modName = BuildCraft Oil Tweak
Expand Down Expand Up @@ -33,41 +33,35 @@ channel = stable
mappingsVersion = 12

# Defines other MCP mappings for dependency deobfuscation.
remoteMappings = https://raw.githubusercontent.com/MinecraftForge/FML/1.7.10/conf/
remoteMappings = https\://raw.githubusercontent.com/MinecraftForge/FML/1.7.10/conf/

# 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.
# See https://github.com/bsideup/jabel for details on how this works.
enableModernJavaSyntax = false
enableModernJavaSyntax = true

# Enables injecting missing generics into the decompiled source code for a better coding experience.
# Turns most publicly visible List, Map, etc. into proper List<E>, Map<K, V> types.
enableGenericInjection = false
enableGenericInjection = true

# Generate a class with a String field for the mod version named as defined below.
# If generateGradleTokenClass is empty or not missing, no such class will be generated.
# If gradleTokenVersion is empty or missing, the field will not be present in the class.
generateGradleTokenClass =
generateGradleTokenClass = buildcraft.oiltweak.Tags

# Name of the token containing the project's current version to generate/replace.
gradleTokenVersion = GRADLETOKEN_VERSION

# [DEPRECATED] Mod ID replacement token.
gradleTokenModId =

# [DEPRECATED] Mod name replacement token.
gradleTokenModName =
gradleTokenVersion = VERSION

# [DEPRECATED]
# Multiple source files can be defined here by providing a comma-separated list: Class1.java,Class2.java,Class3.java
# public static final String VERSION = "GRADLETOKEN_VERSION";
# The string's content will be replaced with your mod's version when compiled. You should use this to specify your mod's
# version in @Mod([...], version = VERSION, [...]).
# Leave these properties empty to skip individual token replacements.
replaceGradleTokenInFile = BuildCraftOilTweak.java,package-info.java
replaceGradleTokenInFile =

# In case your mod provides an API for other mods to implement you may declare its package here. Otherwise, you can
# leave this property empty.
Expand Down Expand Up @@ -123,7 +117,7 @@ includeWellKnownRepositories = true
usesMavenPublishing = true

# Maven repository to publish the mod to.
# mavenPublishUrl = https://nexus.gtnewhorizons.com/repository/releases/
# mavenPublishUrl = https\://nexus.gtnewhorizons.com/repository/releases/

# Publishing to Modrinth requires you to set the MODRINTH_TOKEN environment variable to your current Modrinth API token.
#
Expand Down Expand Up @@ -187,5 +181,3 @@ customArchiveBaseName = BuildCraftOilTweak
# This is meant to be set in $HOME/.gradle/gradle.properties.
# ideaCheckSpotlessOnBuild = true

# Non-GTNH properties
gradleTokenGroupName =
2 changes: 1 addition & 1 deletion settings.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ pluginManagement {
}

plugins {
id 'com.gtnewhorizons.gtnhsettingsconvention' version '1.0.8'
id 'com.gtnewhorizons.gtnhsettingsconvention' version '1.0.19'
}


24 changes: 15 additions & 9 deletions src/main/java/buildcraft/oiltweak/BuildCraftOilTweak.java
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,12 @@
* @author Vexatos
*/
@Mod(
modid = Mods.BCOilTweak,
name = Mods.BCOilTweak_NAME,
version = "GRADLETOKEN_VERSION",
canBeDeactivated = true,
dependencies = "after:BuildCraft|Core@[6.4.1,);after:Forge@[10.13.2.1236,);"
+ "after:BuildCraft|Energy@[6.4.1,);after:EnderIO@[1.7.10_2.2.7,);after:simplyjetpacks")
modid = Mods.BCOilTweak,
name = Mods.BCOilTweak_NAME,
version = Tags.VERSION,
canBeDeactivated = true,
dependencies = "after:BuildCraft|Core@[6.4.1,);after:Forge@[10.13.2.1236,);"
+ "after:BuildCraft|Energy@[6.4.1,);after:EnderIO@[1.7.10_2.2.7,);after:simplyjetpacks")
public class BuildCraftOilTweak extends OilTweakAPI {

@Instance(Mods.BCOilTweak)
Expand All @@ -48,19 +48,25 @@ public void preInit(FMLPreInitializationEvent event) {
@EventHandler
public void init(FMLInitializationEvent event) {
eventHandler = new OilTweakEventHandler();
FMLCommonHandler.instance().bus().register(eventHandler);
FMLCommonHandler.instance()
.bus()
.register(eventHandler);
MinecraftForge.EVENT_BUS.register(eventHandler);
if (Mods.isLoaded(Mods.SimplyJetpacks)) {
simplyJetpacks = new IntegrationSimplyJetpacks();
FMLCommonHandler.instance().bus().register(simplyJetpacks);
FMLCommonHandler.instance()
.bus()
.register(simplyJetpacks);
simplyJetpacks.init();
}
}

@EventHandler
public void deInit(FMLModDisabledEvent event) {
if (eventHandler != null) {
FMLCommonHandler.instance().bus().unregister(eventHandler);
FMLCommonHandler.instance()
.bus()
.unregister(eventHandler);
MinecraftForge.EVENT_BUS.unregister(eventHandler);
}
if (Mods.isLoaded(Mods.SimplyJetpacks) && simplyJetpacks != null) {
Expand Down
21 changes: 10 additions & 11 deletions src/main/java/buildcraft/oiltweak/OilTweakEventHandler.java
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ protected InOil getInOil(Entity entity) {
for (int z = minZ; z <= maxZ; ++z) {
if (isOil(entity.worldObj.getBlock(x, y, z))) {
return maxY == minY || isOil(entity.worldObj.getBlock(x, maxY, z)) ? InOil.FULL
: InOil.HALF;
: InOil.HALF;
}
}
}
Expand All @@ -73,8 +73,9 @@ private boolean isOil(Block block) {
}
Fluid fluid = FluidRegistry.lookupFluidForBlock(block);
return fluid != null && FluidRegistry.isFluidRegistered(fluid)
&& fluid.getName() != null
&& fluid.getName().equalsIgnoreCase("oil");
&& fluid.getName() != null
&& fluid.getName()
.equalsIgnoreCase("oil");
}

@SubscribeEvent(priority = EventPriority.LOWEST)
Expand Down Expand Up @@ -164,7 +165,7 @@ public void onTeleportAttempt(EnderTeleportEvent e) {
}
EntityLivingBase player = e.entityLiving;
if (!(player instanceof EntityPlayer && ((EntityPlayer) player).capabilities.isCreativeMode)
&& getInOil(player).halfOfFull()) {
&& getInOil(player).halfOfFull()) {
e.setCanceled(true);
e.setResult(Event.Result.DENY);
}
Expand All @@ -178,14 +179,12 @@ public void onRightClick(PlayerInteractEvent e) {
EntityPlayer player = e.entityPlayer;
if (!player.capabilities.isCreativeMode && player.getCurrentEquippedItem() != null) {
InOil inOil = getInOil(player);
if (inOil.halfOfFull()
&& ((inOil == InOil.FULL && !(player.getCurrentEquippedItem().getItem() instanceof ItemBlock))
|| OilTweakAPI.INSTANCE.getItemBlacklistRegistry()
.isBlacklisted(player, player.getCurrentEquippedItem()))) {
if (inOil.halfOfFull() && ((inOil == InOil.FULL && !(player.getCurrentEquippedItem()
.getItem() instanceof ItemBlock)) || OilTweakAPI.INSTANCE.getItemBlacklistRegistry()
.isBlacklisted(player, player.getCurrentEquippedItem()))) {
player.addChatComponentMessage(
new ChatComponentTranslation(
inOil == InOil.FULL ? "oiltweak.chat.tooDense.use"
: "oiltweak.chat.tooDense.use.half"));
new ChatComponentTranslation(
inOil == InOil.FULL ? "oiltweak.chat.tooDense.use" : "oiltweak.chat.tooDense.use.half"));
e.setCanceled(true);
}
}
Expand Down
2 changes: 0 additions & 2 deletions src/main/java/buildcraft/oiltweak/OilTweakProperties.java
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
*/
public class OilTweakProperties implements IExtendedEntityProperties {

private Entity entity;
public float realStepHeight;
public boolean inOil;

Expand All @@ -34,7 +33,6 @@ public void loadNBTData(NBTTagCompound data) {

@Override
public void init(Entity entity, World world) {
this.entity = entity;
this.inOil = false;
this.realStepHeight = entity.stepHeight;
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
/**
* @author Vexatos
*/
@API(apiVersion = "1.0.0", owner = "OilTweak", provides = "OilTweakAPI|blacklist")
@API(apiVersion = Tags.VERSION, owner = "OilTweak", provides = "OilTweakAPI|blacklist")
package buildcraft.oiltweak.api.blacklist;

import buildcraft.oiltweak.Tags;
import cpw.mods.fml.common.API;
3 changes: 2 additions & 1 deletion src/main/java/buildcraft/oiltweak/api/package-info.java
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
/**
* @author Vexatos
*/
@API(apiVersion = "GRADLETOKEN_VERSION", owner = "OilTweak", provides = "OilTweakAPI")
@API(apiVersion = Tags.VERSION, owner = "OilTweak", provides = "OilTweakAPI")
package buildcraft.oiltweak.api;

import buildcraft.oiltweak.Tags;
import cpw.mods.fml.common.API;
2 changes: 1 addition & 1 deletion src/main/java/buildcraft/oiltweak/reference/Mods.java
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ public class Mods {

// Other mods
public static final String BuildCraftCore = "BuildCraft|Core", BuildCraftEnergy = "BuildCraft|Energy",
SimplyJetpacks = "simplyjetpacks";
SimplyJetpacks = "simplyjetpacks";

public static boolean hasAPI(String name) {
return ModAPIManager.INSTANCE.hasAPI(name);
Expand Down
6 changes: 1 addition & 5 deletions src/main/resources/mcmod.info
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,6 @@
"credits": "",
"logoFile": "",
"screenshots": [],
"parent": "",
"requiredMods": [],
"dependencies": [],
"dependants": [],
"useDependencyInformation": true
"parent": ""
}]
}

0 comments on commit c436da6

Please sign in to comment.