Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ org.gradle.jvmargs=-Xmx2G
archives_base_name = astraladditions

# Dependencies
fabric_version=0.76.0+1.18.2
fabric_version=0.77.0+1.18.2

# Development QOL
modmenu_version=3.2.5
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
package com.github.ethanicuss.astraladditions.blocks;

import com.github.ethanicuss.astraladditions.util.ModUtils;
import net.minecraft.block.Block;
import net.minecraft.block.BlockState;
import net.minecraft.block.Blocks;
import net.minecraft.block.Material;
import net.minecraft.entity.Entity;
import net.minecraft.entity.FallingBlockEntity;
import net.minecraft.particle.ParticleTypes;
import net.minecraft.server.world.ServerWorld;
import net.minecraft.tag.BlockTags;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;

public class BubbleBlock extends Block {

public BubbleBlock(Settings settings) {
super(settings);
}

public void onSteppedOn(World world, BlockPos pos, BlockState state, Entity entity) {
world.setBlockState(pos, Blocks.AIR.getDefaultState());
ModUtils.spawnForcedParticles((ServerWorld)world, ParticleTypes.BUBBLE, pos.getX(), pos.getY(), pos.getZ(), 10, 0.8, 0.8, 0.8, 0.1);
ModUtils.spawnForcedParticles((ServerWorld)world, ParticleTypes.SPLASH, pos.getX(), pos.getY(), pos.getZ(), 10, 0.8, 0.8, 0.8, 0.1);

super.onSteppedOn(world, pos, state, entity);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
package com.github.ethanicuss.astraladditions.blocks;

import com.github.ethanicuss.astraladditions.util.ModUtils;
import net.minecraft.block.Block;
import net.minecraft.block.BlockState;
import net.minecraft.block.Material;
import net.minecraft.enchantment.EnchantmentHelper;
import net.minecraft.entity.Entity;
import net.minecraft.entity.FallingBlockEntity;
import net.minecraft.entity.LivingEntity;
import net.minecraft.entity.damage.DamageSource;
import net.minecraft.particle.ParticleTypes;
import net.minecraft.server.world.ServerWorld;
import net.minecraft.tag.BlockTags;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;

public class CrackedIceBlock extends Block {

public CrackedIceBlock(Settings settings) {
super(settings);
}

public void onSteppedOn(World world, BlockPos pos, BlockState state, Entity entity) {
if (canFallThrough(world.getBlockState(pos.down())) && pos.getY() >= world.getBottomY() && !world.isClient()) {
FallingBlockEntity fallingBlockEntity = FallingBlockEntity.spawnFromBlock(world, pos, state);
ModUtils.spawnForcedParticles((ServerWorld)world, ParticleTypes.SNOWFLAKE, pos.getX(), pos.getY(), pos.getZ(), 20, 0.5, 0.5, 0.5, 0.3);
ModUtils.spawnForcedParticles((ServerWorld)world, ParticleTypes.CAMPFIRE_COSY_SMOKE, pos.getX(), pos.getY(), pos.getZ(), 3, 0.5, 0.5, 0.5, 0);
}

super.onSteppedOn(world, pos, state, entity);
}

public static boolean canFallThrough(BlockState state) {
Material material = state.getMaterial();
return state.isAir() || state.isIn(BlockTags.FIRE) || material.isLiquid() || material.isReplaceable();
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
package com.github.ethanicuss.astraladditions.blocks;

import com.github.ethanicuss.astraladditions.entities.ModEntities;
import com.github.ethanicuss.astraladditions.entities.prismatic_geyser.PrismaticGeyserEntity;
import com.github.ethanicuss.astraladditions.entities.shimmerblaze.ShimmerBlazeRainEntity;
import com.github.ethanicuss.astraladditions.util.ModUtils;
import io.github.fabricators_of_create.porting_lib.data.SoundDefinition;
import net.minecraft.block.Block;
import net.minecraft.block.BlockState;
import net.minecraft.enchantment.EnchantmentHelper;
import net.minecraft.entity.Entity;
import net.minecraft.entity.LivingEntity;
import net.minecraft.entity.damage.DamageSource;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.particle.ParticleTypes;
import net.minecraft.server.world.ServerWorld;
import net.minecraft.sound.SoundCategory;
import net.minecraft.sound.SoundEvent;
import net.minecraft.sound.SoundEvents;
import net.minecraft.util.ActionResult;
import net.minecraft.util.Hand;
import net.minecraft.util.hit.BlockHitResult;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.Box;
import net.minecraft.util.math.MathHelper;
import net.minecraft.world.World;

import java.util.List;
import java.util.Random;

public class GeyserBlock extends Block {

public GeyserBlock(Settings settings) {
super(settings);
}

public ActionResult onUse(BlockState blockState, World world, BlockPos pos, PlayerEntity placedBy, Hand hand, BlockHitResult blockHitResult) {
if (!world.isClient) {
world.playSound(pos.getX(), pos.getY() + 1, pos.getZ(), SoundEvents.ENTITY_GENERIC_EXPLODE, SoundCategory.BLOCKS, 1, 0.5f, true);
}

return ActionResult.PASS;
}

public void onSteppedOn(World world, BlockPos pos, BlockState state, Entity entity) {
Box box = new Box(pos.getX(), pos.getY(), pos.getZ(), pos.getX()+1, pos.getY()+1.5, pos.getZ()+1);
List<Entity> ls = world.getOtherEntities(entity, box);
for (Entity p : ls) {
if (p instanceof PrismaticGeyserEntity) {
return;
}
}

PrismaticGeyserEntity geyser = new PrismaticGeyserEntity(ModEntities.PRISMATIC_GEYSER, world);
geyser.setPosition(pos.getX() + 0.5, pos.getY() + 1, pos.getZ() + 0.5);
geyser.refreshPositionAndAngles(pos.getX() + 0.5, pos.getY() + 1, pos.getZ() + 0.5, 0.0f, 0.0f);
world.spawnEntity(geyser);

if (world instanceof ServerWorld) {
ModUtils.spawnForcedParticles((ServerWorld)world, ParticleTypes.CLOUD, pos.getX() + 0.5, pos.getY() + 1.1, pos.getZ() + 0.5, 10, 0.2, 0.2, 0.2, 0.1);
ModUtils.spawnForcedParticles((ServerWorld)world, ParticleTypes.SNOWFLAKE, entity.getX(), (double)(pos.getY() + 1), entity.getZ(), 1, (double)(MathHelper.nextBetween(world.random, -1.0F, 1.0F) * 0.083333336F), 0.05000000074505806D, (double)(MathHelper.nextBetween(world.random, -1.0F, 1.0F) * 0.083333336F), 0);

}


super.onSteppedOn(world, pos, state, entity);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
package com.github.ethanicuss.astraladditions.effects.frost;

import com.github.ethanicuss.astraladditions.AstralAdditions;
import net.minecraft.block.Blocks;
import net.minecraft.entity.LivingEntity;
import net.minecraft.entity.attribute.AttributeContainer;
import net.minecraft.entity.effect.StatusEffect;
import net.minecraft.entity.effect.StatusEffectCategory;
import net.minecraft.entity.effect.StatusEffectInstance;
import net.minecraft.particle.ParticleTypes;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.MathHelper;
import net.minecraft.util.math.Vec3d;
import net.minecraft.world.World;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import java.util.Random;


public class FrostEffect extends StatusEffect {

public static final Logger LOGGER = LoggerFactory.getLogger(AstralAdditions.MOD_ID);

public FrostEffect(StatusEffectCategory statusEffectCategory, int color) {
super(statusEffectCategory, color);
}

@Override
public void applyUpdateEffect(LivingEntity entity, int amplifier) {
World world = entity.getWorld();
BlockPos pos = entity.getBlockPos();

if (world.isClient) {
Random random = world.getRandom();
boolean bl = entity.lastRenderX != entity.getX() || entity.lastRenderZ != entity.getZ();
if (bl && random.nextBoolean()) {
world.addParticle(ParticleTypes.SNOWFLAKE, entity.getX(), (double)(pos.getY() + 1), entity.getZ(), (double)(MathHelper.nextBetween(random, -1.0F, 1.0F) * 0.083333336F), 0.05000000074505806D, (double)(MathHelper.nextBetween(random, -1.0F, 1.0F) * 0.083333336F));
}
}

entity.setInPowderSnow(true);
}

@Override
public void onRemoved(LivingEntity entity, AttributeContainer attributes, int amplifier) {

}


@Override
public boolean canApplyUpdateEffect(int duration, int amplifier) {
return true;
}

@Override
public boolean isInstant() {
return false;
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,12 @@
import com.github.ethanicuss.astraladditions.entities.moonman.MoonmanEntityRenderer;
import com.github.ethanicuss.astraladditions.entities.phast.PhastEntity;
import com.github.ethanicuss.astraladditions.entities.phast.PhastEntityRenderer;
import com.github.ethanicuss.astraladditions.entities.prismatic_geyser.PrismaticGeyserEntity;
import com.github.ethanicuss.astraladditions.entities.prismatic_geyser.PrismaticGeyserRenderer;
import com.github.ethanicuss.astraladditions.entities.pylon.PylonEntity;
import com.github.ethanicuss.astraladditions.entities.pylon.PylonEntityRenderer;
import com.github.ethanicuss.astraladditions.entities.scrap_projectile.ScrapProjectileEntity;
import com.github.ethanicuss.astraladditions.entities.scrap_projectile.ScrapProjectileEntityRenderer;
import com.github.ethanicuss.astraladditions.entities.shimmerblaze.*;
import com.github.ethanicuss.astraladditions.entities.shimmerfishingrod.ShimmerFishingBobberEntity;
import com.github.ethanicuss.astraladditions.entities.shimmerfishingrod.ShimmerFishingBobberRenderer;
Expand Down Expand Up @@ -93,6 +97,10 @@ public class ModEntities {
Registry.ENTITY_TYPE,
new Identifier(AstralAdditions.MOD_ID, "cometball"),
FabricEntityTypeBuilder.create(SpawnGroup.MISC, CometballEntity::new).dimensions(EntityDimensions.fixed(0.25f, 0.25f)).build()
);public static final EntityType<ScrapProjectileEntity> SCRAP_PROJECTILE = Registry.register(
Registry.ENTITY_TYPE,
new Identifier(AstralAdditions.MOD_ID, "scrap_projectile"),
FabricEntityTypeBuilder.create(SpawnGroup.MISC, ScrapProjectileEntity::new).dimensions(EntityDimensions.fixed(0.1f, 0.1f)).build()
);
public static final EntityType<PylonEntity> PYLON = Registry.register(
Registry.ENTITY_TYPE,
Expand All @@ -119,6 +127,11 @@ public class ModEntities {
new Identifier(AstralAdditions.MOD_ID, "shimmer_rain"),
FabricEntityTypeBuilder.create(SpawnGroup.MISC, ShimmerBlazeRainEntity::new).dimensions(EntityDimensions.fixed(1.0f, 5.0f)).build()
);
public static final EntityType<PrismaticGeyserEntity> PRISMATIC_GEYSER = Registry.register(
Registry.ENTITY_TYPE,
new Identifier(AstralAdditions.MOD_ID, "prismatic_geyser"),
FabricEntityTypeBuilder.create(SpawnGroup.MISC, PrismaticGeyserEntity::new).dimensions(EntityDimensions.fixed(1.0f, 5.0f)).build()
);
public static final EntityType<PhastEntity> PHAST = Registry.register(
Registry.ENTITY_TYPE,
new Identifier(AstralAdditions.MOD_ID, "phast"),
Expand Down Expand Up @@ -204,6 +217,8 @@ public static void initClient() {

EntityRendererRegistry.register(COMETBALL, CometballEntityRenderer::new);

EntityRendererRegistry.register(SCRAP_PROJECTILE, ScrapProjectileEntityRenderer::new);

EntityRendererRegistry.register(PYLON, PylonEntityRenderer::new);

EntityRendererRegistry.register(METEOR_FIST, MeteorPunchEntityRenderer::new);
Expand All @@ -212,6 +227,8 @@ public static void initClient() {

EntityRendererRegistry.register(SHIMMER_RAIN, ShimmerBlazeRainEntityRenderer::new);

EntityRendererRegistry.register(PRISMATIC_GEYSER, PrismaticGeyserRenderer::new);

EntityRendererRegistry.register(SHIMMER_FISHING_BOBBER, ShimmerFishingBobberRenderer::new);

EntityRendererRegistry.register(BOOMERANG, BoomerangEntityRenderer::new);
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
package com.github.ethanicuss.astraladditions.entities.prismatic_geyser;

import com.github.ethanicuss.astraladditions.entities.shimmerblaze.ShimmerBlazeEntity;
import com.github.ethanicuss.astraladditions.registry.ModEffects;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityType;
import net.minecraft.entity.LivingEntity;
import net.minecraft.entity.damage.DamageSource;
import net.minecraft.entity.data.DataTracker;
import net.minecraft.entity.data.TrackedData;
import net.minecraft.entity.data.TrackedDataHandlerRegistry;
import net.minecraft.entity.effect.StatusEffectInstance;
import net.minecraft.nbt.NbtCompound;
import net.minecraft.network.Packet;
import net.minecraft.network.packet.s2c.play.EntitySpawnS2CPacket;
import net.minecraft.particle.ParticleTypes;
import net.minecraft.util.math.Box;
import net.minecraft.world.World;

import java.util.List;

public class PrismaticGeyserEntity extends Entity {
private static final TrackedData<Integer> AGE = DataTracker.registerData(PrismaticGeyserEntity.class, TrackedDataHandlerRegistry.INTEGER);

public PrismaticGeyserEntity(EntityType<? extends Entity> type, World world) {
super(type, world);
}

public void setAge(int _age){
this.getDataTracker().set(AGE, _age);
}

@Override
public void tick() {
this.getDataTracker().set(AGE, this.getDataTracker().get(AGE)+1);
if (this.getDataTracker().get(AGE) == 10){
for (var i = 0; i < 20; i++) {
this.world.addParticle(ParticleTypes.EFFECT, true, this.getX() - 0.5 + random.nextFloat(), this.getY() + 0.1 + random.nextFloat() * 5, this.getZ() - 0.5 + random.nextFloat(), 0, 2.0, 0);
this.world.addParticle(ParticleTypes.CAMPFIRE_COSY_SMOKE, true, this.getX() - 0.5 + random.nextFloat(), this.getY() + 0.1 + random.nextFloat() * 5, this.getZ() - 0.5 + random.nextFloat(), 0, i/30f, 0);
}
}
if (this.getDataTracker().get(AGE) >= 10){
this.world.addParticle(ParticleTypes.EFFECT, true, this.getX()-0.5 + random.nextFloat(), this.getY() + 0.1 + random.nextFloat()*5, this.getZ()-0.5 + random.nextFloat(), 0, 1.0, 0);

if (this.getDataTracker().get(AGE) < 90) {
Box box = new Box(this.getX() - 0.5, this.getY() - 1, this.getZ() - 0.5, this.getX() + 0.5, this.getY() + 6, this.getZ() + 0.5);
List<Entity> ls = this.world.getOtherEntities(this, box);
for (Entity p : ls) {
if (p instanceof LivingEntity) {
p.damage(DamageSource.FREEZE, 3.0f);
((LivingEntity) p).addStatusEffect(new StatusEffectInstance(ModEffects.FROST, 600, 0), this);
p.setVelocity(0, 1.5, 0);
}
}
}
}
else{
this.world.addParticle(ParticleTypes.CLOUD, true, this.getX(), this.getY() + 0.1, this.getZ(), 0, 0.1, 0);
}
if (this.getDataTracker().get(AGE) >= 120){
this.discard();
}
}

@Override
protected void initDataTracker() {
this.dataTracker.startTracking(AGE, 0);
}

@Override
protected void readCustomDataFromNbt(NbtCompound nbt) {

}

@Override
protected void writeCustomDataToNbt(NbtCompound nbt) {

}

@Override
public Packet<?> createSpawnPacket() {
return new EntitySpawnS2CPacket(this);
}

public int getAge(){
return this.getDataTracker().get(AGE);
}
}
Loading
Loading