Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 10 additions & 6 deletions TODO.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@

1.20.1-1.3.0-beta-7
1.20.1-1.3.0-beta-8

[✔] Done and tested
[🟡] Partially done and/or needs testing
Expand All @@ -22,17 +22,21 @@ New Heroes

Bugfixes
--------
[✔] Fixed grunts and villagers dealing too much damage to animals
[✔] Workers no longer stand on other building foundations while working on adjacent buildings
- This sometimes got them stuck on the top of a building
[✔] Heroes can no longer pick up weapons and armour
[✔] Zombies summoned by necromancers no longer drop their weapons on death
[✔] Fixed the player defeated announcement text
[✔] Fixed grunts and villagers dealing too much damage to other units
[✔] Changing /gamerule groundYLevel no longer moves players that aren't in RTS cam (this was killing survival players!)
- This also happened whenever another player logged in
[✔] Destroying a farm now destroys all of its crop blocks

Quality of Life
---------------

[✔] The Royal Guard and Enchanter now have the collision size of regular illagers (visual size unchanged)

Balance
-------

[✔] All damage dealt to huntable animals by military units is halved

Languages
---------
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ apply plugin: 'maven-publish'
apply plugin: 'org.spongepowered.mixin'
apply plugin: 'org.parchmentmc.librarian.forgegradle'

