This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import com.sun.jna.Library; | |
import com.sun.jna.Native; | |
import org.jnativehook.GlobalScreen; | |
import org.jnativehook.NativeHookException; | |
import org.jnativehook.keyboard.NativeKeyEvent; | |
import org.jnativehook.keyboard.NativeKeyListener; | |
import org.jnativehook.mouse.NativeMouseEvent; | |
import org.jnativehook.mouse.NativeMouseInputListener; | |
import java.awt.*; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package jarcode.consoles; | |
import net.minecraft.server.v1_8_R2.*; | |
import java.lang.reflect.Field; | |
import java.util.Arrays; | |
public class CommandBlockListenerWrapper extends CommandBlockListenerAbstract { | |
private static final Field COMMAND_RESULT, CHAT_COMPONENT; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package jarcode.consoles; | |
import com.google.common.collect.BiMap; | |
import com.google.common.collect.HashBiMap; | |
import jarcode.consoles.bungee.ConsoleBungeeHook; | |
import jarcode.consoles.computer.ComputerHandler; | |
import jarcode.consoles.util.LocalPosition; | |
import jarcode.consoles.util.PacketUtils; | |
import jarcode.consoles.util.Region; | |
import net.minecraft.server.v1_8_R2.*; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
boolean updated = false; | |
int i = 1 << scale; | |
int l = MathHelper.floor(updateX - (double) centerX) / i + 64; | |
int i1 = MathHelper.floor(updateZ - (double) centerZ) / i + 64; | |
int j1 = 128 / i; | |
if(world.worldProvider.o()) { | |
j1 /= 2; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
gson = new GsonBuilder() | |
.registerTypeAdapter(ConsoleMeta.class, new JsonSerializer<ConsoleMeta>() { | |
@Override | |
public JsonElement serialize(ConsoleMeta consoleMeta, Type type, | |
JsonSerializationContext jsonSerializationContext) { | |
JsonObject object = new JsonObject(); | |
object.add("location", | |
locationTypeAdapter.serialize(consoleMeta.location, null, jsonSerializationContext)); | |
object.add("face", new JsonPrimitive(consoleMeta.face.name())); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package ca.jarcode.consoles.util.gson; | |
import org.bukkit.Bukkit; | |
import org.bukkit.Location; | |
import org.bukkit.World; | |
import com.google.gson.*; | |
import java.lang.reflect.Type; | |
public class LocationTypeAdapter implements JsonSerializer<Location>, JsonDeserializer<Location> { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Faster split method, the only alternative within lua is using gsub, which | |
// is insanely slower. This function will actually return strings on the stack, | |
// so {str:split(d)} can be used to collect the return values in a table | |
// | |
// A more memory effecient use would be to use string.fsplit rather than using | |
// a table construct | |
// | |
// this avoids extra memory bloat and will keep the resulting strings on the stack | |
static int luaF_split(lua_State* state) { | |
if (lua_isstring(state, 1) && lua_isstring(state, 2)) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
An extremely simple set of macros for jumping and setting jmp_buf's in a stack to simulate very | |
basic exception handling | |
*/ | |
#ifndef LUAB_JMP_H_ | |
#define LUAB_JMP_H_ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private final Object WAIT_LOCK = new Object(); | |
private int taskCount = 0; | |
@FunctionalInterface | |
public interface SafeAsyncTask<E extends Throwable> { | |
public void run() throws E; | |
} | |
public void safeAsyncTask(final SafeAsyncTask task) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* 'eye' is the location of */ | |
double yaw = eye.getYaw() > 0 ? eye.getYaw() : 360 - Math.abs(eye.getYaw()); // remove negative degrees | |
yaw += 90; // rotate +90 degrees | |
if (yaw > 360) | |
yaw -= 360; | |
yaw = (yaw * Math.PI) / 180; | |
double pitch = ((eye.getPitch() + 90) * Math.PI) / 180; | |
// player-space |