Jump to content

jhonny97

Members
  • Posts

    32
  • Joined

  • Last visited

Everything posted by jhonny97

  1. Hi, in my mod in Minecraft 1.15.2, i added a new type of wood and i want to create the sign for it, but when i place down the block, it has no texture and the GUI don't open. I'm missing something that i don't know? Here is the TileEntityClass public class JapaneseCherrySignTileEntity extends SignTileEntity { public JapaneseCherrySignTileEntity() { super(); } @Override public TileEntityType<?> getType() { return TileEntityInit.INSTANCE.getJapCherrySignTileEntity(); } } The Block initialization public class BlockInit { public static final DeferredRegister<Block> blocks = DeferredRegister.create(ForgeRegistries.BLOCKS, MoreStuffMod.MODID); public static final RegistryObject<Block> japCherrySign = blocks.register("jap_cherry_sign", () -> new JapaneseCherrySignBlock(Block.Properties.create(Material.WOOD).doesNotBlockMovement().hardnessAndResistance(1.0F).sound(SoundType.WOOD), null)); } The tile entities initialization public class TileEntityInit { public static final DeferredRegister<TileEntityType<?>> tileEntities = DeferredRegister.create(ForgeRegistries.TILE_ENTITIES, MoreStuffMod.MODID); public static final RegistryObject<TileEntityType<JapaneseCherrySignTileEntity>> japCherrySignTileEntity = tileEntities.register("jap_cherry_sign", () -> TileEntityType.Builder.create(JapaneseCherrySignTileEntity::new, BlockInit.japCherrySign.get()).build(null)); } And the TileEntityRenderer @OnlyIn(Dist.CLIENT) public class JapaneseCherrySignTileEntityRenderer extends SignTileEntityRenderer { private final SignTileEntityRenderer.SignModel model = new SignTileEntityRenderer.SignModel(); public JapaneseCherrySignTileEntityRenderer(TileEntityRendererDispatcher rendererDispatcherIn) { super(rendererDispatcherIn); } @Override public void render(SignTileEntity tileEntityIn, float partialTicks, MatrixStack matrixStackIn, IRenderTypeBuffer bufferIn, int combinedLightIn, int combinedOverlayIn) { BlockState blockstate = tileEntityIn.getBlockState(); matrixStackIn.push(); float f = 0.6666667F; if (blockstate.getBlock() instanceof StandingSignBlock) { matrixStackIn.translate(0.5D, 0.5D, 0.5D); float f1 = -((float)(blockstate.get(StandingSignBlock.ROTATION) * 360) / 16.0F); matrixStackIn.rotate(Vector3f.YP.rotationDegrees(f1)); this.model.signStick.showModel = true; } else { matrixStackIn.translate(0.5D, 0.5D, 0.5D); float f4 = -blockstate.get(WallSignBlock.FACING).getHorizontalAngle(); matrixStackIn.rotate(Vector3f.YP.rotationDegrees(f4)); matrixStackIn.translate(0.0D, -0.3125D, -0.4375D); this.model.signStick.showModel = false; } matrixStackIn.push(); matrixStackIn.scale(0.6666667F, -0.6666667F, -0.6666667F); RenderMaterial rendermaterial = getMaterial(blockstate.getBlock()); IVertexBuilder ivertexbuilder = rendermaterial.getBuffer(bufferIn, this.model::getRenderType); this.model.signBoard.render(matrixStackIn, ivertexbuilder, combinedLightIn, combinedOverlayIn); this.model.signStick.render(matrixStackIn, ivertexbuilder, combinedLightIn, combinedOverlayIn); matrixStackIn.pop(); FontRenderer fontrenderer = this.renderDispatcher.getFontRenderer(); float f2 = 0.010416667F; matrixStackIn.translate(0.0D, (double)0.33333334F, (double)0.046666667F); matrixStackIn.scale(0.010416667F, -0.010416667F, 0.010416667F); int i = tileEntityIn.getTextColor().getTextColor(); double d0 = 0.4D; int j = (int)((double) NativeImage.getRed(i) * 0.4D); int k = (int)((double)NativeImage.getGreen(i) * 0.4D); int l = (int)((double)NativeImage.getBlue(i) * 0.4D); int i1 = NativeImage.getCombined(0, l, k, j); int j1 = 20; for(int k1 = 0; k1 < 4; ++k1) { ITextProperties itextproperties = tileEntityIn.func_235677_a_(k1, (p_239309_1_) -> { List<ITextProperties> list = fontrenderer.func_238420_b_().func_238362_b_(p_239309_1_, 90, Style.EMPTY); return list.isEmpty() ? ITextProperties.field_240651_c_ : list.get(0); }); if (itextproperties != null) { float f3 = (float)(-fontrenderer.func_238414_a_(itextproperties) / 2); fontrenderer.func_238416_a_(itextproperties, f3, (float)(k1 * 10 - 20), i1, false, matrixStackIn.getLast().getMatrix(), bufferIn, false, 0, combinedLightIn); } } matrixStackIn.pop(); } public static RenderMaterial getMaterial(Block blockIn) { return new RenderMaterial(Atlases.SIGN_ATLAS, new ResourceLocation(MoreStuffMod.MODID, "textures/entity/signs/jap_cherry.png")); } } And the setup event private void setup(final FMLCommonSetupEvent event) { ClientRegistry.bindTileEntityRenderer(TileEntityInit.japCherrySignTileEntity.get(), JapaneseCherrySignTileEntityRenderer::new); }
  2. Thanks it worked
  3. I have a block with a different front texture. When i place down this block, the front is facing me. The left side for me, is the left side of the front. I don't know if I've made myself clear
  4. Hi, i have a problem with the getCapability method. I created a custom tile entity with a FluidHandler and an ItemStackHandler capability and i want to restrict fluid only on the left side of the block. The problem is that the "side" parameter that is present, is not the side of the block, instead is the global facing. This is my code @Nonnull @Override public <T> LazyOptional<T> getCapability(@Nonnull Capability<T> cap, Direction side) { if(cap == CapabilityItemHandler.ITEM_HANDLER_CAPABILITY) { if(side == Direction.UP || side == Direction.NORTH) { return inputHandler.cast(); } else if(side == Direction.DOWN || side == Direction.EAST) { return outputHandler.cast(); } } if(cap == CapabilityFluidHandler.FLUID_HANDLER_CAPABILITY) { if(side == Direction.WEST) { return fluidHandler.cast(); } } return LazyOptional.empty(); } How i can check the real side of the block?
  5. You can find the code at this link: https://github.com/michele-grifa/MoreStuffMod The branch is the 1.16.1 Another problem is that in the TileEntityRender, my custom texture for the Sign don't get loaded. Thanks
  6. Hi, i'm new to modding and i created a new different tree type. Now i created all the associated blocks, but i have some trouble creating a new Sign. I extended the SignBlock class and the SignTileEntity and binded the TileEntityRenderer and all works good, but when i place down the sign the GUI for the text not show. I'm missing something? I'm using Minecraft 1.16.1 with Forge 32.0.98
  7. Hello guys I installed FML and Car Mod, but when I start Minecraft the game freezes and I view this error: 3 mods loaded Minecraft Forge 3.3.7.135 FML v2.2.48.135 Forge Mod Loader version 2.2.48.135 for Minecraft 1.2.5 mod_MinecraftForge : Pre-initialized (minecraft.jar) mod_ModLoaderMp : Pre-initialized (minecraft.jar) mod_cars : Loaded (1.2.4 carmod v2.2.zip) Minecraft has crashed! ---------------------- Minecraft has stopped running because it encountered a problem. --- BEGIN ERROR REPORT 69360557 -------- Generated 11/09/12 17.15 Minecraft: Minecraft 1.2.5 OS: Windows 7 (x86) version 6.1 Java: 1.7.0_05, Oracle Corporation VM: Java HotSpot Client VM (mixed mode), Oracle Corporation LWJGL: 2.4.2 OpenGL: Mobile Intel® HD Graphics version 3.0.0 - Build 8.15.10.2279, Intel cpw.mods.fml.common.LoaderException: java.lang.IllegalAccessException: Class cpw.mods.fml.common.modloader.ModLoaderModContainer can not access a member of class mod_cars with modifiers "public" at cpw.mods.fml.common.modloader.ModLoaderModContainer.preInit(ModLoaderModContainer.java:114) at cpw.mods.fml.common.Loader.preModInit(Loader.java:235) at cpw.mods.fml.common.Loader.loadMods(Loader.java:593) at cpw.mods.fml.client.FMLClientHandler.onPreLoad(FMLClientHandler.java:193) at net.minecraft.client.Minecraft.a(Minecraft.java:383) at net.minecraft.client.Minecraft.run(Minecraft.java:735) at java.lang.Thread.run(Unknown Source) Caused by: java.lang.IllegalAccessException: Class cpw.mods.fml.common.modloader.ModLoaderModContainer can not access a member of class mod_cars with modifiers "public" at sun.reflect.Reflection.ensureMemberAccess(Unknown Source) at java.lang.Class.newInstance0(Unknown Source) at java.lang.Class.newInstance(Unknown Source) at cpw.mods.fml.common.modloader.ModLoaderModContainer.preInit(ModLoaderModContainer.java:107) ... 6 more --- END ERROR REPORT 4eb853a7 ---------- I commend to you the attached file ForgeModLoader-0.
×
×
  • Create New...

Important Information

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