Skip to content

Commit

Permalink
Add rana frog
Browse files Browse the repository at this point in the history
  • Loading branch information
doctor4t committed Apr 19, 2022
1 parent dbdb3af commit 19db556
Show file tree
Hide file tree
Showing 11 changed files with 34 additions and 7 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -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

Expand Down
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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<PoisonDartFrogEntity> POISON_DART_FROG;
Expand All @@ -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;
Expand Down Expand Up @@ -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
};
}

Expand Down Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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);
Expand Down Expand Up @@ -294,7 +304,8 @@ public enum Type {
ORANGE,
CRIMSON,
RED,
LUXINTRUS
LUXINTRUS,
RANA
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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())));
}

Expand Down Expand Up @@ -111,7 +113,7 @@ public SoundEvent getEatSound() {
}

public TypedActionResult<ItemStack> 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);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ public void buildTooltip(List<Text> 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;
Expand Down
1 change: 1 addition & 0 deletions src/main/resources/assets/pickyourpoison/lang/en_us.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"parent": "minecraft:item/generated",
"textures": {
"layer0": "pickyourpoison:item/rana_bowl"
}
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 19db556

Please sign in to comment.