This commit is contained in:
2026-02-07 20:55:10 +01:00
parent 251083788d
commit 3af26761c9
42 changed files with 339 additions and 8 deletions

View File

@@ -43,5 +43,9 @@
"item.szar.ak47": "AK47",
"entity.szar.bullet": "Bullet",
"death.attack.bullet": "%1$s was shot by %2$s",
"death.attack.bullet.player": "%1$s was shot by %2$s"
"death.attack.bullet.player": "%1$s was shot by %2$s",
"item.szar.pop_tart": "Pop Tart",
"entity.szar.nyan_cat": "Nyan Cat",
"item.szar.nyan_cat_spawn_egg": "Nyan Cat Spawn Egg"
}

View File

@@ -0,0 +1,3 @@
{
"parent": "minecraft:item/template_spawn_egg"
}

View File

@@ -0,0 +1,6 @@
{
"parent": "minecraft:item/generated",
"textures": {
"layer0": "szar:item/pop_tart"
}
}

View File

@@ -0,0 +1,18 @@
{
"nyan_cat_first_loop": {
"sounds": [
{
"name": "szar:nyan_cat_first_loop",
"stream": true
}
]
},
"nyan_cat_loop": {
"sounds": [
{
"name": "szar:nyan_cat_loop",
"stream": true
}
]
}
}

View File

@@ -0,0 +1,83 @@
from PIL import Image
import os
def find_pixels_by_color(img, color):
"""Return list of (x, y) coordinates where the pixel matches the given color."""
width, height = img.size
pixels = img.load()
coords = []
for y in range(height):
for x in range(width):
if pixels[x, y][:3] == color: # ignore alpha if exists
coords.append((x, y))
return coords
def place_image(base_img, overlay_img, corner_coords):
"""Resize overlay_img to fit corner_coords and paste onto base_img (sharp, pixel-perfect)."""
if len(corner_coords) != 2:
raise ValueError("corner_coords must have exactly two points")
(x1, y1), (x2, y2) = corner_coords
# Calculate target box (left, top, right, bottom)
left = min(x1, x2)
top = min(y1, y2)
right = max(x1, x2)
bottom = max(y1, y2)
target_width = right - left + 1
target_height = bottom - top + 1
# Resize using NEAREST to keep pixels sharp
resized_overlay = overlay_img.resize((target_width, target_height), Image.Resampling.NEAREST)
base_img.paste(resized_overlay, (left, top), resized_overlay.convert("RGBA"))
def main(input_folder, texture_file, color1, color2, output_folder):
os.makedirs(output_folder, exist_ok=True)
texture = Image.open(texture_file).convert("RGBA")
texture_width, texture_height = texture.size
for filename in os.listdir(input_folder):
if not filename.lower().endswith(".png"):
continue
input_path = os.path.join(input_folder, filename)
overlay = Image.open(input_path).convert("RGBA")
# Create a transparent image of the same size as the texture
output_img = Image.new("RGBA", (texture_width, texture_height), (0, 0, 0, 0))
# Process first color
coords1 = find_pixels_by_color(texture, color1)
if len(coords1) != 2:
print(f"Warning: {filename} - color1 does not have exactly 2 pixels")
else:
place_image(output_img, overlay, coords1)
# Process second color (flipped horizontally)
coords2 = find_pixels_by_color(texture, color2)
if len(coords2) != 2:
print(f"Warning: {filename} - color2 does not have exactly 2 pixels")
else:
flipped_overlay = overlay.transpose(Image.FLIP_LEFT_RIGHT)
place_image(output_img, flipped_overlay, coords2)
# Save output
output_path = os.path.join(output_folder, filename)
output_img.save(output_path)
print(f"Saved {output_path}")
if __name__ == "__main__":
# Example usage
input_folder = "nyan_cat_input"
texture_file = "nyan_cat_example.png"
color2 = (255, 0, 0) # red
color1 = (0, 138, 255) # blue
output_folder = "nyan_cat_textures"
main(input_folder, texture_file, color1, color2, output_folder)

Binary file not shown.

After

Width:  |  Height:  |  Size: 27 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 886 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 461 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 455 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 457 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 459 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 466 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 453 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 455 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 457 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 459 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 461 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 456 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 453 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 811 B