From 19db55648e43ebf57a5bda97af0a575cb459355c Mon Sep 17 00:00:00 2001 From: doctor4t <25477005+doctor4t@users.noreply.github.com> Date: Tue, 19 Apr 2022 22:47:57 +0200 Subject: [PATCH] Add rana frog --- CHANGELOG.md | 4 ++++ gradle.properties | 2 +- .../pickyourpoison/common/PickYourPoison.java | 6 ++++-- .../common/entity/PoisonDartEntity.java | 1 + .../common/entity/PoisonDartFrogEntity.java | 13 ++++++++++++- .../common/item/PoisonDartFrogBowlItem.java | 6 ++++-- .../common/item/ThrowingDartItem.java | 2 +- .../assets/pickyourpoison/lang/en_us.json | 1 + .../pickyourpoison/models/item/rana_bowl.json | 6 ++++++ .../pickyourpoison/textures/entity/rana.png | Bin 0 -> 479 bytes .../pickyourpoison/textures/item/rana_bowl.png | Bin 0 -> 334 bytes 11 files changed, 34 insertions(+), 7 deletions(-) create mode 100644 src/main/resources/assets/pickyourpoison/models/item/rana_bowl.json create mode 100644 src/main/resources/assets/pickyourpoison/textures/entity/rana.png create mode 100644 src/main/resources/assets/pickyourpoison/textures/item/rana_bowl.png diff --git a/CHANGELOG.md b/CHANGELOG.md index 6eed1b3..57feb87 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,9 @@ # Pick Your Poison - Changelog: +### Pick Your Poison 1.0.5 - 1.18.2 +- Added a new Rana frog variant, obtained by naming any poison dart frog "Rana" + - Doesn't have any effect, nor can be used to coat poison darts + ### Pick Your Poison 1.0.4 - 1.18.2 - Fix an invalid player data on world load diff --git a/gradle.properties b/gradle.properties index ddaf132..ee91d9d 100644 --- a/gradle.properties +++ b/gradle.properties @@ -11,7 +11,7 @@ loader_version=0.13.3 fabric_version=0.48.0+1.18.2 # Mod Properties -mod_version = 1.0.4 +mod_version = 1.0.5 maven_group = ladysnake archives_base_name = pickyourpoison diff --git a/src/main/java/ladysnake/pickyourpoison/common/PickYourPoison.java b/src/main/java/ladysnake/pickyourpoison/common/PickYourPoison.java index 4648220..e96b3cd 100644 --- a/src/main/java/ladysnake/pickyourpoison/common/PickYourPoison.java +++ b/src/main/java/ladysnake/pickyourpoison/common/PickYourPoison.java @@ -54,7 +54,6 @@ public class PickYourPoison implements ModInitializer { public static final StatusEffect TORPOR = registerStatusEffect("torpor", new EmptyStatusEffect(StatusEffectCategory.HARMFUL, 0xD8C0B8)); public static final StatusEffect BATRACHOTOXIN = registerStatusEffect("batrachotoxin", new EmptyStatusEffect(StatusEffectCategory.HARMFUL, 0xEAD040)); public static final StatusEffect STIMULATION = registerStatusEffect("stimulation", new EmptyStatusEffect(StatusEffectCategory.HARMFUL, 0xD85252).addAttributeModifier(EntityAttributes.GENERIC_MOVEMENT_SPEED, "91AEAA56-376B-4498-935B-2F7F68070635", 0.2f, EntityAttributeModifier.Operation.MULTIPLY_TOTAL)); - private static final String FROGGY_PLAYERS_URL = "https://doctor4t.uuid.gg/pyp-data"; public static boolean isTrinketsLoaded; // ENTITIES public static EntityType POISON_DART_FROG; @@ -68,6 +67,7 @@ public class PickYourPoison implements ModInitializer { public static PoisonDartFrogBowlItem CRIMSON_POISON_DART_FROG_BOWL; public static PoisonDartFrogBowlItem RED_POISON_DART_FROG_BOWL; public static PoisonDartFrogBowlItem LUXALAMANDER_BOWL; + public static PoisonDartFrogBowlItem RANA_BOWL; public static Item THROWING_DART; public static Item COMATOSE_POISON_DART; public static Item BATRACHOTOXIN_POISON_DART; @@ -133,7 +133,8 @@ public static PoisonDartFrogBowlItem[] getAllFrogBowls() { PickYourPoison.GREEN_POISON_DART_FROG_BOWL, PickYourPoison.GOLDEN_POISON_DART_FROG_BOWL, PickYourPoison.ORANGE_POISON_DART_FROG_BOWL, - PickYourPoison.LUXALAMANDER_BOWL + PickYourPoison.LUXALAMANDER_BOWL, + PickYourPoison.RANA_BOWL }; } @@ -167,6 +168,7 @@ public void onInitialize() { CRIMSON_POISON_DART_FROG_BOWL = registerItem("crimson_poison_dart_frog_bowl", new PoisonDartFrogBowlItem((new Item.Settings()).group(ItemGroup.FOOD).maxCount(1), new Identifier(MODID, "textures/entity/crimson.png"))); RED_POISON_DART_FROG_BOWL = registerItem("red_poison_dart_frog_bowl", new PoisonDartFrogBowlItem((new Item.Settings()).group(ItemGroup.FOOD).maxCount(1), new Identifier(MODID, "textures/entity/red.png"))); LUXALAMANDER_BOWL = registerItem("luxalamander_bowl", new PoisonDartFrogBowlItem((new Item.Settings()).group(ItemGroup.FOOD).maxCount(1).rarity(Rarity.RARE), new Identifier(MODID, "textures/entity/luxintrus.png"))); + RANA_BOWL = registerItem("rana_bowl", new PoisonDartFrogBowlItem((new Item.Settings()).group(ItemGroup.FOOD).maxCount(1).rarity(Rarity.RARE), new Identifier(MODID, "textures/entity/rana.png"))); THROWING_DART = registerDartItem("throwing_dart", new ThrowingDartItem((new Item.Settings()).group(ItemGroup.COMBAT).maxCount(64), null)); COMATOSE_POISON_DART = registerDartItem("comatose_poison_dart", new ThrowingDartItem((new Item.Settings()).group(ItemGroup.COMBAT).maxCount(1), new StatusEffectInstance(PickYourPoison.COMATOSE, 100))); // 5s BATRACHOTOXIN_POISON_DART = registerDartItem("batrachotoxin_poison_dart", new ThrowingDartItem((new Item.Settings()).group(ItemGroup.COMBAT).maxCount(1), new StatusEffectInstance(PickYourPoison.BATRACHOTOXIN, 80))); // 4s diff --git a/src/main/java/ladysnake/pickyourpoison/common/entity/PoisonDartEntity.java b/src/main/java/ladysnake/pickyourpoison/common/entity/PoisonDartEntity.java index 72287d8..895c326 100644 --- a/src/main/java/ladysnake/pickyourpoison/common/entity/PoisonDartEntity.java +++ b/src/main/java/ladysnake/pickyourpoison/common/entity/PoisonDartEntity.java @@ -72,6 +72,7 @@ protected void initDataTracker() { @Override public void tick() { super.tick(); + if (this.world.isClient) { if (this.inGround) { if (this.inGroundTime % 5 == 0) { diff --git a/src/main/java/ladysnake/pickyourpoison/common/entity/PoisonDartFrogEntity.java b/src/main/java/ladysnake/pickyourpoison/common/entity/PoisonDartFrogEntity.java index 0e8c000..ec48fef 100644 --- a/src/main/java/ladysnake/pickyourpoison/common/entity/PoisonDartFrogEntity.java +++ b/src/main/java/ladysnake/pickyourpoison/common/entity/PoisonDartFrogEntity.java @@ -155,12 +155,21 @@ public void tick() { } this.setNoDrag(!this.isOnGround()); + + // turn into rana + if (this.getPoisonDartFrogType() != Type.RANA && this.hasCustomName()) { + if (this.getCustomName().getString().equalsIgnoreCase("rana")) { + this.setPoisonDartFrogType(Type.RANA); + } + } + } @Override public ActionResult interactMob(PlayerEntity player, Hand hand) { if (player.getStackInHand(hand).getItem() == Items.BOWL) { Item item = Items.BOWL; + switch (this.getPoisonDartFrogType()) { case BLUE -> item = PickYourPoison.BLUE_POISON_DART_FROG_BOWL; case GOLDEN -> item = PickYourPoison.GOLDEN_POISON_DART_FROG_BOWL; @@ -169,6 +178,7 @@ public ActionResult interactMob(PlayerEntity player, Hand hand) { case CRIMSON -> item = PickYourPoison.CRIMSON_POISON_DART_FROG_BOWL; case RED -> item = PickYourPoison.RED_POISON_DART_FROG_BOWL; case LUXINTRUS -> item = PickYourPoison.LUXALAMANDER_BOWL; + case RANA -> item = PickYourPoison.RANA_BOWL; } ItemStack itemStack = new ItemStack(item); @@ -294,7 +304,8 @@ public enum Type { ORANGE, CRIMSON, RED, - LUXINTRUS + LUXINTRUS, + RANA } } diff --git a/src/main/java/ladysnake/pickyourpoison/common/item/PoisonDartFrogBowlItem.java b/src/main/java/ladysnake/pickyourpoison/common/item/PoisonDartFrogBowlItem.java index 0318139..774859c 100644 --- a/src/main/java/ladysnake/pickyourpoison/common/item/PoisonDartFrogBowlItem.java +++ b/src/main/java/ladysnake/pickyourpoison/common/item/PoisonDartFrogBowlItem.java @@ -42,6 +42,8 @@ public static PoisonDartFrogEntity.Type getFrogType(Item item) { type = PoisonDartFrogEntity.Type.RED; } else if (item == PickYourPoison.LUXALAMANDER_BOWL) { type = PoisonDartFrogEntity.Type.LUXINTRUS; + } else if (item == PickYourPoison.RANA_BOWL) { + type = PoisonDartFrogEntity.Type.RANA; } return type; @@ -55,7 +57,7 @@ public ItemStack finishUsing(ItemStack stack, World world, LivingEntity user) { serverPlayerEntity.incrementStat(Stats.USED.getOrCreateStat(this)); } - if (!world.isClient) { + if (!world.isClient && PoisonDartFrogEntity.getFrogPoisonEffect(getFrogType(stack.getItem())) != null) { user.addStatusEffect(PoisonDartFrogEntity.getFrogPoisonEffect(getFrogType(stack.getItem()))); } @@ -111,7 +113,7 @@ public SoundEvent getEatSound() { } public TypedActionResult use(World world, PlayerEntity user, Hand hand) { - if (user.hasStatusEffect(PoisonDartFrogEntity.getFrogPoisonEffect(getFrogType(user.getStackInHand(hand).getItem())).getEffectType())) { + if (PoisonDartFrogEntity.getFrogPoisonEffect(getFrogType(user.getStackInHand(hand).getItem())) != null && user.hasStatusEffect(PoisonDartFrogEntity.getFrogPoisonEffect(getFrogType(user.getStackInHand(hand).getItem())).getEffectType())) { return TypedActionResult.pass(user.getStackInHand(hand)); } return ItemUsage.consumeHeldItem(world, user, hand); diff --git a/src/main/java/ladysnake/pickyourpoison/common/item/ThrowingDartItem.java b/src/main/java/ladysnake/pickyourpoison/common/item/ThrowingDartItem.java index d48f1f6..a70d679 100644 --- a/src/main/java/ladysnake/pickyourpoison/common/item/ThrowingDartItem.java +++ b/src/main/java/ladysnake/pickyourpoison/common/item/ThrowingDartItem.java @@ -137,7 +137,7 @@ public void buildTooltip(List list, float durationMultiplier) { @Override public ActionResult useOnEntity(ItemStack stack, PlayerEntity user, LivingEntity entity, Hand hand) { - if (entity instanceof PoisonDartFrogEntity && statusEffectInstance == null) { + if (entity instanceof PoisonDartFrogEntity poisonDartFrog && PoisonDartFrogEntity.getFrogPoisonEffect(poisonDartFrog.getPoisonDartFrogType()) != null && statusEffectInstance == null) { Item item = PickYourPoison.THROWING_DART; switch (((PoisonDartFrogEntity) entity).getPoisonDartFrogType()) { case BLUE -> item = PickYourPoison.COMATOSE_POISON_DART; diff --git a/src/main/resources/assets/pickyourpoison/lang/en_us.json b/src/main/resources/assets/pickyourpoison/lang/en_us.json index bc70996..1bd4d76 100644 --- a/src/main/resources/assets/pickyourpoison/lang/en_us.json +++ b/src/main/resources/assets/pickyourpoison/lang/en_us.json @@ -9,6 +9,7 @@ "item.pickyourpoison.crimson_poison_dart_frog_bowl": "Crimson Poison Dart Frog Bowl", "item.pickyourpoison.red_poison_dart_frog_bowl": "Red Poison Dart Frog Bowl", "item.pickyourpoison.luxalamander_bowl": "Luxalamander Bowl", + "item.pickyourpoison.rana_bowl": "Rana Bowl", "item.pickyourpoison.throwing_dart": "Throwing Dart", "item.pickyourpoison.comatose_poison_dart": "Poison Dart", "item.pickyourpoison.batrachotoxin_poison_dart": "Poison Dart", diff --git a/src/main/resources/assets/pickyourpoison/models/item/rana_bowl.json b/src/main/resources/assets/pickyourpoison/models/item/rana_bowl.json new file mode 100644 index 0000000..a355ac2 --- /dev/null +++ b/src/main/resources/assets/pickyourpoison/models/item/rana_bowl.json @@ -0,0 +1,6 @@ +{ + "parent": "minecraft:item/generated", + "textures": { + "layer0": "pickyourpoison:item/rana_bowl" + } +} \ No newline at end of file diff --git a/src/main/resources/assets/pickyourpoison/textures/entity/rana.png b/src/main/resources/assets/pickyourpoison/textures/entity/rana.png new file mode 100644 index 0000000000000000000000000000000000000000..e991022e0c97d6886e05b7e3d19607484873daed GIT binary patch literal 479 zcmeAS@N?(olHy`uVBq!ia0vp^3LwnE3?yBabR7dyjKx9jP7LeL$-D$|SkfJR9T^xl z_H+M9WCik_0(?ST4?0);k8Dj)3}GnOWbl+|PxWJ1?6#sM+hTjbnNaI9i|XE9p7a0f z+Qo7VRa&93m-{}RulxUf21By^|Ns9P+!BDsREk=HtP(2;@(TtEVgd%nO9!3+Rd5z~ zL>4nJ@ErnSMo|r~2A~63JY5_^Ed1Y2U@U4;;BlSk(XmZuozD0DS@lX*8z1}VUuaKm zurXBma__K+GLvSpSLU%tPOUFRW@s#(Gbxqr9ZTB*NvCaR6k0SHY7IF*PP(?GXO7^$ zeTHuo#g zZh{6G^9|2Qt?FNS%G|~0G|+7hH_1YWOA(}93eEzL z$YKTtzC$3)D5~Mr02D0tba4#P2#!7TkngYp2TOv@#-*z#m(6|uf0c7Y)}?O7_rDpx zx-*>!^ZNL;(TDTRqX4gSl1qIe5;pjFoJm;rmCZWi<2wbXJ-I$gjQTevzw+K&%DRGS zE7Pia3%|cB_I~DiabMYJmvjDGsnRbEj)D0zDjnY2?-u8uaprK?C7|^Tp00i_>zopr E04tP%+yDRo literal 0 HcmV?d00001