Compare commits

..

6 Commits

Author SHA1 Message Date
2c1ec3e7ac Fixed Straw totem description formatting. 2021-05-29 21:44:32 +01:00
5df300dfa6 . 2021-05-29 21:42:46 +01:00
644a1634e5 Changed Straw totem base fail chance from 35 to 45. 2021-05-29 21:39:10 +01:00
3286c59fe8 Changed Straw totem base fail chance from 50 to 35.
Changed fail chance increase when failed charging from variable to static 5.
Changed conditions for failing a revive with the straw totem. The totem no longer gets destroyed and instead uses up the required charges and fail chance gets reset by the required charge amount.
2021-05-29 21:36:20 +01:00
fecf3e5895 Changed color of feedback messages from blue and aqua to gray and dark gray.
Added a check in C2SRequestPlayerRevive and C2SRequestTotemCharge to check if the totem is a straw one and to do the correct fail chance check.
Added functionality to the Straw Totem.
Added an onCraftedBy override for the normal totem in case.
Fixed a small error caused by right-clicking with any totem when no target was selected.
Created extra Utils functions for random numbers in a range.
2021-05-29 21:09:49 +01:00
2274056c04 Started working on two new items: Straw totem and straw charge.
Added textures, crafting recipes and lang file entries.
Items are basic and don't do anything yet
2021-05-29 19:20:54 +01:00
21 changed files with 309 additions and 8 deletions

View File

@ -1,6 +1,12 @@
8a2b88672a3111967914bf84746ee02770dc8aca assets/totemofreviving/models/item/reviving_charge.json 8a2b88672a3111967914bf84746ee02770dc8aca assets/totemofreviving/models/item/reviving_charge.json
6dfda0ccc2ea9fde90748a9fac81e6e122375b60 assets/totemofreviving/models/item/straw_charge.json
70680f30f3471070d6d4121f0787eb7e2a9d7318 assets/totemofreviving/models/item/straw_totem.json
9802f8a76c014c4e7d5b093643a0f8f2c75474bc assets/totemofreviving/models/item/totem_of_reviving.json 9802f8a76c014c4e7d5b093643a0f8f2c75474bc assets/totemofreviving/models/item/totem_of_reviving.json
97e29a14be1fa658d16ee23c9791822f6d49dab7 data/totemofreviving/advancements/recipes/misc/reviving_charge.json 97e29a14be1fa658d16ee23c9791822f6d49dab7 data/totemofreviving/advancements/recipes/misc/reviving_charge.json
4a76d05fbd6fe375b097c1207f2967fd5fbfef5b data/totemofreviving/advancements/recipes/misc/straw_charge.json
8608de575125d59605ad619c16b826cee70c478e data/totemofreviving/advancements/recipes/misc/straw_totem.json
9be362836ef513789b2c8e3d88d35a6b802b5d27 data/totemofreviving/advancements/recipes/misc/totem_of_reviving.json 9be362836ef513789b2c8e3d88d35a6b802b5d27 data/totemofreviving/advancements/recipes/misc/totem_of_reviving.json
0a4143689809621511c8e586e6f030e2dd7a5927 data/totemofreviving/recipes/reviving_charge.json 0a4143689809621511c8e586e6f030e2dd7a5927 data/totemofreviving/recipes/reviving_charge.json
72f1af6072cd28ad40e07d67256f2611bcb2d924 data/totemofreviving/recipes/straw_charge.json
ffba47b4fb65503d8143a387b05e191301b2b895 data/totemofreviving/recipes/straw_totem.json
8d9f9d28b0748d5dacbf0824b8f6531a6a00bbfa data/totemofreviving/recipes/totem_of_reviving.json 8d9f9d28b0748d5dacbf0824b8f6531a6a00bbfa data/totemofreviving/recipes/totem_of_reviving.json

View File

@ -0,0 +1,6 @@
{
"parent": "minecraft:item/generated",
"textures": {
"layer0": "totemofreviving:item/straw_charge"
}
}

