diff --git a/README.md b/README.md index 8d531af8..317c5f0f 100644 --- a/README.md +++ b/README.md @@ -6,7 +6,7 @@ A Bukkit server implementation utilizing Mixin. | Minecraft | Forge | Status | Build | | :----: |:-------:| :---: | :---: | -| 1.18.x | 39.0.59 | ACTIVE | [![1.18 Status](https://img.shields.io/appveyor/build/IzzelAliz/arclight-18?style=flat-square)](https://ci.appveyor.com/project/IzzelAliz/arclight-18) | +| 1.18.x | 39.1.2 | ACTIVE | [![1.18 Status](https://img.shields.io/appveyor/build/IzzelAliz/arclight-18?style=flat-square)](https://ci.appveyor.com/project/IzzelAliz/arclight-18) | | 1.17.x | 37.1.0 | [LEGACY](https://github.com/IzzelAliz/Arclight/releases/tag/1.17/1.0.2) | [![1.17 Status](https://img.shields.io/appveyor/build/IzzelAliz/arclight-17?style=flat-square)](https://ci.appveyor.com/project/IzzelAliz/arclight-17) | | 1.16.x | 36.2.26 | ACTIVE | [![1.16 Status](https://img.shields.io/appveyor/build/IzzelAliz/arclight-16?style=flat-square)](https://ci.appveyor.com/project/IzzelAliz/arclight-16) | | 1.15.x | 31.2.48 | [LEGACY](https://github.com/IzzelAliz/Arclight/releases/tag/1.15/1.0.19) | [![1.15 Status](https://img.shields.io/appveyor/build/IzzelAliz/arclight-15?style=flat-square)](https://ci.appveyor.com/project/IzzelAliz/arclight-15) | diff --git a/arclight-common/src/main/java/io/izzel/arclight/common/mixin/core/world/entity/LivingEntityMixin.java b/arclight-common/src/main/java/io/izzel/arclight/common/mixin/core/world/entity/LivingEntityMixin.java index 354ea786..5edc01bf 100644 --- a/arclight-common/src/main/java/io/izzel/arclight/common/mixin/core/world/entity/LivingEntityMixin.java +++ b/arclight-common/src/main/java/io/izzel/arclight/common/mixin/core/world/entity/LivingEntityMixin.java @@ -233,7 +233,8 @@ public abstract class LivingEntityMixin extends EntityMixin implements LivingEnt protected void dropExperience() { // if (!this.world.isRemote && (this.isPlayer() || this.recentlyHit > 0 && this.canDropLoot() && this.world.getGameRules().getBoolean(GameRules.DO_MOB_LOOT))) { if (true) { - ExperienceOrb.award((ServerLevel) this.level, this.position(), this.expToDrop); + int reward = ForgeEventFactory.getExperienceDrop((LivingEntity)(Object) this, this.lastHurtByPlayer, this.expToDrop); + ExperienceOrb.award((ServerLevel) this.level, this.position(), reward); bridge$setExpToDrop(0); } } diff --git a/arclight-common/src/main/java/io/izzel/arclight/common/mixin/core/world/entity/monster/ShulkerMixin.java b/arclight-common/src/main/java/io/izzel/arclight/common/mixin/core/world/entity/monster/ShulkerMixin.java index 4343a212..8e3eac7b 100644 --- a/arclight-common/src/main/java/io/izzel/arclight/common/mixin/core/world/entity/monster/ShulkerMixin.java +++ b/arclight-common/src/main/java/io/izzel/arclight/common/mixin/core/world/entity/monster/ShulkerMixin.java @@ -9,6 +9,7 @@ import net.minecraft.sounds.SoundEvents; import net.minecraft.util.Mth; import net.minecraft.world.entity.monster.Shulker; import net.minecraft.world.phys.AABB; +import net.minecraftforge.event.ForgeEventFactory; import org.bukkit.Bukkit; import org.bukkit.Location; import org.bukkit.event.entity.CreatureSpawnEvent; @@ -45,6 +46,11 @@ public abstract class ShulkerMixin extends PathfinderMobMixin { BlockPos blockpos1 = blockpos.offset(Mth.randomBetweenInclusive(this.random, -8, 8), Mth.randomBetweenInclusive(this.random, -8, 8), Mth.randomBetweenInclusive(this.random, -8, 8)); if (blockpos1.getY() > this.level.getMinBuildHeight() && this.level.isEmptyBlock(blockpos1) && this.level.getWorldBorder().isWithinBounds(blockpos1) && this.level.noCollision((Shulker) (Object) this, (new AABB(blockpos1)).deflate(1.0E-6D))) { Direction direction = this.findAttachableSurface(blockpos1); + if (direction != null) { + var event = ForgeEventFactory.onEnderTeleport((Shulker) (Object) this, blockpos1.getX(), blockpos1.getY(), blockpos1.getZ()); + if (event.isCanceled()) direction = null; + blockpos1 = new BlockPos(event.getTargetX(), event.getTargetY(), event.getTargetZ()); + } if (direction != null) { EntityTeleportEvent teleport = new EntityTeleportEvent(this.getBukkitEntity(), this.getBukkitEntity().getLocation(), new Location(((WorldBridge) this.level).bridge$getWorld(), blockpos1.getX(), blockpos1.getY(), blockpos1.getZ())); Bukkit.getPluginManager().callEvent(teleport); diff --git a/arclight-common/src/main/java/io/izzel/arclight/common/mixin/core/world/entity/player/ServerPlayerMixin.java b/arclight-common/src/main/java/io/izzel/arclight/common/mixin/core/world/entity/player/ServerPlayerMixin.java index a93f4225..6ad470bb 100644 --- a/arclight-common/src/main/java/io/izzel/arclight/common/mixin/core/world/entity/player/ServerPlayerMixin.java +++ b/arclight-common/src/main/java/io/izzel/arclight/common/mixin/core/world/entity/player/ServerPlayerMixin.java @@ -474,7 +474,7 @@ public abstract class ServerPlayerMixin extends PlayerMixin implements ServerPla if (registrykey == LevelStem.END && ((WorldBridge) server).bridge$getTypeKey() == LevelStem.OVERWORLD && teleporter.isVanilla()) { //Forge: Fix non-vanilla teleporters triggering end credits this.isChangingDimension = true; this.unRide(); - this.getLevel().removePlayer((ServerPlayer) (Object) this, true); //Forge: The player entity is cloned so keep the data until after cloning calls copyFrom + this.getLevel().removePlayerImmediately((ServerPlayer) (Object) this, Entity.RemovalReason.CHANGED_DIMENSION); if (!this.wonGame) { this.wonGame = true; this.connection.send(new ClientboundGameEventPacket(ClientboundGameEventPacket.WIN_GAME, this.seenCredits ? 0.0F : 1.0F)); @@ -494,7 +494,7 @@ public abstract class ServerPlayerMixin extends PlayerMixin implements ServerPla this.connection.send(new ClientboundChangeDifficultyPacket(iworldinfo.getDifficulty(), iworldinfo.isDifficultyLocked())); PlayerList playerlist = this.server.getPlayerList(); playerlist.sendPlayerPermissionLevel((ServerPlayer) (Object) this); - serverworld.removeEntity((ServerPlayer) (Object) this, true); //Forge: the player entity is moved to the new world, NOT cloned. So keep the data alive with no matching invalidate call. + this.getLevel().removePlayerImmediately((ServerPlayer) (Object) this, Entity.RemovalReason.CHANGED_DIMENSION); this.revive(); Entity e = teleporter.placeEntity((ServerPlayer) (Object) this, serverworld, exitWorld[0], this.getYRot(), spawnPortal -> {//Forge: Start vanilla logic serverworld.getProfiler().push("moving"); diff --git a/arclight-common/src/main/java/io/izzel/arclight/common/mixin/core/world/spawner/BaseSpawnerMixin.java b/arclight-common/src/main/java/io/izzel/arclight/common/mixin/core/world/spawner/BaseSpawnerMixin.java index f2475263..117a5c85 100644 --- a/arclight-common/src/main/java/io/izzel/arclight/common/mixin/core/world/spawner/BaseSpawnerMixin.java +++ b/arclight-common/src/main/java/io/izzel/arclight/common/mixin/core/world/spawner/BaseSpawnerMixin.java @@ -111,8 +111,12 @@ public abstract class BaseSpawnerMixin { entity.moveTo(entity.getX(), entity.getY(), entity.getZ(), level.random.nextFloat() * 360.0F, 0.0F); if (entity instanceof Mob mob) { - if (this.nextSpawnData.getCustomSpawnRules().isEmpty() && !ForgeEventFactory.canEntitySpawnSpawner(mob, level, (float) entity.getX(), (float) entity.getY(), (float) entity.getZ(), (BaseSpawner) (Object) this)) { - continue; + var res = ForgeEventFactory.canEntitySpawn(mob, level, (float) entity.getX(), (float) entity.getY(), (float) entity.getZ(), (BaseSpawner) (Object) this, MobSpawnType.SPAWNER); + if (res == net.minecraftforge.eventbus.api.Event.Result.DENY) continue; + if (res == net.minecraftforge.eventbus.api.Event.Result.DEFAULT) { + if (this.nextSpawnData.getCustomSpawnRules().isEmpty() && !ForgeEventFactory.canEntitySpawnSpawner(mob, level, (float) entity.getX(), (float) entity.getY(), (float) entity.getZ(), (BaseSpawner) (Object) this)) { + continue; + } } if (this.nextSpawnData.getEntityToSpawn().size() == 1 && this.nextSpawnData.getEntityToSpawn().contains("id", 8)) { diff --git a/build.gradle b/build.gradle index c37d1121..45f1d6e2 100644 --- a/build.gradle +++ b/build.gradle @@ -14,7 +14,7 @@ allprojects { ext { agpVersion = '1.22' minecraftVersion = '1.18.1' - forgeVersion = '39.0.59' + forgeVersion = '39.1.2' apiVersion = '1.2.5' toolsVersion = '1.3.+' mixinVersion = '0.8.5'