User Tools

Site Tools


tutorial:mixin_redirectors_methods

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
tutorial:mixin_redirectors_methods [2021/01/15 03:11]
obw Fix the mixin example to target the right class
tutorial:mixin_redirectors_methods [2021/01/15 04:20] (current)
obw Fix instance method example - removed "static" modifier & rename class
Line 35: Line 35:
 <code java [enable_line_numbers=true]>​ <code java [enable_line_numbers=true]>​
 @Mixin(Entity.class) @Mixin(Entity.class)
-abstract class ItemStackMixin ​{+abstract class EntityMixin ​{
     @Redirect(method = "​dropItem",​     @Redirect(method = "​dropItem",​
               at = @At(value = "​INVOKE",​ target = "​Lnet/​minecraft/​item/​ItemStack;​dropItem(Lnet/​minecraft/​item/​ItemConvertible;​I)Lnet/​minecraft/​entity/​ItemEntity;"​))               at = @At(value = "​INVOKE",​ target = "​Lnet/​minecraft/​item/​ItemStack;​dropItem(Lnet/​minecraft/​item/​ItemConvertible;​I)Lnet/​minecraft/​entity/​ItemEntity;"​))
-    private ​static ​ItemEntity replaceDroppedItem(Entity droppingEntity,​ ItemConvertible item, int yOffset) {+    private ItemEntity replaceDroppedItem(Entity droppingEntity,​ ItemConvertible item, int yOffset) {
         return droppingEntity.dropItem(item == Items.DIAMOND ? Items.AIR : item, yOffset);         return droppingEntity.dropItem(item == Items.DIAMOND ? Items.AIR : item, yOffset);
     }     }
tutorial/mixin_redirectors_methods.txt ยท Last modified: 2021/01/15 04:20 by obw