Browse Source

Implemented JAR signing, fixed build issues

labyrinth
Collin1971 4 years ago
parent
commit
0155c04ca8
6 changed files with 87 additions and 73 deletions
  1. +56
    -27
      build.gradle
  2. +6
    -0
      build_signed.bat
  3. +19
    -19
      src/main/java/com/gildedgames/aether/common/AetherCore.java
  4. +5
    -0
      src/main/java/com/gildedgames/aether/common/CommonProxy.java
  5. +0
    -20
      src/main/java/com/gildedgames/aether/common/blocks/BlocksAether.java
  6. +1
    -7
      src/main/resources/assets/aether/lang/en_US.lang

+ 56
- 27
build.gradle View File

@@ -1,48 +1,61 @@
buildscript {
repositories {
jcenter()
maven {
name = "forge"
url = "http://files.minecraftforge.net/maven"
}
}
dependencies {
classpath 'net.minecraftforge.gradle:ForgeGradle:2.1-SNAPSHOT'
}
repositories {
jcenter()
maven {
name = "forge"
url = "http://files.minecraftforge.net/maven"
}
}
dependencies {
classpath 'net.minecraftforge.gradle:ForgeGradle:2.1-SNAPSHOT'
classpath 'org.ajoberstar:gradle-git:1.4.2'
}
}

import org.ajoberstar.grgit.*

apply plugin: 'net.minecraftforge.gradle.forge'

ext.config = loadConfig(file('build.properties'))
ext.repo = Grgit.open(project.file('.'))

sourceCompatibility = 1.7
targetCompatibility = 1.7

version = config.mod_version
group = 'com.gildedgames.aether'
version = "${config.mod_version}"
group = "com.gildedgames.aether"
archivesBaseName = "AetherII"

ext.ciVersion = System.getenv("BUILD_VERSION")
ext.gitVersion = repo.head().abbreviatedId

if (ciVersion != null) {
version = "${config.mod_version}.build-${ciVersion}"
} else {
version = "${config.mod_version}.git-${gitVersion}"
}

dependencies {
compile project(":Gilded-Games-Util")
compile project(":Gilded-Games-Util")
}

minecraft {
version = config.forge_version
mappings = config.forge_mappings
version = config.forge_version
mappings = config.forge_mappings

runDir = "run"
runDir = "run"
}

processResources {
from (sourceSets.main.resources.srcDirs) {
include 'mcmod.info'
from (sourceSets.main.resources.srcDirs) {
include 'mcmod.info'

expand 'version': project.version, 'mcversion': project.minecraft.version
}
expand 'version': project.version, 'mcversion': project.minecraft.version
}

from (sourceSets.main.resources.srcDirs) {
exclude 'mcmod.info'
}
from (sourceSets.main.resources.srcDirs) {
exclude 'mcmod.info'
}
}

idea {
@@ -51,11 +64,27 @@ idea {
}
}

// We disable this because Gradle will fail to build otherwise for some reason.
// See https://github.com/MinecraftForge/Srg2Source/issues/10
minecraft {
makeObfSourceJar = false
}