version = '1.3.0-beta-7'
version = '1.3.0-beta-8'
group = 'com.solegendary.reignofnether' // http://maven.apache.org/guides/mini/guide-naming-conventions.html
archivesBaseName = 'reignofnether'

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@
public class ReignOfNether {
public static final Logger LOGGER = LogManager.getLogger();
public static final String MOD_ID = "reignofnether";
public static final String VERSION_STRING = "1.3.0-beta-7";
public static final String VERSION_STRING = "1.3.0-beta-8";

// Fields from ClientReset
public static final Field handshakeField;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
import com.solegendary.reignofnether.unit.units.villagers.VillagerUnit;
import net.minecraft.core.BlockPos;
import net.minecraft.core.Direction;
import net.minecraft.server.level.ServerLevel;
import net.minecraft.tags.BlockTags;
import net.minecraft.world.entity.LivingEntity;
import net.minecraft.world.level.Level;
Expand Down Expand Up @@ -145,4 +146,20 @@ public void tick(Level tickLevel) {
if (!level.isClientSide() && tickAge % TICK_CROPS_INTERVAL == 0)
tickCrops();
}

@Override
public void destroy(ServerLevel serverLevel) {
super.destroy(serverLevel);
for (int x = minCorner.getX(); x <= maxCorner.getX(); x++) {
for (int y = minCorner.getY(); y <= maxCorner.getY(); y++) {
for (int z = minCorner.getZ(); z <= maxCorner.getZ(); z++) {
BlockPos bp = new BlockPos(x,y,z);
BlockState bs = serverLevel.getBlockState(bp);
Block block = bs.getBlock();
if (bs.getTags().toList().contains(BlockTags.CROPS) || block == Blocks.MELON || block == Blocks.PUMPKIN)
serverLevel.destroyBlock(bp, false);
}
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ public static Pair<Integer, Integer> getPortraitRendererModifiers(LivingEntity e
yOffset = -35;
scale = -27;
} else if (entity instanceof RoyalGuardUnit royalGuardUnit) {
yOffset = -34;
yOffset = -14;
scale = -16;
float avatarPercent = (float) royalGuardUnit.avatarScaleTicks / royalGuardUnit.AVATAR_SCALE_TICKS_MAX;
yOffset -= (26 * avatarPercent);
Expand All @@ -118,7 +118,7 @@ public static Pair<Integer, Integer> getPortraitRendererModifiers(LivingEntity e
yOffset = -30;
scale = -32;
} else if (entity instanceof EnchanterUnit) {
yOffset = -36;
yOffset = -12;
scale = -16;
} else if (entity instanceof MarauderUnit) {
yOffset = -34;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@
import com.solegendary.reignofnether.survival.SurvivalServerEvents;
import com.solegendary.reignofnether.unit.interfaces.AttackerUnit;
import com.solegendary.reignofnether.unit.interfaces.Unit;
import com.solegendary.reignofnether.unit.interfaces.WorkerUnit;
import com.solegendary.reignofnether.unit.units.villagers.MilitiaUnit;
import com.solegendary.reignofnether.unit.units.villagers.VillagerUnit;
import com.solegendary.reignofnether.unit.units.villagers.VillagerUnitProfession;
import net.minecraft.core.BlockPos;
import net.minecraft.core.Direction;
import net.minecraft.server.level.ServerPlayer;
Expand Down Expand Up @@ -122,24 +126,38 @@ private void FrostWalkerOnEntityMoved(LivingEntity pLiving, Level pLevel, BlockP
cancellable = true
)
protected void actuallyHurt(DamageSource pDamageSource, float pDamageAmount, CallbackInfo ci) {


// ensure projectiles from units do the damage of the unit, not the item,
// and that armour and anti-armour effects are considered through absorption
if ((pDamageSource.is(DamageTypeTags.IS_PROJECTILE) ||
!pDamageSource.is(DamageTypeTags.WITCH_RESISTANT_TO) &&
(!pDamageSource.is(DamageTypeTags.WITCH_RESISTANT_TO) &&
!pDamageSource.is(DamageTypeTags.BYPASSES_SHIELD) &&
!pDamageSource.is(DamageTypeTags.BYPASSES_ARMOR) &&
!pDamageSource.is(DamageTypeTags.BYPASSES_RESISTANCE) &&
pDamageSource.is(DamageTypes.MOB_ATTACK)) &&
pDamageSource.getEntity() instanceof AttackerUnit attackerUnit &&
!ResourceSources.isHuntableAnimal((LivingEntity) (Object) this)) {
pDamageSource.is(DamageTypes.MOB_ATTACK))) &&
pDamageSource.getEntity() instanceof AttackerUnit attackerUnit) {

ci.cancel();

boolean isHuntableAnimal = ResourceSources.isHuntableAnimal((LivingEntity) (Object) this);

float dmg = attackerUnit.getUnitAttackDamage();
boolean isMelee = pDamageSource.is(DamageTypes.MOB_ATTACK) && !pDamageSource.is(DamageTypeTags.IS_PROJECTILE);
if (isMelee)
if (isMelee && !(pDamageSource.getEntity() instanceof WorkerUnit))
dmg += AttackerUnit.getWeaponDamageModifier(attackerUnit);

if (isHuntableAnimal) {
if (pDamageSource.getEntity() instanceof MilitiaUnit)
dmg = 1f;
else if (pDamageSource.getEntity() instanceof VillagerUnit vUnit &&
vUnit.getUnitProfession() == VillagerUnitProfession.HUNTER) {
dmg = vUnit.isVeteran() ? 2f : 1.5f;
} else if (!(pDamageSource.getEntity() instanceof WorkerUnit)) {
dmg *= 0.5f;
}
}

if (this instanceof Unit unit) {
dmg *= (1 - unit.getUnitPhysicalArmorPercentage());
if (pDamageSource.is(DamageTypeTags.IS_PROJECTILE))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,9 @@ public static boolean shouldHideLeaves() {

public static void setMinOrthoviewY(double value) {
minOrthoviewY = value;
if (MC.level != null && MC.player != null && MC.player.getY() < value + 15) {
if (MC.level != null && MC.player != null && MC.player.getY() < value + 15 && MC.gameMode != null &&
(MC.gameMode.getPlayerMode() == GameType.CREATIVE ||
MC.gameMode.getPlayerMode() == GameType.SPECTATOR) && isEnabled()) {
MC.player.move(MoverType.SELF, new Vec3(0, minOrthoviewY - MC.player.getY() + 15, 0));
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -307,10 +307,17 @@ public static void onPlayerJoin(PlayerEvent.PlayerLoggedInEvent evt) {
ResearchServerEvents.syncResearch(playerName);
ResearchServerEvents.syncCheats(playerName);
}

boolean inOrthoviewList = false;
for (ServerPlayer orthoviewPlayer : orthoviewPlayers) {
if (orthoviewPlayer.getId() != evt.getEntity().getId()) continue;
orthoviewPlayers.add((ServerPlayer) evt.getEntity());
if (orthoviewPlayer.getId() == evt.getEntity().getId()) {
inOrthoviewList = true;
break;
}
}
if (!inOrthoviewList)
orthoviewPlayers.add((ServerPlayer) evt.getEntity());

if (!TutorialServerEvents.isEnabled()) {
if (!isRTSPlayer(serverPlayer.getId())) {
serverPlayer.sendSystemMessage(Component.translatable("tutorial.reignofnether.welcome")
Expand Down Expand Up @@ -837,7 +844,7 @@ public static void defeat(String playerName, String reason) {
// Remove the defeated player from the list
rtsPlayers.removeIf(rtsPlayer -> {
if (rtsPlayer.name.equals(playerName)) {
sendMessageToAllPlayers("server.reignofnether.is_defeated", true);
sendMessageToAllPlayers("server.reignofnether.is_defeated", true, playerName, reason);
sendMessageToAllPlayers("server.reignofnether.players_remaining", false, (rtsPlayers.size() - 1));

postGameRtsPlayers.add(rtsPlayer);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -233,15 +233,15 @@ public class EntityRegistrar {

public static final RegistryObject<EntityType<RoyalGuardUnit>> ROYAL_GUARD_UNIT = ENTITIES.register("royal_guard_unit",
() -> EntityType.Builder.of(RoyalGuardUnit::new, MobCategory.CREATURE)
.sized(EntityType.VINDICATOR.getWidth() * RoyalGuardRenderer.SCALE_MULT,
EntityType.VINDICATOR.getHeight() * RoyalGuardRenderer.SCALE_MULT)
.sized(EntityType.VINDICATOR.getWidth(),
EntityType.VINDICATOR.getHeight())
.clientTrackingRange(UNIT_CLIENT_TRACKING_RANGE)
.build(ResourceLocation.fromNamespaceAndPath(ReignOfNether.MOD_ID, "royal_guard_unit").toString()));

public static final RegistryObject<EntityType<EnchanterUnit>> ENCHANTER_UNIT = ENTITIES.register("enchanter_unit",
() -> EntityType.Builder.of(EnchanterUnit::new, MobCategory.CREATURE)
.sized(EntityType.VINDICATOR.getWidth() * EnchanterRenderer.SCALE_MULT,
EntityType.VINDICATOR.getHeight() * EnchanterRenderer.SCALE_MULT)
.sized(EntityType.VINDICATOR.getWidth(),
EntityType.VINDICATOR.getHeight())
.clientTrackingRange(UNIT_CLIENT_TRACKING_RANGE)
.build(ResourceLocation.fromNamespaceAndPath(ReignOfNether.MOD_ID, "enchanter_unit").toString()));

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -849,24 +849,6 @@ public static void onEntityDamaged(LivingDamageEvent evt) {
evt.setAmount(evt.getAmount() / 2);
}

if (ResourceSources.isHuntableAnimal(evt.getEntity()) && (
evt.getSource().getEntity() instanceof MilitiaUnit
)) {
evt.setAmount(1);
return;
}

if (ResourceSources.isHuntableAnimal(evt.getEntity()) && (
evt.getSource().getEntity() instanceof VillagerUnit vUnit &&
vUnit.getUnitProfession() == VillagerUnitProfession.HUNTER
)) {
if (vUnit.isVeteran())
evt.setAmount(2);
else
evt.setAmount(1.5f);
return;
}

if (evt.getEntity() instanceof Unit && (
evt.getSource() == evt.getEntity().damageSources().sweetBerryBush() || evt.getSource() == evt.getEntity().damageSources().cactus()
)) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@
import net.minecraft.world.entity.ai.attributes.Attributes;
import net.minecraft.world.entity.ai.goal.FloatGoal;
import net.minecraft.world.entity.ai.goal.Goal;
import net.minecraft.world.entity.item.ItemEntity;
import net.minecraft.world.entity.monster.Monster;
import net.minecraft.world.entity.monster.Skeleton;
import net.minecraft.world.item.ItemStack;
Expand Down Expand Up @@ -309,6 +310,10 @@ public NecromancerUnit(EntityType<? extends Skeleton> entityType, Level level) {
setStatsForLevel();
}

// prevent vanilla logic for picking up items
@Override
protected void pickUpItem(ItemEntity pItemEntity) { }

@Override
public float getDamageAfterMagicAbsorb(DamageSource pSource, float pDamage) {
pDamage = super.getDamageAfterMagicAbsorb(pSource, pDamage);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@
import net.minecraft.world.entity.ai.attributes.Attributes;
import net.minecraft.world.entity.ai.goal.FloatGoal;
import net.minecraft.world.entity.ai.goal.Goal;
import net.minecraft.world.entity.item.ItemEntity;
import net.minecraft.world.entity.monster.Monster;
import net.minecraft.world.entity.projectile.Projectile;
import net.minecraft.world.item.ItemStack;
Expand Down Expand Up @@ -349,6 +350,10 @@ public WretchedWraithUnit(EntityType<? extends Monster> entityType, Level level)
setStatsForLevel();
}

// prevent vanilla logic for picking up items
@Override
protected void pickUpItem(ItemEntity pItemEntity) { }

@Override
public float getDamageAfterMagicAbsorb(DamageSource pSource, float pDamage) {
pDamage = super.getDamageAfterMagicAbsorb(pSource, pDamage);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -173,6 +173,11 @@ public ZombieUnit(EntityType<? extends Zombie> entityType, Level level) {
updateAbilityButtons();
}

@Override
protected boolean shouldDropLoot() {
return false;
}

@Override
public double getUnitRangedArmorPercentage() {
return rangedDamageResist;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
import com.solegendary.reignofnether.util.MyMath;
import it.unimi.dsi.fastutil.objects.Object2ObjectArrayMap;
import net.minecraft.client.animation.AnimationDefinition;
import net.minecraft.client.resources.language.I18n;
import net.minecraft.core.BlockPos;
import net.minecraft.nbt.CompoundTag;
import net.minecraft.network.syncher.EntityDataAccessor;
Expand All @@ -41,6 +42,7 @@
import net.minecraft.sounds.SoundEvent;
import net.minecraft.sounds.SoundEvents;
import net.minecraft.tags.DamageTypeTags;
import net.minecraft.util.FormattedCharSequence;
import net.minecraft.util.Mth;
import net.minecraft.world.damagesource.DamageSource;
import net.minecraft.world.effect.MobEffectInstance;
Expand All @@ -50,6 +52,7 @@
import net.minecraft.world.entity.ai.attributes.Attributes;
import net.minecraft.world.entity.ai.goal.FloatGoal;
import net.minecraft.world.entity.ai.goal.Goal;
import net.minecraft.world.entity.item.ItemEntity;
import net.minecraft.world.entity.monster.Blaze;
import net.minecraft.world.entity.monster.Monster;
import net.minecraft.world.item.ItemStack;
Expand All @@ -68,6 +71,8 @@
import java.util.List;
import java.util.Set;

import static com.solegendary.reignofnether.util.MiscUtil.fcs;

public class WildfireUnit extends Blaze implements Unit, AttackerUnit, RangedAttackerUnit, HeroUnit, KeyframeAnimated, RangeIndicator {
public final Abilities ABILITIES = new Abilities(
List.of(
Expand Down Expand Up @@ -658,13 +663,9 @@ private void convertNearbyFires() {
}
}

// prevent vanilla logic for picking up items
@Override
public boolean wantsToPickUp(ItemStack itemStack) {
if (!itemStack.isEdible()) {
return false;
}
return super.wantsToPickUp(itemStack);
}
protected void pickUpItem(ItemEntity pItemEntity) { }

@Override
public void setupEquipmentAndUpgradesServer() {
Expand All @@ -678,6 +679,19 @@ public AABB getInflatedSelectionBox() {
return aabb;
}

@Override
public List<FormattedCharSequence> getAttackDamageStatTooltip() {
return List.of(
fcs(I18n.get("unitstats.reignofnether.attack_damage"), true),
fcs(I18n.get("unitstats.reignofnether.attack_damage_bonus_fire_damage", BlazeUnitFireball.FIRE_SECONDS, BlazeUnitFireball.FIRE_SECONDS))
);
}

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

@Override
public boolean causeFallDamage(float pFallDistance, float pMultiplier, DamageSource pSource) {
return false;
Expand Down
Loading