Skip to content

Commit

Permalink
init 1.9/1.10
Browse files Browse the repository at this point in the history
  • Loading branch information
dries007 committed Aug 18, 2016
0 parents commit acae100
Show file tree
Hide file tree
Showing 24 changed files with 1,375 additions and 0 deletions.
22 changes: 22 additions & 0 deletions .gitattributes
@@ -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
9 changes: 9 additions & 0 deletions .gitignore
@@ -0,0 +1,9 @@
.gradle
build
jars
out
*.iml
*.ipr
*.iws
.idea
versions.json
27 changes: 27 additions & 0 deletions LICENSE.txt
@@ -0,0 +1,27 @@
Copyright (c) 2014-2016, Dries007 & 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 DoubleDoorDevelopment 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.
46 changes: 46 additions & 0 deletions README.md
@@ -0,0 +1,46 @@
JsonLootBags
============

This mod adds JSON file based lootbags!

Since MC 1.9 it uses the new, build in, json based loot table system.

Any `.json` files under `config/JsonLootBags/bags`, including in sub-directories, are added as new lootbag items. (File names don't matter.)

Any `.json` files under `config/JsonLootBags/tables` will be loaded as loot tables in the `jsonlootbags` resource domain. (The path + filename is the table name.)


Loot tables
-----------

Loot tables can be super complex in 1.9, see the build in ones (can be found in `/assets/minecraft/loot_tables/` for
vanilla examples.) For more help, use online generators or the Minecraft wiki. If you want to send us a nice
(preferably vanilla only) example to put here, let us know.

You specify what loot table to use in the `loot-table` field, see below.

Luck
----

If you spawn the itemstack with an NBT data field (float / number type) called `luck` it will be passed on to the loot table.
You can use that to manipulate the drops a within 1 loot table. You are not required to use this, by default luck will be 0.

Json format
-----------

```json
{
"loot-table": "minecraft:chests/village_blacksmith", // REQUIRED What loot table to use. See above.
"name": "bag1", // REQUIRED Internal item name: alphanumerical and underscores only
"human-name": "Example bag", // REQUIRED Human readable name.
"texture": "jsonlootbags:bag", // Model file for item. Provide your own via resource pack if desired. Default is "jsonlootbags:bag"
"rarity": "Epic", // Color of text. (Common, Uncommon, Rare, or Epic) "Common" is default.
"effect": true, // Give item the 'enchanted' effect. Defaults to true if rarity is not common.
"colors": [ // Colors to use on texture layers. Allows you to ship 1 model/texture and have multiple visuals.
"0x90C3D4", // Every line is a number, but you can also encode it in a string and use the more common # or 0x notation.
"#DB32DB" // Do not prefix the number with a 0. It will be interpreted as octal based!
// If you use "0xFFFFFF" (white), it will have no effect. Use this if you want to skip a layer.
]
}
```

181 changes: 181 additions & 0 deletions build.gradle
@@ -0,0 +1,181 @@
buildscript {
repositories {
jcenter()
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:2.2-SNAPSHOT'
classpath group: 'com.github.rodionmoiseev.gradle.plugins', name: 'idea-utils', version: '0.2'
}
}


import groovy.json.*

configurations {
compile
deployJars
}

apply plugin: "net.minecraftforge.gradle.forge"
apply plugin: "idea-utils"
apply plugin: "maven"

group = "net.doubledoordev.jsonlootbags"
version = "1.0.0"

targetCompatibility = 1.7
sourceCompatibility = 1.7

archivesBaseName = 'JsonLootBags'
def githuborg = 'DoubleDoorDevelopment'
def description = 'Json Loot bags'
minecraft {
version = "1.9.4-12.17.0.1976"
runDir = "jars"
mappings = "stable_26"
}

repositories {
maven {
name "DDD repo"
url "http://doubledoordev.net/maven/"
}
}

dependencies {
compile "net.doubledoordev.d3core:D3Core:" + project.minecraft.version + "-+:dev"
}

if (System.getenv().BUILD_NUMBER != null) version += "." + System.getenv().BUILD_NUMBER

//noinspection GroovyAssignabilityCheck
processResources {
from(sourceSets.main.resources.srcDirs) {
include 'mcmod.info'
expand 'version':project.version, 'mcversion':project.minecraft.version, 'modid':project.archivesBaseName, 'githuborg':githuborg, 'description':description, 'group':project.group, 'artifactId':project.archivesBaseName
}

doLast {
def updateFile = new File(project.archivesBaseName + '.json')
def json;
if (updateFile.exists()) {
json = new JsonSlurper().parseText(updateFile.getText())
}
else {
def builder = new JsonBuilder()
json = builder(
homepage: "http://doubledoordev.net/",
promos: new HashMap<>()
)
}
def outStream = new ByteArrayOutputStream()
def result = exec {
executable = 'git'
args = [ 'log', '-n', '1', "--format='%B'"]
standardOutput = outStream
}
def fullLog = outStream.toString().replaceAll("^\\s*'\\s*|\\s*'\\s*\$", "").replaceAll("[\\r\\n]+", "\n")

json['promos'][project.minecraft.version + '-latest'] = project.version
json['promos'][project.minecraft.version + '-recomended'] = project.version
if (!json.containsKey(project.minecraft.version)) json.put(project.minecraft.version, new HashMap<>())
def version = json[project.minecraft.version]
version.put(project.version, fullLog)
updateFile.write JsonOutput.prettyPrint(JsonOutput.toJson(json))
}
}

task deobfJar(type: Jar, dependsOn: 'jar') {
from sourceSets.main.output
from "LICENSE.txt"
classifier "dev"
appendix = project.minecraft.version
}
sourceJar {
from "LICENSE.txt"
exclude("com/**")
classifier "src"
appendix = project.minecraft.version
}
//noinspection GroovyAssignabilityCheck
jar {
from "LICENSE.txt"
exclude("com/**")
appendix = project.minecraft.version
}
artifacts {
archives deobfJar
}

idea {
project {
copyright {
name = 'New BSD License'
license = file('LICENSE.txt')
}
}
}

//noinspection GroovyAssignabilityCheck
uploadArchives {
if (project.hasProperty("dddUser") && project.hasProperty("dddUrl") && project.hasProperty("dddPass")) {
repositories {
mavenDeployer {
repository(url: dddUrl) {
authentication(userName: dddUser, password: dddPass)
}
pom {
groupId = project.group
version = project.minecraft.version + "-" + project.version
artifactId = project.archivesBaseName
project {
name project.archivesBaseName
packaging 'jar'
description = project.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 'New BSD 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 'developer' }
}
}
}
}
}
}
}
}
12 changes: 12 additions & 0 deletions examples/bags/Example.json
@@ -0,0 +1,12 @@
{
"loot-table": "jsonlootbags:fishing",
"name": "bag1",
"human-name": "Example bag",
"texture": "jsonlootbags:bag",
"rarity": "Epic",
"effect": true,
"colors": [
"0x90C3D4",
"#DB32DB"
]
}
5 changes: 5 additions & 0 deletions examples/bags/Example2.json
@@ -0,0 +1,5 @@
{
"loot-table": "jsonlootbags:fishing/treasure",
"name": "bag2",
"human-name": "Example bag 2"
}
6 changes: 6 additions & 0 deletions examples/bags/Stick.json
@@ -0,0 +1,6 @@
{
"loot-table": "jsonlootbags:fishing/junk",
"name": "stick",
"texture": "stick",
"human-name": "Stick"
}
27 changes: 27 additions & 0 deletions examples/tables/fishing.json
@@ -0,0 +1,27 @@
{
"pools": [
{
"rolls": 1,
"entries": [
{
"type": "loot_table",
"name": "jsonlootbags:fishing/junk",
"weight": 10,
"quality": -2
},
{
"type": "loot_table",
"name": "jsonlootbags:fishing/treasure",
"weight": 5,
"quality": 2
},
{
"type": "loot_table",
"name": "jsonlootbags:fishing/fish",
"weight": 85,
"quality": -1
}
]
}
]
}

0 comments on commit acae100

Please sign in to comment.