Merge branch '4jcraft:dev' into dev

This commit is contained in:
Liriosha 2026-03-17 04:13:35 +00:00 committed by GitHub
commit c55443b5be
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
51 changed files with 2770 additions and 374 deletions

View file

@ -9,6 +9,7 @@ RUN apt-get update \
&& apt-get update \
&& apt-get install -y \
build-essential \
gcc-14 g++-14 \
python3 \
ninja-build \
meson \
@ -16,6 +17,9 @@ RUN apt-get update \
libgl-dev \
libglu1-mesa-dev \
libpthread-stubs0-dev \
# Set GCC 14 as the default compiler
&& update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-14 100 \
&& update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-14 100 \
# Clean up lol
&& apt-get autoremove -y \
&& apt-get clean -y \

View file

@ -60,10 +60,10 @@ jobs:
BASE_SHA=""
if [ "$EVENT_NAME" = "pull_request" ]; then
git fetch --no-tags origin "$PR_BASE_REF" --depth=1
git fetch --no-tags origin "$PR_BASE_REF"
BASE_SHA="$(git merge-base "origin/$PR_BASE_REF" "$CURRENT_SHA")"
elif [ -n "$BEFORE_SHA" ] && [ "$BEFORE_SHA" != "0000000000000000000000000000000000000000" ]; then
BASE_SHA="$BEFORE_SHA"
fi
bash ./.github/scripts/check-clang-format.sh "$BASE_SHA" "$CURRENT_SHA"
bash ./.github/scripts/check-clang-format.sh "$BASE_SHA" "$CURRENT_SHA"

View file

@ -28,6 +28,7 @@ static bool s_prevMenuDisplayed = false;
static bool s_snapTaken = false;
static float s_accumRelX = 0, s_accumRelY = 0;
static float s_snapRelX = 0, s_snapRelY = 0;
static int s_mouseX = 0, s_mouseY = 0;
static int s_scrollTicksForButtonPressed = 0;
static int s_scrollTicksForGetValue = 0;
@ -274,7 +275,7 @@ void C_4JInput::Tick() {
if (sc > 0 && sc < KEY_COUNT) s_keysCurrent[sc] = state[sc] != 0;
}
Uint32 btns = SDL_GetMouseState(NULL, NULL);
Uint32 btns = SDL_GetMouseState(&s_mouseX, &s_mouseY);
s_mouseLeftCurrent = (btns & SDL_BUTTON(SDL_BUTTON_LEFT)) != 0;
s_mouseRightCurrent = (btns & SDL_BUTTON(SDL_BUTTON_RIGHT)) != 0;
@ -353,13 +354,17 @@ int C_4JInput::GetHotbarSlotPressed(int iPad) {
case ACTION_MENU_PAGEDOWN: \
return KFN(SDL_SCANCODE_PAGEDOWN); \
case ACTION_MENU_OK: \
return KFN(SDL_SCANCODE_RETURN) || KFN(SDL_SCANCODE_Z) || CFN(SDL_CONTROLLER_BUTTON_A); \
return KFN(SDL_SCANCODE_RETURN) || KFN(SDL_SCANCODE_Z) || \
CFN(SDL_CONTROLLER_BUTTON_A); \
case ACTION_MENU_CANCEL: \
return KFN(SDL_SCANCODE_ESCAPE) || KFN(SDL_SCANCODE_X) || CFN(SDL_CONTROLLER_BUTTON_B); \
return KFN(SDL_SCANCODE_ESCAPE) || KFN(SDL_SCANCODE_X) || \
CFN(SDL_CONTROLLER_BUTTON_B); \
case ACTION_MENU_A: \
return KFN(SDL_SCANCODE_Z) || KFN(SDL_SCANCODE_RETURN) || CFN(SDL_CONTROLLER_BUTTON_A); \
return KFN(SDL_SCANCODE_Z) || KFN(SDL_SCANCODE_RETURN) || \
CFN(SDL_CONTROLLER_BUTTON_A); \
case ACTION_MENU_B: \
return KFN(SDL_SCANCODE_X) || KFN(SDL_SCANCODE_ESCAPE) || CFN(SDL_CONTROLLER_BUTTON_B); \
return KFN(SDL_SCANCODE_X) || KFN(SDL_SCANCODE_ESCAPE) || \
CFN(SDL_CONTROLLER_BUTTON_B); \
case ACTION_MENU_X: \
return KFN(SDL_SCANCODE_C) || CFN(SDL_CONTROLLER_BUTTON_X); \
case ACTION_MENU_Y: \
@ -545,6 +550,10 @@ unsigned char C_4JInput::GetJoypadRTrigger(int, bool) {
? 255
: 0;
}
int C_4JInput::GetMouseX() { return s_mouseX; }
int C_4JInput::GetMouseY() { return s_mouseY; }
// We detect if a Menu is visible on the player's screen to the mouse being
// stuck.
void C_4JInput::SetMenuDisplayed(int iPad, bool bVal) {

View file

@ -157,6 +157,9 @@ public:
void* lpParam);
void CancelAllVerifyInProgress(void);
int GetMouseX();
int GetMouseY();
// bool InputDetected(DWORD dwUserIndex,WCHAR *pwchInput);
};

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1,005 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 965 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.1 KiB

After

Width:  |  Height:  |  Size: 1.5 KiB

View file

