Fixed drawers not showing items on their tooltip
This commit is contained in:
parent
6afd5ee8ba
commit
1cae6d8bce
|
@ -100,7 +100,7 @@ dependencies {
|
||||||
//implementation fg.deobf("curse.maven:allthecompressed-514045:3723881")
|
//implementation fg.deobf("curse.maven:allthecompressed-514045:3723881")
|
||||||
//runtimeOnly fg.deobf("curse.maven:create-328085:3600402")
|
//runtimeOnly fg.deobf("curse.maven:create-328085:3600402")
|
||||||
//runtimeOnly fg.deobf("curse.maven:flywheel-486392:3600401")
|
//runtimeOnly fg.deobf("curse.maven:flywheel-486392:3600401")
|
||||||
runtimeOnly fg.deobf("curse.maven:mekanism-268560:3810540")
|
implementation fg.deobf("curse.maven:mekanism-268560:3810540")
|
||||||
runtimeOnly fg.deobf("curse.maven:refined-pipes-370696:3816785")
|
runtimeOnly fg.deobf("curse.maven:refined-pipes-370696:3816785")
|
||||||
annotationProcessor "org.spongepowered:mixin:0.8.5:processor"
|
annotationProcessor "org.spongepowered:mixin:0.8.5:processor"
|
||||||
}
|
}
|
||||||
|
|
|
@ -147,7 +147,8 @@ public class FunctionalStorage extends ModuleController {
|
||||||
for (DrawerType value : DrawerType.values()) {
|
for (DrawerType value : DrawerType.values()) {
|
||||||
for (IWoodType woodType : WOOD_TYPES) {
|
for (IWoodType woodType : WOOD_TYPES) {
|
||||||
String name = woodType.getName() + "_" + value.getSlots();
|
String name = woodType.getName() + "_" + value.getSlots();
|
||||||
DRAWER_TYPES.computeIfAbsent(value, drawerType -> new ArrayList<>()).add(getRegistries().registerBlockWithTile(name, () -> new DrawerBlock(woodType, value)));
|
DRAWER_TYPES.computeIfAbsent(value, drawerType -> new ArrayList<>()).add(getRegistries().registerBlockWithTileItem(name, () -> new DrawerBlock(woodType, value), blockRegistryObject -> () ->
|
||||||
|
new DrawerBlock.DrawerItem((DrawerBlock) blockRegistryObject.get(), new Item.Properties().tab(TAB))));
|
||||||
}
|
}
|
||||||
DRAWER_TYPES.get(value).forEach(blockRegistryObject -> TAB.addIconStacks(() -> new ItemStack(blockRegistryObject.getLeft().get())));
|
DRAWER_TYPES.get(value).forEach(blockRegistryObject -> TAB.addIconStacks(() -> new ItemStack(blockRegistryObject.getLeft().get())));
|
||||||
}
|
}
|
||||||
|
|
|
@ -28,6 +28,7 @@ import net.minecraft.world.InteractionHand;
|
||||||
import net.minecraft.world.InteractionResult;
|
import net.minecraft.world.InteractionResult;
|
||||||
import net.minecraft.world.entity.LivingEntity;
|
import net.minecraft.world.entity.LivingEntity;
|
||||||
import net.minecraft.world.entity.player.Player;
|
import net.minecraft.world.entity.player.Player;
|
||||||
|
import net.minecraft.world.inventory.tooltip.TooltipComponent;
|
||||||
import net.minecraft.world.item.BlockItem;
|
import net.minecraft.world.item.BlockItem;
|
||||||
import net.minecraft.world.item.Item;
|
import net.minecraft.world.item.Item;
|
||||||
import net.minecraft.world.item.ItemStack;
|
import net.minecraft.world.item.ItemStack;
|
||||||
|
@ -60,6 +61,7 @@ import javax.annotation.Nonnull;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Optional;
|
||||||
import java.util.function.Consumer;
|
import java.util.function.Consumer;
|
||||||
import java.util.function.Supplier;
|
import java.util.function.Supplier;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
@ -127,17 +129,6 @@ public class DrawerBlock extends RotatableBlock<DrawerTile> {
|
||||||
registerDefaultState(defaultBlockState().setValue(RotatableBlock.FACING_HORIZONTAL, Direction.NORTH).setValue(LOCKED, false));
|
registerDefaultState(defaultBlockState().setValue(RotatableBlock.FACING_HORIZONTAL, Direction.NORTH).setValue(LOCKED, false));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public Supplier<Item> getItemBlockFactory() {
|
|
||||||
return () -> new BlockItem(this, new Item.Properties().tab(this.getItemGroup())) {
|
|
||||||
@Nullable
|
|
||||||
@Override
|
|
||||||
public ICapabilityProvider initCapabilities(ItemStack stack, @Nullable CompoundTag nbt) {
|
|
||||||
return new DrawerCapabilityProvider(stack, type);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void createBlockStateDefinition(StateDefinition.Builder<Block, BlockState> p_206840_1_) {
|
protected void createBlockStateDefinition(StateDefinition.Builder<Block, BlockState> p_206840_1_) {
|
||||||
super.createBlockStateDefinition(p_206840_1_);
|
super.createBlockStateDefinition(p_206840_1_);
|
||||||
|
@ -336,5 +327,25 @@ public class DrawerBlock extends RotatableBlock<DrawerTile> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static class DrawerItem extends BlockItem{
|
||||||
|
|
||||||
|
private DrawerBlock drawerBlock;
|
||||||
|
public DrawerItem(DrawerBlock p_40565_, Properties p_40566_) {
|
||||||
|
super(p_40565_, p_40566_);
|
||||||
|
this.drawerBlock = p_40565_;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Optional<TooltipComponent> getTooltipImage(ItemStack stack) {
|
||||||
|
return super.getTooltipImage(stack);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Nullable
|
||||||
|
@Override
|
||||||
|
public ICapabilityProvider initCapabilities(ItemStack stack, @Nullable CompoundTag nbt) {
|
||||||
|
return new DrawerCapabilityProvider(stack, this.drawerBlock.getType());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user