Skip to content

Commit

Permalink
agony damagetype
Browse files Browse the repository at this point in the history
adenator was crushed by grief (also a few other things)
  • Loading branch information
adenator0 committed Dec 8, 2024
1 parent 9a27de8 commit 4face35
Show file tree
Hide file tree
Showing 8 changed files with 39 additions and 2 deletions.
Binary file modified README.md
Binary file not shown.
Binary file added image.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 2 additions & 0 deletions src/main/java/com/nuclearcrackhead/serverboss/SVBCR.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import com.nuclearcrackhead.serverboss.registry.ModBlocks;
import com.nuclearcrackhead.serverboss.registry.ModFluids;
import com.nuclearcrackhead.serverboss.registry.ModItems;
import com.nuclearcrackhead.serverboss.registry.ModDamageTypes;
import net.fabricmc.api.ModInitializer;

import net.minecraft.util.Identifier;
Expand All @@ -23,5 +24,6 @@ public void onInitialize() {
ModItems.init();
ModFluids.init();
ModBlocks.init();
ModDamageTypes.init();
}
}
Original file line number Diff line number Diff line change
@@ -1,13 +1,16 @@
package com.nuclearcrackhead.serverboss.content.block;

import com.nuclearcrackhead.serverboss.registry.ModDamageTypes;
import net.minecraft.block.AbstractBlock;
import net.minecraft.block.Block;
import com.mojang.serialization.MapCodec;
import net.minecraft.block.BlockState;
import net.minecraft.entity.Entity;
import net.minecraft.entity.LivingEntity;
import net.minecraft.registry.RegistryKeys;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;
import net.minecraft.entity.damage.DamageSource;

public class Agony extends Block {
public static final MapCodec<Agony> CODEC = createCodec(Agony::new);
Expand All @@ -22,7 +25,11 @@ public Agony(AbstractBlock.Settings settings) {

public void onSteppedOn(World world, BlockPos pos, BlockState state, Entity entity) {
if (!entity.bypassesSteppingEffects() && entity instanceof LivingEntity livingEntity) {
livingEntity.serverDamage(world.getDamageSources().hotFloor(), livingEntity.getMaxHealth() / 7);
//DamageSource damageSource = new DamageSource(
// world.getRegistryManager()
// .get(RegistryKeys.DAMAGE_TYPE) //incoherent as hell
// .entryOf(ModDamageTypes.AGONY_DAMAGE));
livingEntity.serverDamage(entity.getDamageSources().create(ModDamageTypes.AGONY_DAMAGE, null), livingEntity.getMaxHealth() / 7);
}

super.onSteppedOn(world, pos, state, entity);
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
package com.nuclearcrackhead.serverboss.registry;

import net.minecraft.entity.Entity;
import net.minecraft.entity.damage.DamageSource;
import net.minecraft.entity.damage.DamageType;
import net.minecraft.registry.RegistryKey;
import net.minecraft.registry.RegistryKeys;
import net.minecraft.util.Identifier;

public class ModDamageTypes {

public static void init() {}

public static final RegistryKey<DamageType> AGONY_DAMAGE = RegistryKey.of(RegistryKeys.DAMAGE_TYPE, Identifier.of("svbcr", "agony"));

}
4 changes: 3 additions & 1 deletion src/main/resources/assets/svbcr/lang/en_us.json
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
{
"block.svbcr.example_block": "Example Block",
"block.svbcr.agony": "Agony",
"item.svbcr.example_item": "Example Item",
"block.svbcr.radioactive": "Radioactive Waste",
"block.svbcr.sludge": "Sludge",
"block.svbcr.wastebarrel": "Large Radioactive Waste Barrel",
"item.svbcr.radioactive_bucket": "Radioactive Waste Barrel",
"item.svbcr.example_item": "Example Item"
"death.attack.agony": "%s was crushed by grief",
"death.attack.agony.player": "%s was crushed by grief whilst trying to escape %s"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"values": [
"svbcr:agony"
]
}
5 changes: 5 additions & 0 deletions src/main/resources/data/svbcr/damage_type/agony.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"exhaustion": 0.3,
"message_id": "agony",
"scaling": "never"
}

0 comments on commit 4face35

Please sign in to comment.