-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
12 changed files
with
512 additions
and
35 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
Features: | ||
- Creepers explode when getting damaged by an explosion | ||
- Creepers ignite when on fire | ||
- Creepers get charged up when damaged by a charged creeper | ||
- Creepers have 4 times the follow / target range | ||
- Creepers spawn at any light level | ||
- Creepers have a randomly reduced fuse time | ||
- Creepers have a 10% chance to expel random flying blocks | ||
- These blocks can have any blockstate in the game | ||
- These blocks deal damage like anvils | ||
- Creepers have a 10% chance to spawn 1 to 10 other creepers with random status effects when exploding | ||
- Creepers don't take fall damage | ||
- Creepers have a 10% chance to spawn charged | ||
- Creepers are twice as fast | ||
- Creeper explosion have a random knockback between normal and five times the Vanilla knockback |
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
32 changes: 14 additions & 18 deletions
32
src/main/java/ladysnake/reactivecreepers/mixin/HostileEntityMixin.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 |
---|---|---|
@@ -1,30 +1,26 @@ | ||
package ladysnake.reactivecreepers.mixin; | ||
|
||
import net.minecraft.entity.EntityType; | ||
import net.minecraft.entity.damage.DamageSource; | ||
import net.minecraft.entity.SpawnReason; | ||
import net.minecraft.entity.mob.HostileEntity; | ||
import net.minecraft.entity.mob.MobEntityWithAi; | ||
import net.minecraft.entity.mob.Monster; | ||
import net.minecraft.world.World; | ||
import net.minecraft.util.math.BlockPos; | ||
import net.minecraft.world.Difficulty; | ||
import net.minecraft.world.ServerWorldAccess; | ||
import org.spongepowered.asm.mixin.Mixin; | ||
import org.spongepowered.asm.mixin.Unique; | ||
import org.spongepowered.asm.mixin.injection.At; | ||
import org.spongepowered.asm.mixin.injection.ModifyVariable; | ||
import org.spongepowered.asm.mixin.injection.Inject; | ||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; | ||
|
||
@Mixin(HostileEntity.class) | ||
public abstract class HostileEntityMixin extends MobEntityWithAi implements Monster { | ||
protected HostileEntityMixin(EntityType<? extends MobEntityWithAi> type, World world) { | ||
super(type, world); | ||
} | ||
import java.util.Random; | ||
|
||
@ModifyVariable(at = @At(value = "HEAD"), method = "damage", argsOnly = true) | ||
private float damage(float amount, DamageSource source) { | ||
return this.onDamage(source, amount); | ||
} | ||
@Mixin(HostileEntity.class) | ||
public class HostileEntityMixin { | ||
|
||
@Unique | ||
protected float onDamage(DamageSource source, float amount) { | ||
return amount; | ||
@Inject(method = "canSpawnInDark", at = @At("RETURN"), cancellable = true) | ||
private static void canSpawnInDark(EntityType<? extends HostileEntity> type, ServerWorldAccess world, SpawnReason spawnReason, BlockPos pos, Random random, CallbackInfoReturnable<Boolean> cir) { | ||
if (world.getDifficulty() != Difficulty.PEACEFUL && type == EntityType.CREEPER) { | ||
cir.setReturnValue(true); | ||
} | ||
} | ||
|
||
} |
29 changes: 29 additions & 0 deletions
29
src/main/java/ladysnake/reactivecreepers/mixin/LivingEntityMixin.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,29 @@ | ||
package ladysnake.reactivecreepers.mixin; | ||
|
||
import net.minecraft.entity.Entity; | ||
import net.minecraft.entity.EntityType; | ||
import net.minecraft.entity.LivingEntity; | ||
import net.minecraft.entity.damage.DamageSource; | ||
import net.minecraft.world.World; | ||
import org.spongepowered.asm.mixin.Mixin; | ||
import org.spongepowered.asm.mixin.Unique; | ||
import org.spongepowered.asm.mixin.injection.At; | ||
import org.spongepowered.asm.mixin.injection.ModifyVariable; | ||
|
||
@Mixin(LivingEntity.class) | ||
public abstract class LivingEntityMixin extends Entity { | ||
public LivingEntityMixin(EntityType<?> type, World world) { | ||
super(type, world); | ||
} | ||
|
||
@ModifyVariable(at = @At(value = "HEAD"), method = "damage", argsOnly = true) | ||
private float damage(float amount, DamageSource source) { | ||
return this.onDamage(source, amount); | ||
} | ||
|
||
@Unique | ||
protected float onDamage(DamageSource source, float amount) { | ||
return amount; | ||
} | ||
|
||
} |
30 changes: 30 additions & 0 deletions
30
src/main/java/ladysnake/reactivecreepers/mixin/MobEntityMixin.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,30 @@ | ||
package ladysnake.reactivecreepers.mixin; | ||
|
||
import net.minecraft.entity.EntityType; | ||
import net.minecraft.entity.LivingEntity; | ||
import net.minecraft.entity.SpawnReason; | ||
import net.minecraft.entity.mob.MobEntity; | ||
import net.minecraft.util.math.BlockPos; | ||
import net.minecraft.world.Difficulty; | ||
import net.minecraft.world.World; | ||
import net.minecraft.world.WorldAccess; | ||
import org.spongepowered.asm.mixin.Mixin; | ||
import org.spongepowered.asm.mixin.injection.At; | ||
import org.spongepowered.asm.mixin.injection.Inject; | ||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; | ||
|
||
import java.util.Random; | ||
|
||
@Mixin(MobEntity.class) | ||
public abstract class MobEntityMixin extends LivingEntity { | ||
protected MobEntityMixin(EntityType<? extends MobEntity> entityType, World world) { | ||
super(entityType, world); | ||
} | ||
|
||
@Inject(method = "canMobSpawn", at = @At("HEAD"), cancellable = true) | ||
private static void canMobSpawn(EntityType<? extends MobEntity> type, WorldAccess world, SpawnReason spawnReason, BlockPos pos, Random random, CallbackInfoReturnable<Boolean> cir) { | ||
if (world.getDifficulty() != Difficulty.PEACEFUL && type == EntityType.CREEPER) { | ||
cir.setReturnValue(true); | ||
} | ||
} | ||
} |
26 changes: 26 additions & 0 deletions
26
src/main/java/ladysnake/reactivecreepers/mixin/ServerWorldMixin.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,26 @@ | ||
package ladysnake.reactivecreepers.mixin; | ||
|
||
import ladysnake.reactivecreepers.world.CustomCreeperExplosion; | ||
import net.minecraft.entity.Entity; | ||
import net.minecraft.entity.damage.DamageSource; | ||
import net.minecraft.entity.mob.CreeperEntity; | ||
import net.minecraft.server.world.ServerWorld; | ||
import net.minecraft.world.World; | ||
import net.minecraft.world.explosion.Explosion; | ||
import net.minecraft.world.explosion.ExplosionBehavior; | ||
import org.jetbrains.annotations.Nullable; | ||
import org.spongepowered.asm.mixin.Mixin; | ||
import org.spongepowered.asm.mixin.injection.At; | ||
import org.spongepowered.asm.mixin.injection.ModifyVariable; | ||
|
||
@Mixin(ServerWorld.class) | ||
public class ServerWorldMixin { | ||
@ModifyVariable(method = "createExplosion(Lnet/minecraft/entity/Entity;Lnet/minecraft/entity/damage/DamageSource;Lnet/minecraft/world/explosion/ExplosionBehavior;DDDFZLnet/minecraft/world/explosion/Explosion$DestructionType;)Lnet/minecraft/world/explosion/Explosion;", at = @At("STORE")) | ||
private Explosion createExplosion(Explosion explosion, @Nullable Entity entity, @Nullable DamageSource damageSource, @Nullable ExplosionBehavior behavior, double x, double y, double z, float power, boolean createFire, Explosion.DestructionType destructionType) { | ||
if (entity instanceof CreeperEntity) { | ||
return new CustomCreeperExplosion((World) (Object) this, entity, damageSource, behavior, x, y, z, power, destructionType); | ||
} else { | ||
return explosion; | ||
} | ||
} | ||
} |
Oops, something went wrong.