Skip to content

Instantly share code, notes, and snippets.

View matshou's full-sized avatar
📚
Learning C++

Matthew Cain matshou

📚
Learning C++
  • Dresden, Germany
View GitHub Profile
@matshou
matshou / .project
Last active October 8, 2016 14:46
Mod framework for Minecraft 1.10
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>Generic-Mod</name>
<comment>Project Generic-Mod created by Buildship.</comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>org.eclipse.jdt.core.javabuilder</name>
<arguments>
@matshou
matshou / Logger.java
Last active October 9, 2016 13:37
Custom Logger for Minecraft (1.10) Modders
package com.user.genericmod.common;
import java.io.File;
import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
import org.apache.logging.log4j.Level;
import org.apache.logging.log4j.Marker;
@matshou
matshou / NewItemTorch.java
Created October 17, 2016 23:35
Sample code change after ItemStack#setItem deprecation
public static boolean extinguishItemTorch(ItemStack stack, Entity owner, int itemSlot, boolean extinguishByWater)
{
if (extinguishByWater == true)
setItemHumidity(stack.getTagCompound(), SharedDefines.TORCH_HUMIDITY_THRESHOLD);
if (ItemTorch.isItemTorch(stack.getItem(), false))
{
ItemStack unlitTorch = new ItemStack(ResourceLibrary.TORCH_UNLIT, 1);
ItemTorch.createCustomItemNBTFromExisting(unlitTorch, owner.worldObj, stack.getTagCompound());
@matshou
matshou / MessagePacketHandler.java
Last active October 18, 2016 01:02
Example: Packet handler as an outer class
package com.padwolf.minecraft.t1d.packets;
import com.padwolf.minecraft.t1d.refs.Functions;
import cpw.mods.fml.common.network.simpleimpl.IMessage;
import cpw.mods.fml.common.network.simpleimpl.IMessageHandler;
import cpw.mods.fml.common.network.simpleimpl.MessageContext;
public class MessagePacketHandler implements IMessageHandler<MessagePacket, IMessage>
{
@matshou
matshou / BlockTorch.java
Created October 18, 2016 14:51
Workaround for not registering EntityItem
package com.yooksi.fierysouls.block;
import javax.annotation.Nullable;
import com.yooksi.fierysouls.entity.item.EntityItemTorch;
import com.yooksi.fierysouls.item.ItemTorch;
import com.yooksi.fierysouls.tileentity.TileEntityTorch;
import net.minecraft.block.Block;
import net.minecraft.block.state.IBlockState;
@matshou
matshou / EventHandler.java
Last active October 27, 2016 07:43
Iron Pickaxe of Inferno
@SubscribeEvent
public static void onBlockLeftClicked(PlayerInteractEvent.LeftClickBlock event)
{
/*
* Tips: Don't worry about World#getBlockState returning null,
* if it does not find anything valid it will just return the default state of AIR.
*/
Random rand = new Random();
@matshou
matshou / long_bow_plain.json
Created October 28, 2016 08:02
LoaderException: Circular Model Dependencies
{
"parent": "item/generated",
"textures": {
"layer0": "betterarchery:items/item_simple_bow_body",
"layer1": "betterarchery:items/layer_bow_string_standby"
},
"display": {
"thirdperson_righthand": {
"rotation": [ -80, 260, -40 ],
"translation": [ -1, -2, 2.5 ],
@matshou
matshou / ColourfulItem.java
Last active November 14, 2016 04:29
How to add colour to item description text.
@SideOnly(Side.CLIENT)
@Override
public void addInformation(ItemStack stack, EntityPlayer player, java.util.List<String> info, boolean par4)
{
info.add(com.mojang.realmsclient.gui.ChatFormatting.RED + "This item " +
com.mojang.realmsclient.gui.ChatFormatting.GREEN + "has a " +
com.mojang.realmsclient.gui.ChatFormatting.BLUE + "colourful " +
com.mojang.realmsclient.gui.ChatFormatting.GOLD + "description.");
}
@matshou
matshou / git_commands.md
Last active January 25, 2022 12:19
Git command references.

Reference sheet covering basic and commonly used Git commands.

Stash

Restore all files in the current directory to their stashed version §

$ git checkout stash -- .

Diff

Ingredients

  • 3 🥑 - peeled, pitted, and mashed

  • 1 🍋, juiced

  • 1 🍵 drawing salt

  • 1/2 cup diced onion

  • 3 drawing chopped fresh cilantro

  • 2 roma (plum) tomatoes, diced

  • 1 🍵 drawing minced garlic