Skip to content

Instantly share code, notes, and snippets.

using OpenGL_Testbed.Lib;
using OpenTK;
using OpenTK.Graphics;
using OpenTK.Graphics.OpenGL;
using System;
using System.IO;
namespace OpenGL_Testbed
{
public class CoordinateSystems : GameWindow
@Daomephsta
Daomephsta / BeamFiringBehaviour
Created December 10, 2017 21:28
Raytracing issues
public void fire(ItemStack stack, World world, EntityLivingBase shooter, EnumHand hand)
{
shooter.setActiveHand(hand);
Vec3d eyeVec = shooter.getPositionVector().addVector(0.0D, shooter.getEyeHeight(), 0.0D);
Vec3d targetVec = eyeVec.add(shooter.getLookVec().scale(maxRange));
if(pierceCount > 1) //Piercing
{
List<RayTraceResult> results = new ArrayList<>(pierceCount);
Helper.raytraceAll(results, world, shooter, eyeVec, targetVec);
if(results.isEmpty()) return;
@Daomephsta
Daomephsta / Cameras.cs
Last active December 13, 2017 21:42
OpenGL Testbed
using OpenGL_Testbed.Lib;
using OpenTK;
using OpenTK.Graphics;
using OpenTK.Graphics.OpenGL;
using System;
using System.IO;
using OpenTK.Input;
namespace OpenGL_Testbed
{
@Daomephsta
Daomephsta / TEST_MOD_GUIDELINES.md
Last active December 25, 2017 09:40
Forge Test Mod Guidelines (Initial Draft)

Writing a Test Mod - Guidelines

All feature-adding PRs need to have a test mod that demonstrates that the new feature works, and how to use it. A good test mod should:

  1. be minimal. All that should be demonstrated is that the PR works correctly, nothing more. However test mods do not need to be minified, class and member names should be sensible. Nor is line count an issue, follow the Forge class formatting conventions when writing a test mod.

  2. keep all classes in a single file. This can be achieved using nested classes.

  3. follow 'best practices' at the time of creation. Test mods should be written using the same 'best practices' used for writing mods, with the exception of keeping all classes in a single file. For example a test mod written for a PR targeting 1.12 Forge should use ObjectHolders & RegistryEvents.

public class WeakArrayList<E> extends AbstractList<E>
{
private List<WeakReference<E>> backingList = new ArrayList<>();
@Override
public E get(int index)
{
clean();
WeakReference<E> obj = backingList.get(index);
return obj != null ? obj.get() : null;
import java.util.Arrays;
public class RabbitProblem
{
private static final int DEATH_AGE = 96;
private static final int FERTILE_AGE = 4;
private static final int MALES_PER_LITTER = 5;
private static final int FEMALES_PER_LITTER = 9;
private static long[] maleAgeTracker = new long[DEATH_AGE];
package leviathan143.dogwhistle.common.capability;
import java.util.concurrent.Callable;
import leviathan143.dogwhistle.common.capability.PackHandler.Pack;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.nbt.NBTBase;
import net.minecraft.util.EnumFacing;
import net.minecraftforge.common.capabilities.*;
public static RayTraceResult raytraceClosestObject(World world, @Nullable Entity exclude, Vec3d startVec, Vec3d endVec)
{
RayTraceResult result = world.rayTraceBlocks(startVec, endVec);
double blockHitDistance = 0.0D; // The distance to the block that was
// hit
if (result != null) blockHitDistance = result.hitVec.distanceTo(startVec);
// Encloses the entire area where entities that could collide with this
// ray exist
AxisAlignedBB entitySearchArea = new AxisAlignedBB(startVec.x, startVec.y, startVec.z, endVec.x, endVec.y,
[13:20:22] [main/ERROR] [FML]: Unable to read a class file correctly
java.lang.RuntimeException: null
at org.objectweb.asm.ClassVisitor.visitModule(ClassVisitor.java:148) ~[asm-debug-all-6.0_BETA.jar:6.0_BETA]
at org.objectweb.asm.ClassReader.readModule(ClassReader.java:760) ~[asm-debug-all-6.0_BETA.jar:6.0_BETA]
at org.objectweb.asm.ClassReader.accept(ClassReader.java:661) ~[asm-debug-all-6.0_BETA.jar:6.0_BETA]
at org.objectweb.asm.ClassReader.accept(ClassReader.java:525) ~[asm-debug-all-6.0_BETA.jar:6.0_BETA]
at net.minecraftforge.fml.common.discovery.asm.ASMModParser.<init>(ASMModParser.java:58) [ASMModParser.class:?]
at net.minecraftforge.fml.common.discovery.JarDiscoverer.discover(JarDiscoverer.java:80) [JarDiscoverer.class:?]
at net.minecraftforge.fml.common.discovery.ContainerType.findMods(ContainerType.java:47) [ContainerType.class:?]
at net.minecraftforge.fml.common.discovery.ModCandidate.explore(ModCandidate.java:74) [ModCandidate.class:?]
2018-05-11 21:22:54,348 main WARN Unable to instantiate org.fusesource.jansi.WindowsAnsiOutputStream
2018-05-11 21:22:54,355 main WARN Unable to instantiate org.fusesource.jansi.WindowsAnsiOutputStream
[21:22:54] [main/INFO] [GradleStart]: Extra: []
[21:22:54] [main/INFO] [GradleStart]: Running with arguments: [--userProperties, {}, --assetsDir, C:/Users/User/.gradle/caches/minecraft/assets, --assetIndex, 1.12, --accessToken{REDACTED}, --version, 1.12.2, --tweakClass, net.minecraftforge.fml.common.launcher.FMLTweaker, --tweakClass, net.minecraftforge.gradle.tweakers.CoremodTweaker]
[21:22:54] [main/INFO] [LaunchWrapper]: Loading tweak class name net.minecraftforge.fml.common.launcher.FMLTweaker
[21:22:54] [main/INFO] [LaunchWrapper]: Using primary tweak class name net.minecraftforge.fml.common.launcher.FMLTweaker
[21:22:54] [main/INFO] [LaunchWrapper]: Loading tweak class name net.minecraftforge.gradle.tweakers.CoremodTweaker
[21:22:54] [main/INFO] [LaunchWrapper]: Calling tweak class net.minecraftforge.fml.c