block loot tables

This commit is contained in:
Vincent Lee committed 2019-06-30 14:51:22 -07:00
1 parent 27ec1e58fc
commit 2b7a780736
465 files changed
+9205 -187

No files matched your search

@@ -203,7 +203,7 @@ public class TileEntityGeneratingFlower extends TileEntitySpecialFlower {
@Override
public List<ItemStack> getDrops(List<ItemStack> list, LootContext.Builder ctx) {
List<ItemStack> drops = super.getDrops(list);
List<ItemStack> drops = super.getDrops(list, ctx);
populateDropStackNBTs(drops);
return drops;
}
@@ -85,12 +85,6 @@ public class BlockAltGrass extends BlockMod implements ILexiconable {
}
}
@Nonnull
@Override
public IItemProvider getItemDropped(BlockState state, World world, BlockPos pos, int fortune) {
return Blocks.DIRT.getItemDropped(state, world, pos, fortune);
}
@Override
public boolean canSustainPlant(@Nonnull BlockState state, @Nonnull IBlockReader world, BlockPos pos, @Nonnull Direction direction, IPlantable plantable) {
PlantType type = plantable.getPlantType(world, pos.down());
@@ -94,16 +94,6 @@ public class BlockAltar extends BlockMod implements ILexiconable {
return BlockRenderLayer.CUTOUT;
}
@Nonnull
@Override
public IItemProvider getItemDropped(BlockState state, World world, BlockPos pos, int fortune) {
if(variant == Variant.MOSSY) {
return ModBlocks.defaultAltar;
} else {
return super.getItemDropped(state, world, pos, fortune);
}
}
@Override
public void onEntityCollision(BlockState state, World world, BlockPos pos, Entity entity) {
if(!world.isRemote && entity instanceof ItemEntity) {
@@ -36,11 +36,6 @@ public class BlockBifrost extends BlockBifrostPerm implements ILexiconable {
return new ItemStack(ModItems.rainbowRod);
}
@Override
public int quantityDropped(BlockState state, @Nonnull Random random) {
return 0;
}
@Override
public boolean hasTileEntity(BlockState state) {
return true;
@@ -43,11 +43,6 @@ public class BlockCacophonium extends BlockMod {
builder.add(BotaniaStateProps.POWERED);
}
@Override
public boolean canSilkHarvest(@Nonnull BlockState state, IWorldReader world, BlockPos pos, PlayerEntity player) {
return false;
}
@Override
public void neighborChanged(BlockState state, World world, BlockPos pos, Block block, BlockPos fromPos, boolean isMoving) {
boolean power = world.getRedstonePowerFromNeighbors(pos) > 0 || world.getRedstonePowerFromNeighbors(pos.up()) > 0;
@@ -38,12 +38,6 @@ public class BlockCell extends BlockMod implements ILexiconable {
super(builder);
}
@Nonnull
@Override
public IItemProvider getItemDropped(BlockState state, World world, BlockPos pos, int fortune) {
return Items.AIR;
}
@Override
public boolean hasTileEntity(BlockState state) {
return true;
@@ -99,17 +99,6 @@ public class BlockCocoon extends BlockMod implements ILexiconable {
return false;
}
@Nonnull
@Override
public Item getItemDropped(BlockState state, World world, BlockPos pos, int fortune) {
return Items.AIR;
}
@Override
public boolean canSilkHarvest(@Nonnull BlockState state, IWorldReader world, BlockPos pos, PlayerEntity player) {
return false;
}
@Override
public boolean hasTileEntity(BlockState state) {
return true;
@@ -41,12 +41,6 @@ public class BlockEnchantedSoil extends BlockMod implements ILexiconable {
super(builder);
}
@Nonnull
@Override
public IItemProvider getItemDropped(BlockState state, World world, BlockPos pos, int fortune) {
return Blocks.DIRT.getItemDropped(state, world, pos, fortune);
}
@Override
public boolean canSustainPlant(@Nonnull BlockState state, @Nonnull IBlockReader world, BlockPos pos, @Nonnull Direction direction, IPlantable plantable) {
return plantable.getPlantType(world, pos.down()) == PlantType.Plains;
@@ -37,7 +37,7 @@ import java.util.ArrayList;
import java.util.List;
import java.util.Random;
public class BlockModDoubleFlower extends TallFlowerBlock implements ILexiconable, IShearable {
public class BlockModDoubleFlower extends TallFlowerBlock implements ILexiconable {
private final DyeColor color;
public BlockModDoubleFlower(DyeColor color, Properties builder) {
@@ -45,33 +45,11 @@ public class BlockModDoubleFlower extends TallFlowerBlock implements ILexiconabl
this.color = color;
}
@Nonnull
@Override
public Item getItemDropped(BlockState state, @Nonnull World world, @Nonnull BlockPos pos, int fortune) {
return Items.AIR;
}
@Override
public boolean canGrow(@Nonnull IBlockReader world, @Nonnull BlockPos pos, @Nonnull BlockState state, boolean fuckifiknow) {
return false;
}
@Override
public boolean isShearable(@Nonnull ItemStack item, IWorldReader world, BlockPos pos) {
return true;
}
@Nonnull
@Override
public List<ItemStack> onSheared(@Nonnull ItemStack item, IWorld world, @Nonnull BlockPos pos, int fortune) {
List<ItemStack> ret = new ArrayList<>();
ret.add(new ItemStack(this));
BlockPos other = world.getBlockState(pos).get(HALF) == DoubleBlockHalf.UPPER ? pos.down() : pos.up();
world.removeBlock(pos, false);
world.destroyBlock(other, false);
return ret;
}
@Override
@OnlyIn(Dist.CLIENT)
public void animateTick(BlockState state, World world, BlockPos pos, Random rand) {
@@ -73,11 +73,6 @@ public class BlockPistonRelay extends BlockMod implements IWandable, ILexiconabl
MinecraftForge.EVENT_BUS.register(this);
}
@Override
public int quantityDropped(BlockState state, @Nonnull Random random) {
return 0;
}
@Override
public void onReplaced(@Nonnull BlockState state, @Nonnull World world, @Nonnull BlockPos pos, @Nonnull BlockState newState, boolean isMoving) {
if(!world.isRemote)
@@ -30,17 +30,6 @@ public class BlockRoot extends BlockMod implements ILexiconable {
super(builder);
}
@Nonnull
@Override
public Item getItemDropped(BlockState state, World world, BlockPos pos, int fortune) {
return ModItems.livingroot;
}
@Override
public int quantityDropped(BlockState state, Random r) {
return 2 + r.nextInt(3);
}
@Override
public LexiconEntry getEntry(World world, BlockPos pos, PlayerEntity player, ItemStack lexicon) {
return LexiconData.gardenOfGlass;
@@ -22,7 +22,6 @@ import net.minecraftforge.fml.common.Mod;
import net.minecraftforge.registries.IForgeRegistry;
import net.minecraftforge.registries.ObjectHolder;
import vazkii.botania.api.lexicon.ILexiconable;
import vazkii.botania.common.block.decor.BlockBiomeStone;
import vazkii.botania.common.block.decor.panes.BlockModPane;
import vazkii.botania.common.block.decor.quartz.BlockSpecialQuartzPillar;
import vazkii.botania.common.block.decor.quartz.BlockElfQuartzSlab;
@@ -330,7 +329,7 @@ public final class ModFluffBlocks {
"swamp", "desert", "taiga", "mesa"
};
for (String variant : variants) {
base = new BlockBiomeStone(props);
base = new BlockModLexiconable(props, marimorph);
register(r, base, LibBlockNames.METAMORPHIC_PREFIX + variant + "_stone");
register(r, new BlockBiomeStoneStairs(base.getDefaultState(), props), base.getRegistryName().getPath() + STAIR_SUFFIX);
register(r, new BlockBiomeStoneSlab(props), base.getRegistryName().getPath() + SLAB_SUFFIX);
@@ -1,50 +0,0 @@
package vazkii.botania.common.block.decor;
import net.minecraft.block.BlockState;
import net.minecraft.block.BlockState;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.block.Blocks;
import net.minecraft.item.ItemStack;
import net.minecraft.util.IItemProvider;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;
import vazkii.botania.api.lexicon.ILexiconable;
import vazkii.botania.api.lexicon.LexiconEntry;
import vazkii.botania.common.block.BlockMod;
import vazkii.botania.common.block.ModFluffBlocks;
import vazkii.botania.common.lexicon.LexiconData;
import javax.annotation.Nonnull;
public class BlockBiomeStone extends BlockMod implements ILexiconable {
public BlockBiomeStone(Properties builder) {
super(builder);
}
@Nonnull
@Override
public IItemProvider getItemDropped(BlockState state, World world, BlockPos pos, int fortune) {
if(this == ModFluffBlocks.biomeStoneForest)
return ModFluffBlocks.biomeCobblestoneForest;
if(this == ModFluffBlocks.biomeStonePlains)
return ModFluffBlocks.biomeCobblestonePlains;
if(this == ModFluffBlocks.biomeStoneMountain)
return ModFluffBlocks.biomeCobblestoneMountain;
if(this == ModFluffBlocks.biomeStoneFungal)
return ModFluffBlocks.biomeCobblestoneFungal;
if(this == ModFluffBlocks.biomeStoneSwamp)
return ModFluffBlocks.biomeCobblestoneSwamp;
if(this == ModFluffBlocks.biomeStoneDesert)
return ModFluffBlocks.biomeCobblestoneDesert;
if(this == ModFluffBlocks.biomeStoneTaiga)
return ModFluffBlocks.biomeCobblestoneTaiga;
if(this == ModFluffBlocks.biomeStoneMesa)
return ModFluffBlocks.biomeCobblestoneMesa;
return Blocks.AIR;
}
@Override
public LexiconEntry getEntry(World world, BlockPos pos, PlayerEntity player, ItemStack lexicon) {
return LexiconData.marimorphosis;
}
}
@@ -64,12 +64,6 @@ public class BlockBuriedPetals extends BlockModFlower {
Botania.proxy.setSparkleFXNoClip(false);
}
@Nonnull
@Override
public Item getItemDropped(BlockState state, World world, BlockPos pos, int fortune) {
return ModItems.getPetal(color);
}
@Nonnull
@Override
public BlockRenderType getRenderType(BlockState state) {
@@ -95,38 +95,6 @@ public class BlockTinyPotato extends BlockMod implements ILexiconable {
((TileTinyPotato) world.getTileEntity(pos)).name = stack.getDisplayName();
}
@Override
public boolean removedByPlayer(@Nonnull BlockState state, World world, @Nonnull BlockPos pos, @Nonnull PlayerEntity player, boolean willHarvest, IFluidState fluid) {
if (willHarvest) {
// Copy of super.removedByPlayer but don't remove block yet
// This is so getDrops below will have a TE to work with
onBlockHarvested(world, pos, state, player);
return true;
} else {
return super.removedByPlayer(state, world, pos, player, willHarvest, fluid);
}
}
@Override
public void harvestBlock(@Nonnull World world, PlayerEntity player, @Nonnull BlockPos pos, @Nonnull BlockState state, TileEntity te, ItemStack stack) {
super.harvestBlock(world, player, pos, state, te, stack);
// Now delete the block and TE
world.removeBlock(pos);
}
@Override
public void getDrops(BlockState state, NonNullList<ItemStack> list, World world, BlockPos pos, int fortune) {
TileEntity tile = world.getTileEntity(pos);
if(tile != null) {
ItemStack stack = new ItemStack(this);
ITextComponent name = ((TileTinyPotato) tile).name;
if(!name.getString().isEmpty())
stack.setDisplayName(name);
list.add(stack);
}
}
@Nonnull
@Override
public BlockRenderType getRenderType(BlockState state) {
@@ -76,12 +76,6 @@ public class BlockEnchanter extends BlockMod implements IWandable, ILexiconable,
return new TileEnchanter();
}
@Nonnull
@Override
public IItemProvider getItemDropped(BlockState state, World world, BlockPos pos, int fortune) {
return Blocks.LAPIS_BLOCK;
}
@Override
public boolean onBlockActivated(BlockState state, World world, BlockPos pos, PlayerEntity player, Hand hand, BlockRayTraceResult hit) {
TileEnchanter enchanter = (TileEnchanter) world.getTileEntity(pos);
@@ -134,7 +134,7 @@ public class SubTileMunchdew extends TileEntityGeneratingFlower {
@Override
public List<ItemStack> getDrops(List<ItemStack> list, LootContext.Builder ctx) {
List<ItemStack> drops = super.getDrops(list);
List<ItemStack> drops = super.getDrops(list, ctx);
if(cooldown > 0)
ItemNBTHelper.setInt(drops.get(0), TAG_COOLDOWN, cooldown);
return drops;
@@ -22,10 +22,12 @@ import net.minecraft.util.Direction;
import net.minecraft.util.Direction;
import net.minecraft.util.Hand;
import net.minecraft.tileentity.ITickableTileEntity;
import net.minecraft.util.INameable;
import net.minecraft.util.ResourceLocation;
import net.minecraft.util.SoundCategory;
import net.minecraft.util.text.ITextComponent;
import net.minecraft.util.text.StringTextComponent;
import net.minecraft.util.text.TranslationTextComponent;
import net.minecraftforge.items.ItemHandlerHelper;
import net.minecraftforge.registries.ObjectHolder;
import vazkii.botania.api.internal.VanillaPacketDispatcher;
@@ -35,7 +37,10 @@ import vazkii.botania.common.core.helper.PlayerHelper;
import vazkii.botania.common.lib.LibBlockNames;
import vazkii.botania.common.lib.LibMisc;
public class TileTinyPotato extends TileSimpleInventory implements ITickableTileEntity {
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
public class TileTinyPotato extends TileSimpleInventory implements ITickableTileEntity, INameable {
@ObjectHolder(LibMisc.MOD_ID + ":" + LibBlockNames.TINY_POTATO)
public static TileEntityType<TileTinyPotato> TYPE;
private static final String TAG_NAME = "name";
@@ -127,4 +132,21 @@ public class TileTinyPotato extends TileSimpleInventory implements ITickableTile
return 6;
}
@Nonnull
@Override
public ITextComponent getName() {
return new TranslationTextComponent(ModBlocks.tinyPotato.getTranslationKey());
}
@Nullable
@Override
public ITextComponent getCustomName() {
return name.getString().isEmpty() ? null : name; // todo 1.14 improve
}
@Nonnull
@Override
public ITextComponent getDisplayName() {
return hasCustomName() ? getCustomName() : getName();
}
}