Skip to content

Commit

Permalink
Fix #5
Browse files Browse the repository at this point in the history
  • Loading branch information
SFort committed Jun 10, 2021
1 parent 4bba414 commit a6b156b
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 3 deletions.
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,6 @@ org.gradle.jvmargs=-Xmx1G
loader_version=0.11.3

# Mod Properties
mod_version = 1.0.3
mod_version = 1.0.4
maven_group = tf.ssf.sfort
archives_base_name = lengthyladders
15 changes: 13 additions & 2 deletions src/main/java/tf/ssf/sfort/lengthyladders/mixin/MixinItems.java
Original file line number Diff line number Diff line change
@@ -1,17 +1,28 @@
package tf.ssf.sfort.lengthyladders.mixin;

import net.minecraft.block.Block;
import net.minecraft.block.Blocks;
import net.minecraft.item.BlockItem;
import net.minecraft.item.Item;
import net.minecraft.item.ItemGroup;
import net.minecraft.item.Items;
import net.minecraft.util.registry.Registry;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Shadow;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.ModifyArg;
import org.spongepowered.asm.mixin.injection.Redirect;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
import tf.ssf.sfort.lengthyladders.LadderBlockItem;

@Mixin(Items.class)
public abstract class MixinItems {
//public static Item LADDER = Registry.register(Registry.ITEM, Registry.BLOCK.getId(Blocks.LADDER), new LadderBlockItem(Blocks.LADDER, (new Item.Settings()).group(ItemGroup.DECORATIONS)));
@Inject(method = "register(Lnet/minecraft/block/Block;Lnet/minecraft/item/ItemGroup;)Lnet/minecraft/item/Item;", at=@At("HEAD"), cancellable = true)
private static void register(Block block, ItemGroup group, CallbackInfoReturnable<Item> cir){
if(block.equals(Blocks.LADDER))
cir.setReturnValue(register(new LadderBlockItem(block, (new Item.Settings()).group(group))));
}
@Shadow
public static Item LADDER = Registry.register(Registry.ITEM, 186, Registry.BLOCK.getId(Blocks.LADDER).toString(), new LadderBlockItem(Blocks.LADDER, new Item.Settings().group(ItemGroup.DECORATIONS)));
private static Item register(BlockItem blockItem) { return null; }
}

0 comments on commit a6b156b

Please sign in to comment.