Skip to content

Commit

Permalink
Heated hellfork balance changes
Browse files Browse the repository at this point in the history
  • Loading branch information
doctor4t committed Mar 30, 2022
1 parent 2aee248 commit c0488a5
Show file tree
Hide file tree
Showing 7 changed files with 62 additions and 40 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
@@ -1,5 +1,10 @@
# Impaled - Changelog:

### Impaled 1.0.3 - 1.18.1
Introduces heated Hellfork balance changes:
- Heated Hellforks will no longer put their user on fire when held. No more awkward hotbar (haha) scrolls that put you on fire!
- Heated Hellforks with Riptide will now deal 2 (1 heart) damage upon use if the user is not already on fire. This damage bypasses armor and Protection enchantments, but can be avoided if the user has the fire resistance effect.

### Impaled 1.0.2 - 1.18
- Updated to Minecraft 1.18

Expand Down
6 changes: 3 additions & 3 deletions gradle.properties
Expand Up @@ -14,7 +14,7 @@ fabric_version=0.43.1+1.18


# Mod Properties
mod_version = 1.0.2
mod_version = 1.0.3
maven_group = io.github.ladysnake
archives_base_name = impaled

Expand All @@ -26,9 +26,9 @@ vanguard_version=1.0.+

#Publishing
owners = Ladysnake
license_header = CC-BY-NC-SA+4.0
license_header = ARR
curseforge_id = 478843
curseforge_versions = 1.18
curseforge_versions = 1.18.1
cf_requirements = fabric-api
release_type = release
changelog_url = https://github.com/Ladysnake/Impaled/blob/main/CHANGELOG.md
@@ -0,0 +1,11 @@
package ladysnake.impaled.common.damage;

import net.minecraft.entity.damage.DamageSource;

public class HellforkHeatDamageSource extends DamageSource {
public static final DamageSource HELLFORK_HEAT = ((HellforkHeatDamageSource)new HellforkHeatDamageSource("hellfork_heat").setBypassesArmor()).setUnblockable();

protected HellforkHeatDamageSource(String name) {
super(name);
}
}
55 changes: 19 additions & 36 deletions src/main/java/ladysnake/impaled/common/item/HellforkItem.java
@@ -1,6 +1,6 @@
package ladysnake.impaled.common.item;

import ladysnake.impaled.common.Impaled;
import ladysnake.impaled.common.damage.HellforkHeatDamageSource;
import ladysnake.impaled.common.entity.ImpaledTridentEntity;
import ladysnake.impaled.common.init.ImpaledItems;
import net.minecraft.block.Blocks;
Expand All @@ -9,12 +9,11 @@
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityType;
import net.minecraft.entity.LivingEntity;
import net.minecraft.entity.boss.BossBar;
import net.minecraft.entity.effect.StatusEffect;
import net.minecraft.entity.effect.StatusEffects;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.item.ItemGroup;
import net.minecraft.item.ItemStack;
import net.minecraft.item.ItemUsageContext;
import net.minecraft.particle.ParticleEffect;
import net.minecraft.particle.ParticleTypes;
import net.minecraft.sound.SoundCategory;
import net.minecraft.sound.SoundEvents;
Expand All @@ -24,7 +23,6 @@
import net.minecraft.util.Formatting;
import net.minecraft.util.Hand;
import net.minecraft.util.TypedActionResult;
import net.minecraft.util.collection.DefaultedList;
import net.minecraft.world.World;
import org.jetbrains.annotations.Nullable;

