Jump to content

TheOnly8Z

Members
  • Posts

    5
  • Joined

  • Last visited

Everything posted by TheOnly8Z

  1. I'm already using drawString, and I don't think drawStringWithShadow exists (the IDE does not show it as a function). @Override protected void drawGuiContainerForegroundLayer(int mouseX, int mouseY) { drawCenteredString(Minecraft.getInstance().fontRenderer, I18n.format("block.bait_station.bait_station"), 88, 6, 0x3f3f3f); drawString(Minecraft.getInstance().fontRenderer, I18n.format("container.inventory"), 8, 72, 0x3f3f3f); } EDIT: Calling it from the fontRenderer seemed to work - thank you!
  2. Hello all, I'm using a ContainerScreen class to make a custom container for a block. I've noticed that the text I get from using Minecraft.getInstance().fontRenderer seems to have a back shadow, while vanilla Minecraft container text doesn't have this shadow. What function can I use to remove this shadow?
  3. Okay, I've been fooled thoroughly. LogManager.getLogger().debug() didn't actually print anything to the game output (for some reason). Changing it to info() worked.
  4. I have these lines regarding the TileEntity in other classes: // In a registry class private static final DeferredRegister<TileEntityType<?>> TILES = new DeferredRegister<>(ForgeRegistries.TILE_ENTITIES, MOD_ID); public static final RegistryObject<TileEntityType<BaitStationTile>> BAIT_STATION_BLOCK_TILE = TILES.register("bait_station", () -> TileEntityType.Builder.create(BaitStationTile::new, BAIT_STATION_BLOCK.get()).build(null)); // In the block class @Override public boolean hasTileEntity(BlockState state) { return true; } @Nullable @Override public TileEntity createTileEntity(BlockState state, IBlockReader world) { return new BaitStationTile(); } EDIT: I noticed that the item I place in the container isn't saved - when I quit and rejoin the item disappears.
  5. Hello all, I'm trying to make a block that implements ITickableTileEntity and does something every minute, but tick() doesn't seem to be running at all. I'm following McJty's tutorial series (for 1.14). The forge documentation mentions using net.minecraft.util.ITickable, but the IDE highlighting seems to suggest this doesn't exist. // snip imports public class BaitStationTile extends TileEntity implements ITickableTileEntity, INamedContainerProvider { private LazyOptional<IItemHandler> handler = LazyOptional.of(this::createHandler); private int counter; public BaitStationTile() { super(BAIT_STATION_BLOCK_TILE.get()); } @Override public void tick() { // this line is not running LogManager.getLogger().debug("ticking Bait Station, remote: " + world.isRemote + "handler: " + handler.toString()); if (world.isRemote) { return; } handler.ifPresent(h -> { ItemStack stack = h.getStackInSlot(0); // snip functionality }); } private IItemHandler createHandler() { return new ItemStackHandler(1) { @Override protected void onContentsChanged(int slot) { markDirty(); } @Override public boolean isItemValid(int slot, @Nonnull ItemStack stack) { return BaitStation.baitEntities.exists(stack.getItem()); } @Nonnull @Override public ItemStack insertItem(int slot, @Nonnull ItemStack stack, boolean simulate) { // TODO fancy logic or something if (!BaitStation.baitEntities.exists(stack.getItem())) { return stack; } return super.insertItem(slot, stack, simulate); } }; } @Nonnull @Override public <T> LazyOptional<T> getCapability(@Nonnull Capability<T> cap, @Nullable Direction side) { if (cap == CapabilityItemHandler.ITEM_HANDLER_CAPABILITY) { return handler.cast(); } return super.getCapability(cap, side); } @Override public ITextComponent getDisplayName() { return new StringTextComponent(getType().getRegistryName().getPath()); } @Nullable @Override public Container createMenu(int i, PlayerInventory playerInventory, PlayerEntity playerEntity) { return new BaitStationContainer(i, world, pos, playerInventory, playerEntity); } }
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.