diff --git a/game/client/src/main/java/net/minecraft/client/Minecraft.java b/game/client/src/main/java/net/minecraft/client/Minecraft.java index 143abe392..7ae77976a 100644 --- a/game/client/src/main/java/net/minecraft/client/Minecraft.java +++ b/game/client/src/main/java/net/minecraft/client/Minecraft.java @@ -1187,6 +1187,11 @@ public class Minecraft private void mineBlocks(final boolean leftClickDown) { final @NotNull PlayerController playerController = Objects.requireNonNull(this.playerController); + if (playerController.cancelLeftClick) { + if (!leftClickDown) playerController.cancelLeftClick = false; + return; + } + if (leftClickDown && this.objectMouseOver instanceof final @NotNull HitResult.Tile hitTile) { final double xPlaced; if (hitTile.side.axis() == Axis.X) { diff --git a/game/client/src/main/java/net/minecraft/client/gui/ScreenSignEditor.java b/game/client/src/main/java/net/minecraft/client/gui/ScreenSignEditor.java index 30f412f04..37d0409a6 100644 --- a/game/client/src/main/java/net/minecraft/client/gui/ScreenSignEditor.java +++ b/game/client/src/main/java/net/minecraft/client/gui/ScreenSignEditor.java @@ -50,18 +50,18 @@ public class ScreenSignEditor extends Screen { this.buttons.clear(); Keyboard.enableRepeatEvents(true); - final @NotNull Block block = this.entitySign.getBlock(); - if (block == Blocks.SIGN_POST_PLANKS_OAK) { - this.yOffset = 36; - } - - this.buttons.add(new ButtonElement(0, this.width / 2 - 100, 150 + 50 + this.yOffset, I18n.getInstance().translateKey("gui.edit_sign.button.done"))); - boolean wallSign = false; - if (Block.hasLogicClass(block, BlockLogicSign.class)) { - wallSign = !((BlockLogicSign) block.getLogic()).isFreeStanding; + final @NotNull BlockLogic logic = this.entitySign.getBlock().getLogic(); + if (logic instanceof BlockLogicSign sign) { + if (sign.isFreeStanding) { + this.yOffset = 31; + } else { + wallSign = true; + } } + this.buttons.add(new ButtonElement(0, this.width / 2 - 100, 150 + 50, I18n.getInstance().translateKey("gui.edit_sign.button.done"))); + this.add(new ListenerButtonElement(30, this.width / 2 - 50, 67 + (wallSign ? 31 : 0), 100, 12, "") .setActionListener(() -> { this.editLine = 0; diff --git a/game/client/src/main/java/net/minecraft/client/gui/guidebook/crafting/displays/DisplayAdapterLabel.java b/game/client/src/main/java/net/minecraft/client/gui/guidebook/crafting/displays/DisplayAdapterLabel.java index ebb1fb683..51cc6eb81 100644 --- a/game/client/src/main/java/net/minecraft/client/gui/guidebook/crafting/displays/DisplayAdapterLabel.java +++ b/game/client/src/main/java/net/minecraft/client/gui/guidebook/crafting/displays/DisplayAdapterLabel.java @@ -10,6 +10,7 @@ import net.minecraft.core.item.IItemConvertible; import net.minecraft.core.item.Item; import net.minecraft.core.item.ItemStack; import net.minecraft.core.item.Items; +import org.jetbrains.annotations.NotNull; import java.util.ArrayList; import java.util.List; @@ -24,8 +25,8 @@ public class DisplayAdapterLabel implements RecipeDisplayAdapter b = null; - while (b == null) { + @NotNull Block b = Blocks.AIR; + while (b == Blocks.AIR) { b = Blocks.getBlock(lastId + offset++); } randomOptions[blocksAdded++] = b; @@ -35,7 +36,7 @@ public class DisplayAdapterLabel implements RecipeDisplayAdapter extends BlockMo @Override public boolean renderAttached(@NotNull TessellatorGeneral tessellator, @NotNull WorldSource worldSource, @NotNull TilePosc tilePos, boolean cullFaces, @Nullable IconCoordinate overrideTexture) { - int dir = worldSource.getBlockData(tilePos) & 0b1; - if (dir > 0) { - return getModel(worldSource, tilePos).renderAttached(this, tessellator, worldSource, tilePos, 0, 1, 0, 0, 0, 0, false, cullFaces, overrideTexture); + class Cache { + private static final TilePos queryPos = new TilePos(); + } + var model = getModel(worldSource, tilePos); + + boolean we = worldSource.getBlockType(tilePos.add(Direction.WEST, Cache.queryPos)) == this.block || worldSource.getBlockType(tilePos.add(Direction.EAST, Cache.queryPos)) == this.block; + boolean ns = worldSource.getBlockType(tilePos.add(Direction.NORTH, Cache.queryPos)) == this.block || worldSource.getBlockType(tilePos.add(Direction.SOUTH, Cache.queryPos)) == this.block; + if (we && ns) { + boolean didRender = model.renderAttached(this, tessellator, worldSource, tilePos, 0, 0, 0, 0, 0, 0, false, cullFaces, overrideTexture); + didRender |= model.renderAttached(this, tessellator, worldSource, tilePos, 0, 1, 0, 0, 0, 0, false, cullFaces, overrideTexture); + return didRender; } - return getModel(worldSource, tilePos).renderAttached(this, tessellator, worldSource, tilePos, 0, 0, 0, 0, 0, 0, false, cullFaces, overrideTexture); + + int dir = worldSource.getBlockData(tilePos) & 0b1; + return model.renderAttached(this, tessellator, worldSource, tilePos, 0, dir != 0 ? 1 : 0, 0, 0, 0, 0, false, cullFaces, overrideTexture); } @Override diff --git a/game/client/src/main/java/net/minecraft/client/world/WorldClient.java b/game/client/src/main/java/net/minecraft/client/world/WorldClient.java index a6b3f34af..59e45954c 100644 --- a/game/client/src/main/java/net/minecraft/client/world/WorldClient.java +++ b/game/client/src/main/java/net/minecraft/client/world/WorldClient.java @@ -124,7 +124,7 @@ public class WorldClient extends World { TilePos blockPos = camera.getTilePos(partialTick); float blockTemperature = (float) getBlockTemperature(blockPos); - if (this.getSeasonManager().getCurrentSeason() != null && (this.getSeasonManager().getCurrentSeason() == Seasons.OVERWORLD_WINTER || this.getSeasonManager().getCurrentSeason() == Seasons.OVERWORLD_FALL)) { + if (this.getSeasonManager().getCurrentSeason() != null && (this.getSeasonManager().getCurrentSeason() == Seasons.OVERWORLD_WINTER || this.getSeasonManager().getCurrentSeason() == Seasons.OVERWORLD_WINTER_ENDLESS || this.getSeasonManager().getCurrentSeason() == Seasons.OVERWORLD_FALL)) { blockTemperature = blockTemperature - (1.25f); } int skyColor; diff --git a/game/client/src/main/resources/assets/minecraft/models/entity/zombie/zombie.geo.json b/game/client/src/main/resources/assets/minecraft/models/entity/zombie/zombie.geo.json index db2a0bc5b..a1b96edc5 100644 --- a/game/client/src/main/resources/assets/minecraft/models/entity/zombie/zombie.geo.json +++ b/game/client/src/main/resources/assets/minecraft/models/entity/zombie/zombie.geo.json @@ -84,7 +84,7 @@ }, { "name": "hat", - "parent": "waist", + "parent": "head", "pivot": [0, 24, 0], "cubes": [ {"origin": [-4, 24, -4], "size": [8, 8, 8], "uv": [32, 0], "inflate": 0.5} diff --git a/game/client/src/main/resources/shaders/font.fsh b/game/client/src/main/resources/shaders/font.fsh index d86522da3..ead383197 100644 --- a/game/client/src/main/resources/shaders/font.fsh +++ b/game/client/src/main/resources/shaders/font.fsh @@ -45,7 +45,7 @@ vec4 bold(vec2 coord, vec4 text, vec4 textColor) for(int i = 0; i < sh.x; i++) { vec2 left = coord - vec2(i+1, 0)/rh; - if(sampleInside(left) && text.a < 1.0f) + if(sampleInside(left) && text.a < 0.9999f) text = texture(colortex, left) * textColor; } diff --git a/game/core/src/main/java/net/minecraft/core/block/BlockLogicBrazier.java b/game/core/src/main/java/net/minecraft/core/block/BlockLogicBrazier.java index c70e4b011..4221274bf 100644 --- a/game/core/src/main/java/net/minecraft/core/block/BlockLogicBrazier.java +++ b/game/core/src/main/java/net/minecraft/core/block/BlockLogicBrazier.java @@ -107,7 +107,16 @@ public class BlockLogicBrazier @Override public void animationTick(final @NotNull World world, final @NotNull TilePosc tilePos, final @NotNull Random rand) { if (this.burning) { - Blocks.FIRE.animationTick(world, tilePos, rand); + if (rand.nextInt(24) == 0) { + world.playSoundEffect(null, SoundCategory.WORLD_SOUNDS, tilePos.x() + 0.5F, tilePos.y() + 0.5F, tilePos.z() + 0.5F, "fire.fire", + 1.0F + rand.nextFloat(), rand.nextFloat() * 0.7F + 0.3F); + } + for (int l = 0; l < 3; l++) { + final double x = tilePos.x() + rand.nextFloat(); + final double y = tilePos.y() + rand.nextFloat() * 0.5F + 0.5F; + final double z = tilePos.z() + rand.nextFloat(); + world.spawnParticle("largesmoke", x, y, z, 0.0D, 0.0D, 0.0D, 0, false); + } } } } diff --git a/game/core/src/main/java/net/minecraft/core/block/BlockLogicPortal.java b/game/core/src/main/java/net/minecraft/core/block/BlockLogicPortal.java index c4e030e52..f2af23610 100644 --- a/game/core/src/main/java/net/minecraft/core/block/BlockLogicPortal.java +++ b/game/core/src/main/java/net/minecraft/core/block/BlockLogicPortal.java @@ -12,7 +12,6 @@ import net.minecraft.core.item.ItemStack; import net.minecraft.core.item.Items; import net.minecraft.core.sound.SoundCategory; import net.minecraft.core.util.helper.Axis; -import net.minecraft.core.util.helper.Direction; import net.minecraft.core.util.helper.DyeColor; import net.minecraft.core.util.helper.Side; import net.minecraft.core.world.Dimension; @@ -30,7 +29,8 @@ import java.util.Random; public class BlockLogicPortal extends BlockLogicTransparent implements IPainted { public static final int MAX_PORTAL_SIZE = 32; public static final int MASK_COLOR = 0b1111_0000; - public static final int MASK_ROTATION = 0b0000_0011; + public static final int MASK_ROTATION = 0b0000_0001; + public static final int MASK_SOURCE = 0b0000_0010; public static final int MASK_COLOR_SET = 0b0000_1000; public static final int ORIENTATION_X = 0; @@ -60,7 +60,7 @@ public class BlockLogicPortal extends BlockLogicTransparent implements IPainted @Override public @NotNull AABBdc getBoundsFromState(@NotNull WorldSource source, @NotNull TilePosc tilePos) { int meta = source.getBlockData(tilePos); - if ((meta & 0x1) > 0) { + if ((meta & MASK_ROTATION) != 0) { float f1 = 0.125F; float f3 = 0.5F; return new AABBd(0.5F - f1, 0.0F, 0.5F - f3, 0.5F + f1, 1.0F, 0.5F + f3); @@ -327,11 +327,9 @@ public class BlockLogicPortal extends BlockLogicTransparent implements IPainted @Override public void animationTick(@NotNull World world, @NotNull TilePosc tilePos, @NotNull Random rand) { int meta = world.getBlockData(tilePos); - if ((meta & 0x2) > 0 && rand.nextInt(20) == 0) { + if ((meta & MASK_SOURCE) != 0 && rand.nextInt(20) == 0) { world.playSoundEffect(null, SoundCategory.WORLD_SOUNDS, (double) tilePos.x() + 0.5D, (double) tilePos.y() + 0.5D, (double) tilePos.z() + 0.5D, "portal.portal", 0.5F, rand.nextFloat() * 0.4F + 0.8F); } - - TilePos queryPos = new TilePos(); for (int l = 0; l < 4; l++) { double px = (double) tilePos.x() + rand.nextFloat(); double py = (double) tilePos.y() + rand.nextFloat(); @@ -340,12 +338,15 @@ public class BlockLogicPortal extends BlockLogicTransparent implements IPainted double xd = (rand.nextDouble() - 0.5D) * 0.5D; double yd = (rand.nextDouble() - 0.5D) * 0.5D; double zd = (rand.nextDouble() - 0.5D) * 0.5D; - if (world.getBlockType(tilePos.add(Direction.WEST, queryPos)) == this.block || world.getBlockType(tilePos.add(Direction.EAST, queryPos)) == this.block) { - pz = (double) tilePos.z() + 0.5D + 0.25D * (double) i1; - zd = rand.nextFloat() * 2.0D * (double) i1; - } else { - px = (double) tilePos.x() + 0.5D + 0.25D * (double) i1; - xd = rand.nextFloat() * 2.0D * (double) i1; + switch (meta & MASK_ROTATION) { + case 0 -> { + pz = (double) tilePos.z() + 0.5D + 0.25D * (double) i1; + zd = rand.nextFloat() * 2.0D * (double) i1; + } + case 1 -> { + px = (double) tilePos.x() + 0.5D + 0.25D * (double) i1; + xd = rand.nextFloat() * 2.0D * (double) i1; + } } world.spawnParticle("portal", px, py, pz, xd, yd, zd, fromMetadata(meta).blockMeta, false); } diff --git a/game/core/src/main/java/net/minecraft/core/entity/animal/MobAnimal.java b/game/core/src/main/java/net/minecraft/core/entity/animal/MobAnimal.java index 94fdaef6e..4d52bf93e 100644 --- a/game/core/src/main/java/net/minecraft/core/entity/animal/MobAnimal.java +++ b/game/core/src/main/java/net/minecraft/core/entity/animal/MobAnimal.java @@ -55,10 +55,10 @@ public abstract class MobAnimal extends MobPathfinder @Override public int getMaxSpawnedInChunk() { - if(world.getSeasonManager().getCurrentSeason() == Seasons.OVERWORLD_SPRING) - return 8; - if(world.getSeasonManager().getCurrentSeason() == Seasons.OVERWORLD_WINTER) - return 0; + var currentSeason = this.world.getSeasonManager().getCurrentSeason(); + if(currentSeason == Seasons.OVERWORLD_SPRING) return 8; + if(currentSeason == Seasons.OVERWORLD_WINTER) return 0; + if(currentSeason == Seasons.OVERWORLD_WINTER_ENDLESS) return 1; return 4; } diff --git a/game/core/src/main/java/net/minecraft/core/entity/animal/MobDeer.java b/game/core/src/main/java/net/minecraft/core/entity/animal/MobDeer.java index bb79278e4..5ef59ea37 100644 --- a/game/core/src/main/java/net/minecraft/core/entity/animal/MobDeer.java +++ b/game/core/src/main/java/net/minecraft/core/entity/animal/MobDeer.java @@ -131,7 +131,8 @@ public class MobDeer @Override public int getMaxSpawnedInChunk() { - if (this.world.getSeasonManager().getCurrentSeason() == Seasons.OVERWORLD_WINTER) { + var currentSeason = this.world.getSeasonManager().getCurrentSeason(); + if (currentSeason == Seasons.OVERWORLD_WINTER || currentSeason == Seasons.OVERWORLD_WINTER_ENDLESS) { return 4; } else { return 0; diff --git a/game/core/src/main/java/net/minecraft/core/world/generate/chunk/ChunkFeatureDecorator.java b/game/core/src/main/java/net/minecraft/core/world/generate/chunk/ChunkFeatureDecorator.java index ba54249c7..83324af95 100644 --- a/game/core/src/main/java/net/minecraft/core/world/generate/chunk/ChunkFeatureDecorator.java +++ b/game/core/src/main/java/net/minecraft/core/world/generate/chunk/ChunkFeatureDecorator.java @@ -3,7 +3,10 @@ package net.minecraft.core.world.generate.chunk; import com.mojang.logging.LogUtils; import it.unimi.dsi.fastutil.objects.Object2IntLinkedOpenHashMap; import it.unimi.dsi.fastutil.objects.Object2IntMap; +import it.unimi.dsi.fastutil.objects.Object2ObjectLinkedOpenHashMap; +import it.unimi.dsi.fastutil.objects.Object2ObjectMap; import net.minecraft.core.block.BlockLogicFallingBlock; +import net.minecraft.core.block.BlockLogicFluid; import net.minecraft.core.util.HardIllegalArgumentException; import net.minecraft.core.util.collection.NamespaceID; import net.minecraft.core.world.World; @@ -21,7 +24,8 @@ public abstract class ChunkFeatureDecorator private boolean initialized = false; private final @NotNull World world; - private final @NotNull Object2IntMap decorations = new Object2IntLinkedOpenHashMap<>(); + private final @NotNull Object2ObjectMap decorations = new Object2ObjectLinkedOpenHashMap<>(); + private final @NotNull Object2IntMap decorationSeeds = new Object2IntLinkedOpenHashMap<>(); private ChunkDecoration @Nullable [] decorationArray; private int @Nullable [] decorationSeedArray; @@ -55,19 +59,20 @@ public abstract class ChunkFeatureDecorator } public final @NotNull ChunkFeatureDecorator register(final @NotNull NamespaceID id, final @NotNull ChunkDecoration decoration) { - this.decorations.put(decoration, id.toString().hashCode()); + this.decorations.put(decoration, id); + this.decorationSeeds.put(decoration, id.toString().hashCode()); this.decorationArray = null; this.decorationSeedArray = null; return this; } private void bakeDecorations() { - final int n = this.decorations.size(); + final int n = this.decorationSeeds.size(); final ChunkDecoration[] decoArr = new ChunkDecoration[n]; final int[] seedArr = new int[n]; int i = 0; - for (final Object2IntMap.Entry entry : this.decorations.object2IntEntrySet()) { + for (final Object2IntMap.Entry entry : this.decorationSeeds.object2IntEntrySet()) { decoArr[i] = entry.getKey(); seedArr[i] = entry.getIntValue(); i++; @@ -116,8 +121,7 @@ public abstract class ChunkFeatureDecorator try { decoArr[i].placeDecoration(this.world, chunk, worldX, worldZ, minY, maxY, rangeY, rand); } catch (final Throwable t) { - LOGGER.error("Decoration {} failed at chunk ({}, {}); continuing with remaining decorations.", - i, chunkX, chunkZ, t); + LOGGER.error("Decoration {} '{}' failed at chunk ({}, {}); continuing with remaining decorations.", i, this.decorations.get(this.decorationArray[i]), chunkX, chunkZ, t); } } diff --git a/game/core/src/main/java/net/minecraft/core/world/type/WorldType.java b/game/core/src/main/java/net/minecraft/core/world/type/WorldType.java index f21c4a808..9b704aecc 100644 --- a/game/core/src/main/java/net/minecraft/core/world/type/WorldType.java +++ b/game/core/src/main/java/net/minecraft/core/world/type/WorldType.java @@ -35,6 +35,7 @@ public abstract class WorldType private final WindProvider windProvider; private final boolean hasCeiling; private final boolean hasFloor; + private final boolean hasAuroras; private final float[] brightnessRamp; private final SeasonConfig seasonConfig; private final int minY; @@ -53,6 +54,7 @@ public abstract class WorldType this.windProvider = properties.windProvider == null ? new WindProviderGeneric() : properties.windProvider; this.hasCeiling = properties.hasCeiling; this.hasFloor = properties.hasFloor; + this.hasAuroras = properties.hasAuroras; this.brightnessRamp = properties.brightnessRamp; this.seasonConfig = properties.seasonConfig == null ? SeasonConfig.builder().withSingleSeason(Seasons.NULL).build() : properties.seasonConfig; this.minY = properties.minY; @@ -105,6 +107,10 @@ public abstract class WorldType return hasFloor; } + public boolean hasAuroras() { + return this.hasAuroras; + } + public float[] getBrightnessRamp() { return brightnessRamp; } @@ -321,6 +327,7 @@ public abstract class WorldType private WindProvider windProvider = null; private boolean hasCeiling = false; private boolean hasFloor = true; + private boolean hasAuroras = true; private float[] brightnessRamp = null; private SeasonConfig seasonConfig = null; private int minY = 0; @@ -362,6 +369,11 @@ public abstract class WorldType return this; } + public @NotNull Properties withNoAurora() { + this.hasAuroras = false; + return this; + } + public @NotNull Properties brightnessRamp(float[] brightnessRamp) { this.brightnessRamp = brightnessRamp; return this; diff --git a/game/core/src/main/java/net/minecraft/core/world/type/WorldTypes.java b/game/core/src/main/java/net/minecraft/core/world/type/WorldTypes.java index 930400073..96ef6c972 100644 --- a/game/core/src/main/java/net/minecraft/core/world/type/WorldTypes.java +++ b/game/core/src/main/java/net/minecraft/core/world/type/WorldTypes.java @@ -34,6 +34,7 @@ public abstract class WorldTypes { new WorldTypeNether( WorldTypeNether.defaultProperties("worldType.nether.default") .portalBounds(63, 255) + .withNoAurora() .withTags(WorldTypeTags.NETHER, WorldTypeTags.HOT, WorldTypeTags.BREAKS_COMPASS, WorldTypeTags.BREAKS_TIMEPIECES) ) ); @@ -43,6 +44,7 @@ public abstract class WorldTypes { WorldTypeNether.defaultProperties("worldType.nether.skyblock") .bounds(0, 127, 0) .withNoFloor() + .withNoAurora() .withTags(WorldTypeTags.NETHER, WorldTypeTags.HOT, WorldTypeTags.BREAKS_COMPASS, WorldTypeTags.BREAKS_TIMEPIECES) ) ); @@ -63,6 +65,7 @@ public abstract class WorldTypes { .allowRespawn() .bounds(0, 31, 0) .portalBounds(0, 255) + .withNoAurora() .seasonConfig(SeasonConfig.builder() .withSingleSeason(Seasons.OVERWORLD_SUMMER) .build() @@ -95,6 +98,7 @@ public abstract class WorldTypes { .seasonConfig(null) .bounds(0, 127, 64) .portalBounds(0, 255) + .withNoAurora() .withTags(WorldTypeTags.OVERWORLD, WorldTypeTags.RETRO) ) ); @@ -133,6 +137,7 @@ public abstract class WorldTypes { .allowRespawn() .bounds(0, 127, 64) .portalBounds(0, 255) + .withNoAurora() .defaultWeather(Weathers.OVERWORLD_HELL_CLEAR) .withTags(WorldTypeTags.OVERWORLD, WorldTypeTags.HOT) ) @@ -155,6 +160,7 @@ public abstract class WorldTypes { ) .bounds(0, 127, 64) .portalBounds(0, 255) + .withNoAurora() .withTags(WorldTypeTags.OVERWORLD) ) ); @@ -174,6 +180,7 @@ public abstract class WorldTypes { .seasonConfig(null) .bounds(0, 127, 64) .portalBounds(0, 255) + .withNoAurora() .withTags(WorldTypeTags.OVERWORLD, WorldTypeTags.RETRO) ) ); @@ -184,6 +191,7 @@ public abstract class WorldTypes { .seasonConfig(null) .bounds(0, 127, 64) .portalBounds(0, 255) + .withNoAurora() .withTags(WorldTypeTags.OVERWORLD, WorldTypeTags.RETRO) ) ); @@ -202,6 +210,7 @@ public abstract class WorldTypes { new WorldTypeOverworldB173( WorldTypeOverworld.defaultProperties("worldType.overworld.beta_173") .bounds(0, 127, 64) + .withNoAurora() .withTags(WorldTypeTags.OVERWORLD) ) ); @@ -212,6 +221,7 @@ public abstract class WorldTypes { .brightnessRamp(WorldTypeEmpty.createLightRamp()) .bounds(0, 255, 0) .withNoFloor() + .withNoAurora() .allowRespawn() ) ); @@ -222,6 +232,7 @@ public abstract class WorldTypes { .brightnessRamp(WorldTypeDebug.createLightRamp()) .bounds(0, 255, 0) .withNoFloor() + .withNoAurora() .allowRespawn() ) );