• Recently Browsing

    No registered users viewing this page.

  • Posts

    • I want to change player's eyeheight. I think it's impossible without replacing a vanilla method. So I used coremod, but my cord caused error. I think this cause is that 0.5 is double, but I don't know to define float value on JavaScript. How do I solve this?   I have bad English, so I apologize if I say something strange.   Vanilla Method: public float getStandingEyeHeight(Pose poseIn, EntitySize sizeIn) { switch(poseIn) { case SWIMMING: case FALL_FLYING: case SPIN_ATTACK: return 0.4F; case CROUCHING: return 1.27F; default: return 1.62F; } }   Byte Code of Vanilla Method: public getStandingEyeHeight(Lnet/minecraft/entity/Pose;Lnet/minecraft/entity/EntitySize;)F L0 LINENUMBER 1771 L0 GETSTATIC net/minecraft/entity/player/PlayerEntity$1.$SwitchMap$net$minecraft$entity$Pose : [I ALOAD 1 INVOKEVIRTUAL net/minecraft/entity/Pose.ordinal ()I IALOAD TABLESWITCH 1: L1 2: L1 3: L1 4: L2 default: L3 L1 LINENUMBER 1775 L1 FRAME SAME LDC 0.4 FRETURN L2 LINENUMBER 1777 L2 FRAME SAME LDC 1.27 FRETURN L3 LINENUMBER 1779 L3 FRAME SAME LDC 1.62 FRETURN L4 LOCALVARIABLE this Lnet/minecraft/entity/player/PlayerEntity; L0 L4 0 LOCALVARIABLE p_213348_1_ Lnet/minecraft/entity/Pose; L0 L4 1 LOCALVARIABLE p_213348_2_ Lnet/minecraft/entity/EntitySize; L0 L4 2 MAXSTACK = 2 MAXLOCALS = 3   Transformer.js: var ASMAPI = Java.type('net.minecraftforge.coremod.api.ASMAPI'); var Opcodes = Java.type('org.objectweb.asm.Opcodes'); var mappedMethodName = ASMAPI.mapMethod("func_213348_b"); function initializeCoreMod() { return { 'coremodmethod': { 'target': { 'type': 'METHOD', 'class': 'net.minecraft.entity.player.PlayerEntity', 'methodName': mappedMethodName, 'methodDesc': '(Lnet/minecraft/entity/Pose;Lnet/minecraft/entity/EntitySize;)F' }, 'transformer': function(method) { var arrayLength = method.instructions.size(); for (var i = arrayLength - 1; i >= 0; --i) { var instruction = method.instructions.get(i); if (instruction.getOpcode() == Opcodes.LDC) { var LdcInsnNode = Java.type('org.objectweb.asm.tree.LdcInsnNode'); var newInstruction = new LdcInsnNode(0.5); method.instructions.insertBefore(instruction, newInstruction); method.instructions.remove(instruction); print("Transformed!"); break; } } return method; } } } }   Error: [main/INFO] [STDERR/]: [java.lang.Throwable:printStackTrace:644]: Caused by: java.lang.VerifyError: Bad type on operand stack Exception Details: Location: net/minecraft/entity/player/PlayerEntity.getStandingEyeHeight(Lnet/minecraft/entity/Pose;Lnet/minecraft/entity/EntitySize;)F @51: freturn Reason: Type double_2nd (current frame, stack[1]) is not assignable to float Current Frame: bci: @51 flags: { } locals: { 'net/minecraft/entity/player/PlayerEntity', 'net/minecraft/entity/Pose', 'net/minecraft/entity/EntitySize' } stack: { double, double_2nd }  
    • Got it. I wasn't eager to do it at first because I thought you weren't able to specify the item used, but I found out that you can through event.getItemStack().getItem() Thanks man.
    • Your original post says that you want to make blocks that move smoothly. That means you want to add a block. You need to implement this block (your own block class) and give it a tile entity.
    • Well then, apparently a TileEntity isn't the right tool either.    
  • Topics

  • Who's Online (See full list)