Jump to content
Search In
  • More options...
Find results that contain...
Find results in...

jhonny97

Members
  • Posts

    29
  • Joined

  • Last visited

Everything posted by jhonny97

  1. I don't know where to place that code, the only place that possibly can go is the DistExecutor, but not work. I updated the repo to reflect this change.
  2. I tried also extending the SignTileEntity instead of extending TileEntity but not work.
  3. I was doing some testing and i accidentally pushed the changes. I replaced TileEntityType.SIGN with my custom type, but the result is the same
  4. This is the Git repo https://github.com/michele-grifa/MoreStuffMod.git The branch is the 1.16.1
  5. My tile entity extend the SignTileEntity class CustomSignTileEntity : SignTileEntity() { override fun getType(): TileEntityType<*> { return TileEntityInit.signTileEntity } } val signTileEntity: TileEntityType<CustomSignTileEntity> by tileEntities.register("my_sign") { TileEntityType.Builder.create({ CustomSignTileEntity() }, BlockInit.mySign, BlockInit.myWallSign).build(null) } If i extend SignTileEntity, the TE sync shouldn't happen by itself?
  6. I used the DistExecutor and the code is now the following val flag = super.onBlockPlaced(pos, worldIn, player, stack, state) if (worldIn.isRemote && !flag && player != null) { DistExecutor.safeRunWhenOn(Dist.CLIENT) { DistExecutor.SafeRunnable { Minecraft.getInstance().displayGuiScreen(CustomEditSignScreen(worldIn.getTileEntity(pos) as CustomSignTileEntity)) } } } return flag Now my custom sign screen is opened and i can edit it, but when i exit and re-enter the world, the sign is blank. If i use !worldIn.isRemote instead of worldIn.isRemote the game crash even if i use the DistExecutor
  7. I tried checking for logical client, but by calling it directly, Minecraft stuck after i place the sign. I will try with DistExecutor.
  8. I had the same problem a while ago, i created the custom sign screen but i don't know how to open the custom screen instead of the vanilla one. In the ClientPlayerEntity class, the EditSignScreen is hardcoded this.mc.displayGuiScreen(new EditSignScreen(signTile)); So in a custom SignItem, i cannot use: player.openSignEditor(worldIn.getTileEntity(pos) as CustomSignTileEntity) I also tried using this code, but the game crash after placing the sign. class CustomSignItem(propertiesIn: Properties?, floorBlockIn: Block?, wallBlockIn: Block?) : WallOrFloorItem(floorBlockIn, wallBlockIn, propertiesIn) { override fun onBlockPlaced( pos: BlockPos, worldIn: World, player: PlayerEntity?, stack: ItemStack, state: BlockState ): Boolean { val flag = super.onBlockPlaced(pos, worldIn, player, stack, state) if (!worldIn.isRemote && !flag && player != null) { Minecraft.getInstance().displayGuiScreen(CustomEditSignScreen(worldIn.getTileEntity(pos) as CustomSignTileEntity)) } return flag } } How i can override them?
  9. Your hint about the chaining placement was helpful, using this two placement i'm able to achieve the previous behavior .withPlacement(Features.Placements.HEIGHTMAP_PLACEMENT) .withPlacement(Placement.field_242902_f.configure(AtSurfaceWithExtraConfig(5, 0.1f, 1))
  10. Thanks for the explanation. After a bit of testing, i managed to register and spawn the biome without using json, but now the problem is another. In this biome i spawn a custom tree that worked until now. Instead of randomly place tree, like vanilla ones, they are placed in a grid (i attached a screenshot). Nothing has changed in my code since 1.16.1. This is the code that i use to add the tree to my biome withFeature( GenerationStage.Decoration.VEGETAL_DECORATION, Feature.TREE.withConfiguration(MyTree.treeConfig) .withPlacement(Placement.field_242902_f.configure(AtSurfaceWithExtraConfig(9, 0.1f, 1))) ) And this is the tree code: val treeConfig: BaseTreeFeatureConfig = BaseTreeFeatureConfig.Builder( SimpleBlockStateProvider(MyBlocks.log.defaultState), SimpleBlockStateProvider(MyBlocks.leaves.defaultState), BlobFoliagePlacer(FeatureSpread.func_242252_a(2), FeatureSpread.func_242252_a(0), 3), StraightTrunkPlacer(4, 2, 0), TwoLayerFeature(1, 0, 1)) .setIgnoreVines() .build() This happen with Forge 34.1.17, if i update to the latest Forge version they don't spawn at all.
  11. In 1.16.1 i used to add the biome using this code: BiomeManager.addBiome(BiomeManager.BiomeType.WARM, BiomeManager.BiomeEntry(biome, 10)) but now BiomeEntry require RegistryKey instead of biome itself and in 1.16.3 don't spawn anymore.
  12. Hi, i created added a custom biome in minecraft 1.16.1 and works perfectly, but now updating to 1.16.3, all of the biome code is not working, like BiomeDictionary that is not present anymore. I know of the change made by Mojang in 1.16.3 for the data driven biomes, but how i can convert this biome to the new version?
  13. You have to add sprite in TextureStitchEvent.Pre Event
  14. Ok thanks, i resolved using only using a custom Renderer for the sign and adding the sprite to the atlas and it works. the only problem is the EditSignScreen that show the default Oak WoodType instead of my texture because the screen, call "SignTileEntity.getMaterial" that search for the texture in the minecraft namespace and not my mod namespace. I tried creating a new EditSignScreen, but unfortunately when i try to display the screen, Minecraft crash without error. I checked the original call to display the gui and is done Server side, maybe there is some sort of synchronization between server and client that i have to implement myself.
  15. i checked more the IFluidHandler::fill but i can't figure out what to do. I the fill method i have only the fluidstack to insert and the action for the fill. If you were a little more specific, I would appreciate it.
  16. Have you tried in IntelliJ IDEA to do the Invalidate Caches / Restart under the File menu? Could you also share the build.gradle file content?
  17. 1.8 is no longer supported on this forum. Update to a newer version
  18. the folder is called "blockStates", it should be "blockstates"
  19. I created a custom block with a TileEntity that implements IFluidHandler and it works good, but i want to know if there is a way to tell the input handler to only accept a specific amount of fluid per tick
  20. I copy-pasted the renderer from the original sign renderer, because afaik I cannot instantiate a new woodtype, that has a protected constructor. So i overrided the getRenderMaterial to find my texture and there isn't a error in the log. How can I add that texture to the Atlas? There are some resources where I can learn this type of things about rendering and so on?
  21. 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); }
  22. 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
×
×
  • Create New...

Important Information

By using this site, you agree to our Privacy Policy.