@ -0,0 +1,984 @@
language.name=English
language.region=US
language.code=en_US
gui.done=Done
gui.cancel=Cancel
gui.toMenu=Back to title screen
gui.up=Up
gui.down=Down
gui.yes=Yes
gui.no=No
menu.singleplayer=Singleplayer
menu.multiplayer=Multiplayer
menu.mods=Texture Packs
menu.options=Options...
menu.quit=Quit Game
menu.returnToMenu=Save and Quit to Title
menu.disconnect=Disconnect
menu.returnToGame=Back to Game
menu.switchingLevel=Switching worlds
menu.generatingLevel=Generating world
menu.loadingLevel=Loading world
menu.generatingTerrain=Building terrain
menu.convertingLevel=Converting world
menu.simulating=Simulating the world for a bit
menu.respawning=Respawning
menu.shareToLan=Open to LAN
selectWorld.title=Select World
selectWorld.empty=empty
selectWorld.world=World
selectWorld.select=Play Selected World
selectWorld.create=Create New World
selectWorld.createDemo=Play New Demo World
selectWorld.delete=Delete
selectWorld.rename=Rename
selectWorld.deleteQuestion=Are you sure you want to delete this world?
selectWorld.deleteWarning=will be lost forever! (A long time!)
selectWorld.deleteButton=Delete
selectWorld.renameButton=Rename
selectWorld.renameTitle=Rename World
selectWorld.conversion=Must be converted!
selectWorld.newWorld=New World
selectWorld.enterName=World Name
selectWorld.resultFolder=Will be saved in:
selectWorld.enterSeed=Seed for the World Generator
selectWorld.seedInfo=Leave blank for a random seed
selectWorld.cheats=Cheats
gameMode.survival=Survival Mode
gameMode.creative=Creative Mode
gameMode.adventure=Adventure Mode
gameMode.hardcore=Hardcore Mode!
gameMode.changed=Your game mode has been changed
selectWorld.gameMode=Game Mode:
selectWorld.gameMode.survival=Survival
selectWorld.gameMode.survival.line1=Search for resources, crafting, gain
selectWorld.gameMode.survival.line2=levels, health and hunger
selectWorld.gameMode.creative=Creative
selectWorld.gameMode.creative.line1=Unlimited resources, free flying and
selectWorld.gameMode.creative.line2=destroy blocks instantly
selectWorld.gameMode.hardcore=Hardcore
selectWorld.gameMode.hardcore.line1=Same as survival mode, locked at hardest
selectWorld.gameMode.hardcore.line2=difficulty, and one life only
selectWorld.gameMode.adventure=Adventure
selectWorld.gameMode.adventure.line1=Same as survival mode, but blocks can't
selectWorld.gameMode.adventure.line2=be added or removed
selectWorld.moreWorldOptions=More World Options...
selectWorld.mapFeatures=Generate Structures:
selectWorld.mapFeatures.info=Villages, dungeons etc
selectWorld.mapType=World Type:
selectWorld.mapType.normal=Normal
selectWorld.mapType.flat=Superflat
selectWorld.allowCommands=Allow Cheats:
selectWorld.allowCommands.info=Commands like /gamemode, /xp
selectWorld.hardcoreMode=Hardcore:
selectWorld.hardcoreMode.info=World is deleted upon death
selectWorld.bonusItems=Bonus Chest:
generator.default=Default
generator.flat=Superflat
generator.largeBiomes=Large Biomes
selectServer.title=Select Server
selectServer.empty=empty
selectServer.select=Join Server
selectServer.direct=Direct Connect
selectServer.edit=Edit
selectServer.delete=Delete
selectServer.add=Add server
selectServer.defaultName=Minecraft Server
selectServer.deleteQuestion=Are you sure you want to remove this server?
selectServer.deleteWarning=will be lost forever! (A long time!)
selectServer.deleteButton=Delete
selectServer.refresh=Refresh
addServer.title=Edit Server Info
addServer.enterName=Server Name
addServer.enterIp=Server Address
addServer.add=Done
lanServer.title=LAN World
lanServer.scanning=Scanning for LAN Worlds
lanServer.start=Start LAN World
lanServer.otherPlayers=Settings for Other Players
multiplayer.title=Play Multiplayer
multiplayer.connect=Connect
multiplayer.info1=Minecraft Multiplayer is currently not finished, but there
multiplayer.info2=is some buggy early testing going on.
multiplayer.ipinfo=Enter the IP of a server to connect to it:
multiplayer.texturePrompt.line1=This server recommends the use of a custom texture pack.
multiplayer.texturePrompt.line2=Would you like to download and install it automagically?
multiplayer.downloadingTerrain=Downloading terrain
multiplayer.stopSleeping=Leave Bed
chat.link.confirm=Are you sure you want to open the following website?
chat.link.warning=Never open links from people that you don't trust!
chat.copy=Copy to Clipboard
menu.playdemo=Play Demo World
menu.resetdemo=Reset Demo World
demo.day.1=This demo will last five game days, do your best!
demo.day.2=Day Two
demo.day.3=Day Three
demo.day.4=Day Four
demo.day.5=This is your last day!
demo.day.warning=Your time is almost up!
demo.day.6=You have passed your fifth day, use F2 to save a screenshot of your creation
demo.reminder=The demo time has expired, buy the game to continue or start a new world!
demo.remainingTime=Remaining time: %s
demo.demoExpired=Demo time's up!
demo.help.movement=Use %s, %s, %s, %s and the mouse to move around
demo.help.movementShort=Move by pressing %s, %s, %s, %s
demo.help.movementMouse=Look around using the mouse
demo.help.jump=Jump by pressing %s
demo.help.inventory=Use %s to open your inventory
demo.help.title=Minecraft Demo Mode
demo.help.fullWrapped=This demo will last 5 ingame days (about 1 hour and 40 minutes of real time). Check the achievements for hints! Have fun!
demo.help.buy=Purchase Now!
demo.help.later=Continue Playing!
connect.connecting=Connecting to the server...
connect.authorizing=Logging in...
connect.failed=Failed to connect to the server
disconnect.genericReason=%s
disconnect.disconnected=Disconnected by Server
disconnect.lost=Connection Lost
disconnect.kicked=Was kicked from the game
disconnect.timeout=Timed out
disconnect.closed=Connection closed
disconnect.loginFailed=Failed to login
disconnect.loginFailedInfo=Failed to login: %s
disconnect.quitting=Quitting
disconnect.endOfStream=End of stream
disconnect.overflow=Buffer overflow
disconnect.spam=Kicked for spamming
options.off=OFF
options.on=ON
options.visible=Shown
options.hidden=Hidden
options.title=Options
options.controls=Controls...
options.video=Video Settings...
options.language=Language...
options.languageWarning=Language translations may not be 100% accurate
options.videoTitle=Video Settings
options.music=Music
options.sound=Sound
options.invertMouse=Invert Mouse
options.fov=FOV
options.fov.min=Normal
options.fov.max=Quake Pro
options.gamma=Brightness
options.gamma.min=Moody
options.gamma.max=Bright
options.sensitivity=Sensitivity
options.sensitivity.min=*yawn*
options.sensitivity.max=HYPERSPEED!!!
options.renderDistance=Render Distance
options.renderDistance.tiny=Tiny
options.renderDistance.short=Short
options.renderDistance.normal=Normal
options.renderDistance.far=Far
options.viewBobbing=View Bobbing
options.ao=Smooth Lighting
options.anaglyph=3D Anaglyph
options.framerateLimit=Performance
options.difficulty=Difficulty
options.difficulty.peaceful=Peaceful
options.difficulty.easy=Easy
options.difficulty.normal=Normal
options.difficulty.hard=Hard
options.difficulty.hardcore=Hardcore
options.graphics=Graphics
options.graphics.fancy=Fancy
options.graphics.fast=Fast
options.guiScale=GUI Scale
options.guiScale.auto=Auto
options.guiScale.small=Small
options.guiScale.normal=Normal
options.guiScale.large=Large
options.advancedOpengl=Advanced OpenGL
options.renderClouds=Clouds
options.farWarning1=A 64 bit Java installation is recommended
options.farWarning2=for 'Far' render distance (you have 32 bit)
options.particles=Particles
options.particles.all=All
options.particles.decreased=Decreased
options.particles.minimal=Minimal
options.chat.title=Chat Settings...
options.chat.visibility=Chat
options.chat.visibility.full=Shown
options.chat.visibility.system=Commands Only
options.chat.visibility.hidden=Hidden
options.chat.color=Colors
options.chat.opacity=Opacity
options.chat.links=Web Links
options.chat.links.prompt=Prompt on Links
options.serverTextures=Server Textures
options.snooper=Allow Snooper
options.snooper.view=Snooper Settings...
options.snooper.title=Machine Specs Collection
options.snooper.desc=We want to collect information about your machine to help improve Minecraft by knowing what we can support and where the biggest problems are. All of this information is completely anonymous and viewable below. We promise we won't do anything bad with this data, but if you want to opt out then feel free to toggle it off!
options.fullscreen=Fullscreen
options.vsync=Use VSync
performance.max=Max FPS
performance.balanced=Balanced
performance.powersaver=Power saver
controls.title=Controls
key.forward=Forward
key.left=Left
key.back=Back
key.right=Right
key.jump=Jump
key.inventory=Inventory
key.drop=Drop
key.chat=Chat
key.fog=Toggle Fog
key.sneak=Sneak
key.playerlist=List Players
key.attack=Attack
key.use=Use Item
key.pickItem=Pick Block
key.mouseButton=Button %d
key.command=Command
texturePack.openFolder=Open texture pack folder
texturePack.title=Select Texture Pack
texturePack.folderInfo=(Place texture pack files here)
book.pageIndicator=Page %s of %s
book.byAuthor=by %s
book.signButton=Sign
book.editTitle=Enter Book Title:
book.finalizeButton=Sign and Close
book.finalizeWarning=Note! When you sign the book, it will no longer be editable.
tile.stone.name=Stone
tile.grass.name=Grass Block
tile.dirt.name=Dirt
tile.stonebrick.name=Cobblestone
tile.wood.name=Wooden Planks
tile.wood.oak.name=Oak Wood Planks
tile.wood.spruce.name=Spruce Wood Planks
tile.wood.birch.name=Birch Wood Planks
tile.wood.jungle.name=Jungle Wood Planks
tile.sapling.oak.name=Oak Sapling
tile.sapling.spruce.name=Spruce Sapling
tile.sapling.birch.name=Birch Sapling
tile.sapling.jungle.name=Jungle Sapling
tile.deadbush.name=Dead Bush
tile.bedrock.name=Bedrock
tile.water.name=Water
tile.lava.name=Lava
tile.sand.name=Sand
tile.sandStone.name=Sandstone
tile.sandStone.default.name=Sandstone
tile.sandStone.chiseled.name=Chiseled Sandstone
tile.sandStone.smooth.name=Smooth Sandstone
tile.gravel.name=Gravel
tile.oreGold.name=Gold Ore
tile.oreIron.name=Iron Ore
tile.oreCoal.name=Coal Ore
tile.log.name=Wood
tile.log.oak.name=Oak Wood
tile.log.spruce.name=Spruce Wood
tile.log.birch.name=Birch Wood
tile.log.jungle.name=Jungle Wood
tile.leaves.name=Leaves
tile.leaves.oak.name=Oak Leaves
tile.leaves.spruce.name=Spruce Leaves
tile.leaves.birch.name=Birch Leaves
tile.leaves.jungle.name=Jungle Leaves
tile.tallgrass.name=Grass
tile.tallgrass.shrub.name=Shrub
tile.tallgrass.grass.name=Grass
tile.tallgrass.fern.name=Fern
tile.sponge.name=Sponge
tile.glass.name=Glass
tile.thinGlass.name=Glass Pane
tile.cloth.name=Wool
tile.flower.name=Flower
tile.rose.name=Rose
tile.mushroom.name=Mushroom
tile.blockGold.name=Block of Gold
tile.blockIron.name=Block of Iron
tile.stoneSlab.stone.name=Stone Slab
tile.stoneSlab.sand.name=Sandstone Slab
tile.stoneSlab.wood.name=Wooden Slab
tile.stoneSlab.cobble.name=Cobblestone Slab
tile.stoneSlab.brick.name=Bricks Slab
tile.stoneSlab.smoothStoneBrick.name=Stone Bricks Slab
tile.woodSlab.oak.name=Oak Wood Slab
tile.woodSlab.spruce.name=Spruce Wood Slab
tile.woodSlab.birch.name=Birch Wood Slab
tile.woodSlab.jungle.name=Jungle Wood Slab
tile.brick.name=Bricks
tile.tnt.name=TNT
tile.bookshelf.name=Bookshelf
tile.stoneMoss.name=Moss Stone
tile.obsidian.name=Obsidian
tile.torch.name=Torch
tile.fire.name=Fire
tile.mobSpawner.name=Monster Spawner
tile.stairsWood.name=Oak Wood Stairs
tile.stairsWoodSpruce.name=Spruce Wood Stairs
tile.stairsWoodBirch.name=Birch Wood Stairs
tile.stairsWoodJungle.name=Jungle Wood Stairs
tile.chest.name=Chest
tile.redstoneDust.name=Redstone Dust
tile.oreDiamond.name=Diamond Ore
tile.blockDiamond.name=Block of Diamond
tile.workbench.name=Crafting Table
tile.crops.name=Crops
tile.farmland.name=Farmland
tile.furnace.name=Furnace
tile.sign.name=Sign
tile.doorWood.name=Wooden Door
tile.ladder.name=Ladder
tile.rail.name=Rail
tile.goldenRail.name=Powered Rail
tile.detectorRail.name=Detector Rail
tile.stairsStone.name=Stone Stairs
tile.stairsSandStone.name=Sandstone Stairs
tile.lever.name=Lever
tile.pressurePlate.name=Pressure Plate
tile.doorIron.name=Iron Door
tile.oreRedstone.name=Redstone Ore
tile.notGate.name=Redstone Torch
tile.button.name=Button
tile.snow.name=Snow
tile.ice.name=Ice
tile.cactus.name=Cactus
tile.clay.name=Clay
tile.reeds.name=Sugar cane
tile.jukebox.name=Jukebox
tile.fence.name=Fence
tile.fenceGate.name=Fence Gate
tile.pumpkin.name=Pumpkin
tile.litpumpkin.name=Jack 'o' Lantern
tile.hellrock.name=Netherrack
tile.hellsand.name=Soul Sand
tile.lightgem.name=Glowstone
tile.portal.name=Portal
tile.cloth.black.name=Black Wool
tile.cloth.red.name=Red Wool
tile.cloth.green.name=Green Wool
tile.cloth.brown.name=Brown Wool
tile.cloth.blue.name=Blue Wool
tile.cloth.purple.name=Purple Wool
tile.cloth.cyan.name=Cyan Wool
tile.cloth.silver.name=Light Gray Wool
tile.cloth.gray.name=Gray Wool
tile.cloth.pink.name=Pink Wool
tile.cloth.lime.name=Lime Wool
tile.cloth.yellow.name=Yellow Wool
tile.cloth.lightBlue.name=Light Blue Wool
tile.cloth.magenta.name=Magenta Wool
tile.cloth.orange.name=Orange Wool
tile.cloth.white.name=Wool
tile.oreLapis.name=Lapis Lazuli Ore
tile.blockLapis.name=Lapis Lazuli Block
tile.dispenser.name=Dispenser
tile.musicBlock.name=Note Block
tile.cake.name=Cake
tile.bed.name=Bed
tile.bed.occupied=This bed is occupied
tile.bed.noSleep=You can only sleep at night
tile.bed.notSafe=You may not rest now, there are monsters nearby
tile.bed.notValid=Your home bed was missing or obstructed
tile.lockedchest.name=Locked chest
tile.trapdoor.name=Trapdoor
tile.web.name=Cobweb
tile.stonebricksmooth.name=Stone Bricks
tile.stonebricksmooth.default.name=Stone Bricks
tile.stonebricksmooth.mossy.name=Mossy Stone Bricks
tile.stonebricksmooth.cracked.name=Cracked Stone Bricks
tile.stonebricksmooth.chiseled.name=Chiseled Stone Bricks
tile.monsterStoneEgg.stone.name=Stone Monster Egg
tile.monsterStoneEgg.cobble.name=Cobblestone Monster Egg
tile.monsterStoneEgg.brick.name=Stone Brick Monster Egg
tile.pistonBase.name=Piston
tile.pistonStickyBase.name=Sticky Piston
tile.fenceIron.name=Iron Bars
tile.melon.name=Melon
tile.stairsBrick.name=Brick Stairs
tile.stairsStoneBrickSmooth.name=Stone Brick Stairs
tile.vine.name=Vines
tile.netherBrick.name=Nether Brick
tile.netherFence.name=Nether Brick Fence
tile.stairsNetherBrick.name=Nether Brick Stairs
tile.netherStalk.name=Nether Wart
tile.cauldron.name=Cauldron
tile.enchantmentTable.name=Enchantment Table
tile.whiteStone.name=End Stone
tile.endPortalFrame.name=End Portal
tile.mycel.name=Mycelium
tile.waterlily.name=Lily Pad
tile.dragonEgg.name=Dragon Egg
tile.redstoneLight.name=Redstone Lamp
tile.cocoa.name=Cocoa
tile.enderChest.name=Ender Chest
tile.oreRuby.name=Ruby Ore
tile.oreEmerald.name=Emerald Ore
tile.blockEmerald.name=Block of Emerald
tile.tripWire.name=Tripwire
tile.tripWireSource.name=Tripwire Hook
item.shovelIron.name=Iron Shovel
item.pickaxeIron.name=Iron Pickaxe
item.hatchetIron.name=Iron Axe
item.flintAndSteel.name=Flint and Steel
item.apple.name=Apple
item.cookie.name=Cookie
item.bow.name=Bow
item.arrow.name=Arrow
item.coal.name=Coal
item.charcoal.name=Charcoal
item.diamond.name=Diamond
item.emerald.name=Emerald
item.ingotIron.name=Iron Ingot
item.ingotGold.name=Gold Ingot
item.swordIron.name=Iron Sword
item.swordWood.name=Wooden Sword
item.shovelWood.name=Wooden Shovel
item.pickaxeWood.name=Wooden Pickaxe
item.hatchetWood.name=Wooden Axe
item.swordStone.name=Stone Sword
item.shovelStone.name=Stone Shovel
item.pickaxeStone.name=Stone Pickaxe
item.hatchetStone.name=Stone Axe
item.swordDiamond.name=Diamond Sword
item.shovelDiamond.name=Diamond Shovel
item.pickaxeDiamond.name=Diamond Pickaxe
item.hatchetDiamond.name=Diamond Axe
item.stick.name=Stick
item.bowl.name=Bowl
item.mushroomStew.name=Mushroom Stew
item.swordGold.name=Golden Sword
item.shovelGold.name=Golden Shovel
item.pickaxeGold.name=Golden Pickaxe
item.hatchetGold.name=Golden Axe
item.string.name=String
item.feather.name=Feather
item.sulphur.name=Gunpowder
item.hoeWood.name=Wooden Hoe
item.hoeStone.name=Stone Hoe
item.hoeIron.name=Iron Hoe
item.hoeDiamond.name=Diamond Hoe
item.hoeGold.name=Golden Hoe
item.seeds.name=Seeds
item.seeds_pumpkin.name=Pumpkin Seeds
item.seeds_melon.name=Melon Seeds
item.melon.name=Melon
item.wheat.name=Wheat
item.bread.name=Bread
item.helmetCloth.name=Leather Cap
item.chestplateCloth.name=Leather Tunic
item.leggingsCloth.name=Leather Pants
item.bootsCloth.name=Leather Boots
item.helmetChain.name=Chain Helmet
item.chestplateChain.name=Chain Chestplate
item.leggingsChain.name=Chain Leggings
item.bootsChain.name=Chain Boots
item.helmetIron.name=Iron Helmet
item.chestplateIron.name=Iron Chestplate
item.leggingsIron.name=Iron Leggings
item.bootsIron.name=Iron Boots
item.helmetDiamond.name=Diamond Helmet
item.chestplateDiamond.name=Diamond Chestplate
item.leggingsDiamond.name=Diamond Leggings
item.bootsDiamond.name=Diamond Boots
item.helmetGold.name=Golden Helmet
item.chestplateGold.name=Golden Chestplate
item.leggingsGold.name=Golden Leggings
item.bootsGold.name=Golden Boots
item.flint.name=Flint
item.porkchopRaw.name=Raw Porkchop
item.porkchopCooked.name=Cooked Porkchop
item.chickenRaw.name=Raw Chicken
item.chickenCooked.name=Cooked Chicken
item.beefRaw.name=Raw Beef
item.beefCooked.name=Steak
item.painting.name=Painting
item.appleGold.name=Golden Apple
item.sign.name=Sign
item.doorWood.name=Wooden Door
item.bucket.name=Bucket
item.bucketWater.name=Water Bucket
item.bucketLava.name=Lava Bucket
item.minecart.name=Minecart
item.saddle.name=Saddle
item.doorIron.name=Iron Door
item.redstone.name=Redstone
item.snowball.name=Snowball
item.boat.name=Boat
item.leather.name=Leather
item.milk.name=Milk
item.brick.name=Brick
item.clay.name=Clay
item.reeds.name=Sugar Canes
item.paper.name=Paper
item.book.name=Book
item.slimeball.name=Slimeball
item.minecartChest.name=Minecart with Chest
item.minecartFurnace.name=Minecart with Furnace
item.egg.name=Egg
item.compass.name=Compass
item.fishingRod.name=Fishing Rod
item.clock.name=Clock
item.yellowDust.name=Glowstone Dust
item.fishRaw.name=Raw Fish
item.fishCooked.name=Cooked Fish
item.record.name=Music Disc
item.bone.name=Bone
item.dyePowder.black.name=Ink Sac
item.dyePowder.red.name=Rose Red
item.dyePowder.green.name=Cactus Green
item.dyePowder.brown.name=Cocoa Beans
item.dyePowder.blue.name=Lapis Lazuli
item.dyePowder.purple.name=Purple Dye
item.dyePowder.cyan.name=Cyan Dye
item.dyePowder.silver.name=Light Gray Dye
item.dyePowder.gray.name=Gray Dye
item.dyePowder.pink.name=Pink Dye
item.dyePowder.lime.name=Lime Dye
item.dyePowder.yellow.name=Dandelion Yellow
item.dyePowder.lightBlue.name=Light Blue Dye
item.dyePowder.magenta.name=Magenta Dye
item.dyePowder.orange.name=Orange Dye
item.dyePowder.white.name=Bone Meal
item.sugar.name=Sugar
item.cake.name=Cake
item.bed.name=Bed
item.diode.name=Redstone Repeater
item.map.name=Map
item.leaves.name=Leaves
item.shears.name=Shears
item.rottenFlesh.name=Rotten Flesh
item.enderPearl.name=Ender Pearl
item.blazeRod.name=Blaze Rod
item.ghastTear.name=Ghast Tear
item.netherStalkSeeds.name=Nether Wart
item.potion.name=Potion
item.emptyPotion.name=Water Bottle
item.goldNugget.name=Gold Nugget
item.glassBottle.name=Glass Bottle
item.spiderEye.name=Spider Eye
item.fermentedSpiderEye.name=Fermented Spider Eye
item.blazePowder.name=Blaze Powder
item.magmaCream.name=Magma Cream
item.cauldron.name=Cauldron
item.brewingStand.name=Brewing Stand
item.eyeOfEnder.name=Eye of Ender
item.speckledMelon.name=Glistering Melon
item.monsterPlacer.name=Spawn
item.expBottle.name=Bottle o' Enchanting
item.fireball.name=Fire Charge
item.writingBook.name=Book and Quill
item.writtenBook.name=Written Book
item.ruby.name=Ruby
container.inventory=Inventory
container.crafting=Crafting
container.dispenser=Dispenser
container.furnace=Furnace
container.enchant=Enchant
container.creative=Item Selection
container.brewing=Brewing Stand
container.chest=Chest
container.chestDouble=Large Chest
container.minecart=Minecart
container.enderchest=Ender Chest
entity.Item.name=Item
entity.XPOrb.name=Experience Orb
entity.Arrow.name=Arrow
entity.Snowball.name=Snowball
entity.Painting.name=Painting
entity.Mob.name=Mob
entity.Monster.name=Monster
entity.Creeper.name=Creeper
entity.Skeleton.name=Skeleton
entity.Spider.name=Spider
entity.Giant.name=Giant
entity.Zombie.name=Zombie
entity.Slime.name=Slime
entity.Ghast.name=Ghast
entity.PigZombie.name=Zombie Pigman
entity.Enderman.name=Enderman
entity.Silverfish.name=Silverfish
entity.CaveSpider.name=Cave Spider
entity.Blaze.name=Blaze
entity.LavaSlime.name=Magma Cube
entity.MushroomCow.name=Mooshroom
entity.Villager.name=Villager
entity.VillagerGolem.name=Iron Golem
entity.SnowMan.name=Snow Golem
entity.EnderDragon.name=Ender Dragon
entity.Pig.name=Pig
entity.Sheep.name=Sheep
entity.Cow.name=Cow
entity.Chicken.name=Chicken
entity.Squid.name=Squid
entity.Wolf.name=Wolf
entity.Ozelot.name=Ocelot
entity.Cat.name=Cat
entity.PrimedTnt.name=Block of TNT
entity.FallingSand.name=Falling Block
entity.Minecart.name=Minecart
entity.Boat.name=Boat
entity.Arrow.name=arrow
entity.generic.name=unknown
death.inFire=%s went up in flames
death.onFire=%s burned to death
death.lava=%s tried to swim in lava
death.inWall=%s suffocated in a wall
death.drown=%s drowned
death.starve=%s starved to death
death.cactus=%s was pricked to death
death.fall=%s hit the ground too hard
death.outOfWorld=%s fell out of the world
death.generic=%s died
death.explosion=%s blew up
death.magic=%s was killed by magic
death.mob=%s was slain by %s
death.player=%s was slain by %s
death.arrow=%s was shot by %s
death.fireball=%s was fireballed by %s
death.thrown=%s was pummeled by %s
death.indirectMagic=%s was killed by %s
deathScreen.respawn=Respawn
deathScreen.deleteWorld=Delete world
deathScreen.titleScreen=Title screen
deathScreen.score=Score
deathScreen.title.hardcore=Game over!
deathScreen.hardcoreInfo=You cannot respawn in hardcore mode!
deathScreen.title=You died!
deathScreen.leaveServer=Leave server
potion.empty=No Effects
potion.moveSpeed=Speed
potion.moveSlowdown=Slowness
potion.digSpeed=Haste
potion.digSlowDown=Mining Fatigue
potion.damageBoost=Strength
potion.weakness=Weakness
potion.heal=Instant Health
potion.harm=Instant Damage
potion.jump=Jump Boost
potion.confusion=Nausea
potion.regeneration=Regeneration
potion.resistance=Resistance
potion.fireResistance=Fire Resistance
potion.waterBreathing=Water Breathing
potion.invisibility=Invisibility
potion.blindness=Blindness
potion.nightVision=Night Vision
potion.hunger=Hunger
potion.poison=Poison
potion.moveSpeed.postfix=Potion of Swiftness
potion.moveSlowdown.postfix=Potion of Slowness
potion.digSpeed.postfix=Potion of Haste
potion.digSlowDown.postfix=Potion of Dullness
potion.damageBoost.postfix=Potion of Strength
potion.weakness.postfix=Potion of Weakness
potion.heal.postfix=Potion of Healing
potion.harm.postfix=Potion of Harming
potion.jump.postfix=Potion of Leaping
potion.confusion.postfix=Potion of Nausea
potion.regeneration.postfix=Potion of Regeneration
potion.resistance.postfix=Potion of Resistance
potion.fireResistance.postfix=Potion of Fire Resistance
potion.waterBreathing.postfix=Potion of Water Breathing
potion.invisibility.postfix=Potion of Invisibility
potion.blindness.postfix=Potion of Blindness
potion.nightVision.postfix=Potion of Night Vision
potion.hunger.postfix=Potion of Hunger
potion.poison.postfix=Potion of Poison
potion.potency.0=
potion.potency.1=II
potion.potency.2=III
potion.potency.3=IV
potion.prefix.grenade=Splash
potion.prefix.mundane=Mundane
potion.prefix.uninteresting=Uninteresting
potion.prefix.bland=Bland
potion.prefix.clear=Clear
potion.prefix.milky=Milky
potion.prefix.diffuse=Diffuse
potion.prefix.artless=Artless
potion.prefix.thin=Thin
potion.prefix.awkward=Awkward
potion.prefix.flat=Flat
potion.prefix.bulky=Bulky
potion.prefix.bungling=Bungling
potion.prefix.buttered=Buttered
potion.prefix.smooth=Smooth
potion.prefix.suave=Suave
potion.prefix.debonair=Debonair
potion.prefix.thick=Thick
potion.prefix.elegant=Elegant
potion.prefix.fancy=Fancy
potion.prefix.charming=Charming
potion.prefix.dashing=Dashing
potion.prefix.refined=Refined
potion.prefix.cordial=Cordial
potion.prefix.sparkling=Sparkling
potion.prefix.potent=Potent
potion.prefix.foul=Foul
potion.prefix.odorless=Odorless
potion.prefix.rank=Rank
potion.prefix.harsh=Harsh
potion.prefix.acrid=Acrid
potion.prefix.gross=Gross
potion.prefix.stinky=Stinky
enchantment.damage.all=Sharpness
enchantment.damage.undead=Smite
enchantment.damage.arthropods=Bane of Arthropods
enchantment.knockback=Knockback
enchantment.fire=Fire Aspect
enchantment.protect.all=Protection
enchantment.protect.fire=Fire Protection
enchantment.protect.fall=Feather Falling
enchantment.protect.explosion=Blast Protection
enchantment.protect.projectile=Projectile Protection
enchantment.oxygen=Respiration
enchantment.waterWorker=Aqua Affinity
enchantment.digging=Efficiency
enchantment.untouching=Silk Touch
enchantment.durability=Unbreaking
enchantment.lootBonus=Looting
enchantment.lootBonusDigger=Fortune
enchantment.arrowDamage=Power
enchantment.arrowFire=Flame
enchantment.arrowKnockback=Punch
enchantment.arrowInfinite=Infinity
enchantment.level.1=I
enchantment.level.2=II
enchantment.level.3=III
enchantment.level.4=IV
enchantment.level.5=V
enchantment.level.6=VI
enchantment.level.7=VII
enchantment.level.8=VIII
enchantment.level.9=IX
enchantment.level.10=X
gui.achievements=Achievements
gui.stats=Statistics
stat.generalButton=General
stat.blocksButton=Blocks
stat.itemsButton=Items
stat.used=Times Used
stat.mined=Times Mined
stat.depleted=Times Depleted
stat.crafted=Times Crafted
stat.startGame=Times played
stat.createWorld=Worlds played
stat.loadWorld=Saves loaded
stat.joinMultiplayer=Multiplayer joins
stat.leaveGame=Games quit
stat.playOneMinute=Minutes Played
stat.walkOneCm=Distance Walked
stat.fallOneCm=Distance Fallen
stat.swimOneCm=Distance Swum
stat.flyOneCm=Distance Flown
stat.climbOneCm=Distance Climbed
stat.diveOneCm=Distance Dove
stat.minecartOneCm=Distance by Minecart
stat.boatOneCm=Distance by Boat
stat.pigOneCm=Distance by Pig
stat.jump=Jumps
stat.drop=Items Dropped
stat.damageDealt=Damage Dealt
stat.damageTaken=Damage Taken
stat.deaths=Number of Deaths
stat.mobKills=Mob Kills
stat.playerKills=Player Kills
stat.fishCaught=Fish Caught
stat.mineBlock=%s Mined
stat.craftItem=%s Crafted
stat.useItem=%s Used
stat.breakItem=%s Depleted
achievement.get=Achievement get!
achievement.taken=Taken!
achievement.requires=Requires '%s'
achievement.openInventory=Taking Inventory
achievement.openInventory.desc=Press 'E' to open your inventory.
achievement.mineWood=Getting Wood
achievement.mineWood.desc=Attack a tree until a block of wood pops out
achievement.buildWorkBench=Benchmarking
achievement.buildWorkBench.desc=Craft a workbench with four blocks of planks
achievement.buildPickaxe=Time to Mine!
achievement.buildPickaxe.desc=Use planks and sticks to make a pickaxe
achievement.buildFurnace=Hot Topic
achievement.buildFurnace.desc=Construct a furnace out of eight stone blocks
achievement.acquireIron=Acquire Hardware
achievement.acquireIron.desc=Smelt an iron ingot
achievement.buildHoe=Time to Farm!
achievement.buildHoe.desc=Use planks and sticks to make a hoe
achievement.makeBread=Bake Bread
achievement.makeBread.desc=Turn wheat into bread
achievement.bakeCake=The Lie
achievement.bakeCake.desc=Wheat, sugar, milk and eggs!
achievement.buildBetterPickaxe=Getting an Upgrade
achievement.buildBetterPickaxe.desc=Construct a better pickaxe
achievement.cookFish=Delicious Fish
achievement.cookFish.desc=Catch and cook fish!
achievement.onARail=On A Rail
achievement.onARail.desc=Travel by minecart at least 1 km from where you started
achievement.buildSword=Time to Strike!
achievement.buildSword.desc=Use planks and sticks to make a sword
achievement.killEnemy=Monster Hunter
achievement.killEnemy.desc=Attack and destroy a monster
achievement.killCow=Cow Tipper
achievement.killCow.desc=Harvest some leather
achievement.flyPig=When Pigs Fly
achievement.flyPig.desc=Fly a pig off a cliff
achievement.snipeSkeleton=Sniper Duel
achievement.snipeSkeleton.desc=Kill a skeleton with an arrow from more than 50 meters
achievement.diamonds=DIAMONDS!
achievement.diamonds.desc=Acquire diamonds with your iron tools
achievement.portal=We Need to Go Deeper
achievement.portal.desc=Build a portal to the Nether
achievement.ghast=Return to Sender
achievement.ghast.desc=Destroy a Ghast with a fireball
achievement.blazeRod=Into Fire
achievement.blazeRod.desc=Relieve a Blaze of its rod
achievement.potion=Local Brewery
achievement.potion.desc=Brew a potion
achievement.theEnd=The End?
achievement.theEnd.desc=Locate the End
achievement.theEnd2=The End.
achievement.theEnd2.desc=Defeat the Ender Dragon
achievement.enchantments=Enchanter
achievement.enchantments.desc=Use a book, obsidian and diamonds to construct an enchantment table
achievement.overkill=Overkill
achievement.overkill.desc=Deal eight hearts of damage in a single hit
achievement.bookcase=Librarian
achievement.bookcase.desc=Build some bookshelves to improve your enchantment table
commands.generic.exception=An unknown error occurred while attempting to perform this command
commands.generic.syntax=Invalid command syntax
commands.generic.player.notFound=That player cannot be found
commands.generic.notFound=Unknown command. Try /help for a list of commands.
commands.generic.num.invalid='%s' is not a valid number
commands.generic.num.tooSmall=The number you have entered (%d) is too small, it must be at least %d
commands.generic.num.tooBig=The number you have entered (%d) is too big, it must be at most %d
commands.generic.usage=Usage: %s
commands.xp.success=Given %d experience to %s
commands.xp.usage=/xp <amount> [player]
commands.give.usage=/give <player> <item> [amount] [data]
commands.give.notFound=There is no such item with ID %d
commands.give.success=Given %s (ID %d) * %d to %s
commands.downfall.success=Toggled downfall
commands.time.usage=/time <set|add> <value>
commands.time.added=Added %d to the time
commands.time.set=Set the time to %d
commands.players.list=There are %d/%d players online:
commands.banlist.ips=There are %d total banned IP addresses:
commands.banlist.players=There are %d total banned players:
commands.banlist.usage=/banlist [ips|players]
commands.kick.success=Kicked %s from the game
commands.kick.success.reason=Kicked %s from the game: '%s'
commands.kick.usage=/kick <player> [reason ...]
commands.op.success=Opped %s
commands.op.usage=/op <player>
commands.deop.success=De-opped %s
commands.deop.usage=/deop <player>
commands.say.usage=/say <message ...>
commands.ban.success=Banned player %s
commands.ban.usage=/ban <name> [reason ...]
commands.unban.success=Unbanned player %s
commands.unban.usage=/pardon <name>
commands.banip.invalid=You have entered an invalid IP address or a player that is not online
commands.banip.success=Banned IP address %s
commands.banip.success.players=Banned IP address %s belonging to %s
commands.banip.usage=/ban-ip <address|name> [reason ...]
commands.unbanip.invalid=You have entered an invalid IP address
commands.unbanip.success=Unbanned IP address %s
commands.unbanip.usage=/pardon-ip <address>
commands.save.enabled=Turned on world auto-saving
commands.save.disabled=Turned off world auto-saving
commands.save.start=Saving...
commands.save.success=Saved the world
commands.save.failed=Saving failed: %s
commands.stop.start=Stopping the server
commands.tp.success=Teleported %s to %s
commands.tp.coordinates=Teleported %s to %d,%d,%d
commands.tp.usage=/tp [target player] <destination player> OR /tp [target player] <x> <y> <z>
commands.whitelist.list=There are %d (out of %d seen) whitelisted players:
commands.whitelist.enabled=Turned on the whitelist
commands.whitelist.disabled=Turned off the whitelist
commands.whitelist.reloaded=Reloaded the whitelist
commands.whitelist.add.success=Added %s to the whitelist
commands.whitelist.add.usage=/whitelist add <player>
commands.whitelist.remove.success=Removed %s from the whitelist
commands.whitelist.remove.usage=/whitelist remove <player>
commands.whitelist.usage=/whitelist <on|off|list|add|remove|reload>
commands.gamemode.success.self=Set own game mode to %s
commands.gamemode.success.other=Set %s's game mode to %s
commands.gamemode.usage=/gamemode <mode> [player]
commands.defaultgamemode.usage=/defaultgamemode <mode>
commands.defaultgamemode.success=The world's default game mode is now %s
commands.me.usage=/me <action ...>
commands.help.header=--- Showing help page %d of %d (/help <page>) ---
commands.help.footer=Tip: Use the <tab> key while typing a command to auto-complete the command or its arguments
commands.help.usage=/help [page|command name]
commands.publish.started=Local game hosted on %s
commands.publish.failed=Unable to host local game
commands.debug.start=Started debug profiling
commands.debug.stop=Stopped debug profiling after %.2f seconds (%d ticks)
commands.debug.notStarted=Can't stop profiling when we haven't started yet!
commands.debug.usage=/debug <start|stop>
itemGroup.buildingBlocks=Building Blocks
itemGroup.decorations=Decoration Blocks
itemGroup.redstone=Redstone
itemGroup.transportation=Transportation
itemGroup.misc=Miscellaneous
itemGroup.search=Search Items
itemGroup.food=Foodstuffs
itemGroup.tools=Tools
itemGroup.combat=Combat
itemGroup.brewing=Brewing
itemGroup.materials=Materials
itemGroup.inventory=Survival Inventory
inventory.binSlot=Destroy Item

