Skip to content

Commit

Permalink
Merged 1.7.7 release
Browse files Browse the repository at this point in the history
  • Loading branch information
Majrusz committed Jun 15, 2023
2 parents e9e5236 + b0c1a97 commit b5521d8
Show file tree
Hide file tree
Showing 14 changed files with 69 additions and 19 deletions.
6 changes: 3 additions & 3 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,6 @@ versions_minecraft=1.20
versions_minecraft_range=[1.20,1.21)
versions_forge=46.0.1
versions_forge_range=[46.0.1,)
versions_mod=1.7.6
versions_mlib=4.3.0
versions_mlib_range=[4.3.0,5.0.0)
versions_mod=1.7.7
versions_mlib=4.3.2
versions_mlib_range=[4.3.2,5.0.0)
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
import net.minecraft.world.entity.*;
import net.minecraft.world.entity.ai.attributes.AttributeSupplier;
import net.minecraft.world.entity.ai.attributes.Attributes;
import net.minecraft.world.entity.monster.Monster;
import net.minecraft.world.entity.monster.Spider;
import net.minecraft.world.level.Level;
import net.minecraft.world.level.block.Blocks;
Expand All @@ -31,7 +32,7 @@ public static Supplier< EntityType< BlackWidowEntity > > createSupplier() {
}

