Jump to content

killerjdog51

Members
  • Posts

    56
  • Joined

  • Last visited

Converted

  • Gender
    Male
  • Location
    United States
  • Personal Text
    I am new!

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

killerjdog51's Achievements

Stone Miner

Stone Miner (3/8)

1

Reputation

  1. There's a discord channel and a forge bot? Honestly I'm not as surprised as I thought I'd be. Guess I'll check it out then. I didn't think it was possible since I didn't see anything past 1.15 on the old website.
  2. Thats what I was thinking, and unfortunately I don't think theres a good way to accomplish that, which is why I was hoping for an easy way to slip my biome layer into the world generation through some sort of forge manager (like the BiomeManager) or through an event (like one of the WorldEvents or WorldTypeEvent). The only other solution I can think of is by generating a feature and inserting my custom biome into the BiomeContainer using reflection, which is possible except I would need to know the exact obfuscated methods/fields (which is like trying to find a needle in a haystack).
  3. Unfortunately that didn't work the way I wanted it to. What I'm trying to accomplish is to have a rare biome that spawns within another more common biome, similar to how bamboo forests spawn within jungles. I've found that if I just add my custom biome to world generation that it will generate on the outside between different biomes (Like in the middle of a jungle, desert, and plains) rather than within/surrounded by a single specific biome. Like its very jarring and unsatisfying, which is why I want to make it generate as a layer instead since I want my biome to behave more akin to bamboo jungles or sunflower plains.
  4. Hey, I was wondering how I could add a custom biome layer to vanilla world generation? I see in IForgeWorldType there is a getBiomeLayer method that takes an IAreaFactory, overworldGenSettings, and a LongFunction (world seed) and returns the same IAreaFactory with bamboo forests. I was thinking I'd use the WorldTypeEvent.BiomeSize event to seamlessly insert my custom biome layer into vanilla generation since the event occurs within the function that builds the vanilla biome layers. Because my understanding is that if I got the vanilla IAreaFactory I would have to return it with my custom biome layer before LayerUtil gives the layer to the OverworldBiomeProvider. The issue is I can't figure out how to get the vanilla IAreaFactory, so I was wondering if there was a better way to add a custom biome layer to vanilla world generation?
  5. Thanks, it worked! I'm an idiot for not realizing that biomes were dynamic and being called within the BiomeContainer with its own version of a dynamic Biome Registry. All I had to do was grab copy the reference to that and get a reference to my biome and the dynamic biome id that way.
  6. I've narrowed things down to: public int getInt(final Object k) { if ((strategy.equals(((K) k), (null)))) return containsNullKey ? value[n] : defRetValue; K curr; final K[] key = this.key; int pos; // The starting point. if (((curr = key[pos = (it.unimi.dsi.fastutil.HashCommon.mix(strategy.hashCode((K) k))) & mask]) == null)) return defRetValue; if ((strategy.equals((K) (k), (curr)))) return value[pos]; // There's always an unused entry. while (true) { if (((curr = key[pos = (pos + 1) & mask]) == null)) return defRetValue; if ((strategy.equals((K) (k), (curr)))) return value[pos]; } } Somehow the key[pos = (it.unimi.dsi.fastutil.HashCommon.mix(strategy.hashCode((K) k))) & mask] is used to calculate the biome data position within the list K. For some reason it seems like my inserted biome returns the wrong position value (though it is within the K list). I've tested it with Minecraft biomes like forest and mushroom fields, they also don't return the correct position unless its natural generation (not inserted like mine). Does anyone have ideas on why this is? If I had to guess inserting the biome data generates a different hash, but I don't understand why. perhaps its caused by ForgeRegistries.BIOMES.getValue()?
  7. So I have an Oasis feature that generates and edits the biome around it. The feature generation part works well, the issue is that it no longer edits the biome like it did in previous versions (1.12, 1.14, & 1.15). Or it does, but instead of my custom biome it generates the "Received invalid biome id: -1" error and uses the Minecraft:Ocean biome. The biome spawns perfectly fine if I generate it using the single biome world type. OasisBiome
  8. Thanks, I switched it to an iterator and it worked. I was able to remove the features after the game had loaded but before they generated.
  9. How did you remove/prevent the generation? Because when I use f.remove() I get a ConcurrentModificationException.
  10. Thanks, it worked! I generally try to avoid reflection because I don't want to accidently break the game... I was hoping there would be a better way to implement trees, but considering the constructor itself is private, I guess there's not many options available. I kinda wish there was a consistent tutorial for trees, but I suppose that'd be hard since mojang keeps changing things between updates. The mod I'm working on is for 1.14, 1.15, and now 1.16, and each update has different code for trees, like they keep getting more and more modularized/customizable. Which certainly isn't a bad thing.
  11. Even though the registry has? public static final Registry<TrunkPlacerType<?>> TRUNK_REPLACER = createRegistry(TRUNK_PLACER_TYPE_KEY, () -> { return TrunkPlacerType.STRAIGHT_TRUNK_PLACER; });
  12. I'm trying to add custom trees to my mod and to do that I need a custom Trunk. The only way to do this is to register my own type using: private static <P extends AbstractTrunkPlacer> TrunkPlacerType<P> register(String key, Codec<P> type) { return Registry.register(Registry.TRUNK_REPLACER, key, new TrunkPlacerType<>(type)); } The issue though is that it errors on the new TrunkPlacerType<>(type) saying "Cannot infer type arguments for TrunkPlacerType<>". And if I delete TrunkPlacerType<> I get an error on Register.register saying "The method register(Registry<V>, ResourceLocation, T) in the type Registry is not applicable for the arguments (Registry<TrunkPlacerType<?>>, ResourceLocation, Codec<P>)". My next thought process was to add my Trunk Placer Type to a forge deferred register, except that it doesn't exist. There's a Forge registry for FoliagePlacerType and TreeDecorationType, but not one for TrunkPlacerType. So I'm wondering if anyone has an idea that I haven't thought of? Like is there a way for me to add my trunk type to the minecraft registry? Or is there a way to create a custom Forge registry/deferred register?
  13. I've updated my 1.14.4 mod to 1.15.2 and it turns out sign rendering has been somewhat improved/changed. So I changed from using a direct resource path to the atlas. Good thing is that the sign render for the block works, problem is that the sign render for the sign edit screen doesn't because that uses packets to communicate from server to client and I just don't understand that stuff. So I'm asking for help to get my sign edit screen working, below are images of the issue along with my code. Thank you in advanced. Sign edit screen: Sign: Wood Types: package biome_enhancments.util; import java.util.Set; import it.unimi.dsi.fastutil.objects.ObjectArraySet; import net.minecraft.block.WoodType; public class ModWoodTypes extends WoodType { private static final Set<WoodType> VALUES = new ObjectArraySet<>(); public static final WoodType BAOBAB = register(new ModWoodTypes("baobab")); public static final WoodType MANGROVE = register(new ModWoodTypes("mangrove")); public static final WoodType PALM = register(new ModWoodTypes("palm")); private final String name; protected ModWoodTypes(String nameIn) { super(nameIn); this.name = nameIn; } private static WoodType register(WoodType woodTypeIn) { VALUES.add(woodTypeIn); return woodTypeIn; } public String getName() { return this.name; } } Sign Item: public static final Item BAOBAB_SIGN = new ModSignItem(new Item.Properties().maxStackSize(16).group(ItemGroup.DECORATIONS), ModBlocks.BAOBAB_SIGN, ModBlocks.BAOBAB_WALL_SIGN); public static final Item MANGROVE_SIGN = new ModSignItem(new Item.Properties().maxStackSize(16).group(ItemGroup.DECORATIONS), ModBlocks.MANGROVE_SIGN, ModBlocks.MANGROVE_WALL_SIGN); public static final Item PALM_SIGN = new ModSignItem(new Item.Properties().maxStackSize(16).group(ItemGroup.DECORATIONS), ModBlocks.PALM_SIGN, ModBlocks.PALM_WALL_SIGN); package biome_enhancments.items; import javax.annotation.Nullable; import biome_enhancments.tileentity.ModSignTileEntity; import net.minecraft.block.Block; import net.minecraft.block.BlockState; import net.minecraft.entity.player.PlayerEntity; import net.minecraft.item.ItemStack; import net.minecraft.item.SignItem; import net.minecraft.util.math.BlockPos; import net.minecraft.world.World; public class ModSignItem extends SignItem{ public ModSignItem(Properties propertiesIn, Block floorBlockIn, Block wallBlockIn) { super(propertiesIn, floorBlockIn, wallBlockIn); } @Override protected boolean onBlockPlaced(BlockPos pos, World worldIn, @Nullable PlayerEntity player, ItemStack stack, BlockState state) { boolean flag = super.onBlockPlaced(pos, worldIn, player, stack, state); if (!worldIn.isRemote && !flag && player != null) { player.openSignEditor((ModSignTileEntity)worldIn.getTileEntity(pos)); } return flag; } } Sign Block: public static final Block BAOBAB_SIGN = new ModStandingSignBlock(Block.Properties.create(Material.WOOD, MaterialColor.ADOBE).doesNotBlockMovement().hardnessAndResistance(1.0F).sound(SoundType.WOOD), ModWoodTypes.BAOBAB); public static final Block BAOBAB_WALL_SIGN = new ModWallSignBlock(Block.Properties.create(Material.WOOD, MaterialColor.ADOBE).doesNotBlockMovement().hardnessAndResistance(1.0F).sound(SoundType.WOOD).lootFrom(BAOBAB_SIGN), ModWoodTypes.BAOBAB); public static final Block MANGROVE_SIGN = new ModStandingSignBlock(Block.Properties.create(Material.WOOD, MaterialColor.OBSIDIAN).doesNotBlockMovement().hardnessAndResistance(1.0F).sound(SoundType.WOOD), ModWoodTypes.MANGROVE); public static final Block MANGROVE_WALL_SIGN = new ModWallSignBlock(Block.Properties.create(Material.WOOD, MaterialColor.OBSIDIAN).doesNotBlockMovement().hardnessAndResistance(1.0F).sound(SoundType.WOOD).lootFrom(MANGROVE_SIGN), ModWoodTypes.MANGROVE); public static final Block PALM_SIGN = new ModStandingSignBlock(Block.Properties.create(Material.WOOD, MaterialColor.SAND).doesNotBlockMovement().hardnessAndResistance(1.0F).sound(SoundType.WOOD), ModWoodTypes.PALM); public static final Block PALM_WALL_SIGN = new ModWallSignBlock(Block.Properties.create(Material.WOOD, MaterialColor.SAND).doesNotBlockMovement().hardnessAndResistance(1.0F).sound(SoundType.WOOD).lootFrom(PALM_SIGN), ModWoodTypes.PALM); package biome_enhancments.blocks; import biome_enhancments.tileentity.ModSignTileEntity; import net.minecraft.block.StandingSignBlock; import net.minecraft.block.WoodType; import net.minecraft.tileentity.TileEntity; import net.minecraft.world.IBlockReader; public class ModStandingSignBlock extends StandingSignBlock { public ModStandingSignBlock(Properties properties, WoodType woodType) { super(properties, woodType); } @Override public TileEntity createNewTileEntity(IBlockReader worldIn) { return new ModSignTileEntity(); } } package biome_enhancments.blocks; import biome_enhancments.tileentity.ModSignTileEntity; import net.minecraft.block.WallSignBlock; import net.minecraft.block.WoodType; import net.minecraft.tileentity.TileEntity; import net.minecraft.world.IBlockReader; public class ModWallSignBlock extends WallSignBlock { public ModWallSignBlock(Properties properties, WoodType woodType) { super(properties, woodType); } @Override public TileEntity createNewTileEntity(IBlockReader worldIn) { return new ModSignTileEntity(); } } Sign Tile Entity: public static final TileEntityType<ModSignTileEntity> SIGN = TileEntityType.Builder.create(ModSignTileEntity::new , ModBlocks.BAOBAB_SIGN, ModBlocks.BAOBAB_WALL_SIGN, ModBlocks.MANGROVE_SIGN, ModBlocks.MANGROVE_WALL_SIGN, ModBlocks.PALM_SIGN, ModBlocks.PALM_WALL_SIGN).build(null); package biome_enhancments.tileentity; import biome_enhancments.init.ModTileEntityTypes; import net.minecraft.tileentity.SignTileEntity; import net.minecraft.tileentity.TileEntityType; public class ModSignTileEntity extends SignTileEntity { @Override public TileEntityType<?> getType() { return ModTileEntityTypes.SIGN; } } Sign Render: package biome_enhancments.tileentity; import java.util.List; import com.mojang.blaze3d.matrix.MatrixStack; import com.mojang.blaze3d.platform.GlStateManager; import com.mojang.blaze3d.vertex.IVertexBuilder; import biome_enhancments.BiomeEnhancements; import biome_enhancments.blocks.ModStandingSignBlock; import biome_enhancments.blocks.ModWallSignBlock; import biome_enhancments.init.ModBlocks; import net.minecraft.block.AbstractSignBlock; import net.minecraft.block.Block; import net.minecraft.block.BlockState; import net.minecraft.block.StandingSignBlock; import net.minecraft.block.WallSignBlock; import net.minecraft.block.WoodType; import net.minecraft.client.Minecraft; import net.minecraft.client.gui.AbstractGui; import net.minecraft.client.gui.FontRenderer; import net.minecraft.client.gui.RenderComponentsUtil; import net.minecraft.client.renderer.Atlases; import net.minecraft.client.renderer.BufferBuilder; import net.minecraft.client.renderer.IRenderTypeBuffer; import net.minecraft.client.renderer.Tessellator; import net.minecraft.client.renderer.Vector3f; import net.minecraft.client.renderer.model.Material; import net.minecraft.client.renderer.texture.NativeImage; import net.minecraft.client.renderer.texture.TextureAtlasSprite; import net.minecraft.client.renderer.tileentity.SignTileEntityRenderer; import net.minecraft.client.renderer.tileentity.TileEntityRenderer; import net.minecraft.client.renderer.tileentity.TileEntityRendererDispatcher; import net.minecraft.client.renderer.vertex.DefaultVertexFormats; import net.minecraft.tileentity.SignTileEntity; import net.minecraft.util.ResourceLocation; import net.minecraft.util.text.ITextComponent; import net.minecraftforge.api.distmarker.Dist; import net.minecraftforge.api.distmarker.OnlyIn; @OnlyIn(Dist.CLIENT) public class ModSignTileEntityRenderer extends TileEntityRenderer<ModSignTileEntity> { private final SignTileEntityRenderer.SignModel model = new SignTileEntityRenderer.SignModel(); public ModSignTileEntityRenderer(TileEntityRendererDispatcher rendererDispatcherIn) { super(rendererDispatcherIn); } public void render(ModSignTileEntity tileEntityIn, float partialTicks, MatrixStack matrixStackIn, IRenderTypeBuffer bufferIn, int combinedLightIn, int combinedOverlayIn) { BlockState blockstate = tileEntityIn.getBlockState(); matrixStackIn.push(); float f = 0.6666667F; if (blockstate.getBlock() instanceof StandingSignBlock) { matrixStackIn.translate(0.5D, 0.5D, 0.5D); float f1 = -((float)(blockstate.get(StandingSignBlock.ROTATION) * 360) / 16.0F); matrixStackIn.rotate(Vector3f.YP.rotationDegrees(f1)); this.model.signStick.showModel = true; } else { matrixStackIn.translate(0.5D, 0.5D, 0.5D); float f4 = -blockstate.get(WallSignBlock.FACING).getHorizontalAngle(); matrixStackIn.rotate(Vector3f.YP.rotationDegrees(f4)); matrixStackIn.translate(0.0D, -0.3125D, -0.4375D); this.model.signStick.showModel = false; } matrixStackIn.push(); matrixStackIn.scale(0.6666667F, -0.6666667F, -0.6666667F); Material material = getMaterial(blockstate.getBlock()); IVertexBuilder ivertexbuilder = material.getBuffer(bufferIn, this.model::getRenderType); this.model.signBoard.render(matrixStackIn, ivertexbuilder, combinedLightIn, combinedOverlayIn); this.model.signStick.render(matrixStackIn, ivertexbuilder, combinedLightIn, combinedOverlayIn); matrixStackIn.pop(); FontRenderer fontrenderer = this.renderDispatcher.getFontRenderer(); float f2 = 0.010416667F; matrixStackIn.translate(0.0D, (double)0.33333334F, (double)0.046666667F); matrixStackIn.scale(0.010416667F, -0.010416667F, 0.010416667F); int i = tileEntityIn.getTextColor().getTextColor(); double d0 = 0.4D; int j = (int)((double)NativeImage.getRed(i) * 0.4D); int k = (int)((double)NativeImage.getGreen(i) * 0.4D); int l = (int)((double)NativeImage.getBlue(i) * 0.4D); int i1 = NativeImage.getCombined(0, l, k, j); for(int j1 = 0; j1 < 4; ++j1) { String s = tileEntityIn.getRenderText(j1, (p_212491_1_) -> { List<ITextComponent> list = RenderComponentsUtil.splitText(p_212491_1_, 90, fontrenderer, false, true); return list.isEmpty() ? "" : list.get(0).getFormattedText(); }); if (s != null) { float f3 = (float)(-fontrenderer.getStringWidth(s) / 2); fontrenderer.renderString(s, f3, (float)(j1 * 10 - tileEntityIn.signText.length * 5), i1, false, matrixStackIn.getLast().getMatrix(), bufferIn, false, 0, combinedLightIn); } } matrixStackIn.pop(); } public static Material getMaterial(Block blockIn) { WoodType woodtype; if (blockIn instanceof AbstractSignBlock) { woodtype = ((AbstractSignBlock)blockIn).getWoodType(); } else { woodtype = WoodType.OAK; } return getSignMaterial(woodtype); } public static Material getSignMaterial(WoodType woodtype) { return new Material(Atlases.SIGN_ATLAS, new ResourceLocation(BiomeEnhancements.MOD_ID, "entity/signs/" + woodtype.getName())); } } package biome_enhancments.tileentity; import biome_enhancments.BiomeEnhancements; import net.minecraft.client.renderer.Atlases; import net.minecraft.client.renderer.texture.AtlasTexture; import net.minecraft.util.ResourceLocation; import net.minecraftforge.api.distmarker.Dist; import net.minecraftforge.client.event.TextureStitchEvent; import net.minecraftforge.eventbus.api.SubscribeEvent; import net.minecraftforge.fml.common.Mod; @Mod.EventBusSubscriber(modid = BiomeEnhancements.MOD_ID, value = Dist.CLIENT, bus = Mod.EventBusSubscriber.Bus.MOD) public class ModSignTextureStitch { public static final ResourceLocation BAOBAB = new ResourceLocation(BiomeEnhancements.MOD_ID, "entity/signs/baobab"); public static final ResourceLocation MANGROVE = new ResourceLocation(BiomeEnhancements.MOD_ID, "entity/signs/mangrove"); public static final ResourceLocation PALM = new ResourceLocation(BiomeEnhancements.MOD_ID, "entity/signs/palm"); @SubscribeEvent public static void onStitchEvent(TextureStitchEvent.Pre event) { ResourceLocation stitching = event.getMap().getTextureLocation(); if(!stitching.equals(Atlases.SIGN_ATLAS)) { return; } boolean added = event.addSprite(BAOBAB); added = event.addSprite(MANGROVE); added = event.addSprite(PALM); } }
  14. Like this? @Mod.EventBusSubscriber(modid = BiomeEnhancements.MOD_ID, value = Dist.CLIENT, bus = Mod.EventBusSubscriber.Bus.MOD) public class ModSignTextureStitch { public static final ResourceLocation BAOBAB = new ResourceLocation(BiomeEnhancements.MOD_ID, "entity/signs/baobab"); public static final ResourceLocation MANGROVE = new ResourceLocation(BiomeEnhancements.MOD_ID, "entity/signs/mangrove"); public static final ResourceLocation PALM = new ResourceLocation(BiomeEnhancements.MOD_ID, "entity/signs/palm"); @SubscribeEvent public static void onStitchEvent(TextureStitchEvent.Pre event) { ResourceLocation stitching = event.getMap().getTextureLocation(); if(!stitching.equals(Atlases.SIGN_ATLAS)) { return; } boolean added = event.addSprite(BAOBAB); added = event.addSprite(MANGROVE); added = event.addSprite(PALM); } } The signs have texture, but when you "type" in them the visual is the missing texture thing. Here's how I load the textures in the sign renderer. public static Material getMaterial(Block blockIn) { WoodType woodtype; if (blockIn instanceof AbstractSignBlock) { woodtype = ((AbstractSignBlock)blockIn).getWoodType(); } else { woodtype = WoodType.OAK; } return getSignMaterial(woodtype); } public static Material getSignMaterial(WoodType woodtype) { return new Material(Atlases.SIGN_ATLAS, new ResourceLocation(BiomeEnhancements.MOD_ID, "entity/signs/" + woodtype.getName())); } }
  15. How did you add to the sign atlas? I'm experiencing the same issue.
×
×
  • Create New...

Important Information

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