View File

@ -0,0 +1,6 @@
{
"parent": "minecraft:item/generated",
"textures": {
"layer0": "totemofreviving:item/straw_totem"
}
}

View File

@ -0,0 +1,32 @@
{
"parent": "minecraft:recipes/root",
"rewards": {
"recipes": [
"totemofreviving:straw_charge"
]
},
"criteria": {
"has_item": {
"trigger": "minecraft:inventory_changed",
"conditions": {
"items": [
{
"item": "minecraft:emerald"
}
]
}
},
"has_the_recipe": {
"trigger": "minecraft:recipe_unlocked",
"conditions": {
"recipe": "totemofreviving:straw_charge"
}
}
},
"requirements": [
[
"has_item",
"has_the_recipe"
]
]
}

View File

@ -0,0 +1,32 @@
{
"parent": "minecraft:recipes/root",
"rewards": {
"recipes": [
"totemofreviving:straw_totem"
]
},
"criteria": {
"has_item": {
"trigger": "minecraft:inventory_changed",
"conditions": {
"items": [
{
"item": "minecraft:wheat"
}
]
}
},
"has_the_recipe": {
"trigger": "minecraft:recipe_unlocked",
"conditions": {
"recipe": "totemofreviving:straw_totem"
}
}
},
"requirements": [
[
"has_item",
"has_the_recipe"
]
]
}

View File

@ -0,0 +1,22 @@
{
"type": "minecraft:crafting_shaped",
"pattern": [
"IWI",
"WEW",
"IWI"
],
"key": {
"W": {
"item": "minecraft:wheat"
},
"E": {
"item": "minecraft:emerald"
},
"I": {
"item": "minecraft:iron_ingot"
}
},
"result": {
"item": "totemofreviving:straw_charge"
}
}

View File

@ -0,0 +1,25 @@
{
"type": "minecraft:crafting_shaped",
"pattern": [
"NSN",
"NWN",
"N/N"
],
"key": {
"W": {
"item": "minecraft:wheat"
},
"/": {
"item": "minecraft:stick"
},
"S": {
"item": "minecraft:string"
},
"N": {
"item": "minecraft:iron_nugget"
}
},
"result": {
"item": "totemofreviving:straw_totem"
}
}

View File

@ -30,5 +30,24 @@ public class ModRecipeProvider extends RecipeProvider {
.pattern("@E@") .pattern("@E@")
.unlockedBy("has_item", has(ModItems.TOTEM_OF_REVIVING.get())) .unlockedBy("has_item", has(ModItems.TOTEM_OF_REVIVING.get()))
.save(consumer); .save(consumer);
ShapedRecipeBuilder.shaped(ModItems.STRAW_TOTEM.get())
.define('W', Items.WHEAT)
.define('/', Items.STICK)
.define('S', Items.STRING)
.define('N', Items.IRON_NUGGET)
.pattern("NSN")
.pattern("NWN")
.pattern("N/N")
.unlockedBy("has_item", has(Items.WHEAT))
.save(consumer);
ShapedRecipeBuilder.shaped(ModItems.STRAW_CHARGE.get())
.define('W', Items.WHEAT)
.define('E', Items.EMERALD)
.define('I', Items.IRON_INGOT)
.pattern("IWI")
.pattern("WEW")
.pattern("IWI")
.unlockedBy("has_item", has(Items.EMERALD))
.save(consumer);
} }
} }

View File

