| 1 | package net.minecraft.client.multiplayer;
|
| 2 |
|
| 3 | import com.google.common.collect.ImmutableMap;
|
| 4 | import com.google.common.collect.Lists;
|
| 5 | import com.google.common.collect.Maps;
|
| 6 | import com.google.common.collect.Queues;
|
| 7 | import com.google.common.collect.Sets;
|
| 8 | import com.mojang.logging.LogUtils;
|
| 9 | import it.unimi.dsi.fastutil.ints.Int2ObjectMap;
|
| 10 | import it.unimi.dsi.fastutil.ints.Int2ObjectOpenHashMap;
|
| 11 | import it.unimi.dsi.fastutil.longs.Long2ObjectMap;
|
| 12 | import it.unimi.dsi.fastutil.longs.Long2ObjectOpenHashMap;
|
| 13 | import it.unimi.dsi.fastutil.objects.Object2ObjectArrayMap;
|
| 14 | import it.unimi.dsi.fastutil.objects.ReferenceOpenHashSet;
|
| 15 | import java.util.Arrays;
|
| 16 | import java.util.Deque;
|
| 17 | import java.util.Iterator;
|
| 18 | import java.util.List;
|
| 19 | import java.util.Locale;
|
| 20 | import java.util.Map;
|
| 21 | import java.util.Set;
|
| 22 | import java.util.SortedSet;
|
| 23 | import java.util.function.BooleanSupplier;
|
| 24 | import net.fabricmc.api.EnvType;
|
| 25 | import net.fabricmc.api.Environment;
|
| 26 | import net.minecraft.CrashReport;
|
| 27 | import net.minecraft.CrashReportCategory;
|
| 28 | import net.minecraft.ReportedException;
|
| 29 | import net.minecraft.SharedConstants;
|
| 30 | import net.minecraft.client.Camera;
|
| 31 | import net.minecraft.client.ClientClockManager;
|
| 32 | import net.minecraft.client.Minecraft;
|
| 33 | import net.minecraft.client.color.block.BlockTintCache;
|
| 34 | import net.minecraft.client.color.block.BlockTintSource;
|
| 35 | import net.minecraft.client.gui.screens.WinScreen;
|
| 36 | import net.minecraft.client.multiplayer.prediction.BlockStatePredictionHandler;
|
| 37 | import net.minecraft.client.particle.FireworkParticles;
|
| 38 | import net.minecraft.client.particle.TerrainParticle;
|
| 39 | import net.minecraft.client.player.AbstractClientPlayer;
|
| 40 | import net.minecraft.client.player.LocalPlayer;
|
| 41 | import net.minecraft.client.renderer.BiomeColors;
|
| 42 | import net.minecraft.client.renderer.EndFlashState;
|
| 43 | import net.minecraft.client.renderer.LevelEventHandler;
|
| 44 | import net.minecraft.client.renderer.block.BlockAndTintGetter;
|
| 45 | import net.minecraft.client.renderer.blockentity.BlockEntityRenderer;
|
| 46 | import net.minecraft.client.renderer.extract.LevelExtractor;
|
| 47 | import net.minecraft.client.resources.sounds.DirectionalSoundInstance;
|
| 48 | import net.minecraft.client.resources.sounds.EntityBoundSoundInstance;
|
| 49 | import net.minecraft.client.resources.sounds.SimpleSoundInstance;
|
| 50 | import net.minecraft.client.resources.sounds.SoundInstance;
|
| 51 | import net.minecraft.core.BlockPos;
|
| 52 | import net.minecraft.core.Cursor3D;
|
| 53 | import net.minecraft.core.Direction;
|
| 54 | import net.minecraft.core.Holder;
|
| 55 | import net.minecraft.core.SectionPos;
|
| 56 | import net.minecraft.core.BlockPos.MutableBlockPos;
|
| 57 | import net.minecraft.core.Direction.Axis;
|
| 58 | import net.minecraft.core.particles.BlockParticleOption;
|
| 59 | import net.minecraft.core.particles.ExplosionParticleInfo;
|
| 60 | import net.minecraft.core.particles.ParticleOptions;
|
| 61 | import net.minecraft.core.particles.ParticleTypes;
|
| 62 | import net.minecraft.core.registries.BuiltInRegistries;
|
| 63 | import net.minecraft.core.registries.Registries;
|
| 64 | import net.minecraft.nbt.NbtOps;
|
| 65 | import net.minecraft.network.chat.Component;
|
| 66 | import net.minecraft.network.protocol.Packet;
|
| 67 | import net.minecraft.resources.ResourceKey;
|
| 68 | import net.minecraft.server.level.BlockDestructionProgress;
|
| 69 | import net.minecraft.server.level.ParticleStatus;
|
| 70 | import net.minecraft.sounds.SoundEvent;
|
| 71 | import net.minecraft.sounds.SoundEvents;
|
| 72 | import net.minecraft.sounds.SoundSource;
|
| 73 | import net.minecraft.tags.BlockTags;
|
| 74 | import net.minecraft.tags.FluidTags;
|
| 75 | import net.minecraft.util.ARGB;
|
| 76 | import net.minecraft.util.Mth;
|
| 77 | import net.minecraft.util.RandomSource;
|
| 78 | import net.minecraft.util.Util;
|
| 79 | import net.minecraft.util.profiling.Profiler;
|
| 80 | import net.minecraft.util.profiling.ProfilerFiller;
|
| 81 | import net.minecraft.util.profiling.Zone;
|
| 82 | import net.minecraft.util.profiling.jfr.JvmProfiler;
|
| 83 | import net.minecraft.util.random.WeightedList;
|
| 84 | import net.minecraft.world.Difficulty;
|
| 85 | import net.minecraft.world.TickRateManager;
|
| 86 | import net.minecraft.world.attribute.AmbientParticle;
|
| 87 | import net.minecraft.world.attribute.EnvironmentAttributeSystem;
|
| 88 | import net.minecraft.world.attribute.EnvironmentAttributes;
|
| 89 | import net.minecraft.world.attribute.EnvironmentAttributeSystem.Builder;
|
| 90 | import net.minecraft.world.damagesource.DamageSource;
|
| 91 | import net.minecraft.world.entity.Entity;
|
| 92 | import net.minecraft.world.entity.EntitySelector;
|
| 93 | import net.minecraft.world.entity.Entity.RemovalReason;
|
| 94 | import net.minecraft.world.entity.boss.enderdragon.EnderDragon;
|
| 95 | import net.minecraft.world.entity.boss.enderdragon.EnderDragonPart;
|
| 96 | import net.minecraft.world.entity.player.Player;
|
| 97 | import net.minecraft.world.flag.FeatureFlagSet;
|
| 98 | import net.minecraft.world.item.BlockItem;
|
| 99 | import net.minecraft.world.item.Item;
|
| 100 | import net.minecraft.world.item.ItemStack;
|
| 101 | import net.minecraft.world.item.Items;
|
| 102 | import net.minecraft.world.item.component.FireworkExplosion;
|
| 103 | import net.minecraft.world.item.crafting.RecipeAccess;
|
| 104 | import net.minecraft.world.level.CardinalLighting;
|
| 105 | import net.minecraft.world.level.ChunkPos;
|
| 106 | import net.minecraft.world.level.ColorResolver;
|
| 107 | import net.minecraft.world.level.ExplosionDamageCalculator;
|
| 108 | import net.minecraft.world.level.GameType;
|
| 109 | import net.minecraft.world.level.Level;
|
| 110 | import net.minecraft.world.level.LevelHeightAccessor;
|
| 111 | import net.minecraft.world.level.Level.ExplosionInteraction;
|
| 112 | import net.minecraft.world.level.biome.Biome;
|
| 113 | import net.minecraft.world.level.biome.Biomes;
|
| 114 | import net.minecraft.world.level.biome.Biome.Precipitation;
|
| 115 | import net.minecraft.world.level.block.Block;
|
| 116 | import net.minecraft.world.level.block.Blocks;
|
| 117 | import net.minecraft.world.level.block.CampfireBlock;
|
| 118 | import net.minecraft.world.level.block.RenderShape;
|
| 119 | import net.minecraft.world.level.block.SoundType;
|
| 120 | import net.minecraft.world.level.block.Block.UpdateFlags;
|
| 121 | import net.minecraft.world.level.block.LevelEvent.Value;
|
| 122 | import net.minecraft.world.level.block.entity.BlockEntity;
|
| 123 | import net.minecraft.world.level.block.state.BlockState;
|
| 124 | import net.minecraft.world.level.border.WorldBorder;
|
| 125 | import net.minecraft.world.level.chunk.LevelChunk;
|
| 126 | import net.minecraft.world.level.dimension.DimensionType;
|
| 127 | import net.minecraft.world.level.entity.EntityTickList;
|
| 128 | import net.minecraft.world.level.entity.LevelCallback;
|
| 129 | import net.minecraft.world.level.entity.LevelEntityGetter;
|
| 130 | import net.minecraft.world.level.entity.TransientEntitySectionManager;
|
| 131 | import net.minecraft.world.level.gameevent.GameEvent;
|
| 132 | import net.minecraft.world.level.gameevent.GameEvent.Context;
|
| 133 | import net.minecraft.world.level.levelgen.Heightmap.Types;
|
| 134 | import net.minecraft.world.level.material.Fluid;
|
| 135 | import net.minecraft.world.level.material.FluidState;
|
| 136 | import net.minecraft.world.level.saveddata.maps.MapId;
|
| 137 | import net.minecraft.world.level.saveddata.maps.MapItemSavedData;
|
| 138 | import net.minecraft.world.level.storage.WritableLevelData;
|
| 139 | import net.minecraft.world.level.storage.LevelData.RespawnData;
|
| 140 | import net.minecraft.world.phys.AABB;
|
| 141 | import net.minecraft.world.phys.Vec3;
|
| 142 | import net.minecraft.world.phys.shapes.VoxelShape;
|
| 143 | import net.minecraft.world.scores.Scoreboard;
|
| 144 | import net.minecraft.world.ticks.BlackholeTickAccess;
|
| 145 | import net.minecraft.world.ticks.LevelTickAccess;
|
| 146 | import org.joml.Vector3f;
|
| 147 | import org.joml.Vector3fc;
|
| 148 | import org.jspecify.annotations.Nullable;
|
| 149 | import org.slf4j.Logger;
|
| 150 |
|
| 151 | @Environment(EnvType.CLIENT)
|
| 152 | public class ClientLevel extends Level implements BlockAndTintGetter, CacheSlot.Cleaner<ClientLevel> {
|
| 153 | private static final Logger LOGGER = LogUtils.getLogger();
|
| 154 | public static final Component DEFAULT_QUIT_MESSAGE = Component.translatable("multiplayer.status.quitting");
|
| 155 | private static final double FLUID_PARTICLE_SPAWN_OFFSET = 0.05;
|
| 156 | private static final int NORMAL_LIGHT_UPDATES_PER_FRAME = 10;
|
| 157 | private static final int LIGHT_UPDATE_QUEUE_SIZE_THRESHOLD = 1000;
|
| 158 | private static final float RAIN_PARTICLES_PER_BLOCK = 0.225F;
|
| 159 | private static final int RAIN_RADIUS = 10;
|
| 160 | private final EntityTickList tickingEntities = new EntityTickList();
|
| 161 | private final TransientEntitySectionManager<Entity> entityStorage = new TransientEntitySectionManager<>(Entity.class, new ClientLevel.EntityCallbacks());
|
| 162 | private final ClientPacketListener connection;
|
| 163 | private final LevelExtractor levelExtractor;
|
| 164 | private final LevelEventHandler levelEventHandler;
|
| 165 | private final ClientLevel.ClientLevelData clientLevelData;
|
| 166 | private final TickRateManager tickRateManager;
|
| 167 | private final @Nullable EndFlashState endFlashState;
|
| 168 | private final Minecraft minecraft = Minecraft.getInstance();
|
| 169 | private final List<AbstractClientPlayer> players = Lists.newArrayList();
|
| 170 | private final List<EnderDragonPart> dragonParts = Lists.newArrayList();
|
| 171 | private final Map<MapId, MapItemSavedData> mapData = Maps.newHashMap();
|
| 172 | private int skyFlashTime;
|
| 173 | private int rainSoundTime;
|
| 174 | private final Object2ObjectArrayMap<ColorResolver, BlockTintCache> tintCaches = Util.make(new Object2ObjectArrayMap<>(3), cache -> {
|
| 175 | cache.put(BiomeColors.GRASS_COLOR_RESOLVER, new BlockTintCache(pos -> this.calculateBlockTint(pos, BiomeColors.GRASS_COLOR_RESOLVER)));
|
| 176 | cache.put(BiomeColors.FOLIAGE_COLOR_RESOLVER, new BlockTintCache(pos -> this.calculateBlockTint(pos, BiomeColors.FOLIAGE_COLOR_RESOLVER)));
|
| 177 | cache.put(BiomeColors.DRY_FOLIAGE_COLOR_RESOLVER, new BlockTintCache(pos -> this.calculateBlockTint(pos, BiomeColors.DRY_FOLIAGE_COLOR_RESOLVER)));
|
| 178 | cache.put(BiomeColors.WATER_COLOR_RESOLVER, new BlockTintCache(pos -> this.calculateBlockTint(pos, BiomeColors.WATER_COLOR_RESOLVER)));
|
| 179 | });
|
| 180 | private final ClientChunkCache chunkSource;
|
| 181 | private final Deque<Runnable> lightUpdateQueue = Queues.newArrayDeque();
|
| 182 | private int serverSimulationDistance;
|
| 183 | private final BlockStatePredictionHandler blockStatePredictionHandler = new BlockStatePredictionHandler();
|
| 184 | private final Set<BlockEntity> globallyRenderedBlockEntities = new ReferenceOpenHashSet<>();
|
| 185 | private final ClientExplosionTracker explosionTracker = new ClientExplosionTracker();
|
| 186 | private final WorldBorder worldBorder = new WorldBorder();
|
| 187 | private final EnvironmentAttributeSystem environmentAttributes;
|
| 188 | private final Int2ObjectMap<BlockDestructionProgress> destroyingBlocks = new Int2ObjectOpenHashMap<>();
|
| 189 | private final Long2ObjectMap<SortedSet<BlockDestructionProgress>> destructionProgress = new Long2ObjectOpenHashMap<>();
|
| 190 | private final int seaLevel;
|
| 191 | private static final Set<Item> MARKER_PARTICLE_ITEMS = Set.of(Items.BARRIER, Items.LIGHT);
|
| 192 |
|
| 193 | public void handleBlockChangedAck(final int sequence) {
|
| 194 | if (SharedConstants.DEBUG_BLOCK_BREAK) {
|
| 195 | LOGGER.debug("ACK {}", sequence);
|
| 196 | }
|
| 197 |
|
| 198 | this.blockStatePredictionHandler.endPredictionsUpTo(sequence, this);
|
| 199 | }
|
| 200 |
|
| 201 | @Override
|
| 202 | public void onBlockEntityAdded(final BlockEntity blockEntity) {
|
| 203 | BlockEntityRenderer<BlockEntity, ?> renderer = this.minecraft.getBlockEntityRenderDispatcher().getRenderer(blockEntity);
|
| 204 | if (renderer != null && renderer.shouldRenderOffScreen()) {
|
| 205 | this.globallyRenderedBlockEntities.add(blockEntity);
|
| 206 | }
|
| 207 | }
|
| 208 |
|
| 209 | public Set<BlockEntity> getGloballyRenderedBlockEntities() {
|
| 210 | return this.globallyRenderedBlockEntities;
|
| 211 | }
|
| 212 |
|
| 213 | public void setServerVerifiedBlockState(final BlockPos pos, final BlockState blockState, final @UpdateFlags int updateFlag) {
|
| 214 | if (!this.blockStatePredictionHandler.updateKnownServerState(pos, blockState)) {
|
| 215 | super.setBlock(pos, blockState, updateFlag, 512);
|
| 216 | }
|
| 217 | }
|
| 218 |
|
| 219 | public void syncBlockState(final BlockPos pos, final BlockState state, final @Nullable Vec3 playerPos) {
|
| 220 | BlockState oldState = this.getBlockState(pos);
|
| 221 | if (oldState != state) {
|
| 222 | this.setBlock(pos, state, 19);
|
| 223 | Player player = this.minecraft.player;
|
| 224 | if (playerPos != null && this == player.level() && player.isColliding(pos, state)) {
|
| 225 | player.absSnapTo(playerPos.x, playerPos.y, playerPos.z);
|
| 226 | }
|
| 227 | }
|
| 228 | }
|
| 229 |
|
| 230 | BlockStatePredictionHandler getBlockStatePredictionHandler() {
|
| 231 | return this.blockStatePredictionHandler;
|
| 232 | }
|
| 233 |
|
| 234 | @Override
|
| 235 | public boolean setBlock(final BlockPos pos, final BlockState blockState, final @UpdateFlags int updateFlags, final int updateLimit) {
|
| 236 | if (this.blockStatePredictionHandler.isPredicting()) {
|
| 237 | BlockState oldState = this.getBlockState(pos);
|
| 238 | boolean success = super.setBlock(pos, blockState, updateFlags, updateLimit);
|
| 239 | if (success) {
|
| 240 | this.blockStatePredictionHandler.retainKnownServerState(pos, oldState, this.minecraft.player);
|
| 241 | }
|
| 242 |
|
| 243 | return success;
|
| 244 | } else {
|
| 245 | return super.setBlock(pos, blockState, updateFlags, updateLimit);
|
| 246 | }
|
| 247 | }
|
| 248 |
|
| 249 | public ClientLevel(
|
| 250 | final ClientPacketListener connection,
|
| 251 | final ClientLevel.ClientLevelData levelData,
|
| 252 | final ResourceKey<Level> dimension,
|
| 253 | final Holder<DimensionType> dimensionType,
|
| 254 | final int serverChunkRadius,
|
| 255 | final int serverSimulationDistance,
|
| 256 | final LevelExtractor levelExtractor,
|
| 257 | final boolean isDebug,
|
| 258 | final long biomeZoomSeed,
|
| 259 | final int seaLevel
|
| 260 | ) {
|
| 261 | super(levelData, dimension, connection.registryAccess(), dimensionType, true, isDebug, biomeZoomSeed, 1000000);
|
| 262 | this.connection = connection;
|
| 263 | this.chunkSource = new ClientChunkCache(this, serverChunkRadius);
|
| 264 | this.tickRateManager = new TickRateManager();
|
| 265 | this.clientLevelData = levelData;
|
| 266 | this.levelExtractor = levelExtractor;
|
| 267 | this.seaLevel = seaLevel;
|
| 268 | this.levelEventHandler = new LevelEventHandler(this.minecraft, this);
|
| 269 | this.endFlashState = dimensionType.value().hasEndFlashes() ? new EndFlashState() : null;
|
| 270 | this.setRespawnData(RespawnData.of(dimension, new BlockPos(8, 64, 8), 0.0F, 0.0F));
|
| 271 | this.serverSimulationDistance = serverSimulationDistance;
|
| 272 | this.environmentAttributes = this.addEnvironmentAttributeLayers(EnvironmentAttributeSystem.builder()).build();
|
| 273 | this.updateSkyBrightness();
|
| 274 | }
|
| 275 |
|
| 276 | private Builder addEnvironmentAttributeLayers(final Builder environmentAttributes) {
|
| 277 | environmentAttributes.addDefaultLayers(this);
|
| 278 | Vector3fc flashColor = new Vector3f(0.8F, 0.8F, 1.0F);
|
| 279 | environmentAttributes.addTimeBasedLayer(
|
| 280 | EnvironmentAttributes.SKY_COLOR, (skyColor, cacheTickId) -> this.getSkyFlashTime() > 0 ? ARGB.srgbLerp(0.22F, skyColor, flashColor) : skyColor
|
| 281 | );
|
| 282 | environmentAttributes.addTimeBasedLayer(EnvironmentAttributes.SKY_LIGHT_FACTOR, (skyFactor, cacheTickId) -> this.getSkyFlashTime() > 0 ? 1.0F : skyFactor);
|
| 283 | return environmentAttributes;
|
| 284 | }
|
| 285 |
|
| 286 | public void queueLightUpdate(final Runnable update) {
|
| 287 | this.lightUpdateQueue.add(update);
|
| 288 | }
|
| 289 |
|
| 290 | public void pollLightUpdates() {
|
| 291 | int size = this.lightUpdateQueue.size();
|
| 292 | int lightUpdatesPerFrame = size < 1000 ? Math.max(10, size / 10) : size;
|
| 293 |
|
| 294 | for (int i = 0; i < lightUpdatesPerFrame; i++) {
|
| 295 | Runnable update = this.lightUpdateQueue.poll();
|
| 296 | if (update == null) {
|
| 297 | break;
|
| 298 | }
|
| 299 |
|
| 300 | update.run();
|
| 301 | }
|
| 302 | }
|
| 303 |
|
| 304 | public @Nullable EndFlashState endFlashState() {
|
| 305 | return this.endFlashState;
|
| 306 | }
|
| 307 |
|
| 308 | public void tick(final BooleanSupplier haveTime) {
|
| 309 | this.updateSkyBrightness();
|
| 310 | if (this.tickRateManager().runsNormally()) {
|
| 311 | this.getWorldBorder().tick();
|
| 312 | this.tickTime();
|
| 313 | this.tickWeatherEffects();
|
| 314 | this.removeBlockBreakingProgress();
|
| 315 | }
|
| 316 |
|
| 317 | if (this.skyFlashTime > 0) {
|
| 318 | this.setSkyFlashTime(this.skyFlashTime - 1);
|
| 319 | }
|
| 320 |
|
| 321 | if (this.endFlashState != null) {
|
| 322 | this.endFlashState.tick(this.getDefaultClockTime());
|
| 323 | if (this.endFlashState.flashStartedThisTick() && !(this.minecraft.gui.screen() instanceof WinScreen)) {
|
| 324 | this.minecraft
|
| 325 | .getSoundManager()
|
| 326 | .playDelayed(
|
| 327 | new DirectionalSoundInstance(
|
| 328 | SoundEvents.WEATHER_END_FLASH,
|
| 329 | SoundSource.WEATHER,
|
| 330 | this.random,
|
| 331 | this.minecraft.gameRenderer.mainCamera(),
|
| 332 | this.endFlashState.getXAngle(),
|
| 333 | this.endFlashState.getYAngle()
|
| 334 | ),
|
| 335 | 30
|
| 336 | );
|
| 337 | }
|
| 338 | }
|
| 339 |
|
| 340 | this.explosionTracker.tick(this);
|
| 341 |
|
| 342 | try (Zone ignored = Profiler.get().zone("blocks")) {
|
| 343 | this.chunkSource.tick(haveTime, true);
|
| 344 | }
|
| 345 |
|
| 346 | JvmProfiler.INSTANCE.onClientTick(this.minecraft.getFps());
|
| 347 | this.environmentAttributes().invalidateTickCache();
|
| 348 | }
|
| 349 |
|
| 350 | public void tickWeatherEffects() {
|
| 351 | ParticleStatus particleStatus = this.minecraft.options.particles().get();
|
| 352 | int weatherRadius = this.minecraft.options.weatherRadius().get();
|
| 353 | float rainLevel = this.getRainLevel(1.0F);
|
| 354 | if (!(rainLevel <= 0.0F)) {
|
| 355 | RandomSource random = RandomSource.createThreadLocalInstance(this.getGameTime() * 312987231L);
|
| 356 | BlockPos cameraPosition = BlockPos.containing(this.minecraft.gameRenderer.mainCamera().position());
|
| 357 | BlockPos rainParticlePosition = null;
|
| 358 | int weatherDiameter = 2 * weatherRadius + 1;
|
| 359 | int weatherArea = weatherDiameter * weatherDiameter;
|
| 360 | int rainParticles = (int)(0.225F * weatherArea * rainLevel * rainLevel) / (particleStatus == ParticleStatus.DECREASED ? 2 : 1);
|
| 361 |
|
| 362 | for (int ii = 0; ii < rainParticles; ii++) {
|
| 363 | int x = random.nextInt(weatherDiameter) - weatherRadius;
|
| 364 | int z = random.nextInt(weatherDiameter) - weatherRadius;
|
| 365 | BlockPos heightmapPosition = this.getHeightmapPos(Types.MOTION_BLOCKING, cameraPosition.offset(x, 0, z));
|
| 366 | if (heightmapPosition.getY() > this.getMinY()
|
| 367 | && heightmapPosition.getY() <= cameraPosition.getY() + 10
|
| 368 | && heightmapPosition.getY() >= cameraPosition.getY() - 10
|
| 369 | && this.getPrecipitationAt(heightmapPosition) == Precipitation.RAIN) {
|
| 370 | rainParticlePosition = heightmapPosition.below();
|
| 371 | if (particleStatus == ParticleStatus.MINIMAL) {
|
| 372 | break;
|
| 373 | }
|
| 374 |
|
| 375 | double blockX = random.nextDouble();
|
| 376 | double blockZ = random.nextDouble();
|
| 377 | BlockState block = this.getBlockState(rainParticlePosition);
|
| 378 | FluidState fluid = this.getFluidState(rainParticlePosition);
|
| 379 | VoxelShape blockShape = block.getCollisionShape(this, rainParticlePosition);
|
| 380 | double blockTop = blockShape.max(Axis.Y, blockX, blockZ);
|
| 381 | double fluidTop = fluid.getHeight(this, rainParticlePosition);
|
| 382 | double particleY = Math.max(blockTop, fluidTop);
|
| 383 | ParticleOptions particleType = !fluid.is(FluidTags.LAVA) && !block.is(Blocks.MAGMA_BLOCK) && !CampfireBlock.isLitCampfire(block)
|
| 384 | ? ParticleTypes.RAIN
|
| 385 | : ParticleTypes.SMOKE;
|
| 386 | this.addParticle(
|
| 387 | particleType, rainParticlePosition.getX() + blockX, rainParticlePosition.getY() + particleY, rainParticlePosition.getZ() + blockZ, 0.0, 0.0, 0.0
|
| 388 | );
|
| 389 | }
|
| 390 | }
|
| 391 |
|
| 392 | if (rainParticlePosition != null && random.nextInt(3) < this.rainSoundTime++) {
|
| 393 | this.rainSoundTime = 0;
|
| 394 | if (rainParticlePosition.getY() > cameraPosition.getY() + 1
|
| 395 | && this.getHeightmapPos(Types.MOTION_BLOCKING, cameraPosition).getY() > Mth.floor(cameraPosition.getY())) {
|
| 396 | this.playLocalSound(rainParticlePosition, SoundEvents.WEATHER_RAIN_ABOVE, SoundSource.WEATHER, 0.1F, 0.5F, false);
|
| 397 | } else {
|
| 398 | this.playLocalSound(rainParticlePosition, SoundEvents.WEATHER_RAIN, SoundSource.WEATHER, 0.2F, 1.0F, false);
|
| 399 | }
|
| 400 | }
|
| 401 | }
|
| 402 | }
|
| 403 |
|
| 404 | public Precipitation getPrecipitationAt(final BlockPos pos) {
|
| 405 | if (!this.chunkSource.hasChunk(SectionPos.blockToSectionCoord(pos.getX()), SectionPos.blockToSectionCoord(pos.getZ()))) {
|
| 406 | return Precipitation.NONE;
|
| 407 | }
|
| 408 |
|
| 409 | Biome biome = this.getBiome(pos).value();
|
| 410 | return biome.getPrecipitationAt(pos, this.getSeaLevel());
|
| 411 | }
|
| 412 |
|
| 413 | private void removeBlockBreakingProgress() {
|
| 414 | long gameTime = this.getGameTime();
|
| 415 | if (gameTime % 20L == 0L) {
|
| 416 | Iterator<BlockDestructionProgress> iterator = this.destroyingBlocks.values().iterator();
|
| 417 |
|
| 418 | while (iterator.hasNext()) {
|
| 419 | BlockDestructionProgress block = iterator.next();
|
| 420 | long updatedRenderTick = block.getUpdatedRenderTick();
|
| 421 | if (gameTime - updatedRenderTick > 400L) {
|
| 422 | iterator.remove();
|
| 423 | this.removeProgress(block);
|
| 424 | }
|
| 425 | }
|
| 426 | }
|
| 427 | }
|
| 428 |
|
| 429 | private void removeProgress(final BlockDestructionProgress block) {
|
| 430 | long pos = block.getPos().asLong();
|
| 431 | Set<BlockDestructionProgress> progresses = this.destructionProgress.get(pos);
|
| 432 | progresses.remove(block);
|
| 433 | if (progresses.isEmpty()) {
|
| 434 | this.destructionProgress.remove(pos);
|
| 435 | }
|
| 436 | }
|
| 437 |
|
| 438 | public Long2ObjectMap<SortedSet<BlockDestructionProgress>> destructionProgress() {
|
| 439 | return this.destructionProgress;
|
| 440 | }
|
| 441 |
|
| 442 | private void tickTime() {
|
| 443 | long gameTime = this.clientLevelData.getGameTime() + 1L;
|
| 444 | this.clientLevelData.setGameTime(gameTime);
|
| 445 | this.clockManager().tick(gameTime);
|
| 446 | }
|
| 447 |
|
| 448 | public void setTimeFromServer(final long gameTime) {
|
| 449 | this.clientLevelData.setGameTime(gameTime);
|
| 450 | }
|
| 451 |
|
| 452 | public Iterable<Entity> entitiesForRendering() {
|
| 453 | return this.getEntities().getAll();
|
| 454 | }
|
| 455 |
|
| 456 | public void tickEntities() {
|
| 457 | this.tickingEntities.forEach(entity -> {
|
| 458 | if (!entity.isRemoved() && !entity.isPassenger() && !this.tickRateManager.isEntityFrozen(entity)) {
|
| 459 | this.guardEntityTick(this::tickNonPassenger, entity);
|
| 460 | }
|
| 461 | });
|
| 462 | }
|
| 463 |
|
| 464 | public boolean isTickingEntity(final Entity entity) {
|
| 465 | return this.tickingEntities.contains(entity);
|
| 466 | }
|
| 467 |
|
| 468 | @Override
|
| 469 | public boolean shouldTickDeath(final Entity entity) {
|
| 470 | return entity.chunkPosition().getChessboardDistance(this.minecraft.player.chunkPosition()) <= this.serverSimulationDistance;
|
| 471 | }
|
| 472 |
|
| 473 | public void tickNonPassenger(final Entity entity) {
|
| 474 | Profiler.get().push(entity.typeHolder()::getRegisteredName);
|
| 475 | entity.commonTick();
|
| 476 | entity.tick();
|
| 477 | Profiler.get().pop();
|
| 478 |
|
| 479 | for (Entity passenger : entity.getPassengers()) {
|
| 480 | this.tickPassenger(entity, passenger);
|
| 481 | }
|
| 482 | }
|
| 483 |
|
| 484 | private void tickPassenger(final Entity vehicle, final Entity entity) {
|
| 485 | if (entity.isRemoved() || entity.getVehicle() != vehicle) {
|
| 486 | entity.stopRiding();
|
| 487 | } else if (entity instanceof Player || this.tickingEntities.contains(entity)) {
|
| 488 | entity.commonTick();
|
| 489 | entity.rideTick();
|
| 490 |
|
| 491 | for (Entity passenger : entity.getPassengers()) {
|
| 492 | this.tickPassenger(entity, passenger);
|
| 493 | }
|
| 494 | }
|
| 495 | }
|
| 496 |
|
| 497 | public void update() {
|
| 498 | ProfilerFiller profiler = Profiler.get();
|
| 499 | profiler.push("populateLightUpdates");
|
| 500 | this.pollLightUpdates();
|
| 501 | profiler.popPush("runLightUpdates");
|
| 502 | this.getChunkSource().getLightEngine().runLightUpdates();
|
| 503 | profiler.pop();
|
| 504 | }
|
| 505 |
|
| 506 | public void unload(final LevelChunk levelChunk) {
|
| 507 | levelChunk.clearAllBlockEntities();
|
| 508 | this.chunkSource.getLightEngine().setLightEnabled(levelChunk.getPos(), false);
|
| 509 | this.entityStorage.stopTicking(levelChunk.getPos());
|
| 510 | }
|
| 511 |
|
| 512 | public void onChunkLoaded(final ChunkPos pos) {
|
| 513 | this.tintCaches.forEach((resolver, cache) -> cache.invalidateForChunk(pos.x(), pos.z()));
|
| 514 | this.entityStorage.startTicking(pos);
|
| 515 | }
|
| 516 |
|
| 517 | public void clearTintCaches() {
|
| 518 | this.tintCaches.forEach((resolver, cache) -> cache.invalidateAll());
|
| 519 | }
|
| 520 |
|
| 521 | @Override
|
| 522 | public boolean hasChunk(final int chunkX, final int chunkZ) {
|
| 523 | return true;
|
| 524 | }
|
| 525 |
|
| 526 | public int getEntityCount() {
|
| 527 | return this.entityStorage.count();
|
| 528 | }
|
| 529 |
|
| 530 | public void addEntity(final Entity entity) {
|
| 531 | this.removeEntity(entity.getId(), RemovalReason.DISCARDED);
|
| 532 | this.entityStorage.addEntity(entity);
|
| 533 | }
|
| 534 |
|
| 535 | public void removeEntity(final int id, final RemovalReason reason) {
|
| 536 | Entity entity = this.getEntities().get(id);
|
| 537 | if (entity != null) {
|
| 538 | entity.setRemoved(reason);
|
| 539 | entity.onClientRemoval();
|
| 540 | }
|
| 541 | }
|
| 542 |
|
| 543 | @Override
|
| 544 | public List<Entity> getPushableEntities(final Entity pusher, final AABB boundingBox) {
|
| 545 | LocalPlayer player = this.minecraft.player;
|
| 546 | return player != null && player != pusher && player.getBoundingBox().intersects(boundingBox) && EntitySelector.pushableBy(pusher).test(player)
|
| 547 | ? List.of(player)
|
| 548 | : List.of();
|
| 549 | }
|
| 550 |
|
| 551 | @Override
|
| 552 | public @Nullable Entity getEntity(final int id) {
|
| 553 | return this.getEntities().get(id);
|
| 554 | }
|
| 555 |
|
| 556 | public void disconnect(final Component message) {
|
| 557 | this.connection.getConnection().disconnect(message);
|
| 558 | this.minecraft.getPlayerSocialManager().getPresenceHandler().tryUpdatePresence();
|
| 559 | }
|
| 560 |
|
| 561 | public void animateTick(final int xt, final int yt, final int zt) {
|
| 562 | int r = 32;
|
| 563 | RandomSource animateRandom = RandomSource.createThreadLocalInstance();
|
| 564 | Block markerParticleTarget = this.getMarkerParticleTarget();
|
| 565 | MutableBlockPos pos = new MutableBlockPos();
|
| 566 |
|
| 567 | for (int i = 0; i < 667; i++) {
|
| 568 | this.doAnimateTick(xt, yt, zt, 16, animateRandom, markerParticleTarget, pos);
|
| 569 | this.doAnimateTick(xt, yt, zt, 32, animateRandom, markerParticleTarget, pos);
|
| 570 | }
|
| 571 | }
|
| 572 |
|
| 573 | private @Nullable Block getMarkerParticleTarget() {
|
| 574 | if (this.minecraft.gameMode.getPlayerMode() == GameType.CREATIVE) {
|
| 575 | ItemStack carriedItemStack = this.minecraft.player.getMainHandItem();
|
| 576 | Item carriedItem = carriedItemStack.getItem();
|
| 577 | if (MARKER_PARTICLE_ITEMS.contains(carriedItem) && carriedItem instanceof BlockItem blockItem) {
|
| 578 | return blockItem.getBlock();
|
| 579 | }
|
| 580 | }
|
| 581 |
|
| 582 | return null;
|
| 583 | }
|
| 584 |
|
| 585 | public void doAnimateTick(
|
| 586 | final int xt,
|
| 587 | final int yt,
|
| 588 | final int zt,
|
| 589 | final int r,
|
| 590 | final RandomSource animateRandom,
|
| 591 | final @Nullable Block markerParticleTarget,
|
| 592 | final MutableBlockPos pos
|
| 593 | ) {
|
| 594 | int x = xt + this.random.nextInt(r) - this.random.nextInt(r);
|
| 595 | int y = yt + this.random.nextInt(r) - this.random.nextInt(r);
|
| 596 | int z = zt + this.random.nextInt(r) - this.random.nextInt(r);
|
| 597 | pos.set(x, y, z);
|
| 598 | BlockState state = this.getBlockState(pos);
|
| 599 | state.getBlock().animateTick(state, this, pos, animateRandom);
|
| 600 | FluidState fluidState = this.getFluidState(pos);
|
| 601 | if (!fluidState.isEmpty()) {
|
| 602 | fluidState.animateTick(this, pos, animateRandom);
|
| 603 | ParticleOptions dripParticle = fluidState.getDripParticle();
|
| 604 | if (dripParticle != null && this.random.nextInt(10) == 0) {
|
| 605 | boolean hasWatertightBottom = state.isFaceSturdy(this, pos, Direction.DOWN);
|
| 606 | BlockPos below = pos.below();
|
| 607 | this.trySpawnDripParticles(below, this.getBlockState(below), dripParticle, hasWatertightBottom);
|
| 608 | }
|
| 609 | }
|
| 610 |
|
| 611 | if (markerParticleTarget == state.getBlock()) {
|
| 612 | this.addParticle(new BlockParticleOption(ParticleTypes.BLOCK_MARKER, state), x + 0.5, y + 0.5, z + 0.5, 0.0, 0.0, 0.0);
|
| 613 | }
|
| 614 |
|
| 615 | if (!state.isCollisionShapeFullBlock(this, pos)) {
|
| 616 | for (AmbientParticle particle : this.environmentAttributes().getValue(EnvironmentAttributes.AMBIENT_PARTICLES, pos)) {
|
| 617 | if (particle.canSpawn(this.random)) {
|
| 618 | this.addParticle(
|
| 619 | particle.particle(), pos.getX() + this.random.nextDouble(), pos.getY() + this.random.nextDouble(), pos.getZ() + this.random.nextDouble(), 0.0, 0.0, 0.0
|
| 620 | );
|
| 621 | }
|
| 622 | }
|
| 623 | }
|
| 624 | }
|
| 625 |
|
| 626 | private void trySpawnDripParticles(final BlockPos pos, final BlockState state, final ParticleOptions dripParticle, final boolean isTopSolid) {
|
| 627 | if (state.getFluidState().isEmpty()) {
|
| 628 | VoxelShape collisionShape = state.getCollisionShape(this, pos);
|
| 629 | double topSideHeight = collisionShape.max(Axis.Y);
|
| 630 | if (topSideHeight < 1.0) {
|
| 631 | if (isTopSolid) {
|
| 632 | this.spawnFluidParticle(pos.getX(), pos.getX() + 1, pos.getZ(), pos.getZ() + 1, pos.getY() + 1 - 0.05, dripParticle);
|
| 633 | }
|
| 634 | } else if (!state.is(BlockTags.IMPERMEABLE)) {
|
| 635 | double bottomSideHeight = collisionShape.min(Axis.Y);
|
| 636 | if (bottomSideHeight > 0.0) {
|
| 637 | this.spawnParticle(pos, dripParticle, collisionShape, pos.getY() + bottomSideHeight - 0.05);
|
| 638 | } else {
|
| 639 | BlockPos below = pos.below();
|
| 640 | BlockState belowState = this.getBlockState(below);
|
| 641 | VoxelShape belowShape = belowState.getCollisionShape(this, below);
|
| 642 | double belowTopSideHeight = belowShape.max(Axis.Y);
|
| 643 | if (belowTopSideHeight < 1.0 && belowState.getFluidState().isEmpty()) {
|
| 644 | this.spawnParticle(pos, dripParticle, collisionShape, pos.getY() - 0.05);
|
| 645 | }
|
| 646 | }
|
| 647 | }
|
| 648 | }
|
| 649 | }
|
| 650 |
|
| 651 | private void spawnParticle(final BlockPos pos, final ParticleOptions dripParticle, final VoxelShape dripShape, final double height) {
|
| 652 | this.spawnFluidParticle(
|
| 653 | pos.getX() + dripShape.min(Axis.X),
|
| 654 | pos.getX() + dripShape.max(Axis.X),
|
| 655 | pos.getZ() + dripShape.min(Axis.Z),
|
| 656 | pos.getZ() + dripShape.max(Axis.Z),
|
| 657 | height,
|
| 658 | dripParticle
|
| 659 | );
|
| 660 | }
|
| 661 |
|
| 662 | private void spawnFluidParticle(final double x1, final double x2, final double z1, final double z2, final double y, final ParticleOptions dripParticle) {
|
| 663 | this.addParticle(dripParticle, Mth.lerp(this.random.nextDouble(), x1, x2), y, Mth.lerp(this.random.nextDouble(), z1, z2), 0.0, 0.0, 0.0);
|
| 664 | }
|
| 665 |
|
| 666 | @Override
|
| 667 | public CrashReportCategory fillReportDetails(final CrashReport report) {
|
| 668 | CrashReportCategory category = super.fillReportDetails(report);
|
| 669 | category.setDetail("Server brand", () -> this.minecraft.player.connection.serverBrand());
|
| 670 | category.setDetail(
|
| 671 | "Server type", () -> this.minecraft.getSingleplayerServer() == null ? "Non-integrated multiplayer server" : "Integrated singleplayer server"
|
| 672 | );
|
| 673 | category.setDetail("Tracked entity count", () -> String.valueOf(this.getEntityCount()));
|
| 674 | category.setDetail("Client weather", () -> String.format(Locale.ROOT, "Raining: %b, thundering: %b", this.isRaining(), this.isThundering()));
|
| 675 | return category;
|
| 676 | }
|
| 677 |
|
| 678 | @Override
|
| 679 | public void playSeededSound(
|
| 680 | final @Nullable Entity except,
|
| 681 | final double x,
|
| 682 | final double y,
|
| 683 | final double z,
|
| 684 | final Holder<SoundEvent> sound,
|
| 685 | final SoundSource source,
|
| 686 | final float volume,
|
| 687 | final float pitch,
|
| 688 | final long seed
|
| 689 | ) {
|
| 690 | if (except == this.minecraft.player) {
|
| 691 | this.playSound(x, y, z, sound.value(), source, volume, pitch, false, seed);
|
| 692 | }
|
| 693 | }
|
| 694 |
|
| 695 | @Override
|
| 696 | public void playSeededSound(
|
| 697 | final @Nullable Entity except,
|
| 698 | final Entity sourceEntity,
|
| 699 | final Holder<SoundEvent> sound,
|
| 700 | final SoundSource source,
|
| 701 | final float volume,
|
| 702 | final float pitch,
|
| 703 | final long seed
|
| 704 | ) {
|
| 705 | if (except == this.minecraft.player) {
|
| 706 | this.minecraft.getSoundManager().play(new EntityBoundSoundInstance(sound.value(), source, volume, pitch, sourceEntity, seed));
|
| 707 | }
|
| 708 | }
|
| 709 |
|
| 710 | @Override
|
| 711 | public void playLocalSound(final Entity sourceEntity, final SoundEvent sound, final SoundSource source, final float volume, final float pitch) {
|
| 712 | this.minecraft.getSoundManager().play(new EntityBoundSoundInstance(sound, source, volume, pitch, sourceEntity, this.random.nextLong()));
|
| 713 | }
|
| 714 |
|
| 715 | @Override
|
| 716 | public void playPlayerSound(final SoundEvent sound, final SoundSource source, final float volume, final float pitch) {
|
| 717 | if (this.minecraft.player != null) {
|
| 718 | this.minecraft.getSoundManager().play(new EntityBoundSoundInstance(sound, source, volume, pitch, this.minecraft.player, this.random.nextLong()));
|
| 719 | }
|
| 720 | }
|
| 721 |
|
| 722 | @Override
|
| 723 | public void playLocalSound(
|
| 724 | final double x,
|
| 725 | final double y,
|
| 726 | final double z,
|
| 727 | final SoundEvent sound,
|
| 728 | final SoundSource source,
|
| 729 | final float volume,
|
| 730 | final float pitch,
|
| 731 | final boolean distanceDelay
|
| 732 | ) {
|
| 733 | this.playSound(x, y, z, sound, source, volume, pitch, distanceDelay, this.random.nextLong());
|
| 734 | }
|
| 735 |
|
| 736 | private void playSound(
|
| 737 | final double x,
|
| 738 | final double y,
|
| 739 | final double z,
|
| 740 | final SoundEvent sound,
|
| 741 | final SoundSource source,
|
| 742 | final float volume,
|
| 743 | final float pitch,
|
| 744 | final boolean distanceDelay,
|
| 745 | final long seed
|
| 746 | ) {
|
| 747 | double distanceToSqr = this.minecraft.gameRenderer.mainCamera().position().distanceToSqr(x, y, z);
|
| 748 | SimpleSoundInstance instance = new SimpleSoundInstance(sound, source, volume, pitch, RandomSource.create(seed), x, y, z);
|
| 749 | if (distanceDelay && distanceToSqr > 100.0) {
|
| 750 | double delayInSeconds = Math.sqrt(distanceToSqr) / 40.0;
|
| 751 | this.minecraft.getSoundManager().playDelayed(instance, (int)(delayInSeconds * 20.0));
|
| 752 | } else {
|
| 753 | this.minecraft.getSoundManager().play(instance);
|
| 754 | }
|
| 755 | }
|
| 756 |
|
| 757 | @Override
|
| 758 | public void createFireworks(
|
| 759 | final double x,
|
| 760 | final double y,
|
| 761 | final double z,
|
| 762 | final double xd,
|
| 763 | final double yd,
|
| 764 | final double zd,
|
| 765 | final List<FireworkExplosion> explosions,
|
| 766 | final boolean playSound
|
| 767 | ) {
|
| 768 | if (explosions.isEmpty()) {
|
| 769 | for (int i = 0; i < this.random.nextInt(3) + 2; i++) {
|
| 770 | this.addParticle(ParticleTypes.POOF, x, y, z, this.random.nextGaussian() * 0.05, 0.005, this.random.nextGaussian() * 0.05);
|
| 771 | }
|
| 772 | } else {
|
| 773 | this.minecraft.particleEngine.add(new FireworkParticles.Starter(this, x, y, z, xd, yd, zd, this.minecraft.particleEngine, explosions, playSound));
|
| 774 | }
|
| 775 | }
|
| 776 |
|
| 777 | @Override
|
| 778 | public void sendPacketToServer(final Packet<?> packet) {
|
| 779 | this.connection.send(packet);
|
| 780 | }
|
| 781 |
|
| 782 | @Override
|
| 783 | public WorldBorder getWorldBorder() {
|
| 784 | return this.worldBorder;
|
| 785 | }
|
| 786 |
|
| 787 | @Override
|
| 788 | public RecipeAccess recipeAccess() {
|
| 789 | return this.connection.recipes();
|
| 790 | }
|
| 791 |
|
| 792 | @Override
|
| 793 | public TickRateManager tickRateManager() {
|
| 794 | return this.tickRateManager;
|
| 795 | }
|
| 796 |
|
| 797 | @Override
|
| 798 | public float getRelativeTickSpeed() {
|
| 799 | float tickrate = this.tickRateManager.tickrate();
|
| 800 | return tickrate > 20.0F ? tickrate / 20.0F : 1.0F;
|
| 801 | }
|
| 802 |
|
| 803 | public ClientClockManager clockManager() {
|
| 804 | return this.connection.clockManager();
|
| 805 | }
|
| 806 |
|
| 807 | @Override
|
| 808 | public EnvironmentAttributeSystem environmentAttributes() {
|
| 809 | return this.environmentAttributes;
|
| 810 | }
|
| 811 |
|
| 812 | @Override
|
| 813 | public LevelTickAccess<Block> getBlockTicks() {
|
| 814 | return BlackholeTickAccess.emptyLevelList();
|
| 815 | }
|
| 816 |
|
| 817 | @Override
|
| 818 | public LevelTickAccess<Fluid> getFluidTicks() {
|
| 819 | return BlackholeTickAccess.emptyLevelList();
|
| 820 | }
|
| 821 |
|
| 822 | public ClientChunkCache getChunkSource() {
|
| 823 | return this.chunkSource;
|
| 824 | }
|
| 825 |
|
| 826 | @Override
|
| 827 | public @Nullable MapItemSavedData getMapData(final MapId id) {
|
| 828 | return this.mapData.get(id);
|
| 829 | }
|
| 830 |
|
| 831 | public void overrideMapData(final MapId id, final MapItemSavedData data) {
|
| 832 | this.mapData.put(id, data);
|
| 833 | }
|
| 834 |
|
| 835 | @Override
|
| 836 | public Scoreboard getScoreboard() {
|
| 837 | return this.connection.scoreboard();
|
| 838 | }
|
| 839 |
|
| 840 | @Override
|
| 841 | public void sendBlockUpdated(final BlockPos pos, final BlockState old, final BlockState current, final @UpdateFlags int updateFlags) {
|
| 842 | this.levelExtractor.blockChanged(pos, updateFlags);
|
| 843 | }
|
| 844 |
|
| 845 | @Override
|
| 846 | public void setBlocksDirty(final BlockPos pos, final BlockState oldState, final BlockState newState) {
|
| 847 | this.levelExtractor.setBlockDirty(pos, oldState, newState);
|
| 848 | }
|
| 849 |
|
| 850 | public void setSectionDirtyWithNeighbors(final int chunkX, final int chunkY, final int chunkZ) {
|
| 851 | this.levelExtractor.setSectionDirtyWithNeighbors(chunkX, chunkY, chunkZ);
|
| 852 | }
|
| 853 |
|
| 854 | public void setSectionRangeDirty(
|
| 855 | final int minSectionX, final int minSectionY, final int minSectionZ, final int maxSectionX, final int maxSectionY, final int maxSectionZ
|
| 856 | ) {
|
| 857 | this.levelExtractor.setSectionRangeDirty(minSectionX, minSectionY, minSectionZ, maxSectionX, maxSectionY, maxSectionZ);
|
| 858 | }
|
| 859 |
|
| 860 | @Override
|
| 861 | public void destroyBlockProgress(final int id, final BlockPos pos, final int progress) {
|
| 862 | if (progress >= 0 && progress < 10) {
|
| 863 | BlockDestructionProgress entry = this.destroyingBlocks.get(id);
|
| 864 | if (entry != null) {
|
| 865 | this.removeProgress(entry);
|
| 866 | }
|
| 867 |
|
| 868 | if (entry == null || entry.getPos().getX() != pos.getX() || entry.getPos().getY() != pos.getY() || entry.getPos().getZ() != pos.getZ()) {
|
| 869 | entry = new BlockDestructionProgress(id, pos);
|
| 870 | this.destroyingBlocks.put(id, entry);
|
| 871 | }
|
| 872 |
|
| 873 | entry.setProgress(progress);
|
| 874 | entry.updateTick(this.getGameTime());
|
| 875 | this.destructionProgress.computeIfAbsent(entry.getPos().asLong(), k -> Sets.newTreeSet()).add(entry);
|
| 876 | } else {
|
| 877 | BlockDestructionProgress removed = this.destroyingBlocks.remove(id);
|
| 878 | if (removed != null) {
|
| 879 | this.removeProgress(removed);
|
| 880 | }
|
| 881 | }
|
| 882 | }
|
| 883 |
|
| 884 | @Override
|
| 885 | public void globalLevelEvent(final @Value int type, final BlockPos pos, final int data) {
|
| 886 | this.levelEventHandler.globalLevelEvent(type, pos, data);
|
| 887 | }
|
| 888 |
|
| 889 | @Override
|
| 890 | public void levelEvent(final @Nullable Entity source, final @Value int type, final BlockPos pos, final int data) {
|
| 891 | try {
|
| 892 | this.levelEventHandler.levelEvent(type, pos, data);
|
| 893 | } catch (Throwable t) {
|
| 894 | CrashReport report = CrashReport.forThrowable(t, "Playing level event");
|
| 895 | CrashReportCategory category = report.addCategory("Level event being played");
|
| 896 | category.setDetail("Block coordinates", CrashReportCategory.formatLocation(this, pos));
|
| 897 | category.setDetail("Event source", source);
|
| 898 | category.setDetail("Event type", type);
|
| 899 | category.setDetail("Event data", data);
|
| 900 | throw new ReportedException(report);
|
| 901 | }
|
| 902 | }
|
| 903 |
|
| 904 | @Override
|
| 905 | public void addParticle(final ParticleOptions particle, final double x, final double y, final double z, final double xd, final double yd, final double zd) {
|
| 906 | this.doAddParticle(particle, particle.getType().getOverrideLimiter(), false, x, y, z, xd, yd, zd);
|
| 907 | }
|
| 908 |
|
| 909 | @Override
|
| 910 | public void addParticle(
|
| 911 | final ParticleOptions particle,
|
| 912 | final boolean overrideLimiter,
|
| 913 | final boolean alwaysShow,
|
| 914 | final double x,
|
| 915 | final double y,
|
| 916 | final double z,
|
| 917 | final double xd,
|
| 918 | final double yd,
|
| 919 | final double zd
|
| 920 | ) {
|
| 921 | this.doAddParticle(particle, particle.getType().getOverrideLimiter() || overrideLimiter, alwaysShow, x, y, z, xd, yd, zd);
|
| 922 | }
|
| 923 |
|
| 924 | @Override
|
| 925 | public void addAlwaysVisibleParticle(
|
| 926 | final ParticleOptions particle, final double x, final double y, final double z, final double xd, final double yd, final double zd
|
| 927 | ) {
|
| 928 | this.doAddParticle(particle, false, true, x, y, z, xd, yd, zd);
|
| 929 | }
|
| 930 |
|
| 931 | @Override
|
| 932 | public void addAlwaysVisibleParticle(
|
| 933 | final ParticleOptions particle,
|
| 934 | final boolean overrideLimiter,
|
| 935 | final double x,
|
| 936 | final double y,
|
| 937 | final double z,
|
| 938 | final double xd,
|
| 939 | final double yd,
|
| 940 | final double zd
|
| 941 | ) {
|
| 942 | this.doAddParticle(particle, particle.getType().getOverrideLimiter() || overrideLimiter, true, x, y, z, xd, yd, zd);
|
| 943 | }
|
| 944 |
|
| 945 | private void doAddParticle(
|
| 946 | final ParticleOptions particle,
|
| 947 | final boolean overrideLimiter,
|
| 948 | final boolean alwaysShowParticles,
|
| 949 | final double x,
|
| 950 | final double y,
|
| 951 | final double z,
|
| 952 | final double xd,
|
| 953 | final double yd,
|
| 954 | final double zd
|
| 955 | ) {
|
| 956 | try {
|
| 957 | Camera camera = this.minecraft.gameRenderer.mainCamera();
|
| 958 | ParticleStatus particleLevel = this.calculateParticleLevel(alwaysShowParticles);
|
| 959 | if (overrideLimiter) {
|
| 960 | this.minecraft.particleEngine.createParticle(particle, x, y, z, xd, yd, zd);
|
| 961 | } else if (!(camera.position().distanceToSqr(x, y, z) > 1024.0)) {
|
| 962 | if (particleLevel != ParticleStatus.MINIMAL) {
|
| 963 | this.minecraft.particleEngine.createParticle(particle, x, y, z, xd, yd, zd);
|
| 964 | }
|
| 965 | }
|
| 966 | } catch (Throwable t) {
|
| 967 | CrashReport report = CrashReport.forThrowable(t, "Exception while adding particle");
|
| 968 | CrashReportCategory category = report.addCategory("Particle being added");
|
| 969 | category.setDetail("ID", BuiltInRegistries.PARTICLE_TYPE.getKey(particle.getType()));
|
| 970 | category.setDetail(
|
| 971 | "Parameters", () -> ParticleTypes.CODEC.encodeStart(this.registryAccess().createSerializationContext(NbtOps.INSTANCE), particle).toString()
|
| 972 | );
|
| 973 | category.setDetail("Position", () -> CrashReportCategory.formatLocation(this, x, y, z));
|
| 974 | throw new ReportedException(report);
|
| 975 | }
|
| 976 | }
|
| 977 |
|
| 978 | private ParticleStatus calculateParticleLevel(final boolean alwaysShowParticles) {
|
| 979 | ParticleStatus particleLevel = this.minecraft.options.particles().get();
|
| 980 | if (alwaysShowParticles && particleLevel == ParticleStatus.MINIMAL && this.random.nextInt(10) == 0) {
|
| 981 | particleLevel = ParticleStatus.DECREASED;
|
| 982 | }
|
| 983 |
|
| 984 | if (particleLevel == ParticleStatus.DECREASED && this.random.nextInt(3) == 0) {
|
| 985 | particleLevel = ParticleStatus.MINIMAL;
|
| 986 | }
|
| 987 |
|
| 988 | return particleLevel;
|
| 989 | }
|
| 990 |
|
| 991 | @Override
|
| 992 | public List<AbstractClientPlayer> players() {
|
| 993 | return this.players;
|
| 994 | }
|
| 995 |
|
| 996 | public List<EnderDragonPart> dragonParts() {
|
| 997 | return this.dragonParts;
|
| 998 | }
|
| 999 |
|
| 1000 | @Override
|
| 1001 | public Holder<Biome> getUncachedNoiseBiome(final int quartX, final int quartY, final int quartZ) {
|
| 1002 | return this.registryAccess().lookupOrThrow(Registries.BIOME).getOrThrow(Biomes.PLAINS);
|
| 1003 | }
|
| 1004 |
|
| 1005 | private int getSkyFlashTime() {
|
| 1006 | return this.minecraft.options.hideLightningFlash().get() ? 0 : this.skyFlashTime;
|
| 1007 | }
|
| 1008 |
|
| 1009 | @Override
|
| 1010 | public void setSkyFlashTime(final int skyFlashTime) {
|
| 1011 | this.skyFlashTime = skyFlashTime;
|
| 1012 | }
|
| 1013 |
|
| 1014 | @Override
|
| 1015 | public CardinalLighting cardinalLighting() {
|
| 1016 | return this.dimensionType().cardinalLightType().get();
|
| 1017 | }
|
| 1018 |
|
| 1019 | @Override
|
| 1020 | public int getBlockTint(final BlockPos pos, final ColorResolver resolver) {
|
| 1021 | BlockTintCache cache = this.tintCaches.get(resolver);
|
| 1022 | return cache.getColor(pos);
|
| 1023 | }
|
| 1024 |
|
| 1025 | public int calculateBlockTint(final BlockPos pos, final ColorResolver colorResolver) {
|
| 1026 | int dist = Minecraft.getInstance().options.biomeBlendRadius().get();
|
| 1027 | if (dist == 0) {
|
| 1028 | return colorResolver.getColor(this.getBiome(pos).value(), pos.getX(), pos.getZ());
|
| 1029 | }
|
| 1030 |
|
| 1031 | int count = (dist * 2 + 1) * (dist * 2 + 1);
|
| 1032 | int totalRed = 0;
|
| 1033 | int totalGreen = 0;
|
| 1034 | int totalBlue = 0;
|
| 1035 | Cursor3D cursor = new Cursor3D(pos.getX() - dist, pos.getY(), pos.getZ() - dist, pos.getX() + dist, pos.getY(), pos.getZ() + dist);
|
| 1036 | MutableBlockPos nextPos = new MutableBlockPos();
|
| 1037 |
|
| 1038 | while (cursor.advance()) {
|
| 1039 | nextPos.set(cursor.nextX(), cursor.nextY(), cursor.nextZ());
|
| 1040 | int color = colorResolver.getColor(this.getBiome(nextPos).value(), nextPos.getX(), nextPos.getZ());
|
| 1041 | totalRed += ARGB.red(color);
|
| 1042 | totalGreen += ARGB.green(color);
|
| 1043 | totalBlue += ARGB.blue(color);
|
| 1044 | }
|
| 1045 |
|
| 1046 | return ARGB.color(totalRed / count, totalGreen / count, totalBlue / count);
|
| 1047 | }
|
| 1048 |
|
| 1049 | @Override
|
| 1050 | public void setRespawnData(final RespawnData respawnData) {
|
| 1051 | this.levelData.setSpawn(this.getWorldBorderAdjustedRespawnData(respawnData));
|
| 1052 | }
|
| 1053 |
|
| 1054 | @Override
|
| 1055 | public RespawnData getRespawnData() {
|
| 1056 | return this.levelData.getRespawnData();
|
| 1057 | }
|
| 1058 |
|
| 1059 | @Override
|
| 1060 | public String toString() {
|
| 1061 | return "ClientLevel";
|
| 1062 | }
|
| 1063 |
|
| 1064 | public ClientLevel.ClientLevelData getLevelData() {
|
| 1065 | return this.clientLevelData;
|
| 1066 | }
|
| 1067 |
|
| 1068 | @Override
|
| 1069 | public void gameEvent(final Holder<GameEvent> gameEvent, final Vec3 pos, final Context context) {
|
| 1070 | }
|
| 1071 |
|
| 1072 | protected Map<MapId, MapItemSavedData> getAllMapData() {
|
| 1073 | return ImmutableMap.copyOf(this.mapData);
|
| 1074 | }
|
| 1075 |
|
| 1076 | protected void addMapData(final Map<MapId, MapItemSavedData> mapData) {
|
| 1077 | this.mapData.putAll(mapData);
|
| 1078 | }
|
| 1079 |
|
| 1080 | @Override
|
| 1081 | protected LevelEntityGetter<Entity> getEntities() {
|
| 1082 | return this.entityStorage.getEntityGetter();
|
| 1083 | }
|
| 1084 |
|
| 1085 | @Override
|
| 1086 | public String gatherChunkSourceStats() {
|
| 1087 | return "Chunks[C] W: " + this.chunkSource.gatherStats() + " E: " + this.entityStorage.gatherStats();
|
| 1088 | }
|
| 1089 |
|
| 1090 | @Override
|
| 1091 | public void addDestroyBlockEffect(final BlockPos pos, final BlockState blockState) {
|
| 1092 | if (!blockState.isAir() && blockState.shouldSpawnTerrainParticles()) {
|
| 1093 | VoxelShape shape = blockState.getShape(this, pos);
|
| 1094 | double density = 0.25;
|
| 1095 | shape.forAllBoxes(
|
| 1096 | (x1, y1, z1, x2, y2, z2) -> {
|
| 1097 | double widthX = Math.min(1.0, x2 - x1);
|
| 1098 | double widthY = Math.min(1.0, y2 - y1);
|
| 1099 | double widthZ = Math.min(1.0, z2 - z1);
|
| 1100 | int countX = Math.max(2, Mth.ceil(widthX / 0.25));
|
| 1101 | int countY = Math.max(2, Mth.ceil(widthY / 0.25));
|
| 1102 | int countZ = Math.max(2, Mth.ceil(widthZ / 0.25));
|
| 1103 |
|
| 1104 | for (int xx = 0; xx < countX; xx++) {
|
| 1105 | for (int yy = 0; yy < countY; yy++) {
|
| 1106 | for (int zz = 0; zz < countZ; zz++) {
|
| 1107 | double relX = (xx + 0.5) / countX;
|
| 1108 | double relY = (yy + 0.5) / countY;
|
| 1109 | double relZ = (zz + 0.5) / countZ;
|
| 1110 | double x = relX * widthX + x1;
|
| 1111 | double y = relY * widthY + y1;
|
| 1112 | double z = relZ * widthZ + z1;
|
| 1113 | this.minecraft
|
| 1114 | .particleEngine
|
| 1115 | .add(new TerrainParticle(this, pos.getX() + x, pos.getY() + y, pos.getZ() + z, relX - 0.5, relY - 0.5, relZ - 0.5, blockState, pos));
|
| 1116 | }
|
| 1117 | }
|
| 1118 | }
|
| 1119 | }
|
| 1120 | );
|
| 1121 | }
|
| 1122 | }
|
| 1123 |
|
| 1124 | public void addBreakingBlockEffects(final BlockPos pos, final Direction direction, final boolean playSound) {
|
| 1125 | BlockState blockState = this.getBlockState(pos);
|
| 1126 | if (!blockState.isAir()) {
|
| 1127 | if (playSound) {
|
| 1128 | this.playBreakingSound(pos, blockState);
|
| 1129 | }
|
| 1130 |
|
| 1131 | if (blockState.getRenderShape() != RenderShape.INVISIBLE && blockState.shouldSpawnTerrainParticles()) {
|
| 1132 | this.addBreakingParticles(pos, direction, blockState);
|
| 1133 | }
|
| 1134 | }
|
| 1135 | }
|
| 1136 |
|
| 1137 | private void addBreakingParticles(final BlockPos pos, final Direction direction, final BlockState blockState) {
|
| 1138 | int x = pos.getX();
|
| 1139 | int y = pos.getY();
|
| 1140 | int z = pos.getZ();
|
| 1141 | float r = 0.1F;
|
| 1142 | AABB shape = blockState.getShape(this, pos).bounds();
|
| 1143 | double xp = x + this.random.nextDouble() * (shape.maxX - shape.minX - 0.2F) + 0.1F + shape.minX;
|
| 1144 | double yp = y + this.random.nextDouble() * (shape.maxY - shape.minY - 0.2F) + 0.1F + shape.minY;
|
| 1145 | double zp = z + this.random.nextDouble() * (shape.maxZ - shape.minZ - 0.2F) + 0.1F + shape.minZ;
|
| 1146 | if (direction == Direction.DOWN) {
|
| 1147 | yp = y + shape.minY - 0.1F;
|
| 1148 | }
|
| 1149 |
|
| 1150 | if (direction == Direction.UP) {
|
| 1151 | yp = y + shape.maxY + 0.1F;
|
| 1152 | }
|
| 1153 |
|
| 1154 | if (direction == Direction.NORTH) {
|
| 1155 | zp = z + shape.minZ - 0.1F;
|
| 1156 | }
|
| 1157 |
|
| 1158 | if (direction == Direction.SOUTH) {
|
| 1159 | zp = z + shape.maxZ + 0.1F;
|
| 1160 | }
|
| 1161 |
|
| 1162 | if (direction == Direction.WEST) {
|
| 1163 | xp = x + shape.minX - 0.1F;
|
| 1164 | }
|
| 1165 |
|
| 1166 | if (direction == Direction.EAST) {
|
| 1167 | xp = x + shape.maxX + 0.1F;
|
| 1168 | }
|
| 1169 |
|
| 1170 | this.minecraft.particleEngine.add(new TerrainParticle(this, xp, yp, zp, 0.0, 0.0, 0.0, blockState, pos).setPower(0.2F).scale(0.6F));
|
| 1171 | }
|
| 1172 |
|
| 1173 | private void playBreakingSound(final BlockPos pos, final BlockState blockState) {
|
| 1174 | SoundType soundType = blockState.getSoundType();
|
| 1175 | this.minecraft
|
| 1176 | .getSoundManager()
|
| 1177 | .play(
|
| 1178 | new SimpleSoundInstance(
|
| 1179 | soundType.getHitSound(), SoundSource.BLOCKS, (soundType.getVolume() + 1.0F) / 8.0F, soundType.getPitch() * 0.5F, SoundInstance.createUnseededRandom(), pos
|
| 1180 | )
|
| 1181 | );
|
| 1182 | }
|
| 1183 |
|
| 1184 | public void setServerSimulationDistance(final int serverSimulationDistance) {
|
| 1185 | this.serverSimulationDistance = serverSimulationDistance;
|
| 1186 | }
|
| 1187 |
|
| 1188 | public int getServerSimulationDistance() {
|
| 1189 | return this.serverSimulationDistance;
|
| 1190 | }
|
| 1191 |
|
| 1192 | @Override
|
| 1193 | public FeatureFlagSet enabledFeatures() {
|
| 1194 | return this.connection.enabledFeatures();
|
| 1195 | }
|
| 1196 |
|
| 1197 | @Override
|
| 1198 | public void explode(
|
| 1199 | final @Nullable Entity source,
|
| 1200 | final @Nullable DamageSource damageSource,
|
| 1201 | final @Nullable ExplosionDamageCalculator damageCalculator,
|
| 1202 | final double x,
|
| 1203 | final double y,
|
| 1204 | final double z,
|
| 1205 | final float r,
|
| 1206 | final boolean fire,
|
| 1207 | final ExplosionInteraction interactionType,
|
| 1208 | final ParticleOptions smallExplosionParticles,
|
| 1209 | final ParticleOptions largeExplosionParticles,
|
| 1210 | final WeightedList<ExplosionParticleInfo> secondaryParticles,
|
| 1211 | final Holder<SoundEvent> explosionSound
|
| 1212 | ) {
|
| 1213 | }
|
| 1214 |
|
| 1215 | @Override
|
| 1216 | public int getSeaLevel() {
|
| 1217 | return this.seaLevel;
|
| 1218 | }
|
| 1219 |
|
| 1220 | @Override
|
| 1221 | public int getClientLeafTintColor(final BlockPos pos) {
|
| 1222 | BlockState state = this.getBlockState(pos);
|
| 1223 | BlockTintSource tintSource = Minecraft.getInstance().getBlockColors().getTintSource(state, 0);
|
| 1224 | return tintSource != null ? tintSource.colorInWorld(state, this, pos) : -1;
|
| 1225 | }
|
| 1226 |
|
| 1227 | @Override
|
| 1228 | public void registerForCleaning(final CacheSlot<ClientLevel, ?> slot) {
|
| 1229 | this.connection.registerForCleaning(slot);
|
| 1230 | }
|
| 1231 |
|
| 1232 | public void trackExplosionEffects(final Vec3 center, final float radius, final int blockCount, final WeightedList<ExplosionParticleInfo> blockParticles) {
|
| 1233 | this.explosionTracker.track(center, radius, blockCount, blockParticles);
|
| 1234 | }
|
| 1235 |
|
| 1236 | @Environment(EnvType.CLIENT)
|
| 1237 | public static class ClientLevelData implements WritableLevelData {
|
| 1238 | private final boolean hardcore;
|
| 1239 | private final boolean isFlat;
|
| 1240 | private RespawnData respawnData;
|
| 1241 | private long gameTime;
|
| 1242 | private Difficulty difficulty;
|
| 1243 | private boolean difficultyLocked;
|
| 1244 |
|
| 1245 | public ClientLevelData(final Difficulty difficulty, final boolean hardcore, final boolean isFlat) {
|
| 1246 | this.difficulty = difficulty;
|
| 1247 | this.hardcore = hardcore;
|
| 1248 | this.isFlat = isFlat;
|
| 1249 | }
|
| 1250 |
|
| 1251 | @Override
|
| 1252 | public RespawnData getRespawnData() {
|
| 1253 | return this.respawnData;
|
| 1254 | }
|
| 1255 |
|
| 1256 | @Override
|
| 1257 | public long getGameTime() {
|
| 1258 | return this.gameTime;
|
| 1259 | }
|
| 1260 |
|
| 1261 | public void setGameTime(final long time) {
|
| 1262 | this.gameTime = time;
|
| 1263 | }
|
| 1264 |
|
| 1265 | @Override
|
| 1266 | public void setSpawn(final RespawnData respawnData) {
|
| 1267 | this.respawnData = respawnData;
|
| 1268 | }
|
| 1269 |
|
| 1270 | @Override
|
| 1271 | public boolean isHardcore() {
|
| 1272 | return this.hardcore;
|
| 1273 | }
|
| 1274 |
|
| 1275 | @Override
|
| 1276 | public Difficulty getDifficulty() {
|
| 1277 | return this.difficulty;
|
| 1278 | }
|
| 1279 |
|
| 1280 | @Override
|
| 1281 | public boolean isDifficultyLocked() {
|
| 1282 | return this.difficultyLocked;
|
| 1283 | }
|
| 1284 |
|
| 1285 | @Override
|
| 1286 | public void fillCrashReportCategory(final CrashReportCategory category, final LevelHeightAccessor levelHeightAccessor) {
|
| 1287 | WritableLevelData.super.fillCrashReportCategory(category, levelHeightAccessor);
|
| 1288 | }
|
| 1289 |
|
| 1290 | public void setDifficulty(final Difficulty difficulty) {
|
| 1291 | this.difficulty = difficulty;
|
| 1292 | }
|
| 1293 |
|
| 1294 | public void setDifficultyLocked(final boolean locked) {
|
| 1295 | this.difficultyLocked = locked;
|
| 1296 | }
|
| 1297 |
|
| 1298 | public double getHorizonHeight(final LevelHeightAccessor level) {
|
| 1299 | return this.isFlat ? level.getMinY() : 63.0;
|
| 1300 | }
|
| 1301 |
|
| 1302 | public float voidDarknessOnsetRange() {
|
| 1303 | return this.isFlat ? 1.0F : 32.0F;
|
| 1304 | }
|
| 1305 | }
|
| 1306 |
|
| 1307 | @Environment(EnvType.CLIENT)
|
| 1308 | private final class EntityCallbacks implements LevelCallback<Entity> {
|
| 1309 | public void onCreated(final Entity entity) {
|
| 1310 | }
|
| 1311 |
|
| 1312 | public void onDestroyed(final Entity entity) {
|
| 1313 | }
|
| 1314 |
|
| 1315 | public void onTickingStart(final Entity entity) {
|
| 1316 | ClientLevel.this.tickingEntities.add(entity);
|
| 1317 | }
|
| 1318 |
|
| 1319 | public void onTickingEnd(final Entity entity) {
|
| 1320 | ClientLevel.this.tickingEntities.remove(entity);
|
| 1321 | }
|
| 1322 |
|
| 1323 | public void onTrackingStart(final Entity entity) {
|
| 1324 | switch (entity) {
|
| 1325 | case AbstractClientPlayer player:
|
| 1326 | ClientLevel.this.players.add(player);
|
| 1327 | break;
|
| 1328 | case EnderDragon dragon:
|
| 1329 | ClientLevel.this.dragonParts.addAll(Arrays.asList(dragon.getSubEntities()));
|
| 1330 | break;
|
| 1331 | default:
|
| 1332 | }
|
| 1333 | }
|
| 1334 |
|
| 1335 | public void onTrackingEnd(final Entity entity) {
|
| 1336 | entity.unRide();
|
| 1337 | switch (entity) {
|
| 1338 | case AbstractClientPlayer player:
|
| 1339 | ClientLevel.this.players.remove(player);
|
| 1340 | break;
|
| 1341 | case EnderDragon dragon:
|
| 1342 | ClientLevel.this.dragonParts.removeAll(Arrays.asList(dragon.getSubEntities()));
|
| 1343 | break;
|
| 1344 | default:
|
| 1345 | }
|
| 1346 | }
|
| 1347 |
|
| 1348 | public void onSectionChange(final Entity entity) {
|
| 1349 | }
|
| 1350 | }
|
| 1351 | }
|
| 1352 |
|