Skip to content

Commit

Permalink
Merge pull request #49 from Chailotl/hopper-extraction
Browse files Browse the repository at this point in the history
Adds hopper extraction for the item display block
  • Loading branch information
sisby-folk authored Oct 3, 2024
2 parents 492d5c8 + c3ee606 commit 5326c01
Showing 1 changed file with 40 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import net.minecraft.block.entity.BlockEntity;
import net.minecraft.entity.Entity;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.inventory.Inventory;
import net.minecraft.item.ItemStack;
import net.minecraft.item.SpawnEggItem;
import net.minecraft.nbt.NbtCompound;
Expand All @@ -27,7 +28,7 @@
import java.util.Set;
import java.util.UUID;

public class ItemDisplayBlockEntity extends BlockEntity {
public class ItemDisplayBlockEntity extends BlockEntity implements Inventory {
private ItemStack stack = ItemStack.EMPTY;
private Entity displayEntity = null;

Expand Down Expand Up @@ -238,6 +239,44 @@ public enum Offset {
CENTER, BACK, FRONT
}

// hopper extraction

@Override
public int size() {
return 1;
}

@Override
public boolean isEmpty() {
return stack.isEmpty();
}

@Override
public ItemStack getStack(int slot) {
return stack.copyWithCount(1);
}

@Override
public ItemStack removeStack(int slot, int amount) {
return stack.copyWithCount(1);
}

@Override
public ItemStack removeStack(int slot) {
return stack.copyWithCount(1);
}

@Override
public void setStack(int slot, ItemStack stack) {}

@Override
public boolean canPlayerUse(PlayerEntity player) {
return false;
}

@Override
public void clear() {}

// standard blockentity boilerplate

public void dispatch() {
Expand Down

0 comments on commit 5326c01

Please sign in to comment.