diff --git a/gradle.properties b/gradle.properties index f93a0d0..3a13493 100644 --- a/gradle.properties +++ b/gradle.properties @@ -8,7 +8,7 @@ org.gradle.jvmargs=-Xmx6G loader_version=0.12.12 # Mod Properties - mod_version = 2.1.0 + mod_version = 3.0.0 maven_group = com.test.mod archives_base_name = test-mod diff --git a/src/main/java/net/test/mod/Hausbommer.java b/src/main/java/net/test/mod/Hausbommer.java new file mode 100644 index 0000000..8978661 --- /dev/null +++ b/src/main/java/net/test/mod/Hausbommer.java @@ -0,0 +1,32 @@ +package net.test.mod; + +import net.minecraft.entity.player.PlayerEntity; +import net.minecraft.item.Item; +import net.minecraft.item.ItemStack; +import net.minecraft.text.LiteralText; +import net.minecraft.util.ActionResult; +import net.minecraft.util.Hand; +import net.minecraft.util.TypedActionResult; +import net.minecraft.util.Util; +import net.minecraft.world.World; + +public class Hausbommer extends Item{ + public Hausbommer(Settings settings) { + super(settings); + } + @Override + public TypedActionResult use(World world, PlayerEntity playerentity, Hand hand) { + double x = playerentity.getX(); + double y = playerentity.getY(); + double z = playerentity.getZ(); + double xRound = Math.round(x); + double yRound = Math.round(y); + double zRound = Math.round(z); + String Xmessage = String.valueOf(xRound); + String Ymessage = String.valueOf(yRound); + String Zmessage = String.valueOf(zRound); + String fullMessage = "X: " + Xmessage + " Y: " + Ymessage + " Z: " + Zmessage; + playerentity.sendSystemMessage(new LiteralText(fullMessage), Util.NIL_UUID); + return new TypedActionResult(ActionResult.SUCCESS, playerentity.getStackInHand(hand)); + } +} diff --git a/src/main/java/net/test/mod/TestMod.java b/src/main/java/net/test/mod/TestMod.java index e28fe7a..96c867c 100644 --- a/src/main/java/net/test/mod/TestMod.java +++ b/src/main/java/net/test/mod/TestMod.java @@ -17,12 +17,15 @@ public class TestMod implements ModInitializer { public static final Item FABRIC_ITEM = new FabricItem(new Item.Settings().group(ItemGroup.MISC)); public static final Block FABRIC_BLOCK = new FabricBlock(); + + public static final Item HAUSBOMMER_ITEM = new Hausbommer(new Item.Settings().group(ItemGroup.MISC)); @Override public void onInitialize() { Registry.register(Registry.ITEM, new Identifier("testmod", "fabric_item"), FABRIC_ITEM); Registry.register(Registry.BLOCK, new Identifier("testmod", "fabric_block"), FABRIC_BLOCK); Registry.register(Registry.ITEM, new Identifier("testmod", "fabric_block"), new BlockItem(FABRIC_BLOCK, new FabricItemSettings().group(ItemGroup.MISC))); + Registry.register(Registry.ITEM, new Identifier("testmod", "hausbommer"), HAUSBOMMER_ITEM); CustomPortalBuilder.beginPortal() .frameBlock(Blocks.DIAMOND_BLOCK) .lightWithItem(Items.ENDER_EYE) diff --git a/src/main/resources/assets/testmod/lang/en_us.json b/src/main/resources/assets/testmod/lang/en_us.json index 92383b2..7ed66f2 100644 --- a/src/main/resources/assets/testmod/lang/en_us.json +++ b/src/main/resources/assets/testmod/lang/en_us.json @@ -1,4 +1,5 @@ { "item.testmod.fabric_item": "Penis", - "block.testmod.fabric_block": "Gay Block" + "block.testmod.fabric_block": "Gay Block", + "item.testmod.hausbommer": "Hausbommer" } \ No newline at end of file diff --git a/src/main/resources/assets/testmod/models/item/hausbommer.json b/src/main/resources/assets/testmod/models/item/hausbommer.json new file mode 100644 index 0000000..3a6855b --- /dev/null +++ b/src/main/resources/assets/testmod/models/item/hausbommer.json @@ -0,0 +1,6 @@ +{ + "parent": "item/generated", + "textures": { + "layer0": "testmod:item/hausbommer" + } +} \ No newline at end of file diff --git a/src/main/resources/assets/testmod/textures/item/hausbommer.png b/src/main/resources/assets/testmod/textures/item/hausbommer.png new file mode 100644 index 0000000..2df2142 Binary files /dev/null and b/src/main/resources/assets/testmod/textures/item/hausbommer.png differ diff --git a/src/main/resources/data/testmod/recipes/hausbommer.json b/src/main/resources/data/testmod/recipes/hausbommer.json new file mode 100644 index 0000000..a778d6c --- /dev/null +++ b/src/main/resources/data/testmod/recipes/hausbommer.json @@ -0,0 +1,26 @@ +{ + "type": "minecraft:crafting_shaped", + "pattern": [ + " X ", + "WZW", + "WRW" + ], + "key": { + "X": { + "item": "testmod:fabric_item" + }, + "R": { + "item": "testmod:fabric_block" + }, + "W": { + "item": "minecraft:iron_block" + }, + "Z": { + "item": "minecraft:redstone_block" + } + }, + "result": { + "item": "testmod:hausbommer", + "count": 1 + } + } \ No newline at end of file