Jump to content
Search In
  • More options...
Find results that contain...
Find results in...

Lylac

Members
  • Posts

    12
  • Joined

  • Last visited

Everything posted by Lylac

  1. Original Post: http://devchat.devolio.net/ This site is now three weeks old. Fairly new, but there's hundreds of people in there. You can get live chat support by going to any of the channels. Infact I decided to make a #minecraft_modding channel. Thats the name of it btw. Ps: should I post this in modder support too?
  2. Actually, getting rid of that stopped it. Also side note, it's a float int. Setting it to 15 with what I had there set the light level way beyond normal means. Using a value of 0.27F will set it to emit a level of 4, which adds a nice effect to the crust block. https://31.media.tumblr.com/1138f965af97e191009dd369b1c84d1d/tumblr_n5z82jAMGJ1tnzqt4o1_500.png[/img] Is it too much that I am facinated by this? I mean this should be in the game.
  3. it took me a while, but I doubled face palmed myself when I saw it. back to messing around...
  4. That works, but I want the crust to melt at a light level of 14. (sorry for not clarifying before). There doesn't seem to be much for documentation out there on how ice works.
  5. I'm developing a new block called crust. Basically it's the equivalent of ice melting to water where as crust melts to lava. It also has the properties of soulsand and netherrack, but I can't get it to stop melting into lava. Thoughts? package com.lylac.podmod.block; import static net.minecraftforge.common.util.ForgeDirection.UP; import java.util.Random; import net.minecraft.block.Block; import net.minecraft.block.BlockBreakable; import net.minecraft.block.material.Material; import net.minecraft.creativetab.CreativeTabs; import net.minecraft.enchantment.EnchantmentHelper; import net.minecraft.entity.Entity; import net.minecraft.entity.EntityLiving; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.init.Blocks; import net.minecraft.item.ItemStack; import net.minecraft.stats.StatList; import net.minecraft.util.AxisAlignedBB; import net.minecraft.util.DamageSource; import net.minecraft.world.EnumSkyBlock; import net.minecraft.world.World; import net.minecraftforge.common.util.ForgeDirection; import com.lylac.podmod.PODmod; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; public class Crust extends BlockBreakable{ public Crust(int id) { super("Crust", Material.rock, false); setHardness(0.5F); setLightOpacity(15); setStepSound(soundTypeStone); setBlockTextureName(PODmod.MODID + ":crust"); setCreativeTab(CreativeTabs.tabBlock); this.setTickRandomly(true); } /** * Currently only called by fire when it is on top of this block. * Returning true will prevent the fire from naturally dying during updating. * Also prevents firing from dying from rain. * * @param world The current world * @param x The blocks X position * @param y The blocks Y position * @param z The blocks Z position * @param metadata The blocks current metadata * @param side The face that the fire is coming from * @return True if this block sustains fire, meaning it will never go out. */ public boolean isFireSource(World world, int x, int y, int z, ForgeDirection side) { if (this == PODmod.Crust && side == UP) { return true; } return false; } /** * Soul Sand Code ~ For Slowness */ /** * Returns a bounding box from the pool of bounding boxes (this means this box can change after the pool has been * cleared to be reused) */ public AxisAlignedBB getCollisionBoundingBoxFromPool(World p_149668_1_, int p_149668_2_, int p_149668_3_, int p_149668_4_) { float f = 0.125F; return AxisAlignedBB.getAABBPool().getAABB((double)p_149668_2_, (double)p_149668_3_, (double)p_149668_4_, (double)(p_149668_2_ + 1), (double)((float)(p_149668_3_ + 1) - f), (double)(p_149668_4_ + 1)); } /** * Triggered whenever an entity collides with this block (enters into the block). Args: world, x, y, z, entity */ public void onEntityCollidedWithBlock (World par1World, int x, int y, int z, Entity entity) { if (entity instanceof EntityPlayer) { //ItemStack stack = ((EntityPlayer) entity).inventory.getStackInSlot(36); //if (stack == null) entity.attackEntityFrom(DamageSource.inFire, 1); } else if (entity instanceof EntityLiving && !entity.isImmuneToFire()) { entity.attackEntityFrom(DamageSource.inFire, 1); } entity.motionX *= 0.1D; entity.motionZ *= 0.1D; } /** * Ice Block Code ~ Melting into lava */ /** * Returns which pass should this block be rendered on. 0 for solids and 1 for alpha */ @SideOnly(Side.CLIENT) public int getRenderBlockPass() { return 0; } /** * Called when the player destroys a block with an item that can harvest it. (i, j, k) are the coordinates of the * block and l is the block's subtype/damage. */ public void harvestBlock(World p_149636_1_, EntityPlayer p_149636_2_, int p_149636_3_, int p_149636_4_, int p_149636_5_, int p_149636_6_) { p_149636_2_.addStat(StatList.mineBlockStatArray[block.getIdFromBlock(this)], 1); p_149636_2_.addExhaustion(0.025F); if (this.canSilkHarvest(p_149636_1_, p_149636_2_, p_149636_3_, p_149636_4_, p_149636_5_, p_149636_6_) && EnchantmentHelper.getSilkTouchModifier(p_149636_2_)) { ItemStack itemstack = this.createStackedBlock(p_149636_6_); if (itemstack != null) { this.dropBlockAsItem(p_149636_1_, p_149636_3_, p_149636_4_, p_149636_5_, itemstack); } } else { if (p_149636_1_.provider.isHellWorld)//dont need this { p_149636_1_.setBlockToAir(p_149636_3_, p_149636_4_, p_149636_5_); return; } int i1 = EnchantmentHelper.getFortuneModifier(p_149636_2_); this.dropBlockAsItem(p_149636_1_, p_149636_3_, p_149636_4_, p_149636_5_, p_149636_6_, i1); Material material = p_149636_1_.getBlock(p_149636_3_, p_149636_4_ - 1, p_149636_5_).getMaterial(); if (material.blocksMovement() || material.isLiquid()) { p_149636_1_.setBlock(p_149636_3_, p_149636_4_, p_149636_5_, Blocks.flowing_lava); } } } /** * Returns the quantity of items to drop on block destruction. */ public int quantityDropped(Random p_149745_1_) { return 0; } /** * Ticks the block if it's been scheduled */ public void updateTick(World p_149674_1_, int p_149674_2_, int p_149674_3_, int p_149674_4_, Random p_149674_5_) { if (p_149674_1_.getSavedLightValue(EnumSkyBlock.Block, p_149674_2_, p_149674_3_, p_149674_4_) > 11 - this.getLightOpacity()) { if (p_149674_1_.provider.isHellWorld)//dont need this { p_149674_1_.setBlockToAir(p_149674_2_, p_149674_3_, p_149674_4_); return; } this.dropBlockAsItem(p_149674_1_, p_149674_2_, p_149674_3_, p_149674_4_, p_149674_1_.getBlockMetadata(p_149674_2_, p_149674_3_, p_149674_4_), 0); p_149674_1_.setBlock(p_149674_2_, p_149674_3_, p_149674_4_, Blocks.lava); } } /** * Returns the mobility information of the block, 0 = free, 1 = can't push but can move over, 2 = total immobility * and stop pistons */ public int getMobilityFlag() { return 0; } } (Sorry, img snippets don't seem to be working at the time of the post. Here is a link instead. Mind the texture bug, I'll have that fixed soon.) https://24.media.tumblr.com/a1e594ad41b2a9807522ebfd59297ce9/tumblr_n5h217toyg1tnzqt4o1_500.png
  6. I'm not sure what I can do myself since I'm pretty new here too. There is a way to override minecraft files in 1.7.2 and force this fix upon the vanilla bed, but you'd have to create a new bed class to do it. I can put in a new suggestion for this after I go back to the door bug; I'm sure it's the same as the bed texture just the coding is different.
  7. @SideOnly(Side.CLIENT) public IIcon getIcon(int p_149691_1_, int p_149691_2_) { if (p_149691_1_ == 0) { return Blocks.planks.getBlockTextureFromSide(p_149691_1_); } else { int k = getDirection(p_149691_2_); int l = Direction.bedDirection[k][p_149691_1_]; int i1 = isBlockHeadOfBed(p_149691_2_) ? 1 : 0; if (i1 == 1 && l == 2) { return this.field_149980_b[i1]; } else if (i1 == 0 && l == 3) { return this.field_149980_b[i1]; } else switch (l) { case 1: return this.field_149983_N[i1]; case 2: return this.field_149982_O[i1]; <--Dummy case 3: return this.field_149982_O[i1]; <--Dummy case 4: return (k == 2 ? this.field_149982_M[i1] : (k == 1 ? this.field_149982_M[i1] : new IconFlipped(this.field_149982_M[i1], true, false))); case 5: return (k == 3 ? this.field_149982_M[i1] : (k == 0 ? this.field_149982_M[i1] : new IconFlipped(this.field_149982_M[i1], true, false))); default: return this.field_149983_N[i1]; } } } ~~~~~~~~~~~~~~~~~~~~~ return (i1 != 1 || l != 2) && (i1 != 0 || l != 3) ? (l != 5 && l != 4 ? this.field_149983_N[i1] : ( l !=5 ? (k == 2 ? this.field_149982_M[i1] : (k == 1 ? this.field_149982_M[i1] : new IconFlipped(this.field_149982_M[i1], true, false))) : (k == 3 ? this.field_149982_M[i1] : (k == 0 ? this.field_149982_M[i1] : new IconFlipped(this.field_149982_M[i1], true, false))))) : this.field_149980_b[i1]; in BlockBed.class replace this.field_149982_M[i1] with: ( l !=5 ? (k == 2 ? this.field_149982_M[i1] : (k == 1 ? this.field_149982_M[i1] : new IconFlipped(this.field_149982_M[i1], true, false))) : (k == 3 ? this.field_149982_M[i1] : (k == 0 ? this.field_149982_M[i1] : new IconFlipped(this.field_149982_M[i1], true, false)))) https://31.media.tumblr.com/3f23ae0b31f4d8d9404cadc2ae203b21/tumblr_n5a3xxv8Ki1tnzqt4o1_1280.png[/img] https://31.media.tumblr.com/95ac18c286c1e8253814bbcd8692c864/tumblr_n5a3xxv8Ki1tnzqt4o2_1280.png[/img] After much trial and error I fixed the texture bug. When I made the switch case statement in the notes/code above it helped me realize that the broken textures could not use the int i1 and l alone. Thanks to grey I was then able to use int k to work out a solution and found out how bed are truly rendered. The way beds are rendered is that l is used to handle the stored values of the sides of a bed depending how a bed is placed; 0, 1, 2, 3, 4, and 5 are stored in 4 arrays that correspond to the four directions in minecraft. 0 and 1 are the bottom and top, 2 and 3 are the ends, and 4 and 5 are used for the sides of a bed. Cases 4 and 5 (refer to the switch statement) handle how to render the textures for the sides of the bed and use k to do just that. k determines where the bed is facing when placed by a player. Using k it became easy to sort out the integers and fix the problem. for example, lets say the player is facing north at a side of a bed which has a value of 5, and the bed is facing south which is 0. using the notes from my last post we can find out which side l needs to store by using bedDirection and going 0 over and then 5 over starting from 0. so that gives l 4; k is 0, and the i1 is the head of the bed which is 1. using the switch statement here as a guide is an advantage, but if you are someone new to coding then I suggest learning boolean equations quickly as it is an easy subject. So now our side is a case 4 here, its k is not equal to 2 nor 1, so it will render as a flipped icon of the head side part of the bed texture. I only get 1 day a week to work on my mod as I am working on other cool stuff in the mean time, so generally this took me about 3 days to get. I hope you found this useful.
  8. Player is facing WEST Side = 5 Bed Direction = 2? Head of Bed = -190, 4, 1301 Feet of Bed = -190, 4, 1302 [bed Direction][side] public static final int[][] bedDirection = new int[2][5] {{1, 0, 3, 2, 5, 4}, {1, 0, 5, 4, 2, 3}, {1, 0, 2, 3, 4, 5}, {1, 0, 4, 5, 3, 2}}; public IIcon getIcon(int Side, int (Bed Direction)) if (5 == 0) FALSE (Side == 0) { return Blocks.planks.getBlockTextureFromSide(p_149691_1_); } else { int k = getDirection(0); BedDirection int l = Direction.bedDirection[2][5]; int l = 5 int i1 = isBlockHeadOfBed(TRUE) ? 1 : 0; = 1 return (i1 != 1 FALSE || l != 2 TRUE) TRUE && (i1 != 0 TRUE || l != 3 TRUE) TRUE = TRUE ? (l != 5 FALSE && l != 4 TRUE = FALSE ? this.field_149983_N[i1] : this.field_149982_M[i1]) : this.field_149980_b[i1]; Field M[1] } } i1 != 1 ~ Checks if face is on Head FALSE l != 2 ~ Checks if face is on north side TRUE TRUE i1 != 0 ~ Checks if face is on foot TRUE l !=3 ~ Checks if face is on south side TRUE TRUE TRUE l != 5 ~ Checks if face is either on east side FALSE l != 4 ~ Checks if face is either on west side TRUE FALSE l == 5 ~ Checks if face is either on east side TRUE l != 4 ~ Checks if face is either on west side TRUE TRUE (i1 != 1 || l != 2) && (i1 != 0 || l != 3) ? (l != 5 && l != 4 ? N : M) : b <-- Old (i1 != 1 || l != 2) && (i1 != 0 || l != 3) ? (l != 5 && l != 4 ? N : (l == 5 && l !=4) ? M : O) : b <-- New Field O[1] ~~~~~~~~~~~~~~~ @SideOnly(Side.CLIENT) private IIcon[] field_149982_O; return (i1 != 1 || l != 2) && (i1 != 0 || l != 3) ? (l != 5 && l != 4 ? this.field_149983_N[i1] : (l ==5 && l !=4) ? this.field_149982_M[i1] : this.field_149982_O[i1]) : this.field_149980_b[i1]; this.field_149982_O = new IIcon[] {p_149651_1_.registerIcon(PODmod.MODID+":"+this.getTextureName()+"_feet_side"), p_149651_1_.registerIcon(PODmod.MODID+":"+this.getTextureName()+"_head_side")}; From what I gathered, with help from you guys, I've been able to come up with a new part to add to the ternary operator equation here. The old one did not have the support for 8 faces needed for the bed. That was the first problem to the bug, and now with a fourth line added to render the bugged side of the bed comes the second problem. The textures need to be flipped with IconFlipped(). I'm still new to modding, so I'm not really sure how to implement IconFlipped() into field O. I'll keep looking in BlockDoor.Class, but hopefully something comes up. Thanks for helping so far
  9. There isn't a fix for this vanilla bug in forge yet, so I'm making do with a temp fix and got stuck along the way. If you know of something that could help with this please reference it down below. Based on google search, I've hardly found any documentation relating to this texture bug, and it would help the populace out. I've been digging around in these files: BlockBed.class, BlockDirectional.class, Block.class, Direction.class, and ItemBed.class to understand how beds render their textures. To my understanding, the bed takes the side of the block and the coords of the block itself and it is able to assign a texture using those four integers(1 for side, and 3 for coords) Here is the code for the texturing of the bed: @SideOnly(Side.CLIENT) public IIcon getIcon(int p_149691_1_, int p_149691_2_) { if (p_149691_1_ == 0) { return Blocks.planks.getBlockTextureFromSide(p_149691_1_); } else { int k = getDirection(p_149691_2_); int l = Direction.bedDirection[k][p_149691_1_]; int i1 = isBlockHeadOfBed(p_149691_2_) ? 1 : 0; return (i1 != 1 || l != 2) && (i1 != 0 || l != 3) ? (l != 5 && l != 4 ? this.field_149983_N[i1] : this.field_149982_M[i1]) : this.field_149980_b[i1]; } } @SideOnly(Side.CLIENT) public void registerBlockIcons(IIconRegister p_149651_1_) { this.field_149983_N = new IIcon[] {p_149651_1_.registerIcon(this.getTextureName() + "_feet_top"), p_149651_1_.registerIcon(this.getTextureName() + "_head_top")}; this.field_149980_b = new IIcon[] {p_149651_1_.registerIcon(this.getTextureName() + "_feet_end"), p_149651_1_.registerIcon(this.getTextureName() + "_head_end")}; this.field_149982_M = new IIcon[] {p_149651_1_.registerIcon(this.getTextureName() + "_feet_side"), p_149651_1_.registerIcon(this.getTextureName() + "_head_side")}; } And my Snippet of that code. Im using this to understand the math behind this. Player is facing south Side = 2 Coords = -190, 4, 1301 Head of Bed = -190, 4, 1301 Feet of Bed = -190, 4, 1302 public IIcon getIcon(int 3, int (-190, 4, 1301)) { if (2 == 0) FALSE { return Blocks.planks.getBlockTextureFromSide(p_149691_1_); } else { int k = getDirection((-190, 4, 1301)); int l = Direction.bedDirection[k][2]; int i1 = isBlockHeadOfBed(-190, 4, 1301) ? 1 : 0; TRUE : 1 return (1 != 1 FALSE || l != 2) && (i1 != 0 || l != 3) ? (l != 5 && l != 4 ? this.field_149983_N[i1] : this.field_149982_M[i1]) : this.field_149980_b[i1]; } } In this I am using the north direction of the block which is bed_head_end.png. It's also the Head of the bed as well. But the part I'm stuck at is Direction.bedDirection[k][2]; where it takes the coords of the bed and the side too and somehow compares that to a number. Thoughts? Advice?
×
×
  • Create New...

Important Information

By using this site, you agree to our Privacy Policy.