Skip to content

Commit

Permalink
[1.20.6] Ported Potion Effect ME (#4843)
Browse files Browse the repository at this point in the history
* Ported PotionEffect ME

* Fix

* Fix

* I don't know how to do it

* Fix

---------

Co-authored-by: KlemenDEV <[email protected]>
  • Loading branch information
Spectrall368 and KlemenDEV committed May 24, 2024
1 parent 0c82a62 commit a0ee984
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 6 deletions.
2 changes: 1 addition & 1 deletion plugins/generator-1.20.6/neoforge-1.20.6/generator.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ structures_dir: "@MODDATAROOT/structures"
block_textures_dir: "@MODASSETSROOT/textures/block"
item_textures_dir: "@MODASSETSROOT/textures/item"
entity_textures_dir: "@MODASSETSROOT/textures/entities"
#effect_textures_dir: "@MODASSETSROOT/textures/mob_effect"
effect_textures_dir: "@MODASSETSROOT/textures/mob_effect"
particle_textures_dir: "@MODASSETSROOT/textures/particle"
screen_textures_dir: "@MODASSETSROOT/textures/screens"
armor_textures_dir: "@MODASSETSROOT/textures/models/armor"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,7 @@
package ${package}.init;

<#assign effects_that_expire = potioneffects?filter(effect -> hasProcedure(effect.onExpired))>

<#if effects_that_expire?size != 0>@Mod.EventBusSubscriber </#if>public class ${JavaModName}MobEffects {
<#if effects_that_expire?size != 0>@EventBusSubscriber </#if>public class ${JavaModName}MobEffects {

public static final DeferredRegister<MobEffect> REGISTRY = DeferredRegister.create(Registries.MOB_EFFECT, ${JavaModName}.MODID);

Expand All @@ -65,9 +64,8 @@ package ${package}.init;

private static void expireEffects(Entity entity, MobEffectInstance effectInstance) {
<#compress>
MobEffect effect = effectInstance.getEffect();
<#list effects_that_expire as effect>
if (effect == ${effect.getModElement().getRegistryNameUpper()}.get()) {
if (effectInstance.getEffect().is(${effect.getModElement().getRegistryNameUpper()})) {
<@procedureCode effect.onExpired, {
"x": "entity.getX()",
"y": "entity.getY()",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ public class ${name}MobEffect extends <#if data.isInstant>Instantenous</#if>MobE
</#if>

<#if hasProcedure(data.onActiveTick)>
@Override public void applyEffectTick(LivingEntity entity, int amplifier) {
@Override public boolean applyEffectTick(LivingEntity entity, int amplifier) {
<@procedureCode data.onActiveTick, {
"x": "entity.getX()",
"y": "entity.getY()",
Expand All @@ -86,6 +86,7 @@ public class ${name}MobEffect extends <#if data.isInstant>Instantenous</#if>MobE
"entity": "entity",
"amplifier": "amplifier"
}/>
return super.applyEffectTick(entity, amplifier);
}
</#if>

Expand Down

0 comments on commit a0ee984

Please sign in to comment.