Jump to content

Bektor

Forge Modder
  • Posts

    852
  • Joined

  • Last visited

Everything posted by Bektor

  1. UPDATE: Ok, I got it nearly working. For testing purpose I decided to use lava. Thats how it looks so far, but there is one problem. Is there a way to remove the lava which is over the one block air level? My current code: for(int x = 0; x < 16; ++x) { for(int z = 0; z < 16; ++z) { BiomeBase biomeBase = (BiomeBase)baseBiome[x * 16 + z]; biomeBase.replaceBlocksForBiome(chunkX * 16 + x, chunkZ * 16 + z, blocks, state, baseBiome, noise); for(int y = 255; y >= 0; --y) { if(y <= this.random.nextInt(4)) { primer.setBlockState((chunkX * 16 + x) & 15, y, (chunkZ * 16 + z) & 15, Blocks.bedrock.getDefaultState()); primer.setBlockState((chunkX * 16 + x) & 15, y + 1, (chunkZ * 16 + z) & 15, Blocks.lava.getDefaultState()); primer.setBlockState((chunkX * 16 + x) & 15, y + 2, (chunkZ * 16 + z) & 15, Blocks.lava.getDefaultState()); primer.setBlockState((chunkX * 16 + x) & 15, y + 3, (chunkZ * 16 + z) & 15, Blocks.lava.getDefaultState()); primer.setBlockState((chunkX * 16 + x) & 15, y + 4, (chunkZ * 16 + z) & 15, Blocks.lava.getDefaultState()); primer.setBlockState((chunkX * 16 + x) & 15, y + 5, (chunkZ * 16 + z) & 15, Blocks.lava.getDefaultState()); primer.setBlockState((chunkX * 16 + x) & 15, y + 6, (chunkZ * 16 + z) & 15, Blocks.air.getDefaultState()); // doesn't remove all lava... not working if(primer.getBlockState((chunkX * 16 + x) & 15, y + 7, (chunkZ * 16 + z) & 15) == Blocks.lava.getDefaultState()) primer.setBlockState((chunkX * 16 + x) & 15, y + 7, (chunkZ * 16 + z) & 15, Blocks.air.getDefaultState()); else if(primer.getBlockState((chunkX * 16 + x) & 15, y + 8, (chunkZ * 16 + z) & 15) == Blocks.lava.getDefaultState()) primer.setBlockState((chunkX * 16 + x) & 15, y + 8, (chunkZ * 16 + z) & 15, Blocks.air.getDefaultState()); else if(primer.getBlockState((chunkX * 16 + x) & 15, y + 9, (chunkZ * 16 + z) & 15) == Blocks.lava.getDefaultState()) primer.setBlockState((chunkX * 16 + x) & 15, y + 9, (chunkZ * 16 + z) & 15, Blocks.air.getDefaultState()); else if(primer.getBlockState((chunkX * 16 + x) & 15, y + 10, (chunkZ * 16 + z) & 15) == Blocks.lava.getDefaultState()) primer.setBlockState((chunkX * 16 + x) & 15, y + 10, (chunkZ * 16 + z) & 15, Blocks.air.getDefaultState()); else if(primer.getBlockState((chunkX * 16 + x) & 15, y + 11, (chunkZ * 16 + z) & 15) == Blocks.lava.getDefaultState()) primer.setBlockState((chunkX * 16 + x) & 15, y + 11, (chunkZ * 16 + z) & 15, Blocks.air.getDefaultState()); else if(primer.getBlockState((chunkX * 16 + x) & 15, y + 12, (chunkZ * 16 + z) & 15) == Blocks.lava.getDefaultState()) primer.setBlockState((chunkX * 16 + x) & 15, y + 12, (chunkZ * 16 + z) & 15, Blocks.air.getDefaultState()); else if(primer.getBlockState((chunkX * 16 + x) & 15, y + 13, (chunkZ * 16 + z) & 15) == Blocks.lava.getDefaultState()) primer.setBlockState((chunkX * 16 + x) & 15, y + 13, (chunkZ * 16 + z) & 15, Blocks.air.getDefaultState()); else if(primer.getBlockState((chunkX * 16 + x) & 15, y + 14, (chunkZ * 16 + z) & 15) == Blocks.lava.getDefaultState()) primer.setBlockState((chunkX * 16 + x) & 15, y + 14, (chunkZ * 16 + z) & 15, Blocks.air.getDefaultState()); } } } } So everything above y + 6 should not generate the lava spots. (lava lakes are ok, but thats a future task for me) Thx in advance. Bektor
  2. Ok, thx.
  3. I am no expert by any means, but here goes: In traditional OpenGL the CPU issues very very many draw calls (e.g. to draw a quad you need glBegin, then glVertex stuff, then glEnd). These are all individual native calls that need to be transferred over the (comparatively) slow path from CPU to GPU. This has to happen every frame. There are some improvements to this such as display lists but it does not change the overall concept. Modern GL let's you actually run code on the GPU (shaders) so that you do not have to pay the expensive transfer cost for data from CPU to GPU. This is my view on it, I am probably wrong in a lot of ways, but I think that's the general concept. Well, the data will still be transfererd from the CPU to the GPU. But the json files from 1.8 just feel to me like bad shaders from OpenGL 3.3+. And I'm not an expert in that stuff, too. Just started once with OpenGL 3.3 and 4.1 programming, but never did that much.... (currently playing around with the new Vulkan API and C++14). But I know for sure that OpenGL 3.3 supports texture compression and I don't think OpenGL or at least Mojang does it, because otherwhise I can't explain myself how someone can fill the VRAM with 8GB of Minecraft textures while playing a mod pack and Games like Battlefront and Battlefield don't use so much VRAM and have a way better texture quality. But thx for the answer. To the next point: Could you give me an example of how to do multi-threading in MC. I've got really no idea of how to implement that in Minecraft.... (well, for me it sometimes is just easier to write my own 2D game then modding MC, because on my own Games I know every single line of code and what it does and how ) Could you please explain the last thing again? I didn't understand it. [kannst ja auch in Deutsch erklären wenn du willst ] Bektor
  4. Thx for all the answers. What makes outdated OpenGL (I think Minecraft uses 2) so slow compared to modern OpenGL? Next point: I want to implement some simple physics like TFC and a better world generator for my own dimension. How can I get a good performance beside optimizing the math behind it.
  5. Hi, I'm currently working on a mod and now I want to now why Minecraft's performance is so bad. So that when I know why Minecraft's performance is so bad I can maybe optimize my own mod to the maximum. Thx in advance. Bektor
  6. Ok, thx. Now it's working.
  7. Hi, I'm wondering how I can build my own mod, cause I'm always getting this error: warning: [options] bootstrap class path not set in conjunction with -source 1.6 error: try-with-resources is not supported in -source 1.6 try (InputStream in = getClass().getClassLoader().getResourceAsStream(getPath())) { ^ (use -source 7 or higher to enable try-with-resources) 1 error 1 warning :compileJava FAILED I'm wondering how to fix it, because in eclipse it's working fine, I can start my mod, test it there, but outside of eclipse I can't compile it. (Eclipse itself is using the Java 8 compiler which is default for all my eclipse projects and the only installed Java version is Java 8 latest update). Thx in advance. Bektor
  8. Ok, thx. Now it's working perfectly.
  9. ModBlocks: public static Block blockHutBaker; public static void init() { blockHutBaker = new BlockHutBaker(); }
  10. protected BlockHutBaker() { super(Material.wood); //setBlockName(getName()); setUnlocalizedName(Constants.MOD_ID + "." + getName()); setCreativeTab(ModCreativeTabs.MINECOLONIES); setResistance(1000f); GameRegistry.registerBlock(this, getName()); this.setDefaultState(this.blockState.getBaseState().withProperty(FACING, EnumFacing.NORTH)); } Oh and here is the Inventory rendering stuff called: @Mod.EventHandler public void init(FMLInitializationEvent event) { proxy.registerRendering(); } The code with the model mesher itself is in the client proxy in the metod which is called above.
  11. Ok, thx. I got now the rotation working, but the item is still not rendered in the GUI and in the hand. And yes, the file is in the models/item folder: assets.minecolonies.models.item.blockHutBaker.json
  12. Hi, I'm wondering how I can render a block correct. It's not just a normal block with one texture, that would be easy. Thats what I got so far. My problem is now: How to do the rotation? I don't want the bread texture always looking in the same direction, it should show in the direction the block is rotated, too. So when the block gets rotated the texture, too. How to setup the rendering when holding the block in the hand and in the GUI? The code: Block class: Blockstates json: block json: item (or should I call it block item json ) json: register rendering: Thx in advance. Bektor
  13. Yep, I'm sure: world.setBlock(new net.minecraft.util.BlockPos.BlockPos(x, y, z), Blocks.chest);
  14. example for setBlock: The method setBlock(BlockPos, Block) is undefined for the type World So this does not seem to work. And then there are still some things with no xyz coords.
  15. Hi, I'm currently helping the MineColonies team to get their mod updated to 1.8.9, but I'm wondering a few things. Like in 1.7.10 they we got these methods: world.setBlock(x, y, , block, metadata, 0x03); world.setBlockMetadataWithNotify(x, y , z, metadata, 0x03); world.setBlock(coords.posX, coords.posY, coords.posZ, block); Vec3.createVectorHelper(x, y, z); citizenInventory.func_110133_a(message.name); (citizenInventory extends from InventoryBasic) world.isAirBlock(posX, posY, posZ); world.canBlockSeeTheSky(x, yHolder, z) Vec3.squareDistanceTo(x, y, z) MinecraftServer.getServer().func_152358_ax().func_152652_a(id); world.blockExists So, how to do this in 1.8.9? I think this should it be for the beginning. Thx in advance. Bektor EDIT: Oh, I forgot something. How do I do Entity Rendering in 1.8.9? I've got here some Entity code which extends from RenderBiped.
  16. Ok, thx. I just wasn't sure if its really checks the complete chunk because its named "isBlockLoaded". (Why not naming it "isChunkLoaded"?)
  17. I don't think that would work for me, because it just checks one block position, I think. I need such a check because I want that all my custom leaves disappear when the tree is chopped down. (I'm doing all this in onNeighborBlockChange)
  18. I always used it in that way: [...] this.setUnlocalizedName(getName()); GameRegistry.registerBlock(this, getName()); [...] public String getName() { return "sapling_golden"; } Is this still correct in Minecraft Forge 1.8.9?
  19. Hi, I'm wondering if there is any method in the World class to check if a chunk exists that I can use for my block? Thx in advance Bektor
  20. Ok, I got some progress: public class ItemModArmor extends ItemArmor { public ItemModArmor(String unlocalizedName, ArmorMaterial material, int renderIndex, int armorType) { super(material, renderIndex, armorType); this.setUnlocalizedName(unlocalizedName); this.setCreativeTab(KaktusMod.kaktusmodcreativetab); } @Override public void onArmorTick(World world, EntityPlayer player, ItemStack itemStack) { if(itemStack.getItem() == KaktusItems.itemModArmorHelmet) effectPlayer(player, Potion.waterBreathing, 0); } private void effectPlayer(EntityPlayer player, Potion potion, int amplifier) { if(player.getActivePotionEffect(potion) == null || player.getActivePotionEffect(potion).getDuration() <= 1) player.addPotionEffect(new PotionEffect(potion.id, 159, amplifier, true, true)); } @Override public String getArmorTexture(ItemStack stack, Entity entity, int slot, String type) { if(stack.getItem() == KaktusItems.itemModArmorHelmet) return Config.MODID + ":textures/models/armor/turtleArmorMaterial_layer_2.png"; else { return Config.MODID + ":textures/models/armor/turtleArmorMaterial_layer_1.png"; } } } I just wrote this code for testing purpose, so I wasn't able to fix the complete problem yet, but I got with that code 2 of 4 items shown in the CreativeTabs. For more details, I just uploaded the Code to your repository: https://github.com/DasKaktus/KaktusMod Here is a picture of it: I hope this helps a bit. Bektor
  21. Hm, for me it the items don't want to appear ingame in any CreativeTab, but the CreativeTab is using the helmet for the icon, so they should be loaded. But I wasn't able to find out why they don't appear in the CreativeTab... Oh and when you rename the class, you have to rename the file itself, too. <classname>.java public class <classname> So replace the <classname> with your classname and then both should be the same, the filename and the class name, except for the .java ending of the filename (besides that, I'm wondering if there are BB codes like [icode][/icode] here on the forum) Bektor
  22. Yep. I'm now installing your Forge version, could take a while. And I would recommend you to correct your class names: Java: Class names: first letter capitalized, example: Test package names: first letter small, example: test variable names: first letter small, example: test Just a small information for the future, because I saw one class which was different named. Bektor EDIT: hm, it seems to be that your Forge is a bit out of date: In your main class you are using Forge 1.8-11.14.3.1450, newest recommend build is 1.8-11.14.4.1563. EDIT 2: hm, for me there are no items, they just don't appear in the Game... going to track down the problem now EDIT 3: thats weird, how can the CreativeTab has access to an item which is never used... which does not appear in the game for me...
  23. Hm, maybe I can help. Going to look now in your repository, if I can find something I'll create a comment there. And how its messed up? Well... Example of my private (and free) Bitbucket repository: Do you see the difference? (not just more files) Bektor
  24. Thx. :D :D I didn't know that it was possible to get such links. Now its working perfectly on BitBucket! (yep, bitbucket got the feature, too, just replace the commit thing with the branch-name and change src to raw and its working on BitBucket, too, for anyone who's interested in knowing how I've done it.) But I find it funny, its showing me, there is a update available, but there is no update available, just no version in the Constants file, because the version will be added with my build.gradle, like in the mcmod.info, too Bektor
×
×
  • Create New...

Important Information

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