Skip to content

Commit

Permalink
Replace cave spiders poison with weakness effect
Browse files Browse the repository at this point in the history
  • Loading branch information
hea3ven committed Jan 7, 2019
1 parent a520f7b commit f4e72fd
Show file tree
Hide file tree
Showing 6 changed files with 49 additions and 5 deletions.
2 changes: 1 addition & 1 deletion Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ pipeline {
changes += "${entry.msg}\r\n".replace('\'', '\\\'')
}
}
sh "gradle build check curseforge githubRelease --stacktrace --info -PBUILD_NO=$BUILD_NUMBER -Pcurse_api_key=$curse_api_key -Pgithub_release_token=$github_release_token -Pchangelog='$changes'"
sh "gradle clean build check curseforge githubRelease --stacktrace --info -PBUILD_NO=$BUILD_NUMBER -Pcurse_api_key=$curse_api_key -Pgithub_release_token=$github_release_token -Pchangelog='$changes'"
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
project_group=com.hea3ven.dulcedeleche
project_name=DulceDeLeche
project_display_name=Dulce De Leche
project_version=1.1.0
project_version=1.1.1
project_class=com.hea3ven.dulcedeleche.ModDulceDeLeche
project_repo=hea3ven/DulceDeLeche
project_repo_branch=master
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
package com.hea3ven.dulcedeleche.modules.mobs.mixin;

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 net.minecraft.entity.Entity;
import net.minecraft.entity.LivingEntity;
import net.minecraft.entity.mob.CaveSpiderEntity;
import net.minecraft.entity.mob.MobEntity;
import net.minecraft.entity.mob.SpiderEntity;

import com.hea3ven.dulcedeleche.modules.mobs.MobsModule;

@Mixin(CaveSpiderEntity.class)
public abstract class CaveSpiderEntityMixin extends SpiderEntity {

protected CaveSpiderEntityMixin() {
super(null, null);
}

@Inject(method = "method_6121(Lnet/minecraft/entity/Entity;)Z", at = @At("HEAD"),
cancellable = true)
public void onPrepareEntityAttributes(Entity entity, CallbackInfoReturnable<Boolean> info) {
if (MobsModule.INSTANCE.cfg.getReplaceCaveSpiderPoison()) {
if (super.method_6121(entity)) {
MobsModule.INSTANCE.onCaveSpiderEntityDoAttack(this, entity);
info.setReturnValue(true);
} else {
info.setReturnValue(false);
}
}
}
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package com.hea3ven.dulcedeleche.modules.mobs

import com.hea3ven.dulcedeleche.Module
import com.hea3ven.dulcedeleche.modules.mobs.mixin.CaveSpiderEntityMixin
import net.minecraft.entity.Entity
import net.minecraft.entity.LivingEntity
import net.minecraft.entity.SpawnType
Expand All @@ -14,7 +15,7 @@ import net.minecraft.world.IWorld
import net.minecraft.world.LightType

object MobsModule : Module<MobsModuleConfig>() {
override fun createDefaultConfig() = MobsModuleConfig(true, 14.0, true)
override fun createDefaultConfig() = MobsModuleConfig(true, 14.0, true, true)

override fun onInitialize() {
}
Expand All @@ -39,5 +40,12 @@ object MobsModule : Module<MobsModuleConfig>() {
}
}
}

fun onCaveSpiderEntityDoAttack(entity: LivingEntity, target: Entity) {
if (target !is LivingEntity) {
return
}
target.addPotionEffect(StatusEffectInstance(StatusEffects.WEAKNESS, 15 * 20));
}
}

Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@ package com.hea3ven.dulcedeleche.modules.mobs
import com.hea3ven.dulcedeleche.config.BaseModuleConfig

data class MobsModuleConfig(val blockCreeperSpawnInSurface: Boolean, val zombieKnockbackAttributeMultiplier: Double,
val spidersApplySlowness: Boolean) : BaseModuleConfig() {}
val spidersApplySlowness: Boolean, val replaceCaveSpiderPoison: Boolean) : BaseModuleConfig() {}
3 changes: 2 additions & 1 deletion src/main/resources/dulcedeleche.mobs.common.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@
"mixins": [
"CreeperEntityMixin",
"ZombieEntityMixin",
"MobEntityMixin"
"MobEntityMixin",
"CaveSpiderEntityMixin"
],
"injectors": {
"defaultRequire": 1
Expand Down

0 comments on commit f4e72fd

Please sign in to comment.