更新版本为1.0.7

1. 改为仅前5个tick同步速度,让客户端看起来效果流畅些
2. 修改了DataGen订阅方式,仅开发环境下可被加载,避免lib39库被错误加载进来
3.更新Credits
This commit is contained in:
叁玖领域 2025-11-30 16:26:37 +08:00
parent b0f0c05e0b
commit 94acb2473e
12 changed files with 33 additions and 39 deletions

View File

@ -102,7 +102,7 @@ minecraft {
server { server {
property 'forge.enabledGameTestNamespaces', mod_id property 'forge.enabledGameTestNamespaces', mod_id
args '--nogui', "-mixin.config="+mod_id+".mixins.json" args "-mixin.config="+mod_id+".mixins.json"
} }
// This run config launches GameTestServer and runs all registered gametests, then exits. // This run config launches GameTestServer and runs all registered gametests, then exits.

View File

@ -1,2 +1,2 @@
// 1.20.1 2025-11-30T14:45:33.8997715 Languages: en_us // 1.20.1 2025-11-30T16:14:50.4899617 Languages: en_us
e8f3919eb4dcc1d7cf4176f3258bc19c6cf7a0b2 assets/blasttravelreborn/lang/en_us.json 77f28d92977b44b36ed92657b3082222587dcf04 assets/blasttravelreborn/lang/en_us.json

View File

@ -1,8 +1,8 @@
{ {
"container.blasttravelreborn.cannon_container_menu": "Cannon", "container.blasttravelreborn.cannon_container_menu": "Cannon",
"death.attack.blasttravelreborn.cannon": "%s was knocked out by a flying %s", "death.attack.blasttravelreborn.cannon": "%s was knocked out by a flying %s",
"dialog.blasttravelreborn.add_behavior_item": "Added %s", "dialog.blasttravelreborn.add_behavior_item": "Added %s (Current/Max): %d / %d",
"dialog.blasttravelreborn.add_gunpowder_item": "Added Gunpowder", "dialog.blasttravelreborn.add_gunpowder_item": "Added Gunpowder (Current/Max): %d / %d",
"dialog.blasttravelreborn.add_lock_chain_item": "Cannon Locked", "dialog.blasttravelreborn.add_lock_chain_item": "Cannon Locked",
"dialog.blasttravelreborn.fire": "Fire", "dialog.blasttravelreborn.fire": "Fire",
"dialog.blasttravelreborn.full_cannon": "Cannon is full!", "dialog.blasttravelreborn.full_cannon": "Cannon is full!",

View File

@ -4,11 +4,13 @@ import com.leisuretimedock.blasttravelreborn.content.BTRParticleTypes;
import com.leisuretimedock.blasttravelreborn.content.entity.BTREntityTypes; import com.leisuretimedock.blasttravelreborn.content.entity.BTREntityTypes;
import com.leisuretimedock.blasttravelreborn.content.item.BTRItems; import com.leisuretimedock.blasttravelreborn.content.item.BTRItems;
import com.leisuretimedock.blasttravelreborn.content.menu.BTRMenuTypes; import com.leisuretimedock.blasttravelreborn.content.menu.BTRMenuTypes;
import com.leisuretimedock.blasttravelreborn.datagen.DataGeneratorHandler;
import com.leisuretimedock.blasttravelreborn.network.BTRNetwork; import com.leisuretimedock.blasttravelreborn.network.BTRNetwork;
import net.minecraft.resources.ResourceLocation; import net.minecraft.resources.ResourceLocation;
import net.minecraftforge.eventbus.api.IEventBus; import net.minecraftforge.eventbus.api.IEventBus;
import net.minecraftforge.fml.common.Mod; import net.minecraftforge.fml.common.Mod;
import net.minecraftforge.fml.javafmlmod.FMLJavaModLoadingContext; import net.minecraftforge.fml.javafmlmod.FMLJavaModLoadingContext;
import net.minecraftforge.fml.loading.FMLEnvironment;
@Mod(value = BlastTravelReborn.MOD_ID) @Mod(value = BlastTravelReborn.MOD_ID)
public class BlastTravelReborn { public class BlastTravelReborn {
@ -21,6 +23,9 @@ public class BlastTravelReborn {
BTRParticleTypes.register(modEventBus); BTRParticleTypes.register(modEventBus);
BTREntityTypes.register(modEventBus); BTREntityTypes.register(modEventBus);
BTRMenuTypes.register(modEventBus); BTRMenuTypes.register(modEventBus);
if(!FMLEnvironment.production) {
modEventBus.register(DataGeneratorHandler.class);
}
} }
public static ResourceLocation id(String path) { public static ResourceLocation id(String path) {

View File

@ -15,7 +15,6 @@ import com.leisuretimedock.blasttravelreborn.util.PlayerEntityDuck;
import net.minecraft.ChatFormatting; import net.minecraft.ChatFormatting;
import net.minecraft.client.Minecraft; import net.minecraft.client.Minecraft;
import net.minecraft.client.player.AbstractClientPlayer; import net.minecraft.client.player.AbstractClientPlayer;
import net.minecraft.client.resources.language.I18n;
import net.minecraft.core.particles.ParticleTypes; import net.minecraft.core.particles.ParticleTypes;
import net.minecraft.nbt.CompoundTag; import net.minecraft.nbt.CompoundTag;
import net.minecraft.network.chat.Component; import net.minecraft.network.chat.Component;
@ -23,7 +22,6 @@ import net.minecraft.network.syncher.EntityDataAccessor;
import net.minecraft.network.syncher.EntityDataSerializers; import net.minecraft.network.syncher.EntityDataSerializers;
import net.minecraft.network.syncher.SynchedEntityData; import net.minecraft.network.syncher.SynchedEntityData;
import net.minecraft.server.level.ServerLevel; import net.minecraft.server.level.ServerLevel;
import net.minecraft.server.level.ServerPlayer;
import net.minecraft.sounds.SoundEvents; import net.minecraft.sounds.SoundEvents;
import net.minecraft.sounds.SoundSource; import net.minecraft.sounds.SoundSource;
import net.minecraft.tags.ItemTags; import net.minecraft.tags.ItemTags;
@ -237,7 +235,7 @@ public class CannonEntity extends Entity {
// 设置新的火药到炮中 // 设置新的火药到炮中
ItemStack newGunpowder = stack.copy(); ItemStack newGunpowder = stack.copy();
newGunpowder.setCount(currentGunpowder.getCount() + 1); // 只放一个火药 newGunpowder.setCount(currentGunpowder.getCount() + 1); // 只放一个火药
((ServerPlayer) player).sendSystemMessage(Component.translatable(ADD_GUNPOWDER_DIALOG, Math.min(currentGunpowder.getCount() + 1, currentGunpowder.getMaxStackSize()), currentGunpowder.getMaxStackSize()), true); player.displayClientMessage(Component.translatable(ADD_GUNPOWDER_DIALOG, Math.min(currentGunpowder.getCount() + 1, currentGunpowder.getMaxStackSize()), currentGunpowder.getMaxStackSize()), true);
inventory.setItem(0, newGunpowder); inventory.setItem(0, newGunpowder);
if (!player.isCreative()) { if (!player.isCreative()) {
@ -258,7 +256,7 @@ public class CannonEntity extends Entity {
if (!player.isCreative()) { if (!player.isCreative()) {
stack.shrink(1); stack.shrink(1);
} }
((ServerPlayer) player).sendSystemMessage(Component.translatable(ADD_LOCK_CHAIN_DIALOG).withStyle(ChatFormatting.GREEN), true); player.displayClientMessage(Component.translatable(ADD_LOCK_CHAIN_DIALOG).withStyle(ChatFormatting.GREEN), true);
level().playSound(null, this.blockPosition(), SoundEvents.CHAIN_PLACE, SoundSource.BLOCKS, 1.0f, 1.0f); level().playSound(null, this.blockPosition(), SoundEvents.CHAIN_PLACE, SoundSource.BLOCKS, 1.0f, 1.0f);
} else { } else {
inventory.setItem(1, ItemStack.EMPTY); inventory.setItem(1, ItemStack.EMPTY);
@ -267,7 +265,7 @@ public class CannonEntity extends Entity {
player.drop(currentChain, false); player.drop(currentChain, false);
} }
} }
((ServerPlayer) player).sendSystemMessage(Component.translatable(REMOVE_LOCK_CHAIN_DIALOG).withStyle(ChatFormatting.RED), true); player.displayClientMessage(Component.translatable(REMOVE_LOCK_CHAIN_DIALOG).withStyle(ChatFormatting.RED), true);
level().playSound(null, this.blockPosition(), SoundEvents.CHAIN_FALL, SoundSource.BLOCKS, 1.0f, 1.0f); level().playSound(null, this.blockPosition(), SoundEvents.CHAIN_FALL, SoundSource.BLOCKS, 1.0f, 1.0f);
} }
} }
@ -286,35 +284,30 @@ public class CannonEntity extends Entity {
level().playSound(null, this.blockPosition(), getBehavior().getPlaceInSound(), SoundSource.BLOCKS, 1.0f, 1.0f); level().playSound(null, this.blockPosition(), getBehavior().getPlaceInSound(), SoundSource.BLOCKS, 1.0f, 1.0f);
} else { } else {
if (stack.is(currentBehaviorItem.getItem())) { //同类物品 +1 if (stack.is(currentBehaviorItem.getItem())) { //同类物品 +1
if (stack.getCount() >= currentBehaviorItem.getMaxStackSize()) { if (currentBehaviorItem.getCount() >= currentBehaviorItem.getMaxStackSize()) {
if (!player.isCreative() && !player.getInventory().add(currentBehaviorItem)) { if (!player.isCreative() && !player.getInventory().add(currentBehaviorItem)) {
player.drop(currentBehaviorItem, false); player.drop(currentBehaviorItem, false);
} }
} }
ItemStack stack1 = stack.copy(); ItemStack stack1 = stack.copy();
stack1.setCount(currentBehaviorItem.getCount() + 1); stack1.setCount(currentBehaviorItem.getCount() + 1);
((ServerPlayer) player).sendSystemMessage(Component.translatable(ADD_BEHAVIOR_DIALOG, I18n.get(currentBehaviorItem.getDescriptionId()),Math.min(currentBehaviorItem.getCount() + 1, currentBehaviorItem.getMaxStackSize()), currentBehaviorItem.getMaxStackSize()), true); player.displayClientMessage(Component.translatable(ADD_BEHAVIOR_DIALOG, Component.translatable(currentBehaviorItem.getDescriptionId()),Math.min(currentBehaviorItem.getCount() + 1, currentBehaviorItem.getMaxStackSize()), currentBehaviorItem.getMaxStackSize()), true);
inventory.setItem(2, stack1); inventory.setItem(2, stack1);
if (!player.isCreative()) { } else { //不同类替换
stack.shrink(1);
}
level().playSound(null, this.blockPosition(), getBehavior().getPlaceInSound(), SoundSource.BLOCKS, 1.0f, 1.0f);
} else { //不同类替换
if (!player.isCreative() && !player.getInventory().add(currentBehaviorItem)) { if (!player.isCreative() && !player.getInventory().add(currentBehaviorItem)) {
player.drop(currentBehaviorItem, false); player.drop(currentBehaviorItem, false);
} }
ItemStack copied = stack.copy(); ItemStack copied = stack.copy();
copied.setCount(1); copied.setCount(1);
inventory.setItem(2, copied); inventory.setItem(2, copied);
((ServerPlayer) player).sendSystemMessage(Component.translatable(ADD_BEHAVIOR_DIALOG, I18n.get(stack.getDescriptionId()), 1, stack.getMaxStackSize()), true); player.displayClientMessage(Component.translatable(ADD_BEHAVIOR_DIALOG, Component.translatable(stack.getDescriptionId()), 1, stack.getMaxStackSize()), true);
if (!player.isCreative()) { }
stack.shrink(1); if (!player.isCreative()) {
} stack.shrink(1);
level().playSound(null, this.blockPosition(), getBehavior().getPlaceInSound(), SoundSource.BLOCKS, 1.0f, 1.0f); }
} level().playSound(null, this.blockPosition(), getBehavior().getPlaceInSound(), SoundSource.BLOCKS, 1.0f, 1.0f);
} }
} }
} }

