-
Posts
15 -
Joined
-
Last visited
Recent Profile Visitors
5263 profile views
TurtyWurty's Achievements
Tree Puncher (2/8)
0
Reputation
-
[1.20.1] Get list of all the recipes
TurtyWurty replied to sillypantscoder's topic in Modder Support
Yes because you told it to get all of the crafting recipes: Since you seem confused about the crafting part, I'm assuming that you actually wanted to get all recipes for all recipe types? Including furnaces, smokers, etc? In which case you can just use the following: Collection<RecipeHolder<?>> recipes = world.getRecipeManager().getRecipes(); Well an ingredient just defines a list of items that could be valid for that entry. Consider for example the recipe for a chest. It uses the wooden planks tag which defines all of the wooden planks that can be used for each of those slots. Which is why there is several thousand(+) combinations that can be used to make a chest. So that `Ingredient` is what holds that information. -
Get furnace block given FurnaceFuelBurnTimeEvent?
TurtyWurty replied to PortsNotAlt's topic in Modder Support
This would not be possible with the event as that event is not sensitive to any specific position. This is primarily because places such as AbstractFurnaceMenu#isFuel doesn't have access to that. Your best bet therefore would be to write 3 mixins, all into AbstractFurnaceBlockEntity that target the 3 usages of ForgeHooks.getBurnTime (that's the method that fires the event). This would give you access to the BlockEntity (self). AbstractFurnaceBlockEntity#getBurnDuration(ItemStack) AbstractFurnaceBlockEntity#isFuel(ItemStack) AbstractFurnaceBlockEntity#canPlaceItem(int, ItemStack) Just note that there are a few problems with this approach, primarily that AbstractFurnaceMenu#isFuel would disregard your changes. But you also have to consider that any mods which utilise ForgeHooks.getBurnTime (and therefore fire the FurnaceFuelBurnTimeEvent), would also not be subject to your changes. -
Ok I have a small update regarding this question, but now actually with more questions. So I have managed to draw the texture. The issue was that I used bufferbuilder.begin(7, DefaultVertexFormats.POSITION); instead of bufferbuilder.begin(7, DefaultVertexFormats.POSITION_TEX); So it was basically ignoring the texture positions. It now looks like the attached image. The issue is that the texture is following the player. So basically I can only ever see that portion of the texture unless it goes behind some terrain or something. Here is my updated code: package com.turtywurty.examplemod.client; import com.mojang.blaze3d.matrix.MatrixStack; import com.mojang.blaze3d.platform.GlStateManager; import com.mojang.blaze3d.systems.RenderSystem; import com.turtywurty.examplemod.ExampleMod; import net.minecraft.client.Minecraft; import net.minecraft.client.renderer.BufferBuilder; import net.minecraft.client.renderer.FogRenderer; import net.minecraft.client.renderer.Tessellator; import net.minecraft.client.renderer.WorldVertexBufferUploader; import net.minecraft.client.renderer.vertex.DefaultVertexFormats; import net.minecraft.client.renderer.vertex.VertexBuffer; import net.minecraft.client.world.ClientWorld; import net.minecraft.client.world.DimensionRenderInfo; import net.minecraft.client.world.DimensionRenderInfo.FogType; import net.minecraft.util.ResourceLocation; import net.minecraft.util.math.MathHelper; import net.minecraft.util.math.vector.Matrix4f; import net.minecraft.util.math.vector.Vector3d; import net.minecraft.util.math.vector.Vector3f; import net.minecraftforge.api.distmarker.Dist; import net.minecraftforge.client.ISkyRenderHandler; import net.minecraftforge.eventbus.api.EventPriority; import net.minecraftforge.eventbus.api.SubscribeEvent; import net.minecraftforge.fml.common.Mod; import net.minecraftforge.fml.common.Mod.EventBusSubscriber.Bus; import net.minecraftforge.fml.event.lifecycle.FMLClientSetupEvent; @Mod.EventBusSubscriber(modid = ExampleMod.MOD_ID, bus = Bus.MOD, value = Dist.CLIENT) public class ClientEventBus { private static final ResourceLocation DIM_RENDER_INFO = new ResourceLocation(ExampleMod.MOD_ID, "example_dim"); private static final ResourceLocation SUN_TEXTURES = new ResourceLocation("textures/environment/sun.png"); private static final ResourceLocation MOON_PHASES_TEXTURES = new ResourceLocation( "textures/environment/moon_phases.png"); private static final ResourceLocation SKY_TEXTURE = new ResourceLocation(ExampleMod.MOD_ID, "textures/environment/sky.png"); @SubscribeEvent(priority = EventPriority.HIGHEST) public static void clientSetup(FMLClientSetupEvent event) { // public net.minecraft.client.world.DimensionRenderInfo field_239208_a_ # // field_239208_a_ // public net.minecraft.client.renderer.Minecraft.getInstance().worldRenderer // field_175012_t # skyVBO // public net.minecraft.client.renderer.Minecraft.getInstance().worldRenderer // field_175014_r # skyVertexFormat // public net.minecraft.client.renderer.Minecraft.getInstance().worldRenderer // field_175013_s # starVBO // public net.minecraft.client.renderer.Minecraft.getInstance().worldRenderer // field_175011_u # sky2VBO DimensionRenderInfo.field_239208_a_.put(DIM_RENDER_INFO, // cloudHeight, alternate sky color, fog type, render sky, diffuse lighting new DimensionRenderInfo(128, true, FogType.NORMAL, true, false) { @Override // adjustSkyColor public Vector3d func_230494_a_(Vector3d fogColor, float partialTicks) { return fogColor; } @Override // useThickFog public boolean func_230493_a_(int posX, int posY) { return false; } @Override public ISkyRenderHandler getSkyRenderHandler() { return new ISkyRenderHandler() { @SuppressWarnings({ "resource", "deprecation" }) @Override public void render(int ticks, float partialTicks, MatrixStack matrixStack, ClientWorld world, Minecraft mc) { RenderSystem.disableTexture(); Vector3d vector3d = world.getSkyColor( Minecraft.getInstance().gameRenderer.getActiveRenderInfo().getBlockPos(), partialTicks); float f = (float) vector3d.x; float f1 = (float) vector3d.y; float f2 = (float) vector3d.z; FogRenderer.applyFog(); BufferBuilder bufferbuilder = Tessellator.getInstance().getBuffer(); RenderSystem.depthMask(false); RenderSystem.enableFog(); RenderSystem.color3f(f, f1, f2); Minecraft.getInstance().worldRenderer.skyVBO.bindBuffer(); Minecraft.getInstance().worldRenderer.skyVertexFormat.setupBufferState(0L); Minecraft.getInstance().worldRenderer.skyVBO.draw(matrixStack.getLast().getMatrix(), 7); VertexBuffer.unbindBuffer(); Minecraft.getInstance().worldRenderer.skyVertexFormat.clearBufferState(); RenderSystem.disableFog(); RenderSystem.disableAlphaTest(); RenderSystem.enableBlend(); RenderSystem.defaultBlendFunc(); float[] afloat = world.func_239132_a_() .func_230492_a_(world.func_242415_f(partialTicks), partialTicks); if (afloat != null) { RenderSystem.disableTexture(); RenderSystem.shadeModel(7425); matrixStack.push(); matrixStack.rotate(Vector3f.XP.rotationDegrees(90.0F)); float f3 = MathHelper.sin(world.getCelestialAngleRadians(partialTicks)) < 0.0F ? 180.0F : 0.0F; matrixStack.rotate(Vector3f.ZP.rotationDegrees(f3)); matrixStack.rotate(Vector3f.ZP.rotationDegrees(90.0F)); float f4 = afloat[0]; float f5 = afloat[1]; float f6 = afloat[2]; Matrix4f matrix4f = matrixStack.getLast().getMatrix(); bufferbuilder.begin(6, DefaultVertexFormats.POSITION_COLOR); bufferbuilder.pos(matrix4f, 0.0F, 100.0F, 0.0F).color(f4, f5, f6, afloat[3]) .endVertex(); for (int j = 0; j <= 16; ++j) { float f7 = (float) j * ((float) Math.PI * 2F) / 16.0F; float f8 = MathHelper.sin(f7); float f9 = MathHelper.cos(f7); bufferbuilder.pos(matrix4f, f8 * 120.0F, f9 * 120.0F, -f9 * 40.0F * afloat[3]) .color(afloat[0], afloat[1], afloat[2], 0.0F).endVertex(); } bufferbuilder.finishDrawing(); WorldVertexBufferUploader.draw(bufferbuilder); matrixStack.pop(); RenderSystem.shadeModel(7424); } RenderSystem.enableTexture(); RenderSystem.blendFuncSeparate(GlStateManager.SourceFactor.SRC_ALPHA, GlStateManager.DestFactor.ONE, GlStateManager.SourceFactor.ONE, GlStateManager.DestFactor.ZERO); matrixStack.push(); float f11 = 1.0F - world.getRainStrength(partialTicks); RenderSystem.color4f(1.0F, 1.0F, 1.0F, f11); matrixStack.rotate(Vector3f.YP.rotationDegrees(-90.0F)); matrixStack.rotate( Vector3f.XP.rotationDegrees(world.func_242415_f(partialTicks) * 360.0F)); Matrix4f matrix4f1 = matrixStack.getLast().getMatrix(); float f12 = 30.0F; Minecraft.getInstance().getTextureManager().bindTexture(SUN_TEXTURES); bufferbuilder.begin(7, DefaultVertexFormats.POSITION_TEX); bufferbuilder.pos(matrix4f1, -f12, 100.0F, -f12).tex(0.0F, 0.0F).endVertex(); bufferbuilder.pos(matrix4f1, f12, 100.0F, -f12).tex(1.0F, 0.0F).endVertex(); bufferbuilder.pos(matrix4f1, f12, 100.0F, f12).tex(1.0F, 1.0F).endVertex(); bufferbuilder.pos(matrix4f1, -f12, 100.0F, f12).tex(0.0F, 1.0F).endVertex(); bufferbuilder.finishDrawing(); WorldVertexBufferUploader.draw(bufferbuilder); f12 = 20.0F; Minecraft.getInstance().getTextureManager().bindTexture(MOON_PHASES_TEXTURES); int k = world.getMoonPhase(); int l = k % 4; int i1 = k / 4 % 2; float f13 = (float) (l + 0) / 4.0F; float f14 = (float) (i1 + 0) / 2.0F; float f15 = (float) (l + 1) / 4.0F; float f16 = (float) (i1 + 1) / 2.0F; bufferbuilder.begin(7, DefaultVertexFormats.POSITION_TEX); bufferbuilder.pos(matrix4f1, -f12, -100.0F, f12).tex(f15, f16).endVertex(); bufferbuilder.pos(matrix4f1, f12, -100.0F, f12).tex(f13, f16).endVertex(); bufferbuilder.pos(matrix4f1, f12, -100.0F, -f12).tex(f13, f14).endVertex(); bufferbuilder.pos(matrix4f1, -f12, -100.0F, -f12).tex(f15, f14).endVertex(); bufferbuilder.finishDrawing(); WorldVertexBufferUploader.draw(bufferbuilder); RenderSystem.disableTexture(); float f10 = world.getStarBrightness(partialTicks) * f11; if (f10 > 0.0F) { RenderSystem.color4f(f10, f10, f10, f10); Minecraft.getInstance().worldRenderer.starVBO.bindBuffer(); Minecraft.getInstance().worldRenderer.skyVertexFormat.setupBufferState(0L); Minecraft.getInstance().worldRenderer.starVBO .draw(matrixStack.getLast().getMatrix(), 7); VertexBuffer.unbindBuffer(); Minecraft.getInstance().worldRenderer.skyVertexFormat.clearBufferState(); } RenderSystem.color4f(1.0F, 1.0F, 1.0F, 1.0F); RenderSystem.disableBlend(); RenderSystem.enableAlphaTest(); RenderSystem.enableFog(); matrixStack.pop(); RenderSystem.disableTexture(); RenderSystem.color3f(0.0F, 0.0F, 0.0F); double d0 = Minecraft.getInstance().player.getEyePosition(partialTicks).y - world.getWorldInfo().getVoidFogHeight(); if (d0 < 0.0D) { matrixStack.push(); matrixStack.translate(0.0D, 12.0D, 0.0D); Minecraft.getInstance().worldRenderer.sky2VBO.bindBuffer(); Minecraft.getInstance().worldRenderer.skyVertexFormat.setupBufferState(0L); Minecraft.getInstance().worldRenderer.sky2VBO .draw(matrixStack.getLast().getMatrix(), 7); VertexBuffer.unbindBuffer(); Minecraft.getInstance().worldRenderer.skyVertexFormat.clearBufferState(); matrixStack.pop(); } if (world.func_239132_a_().func_239216_b_()) { RenderSystem.color3f(f * 0.2F + 0.04F, f1 * 0.2F + 0.04F, f2 * 0.6F + 0.1F); } else { RenderSystem.color3f(f, f1, f2); } Minecraft.getInstance().worldRenderer.skyVBO.bindBuffer(); Minecraft.getInstance().worldRenderer.skyVertexFormat.setupBufferState(0L); Minecraft.getInstance().worldRenderer.skyVBO.draw(matrixStack.getLast().getMatrix(), 7); VertexBuffer.unbindBuffer(); Minecraft.getInstance().worldRenderer.skyVertexFormat.clearBufferState(); RenderSystem.enableTexture(); RenderSystem.blendFuncSeparate(GlStateManager.SourceFactor.SRC_ALPHA, GlStateManager.DestFactor.ONE, GlStateManager.SourceFactor.ONE, GlStateManager.DestFactor.ZERO); RenderSystem.color4f(0.8F, 0.8F, 0.8F, 0.2F); Minecraft.getInstance().getTextureManager().bindTexture(SKY_TEXTURE); bufferbuilder.begin(7, DefaultVertexFormats.POSITION_TEX); bufferbuilder.pos(64, 16, 64).tex(0.0F, 0.0F).endVertex(); bufferbuilder.pos(-64, 16, 64).tex(1.0F, 0.0F).endVertex(); bufferbuilder.pos(-64, 16, -64).tex(1.0F, 1.0F).endVertex(); bufferbuilder.pos(64, 16, -64).tex(0.0F, 1.0F).endVertex(); bufferbuilder.finishDrawing(); WorldVertexBufferUploader.draw(bufferbuilder); RenderSystem.disableTexture(); RenderSystem.enableTexture(); RenderSystem.depthMask(true); RenderSystem.disableFog(); } }; } }); } } Any help with this would be highly appreciated. Because I cannot for the life of me figure this one out.
-
Hello people of the forge forums. Recently I came up with the idea of having the sky in my dimension be a custom texture instead of a solid color. Sadly it appears that this sounds much easier than it is. I have got to the point of having everything reconstructed, however I cannot for the life of me figure out how to draw a texture in place of where the solid color would be. Here is what I have so far: package com.turtywurty.examplemod.client; import com.mojang.blaze3d.matrix.MatrixStack; import com.mojang.blaze3d.platform.GlStateManager; import com.mojang.blaze3d.systems.RenderSystem; import com.turtywurty.examplemod.ExampleMod; import net.minecraft.client.Minecraft; import net.minecraft.client.renderer.BufferBuilder; import net.minecraft.client.renderer.FogRenderer; import net.minecraft.client.renderer.Tessellator; import net.minecraft.client.renderer.WorldVertexBufferUploader; import net.minecraft.client.renderer.vertex.DefaultVertexFormats; import net.minecraft.client.renderer.vertex.VertexBuffer; import net.minecraft.client.world.ClientWorld; import net.minecraft.client.world.DimensionRenderInfo; import net.minecraft.client.world.DimensionRenderInfo.FogType; import net.minecraft.util.ResourceLocation; import net.minecraft.util.math.MathHelper; import net.minecraft.util.math.vector.Matrix4f; import net.minecraft.util.math.vector.Vector3d; import net.minecraft.util.math.vector.Vector3f; import net.minecraftforge.api.distmarker.Dist; import net.minecraftforge.client.ISkyRenderHandler; import net.minecraftforge.eventbus.api.EventPriority; import net.minecraftforge.eventbus.api.SubscribeEvent; import net.minecraftforge.fml.common.Mod; import net.minecraftforge.fml.common.Mod.EventBusSubscriber.Bus; import net.minecraftforge.fml.event.lifecycle.FMLClientSetupEvent; @Mod.EventBusSubscriber(modid = ExampleMod.MOD_ID, bus = Bus.MOD, value = Dist.CLIENT) public class ClientEventBus { private static final ResourceLocation DIM_RENDER_INFO = new ResourceLocation(ExampleMod.MOD_ID, "example_dim"); private static final ResourceLocation SUN_TEXTURES = new ResourceLocation("textures/environment/sun.png"); private static final ResourceLocation MOON_PHASES_TEXTURES = new ResourceLocation( "textures/environment/moon_phases.png"); private static final ResourceLocation SKY_TEXTURE = new ResourceLocation(ExampleMod.MOD_ID, "textures/environment/sky.png"); @SubscribeEvent(priority = EventPriority.HIGHEST) public static void clientSetup(FMLClientSetupEvent event) { // public net.minecraft.client.world.DimensionRenderInfo field_239208_a_ # // field_239208_a_ // public net.minecraft.client.renderer.Minecraft.getInstance().worldRenderer // field_175012_t # skyVBO // public net.minecraft.client.renderer.Minecraft.getInstance().worldRenderer // field_175014_r # skyVertexFormat // public net.minecraft.client.renderer.Minecraft.getInstance().worldRenderer // field_175013_s # starVBO // public net.minecraft.client.renderer.Minecraft.getInstance().worldRenderer // field_175011_u # sky2VBO DimensionRenderInfo.field_239208_a_.put(DIM_RENDER_INFO, // cloudHeight, alternate sky color, fog type, render sky, diffuse lighting new DimensionRenderInfo(128, true, FogType.NORMAL, true, false) { @Override // adjustSkyColor public Vector3d func_230494_a_(Vector3d fogColor, float partialTicks) { return fogColor; } @Override // useThickFog public boolean func_230493_a_(int posX, int posY) { return false; } @Override public ISkyRenderHandler getSkyRenderHandler() { return new ISkyRenderHandler() { @SuppressWarnings({ "resource", "deprecation" }) @Override public void render(int ticks, float partialTicks, MatrixStack matrixStack, ClientWorld world, Minecraft mc) { RenderSystem.disableTexture(); Vector3d vector3d = world.getSkyColor( Minecraft.getInstance().gameRenderer.getActiveRenderInfo().getBlockPos(), partialTicks); float f = (float) vector3d.x; float f1 = (float) vector3d.y; float f2 = (float) vector3d.z; FogRenderer.applyFog(); BufferBuilder bufferbuilder = Tessellator.getInstance().getBuffer(); RenderSystem.depthMask(false); RenderSystem.enableFog(); RenderSystem.color3f(f, f1, f2); RenderSystem.enableTexture(); RenderSystem.blendFuncSeparate(GlStateManager.SourceFactor.SRC_ALPHA, GlStateManager.DestFactor.ONE, GlStateManager.SourceFactor.ONE, GlStateManager.DestFactor.ZERO); RenderSystem.color4f(0.8F, 0.8F, 0.8F, 0.2F); Minecraft.getInstance().getTextureManager().bindTexture(SKY_TEXTURE); bufferbuilder.begin(7, DefaultVertexFormats.POSITION); for (int k = -384; k <= 384; k += 64) { for (int l = -384; l <= 384; l += 64) { float h = (float) k; float h1 = (float) (k + 64); bufferbuilder.pos((double) h, (double) 16, (double) l).tex(0.0F, 0.0F).endVertex(); bufferbuilder.pos((double) h1, (double) 16, (double) l).tex(1.0F, 0.0F).endVertex(); bufferbuilder.pos((double) h1, (double) 16, (double) (l + 64)).tex(1.0F, 1.0F).endVertex(); bufferbuilder.pos((double) h, (double) 16, (double) (l + 64)).tex(0.0F, 1.0F).endVertex(); } } bufferbuilder.finishDrawing(); WorldVertexBufferUploader.draw(bufferbuilder); RenderSystem.disableTexture(); Minecraft.getInstance().worldRenderer.skyVBO.bindBuffer(); Minecraft.getInstance().worldRenderer.skyVertexFormat.setupBufferState(0L); Minecraft.getInstance().worldRenderer.skyVBO.draw(matrixStack.getLast().getMatrix(), 7); VertexBuffer.unbindBuffer(); Minecraft.getInstance().worldRenderer.skyVertexFormat.clearBufferState(); RenderSystem.disableFog(); RenderSystem.disableAlphaTest(); RenderSystem.enableBlend(); RenderSystem.defaultBlendFunc(); float[] afloat = world.func_239132_a_() .func_230492_a_(world.func_242415_f(partialTicks), partialTicks); if (afloat != null) { RenderSystem.disableTexture(); RenderSystem.shadeModel(7425); matrixStack.push(); matrixStack.rotate(Vector3f.XP.rotationDegrees(90.0F)); float f3 = MathHelper.sin(world.getCelestialAngleRadians(partialTicks)) < 0.0F ? 180.0F : 0.0F; matrixStack.rotate(Vector3f.ZP.rotationDegrees(f3)); matrixStack.rotate(Vector3f.ZP.rotationDegrees(90.0F)); float f4 = afloat[0]; float f5 = afloat[1]; float f6 = afloat[2]; Matrix4f matrix4f = matrixStack.getLast().getMatrix(); bufferbuilder.begin(6, DefaultVertexFormats.POSITION_COLOR); bufferbuilder.pos(matrix4f, 0.0F, 100.0F, 0.0F).color(f4, f5, f6, afloat[3]) .endVertex(); for (int j = 0; j <= 16; ++j) { float f7 = (float) j * ((float) Math.PI * 2F) / 16.0F; float f8 = MathHelper.sin(f7); float f9 = MathHelper.cos(f7); bufferbuilder.pos(matrix4f, f8 * 120.0F, f9 * 120.0F, -f9 * 40.0F * afloat[3]) .color(afloat[0], afloat[1], afloat[2], 0.0F).endVertex(); } bufferbuilder.finishDrawing(); WorldVertexBufferUploader.draw(bufferbuilder); matrixStack.pop(); RenderSystem.shadeModel(7424); } RenderSystem.enableTexture(); RenderSystem.blendFuncSeparate(GlStateManager.SourceFactor.SRC_ALPHA, GlStateManager.DestFactor.ONE, GlStateManager.SourceFactor.ONE, GlStateManager.DestFactor.ZERO); matrixStack.push(); float f11 = 1.0F - world.getRainStrength(partialTicks); RenderSystem.color4f(1.0F, 1.0F, 1.0F, f11); matrixStack.rotate(Vector3f.YP.rotationDegrees(-90.0F)); matrixStack.rotate( Vector3f.XP.rotationDegrees(world.func_242415_f(partialTicks) * 360.0F)); Matrix4f matrix4f1 = matrixStack.getLast().getMatrix(); float f12 = 30.0F; Minecraft.getInstance().getTextureManager().bindTexture(SUN_TEXTURES); bufferbuilder.begin(7, DefaultVertexFormats.POSITION_TEX); bufferbuilder.pos(matrix4f1, -f12, 100.0F, -f12).tex(0.0F, 0.0F).endVertex(); bufferbuilder.pos(matrix4f1, f12, 100.0F, -f12).tex(1.0F, 0.0F).endVertex(); bufferbuilder.pos(matrix4f1, f12, 100.0F, f12).tex(1.0F, 1.0F).endVertex(); bufferbuilder.pos(matrix4f1, -f12, 100.0F, f12).tex(0.0F, 1.0F).endVertex(); bufferbuilder.finishDrawing(); WorldVertexBufferUploader.draw(bufferbuilder); f12 = 20.0F; Minecraft.getInstance().getTextureManager().bindTexture(MOON_PHASES_TEXTURES); int k = world.getMoonPhase(); int l = k % 4; int i1 = k / 4 % 2; float f13 = (float) (l + 0) / 4.0F; float f14 = (float) (i1 + 0) / 2.0F; float f15 = (float) (l + 1) / 4.0F; float f16 = (float) (i1 + 1) / 2.0F; bufferbuilder.begin(7, DefaultVertexFormats.POSITION_TEX); bufferbuilder.pos(matrix4f1, -f12, -100.0F, f12).tex(f15, f16).endVertex(); bufferbuilder.pos(matrix4f1, f12, -100.0F, f12).tex(f13, f16).endVertex(); bufferbuilder.pos(matrix4f1, f12, -100.0F, -f12).tex(f13, f14).endVertex(); bufferbuilder.pos(matrix4f1, -f12, -100.0F, -f12).tex(f15, f14).endVertex(); bufferbuilder.finishDrawing(); WorldVertexBufferUploader.draw(bufferbuilder); RenderSystem.disableTexture(); float f10 = world.getStarBrightness(partialTicks) * f11; if (f10 > 0.0F) { RenderSystem.color4f(f10, f10, f10, f10); Minecraft.getInstance().worldRenderer.starVBO.bindBuffer(); Minecraft.getInstance().worldRenderer.skyVertexFormat.setupBufferState(0L); Minecraft.getInstance().worldRenderer.starVBO .draw(matrixStack.getLast().getMatrix(), 7); VertexBuffer.unbindBuffer(); Minecraft.getInstance().worldRenderer.skyVertexFormat.clearBufferState(); } RenderSystem.color4f(1.0F, 1.0F, 1.0F, 1.0F); RenderSystem.disableBlend(); RenderSystem.enableAlphaTest(); RenderSystem.enableFog(); matrixStack.pop(); RenderSystem.disableTexture(); RenderSystem.color3f(0.0F, 0.0F, 0.0F); double d0 = Minecraft.getInstance().player.getEyePosition(partialTicks).y - world.getWorldInfo().getVoidFogHeight(); if (d0 < 0.0D) { matrixStack.push(); matrixStack.translate(0.0D, 12.0D, 0.0D); Minecraft.getInstance().worldRenderer.sky2VBO.bindBuffer(); Minecraft.getInstance().worldRenderer.skyVertexFormat.setupBufferState(0L); Minecraft.getInstance().worldRenderer.sky2VBO .draw(matrixStack.getLast().getMatrix(), 7); VertexBuffer.unbindBuffer(); Minecraft.getInstance().worldRenderer.skyVertexFormat.clearBufferState(); matrixStack.pop(); } if (world.func_239132_a_().func_239216_b_()) { RenderSystem.color3f(f * 0.2F + 0.04F, f1 * 0.2F + 0.04F, f2 * 0.6F + 0.1F); } else { RenderSystem.color3f(f, f1, f2); } RenderSystem.enableTexture(); RenderSystem.depthMask(true); RenderSystem.disableFog(); } }; } }); } } Any help with this would be highly appreciated, I have been trying this for days now. Thanks in advance!
-
how so? it just seems to return true?
-
apologies, here it is then: https://hastebin.com/rulequyede.md
-
So recently I have been trying to make a block which has multiple pages of slots, and getting to the next page and going back a page will just be a simple click of a button. However I am experiencing some issues where the slot index will be out of bounds. So from what I can tell(its quite hard to see whats actually happening), I am able to go from Page 1(first page) to Page 2 perfectly fine, and visa versa. However if I then try to go to Page 3, I get an error and the game crashes with an ArrayOutOfBoundsException. However, if I close the GUI, then re-open it, and go from Page 2 to Page 3 it works fine. Here is my code for switching pages: public void onRecieved(Supplier<NetworkEvent.Context> context) { context.get().enqueueWork(() -> { if (context.get().getSender().openContainer instanceof SiloContainer) { SiloContainer container = (SiloContainer) context.get().getSender().openContainer; if (this.option == 0) { int index = 36; container.currentPage.set(container.currentPage.get() - 1); for (Slot slot : container.inventorySlots) { System.out.println("index: " + (slot.getSlotIndex() - (104 * container.currentPage.get()))); if (slot instanceof SlotItemHandler) { container.inventorySlots.set(index, new SlotItemHandler( container.tileEntity.getHandler().orElse(container.tileEntity.createHandler()), ((SlotItemHandler) slot).getSlotIndex() - (104 * container.currentPage.get()), ((SlotItemHandler) slot).xPos, ((SlotItemHandler) slot).yPos)); index++; } } container.detectAndSendChanges(); } else if (this.option == 1) { int index = 36; container.currentPage.set(container.currentPage.get() + 1); for (Slot slot : container.inventorySlots) { System.out.println("index: " + (slot.getSlotIndex() + (104 * container.currentPage.get()))); if (slot instanceof SlotItemHandler) { container.inventorySlots.set(index, new SlotItemHandler( container.tileEntity.getHandler().orElse(container.tileEntity.createHandler()), ((SlotItemHandler) slot).getSlotIndex() + (104 * container.currentPage.get()), ((SlotItemHandler) slot).xPos, ((SlotItemHandler) slot).yPos)); index++; } } container.detectAndSendChanges(); } } }); context.get().setPacketHandled(true); } I have been trying to figure this out for hours(over the course of many days) so forgive me if something I am doing here is horribly stupid. This is also my 9th or 10th rewrite of the code, so yea, I'm starting to get very tired with this xD. Note: I have been trying to figure this out for hours(over the course of many days) so forgive me if something I am doing here is horribly stupid. This is also my 9th or 10th rewrite of the code, so yea, I'm starting to get very tired with this xD. Also, I should note, there are 5 pages, and 104 slots per page(so the ItemHandler has a size of 520). Here is the latest log(which includes the crash): https://hatebin.com/krsedhysky And here is a video of what i did to produce this crash(it crashed when the video ends): Also, ignore the fact that the page number doesn't update correctly, I know why, I just haven't got around to fixing it yet. If there is any other code you need to see, just ask and I will send, cause I'm not really sure what other code would be relevant. In advance, many thanks. TurtyWurty.
-
[1.15.2] How to update a container's slots?
TurtyWurty replied to TurtyWurty's topic in Modder Support
Yea, I have 104 slots per page, so I don't imagine the second option would be a great idea. But by the first option, do you mean to just change the slots index? If so, how would I even go about doing that? -
[1.15.2] How to update a container's slots?
TurtyWurty replied to TurtyWurty's topic in Modder Support
But how do I actually change the slots? Currently what I am doing to make it page dependent is just (page number * number of slots per page) + index. -
So I have a tile entity which has several 'pages' of slots, and you move to the next page using the forward page and back page buttons. This mostly works apart from the fact that slots seem to only be created when the container is opened. So this means when I press the button, I have to close and re-open the container in order for the container to show the next page of slots. So I was wondering how I would go about causing it to show the next page of slots and hide the current page when I press the button without having to close and re-open the container. I have been trying to look at the Creative Inventory code as well as the Stone-cutter code, but sadly I haven't managed to find anything that works. Thanks in advance.
-
HarvestDropsEvent i don't believe is implemented yet because of some design reason iirc.
-
Hello fellow modders. So I have been trying to spawn particular fossils in my dimension. I was successful with this however I have received a weird issue where any time that it generates on a chunk border, it will cut off any part of the structure that's outside of that chunk. Obviously this is a pretty major issue, and I'm not sure whether this is a forge bug(I think it is) or whether somehow my placement code is wrong. While I was searching around for it, a friend of mine made this issue on the forge issue tracker: https://github.com/MinecraftForge/MinecraftForge/issues/6654. However this got closed by Lex and then the bot said to come here. Here is my feature class: Here is the method I use to add it: And then I call this in my biome's constructor like so ModBiomeFeatures.addExampleFeature(this, 10); So if anyone knows a fix to this, I would love to know, as it does basically make structures useless xD. It only seems to want to let me upload 1 screenshot so here:
-
Hello everyone, I was wondering how you get the name of the world. Just to solve any confusion with this, i mean the save name so for example, the default name is New World. So basically I want to get this name. I have already tried several things, but sadly none have given me what I have been looking for, I have tried: world.getWorldInfo().getWorldName() But this gave me back MpServer, which was not the world name. I also tried: world.getProviderName() but that gave me something about chunks, so basically not what I was looking for. So if anyone knows that would be much appreciated! ?? I solved it by doing: world.getServer().getWorldName()
-
[1.12.2] plugin with id 'net.minecraftforge.gradle.forge' not found
TurtyWurty replied to vMystic's topic in Modder Support
lol thats definitely not correct, in all my mods that i have for 1.12.2 it is net.minecraftforge.gradle.forge, and after seeing your comment about it, i figured i would build another mod just to check if it default builds with that, and it does -
[1.12.2] plugin with id 'net.minecraftforge.gradle.forge' not found
TurtyWurty replied to vMystic's topic in Modder Support
i saw someone said it had to do with the build.gradle, but i dont believe its that, just so everyone knows. I only say this because his build.gradle is correct and im 100% sure on that, he did get the mdk from the right place as well. his mod folder is literally just an unpacked mdk because the gradle setup fails almost instantly edit: i know this because i tried to help him on discord, but i couldnt find anything wrong