Jump to content
View in the app

A better way to browse. Learn more.

Forge Forums

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Alicrack

Members
  • Joined

  • Last visited

  1. Thank you for support, I already found carvedPumpkinOverlay in ForgeInGameGui and will use it
  2. Thanks,but I still do not understand what BufferBuilder is, also, do you have any learning material about rendering I can take lesson from?
  3. I want to overlay a texture on top of the screen, like carved pumpkins do when equipped or when a totem of undying is being used, and dont know how can i implement it. I tried looking inside of carved pumpkins code, totem of undying or anywhere else, but didnt find anything related. Also, I want implement this texture overlay behaviour through renderParticle method in my CustomParticle class
  4. This create() method is a part of a Piece extends TemplateStructurePiece class, which is called in my init() method through this.components.add method, maybe I should put a code here? Here's my structure piece code: package com.alicrack.thebackrooms.world.structures; import java.util.List; import java.util.Random; import com.alicrack.thebackrooms.TheBackrooms; import net.minecraft.block.BlockState; import net.minecraft.block.Blocks; import net.minecraft.client.Minecraft; import net.minecraft.client.MinecraftGame; import net.minecraft.command.CommandSource; import net.minecraft.nbt.CompoundNBT; import net.minecraft.server.MinecraftServer; import net.minecraft.util.Mirror; import net.minecraft.util.ResourceLocation; import net.minecraft.util.Rotation; import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.ChunkPos; import net.minecraft.util.math.MutableBoundingBox; import net.minecraft.world.IWorld; import net.minecraft.world.World; import net.minecraft.world.dimension.DimensionType; import net.minecraft.world.gen.ChunkGenerator; import net.minecraft.world.gen.Heightmap; import net.minecraft.world.gen.feature.NoFeatureConfig; import net.minecraft.world.gen.feature.structure.IStructurePieceType; import net.minecraft.world.gen.feature.structure.StructurePiece; import net.minecraft.world.gen.feature.structure.TemplateStructurePiece; import net.minecraft.world.gen.feature.template.BlockIgnoreStructureProcessor; import net.minecraft.world.gen.feature.template.PlacementSettings; import net.minecraft.world.gen.feature.template.Template; import net.minecraft.world.gen.feature.template.TemplateManager; public class CornerThreeExitsPiece { public static ResourceLocation x; public static class Piece extends TemplateStructurePiece { public Piece(TemplateManager templateMgr, CompoundNBT nbt) { super(TheBackrooms.CORNER_THREE_EXITS_PIECE, nbt); this.setupTemplate(templateMgr); } public Piece(TemplateManager templateMgr, ResourceLocation resLoc, BlockPos blockPos, Rotation rot, int offsetY) { super(TheBackrooms.CORNER_THREE_EXITS_PIECE, 0); x = resLoc; this.templatePosition = new BlockPos(blockPos.getX(), blockPos.getY() - offsetY, blockPos.getZ()); this.setupTemplate(templateMgr); } public Piece(TemplateManager templateMgr, IStructurePieceType type, BlockPos blockPos, Rotation rot, int offsetY) { super(type, 0); this.templatePosition = new BlockPos(blockPos.getX(), blockPos.getY() - offsetY, blockPos.getZ()); this.setupTemplate(templateMgr); } private void setupTemplate(TemplateManager templateMgr) { Template template = templateMgr.getTemplateDefaulted(x); PlacementSettings placementsettings = (new PlacementSettings()) .setMirror(Mirror.NONE) .setCenterOffset(BlockPos.ZERO) .addProcessor(BlockIgnoreStructureProcessor.STRUCTURE_BLOCK); this.setup(template, this.templatePosition, placementsettings); } @Override public boolean create(IWorld worldIn, ChunkGenerator<?> chunkGenIn, Random rand, MutableBoundingBox mutableBB, ChunkPos chunkPos) { PlacementSettings placementsettings = (new PlacementSettings()).setRotation(Rotation.NONE).setMirror(Mirror.NONE).setCenterOffset(BlockPos.ZERO).addProcessor(BlockIgnoreStructureProcessor.STRUCTURE_BLOCK); BlockPos blockpos1 = this.templatePosition.add(Template.transformedBlockPos(placementsettings, new BlockPos(3, 0, 0))); int strucHeight = worldIn.getHeight(Heightmap.Type.WORLD_SURFACE_WG, blockpos1.getX(), blockpos1.getZ()); CornerThreeExitsStructure cornerStructure = new CornerThreeExitsStructure(NoFeatureConfig::deserialize); //problem World w = null; //problem TheBackrooms.LOGGER.info("WORLD:"+ w); TheBackrooms.LOGGER.info(cornerStructure.findNearest(w, chunkGenIn, blockpos1, 32, false)); this.templatePosition = this.templatePosition.add(0, strucHeight, 0); boolean superReturn = super.create(worldIn, chunkGenIn, rand, mutableBB, chunkPos); return superReturn; } @Override protected void handleDataMarker(String function, BlockPos pos, IWorld worldIn, Random rand, MutableBoundingBox sbb) { // TODO Auto-generated method stub } } } And here's my CustomStructure class: package com.alicrack.thebackrooms.world.structures; import java.util.List; import java.util.Random; import java.util.function.Function; import com.alicrack.thebackrooms.TheBackrooms; import com.alicrack.thebackrooms.init.BiomeInit; import com.mojang.datafixers.Dynamic; import net.minecraft.util.ResourceLocation; import net.minecraft.util.Rotation; import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.ChunkPos; import net.minecraft.util.math.MutableBoundingBox; import net.minecraft.world.biome.Biome; import net.minecraft.world.biome.BiomeManager; import net.minecraft.world.gen.ChunkGenerator; import net.minecraft.world.gen.feature.Feature; import net.minecraft.world.gen.feature.NoFeatureConfig; import net.minecraft.world.gen.feature.structure.ScatteredStructure; import net.minecraft.world.gen.feature.structure.Structure; import net.minecraft.world.gen.feature.structure.StructurePiece; import net.minecraft.world.gen.feature.structure.StructureStart; import net.minecraft.world.gen.feature.template.TemplateManager; public class CornerThreeExitsStructure extends Structure<NoFeatureConfig> { public static int worldX, worldZ; public CornerThreeExitsStructure(Function<Dynamic<?>, ? extends NoFeatureConfig> configFactoryIn) { super(configFactoryIn); // TODO Auto-generated constructor stub } @Override public IStartFactory getStartFactory() { // TODO Auto-generated method stub return CornerThreeExitsStructure.Start::new; } @Override public String getStructureName() { // TODO Auto-generated method stub return TheBackrooms.CORNER_THREE_EXITS_LOCATION.toString(); } @Override public int getSize() { // TODO Auto-generated method stub return 2; } public static class Start extends StructureStart{ public Start(Structure<?> p_i225876_1_, int p_i225876_2_, int p_i225876_3_, MutableBoundingBox p_i225876_4_, int p_i225876_5_, long p_i225876_6_) { super(p_i225876_1_, p_i225876_2_, p_i225876_3_, p_i225876_4_, p_i225876_5_, p_i225876_6_); // TODO Auto-generated constructor stub } @Override public void init(ChunkGenerator<?> generator, TemplateManager templateManagerIn, int chunkX, int chunkZ, Biome biomeIn) { worldX = chunkX * 16; worldZ = chunkZ * 16; BlockPos blockpos = new BlockPos(worldX, 1, worldZ); this.components.add(new CornerThreeExitsPiece.Piece (templateManagerIn, TheBackrooms.JEDEN_BOTTOM_LOCATION, blockpos, Rotation.NONE, 1)); this.recalculateStructureSize(); } } @Override public boolean canBeGenerated(BiomeManager biomeManagerIn, ChunkGenerator<?> generatorIn, Random randIn, int chunkX, int chunkZ, Biome biomeIn) { // TODO Auto-generated method stub return true; } }
  5. So, I'm trying to use findNearest (one that returns BlockPos of a structure) function in my create() method of my custom StructurePiece class and don't know the way I can get the instance of the World for that findNearest function Can anyone help?

Important Information

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

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.