public static AttributeSupplier getAttributeMap() {
return Mob.createMobAttributes()
return Monster.createMobAttributes()
.add( Attributes.MAX_HEALTH, 12.0 )
.add( Attributes.MOVEMENT_SPEED, 0.3 )
.add( Attributes.ATTACK_DAMAGE, 4.0 )
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ public static Supplier< EntityType< CerberusEntity > > createSupplier() {
}

public static AttributeSupplier getAttributeMap() {
return Mob.createMobAttributes()
return Monster.createMobAttributes()
.add( Attributes.MAX_HEALTH, 240.0 )
.add( Attributes.MOVEMENT_SPEED, 0.28 )
.add( Attributes.ATTACK_DAMAGE, 8.0 )
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
import net.minecraft.world.entity.ai.attributes.AttributeSupplier;
import net.minecraft.world.entity.ai.attributes.Attributes;
import net.minecraft.world.entity.monster.Creeper;
import net.minecraft.world.entity.monster.Monster;
import net.minecraft.world.level.Level;

import java.util.function.Supplier;
Expand All @@ -22,7 +23,7 @@ public static Supplier< EntityType< CreeperlingEntity > > createSupplier() {
}

public static AttributeSupplier getAttributeMap() {
return Mob.createMobAttributes()
return Monster.createMobAttributes()
.add( Attributes.MAX_HEALTH, 6.0 )
.add( Attributes.MOVEMENT_SPEED, 0.35 )
.build();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ public static Supplier< EntityType< CursedArmorEntity > > createSupplier() {
}

public static AttributeSupplier getAttributeMap() {
return Mob.createMobAttributes()
return Monster.createMobAttributes()
.add( Attributes.MAX_HEALTH, 30.0 )
.add( Attributes.MOVEMENT_SPEED, 0.23 )
.add( Attributes.ATTACK_DAMAGE, 3.0 )
Expand All @@ -99,6 +99,11 @@ public CursedArmorEntity( EntityType< ? extends CursedArmorEntity > type, Level
super( type, world );
}

@Override
public boolean canBreatheUnderwater() {
return true;
}

@Override
public int getExperienceReward() {
return Random.nextInt( 7 );
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ public static Supplier< EntityType< TankEntity > > createSupplier() {
}

public static AttributeSupplier getAttributeMap() {
return Mob.createMobAttributes()
return Monster.createMobAttributes()
.add( Attributes.MAX_HEALTH, 140.0 )
.add( Attributes.MOVEMENT_SPEED, 0.25 )
.add( Attributes.ATTACK_DAMAGE, 6.0 )
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
import com.mlib.gamemodifiers.ModConfigs;
import com.mlib.gamemodifiers.contexts.OnCheckSpawn;
import net.minecraft.world.entity.Entity;
import net.minecraftforge.eventbus.api.Event;

@AutoInstance
public class SpawnBlocker {
Expand All @@ -23,16 +22,12 @@ public SpawnBlocker() {
.name( "SpawnBlocker" )
.comment( "Blocks certain mobs from spawning when given game stage is active." );

OnCheckSpawn.listen( this::blockSpawn )
OnCheckSpawn.listen( OnCheckSpawn.CANCEL )
.addCondition( Condition.predicate( data->this.isForbidden( data.mob ) ) )
.addConfig( this.forbiddenEntities )
.insertTo( group );
}

private void blockSpawn( OnCheckSpawn.Data data ) {
data.event.setResult( Event.Result.DENY );
}

private boolean isForbidden( Entity entity ) {
return this.forbiddenEntities.getCurrentGameStageValue().contains( Utility.getRegistryString( entity.getType() ) );
}
Expand Down
16 changes: 12 additions & 4 deletions src/main/java/com/majruszsdifficulty/undeadarmy/Config.java
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
import com.mlib.gamemodifiers.contexts.OnDeath;
import com.mlib.gamemodifiers.contexts.OnLoot;
import com.mlib.gamemodifiers.contexts.OnServerTick;
import com.mlib.levels.LevelHelper;
import com.mlib.loot.LootHelper;
import com.mlib.math.Range;
import net.minecraft.ChatFormatting;
Expand All @@ -28,7 +29,7 @@
import net.minecraft.world.entity.Mob;
import net.minecraft.world.entity.MobType;
import net.minecraft.world.item.ItemStack;
import net.minecraft.world.level.storage.loot.LootContext;
import net.minecraft.world.level.Level;
import net.minecraft.world.level.storage.loot.LootParams;
import net.minecraft.world.level.storage.loot.parameters.LootContextParamSets;
import net.minecraft.world.level.storage.loot.parameters.LootContextParams;
Expand Down Expand Up @@ -74,6 +75,7 @@ public Config() {
.addCondition( Condition.predicate( data->data.target.getMobType() == MobType.UNDEAD ) )
.addCondition( Condition.predicate( data->!Registries.getUndeadArmyManager().isPartOfUndeadArmy( data.target ) ) )
.addCondition( Condition.predicate( data->data.attacker instanceof ServerPlayer ) )
.addCondition( Condition.predicate( data->LevelHelper.isEntityIn( data.attacker, Level.OVERWORLD ) ) )
.insertTo( group );

OnLoot.listen( this::giveExtraLoot )
Expand Down Expand Up @@ -138,13 +140,19 @@ public List< WaveDef > getWaves() {
.toList();
}

private void updateKilledUndead( OnDeath.Data data ) {
ServerPlayer player = ( ServerPlayer )data.attacker;
CompoundTag tag = player.getPersistentData();
public UndeadArmyInfo readUndeadArmyInfo( CompoundTag tag ) {
UndeadArmyInfo info = new UndeadArmyInfo();
info.killedUndead = this.getInitialKillsCount();
info.read( tag );

return info;
}

private void updateKilledUndead( OnDeath.Data data ) {
ServerPlayer player = ( ServerPlayer )data.attacker;
CompoundTag tag = player.getPersistentData();
UndeadArmyInfo info = this.readUndeadArmyInfo( tag );

++info.killedUndead;
if( info.killedUndead >= this.getRequiredKills() && Registries.getUndeadArmyManager().tryToSpawn( player ) ) {
info.killedUndead = 0;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,10 @@ public List< UndeadArmy > getUndeadArmies() {
return Collections.unmodifiableList( this.undeadArmies );
}

public Config getConfig() {
return this.config;
}

void tick() {
this.undeadArmies.forEach( UndeadArmy::tick );
boolean hasAnyArmyFinished = this.undeadArmies.removeIf( UndeadArmy::hasFinished );
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
package com.majruszsdifficulty.undeadarmy.commands;

import com.majruszsdifficulty.Registries;
import com.majruszsdifficulty.undeadarmy.Config;
import com.majruszsdifficulty.undeadarmy.data.UndeadArmyInfo;
import com.mlib.annotations.AutoInstance;
import com.mlib.commands.Command;
import com.mlib.commands.CommandData;
import com.mojang.brigadier.exceptions.CommandSyntaxException;
import net.minecraft.network.chat.Component;
import net.minecraft.world.entity.Entity;

@AutoInstance
public class UndeadArmyPersonalProgressCommand extends Command {
public UndeadArmyPersonalProgressCommand() {
this.newBuilder()
.literal( "undeadarmy" )
.literal( "progress" )
.hasPermission( 4 )
.execute( this::handle )
.entity()
.execute( this::handle );
}

private int handle( CommandData data ) throws CommandSyntaxException {
Config config = Registries.getUndeadArmyManager().getConfig();
Entity entity = this.getOptionalEntityOrPlayer( data );
UndeadArmyInfo info = config.readUndeadArmyInfo( entity.getPersistentData() );
int killsToStart = Math.max( config.getRequiredKills() - info.killedUndead, 1 );

data.source.sendSuccess( ()->Component.translatable( "commands.undeadarmy.progress", entity.getDisplayName(), killsToStart ), true );
return -1;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,7 @@
"commands.undeadarmy.highlighted": "All Undead Army units were highlighted at position: %s",
"commands.undeadarmy.list": "List of all Undead Armies in progress:",
"commands.undeadarmy.list_empty": "There is no Undead Army in progress!",
"commands.undeadarmy.progress": "%1$s must kill %2$s more undead to start the Undead Army.",
"commands.treasurebag.reset": "Progress of all treasure bags has been restarted for %1$s.",
"commands.treasurebag.unlockall": "Progress of all treasure bags has been maxed out for %1$s.",
"commands.clampedregionaldifficulty": "Clamped regional difficulty at %1$s is %2$s.",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,7 @@
"commands.undeadarmy.highlighted": "Wszystkie jednostki armii nieumarłych zostały podświetlone na pozycji: %s",
"commands.undeadarmy.list": "Lista wszystkich trwających najazdów armii nieumarłych:",
"commands.undeadarmy.list_empty": "Aktualnie nie trwa żaden najazd armii nieumarłych!",
"commands.undeadarmy.progress": "%1$s musi zabić jeszcze %2$s nieumarłych, żeby rozpocząć najazd armii nieumarłych.",
"commands.treasurebag.reset": "Progres wszystkich worków ze skarbami został zresetowany dla %1$s.",
"commands.treasurebag.unlockall": "Progres wszystkich worków ze skarbami został ustawiony na maksimum dla %1$s.",
"commands.clampedregionaldifficulty": "Poziom regionalnej trudności na %1$s wynosi %2$s.",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"spawners": [
{
"type": "minecraft:illusioner",
"weight": 20,
"weight": 8,
"minCount": 1,
"maxCount": 1
},
Expand Down

0 comments on commit b5521d8

Please sign in to comment.