@ -23,6 +23,8 @@ public class ModItemModelProvider extends ItemModelProvider {
builder(item_generated, "totem_of_reviving"); builder(item_generated, "totem_of_reviving");
builder(item_generated, "reviving_charge"); builder(item_generated, "reviving_charge");
builder(item_generated, "straw_totem");
builder(item_generated, "straw_charge");
} }
private ItemModelBuilder builder(ModelFile item_generated, String name) { private ItemModelBuilder builder(ModelFile item_generated, String name) {

View File

@ -2,9 +2,10 @@ package com.micle.totemofreviving.items;
import net.minecraft.item.Item; import net.minecraft.item.Item;
import net.minecraft.item.ItemGroup; import net.minecraft.item.ItemGroup;
import net.minecraft.item.Rarity;
public class RevivingChargeItem extends Item { public class RevivingChargeItem extends Item {
public RevivingChargeItem() { public RevivingChargeItem() {
super(new Item.Properties().tab(ItemGroup.TAB_MISC)); super(new Item.Properties().tab(ItemGroup.TAB_MISC).rarity(Rarity.RARE));
} }
} }

View File

@ -0,0 +1,11 @@
package com.micle.totemofreviving.items;
import net.minecraft.item.Item;
import net.minecraft.item.ItemGroup;
import net.minecraft.item.Rarity;
public class StrawChargeItem extends Item {
public StrawChargeItem() {
super(new Item.Properties().tab(ItemGroup.TAB_MISC).rarity(Rarity.UNCOMMON));
}
}

View File

@ -0,0 +1,86 @@
package com.micle.totemofreviving.items;
import com.micle.totemofreviving.TotemOfReviving;
import com.micle.totemofreviving.network.C2SRequestPlayerRevive;
import com.micle.totemofreviving.network.C2SRequestTotemCharge;
import com.micle.totemofreviving.network.C2SRequestTotemTarget;
import net.minecraft.client.Minecraft;
import net.minecraft.client.util.ITooltipFlag;
import net.minecraft.client.util.InputMappings;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.item.Item;
import net.minecraft.item.ItemGroup;
import net.minecraft.item.ItemStack;
import net.minecraft.item.Rarity;
import net.minecraft.util.ActionResult;
import net.minecraft.util.Hand;
import net.minecraft.util.text.ITextComponent;
import net.minecraft.util.text.StringTextComponent;
import net.minecraft.util.text.TextFormatting;
import net.minecraft.world.World;
import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.api.distmarker.OnlyIn;
import org.lwjgl.glfw.GLFW;
import java.util.List;
public class StrawTotemItem extends Item {
public static final String TAG_CHARGE_AMOUNT = "charge";
public static final String TAG_TARGET_INDEX = "target_index";
public static final String TAG_TARGET_NAME = "target_name";
public static final String TAG_FAIL_CHANCE = "fail_chance";
public static final int STARTING_FAIL_CHANCE = 45;
public StrawTotemItem() {
super(new Item.Properties().tab(ItemGroup.TAB_MISC).stacksTo(1).rarity(Rarity.UNCOMMON));
}
@Override
public void appendHoverText(ItemStack stack, World world, List<ITextComponent> tooltip, ITooltipFlag flag) {
super.appendHoverText(stack, world, tooltip, flag);
tooltip.add(new StringTextComponent(TextFormatting.GOLD + "Charges: " + TextFormatting.GRAY + stack.getOrCreateTag().getInt(TAG_CHARGE_AMOUNT)));
tooltip.add(new StringTextComponent(TextFormatting.GOLD + "Target: " + TextFormatting.GRAY + stack.getOrCreateTag().getString(TAG_TARGET_NAME)));
tooltip.add(new StringTextComponent(TextFormatting.GOLD + "Fail Chance: " + TextFormatting.GRAY + stack.getOrCreateTag().getInt(TAG_FAIL_CHANCE)));
tooltip.add(new StringTextComponent( TextFormatting.DARK_GRAY + "" + TextFormatting.ITALIC + "\"Feels kinda funky.\""));
tooltip.add(new StringTextComponent(""));
if (InputMappings.isKeyDown(Minecraft.getInstance().getWindow().getWindow(), GLFW.GLFW_KEY_LEFT_SHIFT)) {
tooltip.add(new StringTextComponent(TextFormatting.YELLOW + "R-CLICK"));
tooltip.add(new StringTextComponent(TextFormatting.GOLD + "When other hand is empty: attempt to revive target."));
tooltip.add(new StringTextComponent(TextFormatting.GOLD + "When other hand has " + TextFormatting.GRAY + "Straw Reviving Charge" + TextFormatting.GOLD + ": charge totem."));
tooltip.add(new StringTextComponent(""));
tooltip.add(new StringTextComponent(TextFormatting.YELLOW + "SHIFT R-CLICK"));
tooltip.add(new StringTextComponent(TextFormatting.GOLD + "Cycle through available targets."));
} else {
tooltip.add(new StringTextComponent(TextFormatting.GRAY + "[" + TextFormatting.WHITE + "LSHIFT" + TextFormatting.GRAY + "] for advanced tooltip."));
}
}
@Override
public void onCraftedBy(ItemStack stack, World world, PlayerEntity player) {
super.onCraftedBy(stack, world, player);
stack.getOrCreateTag().putInt(TAG_CHARGE_AMOUNT, 0);
stack.getOrCreateTag().putInt(TAG_FAIL_CHANCE, STARTING_FAIL_CHANCE);
}
@Override
@OnlyIn(Dist.CLIENT)
public ActionResult<ItemStack> use(World world, PlayerEntity player, Hand hand) {
if (!world.isClientSide) { return super.use(world, player, hand); }
if (player.isCrouching()) {
TotemOfReviving.INSTANCE.sendToServer(new C2SRequestTotemTarget(player.getUUID(), hand));
} else {
Hand item_charge_hand = Hand.MAIN_HAND;
if (hand.equals(Hand.MAIN_HAND)) {
item_charge_hand = Hand.OFF_HAND;
}
Item item_charge = player.getItemInHand(item_charge_hand).getItem();
if (item_charge instanceof StrawChargeItem) {
TotemOfReviving.INSTANCE.sendToServer(new C2SRequestTotemCharge(player.getUUID(), hand, item_charge_hand));
} else {
TotemOfReviving.INSTANCE.sendToServer(new C2SRequestPlayerRevive(player.getUUID(), hand));
}
}
return super.use(world, player, hand);
}
}

View File

@ -52,6 +52,12 @@ public class TotemOfRevivingItem extends Item {
} }
} }
@Override
public void onCraftedBy(ItemStack stack, World world, PlayerEntity player) {
super.onCraftedBy(stack, world, player);
stack.getOrCreateTag().putInt(TAG_CHARGE_AMOUNT, 0);
}
@Override @Override
@OnlyIn(Dist.CLIENT) @OnlyIn(Dist.CLIENT)
public ActionResult<ItemStack> use(World world, PlayerEntity player, Hand hand) { public ActionResult<ItemStack> use(World world, PlayerEntity player, Hand hand) {

View File

@ -1,12 +1,18 @@
package com.micle.totemofreviving.network; package com.micle.totemofreviving.network;
import com.micle.totemofreviving.TotemOfReviving; import com.micle.totemofreviving.TotemOfReviving;
import com.micle.totemofreviving.items.StrawTotemItem;
import com.micle.totemofreviving.items.TotemOfRevivingItem; import com.micle.totemofreviving.items.TotemOfRevivingItem;
import com.micle.totemofreviving.utils.Utils;
import net.minecraft.client.audio.Sound;
import net.minecraft.entity.player.ServerPlayerEntity; import net.minecraft.entity.player.ServerPlayerEntity;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.item.Items;
import net.minecraft.network.PacketBuffer; import net.minecraft.network.PacketBuffer;
import net.minecraft.stats.Stats; import net.minecraft.stats.Stats;
import net.minecraft.util.DamageSource;
import net.minecraft.util.Hand; import net.minecraft.util.Hand;
import net.minecraft.util.SoundEvent;
import net.minecraft.util.text.StringTextComponent; import net.minecraft.util.text.StringTextComponent;
import net.minecraft.util.text.TextFormatting; import net.minecraft.util.text.TextFormatting;
import net.minecraft.world.GameType; import net.minecraft.world.GameType;
@ -41,7 +47,7 @@ public class C2SRequestPlayerRevive {
if (sender == null) { return; } if (sender == null) { return; }
ItemStack item = sender.getItemInHand(msg.hand); ItemStack item = sender.getItemInHand(msg.hand);
if (item.getOrCreateTag().getInt(TotemOfRevivingItem.TAG_TARGET_INDEX) > TotemOfReviving.players.getPlayerCount()-1) { if (item.getOrCreateTag().getInt(TotemOfRevivingItem.TAG_TARGET_INDEX) > TotemOfReviving.players.getPlayerCount()-1 || item.getOrCreateTag().getString(TotemOfRevivingItem.TAG_TARGET_NAME).equals("")) {
sender.sendMessage(new StringTextComponent(TextFormatting.RED + "Error getting target! (Try selecting the target again)"), sender.getUUID()); sender.sendMessage(new StringTextComponent(TextFormatting.RED + "Error getting target! (Try selecting the target again)"), sender.getUUID());
} else { } else {
ServerPlayerEntity player_to_revive = TotemOfReviving.players.getPlayerByName(item.getOrCreateTag().getString(TotemOfRevivingItem.TAG_TARGET_NAME)); ServerPlayerEntity player_to_revive = TotemOfReviving.players.getPlayerByName(item.getOrCreateTag().getString(TotemOfRevivingItem.TAG_TARGET_NAME));
@ -51,18 +57,27 @@ public class C2SRequestPlayerRevive {
if (player_to_revive.isSpectator()) { if (player_to_revive.isSpectator()) {
if (player_to_revive_world.equals(sender_world)) { if (player_to_revive_world.equals(sender_world)) {
if (item.getOrCreateTag().getInt(TotemOfRevivingItem.TAG_CHARGE_AMOUNT) >= required_charge) { if (item.getOrCreateTag().getInt(TotemOfRevivingItem.TAG_CHARGE_AMOUNT) >= required_charge) {
if (item.getOrCreateTag().contains(StrawTotemItem.TAG_FAIL_CHANCE)) {
int fail_chance = item.getOrCreateTag().getInt(StrawTotemItem.TAG_FAIL_CHANCE);
if (Utils.randomIntRange(0, 100) <= fail_chance) {
item.getOrCreateTag().putInt(StrawTotemItem.TAG_CHARGE_AMOUNT, item.getOrCreateTag().getInt(StrawTotemItem.TAG_CHARGE_AMOUNT)-required_charge);
item.getOrCreateTag().putInt(StrawTotemItem.TAG_FAIL_CHANCE, fail_chance-(5*required_charge));
sender.hurt(DamageSource.GENERIC, (sender.getHealth() * (fail_chance / 100.0f)));
return;
}
}
player_to_revive.teleportTo(sender.getX(), sender.getY(), sender.getZ()); player_to_revive.teleportTo(sender.getX(), sender.getY(), sender.getZ());
player_to_revive.setGameMode(GameType.SURVIVAL); player_to_revive.setGameMode(GameType.SURVIVAL);
item.getOrCreateTag().putInt(TotemOfRevivingItem.TAG_CHARGE_AMOUNT, item.getOrCreateTag().getInt(TotemOfRevivingItem.TAG_CHARGE_AMOUNT) - required_charge); item.getOrCreateTag().putInt(TotemOfRevivingItem.TAG_CHARGE_AMOUNT, item.getOrCreateTag().getInt(TotemOfRevivingItem.TAG_CHARGE_AMOUNT) - required_charge);
sender.sendMessage(new StringTextComponent(TextFormatting.AQUA + "Successfully revived " + TextFormatting.BLUE + player_to_revive.getDisplayName().getString()), sender.getUUID()); sender.sendMessage(new StringTextComponent(TextFormatting.GRAY + "Successfully revived " + TextFormatting.DARK_GRAY + player_to_revive.getDisplayName().getString()), sender.getUUID());
} else { } else {
sender.sendMessage(new StringTextComponent(TextFormatting.AQUA + "Not enough charge! Required charge is: " + TextFormatting.BLUE + required_charge), sender.getUUID()); sender.sendMessage(new StringTextComponent(TextFormatting.GRAY + "Not enough charge! Required charge is: " + TextFormatting.DARK_GRAY + required_charge), sender.getUUID());
} }
} else { } else {
sender.sendMessage(new StringTextComponent(TextFormatting.BLUE + player_to_revive.getDisplayName().getString() + TextFormatting.AQUA + " is not in this dimension!"), sender.getUUID()); sender.sendMessage(new StringTextComponent(TextFormatting.DARK_GRAY + player_to_revive.getDisplayName().getString() + TextFormatting.GRAY + " is not in this dimension!"), sender.getUUID());
} }
} else { } else {
sender.sendMessage(new StringTextComponent(TextFormatting.BLUE + player_to_revive.getDisplayName().getString() + TextFormatting.AQUA + " is not dead!"), sender.getUUID()); sender.sendMessage(new StringTextComponent(TextFormatting.DARK_GRAY + player_to_revive.getDisplayName().getString() + TextFormatting.GRAY + " is not dead!"), sender.getUUID());
} }
} }
}); });

