Skip to content

Commit ddd5e8a

Browse files
authored
Merge pull request #20 from MikoTheBoi/master
Super big and massive, game changing, pack breaking, meta defining PR (not)
2 parents cc0afd3 + d8cf8c0 commit ddd5e8a

36 files changed

+1169
-47
lines changed

build.gradle

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,10 @@ repositories {
3636
name "ModMaven"
3737
url "https://modmaven.dev"
3838
}
39+
maven {
40+
name = 'GeckoLib'
41+
url 'https://dl.cloudsmith.io/public/geckolib3/geckolib/maven/'
42+
}
3943
google()
4044
}
4145

@@ -50,6 +54,8 @@ dependencies {
5054
modCompileOnly "me.shedaniel:RoughlyEnoughItems-api-fabric:${rei_version}"
5155
modRuntimeOnly "me.shedaniel:RoughlyEnoughItems-fabric:${rei_version}"
5256

57+
modImplementation "software.bernie.geckolib:geckolib-fabric-1.18:${geckolib_version}"
58+
5359
// Dev QOL
5460
modLocalRuntime("com.terraformersmc:modmenu:${modmenu_version}")
5561
modLocalRuntime("me.shedaniel:RoughlyEnoughItems-fabric:${rei_version}")

gradle.properties

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,4 +29,7 @@ org.gradle.jvmargs=-Xmx2G
2929
yttr_version = 7.626+1.18.2
3030

3131
# create
32-
create_version = 0.5.1-f-build.1333+mc1.18.2
32+
create_version = 0.5.1-f-build.1333+mc1.18.2
33+
34+
# geckolib
35+
geckolib_version = 3.0.80

src/main/java/com/github/ethanicuss/astraladditions/AstralAdditionsClient.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
package com.github.ethanicuss.astraladditions;
22

33
import com.github.ethanicuss.astraladditions.entities.ModEntities;
4+
import com.github.ethanicuss.astraladditions.entities.blackhole.BlackholeEntityRenderer;
45
import com.github.ethanicuss.astraladditions.fluids.ModFluids;
56
import com.github.ethanicuss.astraladditions.particle.ModParticlesClient;
67
import com.github.ethanicuss.astraladditions.playertracker.PlayerTracker;
@@ -26,6 +27,7 @@ public class AstralAdditionsClient implements ClientModInitializer {
2627
public static final EntityModelLayer MODEL_WHAST_LAYER = new EntityModelLayer(new Identifier(AstralAdditions.MOD_ID, "whast"), "main");
2728
public static final EntityModelLayer MODEL_GLAZER_LAYER = new EntityModelLayer(new Identifier(AstralAdditions.MOD_ID, "glazer"), "main");
2829
public static final EntityModelLayer MODEL_ENDER_WATCHER_LAYER = new EntityModelLayer(new Identifier(AstralAdditions.MOD_ID, "ender_watcher"), "main");
30+
public static final EntityModelLayer MODEL_COGFLY_LAYER = new EntityModelLayer(new Identifier(AstralAdditions.MOD_ID, "cogfly"), "main");
2931
@Override
3032
public void onInitializeClient() {
3133
FluidRenderHandlerRegistry.INSTANCE.register(ModFluids.STILL_SHIMMER, ModFluids.FLOWING_SHIMMER, new SimpleFluidRenderHandler(
Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
package com.github.ethanicuss.astraladditions.effects.parry;
2+
3+
import com.github.ethanicuss.astraladditions.registry.ModEffects;
4+
import com.github.ethanicuss.astraladditions.util.ModUtils;
5+
import net.minecraft.entity.Entity;
6+
import net.minecraft.entity.LivingEntity;
7+
import net.minecraft.entity.damage.DamageSource;
8+
import net.minecraft.entity.effect.StatusEffect;
9+
import net.minecraft.entity.effect.StatusEffectCategory;
10+
import net.minecraft.particle.ParticleTypes;
11+
import net.minecraft.server.world.ServerWorld;
12+
import net.minecraft.sound.SoundCategory;
13+
import net.minecraft.sound.SoundEvents;
14+
import net.minecraft.util.UseAction;
15+
import org.jetbrains.annotations.Nullable;
16+
17+
18+
public class ParryEffect extends StatusEffect{
19+
public ParryEffect(StatusEffectCategory category, int color) {
20+
super(category, color);
21+
}
22+
23+
24+
@Override
25+
public void applyUpdateEffect(LivingEntity entity, int amplifier) {
26+
// Entity attacker = entity.getAttacker();
27+
// onUserDamaged(entity, attacker, amplifier);
28+
super.applyUpdateEffect(entity, amplifier);
29+
}
30+
31+
public static void onUserDamaged (LivingEntity user, Entity attacker, int level) {
32+
if (attacker != null) {
33+
attacker.damage(DamageSource.thorns(user), (float)getDamageAmount(level));
34+
user.world.playSound(null, user.getX(), user.getY(), user.getZ(), SoundEvents.ITEM_TRIDENT_THUNDER, SoundCategory.NEUTRAL, 0.5f, 1.4f / (user.world.getRandom().nextFloat() * 0.4f + 0.8f));
35+
ModUtils.spawnForcedParticles((ServerWorld)user.world, ParticleTypes.END_ROD, user.getX(), user.getY(), user.getZ(), 20, 0.8, 0.8, 0.8, 0.7);
36+
user.heal(level+5);
37+
}
38+
user.setAttacker(null);
39+
}
40+
41+
public static boolean parryWindow(LivingEntity user) {
42+
int lastAttacked = user.age-user.getLastAttackedTime();
43+
return user.getLastAttackedTime() >= user.age - 20;
44+
}
45+
46+
public static int getDamageAmount(int amplifier) {
47+
return amplifier+5;
48+
}
49+
50+
@Override
51+
public boolean canApplyUpdateEffect(int duration, int amplifier) {
52+
return true;
53+
}
54+
55+
@Override
56+
public boolean isInstant() {
57+
return false;
58+
}
59+
}

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

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,13 @@
22

33
import com.github.ethanicuss.astraladditions.AstralAdditions;
44
import com.github.ethanicuss.astraladditions.AstralAdditionsClient;
5+
import com.github.ethanicuss.astraladditions.entities.blackhole.BlackholeEntity;
6+
import com.github.ethanicuss.astraladditions.entities.blackhole.BlackholeEntityRenderer;
57
import com.github.ethanicuss.astraladditions.entities.boomerang.BoomerangEntity;
68
import com.github.ethanicuss.astraladditions.entities.boomerang.BoomerangEntityRenderer;
9+
import com.github.ethanicuss.astraladditions.entities.cogfly.CogflyEntity;
10+
import com.github.ethanicuss.astraladditions.entities.cogfly.CogflyEntityModel;
11+
import com.github.ethanicuss.astraladditions.entities.cogfly.CogflyEntityRenderer;
712
import com.github.ethanicuss.astraladditions.entities.cometball.CometballEntity;
813
import com.github.ethanicuss.astraladditions.entities.cometball.CometballEntityRenderer;
914
import com.github.ethanicuss.astraladditions.entities.ender_watcher.EnderWatcherEntity;
@@ -157,6 +162,16 @@ public class ModEntities {
157162
new Identifier(AstralAdditions.MOD_ID, "boomerang"),
158163
FabricEntityTypeBuilder.create(SpawnGroup.MISC, BoomerangEntity::new).dimensions(EntityDimensions.fixed(2.0f, 1.5f)).build()
159164
);
165+
public static final EntityType<BlackholeEntity> BLACKHOLE = Registry.register(
166+
Registry.ENTITY_TYPE,
167+
new Identifier(AstralAdditions.MOD_ID, "blackhole"),
168+
FabricEntityTypeBuilder.create(SpawnGroup.MONSTER, BlackholeEntity::new).dimensions(EntityDimensions.fixed(1f, 1.6f)).build()
169+
);
170+
public static final EntityType<CogflyEntity> COGFLY = Registry.register(
171+
Registry.ENTITY_TYPE,
172+
new Identifier(AstralAdditions.MOD_ID, "cogfly"),
173+
FabricEntityTypeBuilder.create(SpawnGroup.MISC, CogflyEntity::new).dimensions(EntityDimensions.fixed(0.3f, 0.3f)).build()
174+
);
160175

161176
public static final EntityType<ShimmerFishingBobberEntity> SHIMMER_FISHING_BOBBER = Registry.register(
162177
Registry.ENTITY_TYPE,
@@ -180,6 +195,7 @@ public static void init() {
180195
FabricDefaultAttributeRegistry.register(WHAST, WhastEntity.createWhastAttributes());
181196
FabricDefaultAttributeRegistry.register(ENDER_WATCHER, EnderWatcherEntity.createWatcherAttributes());
182197
FabricDefaultAttributeRegistry.register(GLAZER, GlazerEntity.createGlazerAttributes());
198+
FabricDefaultAttributeRegistry.register(BLACKHOLE, BlackholeEntity.createBlackholeAttributes());
183199

184200
}
185201

@@ -232,5 +248,10 @@ public static void initClient() {
232248
EntityRendererRegistry.register(SHIMMER_FISHING_BOBBER, ShimmerFishingBobberRenderer::new);
233249

234250
EntityRendererRegistry.register(BOOMERANG, BoomerangEntityRenderer::new);
251+
252+
EntityRendererRegistry.register(ModEntities.BLACKHOLE, BlackholeEntityRenderer::new);
253+
254+
EntityRendererRegistry.register(ModEntities.COGFLY, CogflyEntityRenderer::new);
255+
EntityModelLayerRegistry.registerModelLayer(AstralAdditionsClient.MODEL_COGFLY_LAYER, CogflyEntityModel::getTexturedModelData);
235256
}
236257
}
Lines changed: 113 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,113 @@
1+
package com.github.ethanicuss.astraladditions.entities.blackhole;
2+
3+
import com.github.ethanicuss.astraladditions.util.ModUtils;
4+
import net.minecraft.entity.EntityType;
5+
import net.minecraft.entity.ai.goal.*;
6+
import net.minecraft.entity.attribute.DefaultAttributeContainer;
7+
import net.minecraft.entity.attribute.EntityAttributes;
8+
import net.minecraft.entity.damage.DamageSource;
9+
import net.minecraft.entity.mob.HostileEntity;
10+
import net.minecraft.entity.player.PlayerEntity;
11+
import net.minecraft.particle.ParticleTypes;
12+
import net.minecraft.sound.SoundEvent;
13+
import net.minecraft.sound.SoundEvents;
14+
import net.minecraft.world.World;
15+
import software.bernie.geckolib3.core.IAnimatable;
16+
import software.bernie.geckolib3.core.PlayState;
17+
import software.bernie.geckolib3.core.builder.AnimationBuilder;
18+
import software.bernie.geckolib3.core.controller.AnimationController;
19+
import software.bernie.geckolib3.core.event.predicate.AnimationEvent;
20+
import software.bernie.geckolib3.core.manager.AnimationData;
21+
import software.bernie.geckolib3.core.manager.AnimationFactory;
22+
23+
24+
25+
public class BlackholeEntity extends HostileEntity implements IAnimatable {
26+
27+
private AnimationFactory factory = new AnimationFactory(this);
28+
29+
public BlackholeEntity(EntityType<? extends HostileEntity> entityType, World world) {
30+
super(entityType, world);
31+
this.experiencePoints = 20;
32+
}
33+
@Override
34+
protected void initGoals() {
35+
this.goalSelector.add(6, new LookAtEntityGoal(this, PlayerEntity.class, 12.0f));
36+
this.goalSelector.add(5, new GoToWalkTargetGoal(this, 1.0));
37+
this.goalSelector.add(5, new WanderAroundFarGoal(this, 0.75, 1f));
38+
this.goalSelector.add(3, new MeleeAttackGoal(this, 0.8D, false));
39+
this.goalSelector.add(5, new FlyGoal(this, 0.8D));
40+
41+
this.targetSelector.add(4, new ActiveTargetGoal<>(this, PlayerEntity.class, true));
42+
}
43+
44+
public static DefaultAttributeContainer.Builder createBlackholeAttributes(){
45+
return HostileEntity.createHostileAttributes()
46+
.add(EntityAttributes.GENERIC_MAX_HEALTH, 20.0D)
47+
.add(EntityAttributes.GENERIC_ATTACK_SPEED, 2.0f)
48+
.add(EntityAttributes.GENERIC_ATTACK_DAMAGE, 3.0f)
49+
.add(EntityAttributes.GENERIC_MOVEMENT_SPEED, 0.20f)
50+
.add(EntityAttributes.GENERIC_FLYING_SPEED, 0.55)
51+
.add(EntityAttributes.GENERIC_FOLLOW_RANGE, 32.0);
52+
}
53+
54+
55+
@Override
56+
protected SoundEvent getAmbientSound() {
57+
return SoundEvents.ENTITY_ILLUSIONER_PREPARE_MIRROR;
58+
}
59+
60+
@Override
61+
protected SoundEvent getHurtSound(DamageSource source) {
62+
return SoundEvents.ENTITY_FIREWORK_ROCKET_BLAST;
63+
}
64+
65+
@Override
66+
protected SoundEvent getDeathSound() {
67+
return SoundEvents.ENTITY_FIREWORK_ROCKET_TWINKLE_FAR;
68+
}
69+
70+
71+
@Override
72+
public void tickMovement() {
73+
if (this.world.isClient) {
74+
this.world.addParticle(ParticleTypes.GLOW, this.getParticleX(2), this.getRandomBodyY(), this.getParticleZ(2), 0.0, 0.0, 0.0);
75+
}
76+
super.tickMovement();
77+
}
78+
79+
private <E extends IAnimatable> PlayState predicate(AnimationEvent<E> event) {
80+
event.getController().setAnimation(new AnimationBuilder().addAnimation("regularLoop.blackhole.new", true));
81+
return PlayState.CONTINUE;
82+
}
83+
84+
85+
int pullCooldown = 30;
86+
87+
@Override
88+
public void tick() {
89+
pullCooldown--;
90+
PlayerEntity p = this.world.getClosestPlayer(this, 32);
91+
if (p != null) {
92+
//this.getMoveControl().moveTo(p.getX(), p.getY(), p.getZ(), 1.0);
93+
if (pullCooldown == 0){
94+
pullCooldown=30;
95+
if (!p.isCreative()) {
96+
ModUtils.pullPlayer(this, this.world, true, 0.35, 0.02, this.getX(), this.getZ(), this.getX() - 12, this.getY() - 3, this.getZ() - 12, this.getX() + 12, this.getY() + 3, this.getZ() + 12);
97+
}}
98+
}
99+
super.tick();
100+
}
101+
102+
@Override
103+
public void registerControllers(AnimationData animationData) {
104+
animationData.addAnimationController(new AnimationController(this, "controller",
105+
0, this::predicate));
106+
}
107+
108+
@Override
109+
public AnimationFactory getFactory() {
110+
return factory;
111+
}
112+
113+
}
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
package com.github.ethanicuss.astraladditions.entities.blackhole;
2+
3+
import com.github.ethanicuss.astraladditions.AstralAdditions;
4+
import net.minecraft.util.Identifier;
5+
import software.bernie.geckolib3.core.event.predicate.AnimationEvent;
6+
import software.bernie.geckolib3.core.processor.IBone;
7+
import software.bernie.geckolib3.model.AnimatedGeoModel;
8+
import software.bernie.geckolib3.model.provider.data.EntityModelData;
9+
10+
public class BlackholeEntityModel extends AnimatedGeoModel<BlackholeEntity> {
11+
@Override
12+
public Identifier getModelLocation(BlackholeEntity object) {
13+
return new Identifier(AstralAdditions.MOD_ID, "geo/blackhole.geo.json");
14+
}
15+
16+
@Override
17+
public Identifier getTextureLocation(BlackholeEntity object) {
18+
return new Identifier(AstralAdditions.MOD_ID, "textures/entity/blackhole/blackhole_texture.png");
19+
}
20+
21+
@Override
22+
public Identifier getAnimationFileLocation(BlackholeEntity animatable) {
23+
return new Identifier(AstralAdditions.MOD_ID, "animations/blackhole.animation.json");
24+
}
25+
26+
}
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
package com.github.ethanicuss.astraladditions.entities.blackhole;
2+
3+
import com.github.ethanicuss.astraladditions.AstralAdditions;
4+
import net.minecraft.client.render.entity.EntityRendererFactory;
5+
import net.minecraft.util.Identifier;
6+
import software.bernie.geckolib3.renderers.geo.GeoEntityRenderer;
7+
8+
public class BlackholeEntityRenderer extends GeoEntityRenderer<BlackholeEntity> {
9+
public BlackholeEntityRenderer(EntityRendererFactory.Context renderManager) {
10+
super(renderManager, new BlackholeEntityModel());
11+
}
12+
13+
@Override
14+
public Identifier getTexture(BlackholeEntity entity) {
15+
return new Identifier(AstralAdditions.MOD_ID, "textures/entity/blackhole/blackhole_texture.png");
16+
}
17+
}

0 commit comments

Comments
 (0)