Skip to content

Commit cc0afd3

Browse files
authored
Merge pull request #18 from ethanicusss/feature/glacio-features
Feature/glacio features
2 parents 2e3cba4 + 4c55225 commit cc0afd3

File tree

30 files changed

+749
-6
lines changed

30 files changed

+749
-6
lines changed

gradle.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ org.gradle.jvmargs=-Xmx2G
1919
archives_base_name = astraladditions
2020

2121
# Dependencies
22-
fabric_version=0.76.0+1.18.2
22+
fabric_version=0.77.0+1.18.2
2323

2424
# Development QOL
2525
modmenu_version=3.2.5
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
package com.github.ethanicuss.astraladditions.blocks;
2+
3+
import com.github.ethanicuss.astraladditions.util.ModUtils;
4+
import net.minecraft.block.Block;
5+
import net.minecraft.block.BlockState;
6+
import net.minecraft.block.Blocks;
7+
import net.minecraft.block.Material;
8+
import net.minecraft.entity.Entity;
9+
import net.minecraft.entity.FallingBlockEntity;
10+
import net.minecraft.particle.ParticleTypes;
11+
import net.minecraft.server.world.ServerWorld;
12+
import net.minecraft.tag.BlockTags;
13+
import net.minecraft.util.math.BlockPos;
14+
import net.minecraft.world.World;
15+
16+
public class BubbleBlock extends Block {
17+
18+
public BubbleBlock(Settings settings) {
19+
super(settings);
20+
}
21+
22+
public void onSteppedOn(World world, BlockPos pos, BlockState state, Entity entity) {
23+
world.setBlockState(pos, Blocks.AIR.getDefaultState());
24+
ModUtils.spawnForcedParticles((ServerWorld)world, ParticleTypes.BUBBLE, pos.getX(), pos.getY(), pos.getZ(), 10, 0.8, 0.8, 0.8, 0.1);
25+
ModUtils.spawnForcedParticles((ServerWorld)world, ParticleTypes.SPLASH, pos.getX(), pos.getY(), pos.getZ(), 10, 0.8, 0.8, 0.8, 0.1);
26+
27+
super.onSteppedOn(world, pos, state, entity);
28+
}
29+
}
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
package com.github.ethanicuss.astraladditions.blocks;
2+
3+
import com.github.ethanicuss.astraladditions.util.ModUtils;
4+
import net.minecraft.block.Block;
5+
import net.minecraft.block.BlockState;
6+
import net.minecraft.block.Material;
7+
import net.minecraft.enchantment.EnchantmentHelper;
8+
import net.minecraft.entity.Entity;
9+
import net.minecraft.entity.FallingBlockEntity;
10+
import net.minecraft.entity.LivingEntity;
11+
import net.minecraft.entity.damage.DamageSource;
12+
import net.minecraft.particle.ParticleTypes;
13+
import net.minecraft.server.world.ServerWorld;
14+
import net.minecraft.tag.BlockTags;
15+
import net.minecraft.util.math.BlockPos;
16+
import net.minecraft.world.World;
17+
18+
public class CrackedIceBlock extends Block {
19+
20+
public CrackedIceBlock(Settings settings) {
21+
super(settings);
22+
}
23+
24+
public void onSteppedOn(World world, BlockPos pos, BlockState state, Entity entity) {
25+
if (canFallThrough(world.getBlockState(pos.down())) && pos.getY() >= world.getBottomY() && !world.isClient()) {
26+
FallingBlockEntity fallingBlockEntity = FallingBlockEntity.spawnFromBlock(world, pos, state);
27+
ModUtils.spawnForcedParticles((ServerWorld)world, ParticleTypes.SNOWFLAKE, pos.getX(), pos.getY(), pos.getZ(), 20, 0.5, 0.5, 0.5, 0.3);
28+
ModUtils.spawnForcedParticles((ServerWorld)world, ParticleTypes.CAMPFIRE_COSY_SMOKE, pos.getX(), pos.getY(), pos.getZ(), 3, 0.5, 0.5, 0.5, 0);
29+
}
30+
31+
super.onSteppedOn(world, pos, state, entity);
32+
}
33+
34+
public static boolean canFallThrough(BlockState state) {
35+
Material material = state.getMaterial();
36+
return state.isAir() || state.isIn(BlockTags.FIRE) || material.isLiquid() || material.isReplaceable();
37+
}
38+
}
Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
package com.github.ethanicuss.astraladditions.blocks;
2+
3+
import com.github.ethanicuss.astraladditions.entities.ModEntities;
4+
import com.github.ethanicuss.astraladditions.entities.prismatic_geyser.PrismaticGeyserEntity;
5+
import com.github.ethanicuss.astraladditions.entities.shimmerblaze.ShimmerBlazeRainEntity;
6+
import com.github.ethanicuss.astraladditions.util.ModUtils;
7+
import io.github.fabricators_of_create.porting_lib.data.SoundDefinition;
8+
import net.minecraft.block.Block;
9+
import net.minecraft.block.BlockState;
10+
import net.minecraft.enchantment.EnchantmentHelper;
11+
import net.minecraft.entity.Entity;
12+
import net.minecraft.entity.LivingEntity;
13+
import net.minecraft.entity.damage.DamageSource;
14+
import net.minecraft.entity.player.PlayerEntity;
15+
import net.minecraft.particle.ParticleTypes;
16+
import net.minecraft.server.world.ServerWorld;
17+
import net.minecraft.sound.SoundCategory;
18+
import net.minecraft.sound.SoundEvent;
19+
import net.minecraft.sound.SoundEvents;
20+
import net.minecraft.util.ActionResult;
21+
import net.minecraft.util.Hand;
22+
import net.minecraft.util.hit.BlockHitResult;
23+
import net.minecraft.util.math.BlockPos;
24+
import net.minecraft.util.math.Box;
25+
import net.minecraft.util.math.MathHelper;
26+
import net.minecraft.world.World;
27+
28+
import java.util.List;
29+
import java.util.Random;
30+
31+
public class GeyserBlock extends Block {
32+
33+
public GeyserBlock(Settings settings) {
34+
super(settings);
35+
}
36+
37+
public ActionResult onUse(BlockState blockState, World world, BlockPos pos, PlayerEntity placedBy, Hand hand, BlockHitResult blockHitResult) {
38+
if (!world.isClient) {
39+
world.playSound(pos.getX(), pos.getY() + 1, pos.getZ(), SoundEvents.ENTITY_GENERIC_EXPLODE, SoundCategory.BLOCKS, 1, 0.5f, true);
40+
}
41+
42+
return ActionResult.PASS;
43+
}
44+
45+
public void onSteppedOn(World world, BlockPos pos, BlockState state, Entity entity) {
46+
Box box = new Box(pos.getX(), pos.getY(), pos.getZ(), pos.getX()+1, pos.getY()+1.5, pos.getZ()+1);
47+
List<Entity> ls = world.getOtherEntities(entity, box);
48+
for (Entity p : ls) {
49+
if (p instanceof PrismaticGeyserEntity) {
50+
return;
51+
}
52+
}
53+
54+
PrismaticGeyserEntity geyser = new PrismaticGeyserEntity(ModEntities.PRISMATIC_GEYSER, world);
55+
geyser.setPosition(pos.getX() + 0.5, pos.getY() + 1, pos.getZ() + 0.5);
56+
geyser.refreshPositionAndAngles(pos.getX() + 0.5, pos.getY() + 1, pos.getZ() + 0.5, 0.0f, 0.0f);
57+
world.spawnEntity(geyser);
58+
59+
if (world instanceof ServerWorld) {
60+
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);
61+
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);
62+
63+
}
64+
65+
66+
super.onSteppedOn(world, pos, state, entity);
67+
}
68+
}
Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
package com.github.ethanicuss.astraladditions.effects.frost;
2+
3+
import com.github.ethanicuss.astraladditions.AstralAdditions;
4+
import net.minecraft.block.Blocks;
5+
import net.minecraft.entity.LivingEntity;
6+
import net.minecraft.entity.attribute.AttributeContainer;
7+
import net.minecraft.entity.effect.StatusEffect;
8+
import net.minecraft.entity.effect.StatusEffectCategory;
9+
import net.minecraft.entity.effect.StatusEffectInstance;
10+
import net.minecraft.particle.ParticleTypes;
11+
import net.minecraft.util.math.BlockPos;
12+
import net.minecraft.util.math.MathHelper;
13+
import net.minecraft.util.math.Vec3d;
14+
import net.minecraft.world.World;
15+
import org.slf4j.Logger;
16+
import org.slf4j.LoggerFactory;
17+
18+
import java.util.Random;
19+
20+
21+
public class FrostEffect extends StatusEffect {
22+
23+
public static final Logger LOGGER = LoggerFactory.getLogger(AstralAdditions.MOD_ID);
24+
25+
public FrostEffect(StatusEffectCategory statusEffectCategory, int color) {
26+
super(statusEffectCategory, color);
27+
}
28+
29+
@Override
30+
public void applyUpdateEffect(LivingEntity entity, int amplifier) {
31+
World world = entity.getWorld();
32+
BlockPos pos = entity.getBlockPos();
33+
34+
if (world.isClient) {
35+
Random random = world.getRandom();
36+
boolean bl = entity.lastRenderX != entity.getX() || entity.lastRenderZ != entity.getZ();
37+
if (bl && random.nextBoolean()) {
38+
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));
39+
}
40+
}
41+
42+
entity.setInPowderSnow(true);
43+
}
44+
45+
@Override
46+
public void onRemoved(LivingEntity entity, AttributeContainer attributes, int amplifier) {
47+
48+
}
49+
50+
51+
@Override
52+
public boolean canApplyUpdateEffect(int duration, int amplifier) {
53+
return true;
54+
}
55+
56+
@Override
57+
public boolean isInstant() {
58+
return false;
59+
}
60+
61+
}