View File

@ -1,10 +1,15 @@
package com.micle.totemofreviving.network; package com.micle.totemofreviving.network;
import com.micle.totemofreviving.TotemOfReviving; import com.micle.totemofreviving.TotemOfReviving;
import com.micle.totemofreviving.items.StrawTotemItem;
import com.micle.totemofreviving.items.TotemOfRevivingItem; import com.micle.totemofreviving.items.TotemOfRevivingItem;
import com.micle.totemofreviving.utils.Utils;
import net.minecraft.block.material.Material;
import net.minecraft.entity.player.ServerPlayerEntity; import net.minecraft.entity.player.ServerPlayerEntity;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.item.Items;
import net.minecraft.network.PacketBuffer; import net.minecraft.network.PacketBuffer;
import net.minecraft.util.DamageSource;
import net.minecraft.util.Hand; import net.minecraft.util.Hand;
import net.minecraftforge.fml.network.NetworkEvent; import net.minecraftforge.fml.network.NetworkEvent;
@ -43,6 +48,15 @@ public class C2SRequestTotemCharge {
charge_item.setCount(charge_item.getCount()-1); charge_item.setCount(charge_item.getCount()-1);
totem_item.getOrCreateTag().putInt(TotemOfRevivingItem.TAG_CHARGE_AMOUNT, totem_item.getOrCreateTag().getInt(TotemOfRevivingItem.TAG_CHARGE_AMOUNT)+1); totem_item.getOrCreateTag().putInt(TotemOfRevivingItem.TAG_CHARGE_AMOUNT, totem_item.getOrCreateTag().getInt(TotemOfRevivingItem.TAG_CHARGE_AMOUNT)+1);
if (totem_item.getOrCreateTag().contains(StrawTotemItem.TAG_FAIL_CHANCE)) {
int fail_chance = totem_item.getOrCreateTag().getInt(StrawTotemItem.TAG_FAIL_CHANCE);
if (Utils.randomIntRange(0, 100) <= fail_chance) {
sender.setItemInHand(msg.hand, new ItemStack(Items.AIR));
sender.hurt(DamageSource.GENERIC, (sender.getHealth() * (fail_chance / 100.0f)));
} else {
totem_item.getOrCreateTag().putInt(StrawTotemItem.TAG_FAIL_CHANCE, fail_chance+5);
}
}
}); });
context.setPacketHandled(true); context.setPacketHandled(true);
} }

