-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Hammer Cod, Whacker Salmon, Mixin Extra usage, and FlounderFest spawn…
… rate changes! FEAT: Added Hammer Cod, a cod holding a giant toy hammer which does a lot damage! FEAT: Added Whacker Salmon, a salmon holding a punching glove which does a lot of knockback! REFACTOR: Updated ClientWorldMixin to ModifyReturnValue from MixinExtras REFACTOR: Updated FlounderFest spawn rates to be slightly more chaotic, but also more balanced.
- Loading branch information
1 parent
b21b161
commit 20302c4
Showing
22 changed files
with
939 additions
and
34 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
12 changes: 12 additions & 0 deletions
12
src/main/java/net/superkat/flutterandflounder/entity/client/cod/HammerCodModel.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
package net.superkat.flutterandflounder.entity.client.cod; | ||
|
||
import net.minecraft.util.Identifier; | ||
import net.superkat.flutterandflounder.FlutterAndFlounderMain; | ||
import net.superkat.flutterandflounder.entity.custom.cod.HammerCodEntity; | ||
import software.bernie.geckolib.model.DefaultedEntityGeoModel; | ||
|
||
public class HammerCodModel extends DefaultedEntityGeoModel<HammerCodEntity> { | ||
public HammerCodModel() { | ||
super(new Identifier(FlutterAndFlounderMain.MOD_ID, "hammercod"), false); | ||
} | ||
} |
11 changes: 11 additions & 0 deletions
11
src/main/java/net/superkat/flutterandflounder/entity/client/cod/HammerCodRenderer.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
package net.superkat.flutterandflounder.entity.client.cod; | ||
|
||
import net.minecraft.client.render.entity.EntityRendererFactory; | ||
import net.superkat.flutterandflounder.entity.custom.cod.HammerCodEntity; | ||
import software.bernie.geckolib.renderer.GeoEntityRenderer; | ||
|
||
public class HammerCodRenderer extends GeoEntityRenderer<HammerCodEntity> { | ||
public HammerCodRenderer(EntityRendererFactory.Context renderManager) { | ||
super(renderManager, new HammerCodModel()); | ||
} | ||
} |
12 changes: 12 additions & 0 deletions
12
src/main/java/net/superkat/flutterandflounder/entity/client/salmon/WhackerSalmonModel.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
package net.superkat.flutterandflounder.entity.client.salmon; | ||
|
||
import net.minecraft.util.Identifier; | ||
import net.superkat.flutterandflounder.FlutterAndFlounderMain; | ||
import net.superkat.flutterandflounder.entity.custom.salmon.WhackerSalmonEntity; | ||
import software.bernie.geckolib.model.DefaultedEntityGeoModel; | ||
|
||
public class WhackerSalmonModel extends DefaultedEntityGeoModel<WhackerSalmonEntity> { | ||
public WhackerSalmonModel() { | ||
super(new Identifier(FlutterAndFlounderMain.MOD_ID, "whacker"), true); | ||
} | ||
} |
11 changes: 11 additions & 0 deletions
11
...main/java/net/superkat/flutterandflounder/entity/client/salmon/WhackerSalmonRenderer.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
package net.superkat.flutterandflounder.entity.client.salmon; | ||
|
||
import net.minecraft.client.render.entity.EntityRendererFactory; | ||
import net.superkat.flutterandflounder.entity.custom.salmon.WhackerSalmonEntity; | ||
import software.bernie.geckolib.renderer.GeoEntityRenderer; | ||
|
||
public class WhackerSalmonRenderer extends GeoEntityRenderer<WhackerSalmonEntity> { | ||
public WhackerSalmonRenderer(EntityRendererFactory.Context renderManager) { | ||
super(renderManager, new WhackerSalmonModel()); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
98 changes: 98 additions & 0 deletions
98
src/main/java/net/superkat/flutterandflounder/entity/custom/cod/HammerCodEntity.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,98 @@ | ||
package net.superkat.flutterandflounder.entity.custom.cod; | ||
|
||
import net.minecraft.entity.EntityType; | ||
import net.minecraft.entity.ai.TargetPredicate; | ||
import net.minecraft.entity.ai.goal.ActiveTargetGoal; | ||
import net.minecraft.entity.ai.goal.LookAtEntityGoal; | ||
import net.minecraft.entity.ai.goal.MeleeAttackGoal; | ||
import net.minecraft.entity.attribute.DefaultAttributeContainer; | ||
import net.minecraft.entity.attribute.EntityAttributes; | ||
import net.minecraft.entity.mob.HostileEntity; | ||
import net.minecraft.entity.mob.MobEntity; | ||
import net.minecraft.entity.player.PlayerEntity; | ||
import net.minecraft.sound.SoundCategory; | ||
import net.minecraft.sound.SoundEvents; | ||
import net.minecraft.util.math.BlockPos; | ||
import net.minecraft.util.math.Box; | ||
import net.minecraft.world.World; | ||
import net.superkat.flutterandflounder.entity.custom.CommonBossFish; | ||
import software.bernie.geckolib.core.animatable.instance.AnimatableInstanceCache; | ||
import software.bernie.geckolib.core.animation.AnimatableManager; | ||
import software.bernie.geckolib.core.animation.AnimationController; | ||
import software.bernie.geckolib.core.animation.AnimationState; | ||
import software.bernie.geckolib.core.animation.RawAnimation; | ||
import software.bernie.geckolib.core.object.PlayState; | ||
import software.bernie.geckolib.util.GeckoLibUtil; | ||
|
||
import java.util.List; | ||
|
||
public class HammerCodEntity extends CommonBossFish { | ||
protected static final RawAnimation IDLE_ANIM = RawAnimation.begin().thenLoop("animation.hammercod.idle"); | ||
protected static final RawAnimation ATTACK_ANIM = RawAnimation.begin().thenLoop("animation.hammercod.attack"); | ||
private final AnimatableInstanceCache geoCache = GeckoLibUtil.createInstanceCache(this); | ||
public HammerCodEntity(EntityType<? extends HostileEntity> entityType, World world) { | ||
super(entityType, world); | ||
} | ||
|
||
@Override | ||
public void registerControllers(AnimatableManager.ControllerRegistrar controllers) { | ||
controllers.add(new AnimationController<>(this, "controller", 5, this::animController) | ||
.setParticleKeyframeHandler(state -> { | ||
BlockPos pos = state.getAnimatable().getBlockPos(); | ||
BlockPos particlePos = pos.offset(state.getAnimatable().getHorizontalFacing(), 2); | ||
this.getWorld().addBlockBreakParticles(particlePos, state.getAnimatable().getSteppingBlockState()); | ||
}).setSoundKeyframeHandler(state -> { | ||
Box box = state.getAnimatable().getBoundingBox().expand(15.0, 8.0, 15.0); | ||
List<PlayerEntity> players = this.getWorld().getPlayers(TargetPredicate.createNonAttackable().setBaseMaxDistance(15), state.getAnimatable(), box); | ||
|
||
for(PlayerEntity player : players) { | ||
player.playSound(SoundEvents.ENTITY_PLAYER_ATTACK_CRIT, SoundCategory.HOSTILE, 1, 0.7f); | ||
} | ||
}) | ||
); | ||
} | ||
|
||
// private TargetPredicate isInHammerHearingRange() { | ||
// return player -> { | ||
// double distance = squaredDistanceTo(player); | ||
// return distance <= 15; | ||
// }; | ||
// } | ||
|
||
protected<E extends HammerCodEntity> PlayState animController(final AnimationState<E> event) { | ||
if(this.isAttacking()) { | ||
return event.setAndContinue(ATTACK_ANIM); | ||
} else if (!event.isMoving()) { | ||
return event.setAndContinue(IDLE_ANIM); | ||
} else { | ||
return PlayState.STOP; | ||
} | ||
} | ||
|
||
@Override | ||
public AnimatableInstanceCache getAnimatableInstanceCache() { | ||
return geoCache; | ||
} | ||
|
||
private boolean shouldHearHammerSound(PlayerEntity player) { | ||
double distance = squaredDistanceTo(player); | ||
return distance <= 15; | ||
} | ||
|
||
public static DefaultAttributeContainer.Builder createAttributes() { | ||
return MobEntity.createMobAttributes() | ||
.add(EntityAttributes.GENERIC_MAX_HEALTH, 15) | ||
.add(EntityAttributes.GENERIC_MOVEMENT_SPEED, 0.30) | ||
.add(EntityAttributes.GENERIC_ATTACK_DAMAGE, 10) | ||
.add(EntityAttributes.GENERIC_ATTACK_KNOCKBACK, 5) | ||
.add(EntityAttributes.GENERIC_KNOCKBACK_RESISTANCE, 2) | ||
.add(EntityAttributes.GENERIC_FOLLOW_RANGE, 48); | ||
} | ||
|
||
@Override | ||
protected void initGoals() { | ||
this.goalSelector.add(1, new MeleeAttackGoal(this, 1, false)); | ||
this.goalSelector.add(2, new LookAtEntityGoal(this, PlayerEntity.class, 15f, 0.5f)); | ||
this.targetSelector.add(1, new ActiveTargetGoal<>(this, PlayerEntity.class, true)); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
69 changes: 69 additions & 0 deletions
69
src/main/java/net/superkat/flutterandflounder/entity/custom/salmon/WhackerSalmonEntity.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
package net.superkat.flutterandflounder.entity.custom.salmon; | ||
|
||
import net.minecraft.entity.EntityType; | ||
import net.minecraft.entity.ai.goal.ActiveTargetGoal; | ||
import net.minecraft.entity.ai.goal.LookAtEntityGoal; | ||
import net.minecraft.entity.ai.goal.MeleeAttackGoal; | ||
import net.minecraft.entity.ai.goal.WanderAroundFarGoal; | ||
import net.minecraft.entity.attribute.DefaultAttributeContainer; | ||
import net.minecraft.entity.attribute.EntityAttributes; | ||
import net.minecraft.entity.mob.HostileEntity; | ||
import net.minecraft.entity.mob.MobEntity; | ||
import net.minecraft.entity.player.PlayerEntity; | ||
import net.minecraft.world.World; | ||
import net.superkat.flutterandflounder.entity.custom.CommonBossFish; | ||
import software.bernie.geckolib.core.animatable.instance.AnimatableInstanceCache; | ||
import software.bernie.geckolib.core.animation.AnimatableManager; | ||
import software.bernie.geckolib.core.animation.AnimationController; | ||
import software.bernie.geckolib.core.animation.AnimationState; | ||
import software.bernie.geckolib.core.animation.RawAnimation; | ||
import software.bernie.geckolib.core.object.PlayState; | ||
import software.bernie.geckolib.util.GeckoLibUtil; | ||
|
||
public class WhackerSalmonEntity extends CommonBossFish { | ||
protected static final RawAnimation IDLE_ANIM = RawAnimation.begin().thenLoop("animation.whacker.idle"); | ||
protected static final RawAnimation WALK_ANIM = RawAnimation.begin().thenLoop("animation.whacker.walk"); | ||
protected static final RawAnimation ATTACK_ANIM = RawAnimation.begin().thenLoop("animation.whacker.attack"); | ||
private final AnimatableInstanceCache geoCache = GeckoLibUtil.createInstanceCache(this); | ||
public WhackerSalmonEntity(EntityType<? extends HostileEntity> entityType, World world) { | ||
super(entityType, world); | ||
} | ||
|
||
@Override | ||
public void registerControllers(AnimatableManager.ControllerRegistrar controllers) { | ||
controllers.add(new AnimationController<>(this, "controller", 5, this::animController)); | ||
} | ||
|
||
protected <E extends WhackerSalmonEntity> PlayState animController(final AnimationState<E> event) { | ||
if(this.isAttacking()) { | ||
return event.setAndContinue(ATTACK_ANIM); | ||
} else if (event.isMoving()) { | ||
return event.setAndContinue(WALK_ANIM); | ||
} else { | ||
return event.setAndContinue(IDLE_ANIM); | ||
} | ||
} | ||
|
||
@Override | ||
public AnimatableInstanceCache getAnimatableInstanceCache() { | ||
return geoCache; | ||
} | ||
|
||
public static DefaultAttributeContainer.Builder createAttributes() { | ||
return MobEntity.createMobAttributes() | ||
.add(EntityAttributes.GENERIC_MAX_HEALTH, 15) | ||
.add(EntityAttributes.GENERIC_MOVEMENT_SPEED, 0.4) | ||
.add(EntityAttributes.GENERIC_ATTACK_DAMAGE, 7) | ||
.add(EntityAttributes.GENERIC_ATTACK_SPEED, 0.3) | ||
.add(EntityAttributes.GENERIC_ATTACK_KNOCKBACK, 5) | ||
.add(EntityAttributes.GENERIC_FOLLOW_RANGE, 48); | ||
} | ||
|
||
@Override | ||
protected void initGoals() { | ||
this.goalSelector.add(1, new MeleeAttackGoal(this, 1, false)); | ||
this.goalSelector.add(2, new LookAtEntityGoal(this, PlayerEntity.class, 15f, 1f)); | ||
this.goalSelector.add(3, new WanderAroundFarGoal(this, 1)); | ||
this.targetSelector.add(1, new ActiveTargetGoal<>(this, PlayerEntity.class, true)); | ||
} | ||
} |
Oops, something went wrong.