diff --git a/game/client/src/main/java/net/minecraft/client/gui/ScreenPause.java b/game/client/src/main/java/net/minecraft/client/gui/ScreenPause.java index 9b29bfa62..6ab393bd4 100644 --- a/game/client/src/main/java/net/minecraft/client/gui/ScreenPause.java +++ b/game/client/src/main/java/net/minecraft/client/gui/ScreenPause.java @@ -75,6 +75,7 @@ public class ScreenPause extends Screen { //Cancel A press so you dont jump because you hold the jump button if (this.mc.inputType == InputType.CONTROLLER) this.mc.controllerInput.buttonA.cancelButtonPress(); + else this.mc.playerController.cancelLeftClick = true; break; case 5: diff --git a/game/client/src/main/java/net/minecraft/client/gui/ScreenPhotoMode.java b/game/client/src/main/java/net/minecraft/client/gui/ScreenPhotoMode.java index 0505bb983..47d735ad8 100644 --- a/game/client/src/main/java/net/minecraft/client/gui/ScreenPhotoMode.java +++ b/game/client/src/main/java/net/minecraft/client/gui/ScreenPhotoMode.java @@ -38,6 +38,9 @@ public class ScreenPhotoMode extends Screen { private ButtonElement buttonShowPlayer; private final long originalTOD; + + private boolean didReload = false; + private long desiredTOD = -1; private long desiredDay = -1; private int desiredSeason = -1; @@ -191,6 +194,9 @@ public class ScreenPhotoMode extends Screen { this.mc.setRenderer(this.previousRenderer); this.mc.currentWorld.updateSeasonAndLight(); + if (this.didReload) { + this.mc.renderGlobal.allChanged(); + } } @Override @@ -213,6 +219,8 @@ public class ScreenPhotoMode extends Screen { this.mc.currentWorld.setWorldTimeUpdateTicks(this.desiredDay + this.desiredTOD); this.mc.currentWorld.updateSeasonAndLight(); + this.mc.renderGlobal.allChanged(); + this.didReload = true; } else if (button == this.buttonTakeScreenshot) { this.shouldScreenshot = true; } else if (button == this.buttonExit) { diff --git a/game/client/src/main/java/net/minecraft/client/player/controller/PlayerController.java b/game/client/src/main/java/net/minecraft/client/player/controller/PlayerController.java index 242c1cace..2c6b86736 100644 --- a/game/client/src/main/java/net/minecraft/client/player/controller/PlayerController.java +++ b/game/client/src/main/java/net/minecraft/client/player/controller/PlayerController.java @@ -6,7 +6,10 @@ import net.minecraft.client.gui.hud.HudIngame; import net.minecraft.client.render.RenderGlobal; import net.minecraft.core.InventoryAction; import net.minecraft.core.block.Block; +import net.minecraft.core.block.BlockLogic; import net.minecraft.core.block.BlockLogicDoor; +import net.minecraft.core.block.BlockLogicFenceGate; +import net.minecraft.core.block.BlockLogicTrapDoor; import net.minecraft.core.block.Blocks; import net.minecraft.core.block.entity.TileEntity; import net.minecraft.core.entity.Entity; @@ -30,6 +33,7 @@ public abstract class PlayerController { protected final @NotNull Minecraft mc; + public boolean cancelLeftClick = false; protected float destroyProgress; protected float oDestroyProgress; protected int soundDelay; @@ -47,6 +51,7 @@ public abstract class PlayerController { * {@code repeat} is false when the mouse was clicked this frame. */ public void startDestroyBlock(final @NotNull TilePosc tilePos, final @NotNull Side side, final double xHit, final double yHit, final boolean repeat) { + cancelLeftClick = false; final @NotNull World world = Objects.requireNonNull(this.mc.currentWorld); final @NotNull Player player = Objects.requireNonNull(this.mc.thePlayer); @@ -115,7 +120,8 @@ public abstract class PlayerController { //Regular Mining if (!this.isMiningBlock(tilePos)) { this.sendStartDigPacket(tilePos, side, xHit, yHit); - if (world.getBlockLogic(tilePos, BlockLogicDoor.class) == null) { // "Fixes" issue where at certain angles you can spam hit the top and bottom blocks of the door. + BlockLogic b = world.getBlockLogic(tilePos, BlockLogic.class); + if (!(b instanceof BlockLogicDoor)) { // "Fixes" issue where at certain angles you can spam hit the top and bottom blocks of the door. this.hitBlock(tilePos, side, xHit, yHit); } this.destroyProgress = 0.0f; @@ -207,6 +213,10 @@ public abstract class PlayerController { } protected void hitBlock(final @NotNull TilePosc tilePos, final @NotNull Side side, final double xHit, final double yHit) { + if (cancelLeftClick) { + cancelLeftClick = false; + return; + } final @NotNull World world = Objects.requireNonNull(this.mc.currentWorld); final @NotNull Player player = Objects.requireNonNull(this.mc.thePlayer); diff --git a/game/client/src/main/java/net/minecraft/client/render/particle/Particle.java b/game/client/src/main/java/net/minecraft/client/render/particle/Particle.java index f2cceb4e8..c503a9ee8 100644 --- a/game/client/src/main/java/net/minecraft/client/render/particle/Particle.java +++ b/game/client/src/main/java/net/minecraft/client/render/particle/Particle.java @@ -7,6 +7,7 @@ import net.minecraft.client.render.tessellator.TessellatorParticle; import net.minecraft.client.render.texture.stitcher.IconCoordinate; import net.minecraft.core.Global; import net.minecraft.core.block.Block; +import net.minecraft.core.block.BlockLogicMesh; import net.minecraft.core.util.helper.Direction; import net.minecraft.core.util.helper.LightIndexHelper; import net.minecraft.core.util.helper.MathHelper; @@ -268,7 +269,7 @@ public class Particle { } public boolean collidesWithBlock(@NotNull Block block, int data) { - return true; + return !Block.hasLogicClass(block, BlockLogicMesh.class); } /** diff --git a/game/core/src/main/java/net/minecraft/core/block/BlockLogicSand.java b/game/core/src/main/java/net/minecraft/core/block/BlockLogicFallingBlock.java similarity index 91% rename from game/core/src/main/java/net/minecraft/core/block/BlockLogicSand.java rename to game/core/src/main/java/net/minecraft/core/block/BlockLogicFallingBlock.java index d01bd9f25..5679e279a 100644 --- a/game/core/src/main/java/net/minecraft/core/block/BlockLogicSand.java +++ b/game/core/src/main/java/net/minecraft/core/block/BlockLogicFallingBlock.java @@ -1,5 +1,6 @@ package net.minecraft.core.block; +import net.minecraft.core.block.material.Material; import net.minecraft.core.block.material.Materials; import net.minecraft.core.block.tag.BlockTags; import net.minecraft.core.entity.EntityFallingBlock; @@ -10,11 +11,11 @@ import org.jetbrains.annotations.NotNull; import java.util.Random; -public class BlockLogicSand extends BlockLogic { +public class BlockLogicFallingBlock extends BlockLogic { public static boolean fallInstantly = false; - public BlockLogicSand(@NotNull Block block) { - super(block, Materials.SAND); + public BlockLogicFallingBlock(@NotNull Block block, @NotNull Material material) { + super(block, material); } @Override diff --git a/game/core/src/main/java/net/minecraft/core/block/BlockLogicFarmland.java b/game/core/src/main/java/net/minecraft/core/block/BlockLogicFarmland.java index 2f534c8e2..8d204d005 100644 --- a/game/core/src/main/java/net/minecraft/core/block/BlockLogicFarmland.java +++ b/game/core/src/main/java/net/minecraft/core/block/BlockLogicFarmland.java @@ -206,6 +206,16 @@ public class BlockLogicFarmland return false; } + @Override + public boolean isEquivalent(@NotNull World world, @NotNull TilePosc thisPos, @NotNull TilePosc thatPos) { + final @Nullable Block bBlock = world.getBlockType(thatPos); + + final int thisMeta = world.getBlockData(thisPos); + final int otherMeta = world.getBlockData(thatPos); + + return this.block == bBlock && isWet(thisMeta) == isWet(otherMeta); + } + @Override public void updateTick(final @NotNull World world, final @NotNull TilePosc tilePos, final @NotNull Random rand, final boolean isRandomTick) { if (rand.nextInt(2) != 0) { diff --git a/game/core/src/main/java/net/minecraft/core/block/BlockLogicGravel.java b/game/core/src/main/java/net/minecraft/core/block/BlockLogicGravel.java index b53396170..c3236c0f2 100644 --- a/game/core/src/main/java/net/minecraft/core/block/BlockLogicGravel.java +++ b/game/core/src/main/java/net/minecraft/core/block/BlockLogicGravel.java @@ -1,6 +1,8 @@ package net.minecraft.core.block; import net.minecraft.core.block.entity.TileEntity; +import net.minecraft.core.block.material.Material; +import net.minecraft.core.block.material.Materials; import net.minecraft.core.enums.EnumDropCause; import net.minecraft.core.item.Items; import net.minecraft.core.item.ItemStack; @@ -8,12 +10,13 @@ import net.minecraft.core.world.World; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; -public class BlockLogicGravel extends BlockLogicSand +public class BlockLogicGravel extends BlockLogicFallingBlock { public BlockLogicGravel(@NotNull Block block) { - super(block); + super(block, Materials.SAND); + } @Override diff --git a/game/core/src/main/java/net/minecraft/core/block/BlockLogicMatcher.java b/game/core/src/main/java/net/minecraft/core/block/BlockLogicMatcher.java index b1ce19e16..c1243b958 100644 --- a/game/core/src/main/java/net/minecraft/core/block/BlockLogicMatcher.java +++ b/game/core/src/main/java/net/minecraft/core/block/BlockLogicMatcher.java @@ -22,7 +22,7 @@ public class BlockLogicMatcher extends BlockLogicAxisAligned { public final boolean isActive; public BlockLogicMatcher(@NotNull Block block, boolean isActive) { - super(block, Materials.STONE); + super(block, Materials.NETHERRACK); this.isActive = isActive; } diff --git a/game/core/src/main/java/net/minecraft/core/block/BlockLogicStatue.java b/game/core/src/main/java/net/minecraft/core/block/BlockLogicStatue.java index 3b424bbb8..b49460db6 100644 --- a/game/core/src/main/java/net/minecraft/core/block/BlockLogicStatue.java +++ b/game/core/src/main/java/net/minecraft/core/block/BlockLogicStatue.java @@ -41,6 +41,7 @@ public class BlockLogicStatue extends BlockLogic { final float bottom = this.isBottom ? 0.0f : -1.0f; final float top = this.isBottom ? 2.0f : 1.0f; setBlockBounds(0.0f, bottom, 0.0f, 1.0f, top, 1.0f); + } @Override diff --git a/game/core/src/main/java/net/minecraft/core/block/BlockLogicThermalVent.java b/game/core/src/main/java/net/minecraft/core/block/BlockLogicThermalVent.java index fa438a8f0..d2e5d9fa9 100644 --- a/game/core/src/main/java/net/minecraft/core/block/BlockLogicThermalVent.java +++ b/game/core/src/main/java/net/minecraft/core/block/BlockLogicThermalVent.java @@ -21,7 +21,7 @@ public class BlockLogicThermalVent public static int VENTING_STATE = 4; public BlockLogicThermalVent(final @NotNull Block block) { - super(block, Materials.STONE); + super(block, Materials.BASALT); block.setTicking(true); } diff --git a/game/core/src/main/java/net/minecraft/core/block/Blocks.java b/game/core/src/main/java/net/minecraft/core/block/Blocks.java index 0b86bfc75..3397ae039 100644 --- a/game/core/src/main/java/net/minecraft/core/block/Blocks.java +++ b/game/core/src/main/java/net/minecraft/core/block/Blocks.java @@ -84,13 +84,13 @@ public final class Blocks { public static final @NotNull Block COBBLE_PERMAFROST = register("cobble.permafrost", "minecraft:block/cobble_permafrost", 15, (b) -> new BlockLogicCobble(b, Materials.PERMAFROST, () -> Blocks.GRAVEL)) .withSound(BlockSounds.PERMAFROST).withHardness(2.0F).withBlastResistance(10F) .withTags(BlockTags.MINEABLE_BY_PICKAXE, BlockTags.CHAINLINK_FENCES_CONNECT); - public static final @NotNull Block COBBLE_BASALT_MOSSY = register("cobble.basalt.mossy", "minecraft:block/cobble_basalt_mossy", 16, (b) -> new BlockLogicCobble(b, Materials.STONE, () -> Blocks.GRAVEL)) + public static final @NotNull Block COBBLE_BASALT_MOSSY = register("cobble.basalt.mossy", "minecraft:block/cobble_basalt_mossy", 16, (b) -> new BlockLogicCobble(b, Materials.BASALT, () -> Blocks.GRAVEL)) .withSound(BlockSounds.STONE).withHardness(2.0F).withBlastResistance(10F) .withTags(BlockTags.MINEABLE_BY_PICKAXE, BlockTags.CHAINLINK_FENCES_CONNECT, BlockTags.GROWS_FLOWERS); - public static final @NotNull Block COBBLE_LIMESTONE_MOSSY = register("cobble.limestone.mossy", "minecraft:block/cobble_limestone_mossy", 17, (b) -> new BlockLogicCobble(b, Materials.STONE, () -> Blocks.GRAVEL)) + public static final @NotNull Block COBBLE_LIMESTONE_MOSSY = register("cobble.limestone.mossy", "minecraft:block/cobble_limestone_mossy", 17, (b) -> new BlockLogicCobble(b, Materials.LIMESTONE, () -> Blocks.GRAVEL)) .withSound(BlockSounds.STONE).withHardness(2.0F).withBlastResistance(10F) .withTags(BlockTags.MINEABLE_BY_PICKAXE, BlockTags.CHAINLINK_FENCES_CONNECT, BlockTags.GROWS_FLOWERS); - public static final @NotNull Block COBBLE_GRANITE_MOSSY = register("cobble.granite.mossy", "minecraft:block/cobble_granite_mossy", 18, (b) -> new BlockLogicCobble(b, Materials.STONE, () -> Blocks.GRAVEL)) + public static final @NotNull Block COBBLE_GRANITE_MOSSY = register("cobble.granite.mossy", "minecraft:block/cobble_granite_mossy", 18, (b) -> new BlockLogicCobble(b, Materials.GRANITE, () -> Blocks.GRAVEL)) .withSound(BlockSounds.STONE).withHardness(2.0F).withBlastResistance(10F) .withTags(BlockTags.MINEABLE_BY_PICKAXE, BlockTags.CHAINLINK_FENCES_CONNECT, BlockTags.GROWS_FLOWERS); @@ -408,12 +408,13 @@ public final class Blocks { .withSound(BlockSounds.STONE).withHardness(1.5F).withBlastResistance(10F) .withTags(BlockTags.MINEABLE_BY_PICKAXE, BlockTags.CHAINLINK_FENCES_CONNECT, BlockTags.GROWS_FLOWERS, BlockTags.GROWS_SUGAR_CANE); - public static final @NotNull Block SAND = register("sand", "minecraft:block/sand", 250, BlockLogicSand::new) + public static final @NotNull Block SAND = register("sand", "minecraft:block/sand", 250, b -> new BlockLogicFallingBlock(b, Materials.SAND)) .withSound(BlockSounds.SAND).withHardness(0.5F) .withTags(BlockTags.MINEABLE_BY_SHOVEL, BlockTags.GROWS_SUGAR_CANE, BlockTags.GROWS_CACTI, BlockTags.CAVES_CUT_THROUGH, BlockTags.FIREFLIES_CAN_SPAWN); public static final @NotNull Block GRAVEL = register("gravel", "minecraft:block/gravel", 251, BlockLogicGravel::new) .withSound(BlockSounds.GRAVEL).withHardness(0.6F) - .withTags(BlockTags.MINEABLE_BY_SHOVEL); + .withTags(BlockTags.MINEABLE_BY_SHOVEL) + .withOverrideColor(MaterialColor.stone); public static final Block BRIMSAND = register("brimsand", "minecraft:block/brimsand", 252, (b) -> new BlockLogic(b, Materials.SAND)) .withSound(BlockSounds.SAND).withHardness(0.7F) .withTags(BlockTags.MINEABLE_BY_SHOVEL, BlockTags.CAVES_CUT_THROUGH, BlockTags.NETHER_MOBS_SPAWN, BlockTags.NETHER_SURFACE_BLOCK); @@ -702,7 +703,7 @@ public final class Blocks { public static final @NotNull Block ORE_NETHERCOAL_BASALT = register("ore.nethercoal.basalt", "minecraft:block/ore_nethercoal_basalt", 421, (b) -> new BlockLogicOreNetherCoal(b, Blocks.COBBLE_BASALT, Materials.BASALT)) .withSound(BlockSounds.STONE).withHardness(3F).withBlastResistance(5F).withLightEmission(0.625F) .withTags(BlockTags.MINEABLE_BY_PICKAXE, BlockTags.NETHER_MOBS_SPAWN); - public static final @NotNull Block ORE_NETHERCOAL_GLOOMSTONE = register("ore.nethercoal.gloomstone", "minecraft:block/ore_nethercoal_gloomstone", 422, (b) -> new BlockLogicOreNetherCoal(b, Blocks.COBBLE_GLOOMSTONE, Materials.BASALT)) + public static final @NotNull Block ORE_NETHERCOAL_GLOOMSTONE = register("ore.nethercoal.gloomstone", "minecraft:block/ore_nethercoal_gloomstone", 422, (b) -> new BlockLogicOreNetherCoal(b, Blocks.COBBLE_GLOOMSTONE, Materials.GLOOMSTONE)) .withSound(BlockSounds.STONE).withHardness(3F).withBlastResistance(10F).withLightEmission(0.625F) .withTags(BlockTags.MINEABLE_BY_PICKAXE, BlockTags.NETHER_MOBS_SPAWN); @@ -941,10 +942,12 @@ public final class Blocks { public static final @NotNull Block MOBSPAWNER = register("mobspawner", "minecraft:block/mobspawner", 640, BlockLogicMobSpawner::new) .withSound(BlockSounds.METAL).withHardness(5F).withImmovableFlagSet() - .withTags(BlockTags.MINEABLE_BY_PICKAXE); + .withTags(BlockTags.MINEABLE_BY_PICKAXE) + .withOverrideColor(MaterialColor.lapis); public static final @NotNull Block MOBSPAWNER_DEACTIVATED = register("mobspawner.deactivated", "minecraft:block/mobspawner_deactivated", 641, BlockLogicMobSpawnerDeactivated::new) .withSound(BlockSounds.METAL).withHardness(5F) - .withTags(BlockTags.MINEABLE_BY_PICKAXE); + .withTags(BlockTags.MINEABLE_BY_PICKAXE) + .withOverrideColor(MaterialColor.lapis); public static final @NotNull Block WORKBENCH = register("workbench", "minecraft:block/workbench", 650, BlockLogicWorkbench::new) .withSound(BlockSounds.WOOD).withHardness(2.5F) @@ -1109,10 +1112,10 @@ public final class Blocks { .withTags(BlockTags.MINEABLE_BY_PICKAXE); public static final @NotNull Block SOULSAND = register("soulsand", "minecraft:block/soulsand", 810, BlockLogicSoulSand::new) - .withSound(BlockSounds.SAND).withHardness(0.5F).withOverrideColor(MaterialColor.paintedBrown) + .withSound(BlockSounds.SAND).withHardness(0.5F).withOverrideColor(MaterialColor.soulsand) .withTags(BlockTags.MINEABLE_BY_SHOVEL, BlockTags.CAVES_CUT_THROUGH, BlockTags.NETHER_MOBS_SPAWN, BlockTags.INFINITE_BURN_COLD); public static final @NotNull Block SOULSCHIST = register("soulschist", "minecraft:block/soulschist", 811, (b) -> new BlockLogicCobble(b, Materials.STONE, () -> Blocks.SOULSAND)) - .withSound(BlockSounds.STONE).withHardness(2.0F).withBlastResistance(10F).withOverrideColor(MaterialColor.paintedBrown) + .withSound(BlockSounds.STONE).withHardness(2.0F).withBlastResistance(10F).withOverrideColor(MaterialColor.soulsand) .withTags(BlockTags.MINEABLE_BY_PICKAXE, BlockTags.CHAINLINK_FENCES_CONNECT, BlockTags.NETHER_MOBS_SPAWN); public static final @NotNull Block GLOWSTONE = register("glowstone", "minecraft:block/glowstone", 820, (b) -> new BlockLogicGlowStone(b, Materials.STONE)) @@ -1120,20 +1123,25 @@ public final class Blocks { .withTags(BlockTags.MINEABLE_BY_PICKAXE); public static final Block RUBYGLASS = register("rubyglass", "minecraft:block/rubyglass", 821, (b) -> new BlockLogicRubyglass(b)) .withSound(BlockSounds.GLASS).withHardness(0.3F) - .withTags(BlockTags.MINEABLE_BY_PICKAXE); + .withTags(BlockTags.MINEABLE_BY_PICKAXE) + .withOverrideColor(MaterialColor.rubyglass); public static final Block RUBYGLASS_PURE = register("rubyglass.pure", "minecraft:block/rubyglass_pure", 822, (b) -> new BlockLogicTransparent(b, Materials.STONE)) .withSound(BlockSounds.GLASS).withHardness(0.3F) - .withTags(BlockTags.MINEABLE_BY_PICKAXE); + .withTags(BlockTags.MINEABLE_BY_PICKAXE) + .withOverrideColor(MaterialColor.rubyglass); public static final Block RUBYGLASS_SPROUT = register("rubyglass.growth", "minecraft:block/rubyglass_growth", 823, (b) -> new BlockLogicRubyglassGrowth(b)) .withSound(BlockSounds.GLASS).withDisabledNeighborNotifyOnMetadataChange().withLightEmission(0.8F) - .withTags(BlockTags.MINEABLE_BY_PICKAXE); + .withTags(BlockTags.MINEABLE_BY_PICKAXE) + .withOverrideColor(MaterialColor.rubyglass); public static final Block RUBYGLASS_CIRCUIT = register("rubyglass.circuit", "minecraft:block/rubyglass_circuit", 824, (b) -> new BlockLogic(b, Materials.STONE)) .withSound(BlockSounds.STONE).withDisabledNeighborNotifyOnMetadataChange().withHardness(0.5F) - .withTags(BlockTags.MINEABLE_BY_PICKAXE, BlockTags.INFINITE_BURN, BlockTags.CAVES_CUT_THROUGH, BlockTags.NETHER_MOBS_SPAWN); + .withTags(BlockTags.MINEABLE_BY_PICKAXE, BlockTags.INFINITE_BURN, BlockTags.CAVES_CUT_THROUGH, BlockTags.NETHER_MOBS_SPAWN) + .withOverrideColor(MaterialColor.rubyglass); public static final Block RUBYGLASS_BUD = register("rubyglass.bud", "minecraft:block/rubyglass_bud", 825, (b) -> new BlockLogicRubyglassCrop(b)) .withSound(BlockSounds.GLASS).withDisabledNeighborNotifyOnMetadataChange().withLightEmission(0.8F) - .withTags(BlockTags.MINEABLE_BY_PICKAXE, BlockTags.NOT_IN_CREATIVE_MENU); + .withTags(BlockTags.MINEABLE_BY_PICKAXE, BlockTags.NOT_IN_CREATIVE_MENU) + .withOverrideColor(MaterialColor.rubyglass); public static final @NotNull Block PORTAL_NETHER = register("portal.nether", "minecraft:block/portal_nether", 830, (BlockLogicSupplier) b -> new BlockLogicPortal(b, Dimension.NETHER, Blocks.OBSIDIAN, Blocks.FIRE)) .withSound(BlockSounds.GLASS).withHardness(-1F).withLightEmission(0.75F).withOverrideColor(MaterialColor.paintedPurple).withDisabledStats() @@ -1276,34 +1284,34 @@ public final class Blocks { public static final @NotNull Block STATUE_STONE_UPPER = register("statue.stone.upper", "minecraft:block/statue_stone_upper", 1011, (BlockLogicSupplier) b -> new BlockLogicStatue(b, Materials.STONE, false, () -> Items.STATUE_STONE)) .withSound(BlockSounds.STONE).withHardness(1.5F) .withTags(BlockTags.MINEABLE_BY_PICKAXE, BlockTags.NOT_IN_CREATIVE_MENU); - public static final @NotNull Block STATUE_BASALT_LOWER = register("statue.basalt.lower", "minecraft:block/statue_basalt_lower", 1012, (BlockLogicSupplier) b -> new BlockLogicStatue(b, Materials.STONE, true, () -> Items.STATUE_BASALT)) + public static final @NotNull Block STATUE_BASALT_LOWER = register("statue.basalt.lower", "minecraft:block/statue_basalt_lower", 1012, (BlockLogicSupplier) b -> new BlockLogicStatue(b, Materials.BASALT, true, () -> Items.STATUE_BASALT)) .withSound(BlockSounds.STONE).withHardness(1.5F) .withTags(BlockTags.MINEABLE_BY_PICKAXE, BlockTags.NOT_IN_CREATIVE_MENU); - public static final @NotNull Block STATUE_BASALT_UPPER = register("statue.basalt.upper", "minecraft:block/statue_basalt_upper", 1013, (BlockLogicSupplier) b -> new BlockLogicStatue(b, Materials.STONE, false, () -> Items.STATUE_BASALT)) + public static final @NotNull Block STATUE_BASALT_UPPER = register("statue.basalt.upper", "minecraft:block/statue_basalt_upper", 1013, (BlockLogicSupplier) b -> new BlockLogicStatue(b, Materials.BASALT, false, () -> Items.STATUE_BASALT)) .withSound(BlockSounds.STONE).withHardness(1.5F) .withTags(BlockTags.MINEABLE_BY_PICKAXE, BlockTags.NOT_IN_CREATIVE_MENU); - public static final @NotNull Block STATUE_LIMESTONE_LOWER = register("statue.limestone.lower", "minecraft:block/statue_limestone_lower", 1014, (BlockLogicSupplier) b -> new BlockLogicStatue(b, Materials.STONE, true, () -> Items.STATUE_LIMESTONE)) + public static final @NotNull Block STATUE_LIMESTONE_LOWER = register("statue.limestone.lower", "minecraft:block/statue_limestone_lower", 1014, (BlockLogicSupplier) b -> new BlockLogicStatue(b, Materials.LIMESTONE, true, () -> Items.STATUE_LIMESTONE)) .withSound(BlockSounds.STONE).withHardness(1.5F) .withTags(BlockTags.MINEABLE_BY_PICKAXE, BlockTags.NOT_IN_CREATIVE_MENU); - public static final @NotNull Block STATUE_LIMESTONE_UPPER = register("statue.limestone.upper", "minecraft:block/statue_limestone_upper", 1015, (BlockLogicSupplier) b -> new BlockLogicStatue(b, Materials.STONE, false, () -> Items.STATUE_LIMESTONE)) + public static final @NotNull Block STATUE_LIMESTONE_UPPER = register("statue.limestone.upper", "minecraft:block/statue_limestone_upper", 1015, (BlockLogicSupplier) b -> new BlockLogicStatue(b, Materials.LIMESTONE, false, () -> Items.STATUE_LIMESTONE)) .withSound(BlockSounds.STONE).withHardness(1.5F) .withTags(BlockTags.MINEABLE_BY_PICKAXE, BlockTags.NOT_IN_CREATIVE_MENU); - public static final @NotNull Block STATUE_GRANITE_LOWER = register("statue.granite.lower", "minecraft:block/statue_granite_lower", 1016, (BlockLogicSupplier) b -> new BlockLogicStatue(b, Materials.STONE, true, () -> Items.STATUE_GRANITE)) + public static final @NotNull Block STATUE_GRANITE_LOWER = register("statue.granite.lower", "minecraft:block/statue_granite_lower", 1016, (BlockLogicSupplier) b -> new BlockLogicStatue(b, Materials.GRANITE, true, () -> Items.STATUE_GRANITE)) .withSound(BlockSounds.STONE).withHardness(1.5F) .withTags(BlockTags.MINEABLE_BY_PICKAXE, BlockTags.NOT_IN_CREATIVE_MENU); - public static final @NotNull Block STATUE_GRANITE_UPPER = register("statue.granite.upper", "minecraft:block/statue_granite_upper", 1017, (BlockLogicSupplier) b -> new BlockLogicStatue(b, Materials.STONE, false, () -> Items.STATUE_GRANITE)) + public static final @NotNull Block STATUE_GRANITE_UPPER = register("statue.granite.upper", "minecraft:block/statue_granite_upper", 1017, (BlockLogicSupplier) b -> new BlockLogicStatue(b, Materials.GRANITE, false, () -> Items.STATUE_GRANITE)) .withSound(BlockSounds.STONE).withHardness(1.5F) .withTags(BlockTags.MINEABLE_BY_PICKAXE, BlockTags.NOT_IN_CREATIVE_MENU); - public static final @NotNull Block STATUE_MARBLE_LOWER = register("statue.marble.lower", "minecraft:block/statue_marble_lower", 1018, (BlockLogicSupplier) b -> new BlockLogicStatue(b, Materials.STONE, true, () -> Items.STATUE_MARBLE)) + public static final @NotNull Block STATUE_MARBLE_LOWER = register("statue.marble.lower", "minecraft:block/statue_marble_lower", 1018, (BlockLogicSupplier) b -> new BlockLogicStatue(b, Materials.MARBLE, true, () -> Items.STATUE_MARBLE)) .withSound(BlockSounds.STONE).withHardness(1.5F) .withTags(BlockTags.MINEABLE_BY_PICKAXE, BlockTags.NOT_IN_CREATIVE_MENU); - public static final @NotNull Block STATUE_MARBLE_UPPER = register("statue.marble.upper", "minecraft:block/statue_marble_upper", 1019, (BlockLogicSupplier) b -> new BlockLogicStatue(b, Materials.STONE, false, () -> Items.STATUE_MARBLE)) + public static final @NotNull Block STATUE_MARBLE_UPPER = register("statue.marble.upper", "minecraft:block/statue_marble_upper", 1019, (BlockLogicSupplier) b -> new BlockLogicStatue(b, Materials.MARBLE, false, () -> Items.STATUE_MARBLE)) .withSound(BlockSounds.STONE).withHardness(1.5F) .withTags(BlockTags.MINEABLE_BY_PICKAXE, BlockTags.NOT_IN_CREATIVE_MENU); - public static final @NotNull Block STATUE_PIGMAN_LOWER = register("statue.pigman.lower", "minecraft:block/statue_pigman_lower", 1020, (BlockLogicSupplier) b -> new BlockLogicStatue(b, Materials.STONE, true, () -> Items.STATUE_PIGMAN)) + public static final @NotNull Block STATUE_PIGMAN_LOWER = register("statue.pigman.lower", "minecraft:block/statue_pigman_lower", 1020, (BlockLogicSupplier) b -> new BlockLogicStatue(b, Materials.MARBLE, true, () -> Items.STATUE_PIGMAN)) .withSound(BlockSounds.STONE).withHardness(1.5F) .withTags(BlockTags.MINEABLE_BY_PICKAXE, BlockTags.NOT_IN_CREATIVE_MENU); - public static final @NotNull Block STATUE_PIGMAN_UPPER = register("statue.pigman.upper", "minecraft:block/statue_pigman_upper", 1021, (BlockLogicSupplier) b -> new BlockLogicStatue(b, Materials.STONE, false, () -> Items.STATUE_PIGMAN)) + public static final @NotNull Block STATUE_PIGMAN_UPPER = register("statue.pigman.upper", "minecraft:block/statue_pigman_upper", 1021, (BlockLogicSupplier) b -> new BlockLogicStatue(b, Materials.MARBLE, false, () -> Items.STATUE_PIGMAN)) .withSound(BlockSounds.STONE).withHardness(1.5F) .withTags(BlockTags.MINEABLE_BY_PICKAXE, BlockTags.NOT_IN_CREATIVE_MENU); @@ -1315,7 +1323,8 @@ public final class Blocks { .withTags(BlockTags.BROKEN_BY_FLUIDS, BlockTags.PLACE_OVERWRITES, BlockTags.SHEARS_DO_SILK_TOUCH, BlockTags.PLANTABLE_IN_JAR); public static final Block SOULCATCHER = register("soul_catcher", "minecraft:block/soul_catcher", 1031, BlockLogicSoulcatcher::new) .withSound(BlockSounds.GRAVEL).withHardness(1.0F).withOverrideColor(MaterialColor.sand) - .withTags(BlockTags.BROKEN_BY_FLUIDS, BlockTags.PLACE_OVERWRITES, BlockTags.SHEARS_DO_SILK_TOUCH, BlockTags.PLANTABLE_IN_JAR); + .withTags(BlockTags.BROKEN_BY_FLUIDS, BlockTags.PLACE_OVERWRITES, BlockTags.SHEARS_DO_SILK_TOUCH, BlockTags.PLANTABLE_IN_JAR) + .withOverrideColor(MaterialColor.soulsand); public static final Block GLOOMSTONE = register("gloomstone", "minecraft:block/gloomstone", 1032, (b) -> new BlockLogicStone(b, Blocks.COBBLE_GLOOMSTONE, Materials.GLOOMSTONE)) .withSound(BlockSounds.STONE).withHardness(1.5F).withBlastResistance(10F) diff --git a/game/core/src/main/java/net/minecraft/core/block/material/MaterialColor.java b/game/core/src/main/java/net/minecraft/core/block/material/MaterialColor.java index 9084cebd7..68ee7ddb0 100644 --- a/game/core/src/main/java/net/minecraft/core/block/material/MaterialColor.java +++ b/game/core/src/main/java/net/minecraft/core/block/material/MaterialColor.java @@ -37,7 +37,10 @@ public class MaterialColor { public static final MaterialColor marble = new MaterialColor(18, 0xeaeae0); public static final MaterialColor slate = new MaterialColor(19, 0x6e6b93); public static final MaterialColor netherrack = new MaterialColor(20, 0x6b1013); - public static final MaterialColor gloomstone = new MaterialColor(20, 0x352743); + public static final MaterialColor soulsand; // TODO if this needs to be a unique color than the color pallet *can* be expanded just it'd be a bit of a pain + public static final MaterialColor gloomstone; /*= new MaterialColor(20, 0x352743); */ // TODO if this needs to be a unique color than the color pallet *can* be expanded just it'd be a bit of a pain + public static final MaterialColor rubyglass; // TODO if this needs to be a unique color than the color pallet *can* be expanded just it'd be a bit of a pain + public static final MaterialColor ash; // TODO if this needs to be a unique color than the color pallet *can* be expanded just it'd be a bit of a pain public static final MaterialColor brick = new MaterialColor(21, 0x7c4536); // <<<<< Stone Colors pallet >>>>> @@ -83,6 +86,14 @@ public class MaterialColor { public static final MaterialColor paintedRed = new MaterialColor(62, 0xed33434); public static final MaterialColor paintedBlack = new MaterialColor(63, 0x020202); // <<<<< Painted Colors pallet >>>>> + + static { + soulsand = paintedBrown; + gloomstone = paintedPurple; + rubyglass = paintedRed; + ash = paintedGrey; + } + private static final Int2IntMap blockIdColorIndexMap = new Int2IntOpenHashMap(); private final int col; public final int id; diff --git a/game/core/src/main/java/net/minecraft/core/block/material/Materials.java b/game/core/src/main/java/net/minecraft/core/block/material/Materials.java index db95717ac..b7cf31eeb 100644 --- a/game/core/src/main/java/net/minecraft/core/block/material/Materials.java +++ b/game/core/src/main/java/net/minecraft/core/block/material/Materials.java @@ -34,8 +34,8 @@ public final class Materials { public static final @NotNull Material ICE = new Material(MaterialColor.ice).notSolidBlocking(); public static final @NotNull Material TOP_SNOW = new MaterialDecoration(MaterialColor.snow).replaceable().notSolidBlocking().notAlwaysDestroyable().destroyOnPush(); public static final @NotNull Material SNOW = new Material(MaterialColor.snow).notAlwaysDestroyable(); - public static final @NotNull Material TOP_ASH = new MaterialDecoration(MaterialColor.snow).replaceable().notSolidBlocking().notAlwaysDestroyable().destroyOnPush(); - public static final @NotNull Material ASH = new Material(MaterialColor.snow).notAlwaysDestroyable(); + public static final @NotNull Material TOP_ASH = new MaterialDecoration(MaterialColor.ash).replaceable().notSolidBlocking().notAlwaysDestroyable().destroyOnPush(); + public static final @NotNull Material ASH = new Material(MaterialColor.ash).notAlwaysDestroyable(); public static final @NotNull Material CACTUS = new Material(MaterialColor.plant).notSolidBlocking().destroyOnPush(); public static final @NotNull Material CLAY = new Material(MaterialColor.clay); public static final @NotNull Material VEGETABLE = new Material(MaterialColor.plant).destroyOnPush(); diff --git a/game/core/src/main/java/net/minecraft/core/entity/EntityFallingBlock.java b/game/core/src/main/java/net/minecraft/core/entity/EntityFallingBlock.java index 5bc9423c0..d16e36dfc 100644 --- a/game/core/src/main/java/net/minecraft/core/entity/EntityFallingBlock.java +++ b/game/core/src/main/java/net/minecraft/core/entity/EntityFallingBlock.java @@ -3,7 +3,6 @@ package net.minecraft.core.entity; import com.mojang.nbt.tags.CompoundTag; import net.minecraft.core.Global; import net.minecraft.core.block.Block; -import net.minecraft.core.block.BlockLogicSand; import net.minecraft.core.block.Blocks; import net.minecraft.core.block.entity.TileEntity; import net.minecraft.core.block.entity.TileEntityDispatcher; diff --git a/game/core/src/main/java/net/minecraft/core/entity/animal/MobChicken.java b/game/core/src/main/java/net/minecraft/core/entity/animal/MobChicken.java index 4f6cef628..e6fa0a4e0 100644 --- a/game/core/src/main/java/net/minecraft/core/entity/animal/MobChicken.java +++ b/game/core/src/main/java/net/minecraft/core/entity/animal/MobChicken.java @@ -17,8 +17,8 @@ import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; public class MobChicken - extends MobAnimal - implements AgedMob { + extends MobAnimal { +// implements AgedMob { public float flap; public float flapSpeed; public float oFlapSpeed; @@ -26,7 +26,7 @@ public class MobChicken public float flapping; public int eggTimer; public int featherTimer; - private final @NotNull MobAge age; +// private final @NotNull MobAge age; public MobChicken(final World world) { super(world); @@ -38,13 +38,13 @@ public class MobChicken this.eggTimer = this.random.nextInt(6000) + 6000; this.featherTimer = this.random.nextInt(3000) + 3000; this.mobDrops.add(new WeightedRandomLootObject(Items.FEATHER_CHICKEN.getDefaultStack(), 0, 2)); - this.age = MobAge.newRandom(this, MobAge.YEAR_LENGTH_DAYS * 3, 14, (int) (MobAge.YEAR_LENGTH_DAYS * 2.5f)); +// this.age = MobAge.newRandom(this, MobAge.YEAR_LENGTH_DAYS * 3, 14, (int) (MobAge.YEAR_LENGTH_DAYS * 2.5f)); } - @Override - public @NotNull MobAge getMobAge() { - return this.age; - } +// @Override +// public @NotNull MobAge getMobAge() { +// return this.age; +// } @Override public int getMaxHealth() { @@ -81,7 +81,7 @@ public class MobChicken this.featherTimer = this.random.nextInt(3000) + 3000; } - this.getMobAge().tick(this.world); +// this.getMobAge().tick(this.world); } @Override @@ -116,14 +116,14 @@ public class MobChicken public void readAdditionalSaveData(@NotNull final CompoundTag tag) { super.readAdditionalSaveData(tag); - this.age.readTag(tag); +// this.age.readTag(tag); } @Override public void addAdditionalSaveData(@NotNull final CompoundTag tag) { super.addAdditionalSaveData(tag); - this.age.writeTag(tag); +// this.age.writeTag(tag); } @Override diff --git a/game/core/src/main/java/net/minecraft/core/entity/animal/MobCow.java b/game/core/src/main/java/net/minecraft/core/entity/animal/MobCow.java index 7932cf40f..7ea0ed3d0 100644 --- a/game/core/src/main/java/net/minecraft/core/entity/animal/MobCow.java +++ b/game/core/src/main/java/net/minecraft/core/entity/animal/MobCow.java @@ -14,9 +14,9 @@ import org.jetbrains.annotations.NotNull; public class MobCow extends MobAnimal - implements AgedMob +// implements AgedMob { - private final @NotNull MobAge age; +// private final @NotNull MobAge age; public MobCow(World world) { @@ -24,27 +24,27 @@ public class MobCow setTextureIdentifier("minecraft", "cow"); setSize(0.9F, 1.3F); mobDrops.add(new WeightedRandomLootObject(Items.LEATHER.getDefaultStack(), 1, 5)); - this.age = MobAge.newRandom(this, MobAge.YEAR_LENGTH_DAYS * 5, 14, MobAge.YEAR_LENGTH_DAYS * 4); +// this.age = MobAge.newRandom(this, MobAge.YEAR_LENGTH_DAYS * 5, 14, MobAge.YEAR_LENGTH_DAYS * 4); } @Override public void onLivingUpdate() { super.onLivingUpdate(); - this.getMobAge().tick(this.world); +// this.getMobAge().tick(this.world); } - @Override - public @NotNull MobAge getMobAge() { - return this.age; - } +// @Override +// public @NotNull MobAge getMobAge() { +// return this.age; +// } @Override public void addAdditionalSaveData(@NotNull CompoundTag tag) { super.addAdditionalSaveData(tag); - this.age.writeTag(tag); +// this.age.writeTag(tag); } @Override @@ -52,7 +52,7 @@ public class MobCow { super.readAdditionalSaveData(tag); - this.age.readTag(tag); +// this.age.readTag(tag); } @Override 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 aa14a680d..bb79278e4 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 @@ -22,9 +22,9 @@ import java.util.ArrayList; import java.util.List; public class MobDeer - extends MobAnimal - implements AgedMob { - private final @NotNull MobAge age; + extends MobAnimal { +// implements AgedMob { +// private final @NotNull MobAge age; public @NotNull BrainState brainState = new RoamingBrainState(this); public List burningMobDrops = new ArrayList<>(); @@ -36,7 +36,7 @@ public class MobDeer this.moveSpeed = 0.8F; this.mobDrops.add(new WeightedRandomLootObject(Items.FOOD_VENISON_RAW.getDefaultStack(), 1, 2)); this.burningMobDrops.add(new WeightedRandomLootObject(Items.FOOD_VENISON_COOKED.getDefaultStack(), 1, 2)); - this.age = MobAge.newRandom(this, MobAge.YEAR_LENGTH_DAYS * 5, 14, MobAge.YEAR_LENGTH_DAYS * 4); +// this.age = MobAge.newRandom(this, MobAge.YEAR_LENGTH_DAYS * 5, 14, MobAge.YEAR_LENGTH_DAYS * 4); this.jumpHeight = 0.5D; this.brainState.init(); } @@ -44,7 +44,7 @@ public class MobDeer @Override public void onLivingUpdate() { super.onLivingUpdate(); - this.getMobAge().tick(this.world); +// this.getMobAge().tick(this.world); } @Override @@ -118,15 +118,15 @@ public class MobDeer this.pathToEntity = this.world.getEntityPathToTilePos(this, new TilePos(safePoint), 16F); } - @Override - public @NotNull MobAge getMobAge() { - return this.age; - } +// @Override +// public @NotNull MobAge getMobAge() { +// return this.age; +// } @Override public void addAdditionalSaveData(@NotNull final CompoundTag tag) { super.addAdditionalSaveData(tag); - this.age.writeTag(tag); +// this.age.writeTag(tag); } @Override @@ -141,7 +141,7 @@ public class MobDeer @Override public void readAdditionalSaveData(@NotNull final CompoundTag tag) { super.readAdditionalSaveData(tag); - this.age.readTag(tag); +// this.age.readTag(tag); } //Todo: change with new sounds diff --git a/game/core/src/main/java/net/minecraft/core/entity/animal/MobPig.java b/game/core/src/main/java/net/minecraft/core/entity/animal/MobPig.java index 68de88aa9..8415640af 100644 --- a/game/core/src/main/java/net/minecraft/core/entity/animal/MobPig.java +++ b/game/core/src/main/java/net/minecraft/core/entity/animal/MobPig.java @@ -22,12 +22,12 @@ import java.util.List; public class MobPig extends MobAnimal - implements AgedMob +// implements AgedMob { public static final int DATA_SADDLE_ID = 16; public List burningMobDrops = new ArrayList<>(); - private final @NotNull MobAge age; +// private final @NotNull MobAge age; protected float speedProgress = 0f; public MobPig(World world) @@ -37,13 +37,13 @@ public class MobPig setSize(0.9F, 0.9F); mobDrops.add(new WeightedRandomLootObject(Items.FOOD_PORKCHOP_RAW.getDefaultStack(), 1, 2)); burningMobDrops.add(new WeightedRandomLootObject(Items.FOOD_PORKCHOP_COOKED.getDefaultStack(), 1, 2)); - age = MobAge.newRandom(this, MobAge.YEAR_LENGTH_DAYS * 4, 14, MobAge.YEAR_LENGTH_DAYS * 3); +// age = MobAge.newRandom(this, MobAge.YEAR_LENGTH_DAYS * 4, 14, MobAge.YEAR_LENGTH_DAYS * 3); } - @Override - public @NotNull MobAge getMobAge() { - return this.age; - } +// @Override +// public @NotNull MobAge getMobAge() { +// return this.age; +// } @Override protected void defineSynchedData() { @@ -55,7 +55,7 @@ public class MobPig { super.addAdditionalSaveData(tag); tag.putBoolean("Saddle", getSaddled()); - this.age.writeTag(tag); +// this.age.writeTag(tag); } @Override @@ -63,14 +63,14 @@ public class MobPig { super.readAdditionalSaveData(tag); setSaddled(tag.getBoolean("Saddle")); - this.age.readTag(tag); +// this.age.readTag(tag); } @Override public void onLivingUpdate() { super.onLivingUpdate(); - this.age.tick(this.world); +// this.age.tick(this.world); } @Override diff --git a/game/core/src/main/java/net/minecraft/core/entity/animal/MobSheep.java b/game/core/src/main/java/net/minecraft/core/entity/animal/MobSheep.java index 7b5a3a093..67875bb6c 100644 --- a/game/core/src/main/java/net/minecraft/core/entity/animal/MobSheep.java +++ b/game/core/src/main/java/net/minecraft/core/entity/animal/MobSheep.java @@ -21,7 +21,7 @@ import java.util.Random; public class MobSheep extends MobAnimal - implements AgedMob +// implements AgedMob { public static final int DATA_WOOL_STATE_ID = 16; public static final int MASK_WOOL_COLOR = 0b0000_1111; @@ -31,7 +31,7 @@ public class MobSheep private int growthTimer; public int timeSheepEating; public int prevTimeSheepEating; - private final @NotNull MobAge age; +// private final @NotNull MobAge age; public MobSheep(World world) { @@ -39,7 +39,7 @@ public class MobSheep setTextureIdentifier("minecraft", "sheep"); setSize(0.9F, 1.3F); - age = MobAge.newRandom(this, MobAge.YEAR_LENGTH_DAYS * 4, 14, MobAge.YEAR_LENGTH_DAYS * 3); +// age = MobAge.newRandom(this, MobAge.YEAR_LENGTH_DAYS * 4, 14, MobAge.YEAR_LENGTH_DAYS * 3); } @Override @@ -66,10 +66,10 @@ public class MobSheep } } - @Override - public @NotNull MobAge getMobAge() { - return this.age; - } +// @Override +// public @NotNull MobAge getMobAge() { +// return this.age; +// } @Override public boolean interact(@NotNull Player player) @@ -123,7 +123,7 @@ public class MobSheep tag.putByte("Color", (byte)getFleeceColor().blockMeta); tag.putShort("GrowthTimer", (short) growthTimer); - this.age.writeTag(tag); +// this.age.writeTag(tag); } @Override @@ -134,7 +134,7 @@ public class MobSheep setFleeceColor(DyeColor.colorFromBlockMeta(tag.getByte("Color"))); setGrowthTimer(tag.getShort("GrowthTimer")); - this.age.readTag(tag); +// this.age.readTag(tag); } @Override @@ -209,7 +209,7 @@ public class MobSheep } } - this.age.tick(this.world); +// this.age.tick(this.world); } @Override diff --git a/game/core/src/main/java/net/minecraft/core/entity/animal/MobWolf.java b/game/core/src/main/java/net/minecraft/core/entity/animal/MobWolf.java index 26d2b11f4..b911eb426 100644 --- a/game/core/src/main/java/net/minecraft/core/entity/animal/MobWolf.java +++ b/game/core/src/main/java/net/minecraft/core/entity/animal/MobWolf.java @@ -23,7 +23,9 @@ import java.util.*; public class MobWolf extends MobAnimal - implements IItemHolding, AgedMob { + implements IItemHolding// , +// AgedMob +{ public static final Map> ARMOR_MATERIALS = new HashMap<>(); static { @@ -51,7 +53,7 @@ public class MobWolf private float timeWolfIsShaking; private float prevTimeWolfIsShaking; private ItemStack armor = null; - private final @NotNull MobAge age; +// private final @NotNull MobAge age; public MobWolf(World world) { super(world); @@ -60,7 +62,7 @@ public class MobWolf setSize(0.8F, 0.8F); this.moveSpeed = 1.1F; this.scoreValue = 500; - this.age = MobAge.newRandom(this, MobAge.YEAR_LENGTH_DAYS * 2, 14, MobAge.YEAR_LENGTH_DAYS * 2); +// this.age = MobAge.newRandom(this, MobAge.YEAR_LENGTH_DAYS * 2, 14, MobAge.YEAR_LENGTH_DAYS * 2); } @Override @@ -77,10 +79,10 @@ public class MobWolf return super.sendDeathMessage(entityKilledBy) || isWolfTamed(); } - @Override - public @NotNull MobAge getMobAge() { - return this.age; - } +// @Override +// public @NotNull MobAge getMobAge() { +// return this.age; +// } @Override public void spawnInit() { @@ -171,7 +173,7 @@ public class MobWolf } UUIDHelper.writeToTag(tag, getWolfOwner(), "OwnerUUID"); - this.age.writeTag(tag); +// this.age.writeTag(tag); } @Override @@ -224,7 +226,7 @@ public class MobWolf setWolfTamed(true); } - this.age.readTag(tag); +// this.age.readTag(tag); } @Override @@ -385,7 +387,7 @@ public class MobWolf this.world.sendTrackedEntityStatusUpdatePacket(this, (byte) 8); } - this.age.tick(this.world); +// this.age.tick(this.world); } @Override diff --git a/game/core/src/main/java/net/minecraft/core/entity/player/Player.java b/game/core/src/main/java/net/minecraft/core/entity/player/Player.java index 16f6e6112..ad5c30688 100644 --- a/game/core/src/main/java/net/minecraft/core/entity/player/Player.java +++ b/game/core/src/main/java/net/minecraft/core/entity/player/Player.java @@ -1133,6 +1133,10 @@ public abstract class Player } private void setPlayerSleeping(int x, int y, int z) { + if (vehicle != null) { + vehicle.ejectRider(); + } + setSize(0.2F, 0.2F); if (this.world.isBlockLoaded(x, y, z)) { int meta = this.world.getBlockMetadata(x, y, z); diff --git a/game/core/src/main/java/net/minecraft/core/world/Explosion.java b/game/core/src/main/java/net/minecraft/core/world/Explosion.java index 6a2ab01c4..40bcb8a74 100644 --- a/game/core/src/main/java/net/minecraft/core/world/Explosion.java +++ b/game/core/src/main/java/net/minecraft/core/world/Explosion.java @@ -175,7 +175,9 @@ public class Explosion { float proc = 1 - (((IArmorWearing) entity).getTotalProtectionAmount(DamageType.BLAST) / 2f); flingForce *= proc; } - entity.fling(xComp * flingForce, yComp * flingForce, zComp * flingForce, 1); + if (!entity.noPhysics) { + entity.fling(xComp * flingForce, yComp * flingForce, zComp * flingForce, 1); + } } } } diff --git a/game/core/src/main/java/net/minecraft/core/world/ExplosionCannonball.java b/game/core/src/main/java/net/minecraft/core/world/ExplosionCannonball.java index 79e1b78ca..637086a24 100644 --- a/game/core/src/main/java/net/minecraft/core/world/ExplosionCannonball.java +++ b/game/core/src/main/java/net/minecraft/core/world/ExplosionCannonball.java @@ -54,7 +54,9 @@ public class ExplosionCannonball extends Explosion { float proc = 1 - entArmored.getTotalProtectionAmount(DamageType.BLAST) / 2f; flingForce *= proc; } - entity.fling(xComp * flingForce, yComp * flingForce, zComp * flingForce, 1); + if (!entity.noPhysics) { + entity.fling(xComp * flingForce, yComp * flingForce, zComp * flingForce, 1); + } } } } diff --git a/game/core/src/main/java/net/minecraft/core/world/World.java b/game/core/src/main/java/net/minecraft/core/world/World.java index c93a4b9e0..e387859df 100644 --- a/game/core/src/main/java/net/minecraft/core/world/World.java +++ b/game/core/src/main/java/net/minecraft/core/world/World.java @@ -191,20 +191,20 @@ public abstract class World implements MutableWorldSource { final @NotNull SettingNodesValues dimensionSettings = this.dimensionData.getDimensionSettings(); // Set up season manager - if (dimensionSettings.getNodeValue(WorldSettingNodes.SINGLE_SEASON_ENABLED, this.worldConfigurationReader)) { - final @NotNull Season singleSeason = dimensionSettings.getNodeValue(WorldSettingNodes.SINGLE_SEASON_VALUE, this.worldConfigurationReader); - this.seasonManager = SeasonManager.fromConfig(this, SeasonConfig.builder().withSingleSeason(singleSeason).build()); - } else { +// if (dimensionSettings.getNodeValue(WorldSettingNodes.SINGLE_SEASON_ENABLED, this.worldConfigurationReader)) { +// final @NotNull Season singleSeason = dimensionSettings.getNodeValue(WorldSettingNodes.SINGLE_SEASON_VALUE, this.worldConfigurationReader); +// this.seasonManager = SeasonManager.fromConfig(this, SeasonConfig.builder().withSingleSeason(singleSeason).build()); +// } else { this.seasonManager = SeasonManager.fromConfig(this, this.getWorldType().getSeasonConfig()); - } +// } // Set up biome provider - if (dimensionSettings.getNodeValue(WorldSettingNodes.SINGLE_BIOME_ENABLED, this.worldConfigurationReader)) { - final @NotNull Biome biome = dimensionSettings.getNodeValue(WorldSettingNodes.SINGLE_BIOME_VALUE, this.worldConfigurationReader); - this.biomeProvider = new BiomeProviderSingleBiome(this, biome, biome.defaultTemperature, biome.defaultHumidity, biome.defaultVariety); - } else { +// if (dimensionSettings.getNodeValue(WorldSettingNodes.SINGLE_BIOME_ENABLED, this.worldConfigurationReader)) { +// final @NotNull Biome biome = dimensionSettings.getNodeValue(WorldSettingNodes.SINGLE_BIOME_VALUE, this.worldConfigurationReader); +// this.biomeProvider = new BiomeProviderSingleBiome(this, biome, biome.defaultTemperature, biome.defaultHumidity, biome.defaultVariety); +// } else { this.biomeProvider = this.getWorldType().createBiomeProvider(this); - } +// } // Set up command manager this.commandManager.init(); @@ -251,6 +251,21 @@ public abstract class World implements MutableWorldSource { ); } + // Used by non overworld dimensions in MP + public World( + final @NotNull World parent, + final @NotNull WorldConfiguration worldConfiguration, + final @NotNull Dimension dimension + ) { + this( + dimension, + parent.levelStorage, + worldConfiguration, + new LevelData(parent.levelData), + parent.levelStorage.getDimensionData(dimension) + ); + } + public @NotNull T getWorldSetting(final @NotNull ValueSettingNode node) { return this.dimensionData.getDimensionSettings().getNodeValue(node, this.worldConfigurationReader); } 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 6742380cf..ba47c0510 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 @@ -2,7 +2,7 @@ package net.minecraft.core.world.generate.chunk; import it.unimi.dsi.fastutil.objects.Object2IntMap; import it.unimi.dsi.fastutil.objects.Object2IntOpenHashMap; -import net.minecraft.core.block.BlockLogicSand; +import net.minecraft.core.block.BlockLogicFallingBlock; import net.minecraft.core.util.HardIllegalArgumentException; import net.minecraft.core.util.collection.NamespaceID; import net.minecraft.core.world.World; @@ -48,7 +48,7 @@ public abstract class ChunkFeatureDecorator @Override public final void decorate(final @NotNull Chunk chunk) { this.world.scheduledUpdatesAreImmediate = true; - BlockLogicSand.fallInstantly = true; + BlockLogicFallingBlock.fallInstantly = true; final int chunkX = chunk.pos.x; final int chunkZ = chunk.pos.z; @@ -71,7 +71,7 @@ public abstract class ChunkFeatureDecorator this.postDecorate(this.world, chunk); - BlockLogicSand.fallInstantly = false; + BlockLogicFallingBlock.fallInstantly = false; this.world.scheduledUpdatesAreImmediate = false; } diff --git a/game/core/src/main/java/net/minecraft/core/world/generate/chunk/perlin/overworld/ChunkDecoratorOverworld.java b/game/core/src/main/java/net/minecraft/core/world/generate/chunk/perlin/overworld/ChunkDecoratorOverworld.java index d7c7a0ae3..68869919e 100644 --- a/game/core/src/main/java/net/minecraft/core/world/generate/chunk/perlin/overworld/ChunkDecoratorOverworld.java +++ b/game/core/src/main/java/net/minecraft/core/world/generate/chunk/perlin/overworld/ChunkDecoratorOverworld.java @@ -8,7 +8,7 @@ import net.minecraft.core.block.BlockLogicOreGold; import net.minecraft.core.block.BlockLogicOreIron; import net.minecraft.core.block.BlockLogicOreLapis; import net.minecraft.core.block.BlockLogicOreRedstone; -import net.minecraft.core.block.BlockLogicSand; +import net.minecraft.core.block.BlockLogicFallingBlock; import net.minecraft.core.block.Blocks; import net.minecraft.core.block.material.Materials; import net.minecraft.core.world.World; @@ -55,7 +55,7 @@ public class ChunkDecoratorOverworld float oreHeightModifier = rangeY / 128f; - BlockLogicSand.fallInstantly = true; + BlockLogicFallingBlock.fallInstantly = true; int x = chunkX * 16; int z = chunkZ * 16; int y = this.world.getHeightValue(x + 16, z + 16); @@ -622,7 +622,7 @@ public class ChunkDecoratorOverworld } - BlockLogicSand.fallInstantly = false; + BlockLogicFallingBlock.fallInstantly = false; this.world.scheduledUpdatesAreImmediate = false; } } diff --git a/game/core/src/main/java/net/minecraft/core/world/generate/chunk/perlin/overworld/b173/ChunkDecoratorOverworldB173.java b/game/core/src/main/java/net/minecraft/core/world/generate/chunk/perlin/overworld/b173/ChunkDecoratorOverworldB173.java index 3b09b9038..f71d51782 100644 --- a/game/core/src/main/java/net/minecraft/core/world/generate/chunk/perlin/overworld/b173/ChunkDecoratorOverworldB173.java +++ b/game/core/src/main/java/net/minecraft/core/world/generate/chunk/perlin/overworld/b173/ChunkDecoratorOverworldB173.java @@ -1,6 +1,6 @@ package net.minecraft.core.world.generate.chunk.perlin.overworld.b173; -import net.minecraft.core.block.BlockLogicSand; +import net.minecraft.core.block.BlockLogicFallingBlock; import net.minecraft.core.block.Blocks; import net.minecraft.core.world.World; import net.minecraft.core.world.biome.Biome; @@ -29,7 +29,7 @@ public class ChunkDecoratorOverworldB173 @Override public void decorate(final @NotNull Chunk chunk) { this.world.scheduledUpdatesAreImmediate = true; - BlockLogicSand.fallInstantly = true; + BlockLogicFallingBlock.fallInstantly = true; final int x = chunk.pos.x; final int z = chunk.pos.z; @@ -314,7 +314,7 @@ public class ChunkDecoratorOverworldB173 } } - BlockLogicSand.fallInstantly = false; + BlockLogicFallingBlock.fallInstantly = false; this.world.scheduledUpdatesAreImmediate = false; } } diff --git a/game/core/src/main/java/net/minecraft/core/world/generate/chunk/perlin/overworld/retro/ChunkDecoratorOverworldRetro.java b/game/core/src/main/java/net/minecraft/core/world/generate/chunk/perlin/overworld/retro/ChunkDecoratorOverworldRetro.java index 2630f5cc5..adf3fd0ff 100644 --- a/game/core/src/main/java/net/minecraft/core/world/generate/chunk/perlin/overworld/retro/ChunkDecoratorOverworldRetro.java +++ b/game/core/src/main/java/net/minecraft/core/world/generate/chunk/perlin/overworld/retro/ChunkDecoratorOverworldRetro.java @@ -5,7 +5,7 @@ import net.minecraft.core.block.BlockLogicOreDiamond; import net.minecraft.core.block.BlockLogicOreGold; import net.minecraft.core.block.BlockLogicOreIron; import net.minecraft.core.block.BlockLogicOreRedstone; -import net.minecraft.core.block.BlockLogicSand; +import net.minecraft.core.block.BlockLogicFallingBlock; import net.minecraft.core.block.Blocks; import net.minecraft.core.block.material.Materials; import net.minecraft.core.world.World; @@ -45,7 +45,7 @@ public class ChunkDecoratorOverworldRetro int maxY = this.world.getWorldType().getMaxY(world); int rangeY = (maxY + 1) - minY; - BlockLogicSand.fallInstantly = true; + BlockLogicFallingBlock.fallInstantly = true; int k = chunkX * 16; int l = chunkZ * 16; Random rand = new Random(this.world.getRandomSeed()); @@ -200,7 +200,7 @@ public class ChunkDecoratorOverworldRetro } - BlockLogicSand.fallInstantly = false; + BlockLogicFallingBlock.fallInstantly = false; this.world.scheduledUpdatesAreImmediate = false; } } diff --git a/game/core/src/main/java/net/minecraft/core/world/settings/WorldSettingNodes.java b/game/core/src/main/java/net/minecraft/core/world/settings/WorldSettingNodes.java index 2573e5d88..723716b0f 100644 --- a/game/core/src/main/java/net/minecraft/core/world/settings/WorldSettingNodes.java +++ b/game/core/src/main/java/net/minecraft/core/world/settings/WorldSettingNodes.java @@ -12,42 +12,42 @@ public final class WorldSettingNodes { throw new IllegalAccessException("No WorldSettingNodes for you!"); } - public static final @NotNull WorldHeightSettingNode WORLD_HEIGHT_BOTTOM = - new WorldHeightSettingNode("minecraft:world_settings/world_height/bottom", new TranslatableText("world_settings.world_height.bottom.name"), WorldHeightSettingNode.DEFAULT_MIN, WorldHeightSettingNode.ValueType.BOTTOM); - public static final @NotNull WorldHeightSettingNode WORLD_HEIGHT_TOP = - new WorldHeightSettingNode("minecraft:world_settings/world_height/top", new TranslatableText("world_settings.world_height.top.name"), WorldHeightSettingNode.DEFAULT_MAX, WorldHeightSettingNode.ValueType.TOP); - public static final @NotNull BooleanSettingNode SINGLE_SEASON_ENABLED = (BooleanSettingNode) - new BooleanSettingNode("minecraft:world_settings/single_season/enabled", new TranslatableText("world_settings.single_season.enabled.name"), false) - .withChildrenVisibilityListener((config, value) -> value); - public static final @NotNull SeasonSettingNode SINGLE_SEASON_VALUE = - new SeasonSettingNode("minecraft:world_settings/single_season/value", new TranslatableText("world_settings.single_season.value.name")); +// public static final @NotNull WorldHeightSettingNode WORLD_HEIGHT_BOTTOM = +// new WorldHeightSettingNode("minecraft:world_settings/world_height/bottom", new TranslatableText("world_settings.world_height.bottom.name"), WorldHeightSettingNode.DEFAULT_MIN, WorldHeightSettingNode.ValueType.BOTTOM); +// public static final @NotNull WorldHeightSettingNode WORLD_HEIGHT_TOP = +// new WorldHeightSettingNode("minecraft:world_settings/world_height/top", new TranslatableText("world_settings.world_height.top.name"), WorldHeightSettingNode.DEFAULT_MAX, WorldHeightSettingNode.ValueType.TOP); +// public static final @NotNull BooleanSettingNode SINGLE_SEASON_ENABLED = (BooleanSettingNode) +// new BooleanSettingNode("minecraft:world_settings/single_season/enabled", new TranslatableText("world_settings.single_season.enabled.name"), false) +// .withChildrenVisibilityListener((config, value) -> value); +// public static final @NotNull SeasonSettingNode SINGLE_SEASON_VALUE = +// new SeasonSettingNode("minecraft:world_settings/single_season/value", new TranslatableText("world_settings.single_season.value.name")); public static final @NotNull BooleanSettingNode STARTING_BIOME_ENABLED = (BooleanSettingNode) new BooleanSettingNode("minecraft:world_settings/starting_biome/enabled", new TranslatableText("world_settings.starting_biome.enabled.name"), false) .withChildrenVisibilityListener((config, value) -> value); public static final @NotNull BiomeSettingNode STARTING_BIOME_VALUE = new BiomeSettingNode("minecraft:world_settings/starting_biome/value", new TranslatableText("world_settings.starting_biome.value.name")); - public static final @NotNull BooleanSettingNode SINGLE_BIOME_ENABLED = (BooleanSettingNode) - new BooleanSettingNode("minecraft:world_settings/single_biome/enabled", new TranslatableText("world_settings.single_biome.enabled.name"), false) - .withChildrenVisibilityListener((config, value) -> value); - public static final @NotNull BiomeSettingNode SINGLE_BIOME_VALUE = - new BiomeSettingNode("minecraft:world_settings/single_biome/value", new TranslatableText("world_settings.single_biome.value.name")); +// public static final @NotNull BooleanSettingNode SINGLE_BIOME_ENABLED = (BooleanSettingNode) +// new BooleanSettingNode("minecraft:world_settings/single_biome/enabled", new TranslatableText("world_settings.single_biome.enabled.name"), false) +// .withChildrenVisibilityListener((config, value) -> value); +// public static final @NotNull BiomeSettingNode SINGLE_BIOME_VALUE = +// new BiomeSettingNode("minecraft:world_settings/single_biome/value", new TranslatableText("world_settings.single_biome.value.name")); private static final @NotNull SettingNode ROOT_NODE; static { ROOT_NODE = new ContainerSettingNode(new ListSettingNodeChildrenProvider()) - .withChild(WORLD_HEIGHT_BOTTOM) - .withChild(WORLD_HEIGHT_TOP) - .withChild( - SINGLE_SEASON_ENABLED - .withChild(SINGLE_SEASON_VALUE) - ) +// .withChild(WORLD_HEIGHT_BOTTOM) +// .withChild(WORLD_HEIGHT_TOP) +// .withChild( +// SINGLE_SEASON_ENABLED +// .withChild(SINGLE_SEASON_VALUE) +// ) .withChild( STARTING_BIOME_ENABLED .withChild(STARTING_BIOME_VALUE) - ) - .withChild( - SINGLE_BIOME_ENABLED - .withChild(SINGLE_BIOME_VALUE) +// ) +// .withChild( +// SINGLE_BIOME_ENABLED +// .withChild(SINGLE_BIOME_VALUE) ); } diff --git a/game/core/src/main/java/net/minecraft/core/world/settings/impl/WorldHeightSettingNode.java b/game/core/src/main/java/net/minecraft/core/world/settings/impl/WorldHeightSettingNode.java index 2000a92c9..288863060 100644 --- a/game/core/src/main/java/net/minecraft/core/world/settings/impl/WorldHeightSettingNode.java +++ b/game/core/src/main/java/net/minecraft/core/world/settings/impl/WorldHeightSettingNode.java @@ -28,41 +28,44 @@ public class WorldHeightSettingNode extends RangeIntegerSettingNode { @Override public @NotNull Integer getMinimumValue(final @NotNull Dimension dimension, final @NotNull WorldConfigurationReader config) { - final int bottomValue = config.getDimensionSettings(dimension).getNodeValueOr(WorldSettingNodes.WORLD_HEIGHT_BOTTOM, DEFAULT_MIN); - - final int baseMin = super.getMinimumValue(dimension, config); - - return switch (this.valueType) { - case BOTTOM -> baseMin; - case TOP -> bottomValue + 1; - }; +// final int bottomValue = config.getDimensionSettings(dimension).getNodeValueOr(WorldSettingNodes.WORLD_HEIGHT_BOTTOM, DEFAULT_MIN); +// +// final int baseMin = super.getMinimumValue(dimension, config); +// +// return switch (this.valueType) { +// case BOTTOM -> baseMin; +// case TOP -> bottomValue + 1; +// }; + return 0; } @Override public @NotNull Integer getMaximumValue(final @NotNull Dimension dimension, final @NotNull WorldConfigurationReader config) { - final int topValue = config.getDimensionSettings(dimension).getNodeValueOr(WorldSettingNodes.WORLD_HEIGHT_TOP, DEFAULT_MAX); - - final int baseMax = super.getMaximumValue(dimension, config); - - return switch (this.valueType) { - case BOTTOM -> topValue - 1; - case TOP -> baseMax; - }; +// final int topValue = config.getDimensionSettings(dimension).getNodeValueOr(WorldSettingNodes.WORLD_HEIGHT_TOP, DEFAULT_MAX); +// +// final int baseMax = super.getMaximumValue(dimension, config); +// +// return switch (this.valueType) { +// case BOTTOM -> topValue - 1; +// case TOP -> baseMax; +// }; + return 1; } @Override public @NotNull Integer getDefaultValue(final @NotNull Dimension dimension, final @NotNull WorldConfigurationReader config) { - final int baseDefault = super.getDefaultValue(dimension, config); - final int baseMin = super.getMinimumValue(dimension, config); - final int baseMax = super.getMaximumValue(dimension, config); - - final int bottomValue = config.getDimensionSettings(dimension).getNodeValueOr(WorldSettingNodes.WORLD_HEIGHT_BOTTOM, DEFAULT_MIN); - final int topValue = config.getDimensionSettings(dimension).getNodeValueOr(WorldSettingNodes.WORLD_HEIGHT_TOP, DEFAULT_MAX); - - return switch (this.valueType) { - case BOTTOM -> MathHelper.clamp(baseDefault, baseMin, topValue - 1); - case TOP -> MathHelper.clamp(baseDefault, bottomValue + 1, baseMax); - }; +// final int baseDefault = super.getDefaultValue(dimension, config); +// final int baseMin = super.getMinimumValue(dimension, config); +// final int baseMax = super.getMaximumValue(dimension, config); +// +// final int bottomValue = config.getDimensionSettings(dimension).getNodeValueOr(WorldSettingNodes.WORLD_HEIGHT_BOTTOM, DEFAULT_MIN); +// final int topValue = config.getDimensionSettings(dimension).getNodeValueOr(WorldSettingNodes.WORLD_HEIGHT_TOP, DEFAULT_MAX); +// +// return switch (this.valueType) { +// case BOTTOM -> MathHelper.clamp(baseDefault, baseMin, topValue - 1); +// case TOP -> MathHelper.clamp(baseDefault, bottomValue + 1, baseMax); +// }; + return 0; } @Override 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 e9d4aa976..13061a6d8 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 @@ -101,7 +101,8 @@ public abstract class WorldType } public int getMinY(final @NotNull World world) { - return world.getWorldSetting(WorldSettingNodes.WORLD_HEIGHT_BOTTOM) * WorldHeightSettingNode.VALUE_SCALE; +// return world.getWorldSetting(WorldSettingNodes.WORLD_HEIGHT_BOTTOM) * WorldHeightSettingNode.VALUE_SCALE; + return this.minY; } public int getMinPortalY() { @@ -109,7 +110,8 @@ public abstract class WorldType } public int getMaxY(final @NotNull World world) { - return (world.getWorldSetting(WorldSettingNodes.WORLD_HEIGHT_TOP) * WorldHeightSettingNode.VALUE_SCALE) - 1; +// return (world.getWorldSetting(WorldSettingNodes.WORLD_HEIGHT_TOP) * WorldHeightSettingNode.VALUE_SCALE) - 1; + return this.maxY; } public int getMaxPortalY() { diff --git a/game/server/src/main/java/net/minecraft/server/MinecraftServer.java b/game/server/src/main/java/net/minecraft/server/MinecraftServer.java index 713a12eb7..5e4f98e5d 100644 --- a/game/server/src/main/java/net/minecraft/server/MinecraftServer.java +++ b/game/server/src/main/java/net/minecraft/server/MinecraftServer.java @@ -506,25 +506,29 @@ public class MinecraftServer convertWorld(saveFormat, worldDirName); dimensionWorlds = new Int2ObjectArrayMap<>(); LevelStorageServer levelStorage = new LevelStorageServer(saveFormat, new File("."), worldDirName, true); + WorldServer overworld = null; for (final @NotNull Dimension dimension : Dimension.getDimensionList().values()) { + final @NotNull WorldConfiguration worldConfiguration = new WorldConfiguration(); + for (final @NotNull WorldTypeGroups.Group group : WorldTypeGroups.GROUPS) { + if (group.get(dimension).equals(this.defaultWorldType)) { + worldConfiguration.setWorldTypeGroup(group); + break; + } + } + WorldServer worldServer; if (dimension.id == 0) { - final @NotNull WorldConfiguration worldConfiguration = new WorldConfiguration(); - for (final @NotNull WorldTypeGroups.Group group : WorldTypeGroups.GROUPS) { - if (group.get(dimension).equals(this.defaultWorldType)) { - worldConfiguration.setWorldTypeGroup(group); - break; - } - } worldConfiguration.setWorldName(worldDirName); worldConfiguration.setNumericSeed(seed); worldServer = new WorldServer(this, levelStorage, worldConfiguration, dimension); + overworld = worldServer; } else { - worldServer = new WorldServer(dimensionWorlds.get(0), dimension); + if (overworld == null) throw new RuntimeException("Dimension load order issue! Sub dimensions attempted loading before Overworld!"); + worldServer = new WorldServer(overworld, worldConfiguration, dimension); } dimensionWorlds.put(dimension.id, worldServer); worldServer.addListener(new WorldManager(this, dimensionWorlds.get(dimension.id))); diff --git a/game/server/src/main/java/net/minecraft/server/net/handler/PacketHandlerServer.java b/game/server/src/main/java/net/minecraft/server/net/handler/PacketHandlerServer.java index eb32ab9fc..4d3a15a6e 100644 --- a/game/server/src/main/java/net/minecraft/server/net/handler/PacketHandlerServer.java +++ b/game/server/src/main/java/net/minecraft/server/net/handler/PacketHandlerServer.java @@ -586,7 +586,7 @@ public class PacketHandlerServer extends PacketHandler if (!this.playerEntity.getGamemode().canInteract() || !this.playerEntity.isAlive()) return; WorldServer worldserver = this.mcServer.getDimensionWorld(this.playerEntity.dimension); Entity targetEntity = worldserver.getEntityFromId(packetEntityInteract.targetEntityID); - if (targetEntity != null && this.playerEntity.distanceToSqr(targetEntity) < 36D) { + if (this.playerEntity.distanceToSqr(targetEntity) < 36D) { boolean canAttack = this.playerEntity.canEntityBeSeen(targetEntity); if (!canAttack) { diff --git a/game/server/src/main/java/net/minecraft/server/world/WorldServer.java b/game/server/src/main/java/net/minecraft/server/world/WorldServer.java index 184b8ca13..869c23985 100644 --- a/game/server/src/main/java/net/minecraft/server/world/WorldServer.java +++ b/game/server/src/main/java/net/minecraft/server/world/WorldServer.java @@ -21,12 +21,9 @@ import net.minecraft.core.world.Explosion; import net.minecraft.core.world.ExplosionCannonball; import net.minecraft.core.world.SpawnerMobs; import net.minecraft.core.world.World; -import net.minecraft.core.world.biome.Biome; import net.minecraft.core.world.chunk.ChunkLoader; -import net.minecraft.core.world.chunk.provider.ChunkProvider; import net.minecraft.core.world.pos.TilePosc; import net.minecraft.core.world.save.LevelStorage; -import net.minecraft.core.world.saveddata.SavedDataStorage; import net.minecraft.core.world.settings.WorldConfiguration; import net.minecraft.server.MinecraftServer; import net.minecraft.server.world.chunk.provider.ChunkProviderServer; @@ -37,9 +34,9 @@ import java.util.ArrayList; import java.util.List; public class WorldServer extends World { + private Int2ObjectMap<@NotNull Entity> entityIntHashMap = new Int2ObjectOpenHashMap<>(); public boolean dontSave; - public MinecraftServer mcServer; - private final Int2ObjectMap entityIntHashMap; + public @NotNull MinecraftServer mcServer; private long lastWeatherSend = System.currentTimeMillis(); @@ -50,19 +47,16 @@ public class WorldServer extends World { final @NotNull Dimension dimension ) { super(levelStorage, worldConfiguration, dimension); - - entityIntHashMap = new Int2ObjectOpenHashMap<>(); - mcServer = server; + this.mcServer = server; getLevelData().setLastPlayerUUID(null); } public WorldServer( final @NotNull WorldServer parent, + final @NotNull WorldConfiguration worldConfiguration, final @NotNull Dimension dimension ) { - super(parent, dimension); - - entityIntHashMap = new Int2ObjectOpenHashMap<>(); + super(parent, worldConfiguration, dimension); this.mcServer = parent.mcServer; getLevelData().setLastPlayerUUID(null); } @@ -108,18 +102,24 @@ public class WorldServer extends World { } @Override - protected void obtainEntitySkin(Entity entity) + protected void obtainEntitySkin(@Nullable Entity entity) { super.obtainEntitySkin(entity); if (entity == null) return; + if (entityIntHashMap == null) { // This actually can be null, at startup it seems these methods are called *before* the lazy fucking jvm decides to create the hashmap so null check is needed + entityIntHashMap = new Int2ObjectOpenHashMap<>(); + } entityIntHashMap.put(entity.id, entity); } @Override - protected void releaseEntitySkin(Entity entity) + protected void releaseEntitySkin(@Nullable Entity entity) { super.releaseEntitySkin(entity); if (entity == null) return; + if (entityIntHashMap == null) { // This actually can be null, at startup it seems these methods are called *before* the lazy fucking jvm decides to create the hashmap so null check is needed + entityIntHashMap = new Int2ObjectOpenHashMap<>(); + } entityIntHashMap.remove(entity.id); } @@ -188,7 +188,7 @@ public class WorldServer extends World { } - public Entity getEntityFromId(int i) + public @NotNull Entity getEntityFromId(int i) { return entityIntHashMap.get(i); }