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

jun2040

Members
  • Posts

    64
  • Joined

  • Last visited

Everything posted by jun2040

  1. I still can't fix it. Here's my whole mod: https://github.com/jun2040/unixmod
  2. @RaphGamingz I did that but this time whenever I right click the block it says [16:35:22] [Client thread/WARN] [minecraft/ScreenManager]: Failed to create screen for menu type: unixmod:bioreactor
  3. Oops Sorry. I was really sleepy last night. Correct code: package com.jun2040.unixmod.blocks; import com.jun2040.unixmod.items.ModItems; import net.minecraft.entity.player.PlayerEntity; import net.minecraft.entity.player.PlayerInventory; import net.minecraft.inventory.container.Container; import net.minecraft.tileentity.TileEntity; import net.minecraft.util.IWorldPosCallable; import net.minecraft.util.math.BlockPos; import net.minecraft.world.World; import net.minecraftforge.items.CapabilityItemHandler; import net.minecraftforge.items.IItemHandler; import net.minecraftforge.items.SlotItemHandler; import net.minecraftforge.items.wrapper.InvWrapper; import static com.jun2040.unixmod.blocks.ModBlocks.BIOREACTOR_CONTAINER; public class BioreactorContainer extends Container { private TileEntity tileEntity; private PlayerEntity playerEntity; private IItemHandler playerInventory; public BioreactorContainer(int windowId, World world, BlockPos pos, PlayerInventory playerInventory, PlayerEntity player) { super(BIOREACTOR_CONTAINER, windowId); TileEntity tileEntity = world.getTileEntity(pos); this.playerEntity = player; this.playerInventory = new InvWrapper(playerInventory); tileEntity.getCapability(CapabilityItemHandler.ITEM_HANDLER_CAPABILITY).ifPresent(h -> { addSlot(new SlotItemHandler(h, 0, 64, 24)); }); layoutPlayerInventorySlots(10, 70); } @Override public boolean canInteractWith(PlayerEntity playerIn) { return isWithinUsableDistance(IWorldPosCallable.of(tileEntity.getWorld(), tileEntity.getPos()), playerEntity, ModBlocks.BIOREACTOR); } private int addSlotRange(IItemHandler handler, int index, int x, int y, int amount, int dx) { for (int i = 0 ; i < amount ; i++) { addSlot(new SlotItemHandler(handler, index, x, y)); x += dx; index++; } return index; } private int addSlotBox(IItemHandler handler, int index, int x, int y, int horAmount, int dx, int verAmount, int dy) { for (int j = 0 ; j < verAmount ; j++) { index = addSlotRange(handler, index, x, y, horAmount, dx); y += dy; } return index; } private void layoutPlayerInventorySlots(int leftCol, int topRow) { // Player inventory addSlotBox(playerInventory, 9, leftCol, topRow, 9, 18, 3, 18); // Hotbar topRow += 58; addSlotRange(playerInventory, 0, leftCol, topRow, 9, 18); } }
  4. I'm trying to make a block that has a gui but every time I activate it, my game just crashes. Code: package com.jun2040.unixmod.blocks; import com.jun2040.unixmod.UnixMod; import com.mojang.blaze3d.platform.GlStateManager; import net.minecraft.client.Minecraft; import net.minecraft.client.gui.screen.inventory.ContainerScreen; import net.minecraft.entity.player.PlayerInventory; import net.minecraft.util.ResourceLocation; import net.minecraft.util.text.ITextComponent; public class BioreactorScreen extends ContainerScreen<BioreactorContainer> { private ResourceLocation GUI = new ResourceLocation(UnixMod.MODID, "textures/gui/bioreactor.png"); public BioreactorScreen(BioreactorContainer container, PlayerInventory inv, ITextComponent name) { super(container, inv, name); } @Override public void render(int mouseX, int mouseY, float partialTicks) { this.renderBackground(); super.render(mouseX, mouseY, partialTicks); this.renderHoveredToolTip(mouseX, mouseY); } @Override protected void drawGuiContainerForegroundLayer(int mouseX, int mouseY) { } @Override protected void drawGuiContainerBackgroundLayer(float partialTicks, int mouseX, int mouseY) { GlStateManager.color4f(1.0F, 1.0F, 1.0F, 1.0F); this.minecraft.getTextureManager().bindTexture(GUI); int relX = (this.width - this.xSize) / 2; int relY = (this.height - this.ySize) / 2; this.blit(relX, relY, 0, 0, this.xSize, this.ySize); } } Error: ---- Minecraft Crash Report ---- // I bet Cylons wouldn't have this problem. Time: 12/12/19 11:18 PM Description: Ticking entity java.lang.NullPointerException: Ticking entity at com.jun2040.unixmod.blocks.BioreactorContainer.canInteractWith(BioreactorContainer.java:38) ~[?:?] {re:classloading} at net.minecraft.entity.player.ServerPlayerEntity.tick(ServerPlayerEntity.java:338) ~[?:?] {re:classloading,pl:accesstransformer:B} at net.minecraft.world.server.ServerWorld.updateEntity(ServerWorld.java:602) ~[?:?] {re:classloading} at net.minecraft.world.World.func_217390_a(World.java:736) ~[?:?] {re:classloading,pl:accesstransformer:B} at net.minecraft.world.server.ServerWorld.tick(ServerWorld.java:397) ~[?:?] {re:classloading} at net.minecraft.server.MinecraftServer.updateTimeLightAndEntities(MinecraftServer.java:865) ~[?:?] {re:classloading,pl:accesstransformer:B} at net.minecraft.server.MinecraftServer.tick(MinecraftServer.java:800) ~[?:?] {re:classloading,pl:accesstransformer:B} at net.minecraft.server.integrated.IntegratedServer.tick(IntegratedServer.java:118) ~[?:?] {re:classloading,pl:runtimedistcleaner:A} at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:646) [?:?] {re:classloading,pl:accesstransformer:B} at java.lang.Thread.run(Thread.java:748) [?:1.8.0_202] {} A detailed walkthrough of the error, its code path and all known details is as follows: --------------------------------------------------------------------------------------- -- Head -- Thread: Server thread Stacktrace: at com.jun2040.unixmod.blocks.BioreactorContainer.canInteractWith(BioreactorContainer.java:38) at net.minecraft.entity.player.ServerPlayerEntity.tick(ServerPlayerEntity.java:338) at net.minecraft.world.server.ServerWorld.updateEntity(ServerWorld.java:602) -- Entity being ticked -- Details: Entity Type: minecraft:player (net.minecraft.entity.player.ServerPlayerEntity) Entity ID: 126 Entity Name: Dev Entity's Exact location: -149.92, 22.00, -45.12 Entity's Block location: World: (-150,22,-46), Chunk: (at 10,1,2 in -10,-3; contains blocks -160,0,-48 to -145,255,-33), Region: (-1,-1; contains chunks -32,-32 to -1,-1, blocks -512,0,-512 to -1,255,-1) Entity's Momentum: 0.00, -0.08, 0.00 Entity's Passengers: [] Entity's Vehicle: ~~ERROR~~ NullPointerException: null Stacktrace: at net.minecraft.world.World.func_217390_a(World.java:736) at net.minecraft.world.server.ServerWorld.tick(ServerWorld.java:397) -- Affected level -- Details: All players: 1 total; [ServerPlayerEntity['Dev'/126, l='mod test', x=-149.92, y=22.00, z=-45.12]] Chunk stats: ServerChunkCache: 2246 Level dimension: DimensionType{minecraft:overworld} Level name: mod test Level seed: -2385347844768643725 Level generator: ID 01 - flat, ver 0. Features enabled: true Level generator options: {biome:"minecraft:plains",layers:[{block:"minecraft:bedrock",height:1b},{block:"minecraft:dirt",height:20b},{block:"minecraft:grass_block",height:1b}],structures:{village:{}}} Level spawn location: World: (-176,22,-112), Chunk: (at 0,1,0 in -11,-7; contains blocks -176,0,-112 to -161,255,-97), Region: (-1,-1; contains chunks -32,-32 to -1,-1, blocks -512,0,-512 to -1,255,-1) Level time: 54794 game time, 3461 day time Level storage version: 0x04ABD - Anvil Level weather: Rain time: 36009 (now: false), thunder time: 52923 (now: false) Level game mode: Game mode: creative (ID 1). Hardcore: false. Cheats: true Stacktrace: at net.minecraft.server.MinecraftServer.updateTimeLightAndEntities(MinecraftServer.java:865) at net.minecraft.server.MinecraftServer.tick(MinecraftServer.java:800) at net.minecraft.server.integrated.IntegratedServer.tick(IntegratedServer.java:118) at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:646) at java.lang.Thread.run(Thread.java:748) -- System Details -- Details: Minecraft Version: 1.14.4 Minecraft Version ID: 1.14.4 Operating System: Windows 10 (amd64) version 10.0 Java Version: 1.8.0_202, Oracle Corporation Java VM Version: Java HotSpot(TM) 64-Bit Server VM (mixed mode), Oracle Corporation Memory: 535933160 bytes (511 MB) / 2076704768 bytes (1980 MB) up to 3771203584 bytes (3596 MB) CPUs: 12 JVM Flags: 1 total; -XX:HeapDumpPath=MojangTricksIntelDriversForPerformance_javaw.exe_minecraft.exe.heapdump ModLauncher: 4.1.0+62+5bfa59b ModLauncher launch target: fmluserdevclient ModLauncher naming: mcp ModLauncher services: /eventbus-1.0.0-service.jar eventbus PLUGINSERVICE /forge-1.14.4-28.1.87_mapped_snapshot_20191111-1.14.3-launcher.jar object_holder_definalize PLUGINSERVICE /forge-1.14.4-28.1.87_mapped_snapshot_20191111-1.14.3-launcher.jar runtime_enum_extender PLUGINSERVICE /accesstransformers-1.0.1-milestone.0.1+94458e7-shadowed.jar accesstransformer PLUGINSERVICE /forge-1.14.4-28.1.87_mapped_snapshot_20191111-1.14.3-launcher.jar capability_inject_definalize PLUGINSERVICE /forge-1.14.4-28.1.87_mapped_snapshot_20191111-1.14.3-launcher.jar runtimedistcleaner PLUGINSERVICE /forge-1.14.4-28.1.87_mapped_snapshot_20191111-1.14.3-launcher.jar fml TRANSFORMATIONSERVICE FML: 28.1 Forge: net.minecraftforge:28.1.87 FML Language Providers: javafml@28.1 minecraft@1 Mod List: client-extra.jar Minecraft {minecraft@1.14.4 DONE} main UnixMod {unixmod@0.1 DONE} forge-1.14.4-28.1.87_mapped_snapshot_20191111-1.14.3-recomp.jar Forge {forge@28.1.87 DONE} Player Count: 1 / 8; [ServerPlayerEntity['Dev'/126, l='mod test', x=-149.92, y=22.00, z=-45.12]] Data Packs: vanilla, mod:unixmod, mod:forge Type: Integrated Server (map_client.txt) Is Modded: Definitely; Client brand changed to 'forge'
  5. What is Compound NBT and when do I use it? Also, how do I use it?
  6. Is copy-pasting the entire code the only way to bake multiple models? This is the code: try { IUnbakedModel model = ModelLoaderRegistry.getModelOrLogError(new ResourceLocation("toomanyores:block/water_wheel.obj"), "Missing water wheel model"); if (model instanceof OBJModel) { IBakedModel bakedModel = model.bake(event.getModelLoader(), ModelLoader.defaultTextureGetter(), new BasicState(model.getDefaultState(), true), DefaultVertexFormats.BLOCK); IBakedModel bakedInvModel = model.bake(event.getModelLoader(), ModelLoader.defaultTextureGetter(), new BasicState(model.getDefaultState(), true), DefaultVertexFormats.ITEM); bakedInvModel = new PerspectiveMapWrapper(bakedInvModel, BLOCK_TRANSFORMS); event.getModelRegistry().put(new ModelResourceLocation("toomanyores:waterwheel", ""), bakedModel); event.getModelRegistry().put(new ModelResourceLocation("toomanyores:waterwheel", "inventory"), bakedInvModel); } Do I have to copy this code and paste it to bake new models?
  7. I've been searching for animating block models for obj but all I find is for json blocks. Is it possible with obj models? If it is, how do I do it? I also want the animation to be for the models, not the textures.
  8. I did that and it doesn't work. It seems like the objLoader is not trying to find .obj. Its searching for the json file. [09:50:30] [Server-Worker-6/WARN] [minecraft/ModelBakery]: Unable to load model: 'unixmod:block/fabricator.obj' referenced from: unixmod:fabricator#: java.io.FileNotFoundException: unixmod:models/block/fabricator.obj.json [09:50:31] [Server-Worker-6/WARN] [minecraft/ModelBakery]: Unable to load model: 'unixmod:fabricator#inventory' referenced from: unixmod:fabricator#inventory: java.io.FileNotFoundException: unixmod:models/item/fabricator.json
  9. @Yanny7 I am using TextureStitchEvent.Pre but it's not working. The lighting works now tho. Thanks.
  10. @Yanny7 My textures not working... And I got this glitch(?) thing going on with my block.
  11. Um. I meant I commented that out and fixed that. I uncommented it. But the textures are still dark and there's this weird thing going on with my block and things beside the block. Do you know how to register multiple models on onModelBakeEvent()?
  12. @TheMikeste1 I created the model.json for my block and the block doesn't seem to render the model for some reason. I also got some problems with the item. here's my github: https://github.com/jun2040/unixmod Edit: I commented out the model registries thing... The model works now but the item's not working and the model's texture is too dark.
  13. I've been fiddling with OBJLoader for a week now and I keep getting the unable to load model error. I think the OBJLoader is not called properly because I used the tutorial from older versions. does anyone know how to call OBJLoader.INSTANCE.addDomain properly?
  14. I got one more error(?). I don't know if you call this an error or not but still. [21:19:45] [Client thread/INFO] [ne.mi.cl.mo.ob.OBJModel/]: OBJLoader.MaterialLibrary: key 'Ns' (model: 'unixmod:models/block/fabricator.mtl') is not currently supported, skipping [21:19:45] [Client thread/INFO] [ne.mi.cl.mo.ob.OBJModel/]: OBJModel: A color has already been defined for material 'Material' in 'unixmod:models/block/fabricator.mtl'. The color defined by key 'Ks' will not be applied! [21:19:45] [Client thread/INFO] [ne.mi.cl.mo.ob.OBJModel/]: OBJLoader.MaterialLibrary: key 'Ke' (model: 'unixmod:models/block/fabricator.mtl') is not currently supported, skipping [21:19:45] [Client thread/INFO] [ne.mi.cl.mo.ob.OBJModel/]: OBJLoader.MaterialLibrary: key 'Ni' (model: 'unixmod:models/block/fabricator.mtl') is not currently supported, skipping [21:19:45] [Client thread/INFO] [ne.mi.cl.mo.ob.OBJModel/]: OBJLoader.MaterialLibrary: key 'illum' (model: 'unixmod:models/block/fabricator.mtl') is not currently supported, skipping [21:19:45] [Client thread/INFO] [ne.mi.cl.mo.ob.OBJModel/]: OBJLoader.Parser: command 's' (model: 'unixmod:models/block/fabricator.obj') is not currently supported, skipping. Line: 24 's off'
  15. I got an extra line at the end and I can't find a way to fix it. The model isn't even rendering. [21:19:45] [Client thread/INFO] [ne.mi.cl.mo.ob.OBJModel/]: OBJLoader.MaterialLibrary: key 'Ns' (model: 'unixmod:models/block/fabricator.mtl') is not currently supported, skipping [21:19:45] [Client thread/INFO] [ne.mi.cl.mo.ob.OBJModel/]: OBJModel: A color has already been defined for material 'Material' in 'unixmod:models/block/fabricator.mtl'. The color defined by key 'Ks' will not be applied! [21:19:45] [Client thread/INFO] [ne.mi.cl.mo.ob.OBJModel/]: OBJLoader.MaterialLibrary: key 'Ke' (model: 'unixmod:models/block/fabricator.mtl') is not currently supported, skipping [21:19:45] [Client thread/INFO] [ne.mi.cl.mo.ob.OBJModel/]: OBJLoader.MaterialLibrary: key 'Ni' (model: 'unixmod:models/block/fabricator.mtl') is not currently supported, skipping [21:19:45] [Client thread/INFO] [ne.mi.cl.mo.ob.OBJModel/]: OBJLoader.MaterialLibrary: key 'illum' (model: 'unixmod:models/block/fabricator.mtl') is not currently supported, skipping [21:19:45] [Client thread/INFO] [ne.mi.cl.mo.ob.OBJModel/]: OBJLoader.Parser: command 's' (model: 'unixmod:models/block/fabricator.obj') is not currently supported, skipping. Line: 24 's off'
  16. ANYONEEEE???? I'VE BEEN FIDDLING WITH THIS FOR LIKE A DAYYYY. The loader just keeps adding .json. I think its something wrong with my objLoader. [11:29:15] [Server-Worker-1/WARN] [minecraft/ModelBakery]: Unable to load model: 'unixmod:block/fabricator.obj' referenced from: unixmod:fabricator#: java.io.FileNotFoundException: unixmod:models/block/fabricator.obj.json [11:29:16] [Server-Worker-1/WARN] [minecraft/ModelBakery]: Unable to load model: 'unixmod:fabricator#inventory' referenced from: unixmod:fabricator#inventory: java.io.FileNotFoundException: unixmod:models/item/fabricator.json Edit: I also realized there are some errors with OBJLoader [21:19:45] [Client thread/INFO] [ne.mi.cl.mo.ob.OBJModel/]: OBJLoader.MaterialLibrary: key 'Ns' (model: 'unixmod:models/block/fabricator.mtl') is not currently supported, skipping [21:19:45] [Client thread/INFO] [ne.mi.cl.mo.ob.OBJModel/]: OBJModel: A color has already been defined for material 'Material' in 'unixmod:models/block/fabricator.mtl'. The color defined by key 'Ks' will not be applied! [21:19:45] [Client thread/INFO] [ne.mi.cl.mo.ob.OBJModel/]: OBJLoader.MaterialLibrary: key 'Ke' (model: 'unixmod:models/block/fabricator.mtl') is not currently supported, skipping [21:19:45] [Client thread/INFO] [ne.mi.cl.mo.ob.OBJModel/]: OBJLoader.MaterialLibrary: key 'Ni' (model: 'unixmod:models/block/fabricator.mtl') is not currently supported, skipping [21:19:45] [Client thread/INFO] [ne.mi.cl.mo.ob.OBJModel/]: OBJLoader.MaterialLibrary: key 'illum' (model: 'unixmod:models/block/fabricator.mtl') is not currently supported, skipping [21:19:45] [Client thread/INFO] [ne.mi.cl.mo.ob.OBJModel/]: OBJLoader.Parser: command 's' (model: 'unixmod:models/block/fabricator.obj') is not currently supported, skipping. Line: 24 's off' are these even errors?
  17. actually nvm. I fixed it. My folder inside the assets folder was named sourcemod, not unixmod. -_-thanks for helping. It doesn't seem to register the model tho. Now I get this: [11:29:15] [Server-Worker-1/WARN] [minecraft/ModelBakery]: Unable to load model: 'unixmod:block/fabricator.obj' referenced from: unixmod:fabricator#: java.io.FileNotFoundException: unixmod:models/block/fabricator.obj.json [11:29:16] [Server-Worker-1/WARN] [minecraft/ModelBakery]: Unable to load model: 'unixmod:fabricator#inventory' referenced from: unixmod:fabricator#inventory: java.io.FileNotFoundException: unixmod:models/item/fabricator.json
  18. Is there anything wrong with my objLoader? Because I didn't get that part.
  19. I've been trying to do this for weeks but I can't seem to get it right. I get the black and purple texture every single time I load the game and the model isn't even loaded. [15:34:09] [Server-Worker-3/WARN] [minecraft/ModelBakery]: Exception loading blockstate definition: unixmod:blockstates/fabricator.json: java.io.FileNotFoundException: unixmod:blockstates/fabricator.json [15:34:09] [Server-Worker-3/WARN] [minecraft/ModelBakery]: Exception loading blockstate definition: 'unixmod:blockstates/fabricator.json' missing model for variant: 'unixmod:fabricator#' [15:34:10] [Server-Worker-3/WARN] [minecraft/ModelBakery]: Unable to load model: 'unixmod:fabricator#inventory' referenced from: unixmod:fabricator#inventory: java.io.FileNotFoundException: unixmod:models/item/fabricator.json Here's my blockstate: { "variants": { "": { "model": "unixmod:fabricator.obj" } } } obj: mtllib block.mtl o Cube v 8.000000 8.000000 -8.000000 v 8.000000 -8.000000 -8.000000 v 8.000000 8.000000 8.000000 v 8.000000 -8.000000 8.000000 v -8.000000 8.000000 -8.000000 v -8.000000 -8.000000 -8.000000 v -8.000000 8.000000 8.000000 v -8.000000 -8.000000 8.000000 l 6 8 l 2 6 l 1 2 l 8 7 l 3 4 l 5 6 l 3 7 l 1 3 l 8 4 l 7 5 l 5 1 l 4 2 o Cube.001 v 5.000000 5.000000 -5.000000 v 5.000000 -5.000000 -5.000000 v 5.000000 5.000000 5.000000 v 5.000000 -5.000000 5.000000 v -5.000000 5.000000 -5.000000 v -5.000000 -5.000000 -5.000000 v -5.000000 5.000000 5.000000 v -5.000000 -5.000000 5.000000 vt 0.286909 0.500000 vt 0.073817 0.286909 vt 0.286909 0.286909 vt 0.500000 0.286909 vt 0.500000 0.500000 vt 0.286909 0.713091 vt 0.713091 0.500000 vt 0.286909 0.926183 vt 0.500000 0.713091 vt 0.500000 0.926183 vt 0.500000 0.073817 vt 0.286909 0.073817 vt 0.073817 0.500000 vt 0.713091 0.286909 vn -1.0000 0.0000 0.0000 vn 0.0000 -1.0000 0.0000 vn 0.0000 0.0000 1.0000 vn 1.0000 0.0000 0.0000 vn 0.0000 1.0000 0.0000 vn 0.0000 0.0000 -1.0000 usemtl Material s off f 16/1/1 13/2/1 14/3/1 f 10/4/2 16/1/2 14/3/2 f 12/5/3 15/6/3 16/1/3 f 10/4/4 11/7/4 12/5/4 f 13/8/5 11/9/5 9/10/5 f 9/11/6 14/3/6 13/12/6 f 16/1/1 15/13/1 13/2/1 f 10/4/2 12/5/2 16/1/2 f 12/5/3 11/9/3 15/6/3 f 10/4/4 9/14/4 11/7/4 f 13/8/5 15/6/5 11/9/5 f 9/11/6 10/4/6 14/3/6 mtl: newmtl Material Ns 323.999994 Ka 1.000000 1.000000 1.000000 Kd 0.800000 0.000000 0.005390 Ks 0.500000 0.500000 0.500000 Ke 0.0 0.0 0.0 Ni 1.450000 d 1.000000 illum 2 Fabricator: package com.jun2040.unixmod.blocks; import net.minecraft.block.Block; import net.minecraft.block.BlockRenderType; import net.minecraft.block.BlockState; import net.minecraft.block.SoundType; import net.minecraft.block.material.Material; import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.shapes.ISelectionContext; import net.minecraft.util.math.shapes.VoxelShape; import net.minecraft.util.math.shapes.VoxelShapes; import net.minecraft.world.IBlockReader; public class Fabricator extends Block { public Fabricator() { super(Properties.create(Material.IRON) .sound(SoundType.METAL) .hardnessAndResistance(2.0f) ); setRegistryName("fabricator"); } @Override public BlockRenderType getRenderType(BlockState state) { return BlockRenderType.MODEL; } } ClientProxy: package com.jun2040.unixmod.setup; import com.jun2040.unixmod.UnixMod; import net.minecraft.client.Minecraft; import net.minecraft.entity.player.PlayerEntity; import net.minecraft.world.World; import net.minecraftforge.client.model.obj.OBJLoader; public class ClientProxy implements IProxy { static { OBJLoader.INSTANCE.addDomain(UnixMod.MODID); } @Override public void init() { } @Override public World getClientWorld() { return Minecraft.getInstance().world; } @Override public PlayerEntity getClientPlayer() { return Minecraft.getInstance().player; } } Main mod class: package com.jun2040.unixmod; import com.jun2040.unixmod.blocks.Fabricator; import com.jun2040.unixmod.blocks.ModBlocks; import com.jun2040.unixmod.setup.ClientProxy; import com.jun2040.unixmod.setup.IProxy; import com.jun2040.unixmod.setup.ModSetup; import com.jun2040.unixmod.setup.ServerProxy; import net.minecraft.block.Block; import net.minecraft.block.Blocks; import net.minecraft.client.renderer.model.IBakedModel; import net.minecraft.client.renderer.model.IUnbakedModel; import net.minecraft.client.renderer.model.ModelResourceLocation; import net.minecraft.client.renderer.vertex.DefaultVertexFormats; import net.minecraft.item.BlockItem; import net.minecraft.item.Item; import net.minecraft.util.ResourceLocation; import net.minecraftforge.client.event.ModelBakeEvent; import net.minecraftforge.client.event.ModelRegistryEvent; import net.minecraftforge.client.model.BasicState; import net.minecraftforge.client.model.ModelLoader; import net.minecraftforge.client.model.ModelLoaderRegistry; import net.minecraftforge.client.model.obj.OBJLoader; import net.minecraftforge.client.model.obj.OBJModel; import net.minecraftforge.common.MinecraftForge; import net.minecraftforge.event.RegistryEvent; import net.minecraftforge.eventbus.api.SubscribeEvent; import net.minecraftforge.fml.DistExecutor; import net.minecraftforge.fml.InterModComms; import net.minecraftforge.fml.common.Mod; import net.minecraftforge.fml.event.lifecycle.FMLClientSetupEvent; import net.minecraftforge.fml.event.lifecycle.FMLCommonSetupEvent; import net.minecraftforge.fml.event.lifecycle.InterModEnqueueEvent; import net.minecraftforge.fml.event.lifecycle.InterModProcessEvent; import net.minecraftforge.fml.event.server.FMLServerStartingEvent; import net.minecraftforge.fml.javafmlmod.FMLJavaModLoadingContext; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; import java.util.stream.Collectors; @Mod("unixmod") public class UnixMod { public static final String MODID = "sourcemod"; public static IProxy proxy = DistExecutor.runForDist(() -> () -> new ClientProxy(), () -> () -> new ServerProxy()); public static ModSetup setup = new ModSetup(); private static final Logger LOGGER = LogManager.getLogger(); public UnixMod() { FMLJavaModLoadingContext.get().getModEventBus().addListener(this::setup); FMLJavaModLoadingContext.get().getModEventBus().addListener(this::enqueueIMC); FMLJavaModLoadingContext.get().getModEventBus().addListener(this::processIMC); FMLJavaModLoadingContext.get().getModEventBus().addListener(this::doClientStuff); MinecraftForge.EVENT_BUS.register(this); } private void setup(final FMLCommonSetupEvent event) { } private void doClientStuff(final FMLClientSetupEvent event) { OBJLoader.INSTANCE.addDomain(UnixMod.MODID); } private void enqueueIMC(final InterModEnqueueEvent event) { } private void processIMC(final InterModProcessEvent event) { } @SubscribeEvent public void onServerStarting(FMLServerStartingEvent event) { } @Mod.EventBusSubscriber(bus = Mod.EventBusSubscriber.Bus.MOD) public static class RegistryEvents { @SubscribeEvent public static void onBlocksRegistry(final RegistryEvent.Register<Block> event) { event.getRegistry().register(new Fabricator()); } @SubscribeEvent public static void onItemsRegistry(final RegistryEvent.Register<Item> event) { event.getRegistry().register(new BlockItem(ModBlocks.FABRICATOR, new Item.Properties()).setRegistryName("fabricator")); } @SubscribeEvent public static void onModelBakeEvent(ModelBakeEvent event) { try { IUnbakedModel model = ModelLoaderRegistry.getModelOrMissing(new ResourceLocation("unixmod:fabricator.obj")); if (model instanceof OBJModel) { IBakedModel bakedModel = model.bake(event.getModelLoader(), ModelLoader.defaultTextureGetter(), new BasicState(model.getDefaultState(), false), DefaultVertexFormats.ITEM); event.getModelRegistry().put(new ModelResourceLocation("stick", "inventory"), bakedModel); } } catch (Exception e) { e.printStackTrace(); } } } }
  20. I'm getting these exceptions. I get the black and purple texture in the game. [15:34:09] [Server-Worker-3/WARN] [minecraft/ModelBakery]: Exception loading blockstate definition: unixmod:blockstates/fabricator.json: java.io.FileNotFoundException: unixmod:blockstates/fabricator.json [15:34:09] [Server-Worker-3/WARN] [minecraft/ModelBakery]: Exception loading blockstate definition: 'unixmod:blockstates/fabricator.json' missing model for variant: 'unixmod:fabricator#' [15:34:10] [Server-Worker-3/WARN] [minecraft/ModelBakery]: Unable to load model: 'unixmod:fabricator#inventory' referenced from: unixmod:fabricator#inventory: java.io.FileNotFoundException: unixmod:models/item/fabricator.json Here's my blockstates: { "variants": { "facing=north": { "model": "unixmod:fabricator.obj" }, "facing=south": { "model": "unixmod:fabricator.obj", "y": 180 }, "facing=west": { "model": "unixmod:fabricator.obj", "y": 270 }, "facing=east": { "model": "unixmod:fabricator.obj", "y": 90 }, "facing=up": { "model": "unixmod:fabricator.obj", "x": -90 }, "facing=down": { "model": "unixmod:fabricator.obj", "x": 90 }, } } obj: mtllib block.mtl o Cube v 8.000000 8.000000 -8.000000 v 8.000000 -8.000000 -8.000000 v 8.000000 8.000000 8.000000 v 8.000000 -8.000000 8.000000 v -8.000000 8.000000 -8.000000 v -8.000000 -8.000000 -8.000000 v -8.000000 8.000000 8.000000 v -8.000000 -8.000000 8.000000 l 6 8 l 2 6 l 1 2 l 8 7 l 3 4 l 5 6 l 3 7 l 1 3 l 8 4 l 7 5 l 5 1 l 4 2 o Cube.001 v 5.000000 5.000000 -5.000000 v 5.000000 -5.000000 -5.000000 v 5.000000 5.000000 5.000000 v 5.000000 -5.000000 5.000000 v -5.000000 5.000000 -5.000000 v -5.000000 -5.000000 -5.000000 v -5.000000 5.000000 5.000000 v -5.000000 -5.000000 5.000000 vt 0.286909 0.500000 vt 0.073817 0.286909 vt 0.286909 0.286909 vt 0.500000 0.286909 vt 0.500000 0.500000 vt 0.286909 0.713091 vt 0.713091 0.500000 vt 0.286909 0.926183 vt 0.500000 0.713091 vt 0.500000 0.926183 vt 0.500000 0.073817 vt 0.286909 0.073817 vt 0.073817 0.500000 vt 0.713091 0.286909 vn -1.0000 0.0000 0.0000 vn 0.0000 -1.0000 0.0000 vn 0.0000 0.0000 1.0000 vn 1.0000 0.0000 0.0000 vn 0.0000 1.0000 0.0000 vn 0.0000 0.0000 -1.0000 usemtl Material s off f 16/1/1 13/2/1 14/3/1 f 10/4/2 16/1/2 14/3/2 f 12/5/3 15/6/3 16/1/3 f 10/4/4 11/7/4 12/5/4 f 13/8/5 11/9/5 9/10/5 f 9/11/6 14/3/6 13/12/6 f 16/1/1 15/13/1 13/2/1 f 10/4/2 12/5/2 16/1/2 f 12/5/3 11/9/3 15/6/3 f 10/4/4 9/14/4 11/7/4 f 13/8/5 15/6/5 11/9/5 f 9/11/6 10/4/6 14/3/6 mtl: newmtl Material Ns 323.999994 Ka 1.000000 1.000000 1.000000 Kd 0.800000 0.000000 0.005390 Ks 0.500000 0.500000 0.500000 Ke 0.0 0.0 0.0 Ni 1.450000 d 1.000000 illum 2 Fabricator: package com.jun2040.unixmod.blocks; import net.minecraft.block.Block; import net.minecraft.block.BlockRenderType; import net.minecraft.block.BlockState; import net.minecraft.block.SoundType; import net.minecraft.block.material.Material; import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.shapes.ISelectionContext; import net.minecraft.util.math.shapes.VoxelShape; import net.minecraft.util.math.shapes.VoxelShapes; import net.minecraft.world.IBlockReader; public class Fabricator extends Block { public Fabricator() { super(Properties.create(Material.IRON) .sound(SoundType.METAL) .hardnessAndResistance(2.0f) ); setRegistryName("fabricator"); } @Override public BlockRenderType getRenderType(BlockState state) { return BlockRenderType.MODEL; } } ClientProxy: package com.jun2040.unixmod.setup; import com.jun2040.unixmod.UnixMod; import net.minecraft.client.Minecraft; import net.minecraft.entity.player.PlayerEntity; import net.minecraft.world.World; import net.minecraftforge.client.model.obj.OBJLoader; public class ClientProxy implements IProxy { static { OBJLoader.INSTANCE.addDomain(UnixMod.MODID); } @Override public void init() { } @Override public World getClientWorld() { return Minecraft.getInstance().world; } @Override public PlayerEntity getClientPlayer() { return Minecraft.getInstance().player; } } Main mod class: package com.jun2040.unixmod; import com.jun2040.unixmod.blocks.Fabricator; import com.jun2040.unixmod.blocks.ModBlocks; import com.jun2040.unixmod.setup.ClientProxy; import com.jun2040.unixmod.setup.IProxy; import com.jun2040.unixmod.setup.ModSetup; import com.jun2040.unixmod.setup.ServerProxy; import net.minecraft.block.Block; import net.minecraft.block.Blocks; import net.minecraft.client.renderer.model.IBakedModel; import net.minecraft.client.renderer.model.IUnbakedModel; import net.minecraft.client.renderer.model.ModelResourceLocation; import net.minecraft.client.renderer.vertex.DefaultVertexFormats; import net.minecraft.item.BlockItem; import net.minecraft.item.Item; import net.minecraft.util.ResourceLocation; import net.minecraftforge.client.event.ModelBakeEvent; import net.minecraftforge.client.event.ModelRegistryEvent; import net.minecraftforge.client.model.BasicState; import net.minecraftforge.client.model.ModelLoader; import net.minecraftforge.client.model.ModelLoaderRegistry; import net.minecraftforge.client.model.obj.OBJLoader; import net.minecraftforge.client.model.obj.OBJModel; import net.minecraftforge.common.MinecraftForge; import net.minecraftforge.event.RegistryEvent; import net.minecraftforge.eventbus.api.SubscribeEvent; import net.minecraftforge.fml.DistExecutor; import net.minecraftforge.fml.InterModComms; import net.minecraftforge.fml.common.Mod; import net.minecraftforge.fml.event.lifecycle.FMLClientSetupEvent; import net.minecraftforge.fml.event.lifecycle.FMLCommonSetupEvent; import net.minecraftforge.fml.event.lifecycle.InterModEnqueueEvent; import net.minecraftforge.fml.event.lifecycle.InterModProcessEvent; import net.minecraftforge.fml.event.server.FMLServerStartingEvent; import net.minecraftforge.fml.javafmlmod.FMLJavaModLoadingContext; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; import java.util.stream.Collectors; @Mod("unixmod") public class UnixMod { public static final String MODID = "sourcemod"; public static IProxy proxy = DistExecutor.runForDist(() -> () -> new ClientProxy(), () -> () -> new ServerProxy()); public static ModSetup setup = new ModSetup(); private static final Logger LOGGER = LogManager.getLogger(); public UnixMod() { FMLJavaModLoadingContext.get().getModEventBus().addListener(this::setup); FMLJavaModLoadingContext.get().getModEventBus().addListener(this::enqueueIMC); FMLJavaModLoadingContext.get().getModEventBus().addListener(this::processIMC); FMLJavaModLoadingContext.get().getModEventBus().addListener(this::doClientStuff); MinecraftForge.EVENT_BUS.register(this); } private void setup(final FMLCommonSetupEvent event) { } private void doClientStuff(final FMLClientSetupEvent event) { OBJLoader.INSTANCE.addDomain(UnixMod.MODID); } private void enqueueIMC(final InterModEnqueueEvent event) { } private void processIMC(final InterModProcessEvent event) { } @SubscribeEvent public void onServerStarting(FMLServerStartingEvent event) { } @Mod.EventBusSubscriber(bus = Mod.EventBusSubscriber.Bus.MOD) public static class RegistryEvents { @SubscribeEvent public static void onBlocksRegistry(final RegistryEvent.Register<Block> event) { event.getRegistry().register(new Fabricator()); } @SubscribeEvent public static void onItemsRegistry(final RegistryEvent.Register<Item> event) { event.getRegistry().register(new BlockItem(ModBlocks.FABRICATOR, new Item.Properties()).setRegistryName("fabricator")); } @SubscribeEvent public static void onModelBakeEvent(ModelBakeEvent event) { try { IUnbakedModel model = ModelLoaderRegistry.getModelOrMissing(new ResourceLocation("unixmod:fabricator.obj")); if (model instanceof OBJModel) { IBakedModel bakedModel = model.bake(event.getModelLoader(), ModelLoader.defaultTextureGetter(), new BasicState(model.getDefaultState(), false), DefaultVertexFormats.ITEM); event.getModelRegistry().put(new ModelResourceLocation("stick", "inventory"), bakedModel); } } catch (Exception e) { e.printStackTrace(); } } } }
  21. Can you please post the source code? Nvm. Sorry. I keep getting the error that you got: Any solutions?
×
×
  • Create New...

Important Information

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