I must be really stupid because I cant even get my textures to copy over onto the blank texture templates. When I use copy and paste they just show up as invisible textures on top of the pink background, not as the solid texture like it should be...
i don't really know what new 1.2.3 possibilities you are referring to.
My guess is the 4096 IDs, which a lot of people still don't know hasn't been fully implemented.
To add some use to this post, ZoRk: Forge is recommended if you want to add your own textures for your block (a nice feature) and use configuration files (a requirement of any mod that wants to play nicely with others).
Rollback Post to RevisionRollBack
Currently working on random projects. Have any coding problems? Feel free to PM!
yes as crueltyinc said, the block ids haven't been implemented yet. my guess is that that will come out at the same time as the official api
and to add to his other comment forge is also recommended if you're making new dimensions, adding arrows, adding redstone type things, adding ladders, adding liquids, and especially adding new tools and armor
yes as crueltyinc said, the block ids haven't been implemented yet. my guess is that that will come out at the same time as the official api
and to add to his other comment forge is also recommended if you're making new dimensions, adding arrows, adding redstone type things, adding ladders, adding liquids, and especially adding new tools and armor
Translation:
"Forge is recommended if you plan on doing anything at all interesting, want between zero and extremely few base-class edits, and virtually guaranteed compatibility with some of the largest, most popular, and most well-developed mods out there."
"Forge is recommended if you plan on doing anything at all interesting, want between zero and extremely few base-class edits, and virtually guaranteed compatibility with some of the largest, most popular, and most well-developed mods out there."
So much for subtlety...
Rollback Post to RevisionRollBack
Currently working on random projects. Have any coding problems? Feel free to PM!
warning: [options] bootstrap class path not set in conjunction with -source 1.6
src\minecraft\forge\EnumHelper.java:7: error: duplicate class: net.minecraft.src
.forge.EnumHelper
public class EnumHelper {
^
bad source file: src\minecraft\forge\EnumHelper.java
file does not contain class forge.EnumHelper
Please remove or make sure it appears in the correct subdirectory of the sou
rcepath.
2 errors
1 warning
==================
FATAL ERROR
Traceback (most recent call last):
File "runtime\recompile.py", line 31, in recompile
commands.recompile(CLIENT)
File "E:\mcp56\runtime\commands.py", line 736, in recompile
self.runcmd(forkcmd)
File "E:\mcp56\runtime\commands.py", line 779, in runcmd
raise CalledProcessError(returncode, forkcmd, output)
CalledProcessError: Command 'javac.exe -g -source 1.6 -target 1.6 -classpath "li
b;lib\*;jars\bin\minecraft.jar;jars\bin\jinput.jar;jars\bin\lwjgl.jar;jars\bin\l
wjgl_util.jar" -sourcepath src\minecraft -d bin\minecraft src\minecraft\net\mine
craft\src\*.java src\minecraft\net\minecraft\client\*.java src\minecraft\net\min
ecraft\isom\*.java src\minecraft\forge\*.java conf\patches\ga.java conf\patches\
Start.java' returned non-zero exit status 1
Press any key to continue . . .
This is my EnumHelper code:
package net.minecraft.src.forge;
import net.minecraft.src.*;
import java.lang.reflect.*;
import java.util.*;
public class EnumHelper {
private static Object reflectionFactory = null;
private static Method newConstructorAccessor = null;
private static Method newInstance = null;
private static Method newFieldAccessor = null;
private static Method fieldAccessorSet = null;
private static boolean isSetup = false;
//Some enums are decompiled with extra arguments, so lets check for that
private static Class[][] ctrs = {
{EnumAction.class},
{EnumArmorMaterial.class, int.class, int[].class, int.class},
{EnumArt.class, String.class, int.class, int.class, int.class, int.class},
{EnumCreatureAttribute.class},
{EnumCreatureType.class, Class.class, int.class, Material.class, boolean.class},
{EnumDoor.class},
{EnumEnchantmentType.class},
{EnumMobType.class},
{EnumMovingObjectType.class},
{EnumSkyBlock.class, int.class},
{EnumStatus.class},
{EnumToolMaterial.class, int.class, int.class, float.class, int.class, int.class}
};
private static boolean[] decompiled = new boolean[ctrs.length];
public static EnumAction addAction(String name)
{
if (!isSetup)
{
setup();
}
return addEnum(decompiled[0], EnumAction.class, name,
new Class[] {},
new Object[]{});
}
public static EnumArmorMaterial addArmorMaterial(String name, int durability, int[] reductionAmounts, int enchantability)
{
if (!isSetup)
{
setup();
}
return addEnum(decompiled[1], EnumArmorMaterial.class, name,
new Class[] { int.class, int[].class, int.class },
new Object[]{ durability, reductionAmounts, enchantability });
}
public static EnumArt addArt(String name, String tile, int sizeX, int sizeY, int offsetX, int offsetY)
{
if (!isSetup)
{
setup();
}
return addEnum(decompiled[2], EnumArt.class, name,
new Class[] {String.class, int.class, int.class, int.class, int.class},
new Object[]{tile, sizeX, sizeY, offsetX, offsetY});
}
public static EnumCreatureAttribute addCreatureAttribute(String name)
{
if (!isSetup)
{
setup();
}
return addEnum(decompiled[3], EnumCreatureAttribute.class, name,
new Class[] {},
new Object[]{});
}
public static EnumCreatureType addCreatureType(String name, Class typeClass, int maxNumber, Material material, boolean peaceful)
{
if (!isSetup)
{
setup();
}
return addEnum(decompiled[4], EnumCreatureType.class, name,
new Class[] {Class.class, int.class, Material.class, boolean.class},
new Object[]{typeClass, maxNumber, material, peaceful});
}
public static EnumDoor addDoor(String name)
{
if (!isSetup)
{
setup();
}
return addEnum(decompiled[5], EnumDoor.class, name,
new Class[] {},
new Object[]{});
}
public static EnumEnchantmentType addEnchantmentType(String name)
{
if (!isSetup)
{
setup();
}
return addEnum(decompiled[6], EnumEnchantmentType.class, name,
new Class[] {},
new Object[]{});
}
public static EnumMobType addMobType(String name)
{
if (!isSetup)
{
setup();
}
return addEnum(decompiled[7], EnumMobType.class, name,
new Class[] {},
new Object[]{});
}
public static EnumMovingObjectType addMovingObjectType(String name)
{
if (!isSetup)
{
setup();
}
return addEnum(decompiled[8], EnumMovingObjectType.class, name,
new Class[] {},
new Object[]{});
}
public static EnumSkyBlock addSkyBlock(String name, int lightValue)
{
if (!isSetup)
{
setup();
}
return addEnum(decompiled[9], EnumSkyBlock.class, name,
new Class[] {int.class },
new Object[]{lightValue});
}
public static EnumStatus addStatus(String name)
{
if (!isSetup)
{
setup();
}
return addEnum(decompiled[10], EnumStatus.class, name,
new Class[] {},
new Object[]{});
}
public static EnumToolMaterial addToolMaterial(String name, int harvestLevel, int maxUses, float efficiency, int damage, int enchantability)
{
if (!isSetup)
{
setup();
}
return addEnum(decompiled[11], EnumToolMaterial.class, name,
new Class[] { int.class, int.class, float.class, int.class, int.class },
new Object[]{ harvestLevel, maxUses, efficiency, damage, enchantability });
}
private static void setup()
{
if (isSetup)
{
return;
}
//System.out.println("Enum Helper Initalizing: ");
for(int x = 0; x < ctrs.length; x++)
{
try {
Class<?>[] enumHeaders = new Class[ctrs[x].length + 3];
enumHeaders[0] = String.class;
enumHeaders[1] = int.class;
enumHeaders[2] = String.class;
enumHeaders[3] = int.class;
for (int y = 1; y < ctrs[x].length; y++)
enumHeaders[3 + y] = ctrs[x][y];
ctrs[x][0].getDeclaredConstructor(enumHeaders);
decompiled[x] = true;
} catch(Exception e) {
//Nom Nom Nom
}
//System.out.format("\t%-25s %s\r\n", ctrs[x][0].getName().replace("net.minecraft.src.", ""), decompiled[x]);
}
try {
Method getReflectionFactory = Class.forName("sun.reflect.ReflectionFactory").getDeclaredMethod("getReflectionFactory");
reflectionFactory = getReflectionFactory.invoke(null);
newConstructorAccessor = Class.forName("sun.reflect.ReflectionFactory").getDeclaredMethod("newConstructorAccessor", Constructor.class);
newInstance = Class.forName("sun.reflect.ConstructorAccessor").getDeclaredMethod("newInstance", Object[].class);
newFieldAccessor = Class.forName("sun.reflect.ReflectionFactory").getDeclaredMethod("newFieldAccessor", Field.class, boolean.class);
fieldAccessorSet = Class.forName("sun.reflect.FieldAccessor").getDeclaredMethod("set", Object.class, Object.class);
} catch (Exception e) {
e.printStackTrace();
}
isSetup = true;
}
/*
* Everything below this is found at the site below, and updated to be able to compile in Eclipse/Java 1.6+
* Also modified for use in decompiled code.
* Found at: http://niceideas.ch/roller2/badtrash/entry/java_create_enum_instances_dynamically
*/
private static Object getConstructorAccessor(boolean decompiled, Class<?> enumClass, Class<?>[] additionalParameterTypes) throws Exception {
Class<?>[] parameterTypes = null;
if (decompiled)
{
parameterTypes = new Class[additionalParameterTypes.length + 4];
parameterTypes[0] = String.class;
parameterTypes[1] = int.class;
parameterTypes[2] = String.class;
parameterTypes[3] = int.class;
System.arraycopy(additionalParameterTypes, 0, parameterTypes, 4, additionalParameterTypes.length);
}
else
{
parameterTypes = new Class[additionalParameterTypes.length + 2];
parameterTypes[0] = String.class;
parameterTypes[1] = int.class;
System.arraycopy(additionalParameterTypes, 0, parameterTypes, 2, additionalParameterTypes.length);
}
return newConstructorAccessor.invoke(reflectionFactory, enumClass.getDeclaredConstructor(parameterTypes));
}
private static <T extends Enum<?>> T makeEnum(boolean decompiled, Class<T> enumClass, String value, int ordinal, Class<?>[] additionalTypes, Object[] additionalValues) throws Exception {
Object[] parms = null;
if (decompiled)
{
parms = new Object[additionalValues.length + 4];
parms[0] = value;
parms[1] = Integer.valueOf(ordinal);
parms[2] = value;
parms[3] = Integer.valueOf(ordinal);
System.arraycopy(additionalValues, 0, parms, 4, additionalValues.length);
}
else
{
parms = new Object[additionalValues.length + 2];
parms[0] = value;
parms[1] = Integer.valueOf(ordinal);
System.arraycopy(additionalValues, 0, parms, 2, additionalValues.length);
}
return enumClass.cast(newInstance.invoke(getConstructorAccessor(decompiled, enumClass, additionalTypes), new Object[]{parms}));
}
private static void setFailsafeFieldValue(Field field, Object target, Object value) throws Exception {
field.setAccessible(true);
Field modifiersField = Field.class.getDeclaredField("modifiers");
modifiersField.setAccessible(true);
modifiersField.setInt(field, field.getModifiers() & ~Modifier.FINAL);
Object fieldAccessor = newFieldAccessor.invoke(reflectionFactory, field, false);
fieldAccessorSet.invoke(fieldAccessor, target, value);
}
private static void blankField(Class<?> enumClass, String fieldName) throws Exception {
for (Field field : Class.class.getDeclaredFields()) {
if (field.getName().contains(fieldName)) {
field.setAccessible(true);
setFailsafeFieldValue(field, enumClass, null);
break;
}
}
}
private static void cleanEnumCache(Class<?> enumClass) throws Exception {
blankField(enumClass, "enumConstantDirectory");
blankField(enumClass, "enumConstants");
}
public static <T extends Enum<?>> T addEnum(Class<T> enumType, String enumName, boolean decompiled) {
return addEnum(decompiled, enumType, enumName, new Class<?>[]{}, new Object[]{});
}
@SuppressWarnings("unchecked")
public static <T extends Enum<?>> T addEnum(boolean decompiled, Class<T> enumType, String enumName, Class<?>[] paramTypes, Object[] paramValues) {
if (!isSetup)
{
setup();
}
Field valuesField = null;
Field[] fields = enumType.getDeclaredFields();
int flags = Modifier.PRIVATE | Modifier.STATIC | Modifier.FINAL | 0x1000 /*SYNTHETIC*/;
String valueType = String.format("[L%s;", enumType.getName().replace('.', '/'));
for (Field field : fields) {
if (decompiled)
{
if (field.getName().contains("$VALUES"))
{
valuesField = field;
break;
}
}
else
{
if ((field.getModifiers() & flags) == flags &&
field.getType().getName().replace('.', '/').equals(valueType)) //Apparently some JVMs return .'s and some don't..
{
valuesField = field;
break;
}
}
}
valuesField.setAccessible(true);
try {
T[] previousValues = (T[])valuesField.get(enumType);
List<T> values = new ArrayList<T>(Arrays.asList(previousValues));
T newValue = (T)makeEnum(decompiled, enumType, enumName, values.size(), paramTypes, paramValues);
values.add(newValue);
setFailsafeFieldValue(valuesField, null, values.toArray((T[]) Array.newInstance(enumType, 0)));
cleanEnumCache(enumType);
return newValue;
} catch (Exception e) {
e.printStackTrace();
throw new RuntimeException(e.getMessage(), e);
}
}
static {
if (!isSetup)
{
setup();
}
}
}
These tutorials are amazing, but I would LOVE it if you posted a tutorial on making blocks with damage values (I've seen you plan to, but that was a while ago). Thank you!
Looking through your item-based tutorials, all I'm seeing is new versions of old items. How about a tutorial on making new items altogether with new uses and effects (like the Skyrim mod's shouts, or stuff for a mod that i'd like to make that includes instant building blueprints (click with the blueprint item, and it insta-builds facing you from that point) and magic tomes that act like tools, but are a new tool type (clicking to place casts the spell of the tome, like a teleport and explosion).
The blueprints themselves i know how i'd make, regarding recipes and such, but then the blueprint or the tome as an item, having it's own special usage that the game doesn't already use... How would you go about something like that? Could you make a tut on brand new item types and how to give them their own effect on use?
edit:
actually, now that i found how to dig through the existing files, i found in the village structures:
but what are each of those, and how could I turn that into a self-building blueprint structure?
And actually, I seem to be having more trouble now with code to determine where you're looking at... Anybody know that? I bet that's actually simpler than i'm trying to make it be...
never mind, I fixed my own problem
www.youtube.com/user/thunderz8olt
My guess is the 4096 IDs, which a lot of people still don't know hasn't been fully implemented.
To add some use to this post, ZoRk: Forge is recommended if you want to add your own textures for your block (a nice feature) and use configuration files (a requirement of any mod that wants to play nicely with others).
Currently working on random projects. Have any coding problems? Feel free to PM!
and to add to his other comment forge is also recommended if you're making new dimensions, adding arrows, adding redstone type things, adding ladders, adding liquids, and especially adding new tools and armor
Translation:
"Forge is recommended if you plan on doing anything at all interesting, want between zero and extremely few base-class edits, and virtually guaranteed compatibility with some of the largest, most popular, and most well-developed mods out there."
So much for subtlety...
Currently working on random projects. Have any coding problems? Feel free to PM!
== MCP 5.6 (data: 5.6, client: 1.1, server: 1.1) ==
> Recompiling client...
'javac.exe -g -source 1.6 -target 1.6 -classpath "lib;lib\*;jars\bin\minecraft.j
ar;jars\bin\jinput.jar;jars\bin\lwjgl.jar;jars\bin\lwjgl_util.jar" -sourcepath s
rc\minecraft -d bin\minecraft src\minecraft\net\minecraft\src\*.java src\minecra
ft\net\minecraft\client\*.java src\minecraft\net\minecraft\isom\*.java src\minec
raft\forge\*.java conf\patches\ga.java conf\patches\Start.java' failed : 1
== ERRORS FOUND ==
warning: [options] bootstrap class path not set in conjunction with -source 1.6
src\minecraft\forge\EnumHelper.java:7: error: duplicate class: net.minecraft.src
.forge.EnumHelper
public class EnumHelper {
^
src\minecraft\net\minecraft\src\mod_Slugs.java:23: error: cannot access EnumHelp
er
static EnumArmorMaterial armorPOSEIDEN = EnumHelper.addArmorMaterial("PO
SEIDEN", 33, new int[] {4, 9, 7, 4}, 25);
^
bad source file: src\minecraft\forge\EnumHelper.java
file does not contain class forge.EnumHelper
Please remove or make sure it appears in the correct subdirectory of the sou
rcepath.
2 errors
1 warning
==================
FATAL ERROR
Traceback (most recent call last):
File "runtime\recompile.py", line 31, in recompile
commands.recompile(CLIENT)
File "E:\mcp56\runtime\commands.py", line 736, in recompile
self.runcmd(forkcmd)
File "E:\mcp56\runtime\commands.py", line 779, in runcmd
raise CalledProcessError(returncode, forkcmd, output)
CalledProcessError: Command 'javac.exe -g -source 1.6 -target 1.6 -classpath "li
b;lib\*;jars\bin\minecraft.jar;jars\bin\jinput.jar;jars\bin\lwjgl.jar;jars\bin\l
wjgl_util.jar" -sourcepath src\minecraft -d bin\minecraft src\minecraft\net\mine
craft\src\*.java src\minecraft\net\minecraft\client\*.java src\minecraft\net\min
ecraft\isom\*.java src\minecraft\forge\*.java conf\patches\ga.java conf\patches\
Start.java' returned non-zero exit status 1
Press any key to continue . . .
This is my EnumHelper code:
The blueprints themselves i know how i'd make, regarding recipes and such, but then the blueprint or the tome as an item, having it's own special usage that the game doesn't already use... How would you go about something like that? Could you make a tut on brand new item types and how to give them their own effect on use?
edit:
actually, now that i found how to dig through the existing files, i found in the village structures:
but what are each of those, and how could I turn that into a self-building blueprint structure?
And actually, I seem to be having more trouble now with code to determine where you're looking at... Anybody know that? I bet that's actually simpler than i'm trying to make it be...
How?