Skip to content

Commit

Permalink
for 1.19.2 create
Browse files Browse the repository at this point in the history
  • Loading branch information
TiyaAnlite committed Jul 8, 2023
1 parent 4ab865a commit 1537c85
Show file tree
Hide file tree
Showing 7 changed files with 21 additions and 21 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

Minecodecraft服务端专用MOD

当前分支`1.19`适配版本:**Minecraft 1.19.3**
当前分支`1.19`适配版本:**Minecraft 1.19.2**

## 功能

Expand Down
10 changes: 5 additions & 5 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,16 @@ org.gradle.jvmargs=-Xmx1G

# Fabric Properties
# check these on https://fabricmc.net/versions.html
minecraft_version=1.19.3
yarn_mappings=1.19.3+build.3
loader_version=0.14.11
minecraft_version=1.19.2
yarn_mappings=1.19.2+build.28
loader_version=0.14.21
# https://masa.dy.fi/maven/carpet/fabric-carpet/
# carpet_core_version=1.18-1.4.56+v211130

# Mod Properties
mod_version = 1.3.3
mod_version = 1.3.3-create
maven_group = cn.focot.codelab
archives_base_name = MineCodeCraftMod

# Dependencies
fabric_version=0.69.1+1.19.3
fabric_version=0.76.0+1.19.2
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import cn.focot.codelab.minecodecraft.helpers.CreeperHelper;
import cn.focot.codelab.minecodecraft.utils.MessageUtil;
import net.minecraft.entity.mob.CreeperEntity;
import net.minecraft.world.World;
import net.minecraft.world.explosion.Explosion;

