Skip to content

Instantly share code, notes, and snippets.

{
"images":
{
"modpack":
{
"image" : "mainmenu:modpack.png",
"posX" : -127,
"posY" : -245,
"width" : 250,
"height" : 150,
@Johni0702
Johni0702 / recover.py
Created March 12, 2016 10:12
tmcpr recovery script
#!/bin/python
from zipfile import ZipFile
import struct
import sys
import time
def recover(broken):
duration = 0
with open(broken) as bf:
while True:
@Johni0702
Johni0702 / restrictions.md
Last active October 11, 2019 16:44
Replay restrictions

Overview

Currently the ReplayMod is banned on quite a few servers. This is due to the fact that the user can move freely through the world. By allowing a server to place restrictions on a replay it might be allowed on more servers. It might also be useful to allow players to add (not remove) these restrictions to any of their replays in the Replay Viewer.

Backwards compatibility

To prevent new restricted replays from being opened in an older version or a replay viewer which doesn't support restricted replays, a Disconnect packet is inserted in the replay. Any replay viewer may only remove this disconnect packet when it fully supports restricted replays or wants to display a custom failure screen. The disconnect message should be Please update to view this replay. (otherwise the packet is ignored). The packet may be sent at any point in time and (obviously) has to be inserted manually by the recorder, not the server. There is nothing else a replay recorder has to

public void shiftClick(GlowPlayer player, InventoryView view, int clickedSlot, ItemStack clickedItem) {
// try to fill partial, then empty stacks
// first main inventory then hotbar
clickedItem = tryToFillSlots(clickedItem, player.getInventory(), 9, 36, 0, 9);
view.setItem(clickedSlot, clickedItem);
}
public static ItemStack tryToFillSlots(ItemStack stack, GlowInventory target, int...slots) {
if (slots.length % 2 != 0) {
# ---
# name: WindowClickTest
# version: 0.1-SNAPSHOT
# ---
import quick
@quick.event('inventory.InventoryClickEvent', priority='HIGH')
def onWindowClicked(event):
print '---- InventoryClickEvent ----'