Skip to content

Instantly share code, notes, and snippets.

View dazsim's full-sized avatar

workshopcraft dazsim

View GitHub Profile
2016-04-27 11:28:15,527 WARN Unable to instantiate org.fusesource.jansi.WindowsAnsiOutputStream
2016-04-27 11:28:15,529 WARN Unable to instantiate org.fusesource.jansi.WindowsAnsiOutputStream
[11:28:15] [main/INFO] [GradleStart]: Extra: []
[11:28:15] [main/INFO] [GradleStart]: Running with arguments: [--userProperties, {}, --assetsDir, C:/Users/Darren/.gradle/caches/minecraft/assets, --assetIndex, 1.9, --accessToken{REDACTED}, --version, 1.9, --tweakClass, net.minecraftforge.fml.common.launcher.FMLTweaker, --tweakClass, net.minecraftforge.gradle.tweakers.CoremodTweaker]
[11:28:15] [main/INFO] [LaunchWrapper]: Loading tweak class name net.minecraftforge.fml.common.launcher.FMLTweaker
[11:28:15] [main/INFO] [LaunchWrapper]: Using primary tweak class name net.minecraftforge.fml.common.launcher.FMLTweaker
[11:28:15] [main/INFO] [LaunchWrapper]: Loading tweak class name net.minecraftforge.gradle.tweakers.CoremodTweaker
[11:28:15] [main/INFO] [LaunchWrapper]: Calling tweak class net.minecraftforge.fml.common.launch
@dazsim
dazsim / gist:3c7511c3fa5f5ed28818633753450103
Created June 14, 2016 11:49
code to trigger update after processing event (Adding/removing something from barrel)
public void updateBarrel(TileEntityBarrel t)
{
NBTTagCompound compound = new NBTTagCompound();
t.writeToNBT(compound );
t.markDirty();
t.getWorld().tickUpdates(true);
}
package com.workshopcraft.simplebarrels.handlers;
import com.workshopcraft.simplebarrels.tiles.TileEntityBarrel;
import net.minecraft.inventory.InventoryHelper;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.tileentity.TileEntity;
import net.minecraftforge.event.entity.player.PlayerInteractEvent;
@dazsim
dazsim / aitemhandler.java
Created July 2, 2016 10:04
item handler code insertItem
@Override
public ItemStack insertItem(int slot, ItemStack stack, boolean simulate)
{
if (count == 0)
{
this.barrelContents[0]=stack;
count = stack.stackSize;
}
if (count == size)
{
@dazsim
dazsim / BarrelItemHandler.java
Created July 2, 2016 13:03
complete class for the BarrelItemHandler.java
package com.workshopcraft.simplebarrels.handlers;
import net.minecraft.item.ItemStack;
import net.minecraftforge.items.IItemHandler;
public class BarrelItemHandler implements IItemHandler{
public ItemStack[] barrelContents = new ItemStack[1];
int count = 0;
int size = 4096;
package com.workshopcraft.simplebarrels.tiles;
import javax.annotation.Nullable;
import com.workshopcraft.simplebarrels.handlers.BarrelItemHandler;
import net.minecraft.block.BlockChest;
import net.minecraft.block.state.IBlockState;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemBlock;
package com.workshopcraft.simplebarrels.handlers;
import net.minecraft.item.ItemStack;
import net.minecraftforge.items.IItemHandler;
import net.minecraftforge.items.ItemHandlerHelper;
public class BarrelItemHandler implements IItemHandler{
public ItemStack[] barrelContents = new ItemStack[1];
public int count = 0;
@dazsim
dazsim / onblockplacedby.java
Created July 18, 2016 11:49
this is the onBlockPlacedBy code
@Override
public void onBlockPlacedBy(World worldIn,BlockPos pos,IBlockState state,EntityLivingBase placer,ItemStack stack)
{
//grab settings from itemstack
if (worldIn == null)
{
System.out.println("EMPTY WORLD");
return;
}
if (pos == null)
@dazsim
dazsim / snip.java
Created July 18, 2016 11:59
snippet create barrel with no comparator or item frame
NBTTagCompound n = new NBTTagCompound();
n.setBoolean("frame", true);
n.setBoolean("comp", true);
i.setTagCompound(n);
GameRegistry.addRecipe(i, new Object[]{
"WIW",
" C ",
"WIW",
'W',new ItemStack(Blocks.PLANKS,1,0),'C',Blocks.CHEST,'R',Items.COMPARATOR,'F',Items.ITEM_FRAME, 'I',Items.IRON_INGOT
});
@dazsim
dazsim / collide.py
Created July 25, 2016 08:17
This is my collision box class for a simple game. >.<
class CollisionBox:
"""this class deals with collision boxes like the rocketman and
walls/floors"""
x1,y1 = 0 #This is the position of the box
x2,y2 = 0 #This is the size of the box
def CollisionBox(self,x,y):
self.x1 = 0
self.y1 = 0