def loadConfig(File config) {
config.withReader {
def properties = new Properties()
properties.load(it)
def props = new Properties()
config.withInputStream {
stream -> props.load(stream)
}
return new ConfigSlurper().parse(props)
}

return (new ConfigSlurper().parse(properties))
task signJar(type: SignJar, dependsOn: reobfJar) {
if (project.hasProperty("aether_keystore")) {
keyStore = project.aether_keystore
alias = project.aether_keystore_alias
storePass = project.aether_keystore_pass
keyPass = project.aether_keystore_pass
inputFile = jar.archivePath
outputFile = jar.archivePath
}
}

+ 6
- 0
build_signed.bat View File

@@ -0,0 +1,6 @@
@echo off
title Building the Aether II...
call gradlew.bat build signJar

pause
exit

+ 19
- 19
src/main/java/com/gildedgames/aether/common/AetherCore.java View File

@@ -1,35 +1,37 @@
package com.gildedgames.aether.common;

import com.gildedgames.aether.common.world.TeleporterAether;
import com.gildedgames.util.core.SidedObject;
import com.gildedgames.util.io_manager.IOCore;
import com.gildedgames.util.io_manager.exceptions.IOManagerTakenException;
import net.minecraft.server.MinecraftServer;
import net.minecraft.util.ResourceLocation;
import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.fml.common.Mod;
import net.minecraftforge.fml.common.Mod.EventHandler;
import net.minecraftforge.fml.common.Mod.Instance;
import net.minecraftforge.fml.common.SidedProxy;
import net.minecraftforge.fml.common.event.FMLFingerprintViolationEvent;
import net.minecraftforge.fml.common.event.FMLInitializationEvent;
import net.minecraftforge.fml.common.event.FMLPostInitializationEvent;
import net.minecraftforge.fml.common.event.FMLPreInitializationEvent;
import net.minecraftforge.fml.common.event.FMLServerStartedEvent;
import net.minecraftforge.fml.relauncher.Side;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;

import com.gildedgames.aether.common.world.TeleporterAether;
import com.gildedgames.util.core.SidedObject;
import com.gildedgames.util.io_manager.IOCore;
import com.gildedgames.util.io_manager.exceptions.IOManagerTakenException;

@Mod(name = AetherCore.MOD_NAME, modid = AetherCore.MOD_ID, version = AetherCore.MOD_VERSION)
@Mod(name = AetherCore.MOD_NAME, modid = AetherCore.MOD_ID, version = AetherCore.MOD_VERSION, certificateFingerprint = AetherCore.MOD_FINGERPRINT)
public class AetherCore
{
protected static final String MOD_FINGERPRINT = "b9a9be44fb51751dd1aec1dbb881b6de1a086abc";

public static final String MOD_NAME = "Aether II";

public static final String MOD_ID = "aether";

public static final String MOD_VERSION = "1.8-1.0";

public static final Logger LOGGER = LogManager.getLogger("AetherII");

@Instance(AetherCore.MOD_ID)
public static AetherCore INSTANCE;

@@ -40,8 +42,6 @@ public class AetherCore

public static AetherConfig CONFIG;

public static Logger LOGGER;

private static TeleporterAether teleporter;
public static AetherServices locate()
@@ -60,16 +60,8 @@ public class AetherCore
{
e.printStackTrace();
}
AetherCore.LOGGER = event.getModLog();

AetherCore.CONFIG = new AetherConfig(event.getSuggestedConfigurationFile());
AetherCapabilities capabilities = new AetherCapabilities();
capabilities.init();
MinecraftForge.EVENT_BUS.register(capabilities);

AetherCore.PROXY.preInit(event);
}
@@ -92,6 +84,14 @@ public class AetherCore
teleporter = new TeleporterAether(MinecraftServer.getServer().worldServerForDimension(getAetherDimID()));
}


@EventHandler
public void onFingerprintViolation(FMLFingerprintViolationEvent event)
{
AetherCore.LOGGER.warn("The Aether's signature is invalid, and will not receive support. Either you're running in a development environment, your JAR is corrupted, " +
"or you've downloaded an unofficial version of the Aether II. Proceed at your own risk.");
}

