Skip to content

Commit

Permalink
add damagesource and delete unused Portals.java
Browse files Browse the repository at this point in the history
  • Loading branch information
warior456 committed Aug 22, 2024
1 parent 3487e10 commit b8b933f
Show file tree
Hide file tree
Showing 12 changed files with 61 additions and 55 deletions.
18 changes: 9 additions & 9 deletions src/main/java/net/ugi/sculk_depths/ModBiomeEffects.java
Original file line number Diff line number Diff line change
Expand Up @@ -31,15 +31,15 @@
public class ModBiomeEffects implements ServerTickEvents.StartWorldTick{

@Override
public void onStartTick(ServerWorld world) {//todo should be replaced with an actual effect
if(world.getTime()%10 != 0){
return;
}
List<ServerPlayerEntity> players = world.getPlayers(LivingEntity::isAlive);
for (ServerPlayerEntity player : players) {
if (world.getBiome(player.getBlockPos()).getKey().get() == ModBiomes.INFECTED_COLUMNS) {
player.addStatusEffect(new StatusEffectInstance(ModStatusEffects.INFECTED, 115, 0, true, true, true));
public void onStartTick(ServerWorld world) {
if(world.getTime()%10 != 0){
return;
}
List<ServerPlayerEntity> players = world.getPlayers(LivingEntity::isAlive);
for (ServerPlayerEntity player : players) {
if (world.getBiome(player.getBlockPos()).getKey().get() == ModBiomes.INFECTED_COLUMNS) {
player.addStatusEffect(new StatusEffectInstance(ModStatusEffects.INFECTED, 115, 0, true, true, true));
}
}
}
}
}
1 change: 0 additions & 1 deletion src/main/java/net/ugi/sculk_depths/SculkDepths.java
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@
import net.ugi.sculk_depths.item.ModItems;
import net.ugi.sculk_depths.item.crystal.CheckInvForCrystalItems;
import net.ugi.sculk_depths.particle.ModParticleTypes;
import net.ugi.sculk_depths.portal.Portals;
import net.ugi.sculk_depths.screen.ModScreenHandlers;
import net.ugi.sculk_depths.sound.ConditionalSoundPlayer;
import net.ugi.sculk_depths.sound.ModSounds;
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/net/ugi/sculk_depths/block/ModBlocks.java
Original file line number Diff line number Diff line change
Expand Up @@ -430,7 +430,7 @@ public class ModBlocks {
new ShroomBlock(AbstractBlock.Settings.copy(Blocks.MUSHROOM_STEM).nonOpaque()), ModItemGroup.SCULK_DEPTHS_BLOCKS);

public static final Block AURIC_SPORE_SPROUTS = registerBlock("auric_spore_sprouts",
new ShroomPlantBlock(AbstractBlock.Settings.copy(Blocks.BROWN_MUSHROOM).luminance((state)-> 0).noCollision().breakInstantly().sounds(BlockSoundGroup.WEEPING_VINES), ModConfiguredFeatures.AURIC_SHROOM) , ModItemGroup.SCULK_DEPTHS_BLOCKS);//todo
new ShroomPlantBlock(AbstractBlock.Settings.copy(Blocks.BROWN_MUSHROOM).luminance((state)-> 0).noCollision().breakInstantly().sounds(BlockSoundGroup.WEEPING_VINES), ModConfiguredFeatures.AURIC_SHROOM) , ModItemGroup.SCULK_DEPTHS_BLOCKS);

//fluids
public static final Block KRYSLUM = registerBlockWithoutBlockItem("kryslum", new FluidBlock(ModFluids.KRYSLUM_STILL, AbstractBlock.Settings.copy(Blocks.WATER).replaceable().noCollision().strength(100.0f).pistonBehavior(PistonBehavior.DESTROY).dropsNothing().liquid().solid().sounds(BlockSoundGroup.SCULK)), ModItemGroup.SCULK_DEPTHS_BLOCKS);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -155,11 +155,11 @@ public int findKryslumFlowBlock(BlockPos pos, int count){
private static int getCookTime(World world, ZygrinFurnaceBlockEntity furnace) {
SingleStackRecipeInput singleStackRecipeInput = new SingleStackRecipeInput(furnace.getStack(0));
return (Integer)furnace.matchGetter.getFirstMatch(singleStackRecipeInput, world).map((recipe) -> {
return (((AbstractCookingRecipe)recipe.value()).getCookingTime())/4;//furnace speed //todo test
return (((AbstractCookingRecipe)recipe.value()).getCookingTime())/4;//furnace speed
}).orElse(50);
}

public static void tick(World world, BlockPos pos, BlockState state, ZygrinFurnaceBlockEntity blockEntity) {//todo
public static void tick(World world, BlockPos pos, BlockState state, ZygrinFurnaceBlockEntity blockEntity) {
boolean bl4 = false;
boolean bl = blockEntity.isBurning();
boolean bl2 = false;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import net.minecraft.entity.LivingEntity;
import net.minecraft.entity.effect.StatusEffect;
import net.minecraft.entity.effect.StatusEffectCategory;
import net.ugi.sculk_depths.util.ModDamageTypes;

public class InfectedStatusEffect extends StatusEffect {
protected InfectedStatusEffect(StatusEffectCategory category, Integer color) {
Expand All @@ -22,7 +23,7 @@ public boolean applyUpdateEffect(LivingEntity entity, int amplifier) {
if(entity.getWorld().getTime()%40 != 0){
return true;
}
entity.damage(entity.getDamageSources().generic(), 0.75f);//TODO custom damagesource
entity.damage(ModDamageTypes.of(entity.getWorld(), ModDamageTypes.INFECTED_DAMAGE_TYPE), 0.75f);//TODO custom damagesource
return true;
}
}
4 changes: 2 additions & 2 deletions src/main/java/net/ugi/sculk_depths/fluid/KryslumFluid.java
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ protected void appendProperties(StateManager.Builder<Fluid, FluidState> builder)

@Override
protected int getMaxFlowDistance(WorldView world) {
return 4;//TODO CHECK THIS
return 4;
}

@Override
Expand All @@ -135,7 +135,7 @@ public int getLevel(FluidState state) {
public static class Still extends KryslumFluid {
@Override
protected int getMaxFlowDistance(WorldView world) {
return 4;//TODO CHECK THIS
return 4;
}

@Override
Expand Down
39 changes: 0 additions & 39 deletions src/main/java/net/ugi/sculk_depths/portal/Portals.java

This file was deleted.

21 changes: 21 additions & 0 deletions src/main/java/net/ugi/sculk_depths/util/ModDamageTypes.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
package net.ugi.sculk_depths.util;

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.world.World;
import net.ugi.sculk_depths.SculkDepths;

public class ModDamageTypes {

/*
* Store the RegistryKey of our DamageType into a new constant called CUSTOM_DAMAGE_TYPE
* The Identifier in use here points to our JSON file we created earlier.
*/
public static final RegistryKey<DamageType> INFECTED_DAMAGE_TYPE = RegistryKey.of(RegistryKeys.DAMAGE_TYPE, SculkDepths.identifier( "infected_damage_type"));

public static DamageSource of(World world, RegistryKey<DamageType> key) {
return new DamageSource(world.getRegistryManager().get(RegistryKeys.DAMAGE_TYPE).entryOf(key));
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"replace": false,
"values": [
"sculk_depths:infected_damage_type"
]
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"replace": false,
"values": [
"sculk_depths:infected_damage_type"
]
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"replace": false,
"values": [
"sculk_depths:infected_damage_type"
]
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"message_id": "infected",
"exhaustion": 0,
"scaling": "never",
"death_message_type": "default"
}

0 comments on commit b8b933f

Please sign in to comment.