Jump to content

nocot

Members
  • Posts

    18
  • Joined

  • Last visited

Everything posted by nocot

  1. Hi, I'm planning to create a mod from scratch and I'm wondering if it's the right time to start with 1.13.2, or it will be better to stay with the 1.12 versions. I would like to target into the future, but is the newest Forge already stable enough for regular modding?
  2. Hello, I need a general advice on the entities. Most tutorials found in google on how to create an entity are showing how to make an entity that extends another entity (e.g. how to make custom mob), but I haven't found anything for making an entire entity from scratch. Do you have any general advice or tutorial on how to make an independent entity physically appear in the world? I already know how to register entity, I just don't know how to make it placeable. Let's say I want to make a moving box. I have the entity properly registered, and it has its own class. I have its model and textures ready. What's next?
  3. As I wrote in my first post, this is my RenderHandler class: public class RenderHandler { public static void registerEntityRenders() { RenderingRegistry.registerEntityRenderingHandler(EntityTramc.class, new IRenderFactory<EntityTramc>() { @Override public Render<? super EntityTramc> createRenderFor(RenderManager manager) { return new RenderTramc(manager); }); } } And RenderTramc() : @SideOnly(Side.CLIENT) public class RenderTramc extends RenderMinecart<EntityTramc> { public RenderTramc(RenderManager renderManagerIn) { super(renderManagerIn); this.modelMinecart = new ModelTramc(); System.out.println("RenderTramc loaded"); } ... I know I messed up with something but I still don't get the point. Entities are still quite puzzling to me. EDIT: Note that RenderTramc class is not fully pasted but it's (I think) not needed for help purposes.
  4. Is there a significant case that is making so many people stay with such obsolete Minecraft versions? Is that because of compatibility with some old mods or what?
  5. Hello again; so I'm back into Minecraft modding. I analyzed my code a bit and it seems like an overriding function for rendering function is never being called. And why I think it is so - it's because when I create my own minecart entity, it spawns a regular modelled minecart, without null pointer exception or any graphical issues - and a default minecart model in my entity is never replaced by my mod (I don't mean replace original minecart model, but my modded entity model - default is minecart). So, am I thinking right? Also, I tried to register entity renders in model loader with no luck: @SubscribeEvent public static void modelRegister(ModelLoader event) { if(Minecraft.getMinecraft().world.isRemote) { RenderHandler.registerEntityRenders(); } } ... But I think that it just couldn't work. Can anyone help?
  6. Hi, I've finally got to work my custom minecart entity called EntityTramc which extends EntityMinecart and for testing purposes, it has ride ability turned off and does nothing besides that. And it got to work. To replace a model of minecart into a testing box (which will become a tram soon), I created a class called RenderTramc: @SideOnly(Side.CLIENT) public class RenderTramc extends RenderMinecart<EntityTramc> { public RenderTramc(RenderManager renderManagerIn) { super(renderManagerIn); this.modelMinecart = new ModelTramc(); System.out.println("RenderTramc loaded"); } ... and ModelTramc() is a function in a ModelTramc.class which is auto-generated model class (made by some model creator). To register RenderTramc I created a render handler: public class RenderHandler { public static void registerEntityRenders() { RenderingRegistry.registerEntityRenderingHandler(EntityTramc.class, new IRenderFactory<EntityTramc>() { @Override public Render<? super EntityTramc> createRenderFor(RenderManager manager) { return new RenderTramc(manager); }); } } and called it in a registry handler by subscribe event: @SubscribeEvent public static void onItemRegister(RegistryEvent.Register<Item> event) { event.getRegistry().registerAll(ModItems.ITEMS.toArray(new Item[0])); event.getRegistry().registerAll(ModItems.ITEMS.toArray(new Item[1])); RenderHandler.registerEntityRenders(); } ... I know it's very ugly to call it in that way but I just want to get it work, optimization will come next. A RenderTramc() function is being called at the very beginning of the game (I got the System.out message) but it doesn't change a minecart model at all. I know I've messed up with something but I don't really see where is it. So, any help will be appreciated.
  7. Hello again. I copied ItemMinecart to my own item which I called ItemTram so I can use it like a normal minecart placer. Then I created an entity which temporarly just extends EntityMinecart and do nothing more. The problem started when I tried to change an entity calling function in my ItemTram class: EntityMinecart entityminecart = EntityMinecart.create(world, d0, d1 + d3, d2, ((ItemMinecart)stack.getItem()).minecartType); to call my new entity: EntityTram entityminecart = EntityTram.create(world, d0, d1 + d3, d2, ((ItemTram)stack.getItem()).minecartType); and my entity is: package com.kg.transportmod; import net.minecraft.entity.item.EntityMinecart; import net.minecraft.util.DamageSource; import net.minecraft.world.World; public class EntityTram extends EntityMinecart{ public EntityTram(World worldIn, double x, double y, double z, EntityTram.Type type) { super(worldIn, x, y, z); } @Override public Type getType() { return null; } } Eclipse just gives me an answer that entity tram is not compatible with entity minecart. I can cast to entity tram but a Minecraft gives then a runtime error that it can't be casted to entity tram. What am I doing wrong? Isn't that the way I can copy an entity?
  8. Thank you for the answer. Well, it has to be moving around the world by a track, like a minecart. So I think I'll start with creating an entity based on minecart's one and slightly modifying it. I think it will be a good point to start with entities and to better understand them.
  9. Ahh yeah, forgive me, I'm just a begginner and I just don't understand many things that good. But that's my bad. I must have misinterpretated informations about entities that I've searched, so I must go back and study about it. I think, that's it.
  10. I'm still on deep research part, so I haven't started writing a mod for good. I think a train cannot be loaded as a block if it has to be moveable - but maybe I'm wrong and something has changed. I know that entity stuff will come for me with writing a train physics and so on, but I still think that making an entity just for displaying a 3D model is a way too complicated and I look for other methods. So, making a train an item isn't that bad idea? I heard that a minecart did something like that too.
  11. I'm trying to render a train as a normal 3D object, just as any other block or item in the world; so not as the part of HUD. Is it possible to render it as a 3D item, in a player independent position?
  12. I'm creating a train mod and I need to place a train object that will change its position every frame (to look like it's moving). I found two modelling programs - Tabula and Workbench. The first one creates a class file that is probably a tesselator instruction set. The second one can create .json and .obj file. All I want is to render a model in a fixed position and rotation that can change every frame. So I mean, I just want to call some function like this every frame: @SubscribeEvent public int renderTrain(blahblahEveryFrameEvent event) { renderTrain(MY_MODEL, XPOS, YPOS, ZPOS, ...); } What is the simplest way through loading model and displaying it by calling a function? Do I really have to mess with all the tile entity stuff? Or there is somehow no need to call that function manually?
  13. I'm creating a mod based on external libraries that are making snapshots from videos. My goal is to use these snapshots - made as buffered images - to display them in a GUI. My problem is that when an event is converting a buffered image into a dynamic texture, the game eventually crashes. Despite my tryings, I still get the same error with the same function. Here is my crash report: ---- Minecraft Crash Report ---- // You're mean. Time: 8/1/18 8:10 PM Description: Exception in server tick loop java.lang.RuntimeException: No OpenGL context found in the current thread. at org.lwjgl.opengl.GLContext.getCapabilities(GLContext.java:124) at org.lwjgl.opengl.GL11.glGenTextures(GL11.java:1403) at net.minecraft.client.renderer.GlStateManager.generateTexture(GlStateManager.java:465) at net.minecraft.client.renderer.texture.TextureUtil.glGenTextures(TextureUtil.java:38) at net.minecraft.client.renderer.texture.AbstractTexture.getGlTextureId(AbstractTexture.java:54) at net.minecraft.client.renderer.texture.DynamicTexture.<init>(DynamicTexture.java:30) at net.minecraft.client.renderer.texture.DynamicTexture.<init>(DynamicTexture.java:20) at com.kacpergutowski.rfmod.Main.onPlayerTick(Main.java:144) at net.minecraftforge.fml.common.eventhandler.ASMEventHandler_10_Main_onPlayerTick_EntityJoinWorldEvent.invoke(.dynamic) at net.minecraftforge.fml.common.eventhandler.ASMEventHandler.invoke(ASMEventHandler.java:90) at net.minecraftforge.fml.common.eventhandler.EventBus.post(EventBus.java:182) at net.minecraft.world.WorldServer.loadEntities(WorldServer.java:1128) at net.minecraft.world.chunk.Chunk.onLoad(Chunk.java:918) at net.minecraftforge.common.chunkio.ChunkIOProvider.syncCallback(ChunkIOProvider.java:105) at net.minecraftforge.common.chunkio.ChunkIOExecutor.syncChunkLoad(ChunkIOExecutor.java:94) at net.minecraft.world.gen.ChunkProviderServer.loadChunk(ChunkProviderServer.java:130) at net.minecraft.world.gen.ChunkProviderServer.loadChunk(ChunkProviderServer.java:101) at net.minecraft.world.gen.ChunkProviderServer.provideChunk(ChunkProviderServer.java:147) at net.minecraft.server.MinecraftServer.initialWorldChunkLoad(MinecraftServer.java:383) at net.minecraft.server.integrated.IntegratedServer.loadAllWorlds(IntegratedServer.java:143) at net.minecraft.server.integrated.IntegratedServer.init(IntegratedServer.java:160) at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:552) at java.lang.Thread.run(Unknown Source) I see that it might be a server/client side problem but I cannot see what exactly is causing that issue. Here is my mod code (so minimalist because I'm just trying to investigate the problem): @Mod(modid = Reference.MOD_ID, name = Reference.NAME, version = Reference.VERSION) public class Main { int i = 0; @Instance public static Main instance; @SidedProxy(clientSide = Reference.CLIENT_PROXY_CLASS, serverSide = Reference.COMMON_PROXY_CLASS) public static CommonProxy proxy; @EventHandler public void PreInit(FMLPreInitializationEvent event) { } @EventHandler public void Init(FMLInitializationEvent event) { MinecraftForge.EVENT_BUS.register(new com.kacpergutowski.rfmod.events.EventHandler()); MinecraftForge.EVENT_BUS.register(this); } @EventHandler public void PostInit(FMLPostInitializationEvent event) { } @SideOnly(Side.CLIENT) @SubscribeEvent public void onPlayerTick(EntityJoinWorldEvent evt) throws Exception { FFmpegFrameGrabber g = new FFmpegFrameGrabber("C:/Users/Kacper/Documents/file.mp4"); g.start(); Frame f = g.grab(); OpenCVFrameConverter.ToIplImage iplConverter = new OpenCVFrameConverter.ToIplImage(); IplImage img = iplConverter.convert(f); Java2DFrameConverter paintConverter = new Java2DFrameConverter(); BufferedImage image = paintConverter.getBufferedImage(f,1); DynamicTexture texture = new DynamicTexture(image); } } Everything is placed in one event just for testing purposes. For sure my problem is obvious, but I still can't get it. Anyone who can help me with it?
  14. Oh right, I made a mistake. It got to work now, thank you.
  15. Hello, I've just finally started to update my mod for 1.12.2 and I found my first problem. In 1.7.10 to make an event, I had to register event class (still not sure if it was completly nessesary) @EventHandler public static void Init(FMLInitializationEvent event) { MinecraftForge.EVENT_BUS.register(test.class); } And subscribe an event in my class public class test { @SubscribeEvent public void onPlayerTick(PlayerTickEvent evt) { System.out.println("OK"); } } And it used to work - at this example, printed "OK" to a console every tick. But when it comes to 1.12.2, for unknown for me reason, it is not possible anymore. It just shows nothing. Is there a simple solution for it? My actual goal is currently to print "OK" every tick. Woops, my bad. Changed a title.
  16. I've been creating my mods for a stongly outdated version of Minecraft - 1.7.10, just becuse of Traincraft and Flans Mod stuff being available only for this version. Now I want to rewrite those mods for the most recent one. 1.12.2 is the latest at the time, but these will be soon available 1.13 and 1.12 will get outdated. Now I wonder what to do - to wait for the 1.13 and write a mod after this release, or write a mod on 1.12 now and just rewrite it to 1.13 after its release. So, my main question is - is there Forge for 1.13 going to have the big changes compared to 1.12.2, that will force me to rewrite a whole mod code architecture when going from 1.12 to 1.13, or the changes will be not that significant and conversion from 1.12 to 1.13 won't hurt a bit? UPDATE: I found a similar topic on this forum, so if my topic won't give anything new, it can be closed.
  17. I'm creating a TV set for my radio propagation mod and I found it problematic to display an animation on the TV. I want the 300-frames animation to be played on the front of TV block. When I was creating a prototype TV screen as a part of GUI, I could update frames by simply overwriting them and I got the TV set working. But if it goes to a real block, not a GUI texture, things get complicated. I can't just update texture every frame because a texture is preloaded in preInit. I found that Metadata can be helpful with animated textures, but only for up to 16 frames. I also found a json solution, but I want my TV channels be switchable and time-synchronized. The only idea I have is to not interfere with TV textures itselves but render a textured rectangle in front of a TV block and update it every frame. But still having no idea how to do that. Reminding that my goal is just to see an animation like it is shown on the block. Any ideas? I'm still coding for Minecraft 1.7.10, I know it is not longer supported here, so I can take the answer from the newer versions (like 1.8 or 1.12), eventually I can change Forge to a newer version.
×
×
  • Create New...

Important Information

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