public static ResourceLocation getResource(String name)
{
return new ResourceLocation(AetherCore.MOD_ID, name);


+ 5
- 0
src/main/java/com/gildedgames/aether/common/CommonProxy.java View File

@@ -87,6 +87,11 @@ public class CommonProxy
MinecraftForge.EVENT_BUS.register(new EntityEffectsEventHooks());
MinecraftForge.EVENT_BUS.register(new PartyMemberTracker());

AetherCapabilities capabilities = new AetherCapabilities();
capabilities.init();

MinecraftForge.EVENT_BUS.register(capabilities);

MinecraftForge.EVENT_BUS.register(ItemsAether.skyroot_sword);

ChunkModule.api().registerHookFactory(new PlacementFlagFactory());


+ 0
- 20
src/main/java/com/gildedgames/aether/common/blocks/BlocksAether.java View File

@@ -2,8 +2,6 @@ package com.gildedgames.aether.common.blocks;

import com.gildedgames.aether.common.AetherCore;
import com.gildedgames.aether.common.AetherCreativeTabs;
import com.gildedgames.aether.common.blocks.construction.aether_walls.BlockAerogelWall;
import com.gildedgames.aether.common.blocks.construction.aether_walls.BlockAetherWall;
import com.gildedgames.aether.common.blocks.construction.skyroot_fence.BlockSkyrootFence;
import com.gildedgames.aether.common.blocks.construction.skyroot_fence.BlockSkyrootFenceGate;
import com.gildedgames.aether.common.blocks.construction.BlockAetherPortal;
@@ -120,9 +118,6 @@ public class BlocksAether

public static BlockWallSkyrootSign wall_skyroot_sign;

public static BlockAetherWall holystone_wall, holystone_wall_mossy, carved_stone_wall, icestone_wall, aerogel_wall, skyroot_log_wall;


public static void preInit()
{
aether_dirt = registerBlock("aether_dirt", new Block(Material.ground).setStepSound(Block.soundTypeGravel).setHardness(0.5f), AetherCreativeTabs.tabBlocks);
@@ -212,13 +207,6 @@ public class BlocksAether

wall_skyroot_sign = registerBlock("wall_skyroot_sign", new BlockWallSkyrootSign());

holystone_wall = registerBlock("holystone_wall", new BlockAetherWall(BlocksAether.holystone, 1.0f, 10.0f), AetherCreativeTabs.tabBlocks);
holystone_wall_mossy = registerBlock("holystone_wall_mossy", new BlockAetherWall(BlocksAether.holystone, 1.0f, 10.0f), AetherCreativeTabs.tabBlocks);
carved_stone_wall = registerBlock("carved_stone_wall", new BlockAetherWall(BlocksAether.carved_stone, 1.0f, 10.0f), AetherCreativeTabs.tabBlocks);
icestone_wall = registerBlock("icestone_wall", new BlockAetherWall(BlocksAether.icestone_bricks, 3.0f, 10.0f), AetherCreativeTabs.tabBlocks);
skyroot_log_wall = registerBlock("skyroot_log_wall", new BlockAetherWall(BlocksAether.skyroot_log, 2.0f, 10.0f), AetherCreativeTabs.tabBlocks);
aerogel_wall = registerBlock("aerogel_wall", new BlockAerogelWall(BlocksAether.aerogel, 1.0f, 10.f), AetherCreativeTabs.tabBlocks);

registerHarvestLevels();
}

@@ -256,14 +244,6 @@ public class BlocksAether
holystone_brick.setHarvestLevel("pickaxe", 0);

skyroot_door.setHarvestLevel("axe", 0);

holystone_wall.setHarvestLevel("pickaxe", 0);
holystone_wall_mossy.setHarvestLevel("pickaxe", 0);
carved_stone_wall.setHarvestLevel("pickaxe", 0);
skyroot_log_wall.setHarvestLevel("axe", 0);
icestone_wall.setHarvestLevel("pickaxe", 1);
aerogel_wall.setHarvestLevel("pickaxe", 1);

}

private static <T extends Block> T registerBlock(String name, T block, CreativeTabs tab)


+ 1
- 7
src/main/resources/assets/aether/lang/en_US.lang View File

@@ -54,13 +54,7 @@ tile.aether.quicksoil_glass.name=Quicksoil Glass
tile.aether.skyroot_chest.name=Skyroot Chest
tile.aether.ambrosium_torch.name=Ambrosium Torch
tile.aether.skyroot_fence.name=Skyroot Fence
tile.aether.skyroot_fence_gate.name=Skyroot Fence Gates
tile.aether.holystone_wall.name=Holystone Wall
tile.aether.carved_stone_wall.name=Carved Stone Wall
tile.aether.holystone_wall_mossy.name=Mossy Holystone Wall
tile.aether.icestone_wall.name=Icestone Brick Wall
tile.aether.skyroot_log_wall.name=Skyroot Log Wall
tile.aether.aerogel_wall.name=Aerogel Wall
tile.aether.skyroot_fence_gate.name=Skyroot Fence Gate

# Aether Items
item.aether.skyroot_stick.name=Skyroot Stick


Loading…
Cancel
Save