Skip to content

Instantly share code, notes, and snippets.

View Podshot's full-sized avatar

Ben Gothard Podshot

  • Rose-Hulman Institute of Technology
  • Terre Haute, IN
View GitHub Profile
# Anywhere in your filter as long as it is not inside a function. Should be on the same column as "displayName"
VERSION = "<Filter Version. Checked against the Update Page's version>"
UPDATE_URL = "<URL that points to the filters update page. This should be in the Page Format above>"
# Rest of filter
@Podshot
Podshot / filter_thing_fast.py
Last active August 29, 2015 14:08
How to have a filter support both MCEdit-Legacy and MCEdit-Unified
# Thanks to TexelElf for this faster method of version independent editor grabbing code
def perform(level, box, options):
global editor
try:
editor
except:
import inspect
editor = inspect.stack()[1][0].f_locals.get('self', None).editor
@Podshot
Podshot / macros.json
Last active August 29, 2015 14:11
MCEdit Filter macro format
{
"Macros": {
"Test": {
"Number of steps": 3,
"0": {
"Inputs": {
"Biome": "Ocean"
},
"Name": "Setbiome"
},
@Podshot
Podshot / example_filter.py
Last active August 29, 2015 14:17
Library managing with MCEdit Filters (Supported after, but not including, version 1.3.1.0)
# Define the 'libraries' variable just like you would for inputs
# ====Notes====
# * ALWAYS check if the library is available, even if you mark it as '"optional": False'
# * If this ability is abused, it can\will be removed at any of the developers discretion, so please don't abuse it
# * The "path" field starts from a 'lib' subfolder in the 'Filters' directory
# * Keep the libraries small, MCEdit downloads the entire file, not just parts that are used in the filter
# * In reference to the note above, MCEdit downloads the libraries on the main thread, so the entire panel may take awhile to show up
# * These libraries can be other file types too, but you have to parse them and remember Note #3
@Podshot
Podshot / Builder.cs
Last active August 29, 2015 14:22
A Builder script I created to build all OS releases together without a lot of clicking
using UnityEngine;
using UnityEditor;
using System.Collections;
using System.Collections.Generic;
using System.IO;
using Stopwatch = System.Diagnostics.Stopwatch;
public class Builder {
private static string[] levels = new string[] {"Assets/<Scene File.unity>"};
# Example Filter that can be updated
VERSION = "0.0.0"
UPDATE_URL = "http://podshot.github.io/update_json.json"
def perform(level, box, options):
global editor
try:
editor
except:
@Podshot
Podshot / mcedit_waypoints.dat format
Created September 8, 2015 12:22
Format of the mcedit_waypoints.dat file
NBTFile: {2 Entries}
{
TAG_Compound(u'LastPosition'): {3 Entries}
{
TAG_Int(u'Dimension'): 0
TAG_List(u'Coordinates'): [3 TAG_Float(s)]
{
TAG_Float: 95.6182479858
TAG_Float: 59.3979263306
TAG_Float: -373.019592285
@Podshot
Podshot / EventListTest.py
Last active February 26, 2016 16:07
Crazy idea to have a list run callback functions when the data is manipulated. Performance is probably bad, and the implementation probably could be better, but it gets the job done. The name could also be a little more creative
from EventedList import EventedList
class Test:
def __init__(self):
self.old = [0,1,2,3,4,5,6,7,8,9,10]
self.list = EventedList(self.old)
self.list.register(self.testAppend, self.list.append)
self.list.register(self.testInsert, self.list.insert)
import filter_utils # Special import that is dynamically generated before the filter is loaded
print filter_utils.Available_Attributes() # Currently prints ['editor', 'materials']
print filter_utils.editor # Replaces the injected global 'editor' variable, points to a LevelEditor instance, old injected way still works
try:
inputs = (
("Block", filter_utils.materials["minecraft:stone[variant=granite]"]), # Gives the level's materials, instead of haveing to import alphaMaterials or pocketMaterials from pymclevel.materials
("Using new inputs", "label"),
)
@Podshot
Podshot / chunk_reader.py
Last active September 20, 2023 21:04
Proof of Concept for converting BlockState Long IDs to Palette indices. Critical for loading 1.13 Minecraft Java Edition worlds. Run with the command: "python proof_of_concept.py" to use. If you use any snippet of code from this, please give appropriate credit to the respective authors.
"""
Standalone chunk loader/reader from pymclevel with all the fancy repair/OOP stuff removed
"""
from __future__ import unicode_literals, print_function
import os
try:
from pymclevel import nbt
except ImportError:
import nbt
import struct