Skip to content

Commit

Permalink
Updated for 1.5.2
Browse files Browse the repository at this point in the history
  • Loading branch information
Joe12o committed Jun 30, 2013
1 parent 083453b commit 8f1ce38
Show file tree
Hide file tree
Showing 8 changed files with 35 additions and 58 deletions.
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,6 @@
/*.bat
/forge
/bin
/download
/download
/.project
/.classpath
2 changes: 1 addition & 1 deletion alicefixes/src/com/skcraft/alicefixes/AliceFixes.java
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
import cpw.mods.fml.common.Mod.PreInit;
import cpw.mods.fml.common.event.FMLPreInitializationEvent;

@Mod(modid = "aliceFixes", version = "0.1.0")
//@Mod(modid = "aliceFixes", version = "0.1.0")
public class AliceFixes {

@PreInit
Expand Down
49 changes: 18 additions & 31 deletions alicefixes/src/com/skcraft/alicefixes/AliceTransformer.java
Original file line number Diff line number Diff line change
@@ -1,48 +1,35 @@
package com.skcraft.alicefixes;

import java.util.ArrayList;
import java.util.List;
import java.util.logging.Level;

import cpw.mods.fml.common.FMLLog;
import cpw.mods.fml.relauncher.IClassTransformer;

public class AliceTransformer implements IClassTransformer {

private final List<IClassTransformer> transformers;

public AliceTransformer() {
String[] names = LoadingPlugin.getTransformers();
transformers = new ArrayList(names.length);
for(String transformer : names) {
try {
transformers.add((IClassTransformer)Class.forName(transformer).newInstance());
}
catch(Throwable t) {
t.printStackTrace();
}
}
}


private final IClassTransformer[] transformers = {
new TransformMiningLaser()};
//new TransformBlockBreaker()
//new TransformIC2Explosions(),
//new TransformTCExcWand(),
//new TransformTCEquWand(),
//new TransformTCFrostWand(),
//new TransformTCAxe(),
//new TransformTCShovel()};

@Override
public byte[] transform(String name, byte[] bytes) {
public byte[] transform(String name, String transformedName, byte[] bytes) {

if(bytes == null) {
return bytes;
}

for(IClassTransformer transformer : transformers) {
try {
bytes = transformer.transform(name, bytes);
if(bytes == null)
FMLLog.log(Level.SEVERE, "Transformer " + transformer + " has corrupted class " + name);
}
catch(Throwable t) {
t.printStackTrace();
}
bytes = transformer.transform(name, transformedName, bytes);
if(bytes == null)
FMLLog.log(Level.SEVERE, "Transformer " + transformer + " has corrupted class " + name);
}

return bytes;
}

}
12 changes: 0 additions & 12 deletions alicefixes/src/com/skcraft/alicefixes/LoadingPlugin.java
Original file line number Diff line number Diff line change
Expand Up @@ -30,16 +30,4 @@ public String getSetupClass() {

@Override
public void injectData(Map<String, Object> data) {}

public static String[] getTransformers() {
return new String[] { "com.skcraft.alicefixes.TransformMiningLaser",
"com.skcraft.alicefixes.TransformBlockBreaker"
/*"com.skcraft.alicefixes.TransformIC2Explosions",
"com.skcraft.alicefixes.TransformTCExcWand",
"com.skcraft.alicefixes.TransformTCEquWand",
"com.skcraft.alicefixes.TransformTCFrostWand",
"com.skcraft.alicefixes.TransformTCAxe",
"com.skcraft.alicefixes.TransformTCShovel"*/};
}

}
6 changes: 3 additions & 3 deletions alicefixes/src/com/skcraft/alicefixes/ObfNames.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@

public class ObfNames {

public static final String ENTITY_LIVING = "md";
public static final String ENTITY = "lq";
public static final String TILE_ENTITY = "any";
public static final String ENTITY_LIVING = "ng";
public static final String ENTITY = "mp";
public static final String TILE_ENTITY = "aqp";

}
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,11 @@
import cpw.mods.fml.common.FMLLog;
import cpw.mods.fml.relauncher.IClassTransformer;

// THIS MAY NOT WORK WHEN THE NEW RP COMES OUT (if it ever does...)
public class TransformBlockBreaker implements IClassTransformer {

@Override
public byte[] transform(String name, byte[] bytes) {
public byte[] transform(String name, String transformedName, byte[] bytes) {
if(name.equals("com.eloraam.redpower.machine.TileBreaker")) {
return handleBreakerTransform(bytes);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,13 +34,13 @@ public class TransformMiningLaser implements IClassTransformer{
private final String MINE_METHOD_NAME = "canMine";

@Override
public byte[] transform(String name, byte[] bytes) {
public byte[] transform(String name, String transformedName, byte[] bytes) {
if(name.equals(LASER_CLASS_NAME)) {
return handleLaserTransform(bytes);
}
return bytes;
}

private byte[] handleLaserTransform(byte[] bytes) {

ClassNode classNode = new ClassNode();
Expand Down
13 changes: 6 additions & 7 deletions build.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@
<property name="classes.dir" value="${build.dir}/classes"/>
<property name="reobf.dir" value="${mcp.dir}/reobf"/>
<property name="download.dir" value="download"/>
<property name="af.version" value="0.1.0"/>
<property name="forge.version" value="6.6.2.534"/>
<property name="mc.version" value="1.4.7"/>
<property name="af.version" value="1.0.0"/>
<property name="forge.version" value="7.8.1.737"/>
<property name="mc.version" value="1.5.2"/>
<property name="forge.name" value="minecraftforge-src-${mc.version}-${forge.version}.zip"/>
<property name="mcpc.name" value="mcpc-api-${mc.version}.jar"/>

Expand All @@ -33,7 +33,7 @@
<target name="fetch-dependencies" if="missing-dependencies">
<mkdir dir="${download.dir}"/>
<get src="http://files.minecraftforge.net/${forge.name}" dest="${download.dir}"/>
<get src="https://dl.dropboxusercontent.com/u/59005117/${mcpc.name}" dest="${download.dir}"/>
<get src="http://ci.md-5.net/job/MCPC-API/32/za.co.mcportcentral$mcpc-api/artifact/za.co.mcportcentral/mcpc-api/1.5.2-R1.1-20130625.013809-4/mcpc-api-1.5.2-R1.1-20130625.013809-4.jar" dest="${download.dir}/${mcpc.name}"/>
</target>

<!-- Setup Forge/MCP -->
Expand Down Expand Up @@ -68,10 +68,10 @@

<!-- Reobfuscate -->
<exec dir="${mcp.dir}" executable="cmd" osfamily="windows">
<arg line="/c reobfuscate.bat"/>
<arg line="/c reobfuscate_srg.bat"/>
</exec>
<exec dir="${mcp.dir}" executable="sh" osfamily="unix">
<arg value="reobfuscate.sh"/>
<arg value="reobfuscate_srg.sh"/>
</exec>

<!-- Copy classes -->
Expand All @@ -86,7 +86,6 @@
<target name="package" depends="compile">
<jar destfile="${build.dir}/AliceFixes-${af.version}.jar" basedir="${classes.dir}">
<manifest>
<attribute name="Built-by" value="${user.name}"/>
<attribute name="FMLCorePlugin" value="com.skcraft.alicefixes.LoadingPlugin"/>
</manifest>
</jar>
Expand Down

0 comments on commit 8f1ce38

Please sign in to comment.