View File

@ -9,14 +9,12 @@ import net.minecraft.data.DataProvider;
import net.minecraftforge.common.data.DatapackBuiltinEntriesProvider; import net.minecraftforge.common.data.DatapackBuiltinEntriesProvider;
import net.minecraftforge.data.event.GatherDataEvent; import net.minecraftforge.data.event.GatherDataEvent;
import net.minecraftforge.eventbus.api.SubscribeEvent; import net.minecraftforge.eventbus.api.SubscribeEvent;
import net.minecraftforge.fml.common.Mod;
import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.NotNull;
import top.r3944realms.lib39.datagen.provider.SimpleLanguageProvider; import top.r3944realms.lib39.datagen.provider.SimpleLanguageProvider;
import top.r3944realms.lib39.datagen.value.McLocale; import top.r3944realms.lib39.datagen.value.McLocale;
import java.util.Set; import java.util.Set;
@Mod.EventBusSubscriber(modid = BlastTravelReborn.MOD_ID, bus = Mod.EventBusSubscriber.Bus.MOD)
public class DataGeneratorHandler { public class DataGeneratorHandler {
@SubscribeEvent @SubscribeEvent
public static void generatorDataEvent(GatherDataEvent event) { public static void generatorDataEvent(GatherDataEvent event) {

View File

@ -58,14 +58,14 @@ public enum BTRLangKeys implements ILangKeyValueCollection {
)); ));
addLang(LangKeyValue.ofKey( addLang(LangKeyValue.ofKey(
"dialog.blasttravelreborn.add_gunpowder_item", ModPartEnum.MESSAGE, "dialog.blasttravelreborn.add_gunpowder_item", ModPartEnum.MESSAGE,
"Added Gunpowder", "Added Gunpowder (Current/Max): %d / %d",
"填充火药 (当前/最大): %d / %d", "填充火药 (当前/最大): %d / %d",
"填充火藥 (當前/最大): %d / %d" "填充火藥 (當前/最大): %d / %d"
)); ));
addLang(LangKeyValue.ofKey( addLang(LangKeyValue.ofKey(
"dialog.blasttravelreborn.add_behavior_item", ModPartEnum.MESSAGE, "dialog.blasttravelreborn.add_behavior_item", ModPartEnum.MESSAGE,
"Added %s", "Added %s (Current/Max): %d / %d",
"填充%s (当前/最大): %d / %d", "填充%s (当前/最大): %d / %d",
"填充%s (當前/最大): %d / %d" "填充%s (當前/最大): %d / %d"
)); ));

View File

@ -6,7 +6,6 @@ import com.leisuretimedock.blasttravelreborn.network.BTRNetwork;
import com.leisuretimedock.blasttravelreborn.network.toClient.SyncFlightStatePayload; import com.leisuretimedock.blasttravelreborn.network.toClient.SyncFlightStatePayload;
import com.leisuretimedock.blasttravelreborn.network.toServer.StopCannonFlightServerPayload; import com.leisuretimedock.blasttravelreborn.network.toServer.StopCannonFlightServerPayload;
import com.leisuretimedock.blasttravelreborn.util.PlayerEntityDuck; import com.leisuretimedock.blasttravelreborn.util.PlayerEntityDuck;
import net.minecraft.client.Minecraft;
import net.minecraft.core.registries.Registries; import net.minecraft.core.registries.Registries;
import net.minecraft.resources.ResourceKey; import net.minecraft.resources.ResourceKey;
import net.minecraft.server.level.ServerPlayer; import net.minecraft.server.level.ServerPlayer;
@ -22,7 +21,6 @@ import net.minecraft.world.level.Level;
import net.minecraft.world.level.entity.EntityTypeTest; import net.minecraft.world.level.entity.EntityTypeTest;
import net.minecraft.world.phys.Vec3; import net.minecraft.world.phys.Vec3;
import net.minecraftforge.common.MinecraftForge; import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.fml.loading.FMLEnvironment;
import net.minecraftforge.network.NetworkDirection; import net.minecraftforge.network.NetworkDirection;
import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Shadow; import org.spongepowered.asm.mixin.Shadow;
@ -86,10 +84,13 @@ public abstract class PlayerEntityMixin extends LivingEntity implements PlayerEn
entity.hurt(source, (float)(vel.length() * 4)); entity.hurt(source, (float)(vel.length() * 4));
} }
} }
try { if(blasttravel$ticksFlying < 5) {
ServerPlayer cast = ServerPlayer.class.cast(self); try {
BTRNetwork.CHANNEL.sendTo(new SyncFlightStatePayload(self.getId(), vel, self.position(), true, noPhysics), cast.connection.connection, NetworkDirection.PLAY_TO_CLIENT); ServerPlayer cast = ServerPlayer.class.cast(self);
} catch(Exception ignored){} BTRNetwork.CHANNEL.sendTo(new SyncFlightStatePayload(self.getId(), vel, self.position(), true, noPhysics), cast.connection.connection, NetworkDirection.PLAY_TO_CLIENT);
} catch (Exception ignored) {
}
}
} }
if (self.isLocalPlayer() && if (self.isLocalPlayer() &&

View File

@ -36,7 +36,6 @@ public abstract class PlayerEntityRendererMixin extends LivingEntityRenderer<Abs
double horizontal = Math.sqrt(vel.x * vel.x + vel.z * vel.z); double horizontal = Math.sqrt(vel.x * vel.x + vel.z * vel.z);
super.setupRotations(player, matrices, f, 270 + ((float) Math.atan2(vel.z, vel.x) * Mth.RAD_TO_DEG), tickDelta); super.setupRotations(player, matrices, f, 270 + ((float) Math.atan2(vel.z, vel.x) * Mth.RAD_TO_DEG), tickDelta);
matrices.mulPose(Axis.XP.rotation((Mth.PI * 1.5f) + (float) Math.atan2(vel.y, horizontal))); matrices.mulPose(Axis.XP.rotation((Mth.PI * 1.5f) + (float) Math.atan2(vel.y, horizontal)));
ci.cancel(); ci.cancel();
} }
} }