View file

@ -2,5 +2,5 @@
#include "ClientConstants.h"
const std::wstring ClientConstants::VERSION_STRING =
std::wstring(L"Minecraft Xbox ") +
VER_FILEVERSION_STR_W; //+ SharedConstants::VERSION_STRING;
std::wstring(L"Minecraft Xbox ") + VER_FILEVERSION_STR_W +
std::wstring(L" (4jcraft)"); //+ SharedConstants::VERSION_STRING;

View file

@ -237,7 +237,8 @@ void Options::toggle(const Options::Option* option, int dir) {
if (option == Option::RENDER_CLOUDS) renderClouds = !renderClouds;
if (option == Option::ADVANCED_OPENGL) {
advancedOpengl = !advancedOpengl;
minecraft->levelRenderer->allChanged();
// 4jcraft: ensure level exists before applying
if(minecraft->level) minecraft->levelRenderer->allChanged();
}
if (option == Option::ANAGLYPH) {
anaglyph3d = !anaglyph3d;
@ -254,11 +255,13 @@ void Options::toggle(const Options::Option* option, int dir) {
if (option == Option::GRAPHICS) {
fancyGraphics = !fancyGraphics;
minecraft->levelRenderer->allChanged();
// 4jcraft: ensure level exists before applying
if(minecraft->level) minecraft->levelRenderer->allChanged();
}
if (option == Option::AMBIENT_OCCLUSION) {
ambientOcclusion = !ambientOcclusion;
minecraft->levelRenderer->allChanged();
// 4jcraft: ensure level exists before applying
if(minecraft->level) minecraft->levelRenderer->allChanged();
}
// 4J-PB - don't do the file save on the xbox

View file

@ -1,6 +1,7 @@
#include "Platform/stdafx.h"
#include "Minecraft.h"
#include "GameState/GameMode.h"
#include "UI/Screens/PauseScreen.h"
#include "Utils/Timer.h"
#include "Rendering/EntityRenderers/ProgressRenderer.h"
#include "Rendering/LevelRenderer.h"
@ -28,6 +29,9 @@
#include "UI/Screens/ErrorScreen.h"
#include "UI/Screens/TitleScreen.h"
#include "UI/Screens/InventoryScreen.h"
#ifdef ENABLE_JAVA_GUIS
#include "UI/Screens/CreativeInventoryScreen.h"
#endif
#include "UI/Screens/InBedChatScreen.h"
#include "UI/Screens/AchievementPopup.h"
#include "Input/Input.h"
@ -420,7 +424,7 @@ void Minecraft::init() {
void Minecraft::renderLoadingScreen() {
// 4J Unused
// testing stuff on vita just now
#ifdef __PSVITA__
#if (defined(__PSVITA__) || defined(ENABLE_JAVA_GUIS))
ScreenSizeCalculator ssc(options, width, height);
// xxx
@ -463,7 +467,7 @@ void Minecraft::renderLoadingScreen() {
glEnable(GL_ALPHA_TEST);
glAlphaFunc(GL_GREATER, 0.1f);
Display::swapBuffers();
// Display::swapBuffers();
// xxx
RenderManager.Present();
#endif
@ -621,6 +625,55 @@ void Minecraft::destroy() {
// } catch (Throwable e) {
// }
if (screen == NULL && level == NULL) {
screen = new TitleScreen();
} else if (player != NULL && !ui.GetMenuDisplayed(player->GetXboxPad()) &&
player->getHealth() <= 0) {
#ifdef ENABLE_JAVA_GUIS
screen = new DeathScreen();
#else
// 4J Stu - If we exit from the death screen then we are saved as being
// dead. In the Java game when you load the game you are still dead, but
// this is silly so only show the dead screen if we have died during
// gameplay
if (ticks == 0) {
player->respawn();
} else {
ui.NavigateToScene(player->GetXboxPad(), eUIScene_DeathMenu, NULL);
}
#endif
}
if (screen != NULL && dynamic_cast<TitleScreen*>(screen) != NULL) {
options->renderDebug = false;
gui->clearMessages();
}
this->screen = screen;
if (screen != NULL) {
// releaseMouse(); // 4J - removed
ScreenSizeCalculator ssc(options, width, height);
int screenWidth = ssc.getWidth();
int screenHeight = ssc.getHeight();
screen->init(this, screenWidth, screenHeight);
noRender = false;
} else {
// grabMouse(); // 4J - removed
}
// 4J-PB - if a screen has been set, go into menu mode
// it's possible that player doesn't exist here yet
#ifdef ENABLE_JAVA_GUIS
if (screen != NULL) {
if (player && player->GetXboxPad() != -1) {
InputManager.SetMenuDisplayed(player->GetXboxPad(), true);
}
} else {
if (player && player->GetXboxPad() != -1) {
InputManager.SetMenuDisplayed(player->GetXboxPad(), false);
}
}
#endif
// try {
MemoryTracker::release();
// } catch (Throwable e) {
@ -1437,6 +1490,9 @@ void Minecraft::run_middle() {
1LL << MINECRAFT_ACTION_PAUSEMENU;
app.DebugPrintf(
"PAUSE PRESSED - ipad = %d, Storing press\n", i);
#ifdef ENABLE_JAVA_GUIS
pauseGame();
#endif
}
#ifdef _DURANGO
if (InputManager.ButtonPressed(i, ACTION_MENU_GTC_PAUSE))
@ -1900,6 +1956,10 @@ void Minecraft::run_middle() {
}
}
if (screen != NULL) {
screen->updateEvents();
}
ui.HandleGameTick();
setLocalPlayerIdx(ProfileManager.GetPrimaryPad());
@ -1919,7 +1979,8 @@ void Minecraft::run_middle() {
// setScreen(new LevelConflictScreen());
// }
// SparseLightStorage::tick();
// // 4J added CompressedTileStorage::tick(); // 4J added
// // 4J added
// CompressedTileStorage::tick(); // 4J added
// SparseDataStorage::tick();
// // 4J added
}
@ -2092,19 +2153,23 @@ void Minecraft::run_middle() {
if (width <= 0) width = 1;
if (height <= 0) height = 1;
resize(width, height);
}
}
*/
resize(width, height);
}
}
*/
MemSect(31);
checkGlError(L"Post render");
MemSect(0);
frames++;
// pause = !isClientSide() && screen != NULL &&
// screen->isPauseScreen(); pause = g_NetworkManager.IsLocalGame()
// && g_NetworkManager.GetPlayerCount() == 1 &&
// app.IsPauseMenuDisplayed(ProfileManager.GetPrimaryPad());
// screen->isPauseScreen();
#ifdef ENABLE_JAVA_GUIS
pause = g_NetworkManager.IsLocalGame() &&
g_NetworkManager.GetPlayerCount() == 1 &&
screen != nullptr && screen->isPauseScreen();
#else
pause = app.IsAppPaused();
#endif
#ifndef _CONTENT_PACKAGE
while (System::nanoTime() >= lastTime + 1000000000) {
@ -2251,9 +2316,16 @@ void Minecraft::stop() {
}
void Minecraft::pauseGame() {
if (screen != NULL) return;
// setScreen(new PauseScreen()); // 4J - TODO put back in
if (screen != NULL) {
// 4jcraft: Pass the keypress to the screen
// normally this would've been done in updateEvents(), but it works
// better here (for now atleast)
screen->keyPressed(0, Keyboard::KEY_ESCAPE);
return;
}
#ifdef ENABLE_JAVA_GUIS
setScreen(new PauseScreen()); // 4J - TODO put back in
#endif
}
bool Minecraft::pollResize() {
@ -2281,8 +2353,13 @@ void Minecraft::resize(int width, int height) {
this->height = height;
if (screen != NULL) {
// 4jcraft: use adjusted logical width instead of raw width for correct screen size calculation.
#ifdef _ENABLEIGGY
// 4jcraft: use adjusted logical width instead of raw width for correct
// screen size calculation.
ScreenSizeCalculator ssc(options, this->width, height);
#else
ScreenSizeCalculator ssc(options, width, height);
#endif
int screenWidth = ssc.getWidth();
int screenHeight = ssc.getHeight();
// screen->init(this, screenWidth, screenHeight); // 4J -
@ -2326,7 +2403,8 @@ void Minecraft::levelTickThreadInitFunc() {
// textures are to be updated - this will be true for the last time this tick
// runs with bFirst true
void Minecraft::tick(bool bFirst, bool bUpdateTextures) {
int iPad = player->GetXboxPad();
int iPad = -1;
if (player) iPad = player->GetXboxPad();
// OutputDebugString("Minecraft::tick\n");
// 4J-PB - only tick this player's stats
@ -2392,18 +2470,21 @@ void Minecraft::tick(bool bFirst, bool bUpdateTextures) {
setScreen(NULL);
}
if (screen != NULL) {
player->missTime = 10000;
player->lastClickTick[0] = ticks + 10000;
player->lastClickTick[1] = ticks + 10000;
}
// if (screen != NULL) {
// player->missTime = 10000;
// player->lastClickTick[0] = ticks + 10000;
// player->lastClickTick[1] = ticks + 10000;
// }
if (screen != NULL) {
InputManager.SetMenuDisplayed(player->GetXboxPad(), true);
screen->updateEvents();
if (screen != NULL) {
screen->particles->tick();
screen->tick();
}
} else {
InputManager.SetMenuDisplayed(player->GetXboxPad(), false);
}
if (screen == NULL && !ui.GetMenuDisplayed(iPad)) {
@ -3589,7 +3670,14 @@ void Minecraft::tick(bool bFirst, bool bUpdateTextures) {
std::dynamic_pointer_cast<LocalPlayer>(
Minecraft::GetInstance()->player);
ui.PlayUISFX(eSFX_Press);
#ifdef ENABLE_JAVA_GUIS
if (gameMode->hasInfiniteItems())
setScreen(new CreativeInventoryScreen(player));
else
setScreen(new InventoryScreen(player));
#else
app.LoadInventoryMenu(iPad, player);
#endif
}
if ((player->ullButtonsPressed & (1LL << MINECRAFT_ACTION_CRAFTING)) &&
@ -3636,7 +3724,9 @@ void Minecraft::tick(bool bFirst, bool bUpdateTextures) {
"PAUSE PRESS PROCESSING - ipad = %d, NavigateToScene\n",
player->GetXboxPad());
ui.PlayUISFX(eSFX_Press);
#ifndef ENABLE_JAVA_GUIS
ui.NavigateToScene(iPad, eUIScene_PauseMenu, NULL, eUILayer_Scene);
#endif
}
if ((player->ullButtonsPressed & (1LL << MINECRAFT_ACTION_DROP)) &&
@ -3694,10 +3784,10 @@ void Minecraft::tick(bool bFirst, bool bUpdateTextures) {
}
} else {
// 4J-PB
if (InputManager.GetValue(iPad, ACTION_MENU_CANCEL) > 0 &&
gameMode->isInputAllowed(ACTION_MENU_CANCEL)) {
setScreen(NULL);
}
// if (InputManager.GetValue(iPad, ACTION_MENU_CANCEL) > 0 &&
// gameMode->isInputAllowed(ACTION_MENU_CANCEL)) {
// setScreen(NULL);
// }
}
// monitor for keyboard input

View file

@ -33,6 +33,9 @@ ControllerTask::ControllerTask(Tutorial *tutorial, int descriptionId, bool enabl
// If we don't want to be able to complete it early..then assume we want the constraints active
//if( !enablePreCompletion )
// enableConstraints( true );
m_initialized = false; // we can set yaw + pitch on the first tick
}
ControllerTask::~ControllerTask()
@ -42,69 +45,64 @@ ControllerTask::~ControllerTask()
bool ControllerTask::isCompleted()
{
if( bIsCompleted )
return true;
if (bIsCompleted)
return true;
bool bAllComplete = true;
Minecraft *pMinecraft = Minecraft::GetInstance();
Minecraft *pMinecraft = Minecraft::GetInstance();
int iCurrent=0;
// mouse look check
if (!m_initialized) {
m_lastYaw = pMinecraft->player->yRot;
m_lastPitch = pMinecraft->player->xRot;
m_initialized = true;
} else {
float deltaYaw = fabs(pMinecraft->player->yRot - m_lastYaw);
float deltaPitch = fabs(pMinecraft->player->xRot - m_lastPitch);
m_lastYaw = pMinecraft->player->yRot;
m_lastPitch = pMinecraft->player->xRot;
if(m_bHasSouthpaw && app.GetGameSettings(pMinecraft->player->GetXboxPad(),eGameSetting_ControlSouthPaw))
{
for(AUTO_VAR(it, southpawCompletedMappings.begin()); it != southpawCompletedMappings.end(); ++it)
{
bool current = (*it).second;
if(!current)
{
// TODO Use a different pad
if( InputManager.GetValue(pMinecraft->player->GetXboxPad(), (*it).first) > 0 )
{
(*it).second = true;
m_uiCompletionMask|=1<<iCurrent;
}
else
{
bAllComplete = false;
}
}
iCurrent++;
}
}
else
{
for(AUTO_VAR(it, completedMappings.begin()); it != completedMappings.end(); ++it)
{
bool current = (*it).second;
if(!current)
{
// TODO Use a different pad
if( InputManager.GetValue(pMinecraft->player->GetXboxPad(), (*it).first) > 0 )
{
(*it).second = true;
m_uiCompletionMask|=1<<iCurrent;
}
else
{
bAllComplete = false;
}
}
iCurrent++;
}
}
const float LOOK_THRESHOLD = 0.1f;
if (deltaYaw > LOOK_THRESHOLD || deltaPitch > LOOK_THRESHOLD)
return true;
}
// If this has a list of completion masks then check if there is a matching one to mark the task as complete
if(m_iCompletionMaskA && CompletionMaskIsValid())
{
bIsCompleted = true;
}
else
{
bIsCompleted = bAllComplete;
}
// check for controller button input
bool bAllComplete = true;
int iCurrent = 0;
return bIsCompleted;
if (m_bHasSouthpaw && app.GetGameSettings(pMinecraft->player->GetXboxPad(), eGameSetting_ControlSouthPaw)) {
for (auto it = southpawCompletedMappings.begin(); it != southpawCompletedMappings.end(); ++it) {
if (!it->second) {
if (InputManager.GetValue(pMinecraft->player->GetXboxPad(), it->first) > 0) {
it->second = true;
m_uiCompletionMask |= 1 << iCurrent;
} else {
bAllComplete = false;
}
}
iCurrent++;
}
} else {
for (auto it = completedMappings.begin(); it != completedMappings.end(); ++it) {
if (!it->second) {
if (InputManager.GetValue(pMinecraft->player->GetXboxPad(), it->first) > 0) {
it->second = true;
m_uiCompletionMask |= 1 << iCurrent;
} else {
bAllComplete = false;
}
}
iCurrent++;
}
}
// completion mask check
if (m_iCompletionMaskA && CompletionMaskIsValid())
bIsCompleted = true;
else
bIsCompleted = bAllComplete;
return bIsCompleted;
}
bool ControllerTask::CompletionMaskIsValid()

View file

@ -14,6 +14,11 @@ private:
int *m_iCompletionMaskA;
int m_iCompletionMaskACount;
bool CompletionMaskIsValid();
// Mouse tracking for tutorial look-around task
float m_lastYaw;
float m_lastPitch;
bool m_initialized = false;
public:
ControllerTask(Tutorial *tutorial, int descriptionId, bool enablePreCompletion, bool showMinimumTime,
int mappings[], unsigned int mappingsLength, int iCompletionMaskA[]=NULL, int iCompletionMaskACount=0, int iSouthpawMappings[]=NULL, unsigned int uiSouthpawMappingsCount=0);

View file

@ -4,9 +4,12 @@
// 4J Stu - This class is for code that is common between XUI and Iggy
class SimpleContainer;
class CreativeInventoryScreen;
class IUIScene_CreativeMenu : public virtual IUIScene_AbstractContainerMenu
{
friend class CreativeInventoryScreen;
public:
// 4J Stu - These map directly to the tabs seenon the screen
enum ECreativeInventoryTabs

View file

@ -10,6 +10,7 @@
#include "../../Minecraft.World/Headers/net.minecraft.world.entity.boss.enderdragon.h"
#include "../../Minecraft.Client/Rendering/EntityRenderers/EnderDragonRenderer.h"
#include "../../Minecraft.Client/Player/MultiPlayerLocalPlayer.h"
#include "../../Minecraft.Client/UI/Screens/TitleScreen.h"
#include "UIFontData.h"
#ifdef __PSVITA__
#include <message_dialog.h>
@ -1596,6 +1597,9 @@ void UIController::NavigateToHomeMenu()
else
{
ui.NavigateToScene(ProfileManager.GetPrimaryPad(),eUIScene_MainMenu);
#ifdef ENABLE_JAVA_GUIS
pMinecraft->setScreen(new TitleScreen());
#endif
}
}

View file

@ -1806,7 +1806,7 @@ void UIScene_MainMenu::tick()
{
UIScene::tick();
#ifndef _ENABLEIGGY
#if !defined(_ENABLEIGGY) && !defined(ENABLE_JAVA_GUIS)
{
static int s_mainMenuTickCount = 0;
s_mainMenuTickCount++;

View file

@ -905,11 +905,13 @@ return -1;
app.InitialiseTips();
while (!RenderManager.ShouldClose()) {
RenderManager.StartFrame();
#ifdef _ENABLEIGGY
if (pMinecraft->pollResize()) {
int fbw, fbh;
RenderManager.GetFramebufferSize(fbw, fbh);
ui.setScreenSize(fbw, fbh);
}
#endif
app.UpdateTime();
PIXBeginNamedEvent(0, "Input manager tick");
InputManager.Tick();
@ -939,10 +941,14 @@ return -1;
PIXBeginNamedEvent(0, "Network manager do work #1");
g_NetworkManager.DoWork();
PIXEndNamedEvent();
// Render game graphics.
#ifdef ENABLE_JAVA_GUIS
pMinecraft->run_middle();
if (app.GetGameStarted()) {
#else
if (app.GetGameStarted()) {
pMinecraft->run_middle();
#endif
app.SetAppPaused(
g_NetworkManager.IsLocalGame() &&
g_NetworkManager.GetPlayerCount() == 1 &&

View file

@ -531,25 +531,37 @@ void LocalPlayer::closeContainer() {
}
void LocalPlayer::openTextEdit(std::shared_ptr<SignTileEntity> sign) {
#ifdef ENABLE_JAVA_GUIS
minecraft->setScreen(new TextEditScreen(sign));
bool success = true;
#else
bool success = app.LoadSignEntryMenu(GetXboxPad(), sign);
if (success) ui.PlayUISFX(eSFX_Press);
// minecraft->setScreen(new TextEditScreen(sign));
#endif
}
bool LocalPlayer::openContainer(std::shared_ptr<Container> container) {
#ifdef ENABLE_JAVA_GUIS
minecraft->setScreen(new ContainerScreen(inventory, container));
bool success = true;
#else
bool success = app.LoadContainerMenu(GetXboxPad(), inventory, container);
if (success) ui.PlayUISFX(eSFX_Press);
// minecraft->setScreen(new ContainerScreen(inventory, container));
#endif
return success;
}
bool LocalPlayer::startCrafting(int x, int y, int z) {
#ifdef ENABLE_JAVA_GUIS
minecraft->setScreen(new CraftingScreen(inventory, level, x, y, z));
bool success = true;
#else
bool success = app.LoadCrafting3x3Menu(
GetXboxPad(),
std::dynamic_pointer_cast<LocalPlayer>(shared_from_this()), x, y, z);
if (success) ui.PlayUISFX(eSFX_Press);
#endif
// app.LoadXuiCraftMenu(0,inventory, level, x, y, z);
// minecraft->setScreen(new CraftingScreen(inventory, level, x, y, z));
return success;
}
@ -562,17 +574,26 @@ bool LocalPlayer::startEnchanting(int x, int y, int z) {
}
bool LocalPlayer::startRepairing(int x, int y, int z) {
#ifdef ENABLE_JAVA_GUIS
// minecraft.setScreen(new RepairScreen(inventory, level, x, y, z));
// FUCK YOU 4J FIRST AND FOREMOST
bool success = true;
#else
bool success =
app.LoadRepairingMenu(GetXboxPad(), inventory, level, x, y, z);
if (success) ui.PlayUISFX(eSFX_Press);
// minecraft.setScreen(new RepairScreen(inventory, level, x, y, z));
#endif
return success;
}
bool LocalPlayer::openFurnace(std::shared_ptr<FurnaceTileEntity> furnace) {
#ifdef ENABLE_JAVA_GUIS
minecraft->setScreen(new FurnaceScreen(inventory, furnace));
bool success = true;
#else
bool success = app.LoadFurnaceMenu(GetXboxPad(), inventory, furnace);
if (success) ui.PlayUISFX(eSFX_Press);
// minecraft->setScreen(new FurnaceScreen(inventory, furnace));
#endif
return success;
}
@ -688,10 +709,12 @@ void LocalPlayer::awardStat(Stat* stat, byteArray param) {
// storage device, so needs a primary player, and the player may not
// have been a primary player when they first 'got' the award so let the
// award manager figure it out
// if (!minecraft->stats[m_iPad]->hasTaken(ach))
if (!minecraft->stats[m_iPad]->hasTaken(ach))
{
// 4J-PB - Don't display the java popup
// minecraft->achievementPopup->popup(ach);
#ifdef ENABLE_JAVA_GUIS
minecraft->achievementPopup->popup(ach);
#endif
// 4J Stu - Added this function in the libraries as some
// achievements don't get awarded to all players e.g. Splitscreen

View file

@ -317,6 +317,7 @@ void ItemRenderer::renderGuiItem(Font* font, Textures* textures,
std::shared_ptr<ItemInstance> item, float x,
float y, float fScaleX, float fScaleY,
float fAlpha, bool useCompiled) {
if (!item) return;
int itemId = item->id;
int itemAuxValue = item->getAuxValue();
Icon* itemIcon = item->getIcon();

View file

@ -1,6 +1,7 @@
#include "../Platform/stdafx.h"
#include "GameRenderer.h"
#include "EntityRenderers/ItemInHandRenderer.h"
#include "Input/Input.h"
#include "LevelRenderer.h"
#include "Frustum.h"
#include "FrustumCuller.h"
@ -923,7 +924,10 @@ void GameRenderer::updateLightTexture(float a) {
}
}
float brightness = 0.0f; // 4J - TODO - was mc->options->gamma;
float brightness =
mc->options->gamma; // 4jcraft: since the java UI has a
// brightness slider again, lets use it.
// it'll still be 0.0f for iggy UI anyway
if (_r > 1) _r = 1;
if (_g > 1) _g = 1;
if (_b > 1) _b = 1;
@ -1046,13 +1050,17 @@ void GameRenderer::render(float a, bool bFirst) {
int fbw, fbh;
RenderManager.GetFramebufferSize(fbw, fbh);
glViewport(0, 0, fbw, fbh);
#ifdef _ENABLEIGGY
// 4jcraft: use framebuffer dimensions for ScreenSizeCalculator so the
// title screen GUI coordinates match the actual viewport size.
ScreenSizeCalculator ssc(mc->options, fbw, fbh);
#else
ScreenSizeCalculator ssc(mc->options, mc->width, mc->height);
#endif
int screenWidth = ssc.getWidth();
int screenHeight = ssc.getHeight();
int xMouse = Mouse::getX() * screenWidth / fbw;
int yMouse = screenHeight - Mouse::getY() * screenHeight / fbh - 1;
int xMouse = InputManager.GetMouseX() * screenWidth / fbw;
int yMouse = InputManager.GetMouseY() * screenHeight / fbh - 1;
int maxFps = getFpsCap(mc->options->framerateLimit);
@ -1086,9 +1094,14 @@ void GameRenderer::render(float a, bool bFirst) {
if (mc->screen != NULL) {
glClear(GL_DEPTH_BUFFER_BIT);
glEnable(GL_BLEND);
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
glEnable(GL_ALPHA_TEST);
glAlphaFunc(GL_GREATER, 0.01f);
mc->screen->render(xMouse, yMouse, a);
if (mc->screen != NULL && mc->screen->particles != NULL)
mc->screen->particles->render(a);
glDisable(GL_BLEND);
}
}
}
@ -1244,8 +1257,8 @@ void GameRenderer::DisableUpdateThread() {
void GameRenderer::renderLevel(float a, __int64 until) {
// if (updateLightTexture) updateLightTexture(); // 4J - TODO -
//Java 1.0.1 has this line enabled, should check why - don't want to put it
//in now in case it breaks split-screen
// Java 1.0.1 has this line enabled, should check why - don't want to put it
// in now in case it breaks split-screen
glEnable(GL_CULL_FACE);
glEnable(GL_DEPTH_TEST);
@ -1259,7 +1272,7 @@ void GameRenderer::renderLevel(float a, __int64 until) {
(mc->player == mc->localplayers[ProfileManager.GetPrimaryPad()]);
// if (mc->cameraTargetPlayer == NULL) // 4J - removed condition as we
//want to update this is mc->player changes for different local players
// want to update this is mc->player changes for different local players
{
mc->cameraTargetPlayer = mc->player;
}
@ -1822,9 +1835,13 @@ void GameRenderer::setupGuiScreen(int forceScale /*=-1*/) {
int fbw, fbh;
RenderManager.GetFramebufferSize(fbw, fbh);
#ifdef _ENABLEIGGY
// 4jcraft: use actual framebuffer dimensions instead of mc->width/height
// to ensure GUI scales correctly after a window resize.
ScreenSizeCalculator ssc(mc->options, fbw, fbh, forceScale);
#else
ScreenSizeCalculator ssc(mc->options, mc->width, mc->height, forceScale);
#endif
glClear(GL_DEPTH_BUFFER_BIT);
glMatrixMode(GL_PROJECTION);

View file

@ -30,14 +30,24 @@ C4JRender::eTextureFormat Textures::TEXTURE_FORMAT =
int Textures::preLoadedIdx[TN_COUNT];
const wchar_t* Textures::preLoaded[TN_COUNT] = {
L"%blur%misc/pumpkinblur",
// L"%blur%/misc/vignette", // Not currently used
L"%blur%/misc/vignette", // Not currently used
L"%clamp%misc/shadow",
// L"/achievement/bg", // Not currently used
L"/achievement/bg", // Not currently used
L"art/kz",
L"environment/clouds",
L"environment/rain",
L"environment/snow",
L"gui/gui",
L"gui/background",
L"gui/inventory",
L"gui/container",
L"gui/crafting",
L"gui/furnace",
L"gui/creative_inventory/tabs",
L"gui/creative_inventory/tab_items",
L"gui/creative_inventory/tab_inventory",
L"gui/creative_inventory/tab_item_search",
L"title/mclogo",
L"gui/icons",
L"item/arrows",
L"item/boat",

View file

@ -15,14 +15,24 @@ class PreStitchedTextureMap;
typedef enum _TEXTURE_NAME {
TN__BLUR__MISC_PUMPKINBLUR,
// TN__BLUR__MISC_VIGNETTE, // Not currently used
TN__BLUR__MISC_VIGNETTE, // Not currently used
TN__CLAMP__MISC_SHADOW,
// TN_ACHIEVEMENT_BG, // Not currently used
TN_ACHIEVEMENT_BG, // Not currently used
TN_ART_KZ,
TN_ENVIRONMENT_CLOUDS,
TN_ENVIRONMENT_RAIN,
TN_ENVIRONMENT_SNOW,
TN_GUI_GUI,
TN_GUI_BACKGROUND,
TN_GUI_INVENTORY,
TN_GUI_CONTAINER,
TN_GUI_CRAFTING,
TN_GUI_FURNACE,
TN_GUI_CREATIVE_TABS,
TN_GUI_CREATIVE_TAB_ITEMS,
TN_GUI_CREATIVE_TAB_INVENTORY,
TN_GUI_CREATIVE_TAB_ITEM_SEARCH,
TN_TITLE_MCLOGO,
TN_GUI_ICONS,
TN_ITEM_ARROWS,
TN_ITEM_BOAT,

View file

@ -28,7 +28,11 @@
#include "../../Minecraft.World/Level/LevelChunk.h"
#include "../../Minecraft.World/WorldGen/Biomes/Biome.h"
#ifdef ENABLE_JAVA_GUIS
#define RENDER_HUD 1
#else
#define RENDER_HUD 0
#endif
// #ifndef _XBOX
// #undef RENDER_HUD
@ -396,9 +400,11 @@ void Gui::render(float a, bool mouseFree, int xMouse, int yMouse) {
int food = foodData->getFoodLevel();
int oldFood = foodData->getLastFoodLevel();
// if (false) //(true)
// {
// renderBossHealth();
// if (false) //(true)
// {
#ifdef ENABLE_JAVA_GUIS
renderBossHealth();
#endif
// }
/////////////////////////////////////////////////////////////////////////////////////
@ -941,35 +947,38 @@ max) + "% (" + (total / 1024 / 1024) + "MB)"; drawString(font, msg, screenWidth
lastTickA = a;
// 4J Stu - This is now displayed in a xui scene
#if 0
// Jukebox CD message
if (overlayMessageTime > 0)
{
#ifdef ENABLE_JAVA_GUIS
// Jukebox CD message
if (overlayMessageTime > 0) {
float t = overlayMessageTime - a;
int alpha = (int) (t * 256 / 20);
int alpha = (int)(t * 256 / 20);
if (alpha > 255) alpha = 255;
if (alpha > 0)
{
if (alpha > 0) {
glPushMatrix();
if(bTwoPlayerSplitscreen)
{
glTranslatef((float)((screenWidth / 2)+iWidthOffset), ((float)(screenHeight+iHeightOffset)) - iTooltipsYOffset -12 -iSafezoneYHalf, 0);
}
else
{
glTranslatef(((float)screenWidth) / 2, ((float)screenHeight) - iTooltipsYOffset - 12 -iSafezoneYHalf, 0);
}
if (bTwoPlayerSplitscreen) {
glTranslatef((float)((screenWidth / 2) + iWidthOffset),
((float)(screenHeight + iHeightOffset)) -
iTooltipsYOffset - 12 - iSafezoneYHalf,
0);
} else {
glTranslatef(((float)screenWidth) / 2,
((float)screenHeight) - iTooltipsYOffset - 12 -
iSafezoneYHalf,
0);
}
glEnable(GL_BLEND);
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
int col = 0xffffff;
if (animateOverlayMessageColor)
{
if (animateOverlayMessageColor) {
col = Color::HSBtoRGB(t / 50.0f, 0.7f, 0.6f) & 0xffffff;
}
// 4J-PB - this is the string displayed when cds are placed in a jukebox
font->draw(overlayMessageString,-font->width(overlayMessageString) / 2, -20, col + (alpha << 24));
// 4J-PB - this is the string displayed when cds are placed in a
// jukebox
font->draw(overlayMessageString,
-font->width(overlayMessageString) / 2, -20,
col + (alpha << 24));
glDisable(GL_BLEND);
glPopMatrix();
}
@ -988,49 +997,52 @@ max) + "% (" + (total / 1024 / 1024) + "MB)"; drawString(font, msg, screenWidth
glDisable(GL_ALPHA_TEST);
// 4J Stu - We have moved the chat text to a xui
#if 0
#ifdef ENABLE_JAVA_GUIS
glPushMatrix();
// 4J-PB we need to move this up a bit because we've moved the quick select
//glTranslatef(0, ((float)screenHeight) - 48, 0);
glTranslatef(0.0f, (float)(screenHeight - iSafezoneYHalf - iTooltipsYOffset - 16 - 3 + 22) - 24.0f, 0.0f);
// 4J-PB we need to move this up a bit because we've moved the quick select
// glTranslatef(0, ((float)screenHeight) - 48, 0);
glTranslatef(0.0f,
(float)(screenHeight - iSafezoneYHalf - iTooltipsYOffset - 16 -
3 + 22) -
24.0f,
0.0f);
// glScalef(1.0f / ssc.scale, 1.0f / ssc.scale, 1);
// 4J-PB - we need gui messages for each of the possible 4 splitscreen players
if(bDisplayGui)
{
int iPad=minecraft->player->GetXboxPad();
for (unsigned int i = 0; i < guiMessages[iPad].size() && i < max; i++)
{
if (guiMessages[iPad][i].ticks < 20 * 10 || isChatting)
{
double t = guiMessages[iPad][i].ticks / (20 * 10.0);
t = 1 - t;
t = t * 10;
if (t < 0) t = 0;
if (t > 1) t = 1;
t = t * t;
int alpha = (int) (255 * t);
if (isChatting) alpha = 255;
// 4J-PB - we need gui messages for each of the possible 4 splitscreen
// players
if (bDisplayGui) {
int iPad = minecraft->player->GetXboxPad();
for (unsigned int i = 0; i < guiMessages[iPad].size() && i < max; i++) {
if (guiMessages[iPad][i].ticks < 20 * 10 || isChatting) {
double t = guiMessages[iPad][i].ticks / (20 * 10.0);
t = 1 - t;
t = t * 10;
if (t < 0) t = 0;
if (t > 1) t = 1;
t = t * t;
int alpha = (int)(255 * t);
if (isChatting) alpha = 255;
if (alpha > 0)
{
int x = iSafezoneXHalf+2;
int y = -((int)i) * 9;
if(bTwoPlayerSplitscreen)
{
y+= iHeightOffset;
}
if (alpha > 0) {
int x = iSafezoneXHalf + 2;
int y = -((int)i) * 9;
if (bTwoPlayerSplitscreen) {
y += iHeightOffset;
}
std::wstring msg = guiMessages[iPad][i].string;
// 4J-PB - fill the black bar across the whole screen, otherwise it looks odd due to the safe area
this->fill(0, y - 1, screenWidth/fScaleFactorWidth, y + 8, (alpha / 2) << 24);
glEnable(GL_BLEND);
std::wstring msg = guiMessages[iPad][i].string;
// 4J-PB - fill the black bar across the whole screen,
// otherwise it looks odd due to the safe area
this->fill(0, y - 1, screenWidth / fScaleFactorWidth, y + 8,
(alpha / 2) << 24);
glEnable(GL_BLEND);
font->drawShadow(msg, iSafezoneXHalf+4, y, 0xffffff + (alpha << 24));
}
}
}
}
font->drawShadow(msg, iSafezoneXHalf + 4, y,
0xffffff + (alpha << 24));
}
}
}
}
glPopMatrix();
#endif
@ -1103,40 +1115,40 @@ max) + "% (" + (total / 1024 / 1024) + "MB)"; drawString(font, msg, screenWidth
}
// Moved to the xui base scene
// void Gui::renderBossHealth(void)
// {
// if (EnderDragonRenderer::bossInstance == NULL) return;
//
// std::shared_ptr<EnderDragon> boss = EnderDragonRenderer::bossInstance;
// EnderDragonRenderer::bossInstance = NULL;
//
// Minecraft *pMinecraft=Minecraft::GetInstance();
//
// Font *font = pMinecraft->font;
//
// ScreenSizeCalculator ssc(pMinecraft->options, pMinecraft->width_phys,
// pMinecraft->height_phys); int screenWidth = ssc.getWidth();
//
// int w = 182;
// int xLeft = screenWidth / 2 - w / 2;
//
// int progress = (int) (boss->getSynchedHealth() / (float)
// boss->getMaxHealth() * (float) (w + 1));
//
// int yo = 12;
// blit(xLeft, yo, 0, 74, w, 5);
// blit(xLeft, yo, 0, 74, w, 5);
// if (progress > 0)
// {
// blit(xLeft, yo, 0, 79, progress, 5);
// }
//
// std::wstring msg = L"Boss health - NON LOCALISED";
// font->drawShadow(msg, screenWidth / 2 - font->width(msg) / 2, yo - 10,
// 0xff00ff); glColor4f(1, 1, 1, 1); glBindTexture(GL_TEXTURE_2D,
// pMinecraft->textures->loadTexture(TN_GUI_ICONS) );//"/gui/icons.png"));
//
// }
void Gui::renderBossHealth(void) {
if (EnderDragonRenderer::bossInstance == NULL) return;
std::shared_ptr<EnderDragon> boss = EnderDragonRenderer::bossInstance;
EnderDragonRenderer::bossInstance = NULL;
Minecraft* pMinecraft = Minecraft::GetInstance();
Font* font = pMinecraft->font;
ScreenSizeCalculator ssc(pMinecraft->options, pMinecraft->width_phys,
pMinecraft->height_phys);
int screenWidth = ssc.getWidth();
int w = 182;
int xLeft = screenWidth / 2 - w / 2;
int progress = (int)(boss->getSynchedHealth() /
(float)boss->getMaxHealth() * (float)(w + 1));
int yo = 12;
blit(xLeft, yo, 0, 74, w, 5);
blit(xLeft, yo, 0, 74, w, 5);
if (progress > 0) {
blit(xLeft, yo, 0, 79, progress, 5);
}
std::wstring msg = L"Boss health" /*L"Boss health - NON LOCALISED"*/;
font->drawShadow(msg, screenWidth / 2 - font->width(msg) / 2, yo - 10,
0xff00ff);
glColor4f(1, 1, 1, 1);
glBindTexture(GL_TEXTURE_2D, pMinecraft->textures->loadTexture(
TN_GUI_ICONS)); //"/gui/icons.png"));
}
void Gui::renderPumpkin(int w, int h) {
glDisable(GL_DEPTH_TEST);
@ -1168,18 +1180,22 @@ void Gui::renderVignette(float br, int w, int h) {
if (br > 1) br = 1;
tbr += (br - tbr) * 0.01f;
#if 0 // 4J - removed - TODO put back when we have blend functions implemented
#ifdef ENABLE_JAVA_GUIS // 4J - removed - TODO put back when we have blend
// functions implemented
glDisable(GL_DEPTH_TEST);
glDepthMask(false);
glBlendFunc(GL_ZERO, GL_ONE_MINUS_SRC_COLOR);
glColor4f(tbr, tbr, tbr, 1);
glBindTexture(GL_TEXTURE_2D, minecraft->textures->loadTexture(TN__BLUR__MISC_VIGNETTE));//L"%blur%/misc/vignette.png"));
Tesselator *t = Tesselator::getInstance();
glBindTexture(
GL_TEXTURE_2D,
minecraft->textures->loadTexture(
TN__BLUR__MISC_VIGNETTE)); // L"%blur%/misc/vignette.png"));
Tesselator* t = Tesselator::getInstance();
t->begin();
t->vertexUV((float)(0), (float)( h), (float)( -90), (float)( 0), (float)( 1));
t->vertexUV((float)(w), (float)( h), (float)( -90), (float)( 1), (float)( 1));
t->vertexUV((float)(w), (float)( 0), (float)( -90), (float)( 1), (float)( 0));
t->vertexUV((float)(0), (float)( 0), (float)( -90), (float)( 0), (float)( 0));
t->vertexUV((float)(0), (float)(h), (float)(-90), (float)(0), (float)(1));
t->vertexUV((float)(w), (float)(h), (float)(-90), (float)(1), (float)(1));
t->vertexUV((float)(w), (float)(0), (float)(-90), (float)(1), (float)(0));
t->vertexUV((float)(0), (float)(0), (float)(-90), (float)(0), (float)(0));
t->end();
glDepthMask(true);
glEnable(GL_DEPTH_TEST);

View file

@ -46,7 +46,7 @@ public:
float tbr;
private:
// void renderBossHealth(void);
void renderBossHealth(void);
void renderPumpkin(int w, int h);
void renderVignette(float br, int w, int h);
void renderTp(float br, int w, int h);

View file

@ -82,6 +82,39 @@ void Screen::setSize(int width, int height) {
void Screen::init() {}
void Screen::updateEvents() {
// TODO: update for SDL if we ever get around to that
#if (defined(ENABLE_JAVA_GUIS))
int fbw, fbh;
RenderManager.GetFramebufferSize(fbw, fbh);
glViewport(0, 0, fbw, fbh);
ScreenSizeCalculator ssc(minecraft->options, minecraft->width,
minecraft->height);
int screenWidth = ssc.getWidth();
int screenHeight = ssc.getHeight();
int xMouse = InputManager.GetMouseX() * screenWidth / fbw;
int yMouse = InputManager.GetMouseY() * screenHeight / fbh - 1;
static bool prevLeftState = false;
static bool prevRightState = false;
bool leftState = InputManager.ButtonDown(0, MINECRAFT_ACTION_ACTION);
bool rightState = InputManager.ButtonDown(0, MINECRAFT_ACTION_USE);
if (leftState && !prevLeftState) {
mouseClicked(xMouse, yMouse, 0);
} else if (!leftState && prevLeftState) {
mouseReleased(xMouse, yMouse, 0);
}
if (rightState && !prevRightState) {
mouseClicked(xMouse, yMouse, 1);
} else if (!rightState && prevRightState) {
mouseReleased(xMouse, yMouse, 1);
}
prevLeftState = leftState;
prevRightState = rightState;
#else
/* 4J - TODO
while (Mouse.next()) {
mouseEvent();
@ -91,6 +124,7 @@ while (Keyboard.next()) {
keyboardEvent();
}
*/
#endif
}
void Screen::mouseEvent() {
@ -135,6 +169,30 @@ void Screen::renderBackground(int vo) {
void Screen::renderDirtBackground(int vo) {
// 4J Unused - Iggy Flash UI renders the background on consoles
#ifdef ENABLE_JAVA_GUIS
glDisable(GL_LIGHTING);
glDisable(GL_FOG);
Tesselator* t = Tesselator::getInstance();
glBindTexture(GL_TEXTURE_2D,
minecraft->textures->loadTexture(TN_GUI_BACKGROUND));
glColor4f(1, 1, 1, 1);
float s = 32;
t->begin();
t->color(0x404040);
t->vertexUV(static_cast<float>(0), static_cast<float>(height),
static_cast<float>(0), static_cast<float>(0),
static_cast<float>(height / s + vo));
t->vertexUV(static_cast<float>(width), static_cast<float>(height),
static_cast<float>(0), static_cast<float>(width / s),
static_cast<float>(height / s + vo));
t->vertexUV(static_cast<float>(width), static_cast<float>(0),
static_cast<float>(0), static_cast<float>(width / s),
static_cast<float>(0 + vo));
t->vertexUV(static_cast<float>(0), static_cast<float>(0),
static_cast<float>(0), static_cast<float>(0),
static_cast<float>(0 + vo));
t->end();
#endif
}
bool Screen::isPauseScreen() { return true; }

View file

@ -27,10 +27,8 @@ public:
Screen(); // 4J added
virtual void render(int xm, int ym, float a);
protected:
virtual void keyPressed(wchar_t eventCharacter, int eventKey);
public:
virtual void keyPressed(wchar_t eventCharacter, int eventKey);
static std::wstring getClipboard();
static void setClipboard(const std::wstring& str);

View file

@ -29,7 +29,7 @@ void AbstractContainerScreen::init() {
void AbstractContainerScreen::render(int xm, int ym, float a) {
// 4J Stu - Not used
#if 0
#if ENABLE_JAVA_GUIS
renderBackground();
int xo = (width - imageWidth) / 2;
int yo = (height - imageHeight) / 2;
@ -38,7 +38,6 @@ void AbstractContainerScreen::render(int xm, int ym, float a) {
glPushMatrix();
glRotatef(120, 1, 0, 0);
Lighting::turnOn();
glPopMatrix();
glPushMatrix();
@ -46,18 +45,17 @@ void AbstractContainerScreen::render(int xm, int ym, float a) {
glColor4f(1, 1, 1, 1);
glEnable(GL_RESCALE_NORMAL);
Lighting::turnOnGui();
Slot *hoveredSlot = NULL;
AUTO_VAR(itEnd, menu->slots->end());
for (AUTO_VAR(it, menu->slots->begin()); it != itEnd; it++)
{
Slot *slot = *it; //menu->slots->at(i);
Slot* hoveredSlot = NULL;
AUTO_VAR(itEnd, menu->slots->end());
for (AUTO_VAR(it, menu->slots->begin()); it != itEnd; it++) {
Slot* slot = *it; // menu->slots->at(i);
renderSlot(slot);
if (isHovering(slot, xm, ym))
{
if (isHovering(slot, xm, ym)) {
hoveredSlot = slot;
glDisable(GL_LIGHTING);
@ -72,38 +70,163 @@ void AbstractContainerScreen::render(int xm, int ym, float a) {
}
std::shared_ptr<Inventory> inventory = minecraft->player->inventory;
if (inventory->getCarried() != NULL)
{
if (inventory->getCarried() != NULL) {
glTranslatef(0, 0, 32);
// Slot old = carriedSlot;
// carriedSlot = null;
itemRenderer->renderGuiItem(font, minecraft->textures, inventory->getCarried(), xm - xo - 8, ym - yo - 8);
itemRenderer->renderGuiItemDecorations(font, minecraft->textures, inventory->getCarried(), xm - xo - 8, ym - yo - 8);
itemRenderer->renderGuiItem(font, minecraft->textures,
inventory->getCarried(), xm - xo - 8,
ym - yo - 8);
itemRenderer->renderGuiItemDecorations(font, minecraft->textures,
inventory->getCarried(),
xm - xo - 8, ym - yo - 8);
// carriedSlot = old;
}
glDisable(GL_RESCALE_NORMAL);
Lighting::turnOff();
glDisable(GL_RESCALE_NORMAL);
glDisable(GL_LIGHTING);
glDisable(GL_DEPTH_TEST);
renderLabels();
if (inventory->getCarried() == NULL && hoveredSlot != NULL && hoveredSlot->hasItem())
{
// 4jcraft: newer tooltips backported from java edition 1.3.x (MCP 7.x)
if (inventory->getCarried() == NULL && hoveredSlot != NULL &&
hoveredSlot->hasItem()) {
std::shared_ptr<ItemInstance> item = hoveredSlot->getItem();
std::wstring elementName = trimString(Language::getInstance()->getElementName(hoveredSlot->getItem()->getDescriptionId()));
// std::wstring elementName =
// trimString(Language::getInstance()->getElementName(hoveredSlot->getItem()->getDescriptionId()));
std::vector<std::wstring> elementName;
std::vector<std::wstring>* tooltipLines =
item->getHoverText(minecraft->player, false, elementName);
if (elementName.length() > 0)
{
int x = xm - xo + 12;
int y = ym - yo - 12;
int width = font->width(elementName);
fillGradient(x - 3, y - 3, x + width + 3, y + 8 + 3, 0xc0000000, 0xc0000000);
if (tooltipLines != NULL && tooltipLines->size() > 0) {
int tooltipWidth = 0;
std::vector<std::wstring> cleanedLines;
std::vector<int> lineColors;
font->drawShadow(elementName, x, y, 0xffffffff);
for (int lineIndex = 0; lineIndex < (int)tooltipLines->size();
++lineIndex) {
std::wstring rawLine = (*tooltipLines)[lineIndex];
std::wstring clean = L"";
int lineColor = 0xffffffff;
// 4jcraft: LCE is using HTML font elements for its tooltip
// colors, so make sure to parse them for parity w iggy UI
//
// examples would be enchantment books, potions and music
// discs
size_t fontPos = rawLine.find(L"<font");
if (fontPos != std::wstring::npos) {
size_t colorPos = rawLine.find(L"color=\"", fontPos);
if (colorPos != std::wstring::npos) {
colorPos += 7;
size_t colorEnd = rawLine.find(L'"', colorPos);
if (colorEnd != std::wstring::npos) {
std::wstring colorStr =
rawLine.substr(colorPos, colorEnd - colorPos);
if (!colorStr.empty() && colorStr[0] == L'#') {
colorStr = colorStr.substr(1);
}
if (!colorStr.empty()) {
wchar_t* endPtr;
long hexColor =
wcstol(colorStr.c_str(), &endPtr, 16);
if (*endPtr == L'\0') {
lineColor = 0xff000000 | (int)hexColor;
}
}
}
}
}
bool inTag = false;
for (wchar_t currentChar : rawLine) {
if (currentChar == L'<') {
inTag = true;
} else if (currentChar == L'>') {
inTag = false;
} else if (!inTag) {
clean += currentChar;
}
}
cleanedLines.push_back(clean);
lineColors.push_back(lineColor);
int lineWidth = font->width(clean);
if (lineWidth > tooltipWidth) {
tooltipWidth = lineWidth;
}
}
int tooltipX = xm - xo + 12;
int tooltipY = ym - yo - 12;
int tooltipHeight = 8;
if (tooltipLines->size() > 1) {
tooltipHeight += 2 + (tooltipLines->size() - 1) * 10;
}
int bgColor = 0xf0100010;
fillGradient(tooltipX - 3, tooltipY - 4,
tooltipX + tooltipWidth + 3, tooltipY - 3, bgColor,
bgColor);
fillGradient(tooltipX - 3, tooltipY + tooltipHeight + 3,
tooltipX + tooltipWidth + 3,
tooltipY + tooltipHeight + 4, bgColor, bgColor);
fillGradient(tooltipX - 3, tooltipY - 3,
tooltipX + tooltipWidth + 3,
tooltipY + tooltipHeight + 3, bgColor, bgColor);
fillGradient(tooltipX - 4, tooltipY - 3, tooltipX - 3,
tooltipY + tooltipHeight + 3, bgColor, bgColor);
fillGradient(tooltipX + tooltipWidth + 3, tooltipY - 3,
tooltipX + tooltipWidth + 4,
tooltipY + tooltipHeight + 3, bgColor, bgColor);
int borderStart = 0x505000ff;
int borderFinish =
(borderStart & 0xfefefe) >> 1 | borderStart & 0xff000000;
fillGradient(tooltipX - 3, (tooltipY - 3) + 1, (tooltipX - 3) + 1,
(tooltipY + tooltipHeight + 3) - 1, borderStart,
borderFinish);
fillGradient(tooltipX + tooltipWidth + 2, (tooltipY - 3) + 1,
tooltipX + tooltipWidth + 3,
(tooltipY + tooltipHeight + 3) - 1, borderStart,
borderFinish);
fillGradient(tooltipX - 3, tooltipY - 3,
tooltipX + tooltipWidth + 3, (tooltipY - 3) + 1,
borderStart, borderStart);
fillGradient(tooltipX - 3, tooltipY + tooltipHeight + 2,
tooltipX + tooltipWidth + 3,
tooltipY + tooltipHeight + 3, borderFinish,
borderFinish);
int currentY = tooltipY;
for (int lineIndex = 0; lineIndex < (int)tooltipLines->size();
++lineIndex) {
std::wstring& currentLine = cleanedLines[lineIndex];
int textColor;
if (lineIndex == 0) {
textColor = app.GetHTMLColour(item->getRarity()->color);
} else {
textColor = (lineColors[lineIndex] != 0xffffffff)
? lineColors[lineIndex]
: 0xffaaaaaa;
}
font->drawShadow(currentLine, tooltipX, currentY, textColor);
if (lineIndex == 0) {
currentY += 2;
}
currentY += 10;
}
}
}
glPopMatrix();
@ -118,26 +241,27 @@ void AbstractContainerScreen::renderLabels() {}
void AbstractContainerScreen::renderSlot(Slot* slot) {
// 4J Unused
#if 0
#if ENABLE_JAVA_GUIS
int x = slot->x;
int y = slot->y;
std::shared_ptr<ItemInstance> item = slot->getItem();
if (item == NULL)
{
int icon = slot->getNoItemIcon();
if (icon >= 0)
{
glDisable(GL_LIGHTING);
minecraft->textures->bind(minecraft->textures->loadTexture(TN_GUI_ITEMS));//L"/gui/items.png"));
blit(x, y, icon % 16 * 16, icon / 16 * 16, 16, 16);
glEnable(GL_LIGHTING);
return;
}
}
// if (item == NULL)
// {
// int icon = slot->getNoItemIcon();
// if (icon >= 0)
// {
// glDisable(GL_LIGHTING);
// minecraft->textures->bind(minecraft->textures->loadTexture(TN_GUI_ITEMS));//L"/gui/items.png"));
// blit(x, y, icon % 16 * 16, icon / 16 * 16, 16, 16);
// glEnable(GL_LIGHTING);
// return;
// }
// }
itemRenderer->renderGuiItem(font, minecraft->textures, item, x, y);
itemRenderer->renderGuiItemDecorations(font, minecraft->textures, item, x, y);
itemRenderer->renderGuiItemDecorations(font, minecraft->textures, item, x,
y);
#endif
}

View file

@ -23,11 +23,14 @@ public:
protected:
virtual void renderLabels();
virtual void renderBg(float a) = 0;
// 4jcraft: promoted from private to protected so CreativeInventoryScreen
// can call findSlot() and isHovering() directly for its custom click
// handling.
virtual Slot* findSlot(int x, int y);
virtual bool isHovering(Slot* slot, int xm, int ym);
private:
virtual void renderSlot(Slot* slot);
virtual Slot* findSlot(int x, int y);
virtual bool isHovering(Slot* slot, int xm, int ym);
protected:
virtual void mouseClicked(int x, int y, int buttonNum);

View file

@ -67,7 +67,7 @@ void AchievementPopup::prepareWindow() {
void AchievementPopup::render() {
// 4J Unused
#if 0
#if ENABLE_JAVA_GUIS
if (Minecraft::warezTime > 0)
{
glDisable(GL_DEPTH_TEST);
@ -113,7 +113,7 @@ void AchievementPopup::render() {
int xx = width - 160;
int yy = 0 - (int) (yo * 36);
int tex = mc->textures->loadTexture(L"/achievement/bg.png");
int tex = mc->textures->loadTexture(TN_ACHIEVEMENT_BG);
glColor4f(1, 1, 1, 1);
glEnable(GL_TEXTURE_2D);
glBindTexture(GL_TEXTURE_2D, tex);
@ -121,15 +121,15 @@ void AchievementPopup::render() {
blit(xx, yy, 96, 202, 160, 32);
if (isHelper)
{
mc->font->drawWordWrap(desc, xx + 30, yy + 7, 120, 0xffffffff);
}
else
{
// if (isHelper)
// {
// mc->font->drawWordWrap(desc, xx + 30, yy + 7, 120, 0xffffffff);
// }
// else
// {
mc->font->draw(title, xx + 30, yy + 7, 0xffffff00);
mc->font->draw(desc, xx + 30, yy + 18, 0xffffffff);
}
// }
glPushMatrix();
glRotatef(180, 1, 0, 0);

View file

@ -26,13 +26,13 @@ void ContainerScreen::renderLabels() {
void ContainerScreen::renderBg(float a) {
// 4J Unused
#if 0
int tex = minecraft->textures->loadTexture(L"/gui/container.png");
glColor4f(1, 1, 1, 1);
minecraft->textures->bind(tex);
int xo = (width - imageWidth) / 2;
int yo = (height - imageHeight) / 2;
this->blit(xo, yo, 0, 0, imageWidth, containerRows * 18 + 17);
this->blit(xo, yo + containerRows * 18 + 17, 0, 222 - 96, imageWidth, 96);
#ifdef ENABLE_JAVA_GUIS
int tex = minecraft->textures->loadTexture(TN_GUI_CONTAINER);
glColor4f(1, 1, 1, 1);
minecraft->textures->bind(tex);
int xo = (width - imageWidth) / 2;
int yo = (height - imageHeight) / 2;
this->blit(xo, yo, 0, 0, imageWidth, containerRows * 18 + 17);
this->blit(xo, yo + containerRows * 18 + 17, 0, 222 - 96, imageWidth, 96);
#endif
}

View file

@ -20,8 +20,8 @@ void CraftingScreen::renderLabels() {
void CraftingScreen::renderBg(float a) {
// 4J Unused
#if 0
int tex = minecraft->textures->loadTexture(L"/gui/crafting.png");
#ifdef ENABLE_JAVA_GUIS
int tex = minecraft->textures->loadTexture(TN_GUI_CRAFTING);
glColor4f(1, 1, 1, 1);
minecraft->textures->bind(tex);
int xo = (width - imageWidth) / 2;

View file

@ -9,15 +9,24 @@
#include "../../../Minecraft.World/Headers/net.minecraft.world.level.storage.h"
#include "../../../Minecraft.World/Util/SharedConstants.h"
#include "../../../Minecraft.World/Util/Random.h"
#include "../../MinecraftServer.h"
#include "../../GameState/Options.h"
#include <string>
CreateWorldScreen::CreateWorldScreen(Screen* lastScreen) {
done = false; // 4J added
moreOptions = false;
gameMode = L"survival";
generateStructures = true;
bonusChest = false;
cheatsEnabled = false;
flatWorld = false;
this->lastScreen = lastScreen;
}
void CreateWorldScreen::tick() {
nameEdit->tick();
seedEdit->tick();
if (moreOptions) seedEdit->tick();
// 4J - debug code - to be removed
static int count = 0;
@ -29,9 +38,9 @@ void CreateWorldScreen::init() {
Keyboard::enableRepeatEvents(true);
buttons.clear();
buttons.push_back(new Button(0, width / 2 - 100, height / 4 + 24 * 4 + 12,
buttons.push_back(new Button(0, width / 2 - 155, height - 28, 150, 20,
language->getElement(L"selectWorld.create")));
buttons.push_back(new Button(1, width / 2 - 100, height / 4 + 24 * 5 + 12,
buttons.push_back(new Button(1, width / 2 + 5, height - 28, 150, 20,
language->getElement(L"gui.cancel")));
nameEdit = new EditBox(
@ -41,11 +50,74 @@ void CreateWorldScreen::init() {
nameEdit->inFocus = true;
nameEdit->setMaxLength(32);
seedEdit = new EditBox(this, font, width / 2 - 100, 116, 200, 20, L"");
seedEdit = new EditBox(this, font, width / 2 - 100, 60, 200, 20, L"");
buttons.push_back(gameModeButton = new Button(
2, width / 2 - 75, 100, 150, 20,
language->getElement(L"selectWorld.gameMode")));
buttons.push_back(
moreWorldOptionsButton =
new Button(3, width / 2 - 75, 172, 150, 20,
language->getElement(L"selectWorld.moreWorldOptions")));
buttons.push_back(generateStructuresButton = new Button(
4, width / 2 - 155, 100, 150, 20,
language->getElement(L"selectWorld.mapFeatures")));
generateStructuresButton->visible = false;
generateStructuresButton->active = false;
buttons.push_back(bonusChestButton = new Button(
7, width / 2 + 5, 136, 150, 20,
language->getElement(L"selectWorld.bonusItems")));
bonusChestButton->visible = false;
bonusChestButton->active = false;
buttons.push_back(worldTypeButton = new Button(
5, width / 2 + 5, 100, 150, 20,
language->getElement(L"selectWorld.mapType")));
worldTypeButton->visible = false;
worldTypeButton->active = false;
buttons.push_back(cheatsEnabledButton = new Button(
6, width / 2 - 155, 136, 150, 20,
language->getElement(L"selectWorld.allowCommands")));
cheatsEnabledButton->visible = false;
cheatsEnabledButton->active = false;
updateStrings();
updateResultFolder();
}
// 4jcraft: referenced from func_73914_h in MCP 7.1 fr those wondering
void CreateWorldScreen::updateStrings() {
Language* language = Language::getInstance();
gameModeButton->msg =
language->getElement(L"selectWorld.gameMode") + L" " +
language->getElement(L"selectWorld.gameMode." + gameMode);
std::wstring line1Key = L"selectWorld.gameMode." + gameMode + L".line1";
std::wstring line2Key = L"selectWorld.gameMode." + gameMode + L".line2";
gameModeDescriptionLine1 = language->getElement(line1Key);
gameModeDescriptionLine2 = language->getElement(line2Key);
generateStructuresButton->msg =
language->getElement(L"selectWorld.mapFeatures") + L" " +
(generateStructures ? language->getElement(L"options.on")
: language->getElement(L"options.off"));
bonusChestButton->msg = language->getElement(L"selectWorld.bonusItems") +
L" " +
(bonusChest ? language->getElement(L"options.on")
: language->getElement(L"options.off"));
worldTypeButton->msg =
language->getElement(L"selectWorld.mapType") + L" " +
(flatWorld ? language->getElement(L"selectWorld.mapType.flat")
: language->getElement(L"selectWorld.mapType.normal"));
cheatsEnabledButton->msg =
language->getElement(L"selectWorld.allowCommands") + L" " +
(cheatsEnabled ? language->getElement(L"options.on")
: language->getElement(L"options.off"));
}
void CreateWorldScreen::updateResultFolder() {
resultFolder = trimString(nameEdit->getValue());
@ -85,38 +157,192 @@ void CreateWorldScreen::buttonClicked(Button* button) {
if (button->id == 1) {
minecraft->setScreen(lastScreen);
} else if (button->id == 0) {
// note: code copied from SelectWorldScreen
minecraft->setScreen(NULL);
minecraft->setScreen(
new Screen()); // blank screen while the world loads
if (done) return;
done = true;
__int64 seedValue = (new Random())->nextLong();
MoreOptionsParams* moreOptionsParams = new MoreOptionsParams();
// these r just the defaults from the createworldmenu UIscene
// i had higher ambitions for what id do with these but its not worth it
// for a temp ui
moreOptionsParams->bGenerateOptions = TRUE;
moreOptionsParams->bStructures = generateStructures;
moreOptionsParams->bFlatWorld = flatWorld;
moreOptionsParams->bBonusChest = bonusChest;
moreOptionsParams->bPVP = TRUE;
moreOptionsParams->bTrust = TRUE;
moreOptionsParams->bFireSpreads = TRUE;
moreOptionsParams->bTNT = TRUE;
moreOptionsParams->bHostPrivileges = FALSE;
moreOptionsParams->bOnlineGame = FALSE;
moreOptionsParams->bInviteOnly = FALSE;
moreOptionsParams->bAllowFriendsOfFriends = FALSE;
moreOptionsParams->bOnlineSettingChangedBySystem = FALSE;
moreOptionsParams->bCheatsEnabled = cheatsEnabled;
moreOptionsParams->iPad = 0;
moreOptionsParams->worldName = nameEdit->getValue();
moreOptionsParams->seed = seedEdit->getValue();
moreOptionsParams->dwTexturePack = 0;
std::wstring worldName = nameEdit->getValue();
if (worldName.empty()) {
worldName = L"2slimey";
}
StorageManager.ResetSaveData();
StorageManager.SetSaveTitle((wchar_t*)worldName.c_str());
std::wstring seedString = seedEdit->getValue();
__int64 seedValue = 0;
NetworkGameInitData* param = new NetworkGameInitData();
if (seedString.length() != 0) {
// try to convert it to a long first
// try { // 4J - removed try/catch
__int64 value = _fromString<__int64>(seedString);
bool isNumber = true;
for (unsigned int i = 0; i < seedString.length(); ++i) {
if (seedString.at(i) < L'0' || seedString.at(i) > L'9') {
if (!(i == 0 && seedString.at(i) == L'-')) {
isNumber = false;
break;
}
}
}
if (isNumber) value = _fromString<__int64>(seedString);
if (value != 0) {
seedValue = value;
} else {
int hashValue = 0;
for (unsigned int i = 0; i < seedString.length(); ++i)
hashValue = 31 * hashValue + seedString.at(i);
seedValue = hashValue;
}
// } catch (NumberFormatException e) {
// // not a number, fetch hash value
// seedValue = seedString.hashCode();
// }
} else {
param->findSeed = true;
}
param->seed = seedValue;
param->saveData = NULL;
param->texturePackId = 0;
param->settings = 0;
app.SetGameHostOption(eGameHostOption_Difficulty,
minecraft->options->difficulty);
app.SetGameHostOption(eGameHostOption_FriendsOfFriends,
moreOptionsParams->bAllowFriendsOfFriends);
app.SetGameHostOption(eGameHostOption_Gamertags, 1);
app.SetGameHostOption(eGameHostOption_BedrockFog, 0);
app.SetGameHostOption(eGameHostOption_GameType,
(gameMode == L"survival")
? GameType::SURVIVAL->getId()
: GameType::CREATIVE->getId());
app.SetGameHostOption(eGameHostOption_LevelType,
moreOptionsParams->bFlatWorld);
app.SetGameHostOption(eGameHostOption_Structures,
moreOptionsParams->bStructures);
app.SetGameHostOption(eGameHostOption_BonusChest,
moreOptionsParams->bBonusChest);
app.SetGameHostOption(eGameHostOption_PvP, moreOptionsParams->bPVP);
app.SetGameHostOption(eGameHostOption_TrustPlayers,
moreOptionsParams->bTrust);
app.SetGameHostOption(eGameHostOption_FireSpreads,
moreOptionsParams->bFireSpreads);
app.SetGameHostOption(eGameHostOption_TNT, moreOptionsParams->bTNT);
app.SetGameHostOption(eGameHostOption_HostCanFly,
moreOptionsParams->bHostPrivileges);
app.SetGameHostOption(eGameHostOption_HostCanChangeHunger,
moreOptionsParams->bHostPrivileges);
app.SetGameHostOption(eGameHostOption_HostCanBeInvisible,
moreOptionsParams->bHostPrivileges);
app.SetGameHostOption(eGameHostOption_CheatsEnabled,
moreOptionsParams->bHostPrivileges);
param->settings = app.GetGameHostOption(eGameHostOption_All);
param->xzSize = LEVEL_MAX_WIDTH;
param->hellScale = HELL_LEVEL_MAX_SCALE;
g_NetworkManager.HostGame(0, false, false, MINECRAFT_NET_MAX_PLAYERS,
0);
g_NetworkManager.FakeLocalPlayerJoined();
LoadingInputParams* loadingParams = new LoadingInputParams();
loadingParams->func = &CGameNetworkManager::RunNetworkGameThreadProc;
loadingParams->lpParam = (LPVOID)param;
app.SetAutosaveTimerTime();
UIFullscreenProgressCompletionData* completionData =
new UIFullscreenProgressCompletionData();
completionData->bShowBackground = TRUE;
completionData->bShowLogo = TRUE;
completionData->type = e_ProgressCompletion_CloseAllPlayersUIScenes;
completionData->iPad = 0;
loadingParams->completionData = completionData;
ui.NavigateToScene(0, eUIScene_FullscreenProgress, loadingParams);
// 4J Stu - This screen is not used, so removing this to stop the build failing
#if 0
minecraft->gameMode = new SurvivalMode(minecraft);
minecraft->selectLevel(resultFolder, nameEdit->getValue(), seedValue);
minecraft->setScreen(NULL);
#endif
} else if (button->id == 2) {
if (gameMode == L"survival")
gameMode = L"creative";
else
gameMode = L"survival";
updateStrings();
} else if (button->id == 3) {
moreOptions = !moreOptions;
gameModeButton->visible = !moreOptions;
gameModeButton->active = !moreOptions;
generateStructuresButton->visible = moreOptions;
generateStructuresButton->active = moreOptions;
bonusChestButton->visible = moreOptions;
bonusChestButton->active = moreOptions;
worldTypeButton->visible = moreOptions;
worldTypeButton->active = moreOptions;
cheatsEnabledButton->visible = moreOptions;
cheatsEnabledButton->active = moreOptions;
Language* language = Language::getInstance();
if (moreOptions) {
moreWorldOptionsButton->msg = language->getElement(L"gui.done");
} else {
moreWorldOptionsButton->msg =
language->getElement(L"selectWorld.moreWorldOptions");
}
} else if (button->id == 4) {
generateStructures = !generateStructures;
updateStrings();
} else if (button->id == 7) {
bonusChest = !bonusChest;
updateStrings();
} else if (button->id == 5) {
flatWorld = !flatWorld;
updateStrings();
} else if (button->id == 6) {
cheatsEnabled = !cheatsEnabled;
updateStrings();
}
}
void CreateWorldScreen::keyPressed(wchar_t ch, int eventKey) {
if (nameEdit->inFocus)
if (nameEdit->inFocus && !moreOptions)
nameEdit->keyPressed(ch, eventKey);
else
seedEdit->keyPressed(ch, eventKey);
@ -132,8 +358,10 @@ void CreateWorldScreen::keyPressed(wchar_t ch, int eventKey) {
void CreateWorldScreen::mouseClicked(int x, int y, int buttonNum) {
Screen::mouseClicked(x, y, buttonNum);
nameEdit->mouseClicked(x, y, buttonNum);
seedEdit->mouseClicked(x, y, buttonNum);
if (!moreOptions)
nameEdit->mouseClicked(x, y, buttonNum);
else
seedEdit->mouseClicked(x, y, buttonNum);
}
void CreateWorldScreen::render(int xm, int ym, float a) {
@ -143,26 +371,43 @@ void CreateWorldScreen::render(int xm, int ym, float a) {
renderBackground();
drawCenteredString(font, language->getElement(L"selectWorld.create"),
width / 2, height / 4 - 60 + 20, 0xffffff);
drawString(font, language->getElement(L"selectWorld.enterName"),
width / 2 - 100, 47, 0xa0a0a0);
drawString(
font,
language->getElement(L"selectWorld.resultFolder") + L" " + resultFolder,
width / 2 - 100, 85, 0xa0a0a0);
width / 2, 20, 0xffffff);
if (!moreOptions) {
drawString(font, language->getElement(L"selectWorld.enterName"),
width / 2 - 100, 47, 0xa0a0a0);
drawString(font,
language->getElement(L"selectWorld.resultFolder") + L" " +
resultFolder,
width / 2 - 100, 85, 0xa0a0a0);
drawString(font, language->getElement(L"selectWorld.enterSeed"),
width / 2 - 100, 104, 0xa0a0a0);
drawString(font, language->getElement(L"selectWorld.seedInfo"),
width / 2 - 100, 140, 0xa0a0a0);
nameEdit->render();
nameEdit->render();
seedEdit->render();
drawString(font, gameModeDescriptionLine1, width / 2 - 100, 122,
0xa0a0a0);
drawString(font, gameModeDescriptionLine2, width / 2 - 100, 134,
0xa0a0a0);
} else {
drawString(font, language->getElement(L"selectWorld.enterSeed"),
width / 2 - 100, 47, 0xa0a0a0);
drawString(font, language->getElement(L"selectWorld.seedInfo"),
width / 2 - 100, 85, 0xa0a0a0);
drawString(font, language->getElement(L"selectWorld.mapFeatures.info"),
width / 2 - 150, 122, 0xa0a0a0);
drawString(font,
language->getElement(L"selectWorld.allowCommands.info"),
width / 2 - 150, 157, 0xa0a0a0);
seedEdit->render();
}
Screen::render(xm, ym, a);
Screen::render(xm, ym, a);
}
void CreateWorldScreen::tabPressed() {
if (!moreOptions) return;
if (nameEdit->inFocus) {
nameEdit->focus(false);
seedEdit->focus(true);

View file

@ -11,6 +11,24 @@ private:
std::wstring resultFolder;
bool done;
bool moreOptions;
std::wstring gameMode;
bool generateStructures;
bool bonusChest;
bool cheatsEnabled;
bool flatWorld;
Button* gameModeButton;
Button* moreWorldOptionsButton;
Button* generateStructuresButton;
Button* bonusChestButton;
Button* worldTypeButton;
Button* cheatsEnabledButton;
std::wstring gameModeDescriptionLine1;
std::wstring gameModeDescriptionLine2;
std::wstring seed;
public:
CreateWorldScreen(Screen* lastScreen);
virtual void tick();
@ -18,6 +36,7 @@ public:
private:
void updateResultFolder();
void updateStrings();
public:
static std::wstring findAvailableFolderName(LevelStorageSource* levelSource,
@ -32,4 +51,36 @@ protected:
public:
virtual void render(int xm, int ym, float a);
virtual void tabPressed();
private:
int m_iGameModeId;
bool m_bGameModeCreative;
struct MoreOptionsParams {
bool bGenerateOptions;
bool bStructures;
bool bFlatWorld;
bool bBonusChest;
bool bPVP;
bool bTrust;
bool bFireSpreads;
bool bHostPrivileges;
bool bTNT;
bool bMobGriefing;
bool bKeepInventory;
bool bDoMobSpawning;
bool bDoMobLoot;
bool bDoTileDrops;
bool bNaturalRegeneration;
bool bDoDaylightCycle;
bool bOnlineGame;
bool bInviteOnly;
bool bAllowFriendsOfFriends;
bool bOnlineSettingChangedBySystem;
bool bCheatsEnabled;
int dwTexturePack;
int iPad;
std::wstring worldName;
std::wstring seed;
} m_MoreOptionsParams;
};

View file

@ -0,0 +1,527 @@
#include "../../Platform/stdafx.h"
#include "CreativeInventoryScreen.h"
#include "../../../Minecraft.World/Headers/net.minecraft.world.entity.player.h"
#include "../../../Minecraft.World/Containers/Inventory.h"
#include "../../../Minecraft.World/Containers/SimpleContainer.h"
#include "../../../Minecraft.World/Containers/Slot.h"
#include "../../../Minecraft.World/Headers/net.minecraft.world.item.h"
#include "../../../Minecraft.World/Headers/net.minecraft.locale.h"
#include "../../Minecraft.h"
#include "../../Textures/Textures.h"
#include "../../Rendering/EntityRenderers/ItemRenderer.h"
#include "../../Rendering/Lighting.h"
#include "../../../Minecraft.World/Containers/InventoryMenu.h"
#include <algorithm>
#include <cmath>
// Static member initialization
int CreativeInventoryScreen::selectedTabIndex = IUIScene_CreativeMenu::eCreativeInventoryTab_BuildingBlocks;
std::shared_ptr<SimpleContainer> CreativeInventoryScreen::basicInventory = std::make_shared<SimpleContainer>(0, ITEMS_PER_PAGE);
// ContainerCreative implementation
CreativeInventoryScreen::ContainerCreative::ContainerCreative(std::shared_ptr<Player> player) : AbstractContainerMenu()
{
std::shared_ptr<Inventory> inventoryplayer = player->inventory;
// Add creative inventory slots (5 rows x 9 columns = 45 slots)
for (int i = 0; i < ROWS; ++i)
{
for (int j = 0; j < COLUMNS; ++j)
{
addSlot(new Slot(basicInventory, i * COLUMNS + j, 9 + j * 18, 18 + i * 18));
}
}
// Add hotbar slots (9 slots at bottom)
for (int k = 0; k < 9; ++k)
{
addSlot(new Slot(inventoryplayer, k, 9 + k * 18, 112));
}
scrollTo(0.0f);
}
bool CreativeInventoryScreen::ContainerCreative::stillValid(std::shared_ptr<Player> player)
{
return true;
}
std::shared_ptr<ItemInstance> CreativeInventoryScreen::ContainerCreative::clicked(int slotIndex, int buttonNum, int clickType, std::shared_ptr<Player> player)
{
std::shared_ptr<Inventory> inventory = player->inventory;
std::shared_ptr<ItemInstance> carried = inventory->getCarried();
// Handle clicks outside the GUI
if (slotIndex == CLICKED_OUTSIDE)
{
// Drop the carried item
if (carried != NULL)
{
if (buttonNum == 0)
{
player->drop(carried, true);
inventory->setCarried(std::shared_ptr<ItemInstance>());
}
else if (buttonNum == 1)
{
std::shared_ptr<ItemInstance> single = carried->copy();
single->count = 1;
player->drop(single, true);
carried->count--;
if (carried->count <= 0)
{
inventory->setCarried(std::shared_ptr<ItemInstance>());
}
}
}
return std::shared_ptr<ItemInstance>();
}
// Validate slot index
if (slotIndex < 0 || slotIndex >= (int)slots->size())
{
return std::shared_ptr<ItemInstance>();
}
Slot* slot = slots->at(slotIndex);
// Handle creative inventory slots (0-44)
if (slotIndex >= 0 && slotIndex < ITEMS_PER_PAGE)
{
std::shared_ptr<ItemInstance> slotItem = slot->getItem();
// Handle SWAP (number key) - copy item to hotbar
if (clickType == CLICK_SWAP)
{
if (slotItem != NULL && buttonNum >= 0 && buttonNum < 9)
{
std::shared_ptr<ItemInstance> copy = slotItem->copy();
copy->count = copy->getMaxStackSize();
inventory->setItem(buttonNum, copy);
}
return std::shared_ptr<ItemInstance>();
}
// Handle CLONE (middle click)
if (clickType == CLICK_CLONE)
{
if (slotItem != NULL)
{
std::shared_ptr<ItemInstance> copy = slotItem->copy();
copy->count = copy->getMaxStackSize();
inventory->setCarried(copy);
}
return std::shared_ptr<ItemInstance>();
}
// Handle normal clicks
if (slotItem != NULL)
{
if (buttonNum == 0) // Left click
{
std::shared_ptr<ItemInstance> copy = slotItem->copy();
copy->count = copy->getMaxStackSize();
inventory->setCarried(copy);
}
else if (buttonNum == 1) // Right click
{
std::shared_ptr<ItemInstance> copy = slotItem->copy();
copy->count = 1;
inventory->setCarried(copy);
}
}
else if (carried != NULL)
{
// Clicking on empty creative slot with item - clear the carried item
inventory->setCarried(std::shared_ptr<ItemInstance>());
}
return std::shared_ptr<ItemInstance>();
}
// For hotbar slots (45-53), use normal container behavior
return AbstractContainerMenu::clicked(slotIndex, buttonNum, clickType, player);
}
void CreativeInventoryScreen::ContainerCreative::scrollTo(float pos)
{
int i = (itemList.size() + COLUMNS - 1) / COLUMNS - ROWS;
int j = (int)((double)(pos * (float)i) + 0.5);
if (j < 0)
{
j = 0;
}
for (int k = 0; k < ROWS; ++k)
{
for (int l = 0; l < COLUMNS; ++l)
{
int i1 = l + (k + j) * COLUMNS;
if (i1 >= 0 && i1 < (int)itemList.size())
{
basicInventory->setItem(l + k * COLUMNS, itemList[i1]);
}
else
{
basicInventory->setItem(l + k * COLUMNS, std::shared_ptr<ItemInstance>());
}
}
}
}
bool CreativeInventoryScreen::ContainerCreative::canScroll()
{
return itemList.size() > ITEMS_PER_PAGE;
}
CreativeInventoryScreen::CreativeInventoryScreen(std::shared_ptr<Player> player)
: AbstractContainerScreen(new ContainerCreative(player))
{
this->player = player;
player->containerMenu = menu;
currentScroll = 0.0f;
isScrolling = false;
wasClicking = false;
isLeftMouseDown = false;
imageHeight = 136;
imageWidth = 195;
}
void CreativeInventoryScreen::removed()
{
AbstractContainerScreen::removed();
}
void CreativeInventoryScreen::init()
{
buttons.clear();
int i = selectedTabIndex;
selectedTabIndex = -1;
setCurrentCreativeTab(i);
}
void CreativeInventoryScreen::updateEvents()
{
#ifdef ENABLE_JAVA_GUIS
// Handle mouse wheel scrolling.
// We use ButtonDown with the scroll actions rather than GetScrollDelta() because
// both share s_scrollTicksForButtonPressed; whichever is called first in a tick
// zeroes it, so GetScrollDelta() would return 0 if hotbar scroll ran first.
// ButtonDown/ScrollSnap() snapshots once per tick so all callers see the same value.
if (needsScrollBars())
{
ContainerCreative* container = (ContainerCreative*)menu;
int totalRows = ((int)container->itemList.size() + COLUMNS - 1) / COLUMNS;
int scrollableRows = totalRows - ROWS;
if (scrollableRows > 0)
{
float step = 1.0f / (float)scrollableRows;
if (InputManager.ButtonDown(0, MINECRAFT_ACTION_LEFT_SCROLL))
{
currentScroll -= step;
currentScroll = std::max(0.0f, std::min(1.0f, currentScroll));
container->scrollTo(currentScroll);
}
else if (InputManager.ButtonDown(0, MINECRAFT_ACTION_RIGHT_SCROLL))
{
currentScroll += step;
currentScroll = std::max(0.0f, std::min(1.0f, currentScroll));
container->scrollTo(currentScroll);
}
}
}
#endif
Screen::updateEvents();
}
void CreativeInventoryScreen::containerTick()
{
}
void CreativeInventoryScreen::tick()
{
Screen::tick();
}
void CreativeInventoryScreen::keyPressed(wchar_t eventCharacter, int eventKey)
{
AbstractContainerScreen::keyPressed(eventCharacter, eventKey);
}
void CreativeInventoryScreen::mouseClicked(int x, int y, int buttonNum)
{
if (buttonNum == 0) isLeftMouseDown = true;
Screen::mouseClicked(x, y, buttonNum);
if (buttonNum == 0 || buttonNum == 1)
{
int i = x - (width - imageWidth) / 2;
int j = y - (height - imageHeight) / 2;
// Check for tab clicks first; let mouseReleased handle the actual tab switch
for (int tab = 0; tab < IUIScene_CreativeMenu::eCreativeInventoryTab_COUNT; ++tab)
{
if (isMouseOverTab(tab, i, j))
{
return;
}
}
// Determine which slot (if any) was clicked
Slot *slot = findSlot(x, y);
int xo = (width - imageWidth) / 2;
int yo = (height - imageHeight) / 2;
bool clickedOutside = (x < xo || y < yo || x >= xo + imageWidth || y >= yo + imageHeight);
int slotId = -1;
if (slot != NULL) slotId = slot->index;
if (clickedOutside) slotId = AbstractContainerMenu::CLICKED_OUTSIDE;
if (slotId == -1) return;
bool quickKey = slotId != AbstractContainerMenu::CLICKED_OUTSIDE &&
(Keyboard::isKeyDown(Keyboard::KEY_LSHIFT) || Keyboard::isKeyDown(Keyboard::KEY_RSHIFT));
int clickType = quickKey ? AbstractContainerMenu::CLICK_QUICK_MOVE : AbstractContainerMenu::CLICK_PICKUP;
// 4jcraft: bypass AbstractContainerScreen::mouseClicked / handleInventoryMouseClick
// here intentionally. The normal path sends a ContainerClickPacket to the server,
// where player->containerMenu is still the InventoryMenu (45 slots). Creative slot
// indices 0-44 are valid in ContainerCreative but not in InventoryMenu, and hotbar
// indices 45-53 exceed InventoryMenu's slot count entirely, causing an out-of-range
// crash in AbstractContainerMenu::clicked on the server side.
// Instead we apply the click locally and sync hotbar changes via SetCreativeModeSlotPacket.
menu->clicked(slotId, buttonNum, clickType, minecraft->player);
// 4jcraft: sync hotbar slot changes to the server using SetCreativeModeSlotPacket.
// The packet handler (PlayerConnection::handleSetCreativeModeSlot) validates slots
// against InventoryMenu coordinates where the hotbar starts at USE_ROW_SLOT_START (36),
// so we must offset the local hotbar index (0-8) accordingly.
if (slotId >= ITEMS_PER_PAGE && slotId < ITEMS_PER_PAGE + 9)
{
int hotbarSlot = slotId - ITEMS_PER_PAGE;
std::shared_ptr<ItemInstance> hotbarItem = minecraft->player->inventory->getItem(hotbarSlot);
minecraft->gameMode->handleCreativeModeItemAdd(hotbarItem, hotbarSlot + InventoryMenu::USE_ROW_SLOT_START);
}
}
}
void CreativeInventoryScreen::mouseReleased(int x, int y, int buttonNum)
{
if (buttonNum == 0) isLeftMouseDown = false;
if (buttonNum == 0)
{
int i = x - (width - imageWidth) / 2;
int j = y - (height - imageHeight) / 2;
// Check for tab clicks
for (int tab = 0; tab < IUIScene_CreativeMenu::eCreativeInventoryTab_COUNT; ++tab)
{
if (isMouseOverTab(tab, i, j))
{
setCurrentCreativeTab(tab);
return;
}
}
}
AbstractContainerScreen::mouseReleased(x, y, buttonNum);
}
void CreativeInventoryScreen::render(int xm, int ym, float a)
{
// Java: drawDefaultBackground()
renderBackground();
// Handle scrollbar dragging
bool mouseDown = isLeftMouseDown;
int i = (width - imageWidth) / 2;
int j = (height - imageHeight) / 2;
int k = i + 175;
int l = j + 18;
int i1 = k + 14;
int j1 = l + 112;
if (!wasClicking && mouseDown && xm >= k && ym >= l && xm < i1 && ym < j1)
{
isScrolling = needsScrollBars();
}
if (!mouseDown)
{
isScrolling = false;
}
wasClicking = mouseDown;
if (isScrolling)
{
currentScroll = ((float)(ym - l) - 7.5f) / ((float)(j1 - l) - 15.0f);
currentScroll = std::max(0.0f, std::min(1.0f, currentScroll));
((ContainerCreative*)menu)->scrollTo(currentScroll);
}
AbstractContainerScreen::render(xm, ym, a);
}
void CreativeInventoryScreen::renderLabels()
{
#ifdef ENABLE_JAVA_GUIS
if (IUIScene_CreativeMenu::specs && selectedTabIndex >= 0 && selectedTabIndex < IUIScene_CreativeMenu::eCreativeInventoryTab_COUNT)
{
IUIScene_CreativeMenu::TabSpec* spec = IUIScene_CreativeMenu::specs[selectedTabIndex];
if (spec)
{
std::wstring tabName = app.GetString(spec->m_descriptionId);
font->draw(tabName, 8, 6, 0x404040);
}
}
#endif
}
void CreativeInventoryScreen::renderBg(float a)
{
int x = (width - imageWidth) / 2;
int y = (height - imageHeight) / 2;
#ifdef ENABLE_JAVA_GUIS
// Render all non-selected tabs first
for (int tab = 0; tab < IUIScene_CreativeMenu::eCreativeInventoryTab_COUNT; ++tab)
{
if (tab != selectedTabIndex)
{
drawTab(tab);
}
}
// Load and render main creative inventory background
int tex = minecraft->textures->loadTexture(TN_GUI_CREATIVE_TAB_ITEMS);
glColor4f(1, 1, 1, 1);
minecraft->textures->bind(tex);
blit(x, y, 0, 0, imageWidth, imageHeight);
// Render scrollbar
tex = minecraft->textures->loadTexture(TN_GUI_CREATIVE_TABS);
minecraft->textures->bind(tex);
int scrollX = x + 175;
int scrollY = y + 18;
int scrollHeight = 112;
if (needsScrollBars())
{
int scrollPos = (int)((float)(scrollHeight - 17) * currentScroll);
blit(scrollX, scrollY + scrollPos, 232, 0, 12, 15);
}
else
{
blit(scrollX, scrollY + (scrollHeight - 17) / 2, 244, 0, 12, 15);
}
// Render selected tab last (on top)
drawTab(selectedTabIndex);
#endif
}
void CreativeInventoryScreen::setCurrentCreativeTab(int tab)
{
if (tab < 0 || tab >= IUIScene_CreativeMenu::eCreativeInventoryTab_COUNT)
return;
int oldTab = selectedTabIndex;
selectedTabIndex = tab;
ContainerCreative* container = (ContainerCreative*)menu;
container->itemList.clear();
// Populate itemList from the tab's category groups
if (IUIScene_CreativeMenu::specs && IUIScene_CreativeMenu::specs[tab])
{
IUIScene_CreativeMenu::TabSpec* spec = IUIScene_CreativeMenu::specs[tab];
// Add items from static groups
for (int i = 0; i < spec->m_staticGroupsCount; ++i)
{
int groupIdx = spec->m_staticGroupsA[i];
if (groupIdx >= 0 && groupIdx < IUIScene_CreativeMenu::eCreativeInventoryGroupsCount)
{
auto& group = IUIScene_CreativeMenu::categoryGroups[groupIdx];
for (auto& item : group)
{
container->itemList.push_back(item);
}
}
}
}
currentScroll = 0.0f;
container->scrollTo(0.0f);
}
void CreativeInventoryScreen::selectTab(int tab)
{
setCurrentCreativeTab(tab);
}
bool CreativeInventoryScreen::needsScrollBars()
{
return ((ContainerCreative*)menu)->canScroll();
}
bool CreativeInventoryScreen::isMouseOverTab(int tab, int mouseX, int mouseY)
{
int i = tab;
int j = 28 * i;
int k = 0;
if (i > 0)
{
j += i;
}
// Tabs are in the top row
k = k - 32;
return mouseX >= j && mouseX <= j + 28 && mouseY >= k && mouseY <= k + 32;
}
void CreativeInventoryScreen::drawTab(int tab)
{
#ifdef ENABLE_JAVA_GUIS
bool isSelected = (tab == selectedTabIndex);
int i = tab;
int j = i * 28;
int k = 0;
int l = (width - imageWidth) / 2 + 28 * i;
int i1 = (height - imageHeight) / 2;
int j1 = 32;
if (isSelected)
{
k += 32;
}
if (i > 0)
{
l += i;
}
// Tabs are in the top row
i1 = i1 - 28;
// Render tab background
int tex = minecraft->textures->loadTexture(TN_GUI_CREATIVE_TABS);
minecraft->textures->bind(tex);
glColor4f(1, 1, 1, 1);
blit(l, i1, j, k, 28, 32);
// TODO: Render tab icon (would need item icons)
#endif
}

View file

@ -0,0 +1,71 @@
#pragma once
#include "AbstractContainerScreen.h"
#include "../../../Minecraft.World/Containers/AbstractContainerMenu.h"
#include "../../Platform/Common/UI/IUIScene_CreativeMenu.h"
#include "../../Player/MultiPlayerLocalPlayer.h"
class Player;
class SimpleContainer;
class Inventory;
class Slot;
class CreativeInventoryScreen : public AbstractContainerScreen
{
private:
static constexpr int ROWS = 5;
static constexpr int COLUMNS = 9;
static constexpr int ITEMS_PER_PAGE = ROWS * COLUMNS; // 45 items (9x5 grid)
// Currently selected creative tab index
static int selectedTabIndex;
// Temporary inventory for creative mode items
static std::shared_ptr<SimpleContainer> basicInventory;
// Amount scrolled in Creative mode inventory (0 = top, 1 = bottom)
float currentScroll;
bool isScrolling;
// True if the left mouse button is currently being held
bool isLeftMouseDown;
// True if the left mouse button was held down last time render was called
bool wasClicking;
std::shared_ptr<Player> player;
public:
class ContainerCreative : public AbstractContainerMenu
{
public:
std::vector<std::shared_ptr<ItemInstance>> itemList;
ContainerCreative(std::shared_ptr<Player> player);
virtual bool stillValid(std::shared_ptr<Player> player);
virtual std::shared_ptr<ItemInstance> clicked(int slotIndex, int buttonNum, int clickType, std::shared_ptr<Player> player);
void scrollTo(float pos);
bool canScroll();
};
public:
CreativeInventoryScreen(std::shared_ptr<Player> player);
virtual void removed();
virtual void init();
virtual void containerTick();
virtual void tick();
virtual void updateEvents();
virtual void keyPressed(wchar_t eventCharacter, int eventKey);
virtual void mouseClicked(int x, int y, int buttonNum);
virtual void mouseReleased(int x, int y, int buttonNum);
virtual void render(int xm, int ym, float a);
protected:
virtual void renderLabels();
virtual void renderBg(float a);
private:
void setCurrentCreativeTab(int tab);
void selectTab(int tab);
bool needsScrollBars();
bool isMouseOverTab(int tab, int mouseX, int mouseY);
void drawTab(int tab);
};

View file

@ -19,20 +19,19 @@ void FurnaceScreen::renderLabels() {
void FurnaceScreen::renderBg(float a) {
// 4J Unused
#if 0
int tex = minecraft->textures->loadTexture(L"/gui/furnace.png");
glColor4f(1, 1, 1, 1);
minecraft->textures->bind(tex);
int xo = (width - imageWidth) / 2;
int yo = (height - imageHeight) / 2;
this->blit(xo, yo, 0, 0, imageWidth, imageHeight);
if (furnace->isLit())
{
int p = furnace->getLitProgress(12);
this->blit(xo + 56, yo + 36 + 12 - p, 176, 12 - p, 14, p + 2);
}
#ifdef ENABLE_JAVA_GUIS
int tex = minecraft->textures->loadTexture(TN_GUI_FURNACE);
glColor4f(1, 1, 1, 1);
minecraft->textures->bind(tex);
int xo = (width - imageWidth) / 2;
int yo = (height - imageHeight) / 2;
this->blit(xo, yo, 0, 0, imageWidth, imageHeight);
if (furnace->isLit()) {
int p = furnace->getLitProgress(12);
this->blit(xo + 56, yo + 36 + 12 - p, 176, 12 - p, 14, p + 2);
}
int p = furnace->getBurnProgress(24);
this->blit(xo + 79, yo + 34, 176, 14, p + 1, 16);
int p = furnace->getBurnProgress(24);
this->blit(xo + 79, yo + 34, 176, 14, p + 1, 16);
#endif
}

View file

@ -33,8 +33,8 @@ void InventoryScreen::render(int xm, int ym, float a) {
void InventoryScreen::renderBg(float a) {
// 4J Unused
#if 0
int tex = minecraft->textures->loadTexture(L"/gui/inventory.png");
#ifdef ENABLE_JAVA_GUIS
int tex = minecraft->textures->loadTexture(TN_GUI_INVENTORY);
glColor4f(1, 1, 1, 1);
minecraft->textures->bind(tex);
int xo = (width - imageWidth) / 2;
@ -53,6 +53,8 @@ void InventoryScreen::renderBg(float a) {
float oybr = minecraft->player->yBodyRot;
float oyr = minecraft->player->yRot;
float oxr = minecraft->player->xRot;
float oyh = minecraft->player->yHeadRot;
float oyhp = minecraft->player->yHeadRotO;
float xd = (xo + 51) - xMouse;
float yd = (yo + 75 - 50) - yMouse;
@ -61,17 +63,21 @@ void InventoryScreen::renderBg(float a) {
Lighting::turnOn();
glRotatef(-45 - 90, 0, 1, 0);
glRotatef(-(float) atan(yd / 40.0f) * 20, 1, 0, 0);
glRotatef(-(float)atan(yd / 40.0f) * 20, 1, 0, 0);
minecraft->player->yBodyRot = (float) atan(xd / 40.0f) * 20;
minecraft->player->yRot = (float) atan(xd / 40.0f) * 40;
minecraft->player->xRot = -(float) atan(yd / 40.0f) * 20;
minecraft->player->yBodyRot = (float)atan(xd / 40.0f) * 20;
minecraft->player->yRot = (float)atan(xd / 40.0f) * 40;
minecraft->player->xRot = -(float)atan(yd / 40.0f) * 20;
minecraft->player->yHeadRot = (float)atan(xd / 40.0f) * 40;
minecraft->player->yHeadRotO = (float)atan(xd / 40.0f) * 40;
glTranslatef(0, minecraft->player->heightOffset, 0);
EntityRenderDispatcher::instance->playerRotY = 180;
EntityRenderDispatcher::instance->render(minecraft->player, 0, 0, 0, 0, 1);
minecraft->player->yBodyRot = oybr;
minecraft->player->yRot = oyr;
minecraft->player->xRot = oxr;
minecraft->player->yHeadRot = oyh;
minecraft->player->yHeadRotO = oyhp;
glPopMatrix();
Lighting::turnOff();
glDisable(GL_RESCALE_NORMAL);

View file

@ -9,6 +9,8 @@
#include "../../../Minecraft.World/Headers/net.minecraft.world.level.h"
#include "../../../Minecraft.World/Headers/net.minecraft.stats.h"
#include "../../Player/LocalPlayer.h"
#include "../../Player/MultiPlayerLocalPlayer.h"
#include "../../MinecraftServer.h"
PauseScreen::PauseScreen() {
saveStep = 0;
@ -30,6 +32,11 @@ void PauseScreen::init() {
buttons.push_back(new Button(0, width / 2 - 100, height / 4 + 24 * 4 + yo,
L"LOptions..."));
buttons.push_back(new Button(4, width / 2 - 100, height / 4 + 24 * 1 + yo,
I18n::get(L"menu.returnToGame")));
buttons.push_back(new Button(0, width / 2 - 100, height / 4 + 24 * 4 + yo,
I18n::get(L"menu.options")));
buttons.push_back(new Button(5, width / 2 - 100, height / 4 + 24 * 2 + yo,
98, 20, I18n::get(L"gui.achievements")));
buttons.push_back(new Button(6, width / 2 + 2, height / 4 + 24 * 2 + yo, 98,
@ -41,28 +48,30 @@ void PauseScreen::init() {
*/
}
void PauseScreen::buttonClicked(Button button) {
if (button.id == 0) {
void PauseScreen::buttonClicked(Button* button) {
if (button->id == 0) {
minecraft->setScreen(new OptionsScreen(this, minecraft->options));
}
if (button.id == 1) {
if (minecraft->isClientSide()) {
minecraft->level->disconnect();
}
if (button->id == 1) {
// TODO: proper disconnects
// if (minecraft->isClientSide())
// {
// minecraft->level->disconnect();
// }
minecraft->setLevel(NULL);
minecraft->setScreen(new TitleScreen());
// minecraft->setLevel(NULL);
// minecraft->setScreen(new TitleScreen());
}
if (button.id == 4) {
if (button->id == 4) {
minecraft->setScreen(NULL);
// minecraft->grabMouse(); // 4J - removed
}
if (button.id == 5) {
if (button->id == 5) {
// minecraft->setScreen(new AchievementScreen(minecraft->stats));
// // 4J TODO - put back
}
if (button.id == 6) {
if (button->id == 6) {
// minecraft->setScreen(new StatsScreen(this, minecraft->stats));
// // 4J TODO - put back
}

View file

@ -13,7 +13,7 @@ public:
protected:
using Screen::buttonClicked;
virtual void buttonClicked(Button button);
virtual void buttonClicked(Button* button);
public:
virtual void tick();

View file

@ -10,6 +10,7 @@
#include "../../../Minecraft.World/Headers/net.minecraft.locale.h"
#include "../../../Minecraft.World/Platform/System.h"
#include "../../../Minecraft.World/Util/Random.h"
#include <GL/gl.h>
#include "TitleScreen.h"
Random* TitleScreen::random = new Random();
@ -36,13 +37,12 @@ while ( !(line = br->readLine()).empty() )
{
splashes.push_back(line);
}
}
br->close();
delete br;
*/
br->close();
delete br;
*/
splash = L""; // splashes.at(random->nextInt(splashes.size()));
// splash = L""; //splashes.at(random->nextInt(splashes.size()));
// } catch (Exception e) {
// }
@ -122,4 +122,37 @@ void TitleScreen::buttonClicked(Button* button) {
void TitleScreen::render(int xm, int ym, float a) {
// 4J Unused - Iggy Flash UI renders the title screen on consoles
#ifdef ENABLE_JAVA_GUIS
renderBackground();
Tesselator* t = Tesselator::getInstance();
int logoWidth = 155 + 119;
int logoX = width / 2 - logoWidth / 2;
int logoY = 30;
glBindTexture(GL_TEXTURE_2D,
minecraft->textures->loadTexture(TN_TITLE_MCLOGO));
glColor4f(1, 1, 1, 1);
blit(logoX + 0, logoY + 0, 0, 0, 155, 44);
blit(logoX + 155, logoY + 0, 0, 45, 155, 44);
t->color(0xffffff);
glPushMatrix();
glTranslatef((float)width / 2 + 90, 70, 0);
glRotatef(-20, 0, 0, 1);
float sss = 1.8f - Mth::abs(Mth::sin(System::currentTimeMillis() % 1000 /
1000.0f * PI * 2) *
0.1f);
sss = sss * 100 / (font->width(splash) + 8 * 4);
glScalef(sss, sss, sss);
drawCenteredString(font, splash, 0, -8, 0xffff00);
glPopMatrix();
drawString(font, ClientConstants::VERSION_STRING, 2, 2, 0x505050);
wstring msg = L"Copyright Mojang AB. Do not distribute.";
drawString(font, msg, width - font->width(msg) - 2, height - 10, 0xffffff);
Screen::render(xm, ym, a);
#endif
}

View file

@ -16,26 +16,29 @@ void VideoSettingsScreen::init() {
Language* language = Language::getInstance();
this->title = language->getElement(L"options.videoTitle");
// 4J - this was as static array but moving it into the function to remove
// any issues with static initialisation order
const Options::Option* items[8] = {
Options::Option::GRAPHICS, Options::Option::RENDER_DISTANCE,
Options::Option::AMBIENT_OCCLUSION, Options::Option::FRAMERATE_LIMIT,
Options::Option::ANAGLYPH, Options::Option::VIEW_BOBBING,
Options::Option::GUI_SCALE, Options::Option::ADVANCED_OPENGL};
const Options::Option* items[10] = {Options::Option::GRAPHICS,
Options::Option::RENDER_DISTANCE,
Options::Option::AMBIENT_OCCLUSION,
Options::Option::FRAMERATE_LIMIT,
Options::Option::ANAGLYPH,
Options::Option::VIEW_BOBBING,
Options::Option::GUI_SCALE,
Options::Option::ADVANCED_OPENGL,
Options::Option::GAMMA,
Options::Option::FOV};
for (int i = 0; i < 10; i++) {
const Options::Option* item = items[i];
int xPos = width / 2 - 155 + (i % 2 * 160);
int yPos = height / 6 + 24 * (i / 2);
for (int position = 0; position < 8; position++) {
const Options::Option* item = items[position];
if (!item->isProgress()) {
buttons.push_back(new SmallButton(
item->getId(), width / 2 - 155 + position % 2 * 160,
height / 6 + 24 * (position >> 1), item,
options->getMessage(item)));
buttons.push_back(new SmallButton(item->getId(), xPos, yPos, item,
options->getMessage(item)));
} else {
buttons.push_back(new SlideButton(
item->getId(), width / 2 - 155 + position % 2 * 160,
height / 6 + 24 * (position >> 1), item,
options->getMessage(item), options->getProgressValue(item)));
buttons.push_back(new SlideButton(item->getId(), xPos, yPos, item,
options->getMessage(item),
options->getProgressValue(item)));
}
}
@ -43,7 +46,7 @@ void VideoSettingsScreen::init() {
// 6 + 24 * 4 + 12, language.getElement("options.video")));
// buttons.add(new Button(CONTROLS_BUTTON_ID, width / 2 - 100, height
// / 6 + 24 * 5 + 12, language.getElement("options.controls")));
buttons.push_back(new Button(200, width / 2 - 100, height / 6 + 24 * 7,
buttons.push_back(new Button(200, width / 2 - 100, height / 6 + 24 * 6,
language->getElement(L"gui.done")));
}
@ -52,21 +55,18 @@ void VideoSettingsScreen::buttonClicked(Button* button) {
if (button->id < 100 && (dynamic_cast<SmallButton*>(button) != NULL)) {
options->toggle(((SmallButton*)button)->getOption(), 1);
button->msg = options->getMessage(Options::Option::getItem(button->id));
return;
}
if (button->id == 200) {
minecraft->options->save();
minecraft->setScreen(lastScreen);
return;
}
ScreenSizeCalculator ssc(minecraft->options, minecraft->width,
minecraft->height);
int screenWidth = ssc.getWidth();
int screenHeight = ssc.getHeight();
Screen::init(minecraft, screenWidth, screenHeight); // 4J - was this.init
}
void VideoSettingsScreen::render(int xm, int ym, float a) {
renderBackground();
drawCenteredString(font, title, width / 2, 20, 0xffffff);
Screen::render(xm, ym, a);
}
}

View file

@ -73,6 +73,14 @@ if get_option('enable_shiggy')
client_dependencies += shiggy_dep
endif
if get_option('enable_java_guis')
global_cpp_defs += '-DENABLE_JAVA_GUIS'
endif
if get_option('enable_shiggy') and get_option('enable_java_guis')
error('You cannot use the Iggy and Java UI at the same time, please choose one.')
endif
client = executable('Minecraft.Client',
client_sources + platform_sources + localisation[1],
include_directories : include_directories('Platform', 'Platform/Linux/Iggy/include'),

View file

@ -1,11 +1,66 @@
#include "../Platform/stdafx.h"
#include "Language.h"
#include "../IO/Files/File.h"
#include "../IO/Files/FileInputStream.h"
// 4J - TODO - properly implement
// 4jcraft: done!
Language* Language::singleton = nullptr;
Language::Language() {}
Language::Language() {
// TODO: move the language loading out of the init to better match 1.3.x
// see StringTranslate.java in MCP 7.x for more context
File langFile(L"Common/res/lang/en_US.lang");
if (langFile.exists()) {
InputStream* stream = new FileInputStream(langFile);
if (stream) {
__int64 fileSize = langFile.length();
if (fileSize > 0) {
// 4jcraft: we would've used BufferedReader like the JE
// equivalent here, but the lang file starts with a newline,
// causing readLine() in this BufferedReader impl to just return
// an empty string
//
// InputStreamReader reader(stream);
// BufferedReader bufferedReader(&reader);
// std::wstring line;
byteArray buffer((unsigned int)fileSize);
int bytesRead = stream->read(buffer, 0, (unsigned int)fileSize);
if (bytesRead > 0) {
std::string content(reinterpret_cast<char*>(buffer.data),
bytesRead);
std::istringstream iss(content);
std::string line;
// while (!(line = bufferedReader.readLine()).empty()) {
while (std::getline(iss, line)) {
size_t start = line.find_first_not_of(" \t\r\n");
if (start == std::string::npos) continue;
size_t end = line.find_last_not_of(" \t\r\n");
std::string trimmed =
line.substr(start, end - start + 1);
if (trimmed.empty() || trimmed[0] == '#') continue;
size_t equalsPos = trimmed.find('=');
if (equalsPos != std::string::npos) {
std::string key = trimmed.substr(0, equalsPos);
std::string value = trimmed.substr(equalsPos + 1);
std::wstring wkey(key.begin(), key.end());
std::wstring wvalue(value.begin(), value.end());
translateTable[wkey] = wvalue;
}
}
}
}
delete stream;
}
}
}
Language* Language::getInstance() {
// 4jcraft, fixes static init fiassco in I18n.cpp
@ -31,19 +86,39 @@ std::wstring Language::getElement(std::wstring elementId, ...) {
#else
va_list args;
va_start(args, elementId);
return getElement(elementId, args);
std::wstring result = getElement(elementId, args);
va_end(args);
return result;
#endif
}
std::wstring Language::getElement(const std::wstring& elementId, va_list args) {
// 4J TODO
return elementId;
auto it = translateTable.find(elementId);
std::wstring formatString =
(it != translateTable.end()) ? it->second : elementId;
if (formatString.find(L'%') != std::wstring::npos) {
int bufferSize = formatString.length() + 256;
std::vector<wchar_t> buffer(bufferSize);
int written =
vswprintf(buffer.data(), bufferSize, formatString.c_str(), args);
if (written >= 0) {
return std::wstring(buffer.data(), written);
}
}
return formatString;
}
std::wstring Language::getElementName(const std::wstring& elementId) {
return elementId;
std::wstring nameKey = elementId + L".name";
auto it = translateTable.find(nameKey);
return (it != translateTable.end()) ? it->second : elementId;
}
std::wstring Language::getElementDescription(const std::wstring& elementId) {
return elementId;
std::wstring descKey = elementId + L".description";
auto it = translateTable.find(descKey);
return (it != translateTable.end()) ? it->second : elementId;
}

View file

@ -3,6 +3,7 @@
class Language {
private:
static Language* singleton;
std::unordered_map<std::wstring, std::wstring> translateTable;
public:
Language();

View file

@ -4,7 +4,7 @@
![](.github-assets/opengl.gif) ![](.github-assets/adobe_getflash2.gif) ![](.github-assets/flash_get_20010813.gif) ![](.github-assets/SiliconValley_7479_English_imagens_get_flashplayer.gif)
---
4JCraft is a modified version of the Minecraft Console Legacy Edition aimed on porting old Minecraft to different platforms (such as Linux, Android, Emscripten, etc.) and refactoring the codebase to improve organization and use modern C++ features.
4JCraft is a modified version of the Minecraft Console Legacy Edition, aimed at porting old Minecraft to different platforms (such as Linux, Android, Emscripten, etc.) and refactoring the codebase to improve organization and use modern C++ features.
Join our community:
* **Discord:** https://discord.gg/zFCwRWkkUg
@ -68,9 +68,6 @@ docker run -it -v $(pwd):/workspaces/4jcraft -w /workspaces/4jcraft 4jcraft-dev
This project uses the [Meson](https://mesonbuild.com/) build system (with [Ninja](https://ninja-build.org/)).
> [!IMPORTANT]
> If you are using GCC, then GCC 15 or newer is currently *required* to build this project. Ubuntu installations in particular may have older versions preinstalled, so verify your compiler version with `gcc --version`.
#### Install Tooling
Follow [this Quickstart guide](https://mesonbuild.com/Quick-guide.html) for installing or building Meson and Ninja on your respective distro.

View file

@ -2,7 +2,7 @@ project('4jcraft-chucklegrounds', ['cpp', 'c'],
version : '0.1.0',
meson_version: '>= 1.1',
default_options : [
'cpp_std=c++26',
'cpp_std=c++23',
'warning_level=0',
'buildtype=debug', # for now
'unity=on', # merge source files per target

View file

@ -1,3 +1,8 @@
option('enable_java_guis',
type : 'boolean',
value : false,
description : 'Re-enable the Java UI remnants in the code (for testing only)')
option('enable_vsync',
type : 'boolean',
value : true,