View File

@ -45,7 +45,7 @@ public class C2SRequestTotemTarget {
item.getOrCreateTag().putInt(TotemOfRevivingItem.TAG_TARGET_INDEX, current_player_index); item.getOrCreateTag().putInt(TotemOfRevivingItem.TAG_TARGET_INDEX, current_player_index);
item.getOrCreateTag().putString(TotemOfRevivingItem.TAG_TARGET_NAME, TotemOfReviving.players.getPlayers().get(current_player_index).getDisplayName().getString()); item.getOrCreateTag().putString(TotemOfRevivingItem.TAG_TARGET_NAME, TotemOfReviving.players.getPlayers().get(current_player_index).getDisplayName().getString());
sender.sendMessage(new StringTextComponent(TextFormatting.AQUA + "Target: " + TextFormatting.BLUE + item.getOrCreateTag().getString(TotemOfRevivingItem.TAG_TARGET_NAME)), sender.getUUID()); sender.sendMessage(new StringTextComponent(TextFormatting.GRAY + "Target: " + TextFormatting.DARK_GRAY + item.getOrCreateTag().getString(TotemOfRevivingItem.TAG_TARGET_NAME)), sender.getUUID());
}); });
context.setPacketHandled(true); context.setPacketHandled(true);
} }

View File

