Skip to content

Commit

Permalink
feat: rework Long Claws into Ravenous Claws
Browse files Browse the repository at this point in the history
  • Loading branch information
Elenterius committed Jun 13, 2023
1 parent 8fb9bc3 commit 0b619b0
Show file tree
Hide file tree
Showing 31 changed files with 1,933 additions and 1,309 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
import com.github.elenterius.biomancy.item.ICustomTooltip;
import com.github.elenterius.biomancy.item.MaykerBannerPatternItem;
import com.github.elenterius.biomancy.item.SerumItem;
import com.github.elenterius.biomancy.item.state.LivingToolState;
import com.github.elenterius.biomancy.item.livingtool.LivingToolState;
import com.github.elenterius.biomancy.styles.TextComponentUtil;
import net.minecraft.data.CachedOutput;
import net.minecraft.data.DataGenerator;
Expand Down Expand Up @@ -197,9 +197,9 @@ protected void addTranslations() {
// addTooltip("projectile_damage", "Projectile Damage");

add(LivingToolState.getTooltipTranslationKey(), "The Tool is %1$s");
add(LivingToolState.BROKEN.getTranslationKey(), "Broken");
add(LivingToolState.DORMANT.getTranslationKey(), "Dormant");
add(LivingToolState.AWAKE.getTranslationKey(), "Awake");
add(LivingToolState.EXALTED.getTranslationKey(), "Exalted");
add(LivingToolState.AWAKENED.getTranslationKey(), "Awakened");

addHudMessage("not_sleepy", "You don't feel sleepy...");
// addHudMessage("set_behavior_command", "%1$s will now execute the %2$s command");
Expand Down Expand Up @@ -366,7 +366,10 @@ private void addItemTranslations() {
Right Click the Sac to retrieve the Items.""");

addItem(ModItems.LONG_CLAWS, "Living Long Claws", "Claws made of living flesh\n\nFeed it with nutrients via right click in the inventory.");
addItem(ModItems.RAVENOUS_CLAWS, "Ravenous Claws [Rework v1]", """
Extremely hungry and vicious Claws forged by starving living flesh and grafting claws onto them.
Feed the famished claws by killing Mobs or feed them with food via the player inventory.""");
addItem(ModItems.DEV_ARM_CANNON, "[Dev Tool] Arm Cannon", "Creative/Developer Tool for testing projectiles.");
addItem(ModItems.BILE_SPITTER, "[WIP] Bile Spitter", "[WIP] \"living\" projectile weapon that shoots corrosive bile.\nIntended behaviour: charge it like a bow to increase damageShape & size of projectile.");

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -941,7 +941,7 @@ private void registerBioForgeRecipes(Consumer<FinishedRecipe> consumer) {

//////////// WEAPONS ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////

BioForgeRecipeBuilder.create(new ItemData(ModItems.LONG_CLAWS.get()))
BioForgeRecipeBuilder.create(new ItemData(ModItems.RAVENOUS_CLAWS.get()))
.addIngredient(ModItems.LIVING_FLESH.get())
.addIngredient(ModItems.BONE_FRAGMENTS.get(), 4)
.addIngredient(ModItems.FLESH_BITS.get(), 16)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ private void addForgeTags() {

TagKey<Item> clawsTag = forgeTag("tools/claws");
tag(clawsTag)
.add(ModItems.LONG_CLAWS.get());
.add(ModItems.RAVENOUS_CLAWS.get());

tag(Tags.Items.TOOLS_SWORDS)
.add(ModItems.DESPOIL_SICKLE.get());
Expand Down
10 changes: 5 additions & 5 deletions src/generated/resources/assets/biomancy/lang/en_us.json
Original file line number Diff line number Diff line change
Expand Up @@ -74,8 +74,8 @@
"item.biomancy.fertilizer.tooltip": "Fertilizer that induces hyper-growth in plants, even for reeds, cactus, nether wart and chorus plant.",
"item.biomancy.gift_sac": "Gift Sac",
"item.biomancy.gift_sac.tooltip": "Looks like some objects are wrapped in an organic layer of skin. It's either filled with items or toxin if your language is set to German.\n\nRight Click the Sac to retrieve the Items.",
"item.biomancy.long_claws": "Living Long Claws",
"item.biomancy.long_claws.tooltip": "Claws made of living flesh\n\nFeed it with nutrients via right click in the inventory.",
"item.biomancy.ravenous_claws": "Ravenous Claws [Rework v1]",
"item.biomancy.ravenous_claws.tooltip": "Extremely hungry and vicious Claws forged by starving living flesh and grafting claws onto them.\n\nFeed the famished claws by killing Mobs or feed them with food via the player inventory.",
"item.biomancy.dev_arm_cannon": "[Dev Tool] Arm Cannon",
"item.biomancy.dev_arm_cannon.tooltip": "Creative/Developer Tool for testing projectiles.",
"item.biomancy.bile_spitter": "[WIP] Bile Spitter",
Expand Down Expand Up @@ -221,7 +221,7 @@
"effect.biomancy.essence_anemia": "[PH] Essence Anemia",
"serum.biomancy.empty": "ERROR: INVALID SERUM",
"death.attack.biomancy.chest_bite": "%1$s tried touching a chest but was eaten instead",
"death.attack.biomancy.creator_spikes": "%1$s angered the Maykrs and was impaled by bone spikes",
"death.attack.biomancy.primordial_spikes": "%1$s was impaled by primordial spikes",
"death.attack.biomancy.spike_fall_on": "%1$s fell on a sharp spike",
"death.attack.biomancy.spike_impale": "%1$s was skewered by a sharp spike",
"death.attack.biomancy.corrosive_acid": "%1$s died from severe acid burns",
Expand Down Expand Up @@ -251,9 +251,9 @@
"tooltip.biomancy.action.reload": "reload",
"tooltip.biomancy.action.cycle": "cycle",
"tooltip.biomancy.living_tool_state_is": "The Tool is %1$s",
"state.biomancy.living_tool.broken": "Broken",
"state.biomancy.living_tool.dormant": "Dormant",
"state.biomancy.living_tool.awake": "Awake",
"state.biomancy.living_tool.exalted": "Exalted",
"state.biomancy.living_tool.awakened": "Awakened",
"msg.biomancy.not_sleepy": "You don't feel sleepy...",
"msg.biomancy.not_enough_nutrients": "Not enough Nutrients",
"keyboard.biomancy.ctrl": "ctrl",
Expand Down

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
package com.github.elenterius.biomancy.client.render.item.ravenousclaws;

import com.github.elenterius.biomancy.BiomancyMod;
import com.github.elenterius.biomancy.item.weapon.RavenousClawsItem;
import net.minecraft.resources.ResourceLocation;
import software.bernie.geckolib3.model.AnimatedGeoModel;

public class RavenousClawsModel extends AnimatedGeoModel<RavenousClawsItem> {

protected static final ResourceLocation MODEL = BiomancyMod.createRL("geo/item/ravenous_claws.geo.json");
protected static final ResourceLocation TEXTURE = BiomancyMod.createRL("textures/item/weapon/ravenous_claws.png");
protected static final ResourceLocation ANIMATION = BiomancyMod.createRL("animations/item/ravenous_claws.animation.json");

@Override
public ResourceLocation getModelResource(RavenousClawsItem item) {
return MODEL;
}

@Override
public ResourceLocation getTextureResource(RavenousClawsItem item) {
return TEXTURE;
}

@Override
public ResourceLocation getAnimationResource(RavenousClawsItem item) {
return ANIMATION;
}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
package com.github.elenterius.biomancy.client.render.item.ravenousclaws;

import com.github.elenterius.biomancy.item.weapon.RavenousClawsItem;
import software.bernie.geckolib3.renderers.geo.GeoItemRenderer;

public class RavenousClawsRenderer extends GeoItemRenderer<RavenousClawsItem> {

public RavenousClawsRenderer() {
super(new RavenousClawsModel());
}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
@ParametersAreNonnullByDefault
@MethodsReturnNonnullByDefault
package com.github.elenterius.biomancy.client.render.item.ravenousclaws;

import net.minecraft.MethodsReturnNonnullByDefault;

import javax.annotation.ParametersAreNonnullByDefault;
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

import com.github.elenterius.biomancy.BiomancyMod;
import com.github.elenterius.biomancy.init.ModCapabilities;
import com.github.elenterius.biomancy.item.weapon.ICriticalHitEntity;
import com.github.elenterius.biomancy.item.weapon.CriticalHitEntityAction;
import net.minecraft.world.entity.LivingEntity;
import net.minecraft.world.item.ItemStack;
import net.minecraftforge.event.entity.living.LivingKnockBackEvent;
Expand All @@ -21,16 +21,14 @@ private AttackHandler() {}
public static void onCriticalHit(final CriticalHitEvent event) {
if (event.getDamageModifier() > 0 && event.getTarget() instanceof LivingEntity target && (event.getResult() == Event.Result.ALLOW || event.isVanillaCritical() && event.getResult() == Event.Result.DEFAULT)) {
ItemStack heldStack = ((LivingEntity)event.getTarget()).getMainHandItem();
if (heldStack.getItem() instanceof ICriticalHitEntity listener) {
if (heldStack.getItem() instanceof CriticalHitEntityAction listener) {
listener.onCriticalHitEntity(heldStack, event.getEntity(), target);
}
}
}

@SubscribeEvent
@SubscribeEvent(receiveCanceled = false)
public static void onKnockback(final LivingKnockBackEvent event) {
if (event.isCanceled()) return;

event.getEntity().getCapability(ModCapabilities.NO_KNOCKBACK_FLAG_CAP).ifPresent(flag -> {
if (flag.isEnabled()) {
flag.disable();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,8 @@ public static void handleMissingItems(List<Mapping<Item>> mappings) {
for (Mapping<Item> mapping : mappings) {
String path = mapping.getKey().getPath();
switch (path) {
case "long_claws" -> mapping.remap(ModItems.RAVENOUS_CLAWS.get());

case "mascot_pattern", "mascot_outline_pattern", "mascot_accent_pattern" -> mapping.remap(ModItems.MASCOT_BANNER_PATTERNS.get());

case "bio_lantern" -> mapping.remap(ModItems.YELLOW_BIO_LANTERN.get());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ public final class ModBioForgeTabs {

public static final RegistryObject<BioForgeTab> BLOCKS = register("blocks", ModItems.FLESH_BLOCK);
public static final RegistryObject<BioForgeTab> MACHINES = register("machines", ModItems.DECOMPOSER);
public static final RegistryObject<BioForgeTab> WEAPONS = register("weapons", ModItems.LONG_CLAWS);
public static final RegistryObject<BioForgeTab> WEAPONS = register("weapons", ModItems.RAVENOUS_CLAWS);

private ModBioForgeTabs() {}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
import com.github.elenterius.biomancy.item.weapon.BileSpitterItem;
import com.github.elenterius.biomancy.item.weapon.DespoilingSwordItem;
import com.github.elenterius.biomancy.item.weapon.DevArmCannonItem;
import com.github.elenterius.biomancy.item.weapon.LivingLongClawsItem;
import com.github.elenterius.biomancy.item.weapon.RavenousClawsItem;
import net.minecraft.tags.TagKey;
import net.minecraft.util.Mth;
import net.minecraft.world.entity.EntityType;
Expand Down Expand Up @@ -100,7 +100,7 @@ public final class ModItems {

//# Weapons
public static final RegistryObject<DespoilingSwordItem> DESPOIL_SICKLE = registerItem("despoil_sickle", props -> SwordSmithy.forge(DespoilingSwordItem::new, ModTiers.BRITTLE, 10, 1, props.setNoRepair()));
public static final RegistryObject<LivingLongClawsItem> LONG_CLAWS = registerItem("long_claws", props -> new LivingLongClawsItem(ModTiers.BIOFLESH, -2, -2.4f, 0.5f, 1000, props.setNoRepair().rarity(ModRarities.VERY_RARE)));
public static final RegistryObject<RavenousClawsItem> RAVENOUS_CLAWS = registerItem("ravenous_claws", props -> new RavenousClawsItem(ModTiers.BIOFLESH, 5, 5, 1000, props.setNoRepair().rarity(ModRarities.VERY_RARE)));
public static final RegistryObject<DevArmCannonItem> DEV_ARM_CANNON = registerItem("dev_arm_cannon", props -> new DevArmCannonItem(props.stacksTo(1).durability(ModTiers.BIOFLESH.getUses()).rarity(ModRarities.ULTRA_RARE).tab(null)));
public static final RegistryObject<BileSpitterItem> BILE_SPITTER = registerItem("bile_spitter", props -> new BileSpitterItem(props.stacksTo(1).durability(ModTiers.BIOFLESH.getUses()).rarity(ModRarities.ULTRA_RARE).tab(null)));

Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
package com.github.elenterius.biomancy.item.weapon;
package com.github.elenterius.biomancy.item.livingtool;

import com.github.elenterius.biomancy.chat.ComponentUtil;
import com.github.elenterius.biomancy.client.util.ClientTextUtil;
import com.github.elenterius.biomancy.entity.MobUtil;
import com.github.elenterius.biomancy.item.IKeyListener;
import com.github.elenterius.biomancy.item.ILivingToolItem;
import com.github.elenterius.biomancy.item.state.LivingToolState;
import com.github.elenterius.biomancy.item.weapon.SimpleClawsItem;
import com.github.elenterius.biomancy.styles.ColorStyles;
import com.github.elenterius.biomancy.styles.TextComponentUtil;
import net.minecraft.core.BlockPos;
Expand All @@ -32,7 +31,7 @@

import java.util.List;

public class LivingClawsItem extends SimpleClawsItem implements ILivingToolItem, IKeyListener {
public class LivingClawsItem extends SimpleClawsItem implements LivingTool, IKeyListener {

private final int maxNutrients;

Expand Down Expand Up @@ -76,7 +75,7 @@ public boolean mineBlock(ItemStack stack, Level level, BlockState state, BlockPo
@Override
public float getDestroySpeed(ItemStack stack, BlockState state) {
LivingToolState toolState = getLivingToolState(stack);
return toolState == LivingToolState.DORMANT ? 1f : super.getDestroySpeed(stack, state);
return toolState == LivingToolState.BROKEN ? 1f : super.getDestroySpeed(stack, state);
}

@Override
Expand Down Expand Up @@ -113,8 +112,8 @@ public int getLivingToolActionCost(ItemStack livingTool, LivingToolState state,
if (toolAction == ToolActions.SWORD_SWEEP) baseCost = 1;

return switch (state) {
case EXALTED -> baseCost + 4;
case AWAKE -> baseCost + 1;
case AWAKENED -> baseCost + 4;
case DORMANT -> baseCost + 1;
default -> baseCost;
};
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,10 @@
package com.github.elenterius.biomancy.item.weapon;
package com.github.elenterius.biomancy.item.livingtool;

import com.github.elenterius.biomancy.chat.ComponentUtil;
import com.github.elenterius.biomancy.client.util.ClientTextUtil;
import com.github.elenterius.biomancy.entity.MobUtil;
import com.github.elenterius.biomancy.item.ICustomTooltip;
import com.github.elenterius.biomancy.item.IKeyListener;
import com.github.elenterius.biomancy.item.ILivingToolItem;
import com.github.elenterius.biomancy.item.state.LivingToolState;
import com.github.elenterius.biomancy.styles.ColorStyles;
import com.github.elenterius.biomancy.styles.TextComponentUtil;
import net.minecraft.core.BlockPos;
Expand Down Expand Up @@ -34,7 +32,7 @@

import java.util.List;

public class LivingSwordItem extends SwordItem implements ICustomTooltip, ILivingToolItem, IKeyListener {
public class LivingSwordItem extends SwordItem implements ICustomTooltip, LivingTool, IKeyListener {

private final int maxNutrients;

Expand Down Expand Up @@ -78,7 +76,7 @@ public boolean mineBlock(ItemStack stack, Level level, BlockState state, BlockPo
@Override
public float getDestroySpeed(ItemStack stack, BlockState state) {
LivingToolState toolState = getLivingToolState(stack);
return toolState == LivingToolState.DORMANT ? 1f : super.getDestroySpeed(stack, state);
return toolState == LivingToolState.BROKEN ? 1f : super.getDestroySpeed(stack, state);
}

@Override
Expand Down Expand Up @@ -115,8 +113,8 @@ public int getLivingToolActionCost(ItemStack stack, LivingToolState state, ToolA
if (toolAction == ToolActions.SWORD_SWEEP) baseCost = 1;

return switch (state) {
case EXALTED -> baseCost + 4;
case AWAKE -> baseCost + 1;
case AWAKENED -> baseCost + 4;
case DORMANT -> baseCost + 1;
default -> baseCost;
};
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
package com.github.elenterius.biomancy.item;
package com.github.elenterius.biomancy.item.livingtool;

import com.github.elenterius.biomancy.chat.ComponentUtil;
import com.github.elenterius.biomancy.client.util.ClientTextUtil;
import com.github.elenterius.biomancy.init.ModSoundEvents;
import com.github.elenterius.biomancy.item.state.LivingToolState;
import com.github.elenterius.biomancy.item.INutrientsContainerItem;
import com.github.elenterius.biomancy.styles.TextStyles;
import com.github.elenterius.biomancy.util.SoundUtil;
import net.minecraft.ChatFormatting;
Expand All @@ -23,7 +23,7 @@
import java.util.Set;
import java.util.stream.Collectors;

public interface ILivingToolItem extends INutrientsContainerItem {
public interface LivingTool extends INutrientsContainerItem {
Set<Enchantment> INVALID_ENCHANTMENTS = Set.of(Enchantments.FLAMING_ARROWS, Enchantments.FIRE_ASPECT);

default LivingToolState getLivingToolState(ItemStack livingTool) {
Expand All @@ -43,12 +43,12 @@ default void updateLivingToolState(ItemStack livingTool, ServerLevel level, Play
LivingToolState state = getLivingToolState(livingTool);
boolean hasNutrients = hasNutrients(livingTool);

if (state == LivingToolState.AWAKE) {
setLivingToolState(livingTool, hasNutrients ? LivingToolState.EXALTED : LivingToolState.DORMANT);
if (state == LivingToolState.DORMANT) {
setLivingToolState(livingTool, hasNutrients ? LivingToolState.AWAKENED : LivingToolState.BROKEN);
SoundUtil.broadcastItemSound(level, player, ModSoundEvents.FLESH_BLOCK_PLACE.get());
}
else if (state == LivingToolState.EXALTED) {
setLivingToolState(livingTool, hasNutrients ? LivingToolState.AWAKE : LivingToolState.DORMANT);
else if (state == LivingToolState.AWAKENED) {
setLivingToolState(livingTool, hasNutrients ? LivingToolState.DORMANT : LivingToolState.BROKEN);
SoundUtil.broadcastItemSound(level, player, ModSoundEvents.FLESH_BLOCK_HIT.get());
}
}
Expand Down Expand Up @@ -77,19 +77,19 @@ default void onNutrientsChanged(ItemStack livingTool, int oldValue, int newValue
LivingToolState state = prevState;

if (newValue <= 0) {
if (state != LivingToolState.DORMANT) setLivingToolState(livingTool, LivingToolState.DORMANT);
if (state != LivingToolState.BROKEN) setLivingToolState(livingTool, LivingToolState.BROKEN);
return;
}

if (state == LivingToolState.DORMANT) {
state = LivingToolState.AWAKE;
if (state == LivingToolState.BROKEN) {
state = LivingToolState.DORMANT;
}

int maxCost = getLivingToolMaxActionCost(livingTool, state);

if (newValue < maxCost) {
if (state == LivingToolState.EXALTED) state = LivingToolState.AWAKE;
else if (state == LivingToolState.AWAKE) state = LivingToolState.DORMANT;
if (state == LivingToolState.AWAKENED) state = LivingToolState.DORMANT;
else if (state == LivingToolState.DORMANT) state = LivingToolState.BROKEN;
}

if (state != prevState) setLivingToolState(livingTool, state);
Expand Down
Loading

0 comments on commit 0b619b0

Please sign in to comment.