diff --git a/src/main/generated/assets/acesbs/models/item/wand.json b/src/main/generated/assets/acesbs/models/item/wand.json new file mode 100644 index 0000000..9632234 --- /dev/null +++ b/src/main/generated/assets/acesbs/models/item/wand.json @@ -0,0 +1,6 @@ +{ + "parent": "minecraft:item/generated", + "textures": { + "layer0": "acesbs:item/wand" + } +} \ No newline at end of file diff --git a/src/main/java/com/acethewildfire/acesbs/AcesBS.java b/src/main/java/com/acethewildfire/acesbs/AcesBS.java index dcd8701..ad319ce 100644 --- a/src/main/java/com/acethewildfire/acesbs/AcesBS.java +++ b/src/main/java/com/acethewildfire/acesbs/AcesBS.java @@ -1,6 +1,7 @@ package com.acethewildfire.acesbs; import com.acethewildfire.acesbs.block.ModBlocks; +import com.acethewildfire.acesbs.component.ModDataComponentTypes; import com.acethewildfire.acesbs.item.ModItemGroups; import com.acethewildfire.acesbs.item.ModItems; import net.fabricmc.api.ModInitializer; @@ -26,5 +27,7 @@ public class AcesBS implements ModInitializer { ModItemGroups.registerItemGroups(); ModItems.registerModItems(); ModBlocks.registerModBlocks(); + + ModDataComponentTypes.registerDataComponentsTypes(); } } \ No newline at end of file diff --git a/src/main/java/com/acethewildfire/acesbs/TODO.txt b/src/main/java/com/acethewildfire/acesbs/TODO.txt new file mode 100644 index 0000000..2620a65 --- /dev/null +++ b/src/main/java/com/acethewildfire/acesbs/TODO.txt @@ -0,0 +1,62 @@ +Resources +- Infernal Ashes +- Raw End-tropy +- Stable End-tropy +- Prisma Steel (Stable Entropy + Iron) +- Chaos Silver (Stable Entropy + Gold) +- Fractal Diamond (Stable Entropy + Diamond) +- Ashen Steel (Ashes + Iron) +- Everburn Gold (Ashes + Gold) +- Infernal Diamond (Ashes + Diamond) +- Endtropite (Stable End-tropy + Netherite) +- Faerie Shard (Amethyst + Stable Entropy) +- Hyper Sugar (Stable Entropy + Sugar) +- Triangle (We are not sure what it does) + +Food +- Aquarium Gravel +- Bricked Up +- Infernal Beef (Mob/ Ashes + Cooked Beef) +- Hyper Stimulants (Hyper Sugar) +- Narcan + +Armor +- Beserker Pauldron +- Wildfire Boots +- Sov's Plate Carrier +- (Headlamp Armors using Everburn Gold) +- Eternal Armor (Binding and mending) + +Potions +- Lemon (Yellow Blindness) +- Faerie Size (Small and Light) +- Bottle o' Drunken Sailor +- Energy Drink (Hyper Sugar) + +Weapons +- Big Iron +- Thot Begon +- Ahab's Harpoon +- Soul Crusher (Removes Eternal Armor) + +Blocks +- Deep Slate Entropy Ore +- Infernal Ashes Block +- End-tropy Ore +- (Rename) Block of Raw Entropy +- Block of Raw End-tropy +- Stable End-tropy Block + +Workstations +- Entropic Accumulator (For Metals and Stones) +- Entropic Stabilizer (For making Stable Entropy) + +Mobs +- Fren (Stable Entropy on a Creeper) +- Burning Wizard (Infernal Ashes on a Witch) +- Wildfire Iskat (Infernal Ashes on a tamed cat) +- Rat Bastard (Stable Entropy on a cat) + +Music Disk +- Crab Rave +- Lizard \ No newline at end of file diff --git a/src/main/java/com/acethewildfire/acesbs/component/ModDataComponentTypes.java b/src/main/java/com/acethewildfire/acesbs/component/ModDataComponentTypes.java new file mode 100644 index 0000000..0f55498 --- /dev/null +++ b/src/main/java/com/acethewildfire/acesbs/component/ModDataComponentTypes.java @@ -0,0 +1,25 @@ +package com.acethewildfire.acesbs.component; + +import com.acethewildfire.acesbs.AcesBS; +import net.minecraft.component.ComponentType; +import net.minecraft.registry.Registries; +import net.minecraft.registry.Registry; +import net.minecraft.util.Identifier; +import net.minecraft.util.math.BlockPos; + +import java.util.function.UnaryOperator; + +public class ModDataComponentTypes { + + public static final ComponentType COORDINATES = + register("coordinates", blockPosBuilder -> blockPosBuilder.codec(BlockPos.CODEC)); + + private static ComponentType register(String name, UnaryOperator> builderOperator){ + return Registry.register(Registries.DATA_COMPONENT_TYPE, Identifier.of(AcesBS.MOD_ID, name), + builderOperator.apply(ComponentType.builder()).build()); + } + + public static void registerDataComponentsTypes(){ + AcesBS.LOGGER.info("Registering Data Components Types for" + AcesBS.MOD_ID); + } +} diff --git a/src/main/java/com/acethewildfire/acesbs/datagen/ModModelProvider.java b/src/main/java/com/acethewildfire/acesbs/datagen/ModModelProvider.java index c8c38c3..af0590e 100644 --- a/src/main/java/com/acethewildfire/acesbs/datagen/ModModelProvider.java +++ b/src/main/java/com/acethewildfire/acesbs/datagen/ModModelProvider.java @@ -51,5 +51,6 @@ public class ModModelProvider extends FabricModelProvider { itemModelGenerator.register(ModItems.ORACLE_LEMON, Models.GENERATED); itemModelGenerator.register(ModItems.GREEN_BRICKS, Models.GENERATED); itemModelGenerator.register(ModItems.STABLE_ENTROPY, Models.GENERATED); + itemModelGenerator.register(ModItems.WAND, Models.GENERATED); } } diff --git a/src/main/java/com/acethewildfire/acesbs/item/ModItemGroups.java b/src/main/java/com/acethewildfire/acesbs/item/ModItemGroups.java index 2ba1816..d366794 100644 --- a/src/main/java/com/acethewildfire/acesbs/item/ModItemGroups.java +++ b/src/main/java/com/acethewildfire/acesbs/item/ModItemGroups.java @@ -23,6 +23,7 @@ public class ModItemGroups { entries.add(ModItems.RAW_ENTROPY); entries.add(ModItems.STABLE_ENTROPY); entries.add(ModItems.GREEN_BRICKS); + entries.add(ModItems.WAND); }) .build()); diff --git a/src/main/java/com/acethewildfire/acesbs/item/ModItems.java b/src/main/java/com/acethewildfire/acesbs/item/ModItems.java index 740a82b..d6646ac 100644 --- a/src/main/java/com/acethewildfire/acesbs/item/ModItems.java +++ b/src/main/java/com/acethewildfire/acesbs/item/ModItems.java @@ -2,6 +2,7 @@ package com.acethewildfire.acesbs.item; import com.acethewildfire.acesbs.AcesBS; import com.acethewildfire.acesbs.item.custom.OracleLemon; +import com.acethewildfire.acesbs.item.custom.Wand; import net.minecraft.client.gui.screen.Screen; import net.minecraft.component.DataComponentTypes; import net.minecraft.component.type.PotionContentsComponent; @@ -23,6 +24,7 @@ public class ModItems { private static final RegistryEntry BLINDNESS = registerPotion("blindness", new Potion(new StatusEffectInstance(StatusEffects.BLINDNESS, 200))); public static final Item ORACLE_LEMON = registerItem("oracle_lemon", new OracleLemon(new Item.Settings().component(DataComponentTypes.POTION_CONTENTS, new PotionContentsComponent(BLINDNESS)))); + public static final Item WAND = registerItem("wand", new Wand(new Item.Settings().maxDamage(32))); public static final Item RAW_ENTROPY = registerItem("raw_entropy", new Item(new Item.Settings())); public static final Item STABLE_ENTROPY = registerItem("stable_entropy", new Item(new Item.Settings())); public static final Item LEMON = registerItem("lemon", new Item(new Item.Settings().food(ModFoodComponent.LEMON))); diff --git a/src/main/java/com/acethewildfire/acesbs/item/custom/Wand.java b/src/main/java/com/acethewildfire/acesbs/item/custom/Wand.java new file mode 100644 index 0000000..a70932b --- /dev/null +++ b/src/main/java/com/acethewildfire/acesbs/item/custom/Wand.java @@ -0,0 +1,72 @@ +package com.acethewildfire.acesbs.item.custom; + +import com.acethewildfire.acesbs.block.ModBlocks; +import com.acethewildfire.acesbs.component.ModDataComponentTypes; +import net.minecraft.block.Block; +import net.minecraft.block.Blocks; +import net.minecraft.client.gui.screen.Screen; +import net.minecraft.entity.EquipmentSlot; +import net.minecraft.item.Item; +import net.minecraft.item.ItemStack; +import net.minecraft.item.ItemUsageContext; +import net.minecraft.item.tooltip.TooltipType; +import net.minecraft.server.network.ServerPlayerEntity; +import net.minecraft.server.world.ServerWorld; +import net.minecraft.sound.SoundCategory; +import net.minecraft.sound.SoundEvents; +import net.minecraft.text.Text; +import net.minecraft.util.ActionResult; +import net.minecraft.world.World; + +import java.util.List; +import java.util.Map; + +public class Wand extends Item { + private static final Map WAND_MAP = + Map.of( + Blocks.IRON_ORE, ModBlocks.ENTROPY_ORE, + Blocks.BIRCH_PLANKS, ModBlocks.LEMONWOOD_PLANKS, + ModBlocks.STABLE_ENTROPY_BLOCK, ModBlocks.EVIL_BLOCK, + ModBlocks.EVIL_BLOCK, ModBlocks.STABLE_ENTROPY_BLOCK + ); + + public Wand(Settings settings) { + super(settings); + } + + @Override + public ActionResult useOnBlock(ItemUsageContext context) { + World world = context.getWorld(); + Block clickedBlock = world.getBlockState(context.getBlockPos()).getBlock(); + + if(WAND_MAP.containsKey(clickedBlock)) { + if(!world.isClient()) { + world.setBlockState(context.getBlockPos(), WAND_MAP.get(clickedBlock).getDefaultState()); + + context.getStack().damage(1, ((ServerWorld) world), ((ServerPlayerEntity) context.getPlayer()), + item -> context.getPlayer().sendEquipmentBreakStatus(item, EquipmentSlot.MAINHAND)); + + world.playSound(null, context.getBlockPos(), SoundEvents.BLOCK_GRINDSTONE_USE, SoundCategory.BLOCKS); + + context.getStack().set(ModDataComponentTypes.COORDINATES, context.getBlockPos()); + } + } + + return ActionResult.SUCCESS; + } + + @Override + public void appendTooltip(ItemStack stack, TooltipContext context, List tooltip, TooltipType type) { + if(Screen.hasShiftDown()) { + tooltip.add(Text.translatable("tooltip.acesbs.wand.shift_down")); + } else { + tooltip.add(Text.translatable("tooltip.acesbs.wand")); + } + + if(stack.get(ModDataComponentTypes.COORDINATES) != null) { + tooltip.add(Text.literal("Last Block Changed at " + stack.get(ModDataComponentTypes.COORDINATES))); + } + + super.appendTooltip(stack, context, tooltip, type); + } +} diff --git a/src/main/resources/assets/acesbs/lang/en_us.json b/src/main/resources/assets/acesbs/lang/en_us.json index 75f836a..38d95e0 100644 --- a/src/main/resources/assets/acesbs/lang/en_us.json +++ b/src/main/resources/assets/acesbs/lang/en_us.json @@ -5,6 +5,7 @@ "item.acesbs.lemon": "Odd Lemon", "item.acesbs.cooked_lemon": "Cooked Odd Lemon", "item.acesbs.green_bricks": "Green Bricks", + "item.acesbs.wand": "Entropy Wand", "item.minecraft.potion.effect.blindness": "Potion of Blindness", "item.minecraft.splash_potion.effect.blindness": "Splash Potion of Blindness", @@ -35,5 +36,7 @@ "tooltip.acesbs.stable_entropy_block.tooltip": "Exerts an §o§2upward force§r when stepped on.", "tooltip.acesbs.green_bricks.shift_down": "§o§7Useless Item§r", "tooltip.acesbs.green_bricks": "Hold §eShift§r for item description.", - "tooltip.acesbs.entropy_block.tooltip2": "Has a 1/20 chance of turning an apple into a lemon." + "tooltip.acesbs.entropy_block.tooltip2": "Has a 1/20 chance of turning an apple into a lemon.", + "tooltip.acesbs.wand.shift_down": "Changes blocks using Entropy", + "tooltip.acesbs.wand": "Hold §eShift§r for item description." } \ No newline at end of file diff --git a/src/main/resources/assets/acesbs/textures/item/wand.png b/src/main/resources/assets/acesbs/textures/item/wand.png new file mode 100644 index 0000000..f54e980 Binary files /dev/null and b/src/main/resources/assets/acesbs/textures/item/wand.png differ