diff --git a/CHANGELOG.md b/CHANGELOG.md index f45e61d..133fd12 100644 --- a/CHANGELOG.md +++ b/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 diff --git a/gradle.properties b/gradle.properties index 4f9d85e..4cfcf68 100644 --- a/gradle.properties +++ b/gradle.properties @@ -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 @@ -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 \ No newline at end of file diff --git a/src/main/java/ladysnake/impaled/common/damage/HellforkHeatDamageSource.java b/src/main/java/ladysnake/impaled/common/damage/HellforkHeatDamageSource.java new file mode 100644 index 0000000..b033d92 --- /dev/null +++ b/src/main/java/ladysnake/impaled/common/damage/HellforkHeatDamageSource.java @@ -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); + } +} diff --git a/src/main/java/ladysnake/impaled/common/item/HellforkItem.java b/src/main/java/ladysnake/impaled/common/item/HellforkItem.java index c29b93c..a8b2b8c 100644 --- a/src/main/java/ladysnake/impaled/common/item/HellforkItem.java +++ b/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; @@ -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; @@ -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; @@ -43,7 +41,17 @@ 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 @@ -51,7 +59,7 @@ public TypedActionResult use(World world, PlayerEntity user, Hand han 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); @@ -59,40 +67,15 @@ public TypedActionResult use(World world, PlayerEntity user, Hand han } } - @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")) { @@ -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; } diff --git a/src/main/java/ladysnake/impaled/mixin/impaling/EntityRendererMixin.java b/src/main/java/ladysnake/impaled/mixin/impaling/EntityRendererMixin.java new file mode 100644 index 0000000..b27b088 --- /dev/null +++ b/src/main/java/ladysnake/impaled/mixin/impaling/EntityRendererMixin.java @@ -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 { + @Inject(method = "getBlockLight", at = @At("HEAD"), cancellable = true) + protected void getBlockLight(T entity, BlockPos pos, CallbackInfoReturnable cir) { + if (entity instanceof LivingEntity livingEntity && livingEntity.isUsingRiptide() && (livingEntity.getMainHandStack().getItem() == ImpaledItems.HELLFORK || livingEntity.getOffHandStack().getItem() == ImpaledItems.HELLFORK)) { + cir.setReturnValue(15); + } + } +} diff --git a/src/main/resources/assets/impaled/lang/en_us.json b/src/main/resources/assets/impaled/lang/en_us.json index e502a12..5bb79b1 100644 --- a/src/main/resources/assets/impaled/lang/en_us.json +++ b/src/main/resources/assets/impaled/lang/en_us.json @@ -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" } \ No newline at end of file diff --git a/src/main/resources/impaled.mixins.json b/src/main/resources/impaled.mixins.json index e6dac98..82b1b1f 100644 --- a/src/main/resources/impaled.mixins.json +++ b/src/main/resources/impaled.mixins.json @@ -3,6 +3,7 @@ "package": "ladysnake.impaled.mixin", "compatibilityLevel": "JAVA_8", "client": [ + "impaling.EntityRendererMixin" ], "mixins": [ "EnchantmentTargetMixin", @@ -10,7 +11,6 @@ "LivingEntityMixin", "TridentEntityAccessor", "TridentRiptideFeatureRendererMixin", - "EnchantmentTargetMixin", "impaling.ImpalingEnchantmentMixin", "impaling.MobEntityMixin", "impaling.PlayerEntityMixin",