Skip to content

Instantly share code, notes, and snippets.

Avatar

Una unascribed

View GitHub Profile
View unholy.sh
if [ "$DESIRED_RELEASE" == "recommended" ]; then
# this is unholy, but Forge doesn't appear to supply an API, and
# their Maven repo appears to not be well formed
DESIRED_RELEASE=`curl -s http://files.minecraftforge.net/ |
grep -m 1 -A 2 '<td>Recommended' |
grep -v 'Recommended' |
cut -d '>' -f 2 |
cut -d '<' -f 1 |
tac |
head -c -1 |
View attackdamage.java
@Override
public Multimap getAttributeModifiers(ItemStack stack) {
Multimap multimap = super.getAttributeModifiers(stack);
double damage = /* ... */;
multimap.put(SharedMonsterAttributes.attackDamage.getAttributeUnlocalizedName(),
new AttributeModifier(field_111210_e, "<My item> damage modifier", damage, 0));
return multimap;
}
View Coins.java
long value = 123456;
// 56 bronze, 34 silver, 12 gold
int gold = (value / 10000);
int silver = (value / 100 % 100);
int bronze = (value % 100);
View build.gradle
minecraft {
srgExtra "PK: com/typesafe/config my/mod/package/repackage/com/typesafe/config"
}
configurations {
external
compile.extendsFrom external
}
dependencies {
View ItemMobPlacer.java
/** @author Aesen Vismea **/
@Override
public boolean onItemUse(ItemStack itemstack, EntityPlayer player, World world, int x, int y, int z, int side, float hitX, float hitY, float hitZ) {
EnumFacing face = EnumFacing.values()[side];
int xO = x+face.getFrontOffsetX();
int yO = y+face.getFrontOffsetY();
int zO = z+face.getFrontOffsetZ();
world.setBlock(xO, yO, zO, Blocks.mob_spawner);
TileEntityMobSpawner te = new TileEntityMobSpawner();
te.readFromNBT(itemstack.getTagCompound());
View build.gradle
buildscript {
repositories {
mavenCentral()
maven {
name = "forge"
url = "http://files.minecraftforge.net/maven"
}
maven {
name = "sonatype"
url = "https://oss.sonatype.org/content/repositories/snapshots/"
@unascribed
unascribed / 000-before.png
Last active Aug 29, 2015
Analog Modern - Reduces Analog's ugliness levels by up to 90% - Made for Analog 6.0
View z.groovy
o='';r=new Random();args[0].chars.any{o+=it;if(it.letter)(r.nextGaussian()*5+10).times{o+=(char)(768+r.nextInt(48))}}print o
@unascribed
unascribed / MaterialColor.java
Last active Sep 22, 2015
Premade Material Design color palettes for varying target platforms
View MaterialColor.java
package com.droidhackers.misc;
public class MaterialColor {
// File created by Aesen Vismea based off the Google Material Design spec
// http://www.google.com/design/spec/style/color.html#color-color-palette
// This is the Java edition.
// Updates: https://gist.github.com/AesenV/1cfc377df2fca5d00732
public static final int RED_50 = 0xFFFFEBEE;
View Blah.java
package com.unascribed.blah;
class Blah { // warning: Class Foo does not specify an access modifier (defaulting to package)
int blah; // warning: The field blah does not specify an access modifier and the
// class specifies no default (defaulting to package)
void hello() { // warning: The method hello does not specify an access modifier and
// the class specifies no default (defaulting to package)
System.out.println("Hello, World!");
}