Skip to content

Commit

Permalink
* licensed under 3-clause BSD (as agreed by KJ4IPS)
Browse files Browse the repository at this point in the history
* added KJ4IPS as author under mcmod.info
* updated gradlefile, README and EnchantIcons to latest conventions
* enforce siding; mod will now only work client side. fixes crash on server side
* use correct logger
  • Loading branch information
RoyCurtis committed Aug 25, 2015
1 parent 83e9bfb commit cb2d8b1
Show file tree
Hide file tree
Showing 7 changed files with 94 additions and 60 deletions.
12 changes: 12 additions & 0 deletions LICENSE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
Copyright (c) 2015, Roy Adrian Curtis
All rights reserved.

Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:

1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.

2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.

3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
12 changes: 12 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
[![Build Status](http://ci.haun.guru/buildStatus/icon?job=EnchantIcons)](http://ci.haun.guru/job/EnchantIcons/)

**EnchantIcons** is a client-only mod that makes enchanted books easier to find, based on their inner enchantment. It is available for 1.7.10 and 1.6.4.

# Building

## Requirements

* [Gradle installation with gradle binary in PATH](http://www.gradle.org/installation). Unlike the source package provided by Forge, this repository does not include a gradle wrapper or distribution.

## Usage
Simply execute `gradle setupCIWorkspace` in the root directory of this repository. Then execute `gradle build`. If subsequent builds cause problems, do `gradle clean`.
26 changes: 0 additions & 26 deletions Readme.markdown

This file was deleted.

61 changes: 40 additions & 21 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,60 +1,79 @@
buildscript {
repositories {
buildscript
{
// Repositories and plugins used by this buildscript. For internal Gradle use only.
repositories
{
mavenCentral()
maven {
maven
{
name = "forge"
url = "http://files.minecraftforge.net/maven"
}
maven {
maven
{
name = "sonatype"
url = "https://oss.sonatype.org/content/repositories/snapshots/"
}
}
dependencies {
dependencies
{
classpath 'net.minecraftforge.gradle:ForgeGradle:1.2-SNAPSHOT'
}
}

// Applies the custom Gradle plugin Forge uses, for Forge-specific tasks
apply plugin: 'forge'

modid = "enchanticons"
version = "0.1.0"
group = "roycurtis.EnchantIcons"

archivesBaseName = modid
version = "0.1.1"
group = "roycurtis"

minecraft
{
version = "1.7.10-10.13.0.1180"
assetDir = "eclipse/assets"
version = "1.7.10-10.13.4.1448-1.7.10"
runDir = "debug"
}

jar
{
// Sets the output directory of the mod's jar file. Can be an absolute path to your
// Minecraft mods folder for quicker testing
// Sets the output directory of the mod's jar file
destinationDir = file 'output'
classifier "1.7.10"
}

compileJava
{
// Enforces use of Java 1.7 language level
sourceCompatibility = "1.7"
targetCompatibility = "1.7"
}

idea
{
module
{
// Fixes issues with debugging in IntelliJ
inheritOutputDirs = true
}
}

processResources
{
// this will ensure that this task is redone when the versions change.
inputs.property "version", project.version
inputs.property "mcversion", project.minecraft.version
inputs.property "modid", project.modid

// replace stuff in mcmod.info, nothing else
from(sourceSets.main.resources.srcDirs)
{
{
include 'mcmod.info'

// replace version and mcversion
expand 'version':project.version, 'mcversion':project.minecraft.version, 'modid':project.modid
expand 'version':project.version, 'mcversion':project.minecraft.version
}

// copy everything else, thats not the mcmod.info
from(sourceSets.main.resources.srcDirs)
{
{
exclude 'mcmod.info'
}
}
}
36 changes: 27 additions & 9 deletions src/main/java/roycurtis/EnchantIcons.java
Original file line number Diff line number Diff line change
Expand Up @@ -4,32 +4,50 @@
import cpw.mods.fml.common.Mod.EventHandler;
import cpw.mods.fml.common.event.FMLInitializationEvent;
import cpw.mods.fml.common.event.FMLPreInitializationEvent;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import net.minecraft.init.Items;
import net.minecraftforge.client.MinecraftForgeClient;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;

@Mod(modid = EnchantIcons.MODID, version = EnchantIcons.VERSION)
@Mod(
modid = EnchantIcons.MODID,
name = EnchantIcons.MODID,
version = EnchantIcons.VERSION,

acceptableRemoteVersions = "*",
acceptableSaveVersions = ""
)
public class EnchantIcons
{
public static final String MODID = "enchanticons";
/** Frozen at 0.0.1 to prevent misleading world save error */
public static final String VERSION = "0.0.1";
public static final String MODID = "enchanticons";

public static Logger Logger;
public static Logger LOG = LogManager.getFormatterLogger(EnchantIcons.MODID);
public static EnchantIconsConfiguration config;

@EventHandler
public void preInit(FMLPreInitializationEvent event)
@SideOnly(Side.SERVER)
public void serverPreInit(FMLPreInitializationEvent event)
{
Logger = event.getModLog();
config = new EnchantIconsConfiguration(event.getSuggestedConfigurationFile());

LOG.error("This mod is intended only for use on clients");
LOG.error("Please consider removing this mod from your server installation");
}

@EventHandler
@SideOnly(Side.CLIENT)
public void clientPreInit(FMLPreInitializationEvent event)
{
config = new EnchantIconsConfiguration(event.getSuggestedConfigurationFile());
}

@EventHandler
public void init(FMLInitializationEvent event)
@SideOnly(Side.CLIENT)
public void clientInit(FMLInitializationEvent event)
{
MinecraftForgeClient.registerItemRenderer( Items.enchanted_book, new EnchantIconsRenderer() );
Logger.info("Loaded version %s", VERSION);
LOG.info("Loaded version %s", VERSION);
}
}
1 change: 0 additions & 1 deletion src/main/java/roycurtis/EnchantIconsConfiguration.java
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package roycurtis;

import net.minecraftforge.common.config.Configuration;
import sun.misc.Regexp;

import java.io.File;
import java.util.HashMap;
Expand Down
6 changes: 3 additions & 3 deletions src/main/resources/mcmod.info
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
[
{
"modid": "${modid}",
"name": "Enchant Icons",
"modid": "enchanticons",
"name": "EnchantIcons",
"description": "Custom renderer for enchanted book items.",
"version": "${version}",
"mcversion": "${mcversion}",
"url": "",
"updateUrl": "",
"authors": ["Roy Curtis"],
"authors": ["Roy Curtis", "KJ4IPS"],
"credits": "The Forge and FML guys, for making this example",
"logoFile": "",
"screenshots": [],
Expand Down

0 comments on commit cb2d8b1

Please sign in to comment.