Everything posted by Ironfists
-
[1.9]Reflection problems
Is there anywhere I can find a tutorial on it for the latest version?
-
[1.9]Reflection problems
So my mod works fine on eclipse but when I export it and play on the real client some of the features doesn't work. So I checked the fml-client-latest.log to see what's wrong and it's actually some "java.lang.NoSuchMethodException" and "java.lang.NoSuchFieldException" that comes from my reflections so what can I do?
-
[1.9] Can we export java 8?
I deleted my lambdas expressions and srcCompat = JavaVersion.VERSION_1_8 targetCompat = JavaVersion.VERSION_1_8 and yes I use gradlew build. I now have an error when I build, the error in the code is if (amount > 0.0F && (boolean)method.invoke(attackedEntity, source)) which says "incompatible types: Object cannot be converted to boolean I didn't have the problem in eclipse, but I fixed it by putting srcCompat = JavaVersion.VERSION_1_7 targetCompat = JavaVersion.VERSION_1_7 in the build.gradle, it now generate the jar but the mod still act different than the eclipse one. Also I don't know where the FML log are
-
[1.9] Can we export java 8?
So I exported my mod and and I don't understand why it does not work the same between the eclipse version and the real version of minecraft? I mean some things works but for example in my eclipse version I can hurt entities by doing a right click, but it does no damage when running on the real version. I think that has something to do wih server stuff. Do we have to "install server" with the forge installer?
-
[1.9] Can we export java 8?
I have some lambas expression in my code and some try multi-catch statements and when I do gradlew build to export my mode it fails because some of the stuff I did is not supported in source 1.6. How can I use a latter version of java?
-
[1.9]Swing left arm
Because it contains the code that render the first-person right and left arm with along with their animation logic
-
[1.9]Swing left arm
It doesn't seem to have a grasp on ItemRenderer
-
[1.9]Swing left arm
Hi, I've got a pretty complex problem(I guess). I need that the player swing his left arm when right clicking, well that's easy by using the "swingHand(EnumHand)" But, the more problematic thing is that I want to be able to swing both arms at the same time, and it is no possible with the vanilla code because there is only 1 variable for the swing animation so only the last hand will have the animation. My guess is that I have to make a separate variable for the left hand animation and modify the "renderItemInFirstPerson" method in the ItemRenderer.class. So how could I do so that the game use my own "renderItemInFirstPerson" method instead of the vanilla one? edit: I don't care about the swing animation in 3rd person, I just want the 1st person player to see the animation
-
[1.9]Add a variable to a player
Ok, I found that pretty strange that setting the value will also change the server side value without using packets. Also, how would you explain how this method works? @Override public <T> T getCapability(Capability<T> capability, EnumFacing facing) { return capability == OFFHAND_CAP ? OFFHAND_CAP.<T>cast(inst) : null; } I know the 1 line "if-else" thing but I don't understand the whole idea of this method
-
[1.9]Add a variable to a player
So I came up with this code, it seems to work but I'd like to ask you if everything is correct. IOffHandAttack.class public interface IOffHandAttack { public int getTicksSinceLastSwing2(); public void setTicksSinceLastSwing2(int amount); public void tick(); } EventHandler.class public class EventHandler { @CapabilityInject(IOffHandAttack.class) private static final Capability<IOffHandAttack> OFFHAND_CAP = null; @SubscribeEvent public void onAttack(AttackEntityEvent event) { final IOffHandAttack atk = event.getEntityPlayer().getCapability(OFFHAND_CAP, null); atk.setTicksSinceLastSwing2(0); } @SubscribeEvent public void onLivingUpdate(LivingUpdateEvent event) { if(event.getEntityLiving() instanceof EntityPlayer) { final IOffHandAttack atk = event.getEntityLiving().getCapability(OFFHAND_CAP, null); atk.tick(); } } @SubscribeEvent public void onEntityConstruct(AttachCapabilitiesEvent.Entity evt) { evt.addCapability(new ResourceLocation(Reference.MOD_ID, "IOffHandAttack"), new ICapabilitySerializable<NBTPrimitive>() { IOffHandAttack inst = OFFHAND_CAP.getDefaultInstance(); @Override public boolean hasCapability(Capability<?> capability, EnumFacing facing) { return capability == OFFHAND_CAP; } @Override public <T> T getCapability(Capability<T> capability, EnumFacing facing) { return capability == OFFHAND_CAP ? OFFHAND_CAP.<T>cast(inst) : null; } @Override public NBTPrimitive serializeNBT() { return (NBTPrimitive)OFFHAND_CAP.getStorage().writeNBT(OFFHAND_CAP, inst, null); } @Override public void deserializeNBT(NBTPrimitive nbt) { OFFHAND_CAP.getStorage().readNBT(OFFHAND_CAP, inst, null, nbt); } }); } } Storage.class public class Storage implements IStorage<IOffHandAttack> { @Override public NBTBase writeNBT(Capability<IOffHandAttack> capability, IOffHandAttack instance, EnumFacing side) { return new NBTTagInt(instance.getTicksSinceLastSwing2()); } @Override public void readNBT(Capability<IOffHandAttack> capability, IOffHandAttack instance, EnumFacing side, NBTBase nbt) { instance.setTicksSinceLastSwing2(((NBTPrimitive)nbt).getInt()); } } DefaultImpl.class public class DefaultImpl implements IOffHandAttack { private int ticksSinceLastSwing2; @Override public int getTicksSinceLastSwing2() { return ticksSinceLastSwing2; } @Override public void setTicksSinceLastSwing2(int amount) { this.ticksSinceLastSwing2 = amount; } @Override public void tick() { this.ticksSinceLastSwing2++; } } CommonProxy.class public class CommonProxy { public void preInit(FMLPreInitializationEvent e) { CapabilityManager.INSTANCE.register(IOffHandAttack.class, new Storage(), DefaultImpl.class); } }
-
[1.9]Add a variable to a player
I have to create a new variable for the player class. It's an integer that goes up by one every tick and goes back to 0 when we right click. In forge 1.8 I guess I would use IExtendedProperties but it's not there anymore and it's replaced by capabilities. Can someone tell me how can I do it, and if I have to use capabilities, make an example of how to do it because I saw some examples of this new thing but they were too complicated
IPS spam blocked by CleanTalk.