Skip to content

Commit

Permalink
Update to 1.7.10
Browse files Browse the repository at this point in the history
Gradleize the project. Changes to CompressedStreamTools.
  • Loading branch information
AnodeCathode committed Aug 8, 2014
1 parent 5e831da commit 3a7c828
Show file tree
Hide file tree
Showing 10 changed files with 108 additions and 4 deletions.
6 changes: 6 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -34,3 +34,9 @@ Icon
# Files that might appear on external disk
.Spotlight-V100
.Trashes
/build
/bin
.gradle
.project
.settings
.classpath
Expand Down
74 changes: 74 additions & 0 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
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'
}
}

apply plugin: 'forge'

ext.configFile = file "build.properties"

configFile.withReader {
def prop = new Properties()
prop.load(it)
project.ext.config = new ConfigSlurper().parse prop
}

version = config.mod_version
group = config.mod_id
archivesBaseName = "ForgeNBTEdit"

minecraft {
version = config.minecraft_version + "-" + config.forge_version
assetDir = "eclipse/assets"
}

processResources
{
from(sourceSets.main.resources.srcDirs) {
include '**/*.info'
include '**/*.properties'

expand ([
'mod_version': version,
'mc_version': project.config.minecraft_version,
'mod_id': project.config.mod_id
])
}

from(sourceSets.main.resources.srcDirs) {
exclude '**/*.info'
exclude '**/*.properties'
}
}


jar {
appendix = 'universal'
}

task sourceJar(type: Jar) {
from sourceSets.main.allSource
appendix = 'src'
}

task deobfJar(type: Jar) {
from sourceSets.main.output
appendix = 'deobf'
}

artifacts {
archives sourceJar
archives deobfJar
}
4 changes: 4 additions & 0 deletions build.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
minecraft_version=1.7.10
forge_version=10.13.0.1180
mod_version=1.0.0.test
mod_id=forgenbtedit
2 changes: 1 addition & 1 deletion src/main/java/com/mcf/davidee/nbtedit/NBTEdit.java
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
*
* TODO: Beg for the old clientSideRequired and serverSideRequired flags. Accepting all remote versions is stupid.
*/
@Mod(modid="NBTEdit", name = "In-game NBTEdit", version = "1.7.2.2", acceptableRemoteVersions="*")
@Mod(modid="NBTEdit", name = "In-game NBTEdit", version = "1.7.10", acceptableRemoteVersions="*")
public class NBTEdit {

private static final String SEP = System.getProperty("line.separator");
Expand Down
4 changes: 3 additions & 1 deletion src/main/java/com/mcf/davidee/nbtedit/NBTHelper.java
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
package com.mcf.davidee.nbtedit;

import java.io.DataInput;
import java.io.DataInputStream;
import java.io.InputStream;
import java.io.DataOutput;
import java.io.IOException;
import java.util.List;
Expand All @@ -14,7 +16,7 @@

public class NBTHelper {

public static NBTTagCompound nbtRead(DataInput in) throws IOException {
public static NBTTagCompound nbtRead(DataInputStream in) throws IOException {
return CompressedStreamTools.read(in);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
import io.netty.buffer.ByteBufOutputStream;
import io.netty.channel.ChannelHandlerContext;

import java.io.DataInputStream;
import java.io.IOException;
import java.util.logging.Level;

Expand Down Expand Up @@ -44,8 +45,9 @@ public void encodeInto(ChannelHandlerContext ctx, ByteBuf buffer) throws IOExcep
@Override
public void decodeInto(ChannelHandlerContext ctx, ByteBuf buffer) throws IOException {
ByteBufInputStream bis = new ByteBufInputStream(buffer);
DataInputStream nbt = new DataInputStream(bis);
entityID = bis.readInt();
tag = NBTHelper.nbtRead(bis);
tag = NBTHelper.nbtRead(nbt);
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
import io.netty.buffer.ByteBufOutputStream;
import io.netty.channel.ChannelHandlerContext;

import java.io.DataInputStream;
import java.io.IOException;
import java.util.logging.Level;

Expand Down Expand Up @@ -45,10 +46,11 @@ public void encodeInto(ChannelHandlerContext ctx, ByteBuf buffer) throws IOExcep
@Override
public void decodeInto(ChannelHandlerContext ctx, ByteBuf buffer) throws IOException {
ByteBufInputStream bis = new ByteBufInputStream(buffer);
DataInputStream nbt = new DataInputStream(bis);
x = bis.readInt();
y = bis.readInt();
z = bis.readInt();
tag = NBTHelper.nbtRead(bis);
tag = NBTHelper.nbtRead(nbt);
}

@Override
Expand Down
14 changes: 14 additions & 0 deletions src/main/resources/mcmod.info
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
[{
"modid": "${mod_id}",
"name": "ForgeNBTEdit",
"version": "${mod_version}",
"mcversion": "${mc_version}",

"credits": "",
"authorList": [ "DavidG" ],
"description": "Ingame NBT Editing",
"logoFile": "",

"parent": "",
"screenshots": [ ]
}]

0 comments on commit 3a7c828

Please sign in to comment.