Skip to content

Instantly share code, notes, and snippets.

@AlexiyOrlov
AlexiyOrlov / vector2d.gml
Created February 28, 2024 19:23
Vector 2D for Game maker studio (unlike original, this one is immutable)
function vec2() constructor
{
#region Initialize Vector
__IS_VEC_3 = false;
#region Setup
/// Set available parameters
var paramArray = array_create(2,0);
@AlexiyOrlov
AlexiyOrlov / GenerateNoise.cpp
Created February 24, 2024 19:24
Noise generation at an arbitrary position for terrain
void GenerateNoise(int width, int height, float scale, int octaves, int positionX, int positionY)
{
for (int y = positionY; y < positionY + height; y++)
{
for (int x = positionX; x < positionX + width; x++)
{
float sampleX = (float)x / width * scale;
float sampleY = (float)y / height * scale;
float noise = 0.0f;
@AlexiyOrlov
AlexiyOrlov / AStarFloat.cs
Created December 8, 2023 17:48
A* pathfinding for floating point coordinates
public class FloatCell
{
public bool walkable = true;
public float x, y;
public int hCost, gCost, fCost;
public FloatCell previous;
public FloatCell(float x,float y)
{
this.x = x;
@AlexiyOrlov
AlexiyOrlov / AStar.cs
Created December 8, 2023 17:45
A* pathfinding
public class NavigationGrid
{
public int width, height;
public Cell[,] cells;
public NavigationGrid(int width, int height)
{
this.width = width;
this.height = height;
cells = new Cell[width, height];
@AlexiyOrlov
AlexiyOrlov / XMLHTTPRequest.js
Created November 19, 2019 15:10
XmlHttpRequest which POSTs a parameter to local server on document load and recieves a response as text.
let request = new XMLHttpRequest();
request.responseType = 'text';
document.onload = function () {
if (request.status === 200 && request.readyState === XMLHttpRequest.DONE) {
console.log(request.responseText)
}
else console.log(request);
};
request.open('POST', 'http://localhost:4700', true);
request.send('param');
@AlexiyOrlov
AlexiyOrlov / FabricSpawnRestriction.java
Last active October 15, 2019 16:46
Access to registration of net.minecraft.entity.SpawnRestriction.Entry
package net.fabricmc.fabric.api.entity;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityType;
import net.minecraft.entity.SpawnRestriction;
import net.minecraft.world.Heightmap;
import java.util.ArrayList;
import java.util.List;
import java.util.Objects;
@AlexiyOrlov
AlexiyOrlov / build.gradle
Created June 13, 2019 11:37
Gradle task configuration for mod decompilation. "remapMcSources" is final task here.
deobfMcSRG{
setFailOnAtError(false)
setInJar('lib/Thaumcraft-1.12.2-6.1.BETA26.jar')
setOutJar('lib/TC-1.jar')
}
decompileMc{
setInJar('lib/TC-1.jar')
setOutJar('lib/TC-2.jar')
}