-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit c16e089
Showing
11 changed files
with
684 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
# Auto detect text files and perform LF normalization | ||
* text=auto | ||
|
||
# Custom for Visual Studio | ||
*.cs diff=csharp | ||
*.sln merge=union | ||
*.csproj merge=union | ||
*.vbproj merge=union | ||
*.fsproj merge=union | ||
*.dbproj merge=union | ||
|
||
# Standard to msysgit | ||
*.doc diff=astextplain | ||
*.DOC diff=astextplain | ||
*.docx diff=astextplain | ||
*.DOCX diff=astextplain | ||
*.dot diff=astextplain | ||
*.DOT diff=astextplain | ||
*.pdf diff=astextplain | ||
*.PDF diff=astextplain | ||
*.rtf diff=astextplain | ||
*.RTF diff=astextplain |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
.gradle | ||
build | ||
jars | ||
out | ||
*.iml | ||
*.ipr | ||
*.iws | ||
.idea | ||
*.json |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
Copyright (c) 2014, DoubleDoorDevelopment | ||
All rights reserved. | ||
|
||
Redistribution and use in source and binary forms, with or without | ||
modification, are permitted provided that the following conditions are met: | ||
|
||
* Redistributions of source code must retain the above copyright notice, this | ||
list of conditions and the following disclaimer. | ||
|
||
* 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. | ||
|
||
* Neither the name of the project 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. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,149 @@ | ||
buildscript { | ||
repositories { | ||
mavenCentral() | ||
maven { | ||
name = "forge" | ||
url = "http://files.minecraftforge.net/maven" | ||
} | ||
maven { | ||
name = "sonatype" | ||
url = "https://oss.sonatype.org/content/repositories/snapshots/" | ||
} | ||
} | ||
dependencies { | ||
classpath 'net.minecraftforge.gradle:ForgeGradle:1.2-SNAPSHOT' | ||
classpath group: 'com.github.rodionmoiseev.gradle.plugins', name: 'idea-utils', version: '0.2' | ||
} | ||
} | ||
|
||
import groovy.json.* | ||
|
||
configurations { | ||
compile | ||
deployJars | ||
} | ||
|
||
apply plugin: "forge" | ||
apply plugin: "maven" | ||
apply plugin: "idea-utils" | ||
|
||
group = "net.doubledoordev.timber" | ||
version = "1.0.0" | ||
|
||
targetCompatibility = 1.7 | ||
sourceCompatibility = 1.7 | ||
|
||
archivesBaseName = 'Timber' | ||
def githuborg = 'DoubleDoorDevelopment' | ||
def description = 'Cause I hate floating leaves.' | ||
minecraft { | ||
version = "1.7.10-10.13.0.1190" | ||
runDir = "jars" | ||
} | ||
|
||
if (System.getenv().BUILD_NUMBER != null) version += "." + System.getenv().BUILD_NUMBER | ||
def builder = new groovy.json.JsonBuilder() | ||
builder (version: version, mcversion: project.minecraft.version, apiversion: project.minecraft.apiVersion) | ||
new File("versions.json").write(builder.toPrettyString()) | ||
|
||
processResources { | ||
from(sourceSets.main.resources.srcDirs) { | ||
include '**/*.info' | ||
expand 'version':project.version, 'mcversion':project.minecraft.version, 'modid':project.archivesBaseName, 'githuborg':githuborg, 'description':description | ||
} | ||
|
||
from(sourceSets.main.resources.srcDirs) { | ||
exclude '**/*.info' | ||
} | ||
} | ||
|
||
task sourcesJar(type: Jar) { | ||
from "LICENSE.txt" | ||
from sourceSets.main.allSource | ||
classifier = 'src' | ||
appendix = project.minecraft.version | ||
} | ||
|
||
task deobfJar(type: Jar) { | ||
from "LICENSE.txt" | ||
from sourceSets.main.output | ||
from (sourceSets.main.allSource.srcDirs) { | ||
include '**/*.java' | ||
} | ||
classifier = 'dev' | ||
appendix = project.minecraft.version | ||
} | ||
|
||
jar { | ||
from "LICENSE.txt" | ||
appendix = project.minecraft.version | ||
} | ||
|
||
artifacts { | ||
archives jar | ||
archives sourcesJar | ||
archives deobfJar | ||
} | ||
|
||
idea { | ||
project { | ||
copyright { | ||
name = 'New BSD License' | ||
license = file('LICENSE.txt') | ||
} | ||
} | ||
} | ||
|
||
uploadArchives { | ||
String repo = "/var/www/ddd/maven/"; | ||
if (new File(repo).exists()) { | ||
repositories { | ||
mavenDeployer { | ||
repository(url: "file://localhost" + repo) | ||
pom { | ||
groupId = project.group | ||
version = project.minecraft.version + "-" + project.version | ||
artifactId = project.archivesBaseName | ||
project { | ||
name project.archivesBaseName | ||
packaging 'jar' | ||
description = description | ||
url 'https://github.com/' + githuborg + '/' + project.archivesBaseName | ||
|
||
scm { | ||
url 'https://github.com/' + githuborg + '/' + project.archivesBaseName | ||
connection 'scm:git:git://github.com/' + githuborg + '/' + project.archivesBaseName + '.git' | ||
developerConnection 'scm:git:git@github.com:' + githuborg + '/' + project.archivesBaseName + '.git' | ||
} | ||
|
||
issueManagement { | ||
system 'github' | ||
url 'https://github.com/' + githuborg + '/' + project.archivesBaseName + '/issues' | ||
} | ||
|
||
licenses { | ||
license { | ||
name 'MIT License' | ||
url 'https://raw.github.com/' + githuborg + '/' + project.archivesBaseName + '/master/LICENCE.txt' | ||
distribution 'repo' | ||
} | ||
} | ||
|
||
developers { | ||
developer { | ||
id 'Dries007' | ||
name 'Dries007' | ||
roles { role 'developer' } | ||
} | ||
developer { | ||
id 'Claycorp' | ||
name 'Claycorp' | ||
roles { role 'architect' } | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,147 @@ | ||
/* | ||
* Copyright (c) 2014, DoubleDoorDevelopment | ||
* All rights reserved. | ||
* | ||
* Redistribution and use in source and binary forms, with or without | ||
* modification, are permitted provided that the following conditions are met: | ||
* | ||
* Redistributions of source code must retain the above copyright notice, this | ||
* list of conditions and the following disclaimer. | ||
* | ||
* 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. | ||
* | ||
* Neither the name of the project 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. | ||
*/ | ||
|
||
package net.doubledoordev.lib; | ||
|
||
import com.google.gson.JsonObject; | ||
import com.google.gson.JsonParser; | ||
import cpw.mods.fml.common.eventhandler.EventPriority; | ||
import cpw.mods.fml.common.eventhandler.SubscribeEvent; | ||
import cpw.mods.fml.common.registry.GameData; | ||
import net.minecraft.entity.item.EntityItem; | ||
import net.minecraft.item.ItemStack; | ||
import net.minecraftforge.event.entity.player.PlayerDropsEvent; | ||
import net.minecraftforge.event.entity.player.PlayerEvent; | ||
import org.apache.commons.io.IOUtils; | ||
|
||
import java.net.URL; | ||
import java.nio.charset.Charset; | ||
|
||
/** | ||
* Something other than capes for once | ||
* | ||
* @author Dries007 | ||
*/ | ||
public class DevPerks | ||
{ | ||
private static final String PERKS_URL = "http://doubledoordev.net/perks.json"; | ||
private JsonObject perks = new JsonObject(); | ||
private boolean debug; | ||
|
||
public DevPerks(boolean debug) | ||
{ | ||
this.debug = debug; | ||
try | ||
{ | ||
perks = new JsonParser().parse(IOUtils.toString(new URL(PERKS_URL), Charset.forName("UTF-8"))).getAsJsonObject(); | ||
} | ||
catch (Exception e) | ||
{ | ||
if (debug) e.printStackTrace(); | ||
} | ||
} | ||
|
||
/** | ||
* Something other than capes for once | ||
*/ | ||
@SubscribeEvent | ||
public void nameFormatEvent(PlayerEvent.NameFormat event) | ||
{ | ||
try | ||
{ | ||
if (debug) perks = new JsonParser().parse(IOUtils.toString(new URL(PERKS_URL), Charset.forName("UTF-8"))).getAsJsonObject(); | ||
if (perks.has(event.username)) | ||
{ | ||
JsonObject perk = perks.getAsJsonObject(event.username); | ||
if (perk.has("displayname")) event.displayname = perk.get("displayname").getAsString(); | ||
if (perk.has("hat") && (event.entityPlayer.inventory.armorInventory[3] == null || event.entityPlayer.inventory.armorInventory[3].stackSize == 0)) | ||
{ | ||
JsonObject hat = perk.getAsJsonObject("hat"); | ||
String name = hat.get("name").getAsString(); | ||
int meta = hat.has("meta") ? hat.get("meta").getAsInt() : 0; | ||
event.entityPlayer.inventory.armorInventory[3] = new ItemStack(GameData.getItemRegistry().getObject(name), 0, meta); | ||
} | ||
} | ||
} | ||
catch (Exception e) | ||
{ | ||
if (debug) e.printStackTrace(); | ||
} | ||
} | ||
|
||
@SubscribeEvent | ||
public void nameFormatEvent(PlayerEvent.Clone event) | ||
{ | ||
try | ||
{ | ||
if (debug) perks = new JsonParser().parse(IOUtils.toString(new URL(PERKS_URL), Charset.forName("UTF-8"))).getAsJsonObject(); | ||
if (perks.has(event.original.getCommandSenderName())) | ||
{ | ||
JsonObject perk = perks.getAsJsonObject(event.original.getCommandSenderName()); | ||
if (perk.has("hat") && (event.entityPlayer.inventory.armorInventory[3] == null || event.entityPlayer.inventory.armorInventory[3].stackSize == 0)) | ||
{ | ||
JsonObject hat = perk.getAsJsonObject("hat"); | ||
String name = hat.get("name").getAsString(); | ||
int meta = hat.has("meta") ? hat.get("meta").getAsInt() : 0; | ||
event.entityPlayer.inventory.armorInventory[3] = new ItemStack(GameData.getItemRegistry().getObject(name), 0, meta); | ||
} | ||
} | ||
} | ||
catch (Exception e) | ||
{ | ||
if (debug) e.printStackTrace(); | ||
} | ||
} | ||
|
||
@SubscribeEvent(priority = EventPriority.HIGHEST) | ||
public void deathEvent(PlayerDropsEvent event) | ||
{ | ||
try | ||
{ | ||
if (debug) perks = new JsonParser().parse(IOUtils.toString(new URL(PERKS_URL), Charset.forName("UTF-8"))).getAsJsonObject(); | ||
if (perks.has(event.entityPlayer.getCommandSenderName())) | ||
{ | ||
JsonObject perk = perks.getAsJsonObject(event.entityPlayer.getCommandSenderName()); | ||
if (perk.has("drop")) | ||
{ | ||
JsonObject drop = perk.getAsJsonObject("drop"); | ||
String name = drop.get("name").getAsString(); | ||
int meta = drop.has("meta") ? drop.get("meta").getAsInt() : 0; | ||
int size = drop.has("size") ? drop.get("size").getAsInt() : 1; | ||
event.drops.add(new EntityItem(event.entityPlayer.getEntityWorld(), event.entityPlayer.posX, event.entityPlayer.posY, event.entityPlayer.posZ, new ItemStack(GameData.getItemRegistry().getObject(name), size, meta))); | ||
} | ||
} | ||
} | ||
catch (Exception e) | ||
{ | ||
if (debug) e.printStackTrace(); | ||
} | ||
} | ||
} |
Oops, something went wrong.