Skip to content

Instantly share code, notes, and snippets.

View tomocrafter's full-sized avatar
🏠
Working from home

tomotomo tomocrafter

🏠
Working from home
View GitHub Profile
const minute = 60;
const hour = minute * 60;
const day = hour * 24;
const week = day * 7;
const month = day * 30;
const year = day * 365;
/**
* Convert a date to a relative time string, such as
* "a minute ago", "in 2 hours", "yesterday", "3 months ago", etc.
@dktapps
dktapps / blockstate_protocol.md
Last active December 4, 2020 05:20 — forked from Tomcc/blockstate_protocol.md
Block Changes in Beta 1.2.13

Block Storage & Network Protocol Changes

Paletted chunks & removing BlockIDs brings a few big changes to how blocks are represented. In Bedrock, Blocks used to be represented by their 8 bit ID and 4 bit data; this means that we can only represent 256 blocks and 16 variants for each block. As it happens we ran out of IDs in Update Aquatic, so we had to do something about it :)

After this change, we can represent infinite types of Blocks and infinite BlockStates, just like in Java. BlockStates are what is sent over the network as they are roughly equivalent to the old ID+data information, eg. they're all the information attached to a block.

BlockStates are serialized in two ways:

PersistentID: a PersistentID is a NBT tag containing the BlockState name and its variant number; for example

@wakame0731
wakame0731 / ServerSettings.md
Last active October 10, 2022 06:52
設定画面に独自のフォームを出す方法

設定画面に独自のフォームを出す方法

ここに書いてあるコード、情報に誤りがあり、あなたにいかなる損害を与えたとしても私は責任を負わないものとします。 2017/10/05 wakame0731

1.2のアップデートで設定画面に独自のフォームが出せるようになりました。
ここではその出し方について説明したいと思います。

設定画面の送り方

送るjsonのサンプル

{
@5S
5S / Twitter-Account-Generate-API.txt
Created February 2, 2017 10:03
Undocumented Twitter Account Generate API
/*
非公式 Twitter アカウント生成 API
Twitter も廃れ始め、そろそろ潮時だと考えたため公開します。
某氏が公開した API 1.0 の account/generate のほか、独自に発見した API 1.1 の account/create と
認証不要の mobile_client_api/signup もまとめてあります。
何かの役に立つかもしれません。
mobile_client_api/signup については最近テストしていないので、使えないかもしれません。
その場合は情報のみということで。
@hugmanrique
hugmanrique / SwordAnimation.java
Last active October 22, 2022 02:30
Small ArmorStand animation created with the Bukkit API
public class SwordAnimation {
// Config variables
private static final float SEPARATOR = 2;
private static final float RAD_PER_SEC = 1.5F;
private static final float RAD_PER_TICK = RAD_PER_SEC / 20F;
private Location center;
private double radius;
private List<ArmorStand> swords;
@tomocrafter
tomocrafter / autoexec.cfg
Last active March 17, 2023 15:31
DPI: 3700, 参考: https://gist.github.com/KiloSwiss/a015b0620284ce74b5ed849ec599e51e -novid -nojoy -full -language bananagaming -noforcemaccel -noforcemspd -noforcemparms +exec autoexec -tickrate 128
echo "Loading autoexec..."
cl_interp "0"//ヒットボックスの正確化
cl_interp_ratio "1"//ヒットボックスの正確化
cl_interpolate "1"// エンティティ補完
cl_predict "1"// クライアントサイドで補完
cl_lagcompensation "1"//スキンズレ正確化
cl_downloadfilter "all"
//logの設定
@mkotb
mkotb / SimpleScoreboard.java
Last active December 24, 2022 02:29
Non-flickering scoreboard implementation; create scoreboards with ease.
import com.google.common.base.Charsets;
import com.google.common.base.Splitter;
import com.google.common.collect.Lists;
import org.bukkit.Bukkit;
import org.bukkit.ChatColor;
import org.bukkit.OfflinePlayer;
import org.bukkit.entity.Player;
import org.bukkit.scoreboard.*;
import java.lang.reflect.Constructor;
@rsky
rsky / cli-do-not-echo-password.php
Created January 23, 2011 23:07
PHPのコマンドラインツールでパスワードを要求するときの定番コード
<?php
// STDOUT or STDERR は場合に応じて
fwrite(STDERR, 'Password: ');
if (strncasecmp(PHP_OS, 'WIN', 3) === 0) {
// WindowsではエコーバックをOFFにできない?
@flock(STDIN, LOCK_EX);
$password = fgets(STDIN);
@flock(STDIN, LOCK_UN);
} else {
system('stty -echo'); // エコーバックをOFFにする