Skip to content

Commit

Permalink
Added bonfire drops and tweaked ash pile drops
Browse files Browse the repository at this point in the history
  • Loading branch information
Wehavecookies56 committed Dec 17, 2016
1 parent 757c22b commit c4256cd
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 5 deletions.
5 changes: 3 additions & 2 deletions src/main/java/uk/co/wehavecookies56/bonfires/Bonfires.java
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.common.util.EnumHelper;
import net.minecraftforge.event.entity.EntityJoinWorldEvent;
import net.minecraftforge.event.entity.living.LivingDeathEvent;
import net.minecraftforge.event.entity.living.LivingDropsEvent;
import net.minecraftforge.event.world.WorldEvent;
import net.minecraftforge.fml.common.Mod;
Expand Down Expand Up @@ -69,7 +70,7 @@ public static void preInit(FMLPreInitializationEvent event) {
tabBonfires = new TabBonfires("tabBonfires");
blocks = new Block[] {
ashBlock = new BlockAshBlock(Material.SAND).setRegistryName(modid, "ash_block").setUnlocalizedName("ash_block"),
ashBonePile = new BlockAshBonePile(Material.SNOW).setRegistryName(modid, "ash_bone_pile").setUnlocalizedName("ash_bone_pile")
ashBonePile = new BlockAshBonePile(Material.CIRCUITS).setRegistryName(modid, "ash_bone_pile").setUnlocalizedName("ash_bone_pile")
};
items = new Item[] {
ashPile = new ItemAshPile().setRegistryName(modid, "ash_pile").setUnlocalizedName("ash_pile"),
Expand Down Expand Up @@ -110,7 +111,7 @@ public static void registerRender(Item item, int meta, String name) {

@SubscribeEvent
public void entityDeath(LivingDropsEvent event) {
if (event.getSource().isFireDamage()) {
if (event.getSource().isFireDamage() || event.getEntity().isBurning()) {
Random r = new Random();
double percent = r.nextDouble() * 100;
if (percent > 65) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@
import uk.co.wehavecookies56.bonfires.world.BonfireWorldSavedData;

import javax.annotation.Nullable;
import java.util.ArrayList;
import java.util.List;
import java.util.Random;

/**
Expand Down Expand Up @@ -76,10 +78,12 @@ public EnumBlockRenderType getRenderType(IBlockState state) {
return EnumBlockRenderType.MODEL;
}

@Nullable
@Override
public Item getItemDropped(IBlockState state, Random rand, int fortune) {
return super.getItemDropped(state, rand, fortune);
public List<ItemStack> getDrops(IBlockAccess world, BlockPos pos, IBlockState state, int fortune) {
List<ItemStack> stacks = new ArrayList<>();
stacks.add(new ItemStack(getItemDropped(state, new Random(), fortune)));
stacks.add(new ItemStack(Bonfires.coiledSwordFragment));
return stacks;
}

@Override
Expand Down

0 comments on commit c4256cd

Please sign in to comment.