Skip to content

Instantly share code, notes, and snippets.

@SpaceManiac
SpaceManiac / chunk-send-event.txt
Last active November 13, 2017 17:35
Chunk Send Event / Send Chunk Update API rough sketch & notes
Chunk Send Event / Send Chunk Update API rough sketch & notes
<Wolvereness> SpaceManiac: 1/3 of the problem is addresssing where to hook this, 1/3 of the problem
is addressing how to have a mutable block of memory with sensible API, 1/3 of the problem is
address performance concerns like bulk and compression
JIRA Ticket: BUKKIT-5642 Chunk Send Event and Methods
Vaguely related tickets:
BUKKIT-4114: Fast mass block update API
@SpaceManiac
SpaceManiac / InvSerialize.java
Last active August 29, 2015 14:01
Serialization/deserialization of entire inventories
// Usage:
inv.setContents(deserializeAll(config.getMapList("xyz")));
config.set("xyz", serializeAll(inv.getContents()));
// Methods:
private ArrayList<Map<String, Object>> serializeAll(ItemStack[] contents) {
ArrayList<Map<String, Object>> items = new ArrayList<Map<String, Object>>();
if (contents == null) return items;
@SpaceManiac
SpaceManiac / CONTRIBUTING.md
Last active August 29, 2015 14:06
Draft of Glowstone contributing & PR handling guidelines

Contributing to Glowstone

Glowstone is a lightweight, open source Minecraft server written in Java. For those who wish to contribute, we encourage you to fork the repository and submit pull requests. Below you will find guidelines that will explain this process in further detail.

Quick Guide

  1. Create or find an issue on the issue tracker.
  2. Fork Glowstone if you haven't done so already.
  3. Create a branch dedicated to your change.
  4. Write code addressing your feature or bug.
# ---
# name: ParticleTest
# version: 1.0
# author: SpaceManiac
# commands:
# part:
# description: Particle testing
# ---
import quick
@SpaceManiac
SpaceManiac / FurnaceUpgrade.java
Created October 20, 2014 06:07
Double-speed furnace implementation, comments note how to make normal-speed.
package com.platymuus.bukkit.endmachines.machines;
import com.platymuus.bukkit.endmachines.MachineDescription;
import org.bukkit.*;
import org.bukkit.configuration.ConfigurationSection;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import org.bukkit.event.inventory.InventoryClickEvent;
import org.bukkit.event.inventory.InventoryCloseEvent;
package spongetest;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.spongepowered.api.Game;
import org.spongepowered.api.util.event.Subscribe;
import org.spongepowered.api.event.state.PreInitializationEvent;
import org.spongepowered.api.plugin.Plugin;
import org.spongepowered.api.plugin.PluginContainer;
@SpaceManiac
SpaceManiac / docs.rs
Created August 22, 2015 22:31
Demonstration of #[doc(inline)] not working as expected
mod ffi {
mod inner {
/// A Docs
pub type A = i32;
}
/// A Use Docs
#[doc(inline)]
pub use self::inner::A;
}

Keybase proof

I hereby claim:

  • I am SpaceManiac on github.
  • I am spacemaniac (https://keybase.io/spacemaniac) on keybase.
  • I have a public key whose fingerprint is DB3B 2679 BD6D F878 2216 F940 87EB 20C4 5D61 EFD5

To claim this, I am signing this object:

#![allow(non_camel_case_types)]
use std::mem;
// The Situation
struct ffi_Object;
type ffi_Callback = unsafe extern fn(*mut ffi_Object) -> u32;
extern fn ffi_push_callback(_: *mut ffi_Object, _: ffi_Callback) {}
// Dummy wrapper
struct Object {
extern crate memmap;
#[cfg(target_pointer_width = "32")]
const MAGIC_VALUE: usize = 0xdedbeef0;
#[cfg(target_pointer_width = "32")]
const WORD_SIZE: usize = 4;
#[cfg(target_pointer_width = "64")]
const MAGIC_VALUE: usize = 0xd0e0a0d0b0e0e0f0;
#[cfg(target_pointer_width = "64")]
const WORD_SIZE: usize = 8;