Skip to content

Commit

Permalink
fix: drop items
Browse files Browse the repository at this point in the history
  • Loading branch information
Jeronimo97 committed Oct 10, 2024
1 parent 94b3ffd commit fe3b234
Showing 1 changed file with 15 additions and 2 deletions.
17 changes: 15 additions & 2 deletions src/main/java/com/troblecodings/signals/blocks/BasicBlock.java
Original file line number Diff line number Diff line change
@@ -1,25 +1,31 @@
package com.troblecodings.signals.blocks;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Optional;
import java.util.Set;

import com.troblecodings.signals.core.TileEntitySupplierWrapper;

import net.minecraft.core.BlockPos;
import net.minecraft.world.item.ItemStack;
import net.minecraft.world.level.block.Block;
import net.minecraft.world.level.block.EntityBlock;
import net.minecraft.world.level.block.entity.BlockEntity;
import net.minecraft.world.level.block.entity.BlockEntityType;
import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.level.storage.loot.LootContext;

public class BasicBlock extends Block implements EntityBlock {

private static final Map<TileEntitySupplierWrapper, String> BLOCK_NAMES = new HashMap<>();
private static final Map<TileEntitySupplierWrapper, Set<BasicBlock>> BLOCK_SUPPLIER = new HashMap<>();
public static final Map<TileEntitySupplierWrapper, BlockEntityType<?>> BLOCK_ENTITYS = new HashMap<>();
private static final Map<TileEntitySupplierWrapper, Set<BasicBlock>> BLOCK_SUPPLIER =
new HashMap<>();
public static final Map<TileEntitySupplierWrapper, BlockEntityType<?>> BLOCK_ENTITYS =
new HashMap<>();

public BasicBlock(final Properties properties) {
super(properties);
Expand Down Expand Up @@ -63,4 +69,11 @@ public static void prepare() {
public BlockEntity newBlockEntity(final BlockPos pos, final BlockState state) {
return getSupplierWrapper().map(type -> type.create(pos, state)).orElse(null);
}

@Override
public List<ItemStack> getDrops(final BlockState state, final LootContext.Builder builder) {
List<ItemStack> drops = new ArrayList<ItemStack>();
drops.add(new ItemStack(this.asBlock().asItem()));
return drops;
}
}

0 comments on commit fe3b234

Please sign in to comment.