88 lines
3.1 KiB
Python
88 lines
3.1 KiB
Python
|
|
import os, zipfile, io
|
||
|
|
from PIL import Image
|
||
|
|
|
||
|
|
client_jar = r'1.21.1\.gradle\mavenizer\repo\net\minecraft\client-extra\1.21.1-20240808.132146\client-extra-1.21.1-20240808.132146.jar'
|
||
|
|
with zipfile.ZipFile(client_jar) as z:
|
||
|
|
wb_data = z.read('assets/minecraft/textures/item/water_bucket.png')
|
||
|
|
|
||
|
|
wb = Image.open(io.BytesIO(wb_data)).convert('RGBA')
|
||
|
|
|
||
|
|
# Create fixed kofola bucket
|
||
|
|
kb = wb.copy()
|
||
|
|
kbp = kb.load()
|
||
|
|
|
||
|
|
liquid_coords = [
|
||
|
|
# Row 3 (top liquid layer)
|
||
|
|
(4, 3, (42, 17, 5, 255)),
|
||
|
|
(5, 3, (61, 28, 8, 255)),
|
||
|
|
(6, 3, (245, 222, 192, 255)), # foam speck
|
||
|
|
(7, 3, (88, 43, 16, 255)),
|
||
|
|
(8, 3, (74, 35, 12, 255)),
|
||
|
|
(9, 3, (224, 191, 154, 255)), # foam speck
|
||
|
|
(10, 3, (61, 28, 8, 255)),
|
||
|
|
(11, 3, (42, 17, 5, 255)),
|
||
|
|
# Row 4 (middle liquid layer)
|
||
|
|
(3, 4, (36, 14, 4, 255)),
|
||
|
|
(4, 4, (74, 35, 12, 255)),
|
||
|
|
(5, 4, (106, 55, 22, 255)),
|
||
|
|
(6, 4, (135, 76, 35, 255)), # bubble reflection
|
||
|
|
(7, 4, (88, 43, 16, 255)),
|
||
|
|
(8, 4, (74, 35, 12, 255)),
|
||
|
|
(9, 4, (118, 63, 27, 255)),
|
||
|
|
(10, 4, (74, 35, 12, 255)),
|
||
|
|
(11, 4, (61, 28, 8, 255)),
|
||
|
|
(12, 4, (36, 14, 4, 255)),
|
||
|
|
# Row 5 (bottom liquid layer)
|
||
|
|
(5, 5, (42, 17, 5, 255)),
|
||
|
|
(6, 5, (61, 28, 8, 255)),
|
||
|
|
(7, 5, (74, 35, 12, 255)),
|
||
|
|
(8, 5, (74, 35, 12, 255)),
|
||
|
|
(9, 5, (61, 28, 8, 255)),
|
||
|
|
(10, 5, (42, 17, 5, 255)),
|
||
|
|
]
|
||
|
|
|
||
|
|
for x, y, col in liquid_coords:
|
||
|
|
kbp[x, y] = col
|
||
|
|
|
||
|
|
# Save to all texture locations
|
||
|
|
destinations = [
|
||
|
|
r'src\main\resources\assets\kofola\textures\item\kofola_bucket.png',
|
||
|
|
r'1.19.2\src\main\resources\assets\kofola\textures\item\kofola_bucket.png',
|
||
|
|
r'1.21.1\src\main\resources\assets\kofola\textures\item\kofola_bucket.png',
|
||
|
|
]
|
||
|
|
|
||
|
|
for dst in destinations:
|
||
|
|
kb.save(dst)
|
||
|
|
print(f'Saved: {dst}')
|
||
|
|
|
||
|
|
# Generate comparison image
|
||
|
|
artifact_dir = r'C:\Users\Dominik\.gemini\antigravity\brain\1a86ea23-89fd-4192-accd-1ecdc8465aaa'
|
||
|
|
old_img_path = os.path.join(artifact_dir, '.user_uploaded', 'media_1794768442970_e521b389.png')
|
||
|
|
old_img = Image.open(old_img_path).convert('RGBA')
|
||
|
|
|
||
|
|
# Scale new image to 128x128
|
||
|
|
new_scaled = kb.resize((128, 128), Image.NEAREST)
|
||
|
|
old_scaled = old_img.resize((128, 128), Image.NEAREST)
|
||
|
|
|
||
|
|
comp_canvas = Image.new('RGBA', (128 * 2 + 60, 128 + 40), (28, 28, 34, 255))
|
||
|
|
comp_canvas.paste(old_scaled, (20, 20), old_scaled)
|
||
|
|
comp_canvas.paste(new_scaled, (20 + 128 + 20, 20), new_scaled)
|
||
|
|
comp_path = os.path.join(artifact_dir, 'kofola_bucket_comparison.png')
|
||
|
|
comp_canvas.save(comp_path)
|
||
|
|
print(f'Comparison image saved to: {comp_path}')
|
||
|
|
|
||
|
|
# Also update showcase image in artifact directory
|
||
|
|
items = ['kofola_bottle.png', 'kofola_can.png', 'draft_kofola.png', 'kofo_syrup.png', 'kofola_bucket.png']
|
||
|
|
base_path = r'src\main\resources\assets\kofola\textures\item'
|
||
|
|
canvas = Image.new('RGBA', (16 * 8 * len(items) + 40, 16 * 8 + 40), (32, 24, 20, 255))
|
||
|
|
x_off = 20
|
||
|
|
for item_name in items:
|
||
|
|
p = os.path.join(base_path, item_name)
|
||
|
|
im = Image.open(p).convert('RGBA')
|
||
|
|
im_scaled = im.resize((128, 128), Image.NEAREST)
|
||
|
|
canvas.paste(im_scaled, (x_off, 20), im_scaled)
|
||
|
|
x_off += 128 + 8
|
||
|
|
|
||
|
|
canvas.save(os.path.join(artifact_dir, 'kofola_showcase.png'))
|
||
|
|
print('Showcase updated!')
|