@ -1,6 +1,8 @@
package com.micle.totemofreviving.setup; package com.micle.totemofreviving.setup;
import com.micle.totemofreviving.items.RevivingChargeItem; import com.micle.totemofreviving.items.RevivingChargeItem;
import com.micle.totemofreviving.items.StrawChargeItem;
import com.micle.totemofreviving.items.StrawTotemItem;
import com.micle.totemofreviving.items.TotemOfRevivingItem; import com.micle.totemofreviving.items.TotemOfRevivingItem;
import net.minecraft.item.Item; import net.minecraft.item.Item;
import net.minecraft.item.ItemGroup; import net.minecraft.item.ItemGroup;
@ -9,6 +11,8 @@ import net.minecraftforge.fml.RegistryObject;
public class ModItems { public class ModItems {
public static final RegistryObject<Item> TOTEM_OF_REVIVING = Registration.ITEMS.register("totem_of_reviving", TotemOfRevivingItem::new); public static final RegistryObject<Item> TOTEM_OF_REVIVING = Registration.ITEMS.register("totem_of_reviving", TotemOfRevivingItem::new);
public static final RegistryObject<Item> REVIVING_CHARGE = Registration.ITEMS.register("reviving_charge", RevivingChargeItem::new); public static final RegistryObject<Item> REVIVING_CHARGE = Registration.ITEMS.register("reviving_charge", RevivingChargeItem::new);
public static final RegistryObject<Item> STRAW_TOTEM = Registration.ITEMS.register("straw_totem", StrawTotemItem::new);
public static final RegistryObject<Item> STRAW_CHARGE = Registration.ITEMS.register("straw_charge", StrawChargeItem::new);
static void register() { static void register() {
} }

View File

@ -4,4 +4,16 @@ public class Utils {
public static float clamp(float val, float min, float max) { public static float clamp(float val, float min, float max) {
return Math.max(min, Math.min(max, val)); return Math.max(min, Math.min(max, val));
} }
public static int randomIntRange(int min, int max) {
return (int) randomDoubleRange(min, max);
}
public static float randomFloatRange(float min, float max) {
return (float) randomDoubleRange(min, max);
}
public static double randomDoubleRange(double min, double max) {
return ((Math.random() * (max - min)) + min);
}
} }

View File

@ -1,4 +1,6 @@
{ {
"item.totemofreviving.totem_of_reviving": "Totem of Reviving", "item.totemofreviving.totem_of_reviving": "Totem of Reviving",
"item.totemofreviving.reviving_charge": "Reviving charge" "item.totemofreviving.reviving_charge": "Reviving charge",
"item.totemofreviving.straw_totem": "Straw Totem of Reviving",
"item.totemofreviving.straw_charge": "Straw reviving charge"
} }

Binary file not shown.

After

Width:  |  Height:  |  Size: 753 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.7 KiB