Expand All @@ -43,56 +41,41 @@ public boolean postHit(ItemStack stack, LivingEntity target, LivingEntity attack

@Override
protected boolean canRiptide(PlayerEntity playerEntity) {
return playerEntity.isInLava() || playerEntity.isOnFire();
return playerEntity.isInLava() || playerEntity.isOnFire() || (playerEntity.getMainHandStack().getItem() == ImpaledItems.HELLFORK && playerEntity.getMainHandStack().hasNbt() && playerEntity.getMainHandStack().getNbt().getBoolean("Heated")) || (playerEntity.getOffHandStack().getItem() == ImpaledItems.HELLFORK && playerEntity.getOffHandStack().hasNbt() && playerEntity.getOffHandStack().getNbt().getBoolean("Heated"));
}

@Override
public void onStoppedUsing(ItemStack stack, World world, LivingEntity user, int remainingUseTicks) {
super.onStoppedUsing(stack, world, user, remainingUseTicks);

if (!user.isOnFire() && stack.hasNbt() && stack.getNbt().getBoolean("Heated") && !user.hasStatusEffect(StatusEffects.FIRE_RESISTANCE)) {
user.damage(HellforkHeatDamageSource.HELLFORK_HEAT, 2f);
user.playSound(SoundEvents.ENTITY_PLAYER_HURT_ON_FIRE, 1.0f, 1.0f);
}
}

@Override
public TypedActionResult<ItemStack> use(World world, PlayerEntity user, Hand hand) {
ItemStack itemStack = user.getStackInHand(hand);
if (itemStack.getDamage() >= itemStack.getMaxDamage() - 1) {
return TypedActionResult.fail(itemStack);
} else if (EnchantmentHelper.getRiptide(itemStack) > 0 && !user.isInLava() && !user.isOnFire()) {
} else if (EnchantmentHelper.getRiptide(itemStack) > 0 && !user.isInLava() && !user.isOnFire() && !(itemStack.hasNbt() && itemStack.getNbt().getBoolean("Heated"))) {
return TypedActionResult.fail(itemStack);
} else {
user.setCurrentHand(hand);
return TypedActionResult.consume(itemStack);
}
}

@Override
public void inventoryTick(ItemStack stack, World world, Entity entity, int slot, boolean selected) {
if (entity instanceof LivingEntity) {
ItemStack hellfork = null;

if (((LivingEntity) entity).getMainHandStack().isOf(ImpaledItems.HELLFORK)) {
hellfork = ((LivingEntity) entity).getMainHandStack();
} else if (((LivingEntity) entity).getOffHandStack().isOf(ImpaledItems.HELLFORK)) {
hellfork = ((LivingEntity) entity).getOffHandStack();
}

if (hellfork != null) {
if (hellfork.getNbt() != null && hellfork.getNbt().contains("Heated")) {
if (hellfork.getNbt().getBoolean("Heated")) {
if (entity.getFireTicks() <= 0) {
entity.setFireTicks(35);
}
}
} else {
hellfork.getNbt().putBoolean("Heated", false);
}
}
}
}

@Override
public ActionResult useOnBlock(ItemUsageContext context) {
if (context.getWorld().getBlockState(context.getBlockPos()).getBlock() == Blocks.LAVA_CAULDRON && !context.getStack().getNbt().getBoolean("Heated")) {
context.getStack().getNbt().putBoolean("Heated", true);
if (context.getWorld().getBlockState(context.getBlockPos()).getBlock() == Blocks.LAVA_CAULDRON && (!context.getStack().hasNbt() || !context.getStack().getNbt().getBoolean("Heated"))) {
context.getStack().getOrCreateNbt().putBoolean("Heated", true);
context.getWorld().playSound(context.getPlayer().getX(), context.getPlayer().getY(), context.getPlayer().getZ(), SoundEvents.ITEM_FIRECHARGE_USE, SoundCategory.PLAYERS, 1.0f, 1.0f, false);
context.getWorld().playSound(context.getPlayer().getX(), context.getPlayer().getY(), context.getPlayer().getZ(), SoundEvents.BLOCK_ENCHANTMENT_TABLE_USE, SoundCategory.PLAYERS, 1.0f, 1.0f, false);
context.getWorld().setBlockState(context.getBlockPos(), Blocks.CAULDRON.getDefaultState());
for (int i = 0; i < 20; i++) {
context.getWorld().addParticle(ParticleTypes.LAVA, context.getBlockPos().getX()+.5+context.getWorld().getRandom().nextGaussian()/10, context.getBlockPos().getY()+.5+context.getWorld().getRandom().nextGaussian()/10, context.getBlockPos().getZ()+.5+context.getWorld().getRandom().nextGaussian()/10, 0, context.getWorld().getRandom().nextFloat()/10, 0);
context.getWorld().addParticle(ParticleTypes.LAVA, context.getBlockPos().getX() + .5 + context.getWorld().getRandom().nextGaussian() / 10, context.getBlockPos().getY() + .5 + context.getWorld().getRandom().nextGaussian() / 10, context.getBlockPos().getZ() + .5 + context.getWorld().getRandom().nextGaussian() / 10, 0, context.getWorld().getRandom().nextFloat() / 10, 0);
}
return ActionResult.SUCCESS;
} else if ((context.getWorld().getBlockState(context.getBlockPos()).getBlock() == Blocks.WATER_CAULDRON || context.getWorld().getBlockState(context.getBlockPos()).getBlock() == Blocks.POWDER_SNOW_CAULDRON) && context.getStack().getNbt().getBoolean("Heated")) {
Expand All @@ -101,7 +84,7 @@ public ActionResult useOnBlock(ItemUsageContext context) {
context.getWorld().playSound(context.getPlayer().getX(), context.getPlayer().getY(), context.getPlayer().getZ(), SoundEvents.BLOCK_ENCHANTMENT_TABLE_USE, SoundCategory.PLAYERS, 1.0f, 1.0f, false);
context.getWorld().setBlockState(context.getBlockPos(), Blocks.CAULDRON.getDefaultState());
for (int i = 0; i < 50; i++) {
context.getWorld().addParticle(ParticleTypes.SMOKE, context.getBlockPos().getX()+.5+context.getWorld().getRandom().nextGaussian()/10, context.getBlockPos().getY()+.5+context.getWorld().getRandom().nextGaussian()/10, context.getBlockPos().getZ()+.5+context.getWorld().getRandom().nextGaussian()/10, 0, context.getWorld().getRandom().nextFloat()/10, 0);
context.getWorld().addParticle(ParticleTypes.SMOKE, context.getBlockPos().getX() + .5 + context.getWorld().getRandom().nextGaussian() / 10, context.getBlockPos().getY() + .5 + context.getWorld().getRandom().nextGaussian() / 10, context.getBlockPos().getZ() + .5 + context.getWorld().getRandom().nextGaussian() / 10, 0, context.getWorld().getRandom().nextFloat() / 10, 0);
}
return ActionResult.SUCCESS;
}
Expand Down
@@ -0,0 +1,21 @@
package ladysnake.impaled.mixin.impaling;

import ladysnake.impaled.common.init.ImpaledItems;
import net.minecraft.client.render.entity.EntityRenderer;
import net.minecraft.entity.Entity;
import net.minecraft.entity.LivingEntity;
import net.minecraft.util.math.BlockPos;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;

@Mixin(EntityRenderer.class)
public class EntityRendererMixin<T extends Entity> {
@Inject(method = "getBlockLight", at = @At("HEAD"), cancellable = true)
protected void getBlockLight(T entity, BlockPos pos, CallbackInfoReturnable<Integer> cir) {
if (entity instanceof LivingEntity livingEntity && livingEntity.isUsingRiptide() && (livingEntity.getMainHandStack().getItem() == ImpaledItems.HELLFORK || livingEntity.getOffHandStack().getItem() == ImpaledItems.HELLFORK)) {
cir.setReturnValue(15);
}
}
}
2 changes: 2 additions & 0 deletions src/main/resources/assets/impaled/lang/en_us.json
Expand Up @@ -8,6 +8,8 @@

"tooltip.impaled.heated": "Heated",

"death.attack.hellfork_heat": "%1$s came in too hot",

"impaled:tooltip.owned_by": "(to %s)",
"impaled:trident_recall_fail": "Failed to recall your tridents"
}
2 changes: 1 addition & 1 deletion src/main/resources/impaled.mixins.json
Expand Up @@ -3,14 +3,14 @@
"package": "ladysnake.impaled.mixin",
"compatibilityLevel": "JAVA_8",
"client": [
"impaling.EntityRendererMixin"
],
"mixins": [
"EnchantmentTargetMixin",
"EntityMixin",
"LivingEntityMixin",
"TridentEntityAccessor",
"TridentRiptideFeatureRendererMixin",
"EnchantmentTargetMixin",
"impaling.ImpalingEnchantmentMixin",
"impaling.MobEntityMixin",
"impaling.PlayerEntityMixin",
Expand Down

0 comments on commit c0488a5

Please sign in to comment.