Skip to content

Commit 546d050

Browse files
committed
6.2.5
1 parent b0cfb67 commit 546d050

File tree

7 files changed

+311
-296
lines changed

7 files changed

+311
-296
lines changed

CHANGELOG.txt

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
Changelog of recent updates: https://github.com/RobertSkalko/Mine-And-Slash-Rework/blob/1.20-Forge/changelogs/v.6.2.txt
22

3-
v.6.2.4
3+
v.6.2.5
44

5-
- added quickloot
5+
- attempt to fix entity configs overriding levels for harvest and obelisk maps
6+
- added localizations
7+
- server crash fix
8+
- some

gradle.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
org.gradle.jvmargs=-Xmx2G
33
# --- COMMON GRADLE START ---
44
# Mod Properties
5-
mod_version=6.2.4
5+
mod_version=6.2.5
66
# Minecraft Versions
77
minecraft_version=1.20.1
88
forgeversion=47.1.43

src/main/java/com/robertx22/mine_and_slash/database/registry/ExileDB.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,8 +56,7 @@ public class ExileDB {
5656

5757

5858
public static DimensionConfig getDimensionConfig(LevelAccessor world) {
59-
String id = MapManager.getResourceLocation((Level) world)
60-
.toString();
59+
String id = MapManager.getResourceLocation((Level) world).toString();
6160

6261
if (!DimensionConfigs().isRegistered(id)) {
6362
return ExileDB.DimensionConfigs().get(DimensionConfig.DEFAULT_ID);

src/main/java/com/robertx22/mine_and_slash/mmorpg/MMORPG.java

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,6 @@
2121
import com.robertx22.mine_and_slash.aoe_data.database.stat_effects.StatEffects;
2222
import com.robertx22.mine_and_slash.aoe_data.database.stats.Stats;
2323
import com.robertx22.mine_and_slash.aoe_data.datapacks.lang_file.CreateLangFile;
24-
import com.robertx22.mine_and_slash.capability.player.container.BackpackQuickLootButton;
25-
import com.robertx22.mine_and_slash.capability.player.container.BackpackScreen;
2624
import com.robertx22.mine_and_slash.characters.PlayerStats;
2725
import com.robertx22.mine_and_slash.config.forge.ClientConfigs;
2826
import com.robertx22.mine_and_slash.config.forge.ServerContainer;
@@ -57,7 +55,6 @@
5755
import net.minecraftforge.client.event.EntityRenderersEvent;
5856
import net.minecraftforge.client.event.RegisterClientTooltipComponentFactoriesEvent;
5957
import net.minecraftforge.client.event.RegisterKeyMappingsEvent;
60-
import net.minecraftforge.client.event.ScreenEvent;
6158
import net.minecraftforge.data.event.GatherDataEvent;
6259
import net.minecraftforge.eventbus.api.EventPriority;
6360
import net.minecraftforge.eventbus.api.IEventBus;
@@ -157,10 +154,6 @@ public void accept(ExileEvents.OnCheckIsDevToolsRunning event) {
157154
x.register(SocketTooltip.SocketComponent.class, SocketTooltip::new);
158155
});
159156

160-
ForgeEvents.registerForgeEvent(ScreenEvent.Init.class, x -> {
161-
BackpackQuickLootButton.addLootButton(x);
162-
});
163-
164157

165158
DistExecutor.runWhenOn(Dist.CLIENT, () -> () -> {
166159

src/main/java/com/robertx22/mine_and_slash/mmorpg/init/ClientInit.java

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
import com.robertx22.mine_and_slash.a_libraries.dmg_number_particle.DamageParticle;
77
import com.robertx22.mine_and_slash.a_libraries.dmg_number_particle.DamageParticleRenderer;
88
import com.robertx22.mine_and_slash.a_libraries.player_animations.PlayerAnimations;
9+
import com.robertx22.mine_and_slash.capability.player.container.BackpackQuickLootButton;
910
import com.robertx22.mine_and_slash.config.forge.ClientConfigs;
1011
import com.robertx22.mine_and_slash.config.forge.overlay.OverlayPresets;
1112
import com.robertx22.mine_and_slash.gui.SocketTooltip;
@@ -29,6 +30,7 @@
2930
import net.minecraftforge.client.event.RenderGuiOverlayEvent;
3031
import net.minecraftforge.client.event.RenderLivingEvent;
3132
import net.minecraftforge.client.event.RenderTooltipEvent;
33+
import net.minecraftforge.client.event.ScreenEvent;
3234
import net.minecraftforge.client.event.sound.PlaySoundEvent;
3335
import net.minecraftforge.client.gui.overlay.VanillaGuiOverlay;
3436
import net.minecraftforge.fml.event.lifecycle.FMLClientSetupEvent;
@@ -40,6 +42,10 @@ public class ClientInit {
4042

4143
public static void onInitializeClient(final FMLClientSetupEvent event) {
4244

45+
ForgeEvents.registerForgeEvent(ScreenEvent.Init.class, x -> {
46+
BackpackQuickLootButton.addLootButton(x);
47+
});
48+
4349
OrbAddonClientInit.init();
4450

4551
OverlayPresets.init();

src/main/java/com/robertx22/mine_and_slash/uncommon/utilityclasses/LevelUtils.java

Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,8 @@ public static int scaleExpReward(int exp, int level) {
6363
return (int) (Math.pow(exp * GameBalanceConfig.get().NORMAL_STAT_SCALING.getMultiFor(level), 1.1F));
6464
}
6565

66+
public static String OBELISK_DIM = "ancient_obelisks:obelisk";
67+
public static String HARVEST_DIM = "the_harvest:harvest";
6668

6769
public static LevelInfo determineLevel(@Nullable LivingEntity en, Level world, BlockPos pos, @Nullable Player nearestPlayer, boolean usevariance) {
6870

@@ -72,6 +74,10 @@ public static LevelInfo determineLevel(@Nullable LivingEntity en, Level world, B
7274

7375
var opt = WorldUtils.ifMapData(world, pos);
7476

77+
boolean scaletoPlayer = false;
78+
79+
boolean ignoreEntityConfig = false;
80+
7581
if (opt.isPresent()) {
7682

7783
var data = opt.get();
@@ -82,11 +88,18 @@ public static LevelInfo determineLevel(@Nullable LivingEntity en, Level world, B
8288
} else {
8389
System.out.print("A mob spawned in a dungeon world without a dungeon data nearby!");
8490
}
91+
} else {
92+
// if the player enters side content not connected to map, it wont have data, so it should force the level to scale to player
93+
var dimid = MapManager.getResourceLocation((Level) world).toString();
94+
if (dimid.equals(OBELISK_DIM) || dimid.equals(HARVEST_DIM)) {
95+
scaletoPlayer = true;
96+
ignoreEntityConfig = true;
97+
}
8598
}
8699

87100
DimensionConfig dimConfig = ExileDB.getDimensionConfig(world);
88101

89-
if (ServerContainer.get().SCALE_MOB_LEVEL_TO_NEAREST_PLAYER.get() && nearestPlayer != null) {
102+
if ((scaletoPlayer || ServerContainer.get().SCALE_MOB_LEVEL_TO_NEAREST_PLAYER.get()) && nearestPlayer != null) {
90103
info.set(LevelInfo.LevelSource.NEAREST_PLAYER_CONFIG, Load.Unit(nearestPlayer).getLevel());
91104
} else {
92105
if (isInMinLevelArea(sw, pos, dimConfig)) {
@@ -109,8 +122,10 @@ public static LevelInfo determineLevel(@Nullable LivingEntity en, Level world, B
109122
info.capToRange(LevelInfo.LevelSource.MAX_LEVEL, new MinMax(1, GameBalanceConfig.get().MAX_LEVEL));
110123

111124
if (en != null) {
112-
var enconfig = ExileDB.getEntityConfig(en, Load.Unit(en));
113-
info.capToRange(LevelInfo.LevelSource.ENTITY_CONFIG, new MinMax(enconfig.min_lvl, enconfig.max_lvl));
125+
if (!ignoreEntityConfig) {
126+
var enconfig = ExileDB.getEntityConfig(en, Load.Unit(en));
127+
info.capToRange(LevelInfo.LevelSource.ENTITY_CONFIG, new MinMax(enconfig.min_lvl, enconfig.max_lvl));
128+
}
114129
}
115130

116131
return info;

0 commit comments

Comments
 (0)