src/main/java/com/github/ethanicuss/astraladditions/entities/ModEntities.java

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,12 @@
2525
import com.github.ethanicuss.astraladditions.entities.moonman.MoonmanEntityRenderer;
2626
import com.github.ethanicuss.astraladditions.entities.phast.PhastEntity;
2727
import com.github.ethanicuss.astraladditions.entities.phast.PhastEntityRenderer;
28+
import com.github.ethanicuss.astraladditions.entities.prismatic_geyser.PrismaticGeyserEntity;
29+
import com.github.ethanicuss.astraladditions.entities.prismatic_geyser.PrismaticGeyserRenderer;
2830
import com.github.ethanicuss.astraladditions.entities.pylon.PylonEntity;
2931
import com.github.ethanicuss.astraladditions.entities.pylon.PylonEntityRenderer;
32+
import com.github.ethanicuss.astraladditions.entities.scrap_projectile.ScrapProjectileEntity;
33+
import com.github.ethanicuss.astraladditions.entities.scrap_projectile.ScrapProjectileEntityRenderer;
3034
import com.github.ethanicuss.astraladditions.entities.shimmerblaze.*;
3135
import com.github.ethanicuss.astraladditions.entities.shimmerfishingrod.ShimmerFishingBobberEntity;
3236
import com.github.ethanicuss.astraladditions.entities.shimmerfishingrod.ShimmerFishingBobberRenderer;
@@ -93,6 +97,10 @@ public class ModEntities {
9397
Registry.ENTITY_TYPE,
9498
new Identifier(AstralAdditions.MOD_ID, "cometball"),
9599
FabricEntityTypeBuilder.create(SpawnGroup.MISC, CometballEntity::new).dimensions(EntityDimensions.fixed(0.25f, 0.25f)).build()
100+
);public static final EntityType<ScrapProjectileEntity> SCRAP_PROJECTILE = Registry.register(
101+
Registry.ENTITY_TYPE,
102+
new Identifier(AstralAdditions.MOD_ID, "scrap_projectile"),
103+
FabricEntityTypeBuilder.create(SpawnGroup.MISC, ScrapProjectileEntity::new).dimensions(EntityDimensions.fixed(0.1f, 0.1f)).build()
96104
);
97105
public static final EntityType<PylonEntity> PYLON = Registry.register(
98106
Registry.ENTITY_TYPE,
@@ -119,6 +127,11 @@ public class ModEntities {
119127
new Identifier(AstralAdditions.MOD_ID, "shimmer_rain"),
120128
FabricEntityTypeBuilder.create(SpawnGroup.MISC, ShimmerBlazeRainEntity::new).dimensions(EntityDimensions.fixed(1.0f, 5.0f)).build()
121129
);
130+
public static final EntityType<PrismaticGeyserEntity> PRISMATIC_GEYSER = Registry.register(
131+
Registry.ENTITY_TYPE,
132+
new Identifier(AstralAdditions.MOD_ID, "prismatic_geyser"),
133+
FabricEntityTypeBuilder.create(SpawnGroup.MISC, PrismaticGeyserEntity::new).dimensions(EntityDimensions.fixed(1.0f, 5.0f)).build()
134+
);
122135
public static final EntityType<PhastEntity> PHAST = Registry.register(
123136
Registry.ENTITY_TYPE,
124137
new Identifier(AstralAdditions.MOD_ID, "phast"),
@@ -204,6 +217,8 @@ public static void initClient() {
204217

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

220+
EntityRendererRegistry.register(SCRAP_PROJECTILE, ScrapProjectileEntityRenderer::new);
221+
207222
EntityRendererRegistry.register(PYLON, PylonEntityRenderer::new);
208223

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

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

230+
EntityRendererRegistry.register(PRISMATIC_GEYSER, PrismaticGeyserRenderer::new);
231+
215232
EntityRendererRegistry.register(SHIMMER_FISHING_BOBBER, ShimmerFishingBobberRenderer::new);
216233

217234
EntityRendererRegistry.register(BOOMERANG, BoomerangEntityRenderer::new);
Lines changed: 88 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,88 @@
1+
package com.github.ethanicuss.astraladditions.entities.prismatic_geyser;
2+
3+
import com.github.ethanicuss.astraladditions.entities.shimmerblaze.ShimmerBlazeEntity;
4+
import com.github.ethanicuss.astraladditions.registry.ModEffects;
5+
import net.minecraft.entity.Entity;
6+
import net.minecraft.entity.EntityType;
7+
import net.minecraft.entity.LivingEntity;
8+
import net.minecraft.entity.damage.DamageSource;
9+
import net.minecraft.entity.data.DataTracker;
10+
import net.minecraft.entity.data.TrackedData;
11+
import net.minecraft.entity.data.TrackedDataHandlerRegistry;
12+
import net.minecraft.entity.effect.StatusEffectInstance;
13+
import net.minecraft.nbt.NbtCompound;
14+
import net.minecraft.network.Packet;
15+
import net.minecraft.network.packet.s2c.play.EntitySpawnS2CPacket;
16+
import net.minecraft.particle.ParticleTypes;
17+
import net.minecraft.util.math.Box;
18+
import net.minecraft.world.World;
19+
20+
import java.util.List;
21+
22+
public class PrismaticGeyserEntity extends Entity {
23+
private static final TrackedData<Integer> AGE = DataTracker.registerData(PrismaticGeyserEntity.class, TrackedDataHandlerRegistry.INTEGER);
24+
25+
public PrismaticGeyserEntity(EntityType<? extends Entity> type, World world) {
26+
super(type, world);
27+
}
28+
29+
public void setAge(int _age){
30+
this.getDataTracker().set(AGE, _age);
31+
}
32+
33+
@Override
34+
public void tick() {
35+
this.getDataTracker().set(AGE, this.getDataTracker().get(AGE)+1);
36+
if (this.getDataTracker().get(AGE) == 10){
37+
for (var i = 0; i < 20; i++) {
38+
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);
39+
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);
40+
}
41+
}
42+
if (this.getDataTracker().get(AGE) >= 10){
43+
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);
44+
45+
if (this.getDataTracker().get(AGE) < 90) {
46+
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);
47+
List<Entity> ls = this.world.getOtherEntities(this, box);
48+
for (Entity p : ls) {
49+
if (p instanceof LivingEntity) {
50+
p.damage(DamageSource.FREEZE, 3.0f);
51+
((LivingEntity) p).addStatusEffect(new StatusEffectInstance(ModEffects.FROST, 600, 0), this);
52+
p.setVelocity(0, 1.5, 0);
53+
}
54+
}
55+
}
56+
}
57+
else{
58+
this.world.addParticle(ParticleTypes.CLOUD, true, this.getX(), this.getY() + 0.1, this.getZ(), 0, 0.1, 0);
59+
}
60+
if (this.getDataTracker().get(AGE) >= 120){
61+
this.discard();
62+
}
63+
}
64+
65+
@Override
66+
protected void initDataTracker() {
67+
this.dataTracker.startTracking(AGE, 0);
68+
}
69+
70+
@Override
71+
protected void readCustomDataFromNbt(NbtCompound nbt) {
72+
73+
}
74+
75+
@Override
76+
protected void writeCustomDataToNbt(NbtCompound nbt) {
77+
78+
}
79+
80+
@Override
81+
public Packet<?> createSpawnPacket() {
82+
return new EntitySpawnS2CPacket(this);
83+
}
84+
85+
public int getAge(){
86+
return this.getDataTracker().get(AGE);
87+
}
88+
}

0 commit comments

Comments
 (0)