View File

@ -7,7 +7,6 @@ import net.minecraft.network.FriendlyByteBuf;
import net.minecraft.world.entity.Entity; import net.minecraft.world.entity.Entity;
import net.minecraft.world.entity.player.Player; import net.minecraft.world.entity.player.Player;
import net.minecraft.world.phys.Vec3; import net.minecraft.world.phys.Vec3;
import net.minecraftforge.fml.loading.FMLEnvironment;
import net.minecraftforge.network.NetworkEvent; import net.minecraftforge.network.NetworkEvent;
import org.jetbrains.annotations.Nullable; import org.jetbrains.annotations.Nullable;

View File

@ -2,7 +2,6 @@ package com.leisuretimedock.blasttravelreborn.network.toClient;
import net.minecraft.network.FriendlyByteBuf; import net.minecraft.network.FriendlyByteBuf;
import net.minecraft.world.phys.Vec3; import net.minecraft.world.phys.Vec3;
import net.minecraftforge.fml.loading.FMLEnvironment;
import net.minecraftforge.network.NetworkEvent; import net.minecraftforge.network.NetworkEvent;
import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.NotNull;

View File

@ -27,7 +27,7 @@ displayName = "${mod_name}" #mandatory
# A file name (in the root of the mod JAR) containing a logo for display # A file name (in the root of the mod JAR) containing a logo for display
logoFile="icon.png" #optional logoFile="icon.png" #optional
# A text field displayed in the mod UI # A text field displayed in the mod UI
#credits="Thanks for this example mod goes to Java" #optional credits="璃之雨, AtinyFurina"
# A text field displayed in the mod UI # A text field displayed in the mod UI
authors = "${mod_authors}" #optional authors = "${mod_authors}" #optional
# Display Test controls the display for your mod in the server connection screen # Display Test controls the display for your mod in the server connection screen