Jump to content

Whale Cancer

Members
  • Posts

    26
  • Joined

  • Last visited

Everything posted by Whale Cancer

  1. Hi Folks, I'm trying to remove vanilla biomes so that my world generates only with custom biomes. I assume the process is like removing recipes, but I can't figure it out. I use the following code to remove recipes: Iterator<IRecipe> iterator = CraftingManager.getInstance().getRecipeList().iterator(); while(iterator.hasNext()){ ItemStack r = iterator.next().getRecipeOutput(); //Remove Jack O lantern Recipe if(r != null && r.itemID == Block.pumpkinLantern.blockID) iterator.remove(); } I think you would need to look through BiomeGenBase[] biomeList and delete the biomes you don't want, but I'm not clear on how to do that. Thanks for any help in advance.
  2. The console information showing where it is trying to find the texture would be useful in figuring out the problem.
  3. You probably want to start by making a custom furnace, as that is a simple vanilla machine. Here is the first in a youtube tutorial series: http://www.youtube.com/watch?v=ZONhMz-oH9A. I have not followed this one yet, but his other stuff is good. Take a look over the playlist that includes that video before you get started (I just got burned following a tutorial on chest gui that the guy didn't finish after a few hours of video )
  4. My ParticleEffects class looks like this: However, I am not sure this is the problem. If I don't pass a velocity to the particles they spawn a bit over my flowers and a bit over my hive and just fall to the ground with no warping. When I do pass a velocity, they quickly warp to the appropriate location and then float back to their origin (that is, where they would spawn if I didn't give them a velocity). I don't/didn't think it had anything to do with my ParticleEffects class as this behavior is consistent with what happens to glyphs on the enchanting table in vanilla.
  5. @diesieben07 I assumed you meant super.renderParticle so I looked through that and found the logic that limited it to 8x8 textures. I tried making a custom tesselator class and changing that logic, but I ended up running into an error through making a non-static refrence to a static method (IIRC). I messed around with setParticleIcon and it seems to return 8x8 as well. It is currently used in vanilla to grab an 8x8 texture from the texture of a side of a block for the purpose of creating those little damage particles when you hit something.
  6. .rar files can use .zip compression and .rar has two unique compression formats (rar and rar5)
  7. Ok, so I've used the enchanting table particle effects to develop some bee particles that go back and forth between nearby flowers (it triggers way more often than it should right now for the purposes of testing). My problem is that - much like the vanilla enchanting table, which is much less noticeable - the particles spawn at their destination and then extremely quickly teleport to their origin before floating back to their destination at the desired speed. Here is my code: //randomly called to generate particles, adapted from BlockEnchantmentTable @SideOnly(Side.CLIENT) public void randomDisplayTick(World world, int x, int y, int z, Random random) { int sizeX = 5; int sizeZ = 5; super.randomDisplayTick(world, x, y, z, random); for (int targetX = x - sizeX; targetX <= x + sizeX; ++targetX){ for (int targetZ = z - sizeZ; targetZ <= z + sizeZ; ++targetZ){ if (targetX > x - 2 && targetX < x + 2 && targetZ == z - 1){ targetZ = z + 2; } if (random.nextInt(16) == 0){ for (int targetY = y; targetY <= y + 1; ++targetY){ if ((world.getBlockId(targetX, targetY, targetZ) == DoorMod.flower_allium.blockID) || (world.getBlockId(targetX, targetY, targetZ) == DoorMod.flower_bellflower.blockID) || (world.getBlockId(targetX, targetY, targetZ) == DoorMod.flower_chrysanthemum.blockID) || (world.getBlockId(targetX, targetY, targetZ) == DoorMod.flower_daisy.blockID) || (world.getBlockId(targetX, targetY, targetZ) == DoorMod.flower_echinacea.blockID) || (world.getBlockId(targetX, targetY, targetZ) == DoorMod.flower_ginger.blockID) || (world.getBlockId(targetX, targetY, targetZ) == DoorMod.flower_hibiscus.blockID) || (world.getBlockId(targetX, targetY, targetZ) == DoorMod.flower_houstonia.blockID) || (world.getBlockId(targetX, targetY, targetZ) == DoorMod.flower_hydrangea.blockID) || (world.getBlockId(targetX, targetY, targetZ) == DoorMod.flower_morningglory.blockID) || (world.getBlockId(targetX, targetY, targetZ) == DoorMod.flower_nasturtium.blockID) || (world.getBlockId(targetX, targetY, targetZ) == DoorMod.flower_orchid.blockID) || (world.getBlockId(targetX, targetY, targetZ) == DoorMod.flower_paeonia.blockID) || (world.getBlockId(targetX, targetY, targetZ) == DoorMod.flower_syringa.blockID) || (world.getBlockId(targetX, targetY, targetZ) == DoorMod.flower_tulip.blockID) || (world.getBlockId(targetX, targetY, targetZ) == DoorMod.flower_oxeyedaisy.blockID)){ // if (!world.isAirBlock((targetX - x) / 2 + x, targetY, (targetZ - z) / 2 + z)){ // break; // } double xVelocity = (double)((float)(targetX - x) + random.nextFloat()) - 0.5D; double yVelocity = (double)((float)(targetY - y) - random.nextFloat() - 1.0F); double zVelocity = (double)((float)(targetZ - z) + random.nextFloat()) - 0.5D; //originates from flowers but is reversed due to velocity ParticleEffects.spawnParticle("bee_1", targetX + 0.5D, targetY + 2.0D, targetZ + 0.5D, -xVelocity, yVelocity, -zVelocity); //originates from hive but is reversed due to velocity ParticleEffects.spawnParticle("bee_1", x + 0.5D, y + 2.0D, z + 0.5D, xVelocity, yVelocity, zVelocity); } } } } } } Here is a video to demonstrate the teleporting bee particles (apologies for TotalBiscuit in the background, didn't think to pause that video before recording). [embed=425,349] [/embed] Is this unavoidable when using particles? I really don't understand why it would be doing this if spawnParticle is simply accepting x, y, z coordinates and x, y, z velocities. Edit: Just noticed this behavior is noticeable even in the animated gif found in the wiki: http://hydra-media.cursecdn.com/minecraft.gamepedia.com/6/60/Enchantment_Table_animated_experience.gif[/img]
  8. No problem, always glad to help cocaine along. Also, in case you need to know, you can find the potion effects in Items.java. Just search for setPotionEffect and you will find them all.
  9. Not sure about making it edible while full (though why you would make cocaine a food that you can eat rather than just a straight out potion effect is beyond me). Here is an example of a food that poisons you: carrotPoisonous = new ItemFood(IDtracker, 1, false).setPotionEffect(Potion.poison.id, 5, 0, 1.0F).setUnlocalizedName("carrot_poisonous").setTextureName(modPath + "carrot_poisonous"); Just use that ".setPotionEffect" to add effects to your food.
  10. Been playing around with particle effects for a few hours now and I've been trying to understand how getTextureManager.bindTexture works when setting the texture of the particle. Here is bindTexture: public void bindTexture(ResourceLocation par1ResourceLocation) { Object object = (TextureObject)this.mapTextureObjects.get(par1ResourceLocation); if (object == null) { object = new SimpleTexture(par1ResourceLocation); this.loadTexture(par1ResourceLocation, (TextureObject)object); } TextureUtil.bindTexture(((TextureObject)object).getGlTextureId()); } I can't really see where in that code it would limit the texture to 8x8, so I must be looking in the wrong place? I believe this is the only relevant section of my mod for the actual setting of the texture of the particle (other than the actual spawning of the particle stuff, which all works): @Override @SideOnly(Side.CLIENT) public void renderParticle(Tessellator tessellator, float par2, float par3, float par4, float par5, float par6, float par7){ tessellator.draw(); Minecraft.getMinecraft().getTextureManager().bindTexture(new ResourceLocation("doormod:textures/particle/custom_particles.png")); tessellator.startDrawingQuads(); tessellator.setBrightness(200); super.renderParticle(tessellator, par2, par3, par4, par5, par6, par7); tessellator.draw(); Minecraft.getMinecraft().getTextureManager().bindTexture(new ResourceLocation("textures/particle/custom_particles.png")); tessellator.startDrawingQuads(); } If I am not mistaken, par2 through par7 are just the origin and motion of the particle and tessellator only has to do with rendering the particle and nothing to do with setting the texture. So... any help or direction? Thanks in advance!
  11. Just set up a Techne ladder and, during the process of making it work like a ladder, I noticed ladders use 2, 3, 4, and 5 as their metadata for facing. That is probably why you have it set up like that. Just something I noticed that might be useful. Edit: Also, this is cool:
  12. EntityLiving != EntityLivingBase Your function is not identical to the function in the Block class (which is why the @Override is throwing an error and why the function is not being called). Not variable name, variable type. Great! Now I don't have to use those messy variable names. Really, I am just going through every idea I have and making sure I can implement them; so, this is basically a learning process. I've done a whole bunch of stuff like pillars that change their textures so the top and bottom look like a pillar (will probably re-do those as techne models), overridden default recipes to add stuff (got rid of vanilla door and added doors for each wood), custom crops, custom mushrooms, etc., I think this is a good way to learn before getting into modding and I've done this process for other games I've done modding in (zDoom, Terraria, FTL, etc.,) This model is just a table decoration with an arrow on it for debugging. Going to make it extend into a long 2 block table when another table is placed next to it in the way vanilla chests behave. Also, THANK YOU EVERYONE. Here is the fruit of our endeavors:
  13. Ahh, figured it out. You need to use the same variable names and not just the same variable order. Heh. Didn't think of this as this is not the way it works in C#, if I recall correctly.
  14. I did try to override, but I get the error "The method onBlockPlacedBy(World, int, int, int, EntityLiving, ItemStack) of type BlockCustomTable must override or implement a supertype method" despite this being a method found in Block. I had eclipse auto-add the method to block just to compare them, and they appear to be the exact same thing.
  15. Hmm, ok, thanks for letting me know it is not an issue with the function (isn't it a method?) being used. I think I might delete everything and just try again from scratch. I'll also try 'onBlockAddedToWorld' You are talking about Mecblader's solution, right? As onBlockPlacedBy is called when the block is placed by a living entity, right? @Mecblader I have been trying to learn from the 'tutorials' on using techne models. The problem is that they are often like throwing you into the deep end of a pool, there is no slower build up or explanation of smaller bits of code. My main problem is not understanding much of the GL11 functions. I think I'll break it down even simpler and perhaps assign a random metadata between 0-3 and assign rotation based on that. And then move on to have its rotation based on the facing of the placing player. This seems like a way to learn as I already understand how to place a static techne model-as-block. EDIT: Ok, ROTATION WORKS! The problem is only with setting the metadata. If i set a given metadata when I right click the model, it will rotate it appropriately. Even if I try to just set a static value in my onBlockPlacedBy it does not work... i.e. public void onBlockPlacedBy(World world, int x, int y, int z, EntityLiving entityLiving, ItemStack par6ItemStack){ world.setBlockMetadataWithNotify(x, y, z, 2, 2); } This does not work. However, if I set the metadata to 2 using the onBlockActivated it does work. So clearly I am doing something wrong in onBlockPlacedBy.
  16. Yeah, after spending a few hours to figure something out I figure it is time to go to the forums and stop wasting effort. So, thanks for the help! As for actually trying to implement your solution, I am having trouble setting the metadata of the block. I've added a onActivated text message to query the metadata, and it is always 0. Here is my attempt to set the metadata of the block: public void onBlockPlacedBy(World world, int i, int j, int k, EntityLiving entityLiving){ int rotation = MathHelper.floor_double((double)(entityLiving.rotationYaw * 4.0F / 360.0F) + 0.5D) & 3; world.setBlockMetadataWithNotify(i, j, k, rotation, 2); } I am pretty sure that the i, j, k are the coordinates of the entityLiving (player) that drops the block rather than the block itself (so, always 0 since the block the player is in is air). Is this the case? If so, how do I reference the actual dropped block? Any help?
  17. Congratulations*, you're not helpful! I went through a lot of tutorials to even get the model working. None of them actually explained anything. I'm just looking for some help.
  18. I can't seem to get my techne models-as-blocks to be properly rotated when they are placed by the player. No matter what I've tried, the model will not rotate. I think my problem is in public void onBlockPlacedBy. Any help greatly appreciated. Here is my block class: package whalecraft.doors; import net.minecraft.block.BlockContainer; import net.minecraft.block.material.Material; import net.minecraft.client.renderer.texture.IconRegister; import net.minecraft.creativetab.CreativeTabs; import net.minecraft.entity.EntityLiving; import net.minecraft.tileentity.TileEntity; import net.minecraft.util.MathHelper; import net.minecraft.world.World; public class BlockCustomTable extends BlockContainer { public BlockCustomTable(int par1, Material material) { super(par1, material); this.setCreativeTab(CreativeTabs.tabDecorations); this.setHardness(20.0F); this.setResistance(0.4F); //this.setLightValue(0.1F); } //Make sure you set this as your TileEntity class relevant for the block! @Override public TileEntity createNewTileEntity(World world) { return new TileEntityTableWoodLight(); } //You don't want the normal render type, or it wont render properly. @Override public int getRenderType() { return -1; } //It's not an opaque cube, so you need this. @Override public boolean isOpaqueCube() { return false; } //It's not a normal block, so you need this too. public boolean renderAsNormalBlock() { return false; } //This is the icon to use for showing the block in your hand. public void registerIcons(IconRegister iconRegister) { this.blockIcon = iconRegister.registerIcon("doormod:table_wood_light"); } public void onBlockPlacedBy(World world, int i, int j, int k, EntityLiving entityLiving){ int rotation = MathHelper.floor_double((double)((entityLiving.rotationYaw * 4.0f) / 360F) + 2.5D) & 3; } } Here is the renderer class: package whalecraft.doors; import org.lwjgl.opengl.GL11; import net.minecraft.block.Block; import net.minecraft.client.Minecraft; import net.minecraft.client.renderer.OpenGlHelper; import net.minecraft.client.renderer.Tessellator; import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer; import net.minecraft.entity.Entity; import net.minecraft.tileentity.TileEntity; import net.minecraft.util.ResourceLocation; import net.minecraft.world.World; public class TileEntityTableWoodLightRenderer extends TileEntitySpecialRenderer { private final ModelTable model; public TileEntityTableWoodLightRenderer() { this.model = new ModelTable(); } private void adjustRotatePivotViaMeta(World world, int x, int y, int z) { int meta = world.getBlockMetadata(x, y, z); GL11.glPushMatrix(); GL11.glRotatef(meta * (-90), 0.0F, 0.0F, 1.0F); GL11.glPopMatrix(); } @Override public void renderTileEntityAt(TileEntity te, double x, double y, double z, float scale) { GL11.glPushMatrix(); GL11.glTranslatef((float) x + 0.5F, (float) y + 1.5F, (float) z + 0.5F); ResourceLocation textures = (new ResourceLocation("doormod:/textures/entity/table_wood_light.png")); Minecraft.getMinecraft().renderEngine.bindTexture(textures); GL11.glPushMatrix(); GL11.glRotatef(180F, 0.0F, 0.0F, 1.0F); this.model.render((Entity)null, 0.0F, 0.0F, -0.1F, 0.0F, 0.0F, 0.0625F); GL11.glPopMatrix(); GL11.glPopMatrix(); } private void adjustLightFixture(World world, int i, int j, int k, Block block) { Tessellator tess = Tessellator.instance; float brightness = block.getBlockBrightness(world, i, j, k); int skyLight = world.getLightBrightnessForSkyBlocks(i, j, k, 0); int modulousModifier = skyLight % 65536; int divModifier = skyLight / 65536; tess.setColorOpaque_F(brightness, brightness, brightness); OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, (float) modulousModifier, divModifier); } }
  19. I've coded a mushroom that starts as 1 block but grows to 2 eventually. This worked when I was comparing 'simple' strings but now that I want to move to using a more complicated string (by adding 2 strings together) it fails to trigger. Here is the part where the strings are compared: if(l==3 && par1World.getFullBlockLightValue(parX, parY, parZ) <= 11) { ModLoader.getMinecraftInstance().thePlayer.addChatMessage("trying to create top block of a mushroom, the texture name is " + this.textureName); if (this.textureName == new String (modPath + "mushroom_poisonous")) { ModLoader.getMinecraftInstance().thePlayer.addChatMessage("trying to create top block of a poison mushroom"); par1World.setBlock(parX, parY+1, parZ, FoodMod.mushroomPoisonousTop.blockID); } Here is my declaration of modPath: public static String modPath = "foodmod:"; Here is a screenshot showing the report of what this.textureName is: (ignore the fact there is one tall mushroom there, that is a leftover from when it worked) You'll notice the chat message inside the if statement wasn't triggered. I'm totally stumped as to why that if statement isn't triggering. It is probably something small and stupid that a fresh pair of eyes could find easily. Thanks in advance.
  20. I think you may be on to something, TheGreyGhost. I actually noticed that the wireframe which shows the door actually only shows the bottom block of the door. Perhaps the top door block is not being created and, because of the render type, it doesn't render the bottom block (as it isn't next to another block with the same ID) and the top block just doesn't exist at all. I'm not sure why the top block isn't being created (if that is the problem), but I feel like I am getting closer... EDIT: Figured this out. Will post a tutorial on doors tomorrow as I, obviously, couldn't find one myself. Save some people some trouble.
  21. To be clear, it has no texture; not even the missing texture. I have looked at the getIcon and registerIcon method. As I said above, BlockDoor registers the block's texture by combining the door's material as well as "_lower" and "_upper"; even if I use the materials the in vanilla - wood and iron - I have the same problem. Here is how I call (invoke?) my custom class. stoneDoor = new BlockCustomDoor(1016, Material.wood).setUnlocalizedName("door_wood").setTextureName("door_wood").setCreativeTab(CreativeTabs.tabBlock); And this is my BlockCustomDoor class package whalecraft; import net.minecraft.block.Block; import net.minecraft.block.BlockDoor; import net.minecraft.block.material.Material; public class BlockCustomDoor extends BlockDoor { protected BlockCustomDoor(int par1, Material par2Material) { super(par1, par2Material); // TODO Auto-generated constructor stub } }
  22. Ah, okay, thanks. So that isn't my problem, then.
  23. This is all AFAIK. BlockDoor creates a door by looking at the material you pass into it. It creates either an iron or wood door in vanilla by combining some strings to create the top and bottom texture name (and then flipping them for the opposite side). Even if I pass wood as my material (which I think should just result in a wood door), my door still does appear untextured in the game world. It can be placed, but you can only see a frame if you move your mouse over it. The only difference between how I call my BlockCustomDoor class and how it vanilla does it is I cannot get "disableStats()" to work. I thought "Block.disableStats()" would work, but that is not the case. I really don't understand what "disableStats()" and if that is my problem.
  24. Bumping this thread as this is the exact same question I have. I've played around with BlockDoor but to no avail.
×
×
  • Create New...

Important Information

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