Fel pumpkin blazes now draw their drops from a loot table. Closes #2521

This commit is contained in:
Vincent Lee committed 2018-01-25 21:16:03 -06:00
1 parent c791f02711
commit d95d432dbe
3 files changed
+34 -2

No files matched your search

@@ -22,6 +22,7 @@ import net.minecraft.init.Blocks;
import net.minecraft.init.Items;
import net.minecraft.item.ItemStack;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.ResourceLocation;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;
import net.minecraftforge.common.MinecraftForge;
@@ -42,7 +43,7 @@ import javax.annotation.Nonnull;
@Mod.EventBusSubscriber(modid = LibMisc.MOD_ID)
public class BlockFelPumpkin extends BlockMod implements ILexiconable {
private static final ResourceLocation LOOT_TABLE = new ResourceLocation(LibMisc.MOD_ID, "fel_blaze");
private static final String TAG_FEL_SPAWNED = "Botania-FelSpawned";
public BlockFelPumpkin() {
@@ -79,7 +80,7 @@ public class BlockFelPumpkin extends BlockMod implements ILexiconable {
world.setBlockState(pos.down(2), Blocks.AIR.getDefaultState(), 2);
EntityBlaze blaze = new EntityBlaze(world);
blaze.setLocationAndAngles(pos.getX() + 0.5D, pos.getY() - 1.95D, pos.getZ() + 0.5D, 0.0F, 0.0F);
blaze.getEntityData().setBoolean(TAG_FEL_SPAWNED, true);
blaze.deathLootTable = LOOT_TABLE;
blaze.onInitialSpawn(world.getDifficultyForLocation(pos), null);
world.spawnEntity(blaze);
world.notifyNeighborsOfStateChange(pos, Blocks.AIR, false);
@@ -93,6 +94,7 @@ public class BlockFelPumpkin extends BlockMod implements ILexiconable {
world.setBlockState(pos, state.withProperty(BotaniaStateProps.CARDINALS, placer.getHorizontalFacing().getOpposite()));
}
// Legacy support
@SubscribeEvent
public static void onDrops(LivingDropsEvent event) {
if(event.getEntityLiving() instanceof EntityBlaze && event.getEntityLiving().getEntityData().getBoolean(TAG_FEL_SPAWNED))
@@ -49,3 +49,5 @@ public net.minecraft.item.ItemTool field_77862_b # toolMaterial
public net.minecraft.client.multiplayer.ClientAdvancementManager field_192803_d # advancementToProgress
public net.minecraft.item.EnumDyeColor field_193351_w # colorValue
public net.minecraft.entity.EntityLiving field_184659_bA # deathLootTable
@@ -0,0 +1,28 @@
{
"pools": [{
"name": "main",
"rolls": 1,
"entries": [
{
"type": "item",
"entryName": "normal_death_powder",
"name": "minecraft:blaze_powder",
"functions": [
{ "function": "set_count", "count": 6 }
]
},
{
"type": "item",
"entryName": "player_kill_powder",
"name": "minecraft:blaze_powder",
"conditions": [
{ "condition": "killed_by_player" }
],
"functions": [
{ "function": "set_count", "count": 10 },
{ "function": "looting_enchant", "count": { "min": 0, "max": 6 }}
]
}
]
}]
}