Fixed crash on death for servers

Fixed an issue where the client would crash when you died by the Sacrificial Knife when on a server.
This commit is contained in:
WayofTime 2020-10-26 16:08:04 -04:00
parent ec1b0644cb
commit 152525bbe3
6 changed files with 8 additions and 6 deletions

View file

@ -13,7 +13,7 @@ apply plugin: 'net.minecraftforge.gradle'
apply plugin: 'eclipse'
apply plugin: 'maven-publish'
version = '1.16.3-3.0-1'
version = '1.16.3-3.0-2'
group = 'com.yourname.modid' // http://maven.apache.org/guides/mini/guide-naming-conventions.html
archivesBaseName = 'BloodMagic'

View file

@ -18,7 +18,7 @@ e1a98bd53fca155e4bbb03c1e548341af0f84bd7 assets/bloodmagic/blockstates/masterrit
b03040d7a168653bf8df3600033b8fde2383db30 assets/bloodmagic/blockstates/selfsacrificerune.json
487ffdc02ab7b65aafcb932e3b5cf6ea0500b21d assets/bloodmagic/blockstates/speedrune.json
e6d9cf699667aaa47efff37b2b033895dee29c15 assets/bloodmagic/blockstates/waterritualstone.json
af6eebbeef7c75844a0651065016fecb365595dd assets/bloodmagic/lang/en_us.json
775f7c01fb20ba9b55ff5c46d7fef0acd5f591ae assets/bloodmagic/lang/en_us.json
34445195b9f2459475cde53454bc8e37d32865d7 assets/bloodmagic/models/block/accelerationrune.json
bcdbccc49d4509571be6988762ab87126275a4c8 assets/bloodmagic/models/block/airritualstone.json
adf6c0b1e25451609486dc8c8cfbd9cf0f8c67f4 assets/bloodmagic/models/block/alchemicalreactionchamber.json

View file

@ -19,6 +19,7 @@
"block.bloodmagic.soulforge": "Hellfire Forge",
"block.bloodmagic.speedrune": "Speed Rune",
"block.bloodmagic.waterritualstone": "Water Ritual Stone",
"chat.bloodmagic.damageSource": "%s's soul became too weak",
"chat.bloodmagic.ritual.activate": "A rush of energy flows through the ritual!",
"chat.bloodmagic.ritual.notValid": "You feel that these runes are not configured correctly...",
"chat.bloodmagic.ritual.prevent": "The ritual is actively resisting you!",

View file

@ -3,8 +3,7 @@ package wayoftime.bloodmagic.util;
import net.minecraft.entity.LivingEntity;
import net.minecraft.util.DamageSource;
import net.minecraft.util.text.ITextComponent;
import net.minecraft.util.text.StringTextComponent;
import wayoftime.bloodmagic.util.helper.TextHelper;
import net.minecraft.util.text.TranslationTextComponent;
public class DamageSourceBloodMagic extends DamageSource
{
@ -21,6 +20,6 @@ public class DamageSourceBloodMagic extends DamageSource
@Override
public ITextComponent getDeathMessage(LivingEntity livingBase)
{
return new StringTextComponent(TextHelper.localizeEffect("chat.bloodmagic.damageSource", livingBase.getName()));
return new TranslationTextComponent("chat.bloodmagic.damageSource", livingBase.getName());
}
}

View file

@ -19,6 +19,8 @@ public class GeneratorLanguage extends LanguageProvider
// Creative Tab
add("itemGroup.bloodmagic.creativeTab", "Blood Magic");
add("chat.bloodmagic.damageSource", "%s's soul became too weak");
// Tile Entitites
add("tile.bloodmagic.soulforge.name", "Hellfire Forge");

View file

@ -102,7 +102,7 @@ public class ItemSacrificialDagger extends Item
player.hurtResistantTime = 0;
player.attackEntityFrom(DamageSourceBloodMagic.INSTANCE, 0.001F);
player.setHealth(Math.max(player.getHealth() - 1.998F, 0.0001f));
if (player.getHealth() <= 0.001f)
if (player.getHealth() <= 0.001f && !world.isRemote)
{
player.onDeath(DamageSourceBloodMagic.INSTANCE);
player.setHealth(0);