public class CreeperHandler extends AbstractHandler {

Expand All @@ -16,8 +16,8 @@ public static void onCreeperExplode(CreeperEntity creeper) {
MessageUtil.broadcastPrefixMessage(broadcastString, false, true);
}

public static World.ExplosionSourceType onCreeperCreateExplosion(World.ExplosionSourceType t) {
return CreeperHelper.isCreeperExplode() ? t : World.ExplosionSourceType.NONE;
public static Explosion.DestructionType onCreeperCreateExplosion(Explosion.DestructionType t) {
return CreeperHelper.isCreeperExplode() ? t : Explosion.DestructionType.NONE;
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,13 @@
import net.minecraft.entity.effect.StatusEffectInstance;
import net.minecraft.network.packet.s2c.play.ExperienceBarUpdateS2CPacket;
import net.minecraft.network.packet.s2c.play.PlaySoundS2CPacket;
import net.minecraft.registry.RegistryKey;
import net.minecraft.registry.entry.RegistryEntry;
import net.minecraft.util.registry.RegistryKey;
import net.minecraft.server.network.ServerPlayerEntity;
import net.minecraft.server.world.ChunkTicketType;
import net.minecraft.server.world.ServerWorld;
import net.minecraft.sound.SoundCategory;
import net.minecraft.sound.SoundEvent;
import net.minecraft.sound.SoundEvents;
import net.minecraft.text.Text;
import net.minecraft.util.Identifier;
import net.minecraft.util.math.BlockPos;
Expand All @@ -37,8 +37,8 @@ public static void tpPlayer(ServerPlayerEntity player, ServerWorld world, Vec3d
try {
player.sendMessage(Text.of("§e已定位至§r[x:%.2f, y:%.2f, z:%.2f]§e, 将在§4%d§e秒后传送".formatted(targetPos.getX(), targetPos.getY(), targetPos.getZ(), config.getConfigBean().tpPlayer.interval)), true);
int sec = 0;
RegistryEntry<SoundEvent> waitingSound = RegistryEntry.of(SoundEvent.of(new Identifier("minecraft", "entity.experience_orb.pickup")));
RegistryEntry<SoundEvent> teleportSound = RegistryEntry.of(SoundEvent.of(new Identifier("minecraft", "entity.enderman.teleport")));
// RegistryEntry<SoundEvent> waitingSound = RegistryEntry.of(SoundEvents.ENTITY_EXPERIENCE_ORB_PICKUP);
// RegistryEntry<SoundEvent> teleportSound = RegistryEntry.of(SoundEvents.ENTITY_ENDERMAN_TELEPORT);
Vec3d playerEyePos;
while (sec < config.getConfigBean().tpPlayer.interval) {
//Single player
Expand All @@ -48,7 +48,7 @@ public static void tpPlayer(ServerPlayerEntity player, ServerWorld world, Vec3d
return;
}
playerEyePos = player.getEyePos();
player.networkHandler.sendPacket(new PlaySoundS2CPacket(waitingSound, SoundCategory.MASTER, playerEyePos.getX(), playerEyePos.getY(), playerEyePos.getZ(), 1.0F, 1.0F, 1));
player.networkHandler.sendPacket(new PlaySoundS2CPacket(SoundEvents.ENTITY_EXPERIENCE_ORB_PICKUP, SoundCategory.MASTER, playerEyePos.getX(), playerEyePos.getY(), playerEyePos.getZ(), 1.0F, 1.0F, 1));
//LOGGER.info("Waiting at: %d".formatted(sec));
Thread.sleep(1000);
sec++;
Expand Down Expand Up @@ -77,7 +77,7 @@ public static void tpPlayer(ServerPlayerEntity player, ServerWorld world, Vec3d
player.setHeadYaw(f);
LOGGER.info("Teleported %s to %.2f, %.2f, %.2f".formatted(playerName, targetPos.getX(), targetPos.getY(), targetPos.getZ()));
List<ServerPlayerEntity> serverPlayers = world.getPlayers();
PlaySoundS2CPacket packet = new PlaySoundS2CPacket(teleportSound, SoundCategory.PLAYERS, targetPos.getX(), targetPos.getY(), targetPos.getZ(), 1.0F, 1.0F, 1);
PlaySoundS2CPacket packet = new PlaySoundS2CPacket(SoundEvents.ENTITY_ENDERMAN_TELEPORT, SoundCategory.PLAYERS, targetPos.getX(), targetPos.getY(), targetPos.getZ(), 1.0F, 1.0F, 1);
for (ServerPlayerEntity p : serverPlayers) {
if (world.equals(p.getWorld())) {
p.networkHandler.sendPacket(packet);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ public static boolean updatePlayerLatency() {
int interval = config.getConfigBean().playerLatencyUpdateInterval;
if (!(interval == 30) && ++latencyUpdateTimer > interval * 20) {
PlayerManager manager = getServer().getPlayerManager();
manager.sendToAll(new PlayerListS2CPacket(EnumSet.of(PlayerListS2CPacket.Action.UPDATE_LATENCY), manager.getPlayerList()));
manager.sendToAll(new PlayerListS2CPacket(PlayerListS2CPacket.Action.UPDATE_LATENCY, manager.getPlayerList()));
latencyUpdateTimer = 0;
return true;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

import cn.focot.codelab.minecodecraft.handlers.CreeperHandler;
import net.minecraft.entity.mob.CreeperEntity;
import net.minecraft.world.World;
import net.minecraft.world.explosion.Explosion;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
Expand All @@ -20,11 +20,11 @@ private void onCreeperExplode(CallbackInfo c) {
method = "explode",
at = @At(
value = "INVOKE",
target = "Lnet/minecraft/world/World;createExplosion(Lnet/minecraft/entity/Entity;DDDFLnet/minecraft/world/World$ExplosionSourceType;)Lnet/minecraft/world/explosion/Explosion;"
target = "Lnet/minecraft/world/World;createExplosion(Lnet/minecraft/entity/Entity;DDDFLnet/minecraft/world/explosion/Explosion$DestructionType;)Lnet/minecraft/world/explosion/Explosion;"
),
index = 5
)
private World.ExplosionSourceType onCreeperCreateExplosion(World.ExplosionSourceType t) {
private Explosion.DestructionType onCreeperCreateExplosion(Explosion.DestructionType t) {
return CreeperHandler.onCreeperCreateExplosion(t);
}
}
4 changes: 2 additions & 2 deletions src/main/resources/fabric.mod.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,9 @@
],

"depends": {
"fabricloader": ">=0.14.11",
"fabricloader": ">=0.14.21",
"fabric": "*",
"minecraft": "1.19.3",
"minecraft": "1.19.2",
"java": ">=17"
},
"suggests": {
Expand Down

0 comments on commit 1537c85

Please sign in to comment.