Skip to content

Commit c3ee606

Browse files
committed
Fix #40
1 parent 492d5c8 commit c3ee606

File tree

1 file changed

+40
-1
lines changed

1 file changed

+40
-1
lines changed

src/main/java/dev/hephaestus/glowcase/block/entity/ItemDisplayBlockEntity.java

+40-1
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
import net.minecraft.block.entity.BlockEntity;
66
import net.minecraft.entity.Entity;
77
import net.minecraft.entity.player.PlayerEntity;
8+
import net.minecraft.inventory.Inventory;
89
import net.minecraft.item.ItemStack;
910
import net.minecraft.item.SpawnEggItem;
1011
import net.minecraft.nbt.NbtCompound;
@@ -27,7 +28,7 @@
2728
import java.util.Set;
2829
import java.util.UUID;
2930

30-
public class ItemDisplayBlockEntity extends BlockEntity {
31+
public class ItemDisplayBlockEntity extends BlockEntity implements Inventory {
3132
private ItemStack stack = ItemStack.EMPTY;
3233
private Entity displayEntity = null;
3334

@@ -238,6 +239,44 @@ public enum Offset {
238239
CENTER, BACK, FRONT
239240
}
240241

242+
// hopper extraction
243+
244+
@Override
245+
public int size() {
246+
return 1;
247+
}
248+
249+
@Override
250+
public boolean isEmpty() {
251+
return stack.isEmpty();
252+
}
253+
254+
@Override
255+
public ItemStack getStack(int slot) {
256+
return stack.copyWithCount(1);
257+
}
258+
259+
@Override
260+
public ItemStack removeStack(int slot, int amount) {
261+
return stack.copyWithCount(1);
262+
}
263+
264+
@Override
265+
public ItemStack removeStack(int slot) {
266+
return stack.copyWithCount(1);
267+
}
268+
269+
@Override
270+
public void setStack(int slot, ItemStack stack) {}
271+
272+
@Override
273+
public boolean canPlayerUse(PlayerEntity player) {
274+
return false;
275+
}
276+
277+
@Override
278+
public void clear() {}
279+
241280
// standard blockentity boilerplate
242281

243282
public void dispatch() {

0 commit comments

Comments
 (0)