Jump to content

ChAoS_UnItY

Members
  • Posts

    22
  • Joined

  • Last visited

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

ChAoS_UnItY's Achievements

Tree Puncher

Tree Puncher (2/8)

0

Reputation

  1. I'm using `ExtendedList` as my list, but I would like to discard the dirt background which renders in default. I've tried to overrides the render part which contains `Screen#renderDirtBackground()`, but it failed with crash. Any help? Currently stable source code without overrides renderDirtBackground : https://github.com/ChAoSUnItY/EkiLib/blob/1.16.3/src/main/java/com/chaos/eki_lib/gui/screen/StationSelectionScreen.java
  2. But after I removed lots line and get final code result like this : @Override public void render(StationNameplateTileEntity tileEntityIn, float partialTicks, MatrixStack matrixStackIn, IRenderTypeBuffer bufferIn, int combinedLightIn, int combinedOverlayIn) { RenderSystem.color4f(1.0f, 1.0f, 1.0f, 1.0f); matrixStackIn.push(); FontRenderer fontRenderer = this.renderDispatcher.getFontRenderer(); IReorderingProcessor irp = new StringTextComponent("This is a test string, if you saw me , that's gud").func_241878_f(); fontRenderer.func_238416_a_(irp, 10, -20, 16777215, false, matrixStackIn.getLast().getMatrix(), bufferIn, false, 0, combinedLightIn); matrixStackIn.pop(); } It still doesn't show up in the world... EDIT: It's just need a scale down. Case closed
  3. My goal is to create a non sign block but renders text, so that is not what I'm looking for. Maybe I need some Matrix translating help since my block model is quite different.
  4. I have taken a look at Sign's TileEntityRenderer, but I still not 100% sure how to properly render it, any help?
  5. The abstractList is always rendering a dirt backgorund, even I overrided the method, then it'll caused a no respond, is there correct way to change it? Here's my code: package com.chaos.ekiLib.screen; import com.chaos.ekiLib.api.EkiLibApi; import com.chaos.ekiLib.station.data.Station; import com.mojang.blaze3d.matrix.MatrixStack; import net.minecraft.client.Minecraft; import net.minecraft.client.gui.widget.list.ExtendedList; import net.minecraft.entity.player.PlayerEntity; import net.minecraft.util.text.TranslationTextComponent; import net.minecraftforge.api.distmarker.Dist; import net.minecraftforge.api.distmarker.OnlyIn; @OnlyIn(Dist.CLIENT) public class ScreenStationSelection extends ScreenBase { private ScreenStationSelection.List list; private final boolean selectMode; public ScreenStationSelection(int dimID, PlayerEntity player, boolean selectMode) { super(new TranslationTextComponent("eki.screen.station_selection"), dimID, player); this.selectMode = selectMode; } protected void init() { this.list = new ScreenStationSelection.List(this.minecraft); this.children.add(this.list); super.init(); } public void render(MatrixStack matrixStack, int mouseX, int mouseY, float partialTicks) { this.list.render(matrixStack, mouseX, mouseY, partialTicks); drawCenteredString(matrixStack, this.font, this.title, this.width / 2, 16, 16777215); this.renderBackground(matrixStack); super.render(matrixStack, mouseX, mouseY, partialTicks); } @OnlyIn(Dist.CLIENT) class List extends ExtendedList<ScreenStationSelection.List.StationEntry> { public List(Minecraft mcIn) { super(mcIn, ScreenStationSelection.this.width, ScreenStationSelection.this.height, 32, ScreenStationSelection.this.height - 65 + 4, 18); for (Station station : EkiLibApi.getStationList(ScreenStationSelection.this.dimID)){ this.addEntry(new StationEntry(station)); } if (this.getSelected() != null) { this.centerScrollOn(this.getSelected()); } } protected int getScrollbarPosition() { return super.getScrollbarPosition() + 20; } public int getRowWidth() { return super.getRowWidth() + 50; } protected void renderBackground(MatrixStack matrixStack) { ScreenStationSelection.this.renderBackground(matrixStack); } protected boolean isFocused() { return ScreenStationSelection.this.getListener() == this; } @OnlyIn(Dist.CLIENT) public class StationEntry extends ExtendedList.AbstractListEntry<ScreenStationSelection.List.StationEntry> { private final Station station; public StationEntry(Station station) { this.station = station; } public void render(MatrixStack p_230432_1_, int p_230432_2_, int p_230432_3_, int p_230432_4_, int p_230432_5_, int p_230432_6_, int p_230432_7_, int p_230432_8_, boolean p_230432_9_, float p_230432_10_) { String s = this.station.getName() + " - " + this.station.getFormmatedPosition(); ScreenStationSelection.this.font.func_238406_a_(p_230432_1_, s, (float) (ScreenStationSelection.List.this.width / 2 - ScreenStationSelection.this.font.getStringWidth(s) / 2), (float) (p_230432_3_ + 1), 16777215, true); } public boolean mouseClicked(double mouseX, double mouseY, int button) { if (button == 0) { this.select(); return true; } else { return false; } } private void select() { ScreenStationSelection.List.this.setSelected(this); } } } }
  6. um, to be clear, I want to draw it with font renderer but it only accepts String, that's the first problem, and second, after got all tooltips on the tool player is holding, they're formatted but ITextComponent, therefore, I might need that to achieve what I want in a simple way. Note: How about copy 1.15.2's method code and try to modify to be compatible to 1.16.2's?
  7. How about getFormattedText()?
  8. Since I need to style my text with default-set style, like the tools' tooltip, it has green texts on it.
  9. I'm porting my 1.15.2 mod to 1.16.1 . In 1.15.2 , ITextComponent#getFormattedText() is the way to achieve my goal, but in 1.16.1, since most of forge is still mapping, I did not find a similar method to achieve my goal. Any idea? Also, is ITextComponent#applyTextStyle() in 1.16.1 calls ITextComponent#func_240699_a_()?
  10. After a compiled run, it says no such field, how can I get the field I want? (note: the field calls "debugFPS")
  11. Ok, my exception part is fixed, but after a further discover, I don't know what the "E" in the code below should be....... @Nullable public static <T, E> T getPrivateValue(Class<? super E> classToAccess, E instance, String fieldName) { try { return (T) findField(classToAccess, fieldName).get(instance); } catch (UnableToFindFieldException e) { LOGGER.error(REFLECTION,"Unable to locate field {} ({}) on type {}", fieldName, remapName(INameMappingService.Domain.FIELD, fieldName), classToAccess.getName(), e); throw e; } catch (IllegalAccessException e) { LOGGER.error(REFLECTION,"Unable to access field {} ({}) on type {}", fieldName, remapName(INameMappingService.Domain.FIELD, fieldName), classToAccess.getName(), e); throw new UnableToAccessFieldException(e); } } It says "The type of the classToAccess."
  12. I've tried to use Reflection to get the "debugFPS" field like below : int fps = 0; try { Field field = mc.getClass().getDeclaredField("debugFPS"); field.setAccessible(true); fps = (int) field.get(mc); } catch (NoSuchFieldException | SecurityException | IllegalArgumentException | IllegalAccessException e) { e.printStackTrace(); } but it only works on dev one, not working on compiled one. Anything I did not noticed?
  13. Ok , I think I have figured out the final answer, thanks for replies.
  14. My plan is to get server side's world and get tileentity data , I think two methods I mentioned earlier is the remote world so it doesn't get the real data.
  15. I'm trying to get vanilla server side's identity data from server side world.
×
×
  • Create New...

Important Information

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