Skip to content

Instantly share code, notes, and snippets.

@chylex
Last active September 19, 2015 01:27
Show Gist options
  • Save chylex/efc86c98018067fadaec to your computer and use it in GitHub Desktop.
Save chylex/efc86c98018067fadaec to your computer and use it in GitHub Desktop.
ItemStack block fix?
public class ItemStack{
private final Block linkedBlock;
public ItemStack(Block block, ...){
this(...);
this.block = linkedBlock;
}
public Item getItem(){
if (linkedBlock != null && (delegate == null || delegate.get() == null)){
delegate = new RegistryDelegate<Item>(Item.getItemFromBlock(linkedBlock));
}
return delegate != null ? delegate.get() : null;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment