Skip to content

Commit

Permalink
added localization for damage types
Browse files Browse the repository at this point in the history
  • Loading branch information
NewJumper committed Nov 8, 2023
1 parent 2beff02 commit 5db98a7
Show file tree
Hide file tree
Showing 6 changed files with 14 additions and 11 deletions.
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
// 1.20.1 2023-11-06T13:28:26.6147954 Languages: en_us
d0f2718edf354febe4e6d2c785da187d855d4b82 assets/deeperdarker/lang/en_us.json
// 1.20.1 2023-11-07T21:37:03.1844117 Languages: en_us
2b01eee16b8bfdae935bede62bf088252e69002f assets/deeperdarker/lang/en_us.json
2 changes: 2 additions & 0 deletions src/generated/resources/assets/deeperdarker/lang/en_us.json
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,8 @@
"block.deeperdarker.stripped_echo_log": "Stripped Echo Log",
"block.deeperdarker.stripped_echo_wood": "Stripped Echo Wood",
"block.deeperdarker.unlinked": "Unlinked transmitter",
"death.attack.jaw": "%1$s was trapped by a jaw",
"death.attack.ring": "%1$s heard the ring of %2$s",
"effect.deeperdarker.sculk_affinity": "Sculk Affinity",
"enchantment.deeperdarker.catalysis": "Catalysis",
"enchantment.deeperdarker.catalysis.desc": "Spreads sculk when mobs are killed.",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ public void stepOn(Level pLevel, BlockPos pPos, BlockState pState, Entity pEntit
if(pEntity instanceof Monster monster && monster.getMobType() == DDMobType.SCULK) return;
if(pState.getValue(CAN_BITE) && pEntity instanceof LivingEntity entity) {
pLevel.setBlock(pPos, pState.setValue(BITING, true), 3);
entity.hurt(DDDamageTypes.source(pLevel, DDDamageTypes.JAW), 3);
entity.hurt(DDDamageTypes.source(pLevel, DDDamageTypes.JAW, entity, null), 3);
pLevel.scheduleTick(pPos, this, 35);
}
}
Expand All @@ -48,7 +48,7 @@ public void tick(BlockState pState, ServerLevel pLevel, BlockPos pPos, RandomSou

@Override
public void entityInside(BlockState pState, Level pLevel, BlockPos pPos, Entity pEntity) {
if(pEntity instanceof LivingEntity entity) entity.hurt(DDDamageTypes.source(pLevel, DDDamageTypes.JAW), 3);
if(pEntity instanceof LivingEntity entity) entity.hurt(DDDamageTypes.source(pLevel, DDDamageTypes.JAW, entity, null), 3);
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ public void tick() {
this.rangedCooldown = 440;
} else if(this.rangedCooldown < 0 && !level().isClientSide()) {
for(Player player : players) {
player.hurt(DDDamageTypes.source(this.level(), DDDamageTypes.RING), 2);
player.hurt(DDDamageTypes.source(this.level(), DDDamageTypes.RING, player, this), 2);
}
if(this.rangedCooldown % 40 == 0 && level() instanceof ServerLevel serverLevel) {
int spawn = this.random.nextIntBetweenInclusive(1, 3);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,8 @@ protected void addTranslations() {
add("advancements." + DeeperDarker.MOD_ID + ".find_ancient_temple.description", "Explore the depths for a temple");
add("advancements." + DeeperDarker.MOD_ID + ".obtain_sculk_transmitter.title", "Remote Storage");
add("advancements." + DeeperDarker.MOD_ID + ".obtain_sculk_transmitter.description", "Acquire a Sculk Transmitter");
add("advancements." + DeeperDarker.MOD_ID + ".obtain_warden_staff.title", "Noise Complaint");
add("advancements." + DeeperDarker.MOD_ID + ".obtain_warden_staff.description", "Acquire a Sonorous Staff");
add("advancements." + DeeperDarker.MOD_ID + ".explore_otherside.title", "Echolocation");
add("advancements." + DeeperDarker.MOD_ID + ".explore_otherside.description", "Explore all Otherside biomes");
add("advancements." + DeeperDarker.MOD_ID + ".kill_all_sculk_mobs.title", "Sculk Slayer");
Expand All @@ -49,9 +51,6 @@ protected void addTranslations() {
add("advancements." + DeeperDarker.MOD_ID + ".obtain_reinforced_echo_shard.description", "Reinforce an Echo Shard");
add("advancements." + DeeperDarker.MOD_ID + ".warden_armor.title", "Cover Me with Sculk");
add("advancements." + DeeperDarker.MOD_ID + ".warden_armor.description", "Protect yourself with a full set of Warden Armor");
add("advancements." + DeeperDarker.MOD_ID + ".obtain_warden_staff.title", "Noise Complaint");
add("advancements." + DeeperDarker.MOD_ID + ".obtain_warden_staff.description", "Acquire a Sonorous Staff");


add("itemGroup." + DeeperDarker.MOD_ID, "Deeper and Darker");
add("block." + DeeperDarker.MOD_ID + ".linked", "Linked transmitter");
Expand All @@ -71,7 +70,8 @@ protected void addTranslations() {
add("biome." + DeeperDarker.MOD_ID + "." + OthersideBiomes.ECHOING_FOREST.location().getPath(), convertToName(OthersideBiomes.ECHOING_FOREST.location().getPath()));
add("biome." + DeeperDarker.MOD_ID + "." + OthersideBiomes.BLOOMING_CAVERNS.location().getPath(), convertToName(OthersideBiomes.BLOOMING_CAVERNS.location().getPath()));
add("biome." + DeeperDarker.MOD_ID + "." + OthersideBiomes.OVERCAST_COLUMNS.location().getPath(), convertToName(OthersideBiomes.OVERCAST_COLUMNS.location().getPath()));

add("death.attack.jaw", "%1$s was trapped by a jaw");
add("death.attack.ring", "%1$s heard the ring of %2$s");
add("enchantment." + DeeperDarker.MOD_ID + "." + DDEnchantments.CATALYSIS.getId().getPath() + ".desc", "Spreads sculk when mobs are killed.");
add("enchantment." + DeeperDarker.MOD_ID + "." + DDEnchantments.SCULK_SMITE.getId().getPath() + ".desc", "Increases damage against sculk mobs such as Shattered and the Warden.");

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
import net.minecraft.world.damagesource.DamageScaling;
import net.minecraft.world.damagesource.DamageSource;
import net.minecraft.world.damagesource.DamageType;
import net.minecraft.world.entity.Entity;
import net.minecraft.world.level.Level;

public class DDDamageTypes {
Expand All @@ -19,8 +20,8 @@ public static void bootstrap(BootstapContext<DamageType> context) {
context.register(RING, new DamageType("ring", 0.1f));
}

public static DamageSource source(Level level, ResourceKey<DamageType> damageType) {
return new DamageSource(level.registryAccess().registryOrThrow(Registries.DAMAGE_TYPE).getHolderOrThrow(damageType));
public static DamageSource source(Level level, ResourceKey<DamageType> damageType, Entity target, Entity attacker) {
return new DamageSource(level.registryAccess().registryOrThrow(Registries.DAMAGE_TYPE).getHolderOrThrow(damageType), target, attacker);
}

public static ResourceKey<DamageType> createKey(String name) {
Expand Down

0 comments on commit 5db98a7

Please sign in to comment.