Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 01/13/20 in Posts

  1. I know 1.15 is still quite new, but has anybody figured out how to use .obj files as models? Since 1.15 changed the whole rendering system solutions for 1.14 do not work. The main issue is that OBJLoader.INSTANCE.addDomain() no longer exists. Thanks in advance.
    1 point
  2. Hello ! I am currently working on a Forge mod that must display a fake block on client side ("fake" because only for visual). From picking up various render methods in previous versions, and somehow dive into 1.15 new rendering system, I've managed to display something succesfully on screen. I've got an unexpected side-effect: player's hand is disappearing (or probably just rendering far away ?). I've been struggling to understand why and would like to know if anybody could help me on that point. Some snippets MinecraftForge.EVENT_BUS.addListener(renderFake); // somewhere at client's init (FMLClientSetupEvent, Dist.CLIENT) private void renderFake(RenderWorldLastEvent event) { ActiveRenderInfo renderInfo = Minecraft.getInstance().gameRenderer.getActiveRenderInfo(); BlockPos pos = new Blockpos(0, 64, 0); // Just somewhere in the world matrixStack.func_227860_a_(); // push matrixStack.func_227861_a_(-renderInfo.getProjectedView().getX(), -renderInfo.getProjectedView().getY(), -renderInfo.getProjectedView().getZ()); // translate back to camera Matrix4f matrix4f = matrixStack.func_227866_c_().func_227870_a_(); // get final transformation matrix, handy to get yaw+pitch transformation RenderSystem.multMatrix(matrix4f); Minecraft.getInstance().getTextureManager().bindTexture(new ResourceLocation("textures/block/stone.png")); Tessellator.getInstance().getBuffer().begin(GL11.GL_QUADS, DefaultVertexFormats.POSITION_TEX); drawBlock(Tessellator.getInstance().getBuffer(), pos.x + 0.5, pos.y + 0.5, pos.z + 0.5, 0, 1, 0, 1, 0.5,0.5,0.5); Tessellator.getInstance().draw(); matrixStack.func_227861_a_(0, 0, 0); // reset translation matrixStack.func_227865_b_(); // pop } private static void drawBlock(final BufferBuilder bufferbuilder, final double x, final double y, final double z, final float minU, final float maxU, final float minV, final float maxV, final double x_size, final double y_size, final double z_size) { // UP bufferbuilder.func_225582_a_(-x_size + x, y_size + y, -z_size + z).func_225583_a_(maxU, maxV).endVertex(); bufferbuilder.func_225582_a_(-x_size + x, y_size + y, z_size + z).func_225583_a_(maxU, minV).endVertex(); bufferbuilder.func_225582_a_(x_size + x, y_size + y, z_size + z).func_225583_a_(minU, minV).endVertex(); bufferbuilder.func_225582_a_(x_size + x, y_size + y, -z_size + z).func_225583_a_(minU, maxV).endVertex(); // DOWN bufferbuilder.func_225582_a_(-x_size + x, -y_size + y, z_size + z).func_225583_a_(minU, minV).endVertex(); bufferbuilder.func_225582_a_(-x_size + x, -y_size + y, -z_size + z).func_225583_a_(minU, maxV).endVertex(); bufferbuilder.func_225582_a_(x_size + x, -y_size + y, -z_size + z).func_225583_a_(maxU, maxV).endVertex(); bufferbuilder.func_225582_a_(x_size + x, -y_size + y, z_size + z).func_225583_a_(maxU, minV).endVertex(); // LEFT bufferbuilder.func_225582_a_(x_size + x, -y_size + y, z_size + z).func_225583_a_(maxU, minV).endVertex(); bufferbuilder.func_225582_a_(x_size + x, -y_size + y, -z_size + z).func_225583_a_(maxU, maxV).endVertex(); bufferbuilder.func_225582_a_(x_size + x, y_size + y, -z_size + z).func_225583_a_(minU, maxV).endVertex(); bufferbuilder.func_225582_a_(x_size + x, y_size + y, z_size + z).func_225583_a_(minU, minV).endVertex(); // RIGHT bufferbuilder.func_225582_a_(-x_size + x, -y_size + y, -z_size + z).func_225583_a_(minU, maxV).endVertex(); bufferbuilder.func_225582_a_(-x_size + x, -y_size + y, z_size + z).func_225583_a_(minU, minV).endVertex(); bufferbuilder.func_225582_a_(-x_size + x, y_size + y, z_size + z).func_225583_a_(maxU, minV).endVertex(); bufferbuilder.func_225582_a_(-x_size + x, y_size + y, -z_size + z).func_225583_a_(maxU, maxV).endVertex(); // BACK bufferbuilder.func_225582_a_(-x_size + x, -y_size + y, -z_size + z).func_225583_a_(minU, maxV).endVertex(); bufferbuilder.func_225582_a_(-x_size + x, y_size + y, -z_size + z).func_225583_a_(minU, minV).endVertex(); bufferbuilder.func_225582_a_(x_size + x, y_size + y, -z_size + z).func_225583_a_(maxU, minV).endVertex(); bufferbuilder.func_225582_a_(x_size + x, -y_size + y, -z_size + z).func_225583_a_(maxU, maxV).endVertex(); // FRONT bufferbuilder.func_225582_a_(x_size + x, -y_size + y, z_size + z).func_225583_a_(maxU, minV).endVertex(); bufferbuilder.func_225582_a_(x_size + x, y_size + y, z_size + z).func_225583_a_(maxU, maxV).endVertex(); bufferbuilder.func_225582_a_(-x_size + x, y_size + y, z_size + z).func_225583_a_(minU, maxV).endVertex(); bufferbuilder.func_225582_a_(-x_size + x, -y_size + y, z_size + z).func_225583_a_(minU, minV).endVertex(); } Before rendering "fake" block After rendering "fake" block (player's hand disappear)
    1 point
  3. 1 point
  4. Can anyone help me convert this class to a class that uses World Saved Data cabability for 1.14.4? https://mcforge.readthedocs.io/en/1.14.x/datastorage/worldsaveddata/ package edivad.dimstorage.manager; import java.io.DataInputStream; import java.io.DataOutputStream; import java.io.File; import java.io.FileInputStream; import java.io.FileOutputStream; import java.util.ArrayList; import java.util.Collections; import java.util.HashMap; import java.util.LinkedList; import java.util.List; import java.util.Map; import com.google.common.collect.ImmutableMap; import edivad.dimstorage.api.AbstractDimStorage; import edivad.dimstorage.api.DimStoragePlugin; import edivad.dimstorage.api.Frequency; import net.minecraft.entity.player.PlayerEntity; import net.minecraft.nbt.CompoundNBT; import net.minecraft.nbt.CompressedStreamTools; import net.minecraft.server.MinecraftServer; import net.minecraft.world.dimension.DimensionType; import net.minecraftforge.event.entity.player.PlayerEvent; import net.minecraftforge.event.world.WorldEvent.Load; import net.minecraftforge.event.world.WorldEvent.Save; import net.minecraftforge.eventbus.api.SubscribeEvent; import net.minecraftforge.fml.LogicalSide; import net.minecraftforge.fml.LogicalSidedProvider; public class DimStorageManager { public static class DimStorageSaveHandler { @SubscribeEvent public void onWorldLoad(Load event) { if(event.getWorld().getWorld().isRemote) reloadManager(true); } @SubscribeEvent public void onWorldSave(Save event) { if(!event.getWorld().getWorld().isRemote && instance(false) != null) instance(false).save(false); } @SubscribeEvent public void onPlayerLogin(PlayerEvent.PlayerLoggedInEvent event) { instance(false).sendClientInfo(event.getPlayer()); } @SubscribeEvent public void onPlayerChangedDimension(PlayerEvent.PlayerChangedDimensionEvent event) { instance(false).sendClientInfo(event.getPlayer()); } } private static DimStorageManager serverManager; private static DimStorageManager clientManager; private static HashMap<String, DimStoragePlugin> plugins = new HashMap<>(); private Map<String, AbstractDimStorage> storageMap; private Map<String, List<AbstractDimStorage>> storageList; public final boolean client; private File saveDir; private File[] saveFiles; private int saveTo; private List<AbstractDimStorage> dirtyStorage; private CompoundNBT saveTag; public DimStorageManager(boolean client) { this.client = client; storageMap = Collections.synchronizedMap(new HashMap<String, AbstractDimStorage>()); storageList = Collections.synchronizedMap(new HashMap<String, List<AbstractDimStorage>>()); dirtyStorage = Collections.synchronizedList(new LinkedList<AbstractDimStorage>()); for(String key : plugins.keySet()) this.storageList.put(key, new ArrayList<AbstractDimStorage>()); if(!client) load(); } private void sendClientInfo(PlayerEntity player) { for(Map.Entry<String, DimStoragePlugin> plugin : plugins.entrySet()) { plugin.getValue().sendClientInfo(player, storageList.get(plugin.getKey())); } } private void load() { MinecraftServer server = LogicalSidedProvider.INSTANCE.get(LogicalSide.SERVER); this.saveDir = new File(server.getWorld(DimensionType.OVERWORLD).getSaveHandler().getWorldDirectory(), "DimStorage"); try { if(!this.saveDir.exists()) this.saveDir.mkdirs(); this.saveFiles = new File [] { new File(saveDir, "data1.dat"), new File(saveDir, "data2.dat"), new File(saveDir, "lock.dat") }; if(this.saveFiles[2].exists() && this.saveFiles[2].length() > 0) { FileInputStream fin = new FileInputStream(this.saveFiles[2]); this.saveTo = fin.read() ^ 1; fin.close(); if(this.saveFiles[this.saveTo ^ 1].exists()) { DataInputStream din = new DataInputStream(new FileInputStream(this.saveFiles[this.saveTo ^ 1])); this.saveTag = CompressedStreamTools.readCompressed(din); din.close(); } else saveTag = new CompoundNBT(); } else saveTag = new CompoundNBT(); } catch(Exception e) { throw new RuntimeException(String.format("DimStorage was unable to read it's data, please delete the 'DimStorage' folder Here: %s and start the server again.", saveDir), e); } } private void save(boolean force) { if(!this.dirtyStorage.isEmpty() || force) { for(AbstractDimStorage inv : this.dirtyStorage) { saveTag.put(inv.freq + ",type=" + inv.type(), inv.saveToTag()); inv.setClean(); } dirtyStorage.clear(); try { File saveFile = saveFiles[saveTo]; if(!saveFile.exists()) saveFile.createNewFile(); DataOutputStream dout = new DataOutputStream(new FileOutputStream(saveFile)); CompressedStreamTools.writeCompressed(saveTag, dout); dout.close(); FileOutputStream fout = new FileOutputStream(saveFiles[2]); fout.write(saveTo); fout.close(); saveTo ^= 1; } catch(Exception e) { throw new RuntimeException(e); } } } public static void reloadManager(boolean client) { DimStorageManager newManager = new DimStorageManager(client); if(client) clientManager = newManager; else serverManager = newManager; } public File getSaveDir() { return saveDir; } public static DimStorageManager instance(boolean client) { DimStorageManager manager = client ? clientManager : serverManager; if(manager == null) { reloadManager(client); manager = client ? clientManager : serverManager; } return manager; } public AbstractDimStorage getStorage(Frequency freq, String type) { String key = freq + ",type=" + type; AbstractDimStorage storage = storageMap.get(key); if(storage == null) { storage = plugins.get(type).createDimStorage(this, freq); if(!client && saveTag.contains(key)) storage.loadFromTag(saveTag.getCompound(key)); storageMap.put(key, storage); storageList.get(type).add(storage); } return storage; } public static void registerPlugin(DimStoragePlugin plugin) { plugins.put(plugin.identifer(), plugin); if(serverManager != null) serverManager.storageList.put(plugin.identifer(), new ArrayList<AbstractDimStorage>()); if(clientManager != null) clientManager.storageList.put(plugin.identifer(), new ArrayList<AbstractDimStorage>()); } public static DimStoragePlugin getPlugin(String identifier) { return plugins.get(identifier); } public static Map<String, DimStoragePlugin> getPlugins() { return ImmutableMap.copyOf(plugins); } public void requestSave(AbstractDimStorage storage) { dirtyStorage.add(storage); } }
    1 point
  5. I found out why it was on top of everything else. There is 2 different RenderTypeBuffer.Impl available in client, one is for displaying stuff as part of GUI (in top of world rendering), the other is for world rendering. Thanks to everyone working with me on this ! Here is a working snippet for anyone struggling with same issue as me (needless to say, it's physical client-side code only) public void render(RenderWorldLastEvent event) { Vec3d location; // some location in world BlockState state; // some BlockState (does not have to be part of world) renderBlock(event.getMatrixStack(), location, state); } public static void renderBlock(MatrixStack matrixStack, Vec3d pos, BlockState state) { BlockRendererDispatcher renderer = Minecraft.getInstance().getBlockRendererDispatcher(); ClientWorld world = Minecraft.getInstance().world; IModelData model = renderer.getModelForState(state).getModelData(world, new BlockPos(pos), state, ModelDataManager.getModelData(world, new BlockPos(pos))); ActiveRenderInfo renderInfo = Minecraft.getInstance().gameRenderer.getActiveRenderInfo(); matrixStack.func_227860_a_(); // push matrixStack.func_227861_a_(-renderInfo.getProjectedView().getX() + pos.x, -renderInfo.getProjectedView().getY() + pos.y, -renderInfo.getProjectedView().getZ() + pos.z); // translate back to camera // Overlay texture = custom RGBA on top of texture, 0 -> red //func_228487_b_ -> display over everything else //func_228489_c_ -> display as part of chunk rendering Minecraft.getInstance().getBlockRendererDispatcher().renderBlock(state, matrixStack, Minecraft.getInstance().func_228019_au_().func_228489_c_(), 15728880, OverlayTexture.field_229196_a_, model); matrixStack.func_227865_b_(); // pop }
    1 point
  6. Okay ive been trying for a while and havent been able to figure it out. When i reference the obj file from the blockstate i get an error where its adding ".json" to the end on its own. [00:19:43] [Server-Worker-6/WARN] [minecraft/ModelBakery]: Unable to load model: 'brassnsteam:block/obj/pipe_core_valve.obj' referenced from: brassnsteam:iron_pipe#center=true,down=true,east=true,north=true,south=true,up=true,waterlogged=true,west=true: java.io.FileNotFoundException: brassnsteam:models/block/obj/pipe_core_valve.obj.json Is there nothing i need to do in the code? Messing with the blockstate only seems to not be enough.
    1 point
  7. That's literally a loot table. Vanilla loot tables handle the first two already, the third is similar to the second. (Or you can wait for this PR, which would simplify things)
    1 point
  8. Logfile: https://paste.gg/p/anonymous/01608a8d605c4401a98a51a4d833570e Pics of Vanilla and Forge (without any other mods) added
    1 point
  9. You don't need to do that call anymore, it just works™️ if you reference the model from your blockstate json
    1 point
  10. Can you please stop making your posts entirely unreadable? Thanks.
    1 point
  11. Update Regarding LTS System: Please read The Big Forge Update Earlier this year, 1.13 was announced and the snapshots started coming out, the update was relatively small, but enough to be a hurdle for mod developers. This combined with 1.12 stabilizing, and a few fundamental Java changes that broke modding in general, made the Forge team decide to use this opportunity and work on cleaning the years of technical debt that Forge had accrued. During this time, it was discovered that a lot of things needed updating. In fact, well, everything did. And so, it was done, a full rewrite of practically everything Forge related. This took a long time, longer than originally anticipated. But what’s the outcome of this you might ask? A lot. cpw’s mod launching system (ModLauncher) allows for parallel mod loading and support for more modern Java versions. (Considering the original was written to target Java 6). The Forge installer now runs tasks at install time once, rather than doing it every time you run the game. These alone provide dramatic reduction in launch times. ForgeGradle, the “devkit” for creating mods, has been rewritten and is faster at, well, everything. It also integrates much better with IDEs. What does that mean, you ask? Simple. Mods are nicer to make. (Also 100% less setupDecompWorkspace.) MCPConfig allows for much easier MCP updates, and is public source too, so people can see exactly what's going on between updates. In short: There was a lot of work to do. And now that it's done, future updates will be much, much smoother. 1.14 and 1.15 The 1.14 release came around, just in time for the rewrite to be finished, so it was time to get the ball rolling again. The bulk of the restructure work was done through 1.13's life, so all that remained was actually seeing how it was to update all of it, and it went pretty well. A lot of improved systems exist now that make developing for these modern versions far easier and just better in general. The 1.15 release was relatively simple, even if Mojang decided to restructure everything and make changes to how the rendering works. (Taking some of our systems in the process, don't worry, this is a good thing.) 1.15's rendering changes were mostly a refactor, and we expect 1.16 to be a large update to rendering. This plus 1.14 seeing growth is why we chose 1.14 to be a candidate for LTS. (More on that further down.) Hopefully this kind of restructure from them is a rare thing in the future, but we welcome the change, since it often brings improvement. Although the rendering changes may pose a tough hurdle for some, the update for most should be relatively straight-forward. Forge support and LTS Forge's support for Minecraft versions will try to follow a predictable cycle, assuming Mojang also follows a predictable cycle. We will always actively target the latest Minecraft version, as ever. We will now also deem a previous major Minecraft version as "LTS" (Long Term Support). The LTS version will receive support for modders and players alike, however all new features must target the latest version first, and then may be backported. An LTS version differs slightly from the latest version, in that any new features you may want to add to it, must target the latest version, only once it has been merged in, can it be backported. (The exception to this is if the feature is non-applicable to the latest version.) The Forge Team will also mostly be focusing on the latest. This is so the community has time to stabilize a bit and gives modpack developers some time to create something special. But still have Forge running full steam ahead. Late last year (Happy 2020!) a vote was held privately with many developers of various Minecraft projects to determine which version will be LTS: Should 1.12 remain LTS or should 1.14? A vast majority chose 1.14, and so, from now on we are dropping 1.12 from support, and 1.14 is now LTS. What does this mean? 1.15 is latest. It will get full support. 1.14 is LTS. It will also get support, and new features, but new features must be made for 1.15 first. 1.12 is no longer supported on this forum, no new features, and no more bugfixes. All other versions are not supported. This means if you come to us for help with those, we will ask you to update. This includes crashes/bugs. To keep with Mojang's history of releases, we expect 1.14 to stay LTS for 12-18 months, giving plenty of time for modders and pack developers alike. However, this may change depending on what surprises Mojang has in store for us. Finally… Thank you. Thank you to all the modders/developers, all the players, and especially to all the contributors. The Minecraft modding community would not be what it is without you. You are responsible for the striving ecosystem we have today. We hope this new year brings you all you desire, and we look forward to seeing what you create. And now time for some shameless plugging, if you like Forge, please consider supporting us. http://www.patreon.com/lexmanos - The Forge Team.
    1 point
  12. com.mojang.authlib.GameProfile@1a42d08[id=<null>,name=imperatorsergio,properties={},legacy=false] (/25.70.58.120:58924) lost connection: Disconnected when my friend tries to connect with me this error shows up and he display invalid session, ho to riddle ith that
    0 points
×
×
  • Create New...

Important Information

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