Skip to content

Instantly share code, notes, and snippets.

public enum OptionalBoolean
{
TRUE(Boolean.TRUE),
FALSE(Boolean.FALSE),
EMPTY(null);
private final Boolean value;
private OptionalBoolean(Boolean value)
{
@Daomephsta
Daomephsta / LazilyParsedCondition.java
Last active February 22, 2020 05:45
LazilyParsedCondition.java
package net.minecraftforge.common.crafting.conditions;
import com.google.gson.JsonElement;
import com.google.gson.JsonObject;
import java.util.Map;
import net.minecraft.util.ResourceLocation;
import net.minecraftforge.common.crafting.CraftingHelper;
import net.minecraftforge.common.util.Lazy;
public class LazilyParsedCondition implements ICondition
@Daomephsta
Daomephsta / DelegatingArgumentType.java
Created November 19, 2019 03:32
DelegatingArgumentType
public class DelegatingArgumentType implements ArgumentType<String>
{
private final ArgumentType<?> delegate;
private DelegatingArgumentType(ArgumentType<?> delegate)
{
this.delegate = delegate;
}
public static DelegatingArgumentType delegate(ArgumentType<?> delegate)
error[E0382]: use of moved value: `t`
--> src\main.rs:12:71
|
12 | let f = |t: BigRational| (num::pow::pow(t.mul(&two), 2).sub(&two)+t.mul(two)) / (num::pow::pow(t, 2).sub(BigInt::one()));
| - - ^ value used here after move
| | |
| | value moved here
| move occurs because `t` has type `num_rational::Ratio<num_bigint::bigint::BigInt>`, which does not implement the `Copy` trait
error[E0382]: use of moved value: `t`
public abstract class GuideContainerWidget extends GuideWidget implements LayoutContainer
{
private final Map<GuideWidget, LayoutElementMetrics> elementMetrics = new HashMap<>();
private final LayoutContainerMetrics metrics = new LayoutContainerMetrics();
@Override
public Iterable<? extends GuideWidget> getLayoutChildren()
{
return elementMetrics.keySet();
}
package io.github.daomephsta.polar.client.mixin;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.UUID;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
@Override
public AddAttributeModifiersRecipeProcessor read(String recipeId, PacketByteBuf bytes)
{
int uniqueKeys = bytes.readVarInt();
Multimap<String, Entry<EntityAttributeModifier, EquipmentSlot>> modifiers = ArrayListMultimap.create();
for (int i = 0; i < uniqueKeys; i++)
{
String attributeId = bytes.readString();
int valuesForKey = bytes.readVarInt();
for (int j = 0; j < valuesForKey; j++)
package io.github.daomephsta.polar.client.mixin;
import org.spongepowered.asm.mixin.Final;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Shadow;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
import org.spongepowered.asm.mixin.injection.callback.LocalCapture;
@Daomephsta
Daomephsta / build.gradle
Created August 9, 2019 11:07
Loom Machine Broke
plugins {
id 'io.github.daomephsta.warp'
id 'fabric-loom' version '0.2.5-SNAPSHOT'
}
sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8
archivesBaseName = group = 'functionalTest'
version = '1.0.0'
use azul::prelude::*;
use azul::app::AppStateNoData;
use azul::callbacks::{DefaultCallback, DefaultCallbackId};
use azul::widgets::button::Button;
use azul::widgets::label::Label;
use azul::window::FakeWindow;
use std::marker::PhantomData;
pub struct IntegerUpDown<T : Layout>