Jump to content

saxon564

Forge Modder
  • Posts

    490
  • Joined

  • Last visited

  • Days Won

    1

Everything posted by saxon564

  1. I did, the only thing I saw running relating to my mod was ore gen, which was finished before this issue started happening.
  2. I have checked my code for any infinite loops, and there are none. The server isn't running any processes related to what I was doing when this started happening. I don't know what it would be getting caught on if it's a loop.
  3. The issue I am running into is, when I go to load a world, if it's a new world, it will never load, or an existing world, it will load, but once it loads, nothing seems to get ticked. In the instance of the already existing world, I can move, but no new chunks will be loaded, blocks will not update, AIs don't run, simply put the only thing the game runs is me. I have tried reinstalling the eclipse setup and setting up the workspace again, neither of these have fixed the problem. I am running forge 1.8 1336 currently but it wasn't until yesterday that i started having this issue. There are no errors showing up in console either, so I have no idea what is really causing this. heres the console logs:
  4. Thanks! That worked! now onto generating it in the world, wish me luck!
  5. Pretty self explanatory, I know the issue is the 'Decayable" property is not getting set to true, but for some reason, even when I try to force it to be true, it remains false. Leaf class here Sapling class here Tree generator class here All these classes are on github so they are easier to read. Does anyone have any idea as to why the leaves are not being set with Decayable true?
  6. Ok, I'll look into that more. The final issue I'm having at the moment is the leaves aren't decaying. For some reason, even when i default it, the property Decayable is always false.
  7. good to hear!
  8. ok, cool. I added a call to setGraphicsLevel to the updateTick method. Now the issue with rendering I'm having is, if you swap your graphics setting to fast is on fancy or vica versa, the render of the block doesn't update. I have tried everything I can think of to try and cause the leaves to update their texture. The only way I have been able to get their render to update has been by placing a block next to them.
  9. Though it is possible, it is unlikely, and even so, they will not be moving much faster than 1 block/tick. There are a couple ways to combat this, but first I am going to explain the reason behind why it is doing this. Light source blocks do not update themselves when block lights around them update. couple this with the sprint jumping where you can create light blocks in a diagonal fashion, you are creating light blocks that simply aren't getting updated by the code again. the ways you can combat this is to update the players last position, the problem here is that the players last position can change by 0.1 blocks, so if they go through 1054.05, 80.34, 164.56 the block that get lit will be 1054, 80, 164 then they go to 1055.01, 79, 164 just before the tick update so that is their last position according to Minecraft, and it ends up trying to update 1055, 79, 164 instead of 1054, 80, 164. The other way would be to update all 26 blocks around the players location. This would probably by your best option when using light on a player. I would also suggest possibly setting a "last_block_lit" variable and updating the last lit block before creating the new source, this would help with updating stray block create due to teleportation.
  10. Good to know. Be sure to let me know when you release your mod so I can check it out
  11. I know for fact it works since i just tested and made sure. I dont know why i was thinking max light level was 16. Lol
  12. doing some testing with my code, I realized the error, change the 16 to 15 and it will work.
  13. ok, thanks. That helped. Now I'm working on the leaf and can't seem to get it to render transparency like normal leaves. I have crossed it with all 3 of the classes for normal leaves, and the block is always rendering solid. I've even tried doing isOpaqueCube(){return false;} instead of using the fancyGraphics variable, and that didn't do anything. package com.teamrune.symbology.blocks; import java.util.List; import java.util.Random; import net.minecraft.block.Block; import net.minecraft.block.BlockLeavesBase; import net.minecraft.block.material.Material; import net.minecraft.block.properties.IProperty; import net.minecraft.block.properties.PropertyBool; import net.minecraft.block.state.BlockState; import net.minecraft.block.state.IBlockState; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.util.BlockPos; import net.minecraft.util.EnumParticleTypes; import net.minecraft.util.EnumWorldBlockLayer; import net.minecraft.world.IBlockAccess; import net.minecraft.world.World; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; import com.teamrune.symbology.Symbology; public class BlockAshLeafBlock extends BlockLeavesBase implements net.minecraftforge.common.IShearable { public static final PropertyBool DECAYABLE = PropertyBool.create("decayable"); public static final PropertyBool CHECK_DECAY = PropertyBool.create("check_decay"); int[] surroundings; @SideOnly(Side.CLIENT) protected int iconIndex; @SideOnly(Side.CLIENT) protected boolean isTransparent; public BlockAshLeafBlock() { super(Material.leaves, false); setCreativeTab(Symbology.symbologyTab); setUnlocalizedName("ash_leaves"); this.setHardness(0.2F); this.setLightOpacity(1); this.setStepSound(soundTypeGrass); this.setTickRandomly(true); } @SideOnly(Side.CLIENT) public EnumWorldBlockLayer getBlockLayer() { return this.isTransparent ? EnumWorldBlockLayer.CUTOUT_MIPPED : EnumWorldBlockLayer.SOLID; } @Override public boolean isOpaqueCube() { return !this.fancyGraphics; } @Override public boolean isFullCube() { return true; } @Override public int getRenderType() { return 3; } public IBlockState getStateFromMeta(int meta) { System.out.println(isTransparent); return this.getDefaultState().withProperty(DECAYABLE, Boolean.valueOf(meta == 0)).withProperty(CHECK_DECAY, Boolean.valueOf(meta > 0)); } public int getMetaFromState(IBlockState state) { byte b0 = 0; int i = b0; if (!((Boolean)state.getValue(DECAYABLE)).booleanValue()) { i = 0; } if (((Boolean)state.getValue(CHECK_DECAY)).booleanValue()) { i = 1; } return i; } public void breakBlock(World worldIn, BlockPos pos, IBlockState state) { byte b0 = 1; int i = b0 + 1; int j = pos.getX(); int k = pos.getY(); int l = pos.getZ(); if (worldIn.isAreaLoaded(new BlockPos(j - i, k - i, l - i), new BlockPos(j + i, k + i, l + i))) { for (int i1 = -b0; i1 <= b0; ++i1) { for (int j1 = -b0; j1 <= b0; ++j1) { for (int k1 = -b0; k1 <= b0; ++k1) { BlockPos blockpos1 = pos.add(i1, j1, k1); IBlockState iblockstate1 = worldIn.getBlockState(blockpos1); if (iblockstate1.getBlock().isLeaves(worldIn, blockpos1)) { iblockstate1.getBlock().beginLeavesDecay(worldIn, blockpos1); } } } } } } protected BlockState createBlockState() { return new BlockState(this, new IProperty[] { CHECK_DECAY, DECAYABLE }); } public void updateTick(World worldIn, BlockPos pos, IBlockState state, Random rand) { if (!worldIn.isRemote) { if (((Boolean)state.getValue(CHECK_DECAY)).booleanValue() && ((Boolean)state.getValue(DECAYABLE)).booleanValue()) { byte b0 = 4; int i = b0 + 1; int j = pos.getX(); int k = pos.getY(); int l = pos.getZ(); byte b1 = 32; int i1 = b1 * b1; int j1 = b1 / 2; if (this.surroundings == null) { this.surroundings = new int[b1 * b1 * b1]; } int k1; if (worldIn.isAreaLoaded(new BlockPos(j - i, k - i, l - i), new BlockPos(j + i, k + i, l + i))) { int l1; int i2; for (k1 = -b0; k1 <= b0; ++k1) { for (l1 = -b0; l1 <= b0; ++l1) { for (i2 = -b0; i2 <= b0; ++i2) { BlockPos tmp = new BlockPos(j + k1, k + l1, l + i2); Block block = worldIn.getBlockState(tmp).getBlock(); if (!block.canSustainLeaves(worldIn, tmp)) { if (block.isLeaves(worldIn, tmp)) { this.surroundings[(k1 + j1) * i1 + (l1 + j1) * b1 + i2 + j1] = -2; } else { this.surroundings[(k1 + j1) * i1 + (l1 + j1) * b1 + i2 + j1] = -1; } } else { this.surroundings[(k1 + j1) * i1 + (l1 + j1) * b1 + i2 + j1] = 0; } } } } for (k1 = 1; k1 <= 4; ++k1) { for (l1 = -b0; l1 <= b0; ++l1) { for (i2 = -b0; i2 <= b0; ++i2) { for (int j2 = -b0; j2 <= b0; ++j2) { if (this.surroundings[(l1 + j1) * i1 + (i2 + j1) * b1 + j2 + j1] == k1 - 1) { if (this.surroundings[(l1 + j1 - 1) * i1 + (i2 + j1) * b1 + j2 + j1] == -2) { this.surroundings[(l1 + j1 - 1) * i1 + (i2 + j1) * b1 + j2 + j1] = k1; } if (this.surroundings[(l1 + j1 + 1) * i1 + (i2 + j1) * b1 + j2 + j1] == -2) { this.surroundings[(l1 + j1 + 1) * i1 + (i2 + j1) * b1 + j2 + j1] = k1; } if (this.surroundings[(l1 + j1) * i1 + (i2 + j1 - 1) * b1 + j2 + j1] == -2) { this.surroundings[(l1 + j1) * i1 + (i2 + j1 - 1) * b1 + j2 + j1] = k1; } if (this.surroundings[(l1 + j1) * i1 + (i2 + j1 + 1) * b1 + j2 + j1] == -2) { this.surroundings[(l1 + j1) * i1 + (i2 + j1 + 1) * b1 + j2 + j1] = k1; } if (this.surroundings[(l1 + j1) * i1 + (i2 + j1) * b1 + (j2 + j1 - 1)] == -2) { this.surroundings[(l1 + j1) * i1 + (i2 + j1) * b1 + (j2 + j1 - 1)] = k1; } if (this.surroundings[(l1 + j1) * i1 + (i2 + j1) * b1 + j2 + j1 + 1] == -2) { this.surroundings[(l1 + j1) * i1 + (i2 + j1) * b1 + j2 + j1 + 1] = k1; } } } } } } } k1 = this.surroundings[j1 * i1 + j1 * b1 + j1]; if (k1 >= 0) { worldIn.setBlockState(pos, state.withProperty(CHECK_DECAY, Boolean.valueOf(false)), 4); } else { this.destroy(worldIn, pos); } } } } @SideOnly(Side.CLIENT) public void randomDisplayTick(World worldIn, BlockPos pos, IBlockState state, Random rand) { if (worldIn.canLightningStrike(pos.up()) && !World.doesBlockHaveSolidTopSurface(worldIn, pos.down()) && rand.nextInt(15) == 1) { double d0 = (double)((float)pos.getX() + rand.nextFloat()); double d1 = (double)pos.getY() - 0.05D; double d2 = (double)((float)pos.getZ() + rand.nextFloat()); worldIn.spawnParticle(EnumParticleTypes.DRIP_WATER, d0, d1, d2, 0.0D, 0.0D, 0.0D, new int[0]); } } private void destroy(World worldIn, BlockPos pos) { this.dropBlockAsItem(worldIn, pos, worldIn.getBlockState(pos), 0); worldIn.setBlockToAir(pos); } public int quantityDropped(Random random) { return random.nextInt(20) == 0 ? 1 : 0; } public Item getItemDropped(IBlockState state, Random rand, int fortune) { //return Item.getItemFromBlock(Symbology.ash_sapling); return null; } public void dropBlockAsItemWithChance(World worldIn, BlockPos pos, IBlockState state, float chance, int fortune) { super.dropBlockAsItemWithChance(worldIn, pos, state, chance, fortune); } protected void dropApple(World worldIn, BlockPos pos, IBlockState state, int chance) {} protected int getSaplingDropChance(IBlockState state) { return 20; } @SideOnly(Side.CLIENT) public void setGraphicsLevel(boolean fancy) { this.isTransparent = fancy; this.fancyGraphics = fancy; this.iconIndex = fancy ? 0 : 1; } public boolean isVisuallyOpaque() { return false; } @Override public boolean isShearable(ItemStack item, IBlockAccess world, BlockPos pos){ return true; } @Override public boolean isLeaves(IBlockAccess world, BlockPos pos){ return true; } @Override public void beginLeavesDecay(World world, BlockPos pos) { IBlockState state = world.getBlockState(pos); if (!(Boolean)state.getValue(CHECK_DECAY)) { world.setBlockState(pos, state.withProperty(CHECK_DECAY, true), 4); } } @Override public java.util.List<ItemStack> getDrops(IBlockAccess world, BlockPos pos, IBlockState state, int fortune) { java.util.List<ItemStack> ret = new java.util.ArrayList<ItemStack>(); Random rand = world instanceof World ? ((World)world).rand : new Random(); int chance = this.getSaplingDropChance(state); if (fortune > 0) { chance -= 2 << fortune; if (chance < 10) chance = 10; } if (rand.nextInt(chance) == 0) ret.add(new ItemStack(getItemDropped(state, rand, fortune), 1, damageDropped(state))); chance = 200; if (fortune > 0) { chance -= 10 << fortune; if (chance < 40) chance = 40; } this.captureDrops(true); if (world instanceof World) this.dropApple((World)world, pos, state, chance); // Dammet mojang ret.addAll(this.captureDrops(false)); return ret; } @Override public List<ItemStack> onSheared(ItemStack item, IBlockAccess world, BlockPos pos, int fortune) { return new java.util.ArrayList(java.util.Arrays.asList(new ItemStack(this, 1, 0))); } }
  14. I am working on adding a new log and am trying to get directional textures like that of normal Minecraft logs. The issue is, for some reason, the property is getting set to 'none' and not keeping the value it's supposed to have. package com.teamrune.symbology.blocks; import java.util.Iterator; import scala.reflect.internal.Trees.This; import net.minecraft.block.BlockLog; import net.minecraft.block.BlockRotatedPillar; import net.minecraft.block.material.Material; import net.minecraft.block.properties.IProperty; import net.minecraft.block.properties.PropertyEnum; import net.minecraft.block.state.BlockState; import net.minecraft.block.state.IBlockState; import net.minecraft.entity.EntityLivingBase; import net.minecraft.util.BlockPos; import net.minecraft.util.EnumFacing; import net.minecraft.util.EnumWorldBlockLayer; import net.minecraft.util.IStringSerializable; import net.minecraft.world.IBlockAccess; import net.minecraft.world.World; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; import com.teamrune.symbology.Symbology; public class BlockAshLog extends BlockRotatedPillar { public static final PropertyEnum LOG_AXIS = PropertyEnum.create("axis", BlockAshLog.EnumAxis.class); public BlockAshLog() { super(Material.leaves); setCreativeTab(Symbology.symbologyTab); setUnlocalizedName("ash_log"); } @SideOnly(Side.CLIENT) public EnumWorldBlockLayer getBlockLayer() { return EnumWorldBlockLayer.SOLID; } @Override public boolean isOpaqueCube() { return false; } @Override public boolean isFullCube() { return true; } @Override public int getRenderType() { return 3; } public int getMetaFromState(IBlockState state) { return 0; } public void breakBlock(World worldIn, BlockPos pos, IBlockState state) { System.out.println(state.getProperties().toString()); byte b0 = 4; int i = b0 + 1; if (worldIn.isAreaLoaded(pos.add(-i, -i, -i), pos.add(i, i, i))) { Iterator iterator = BlockPos.getAllInBox(pos.add(-b0, -b0, -b0), pos.add(b0, b0, b0)).iterator(); while (iterator.hasNext()) { BlockPos blockpos1 = (BlockPos)iterator.next(); IBlockState iblockstate1 = worldIn.getBlockState(blockpos1); if (iblockstate1.getBlock().isLeaves(worldIn, blockpos1)) { iblockstate1.getBlock().beginLeavesDecay(worldIn, blockpos1); } } } } @Override public IBlockState onBlockPlaced(World worldIn, BlockPos pos, EnumFacing facing, float hitX, float hitY, float hitZ, int meta, EntityLivingBase placer) { System.out.println(facing.toString()); EnumAxis face = BlockAshLog.EnumAxis.fromFacingAxis(facing.getAxis()); System.out.println(face); System.out.println(super.onBlockPlaced(worldIn, pos, facing, hitX, hitY, hitZ, meta, placer).withProperty(LOG_AXIS, face).toString()); return super.onBlockPlaced(worldIn, pos, facing, hitX, hitY, hitZ, meta, placer).withProperty(LOG_AXIS, face); } @Override public boolean canSustainLeaves(net.minecraft.world.IBlockAccess world, BlockPos pos){ return true; } @Override public boolean isWood(net.minecraft.world.IBlockAccess world, BlockPos pos){ return true; } protected BlockState createBlockState() { //return new ExtendedBlockState(this, new IProperty[]{LISTED_PROPERTIES}, new IUnlistedProperty[]{JAI}); return new BlockState(this, new IProperty[] { LOG_AXIS }); } public static enum EnumAxis implements IStringSerializable { X("x"), Y("y"), Z("z"), NONE("none"); private final String name; private EnumAxis(String name) { this.name = name; } public String toString() { return this.name; } public static BlockAshLog.EnumAxis fromFacingAxis(EnumFacing.Axis axis) { switch (BlockAshLog.SwitchAxis.AXIS_LOOKUP[axis.ordinal()]) { case 1: System.out.println("Case 1"); return X; case 2: System.out.println("Case 2"); return Y; case 3: System.out.println("Case 3"); return Z; default: System.out.println("Default"); return NONE; } } public String getName() { return this.name; } } static final class SwitchAxis { static final int[] AXIS_LOOKUP = new int[EnumFacing.Axis.values().length]; static { try { System.out.println("Ordinal 1"); AXIS_LOOKUP[EnumFacing.Axis.X.ordinal()] = 1; } catch (NoSuchFieldError var3) { ; } try { System.out.println("Ordinal 2"); AXIS_LOOKUP[EnumFacing.Axis.Y.ordinal()] = 2; } catch (NoSuchFieldError var2) { ; } try { System.out.println("Ordinal 3"); AXIS_LOOKUP[EnumFacing.Axis.Z.ordinal()] = 3; } catch (NoSuchFieldError var1) { ; } } } } here is the logs I get when I place the block [03:03:20] [Client thread/INFO] [sTDOUT]: [com.teamrune.symbology.blocks.BlockAshLog:onBlockPlaced:87]: up [03:03:20] [Client thread/INFO] [sTDOUT]: [com.teamrune.symbology.blocks.BlockAshLog$EnumAxis:fromFacingAxis:128]: Case 2 [03:03:20] [Client thread/INFO] [sTDOUT]: [com.teamrune.symbology.blocks.BlockAshLog:onBlockPlaced:89]: y [03:03:20] [Client thread/INFO] [sTDOUT]: [com.teamrune.symbology.blocks.BlockAshLog:onBlockPlaced:90]: symbology:ash_log[axis=y] [03:03:20] [server thread/INFO] [sTDOUT]: [com.teamrune.symbology.blocks.BlockAshLog:onBlockPlaced:87]: up [03:03:20] [server thread/INFO] [sTDOUT]: [com.teamrune.symbology.blocks.BlockAshLog$EnumAxis:fromFacingAxis:128]: Case 2 [03:03:20] [server thread/INFO] [sTDOUT]: [com.teamrune.symbology.blocks.BlockAshLog:onBlockPlaced:89]: y [03:03:20] [server thread/INFO] [sTDOUT]: [com.teamrune.symbology.blocks.BlockAshLog:onBlockPlaced:90]: symbology:ash_log[axis=y] then this is what I get when I break it [03:03:18] [server thread/INFO] [sTDOUT]: [com.teamrune.symbology.blocks.BlockAshLog:breakBlock:63]: {PropertyEnum{name=axis, clazz=class com.teamrune.symbology.blocks.BlockAshLog$EnumAxis, values=[x, y, z, none]}=none} As you can see, when I place the block, it gets the right property, but it is getting reset at some point after it leaves my class and becomes none. I have spent the last couple hours trying to find where the issue was coming from, but the final print in the onBlockPlaced method was as far as I could really go into seeing what was being returned. So I have run into a dead end on this one.
  15. ok, thanks for elaborating a bit. I think I'm going to push this off til later for now, still got a lot of more important things to do for this mod for now... See you in the next topic...
  16. At this point, I am not sure why it is not working, I know it works with living entities, but I don't know why it's not working for your entity with the method it's in.
  17. ok, could you share the class so I can see what is going on? It could just be a method not being right.
  18. try adding public void onEntityUpdate() { super(); addlight(); } This method is called in Entity.class every tick and may be what will allow your entity to produce light.
  19. Please post your entity class so we can see what exactly you have.
  20. The issue is onUpdate is not called every tick, you need to put it in onLivingUpdate, which I am no sure if a projectile has a living update. It only works in onLivingUpdate because onLivingUpdate is called every tick, unlike onUpdate.
  21. Unless the entity is moving faster than 1 block per tick, then the light update lines will remove old light source blocks the entity created. Also, the light value works on all blocks. You can see the code working if you use my mod, Mo Chickens, and spawn in the glowing chicken. I made this bit of code to be the best option to giving entities light and not having to make an invisible block. Entities this should not be used on are any entities that teleport around. But you could use it if you modify the light updates to use entities previous position, which is stored by the game.
  22. it tells the block to update its light level based on the light level of blocks around it and the sky. for in the addLight() method, it updates the blocks around the block the entity is in to cause the light to reach out until it is at its limits. the call when the entity is dead causes the source block to check its light level based on the sky and block light sources, therefore causing it to reset. to explain the code in detail this.worldObj.setLightValue(EnumSkyBlock.Block, (int) this.posX, (int) this.posY, (int) this.posZ, 16); you should know what this.worldObj is. EnumSkyBlock.Block tell the server what type of light you are modifying, in this case, you are modifying block light. You really shouldn't need to change sky light because that will effect the whole world. (int) this.posX + 1, (int) this.posY, (int) this.posZ is the block position relative to the entity. 16 is the light level you are setting the block to. this.worldObj.updateLightByType(EnumSkyBlock.Block, (int) this.posX + 1, (int) this.posY, (int) this.posZ); this is pretty much the same as the setLightValue method, just without the 16, and shouldn't be the same block as the setLightValue, otherwise your block light level will reset.
  23. what this does is it takes the location of your entity and sets the light of that block to 16 (with code as is) you can change this by changing the 16 to whatever you want the light level to be. private void addLight() { this.worldObj.setLightValue(EnumSkyBlock.Block, (int) this.posX, (int) this.posY, (int) this.posZ, 16); this.worldObj.markBlockRangeForRenderUpdate((int) this.posX, (int) this.posY, (int) this.posX, 12, 12, 12); this.worldObj.markBlockForUpdate((int) this.posX, (int) this.posY, (int) this.posZ); this.worldObj.updateLightByType(EnumSkyBlock.Block, (int) this.posX, (int) this.posY + 1, (int) this.posZ); this.worldObj.updateLightByType(EnumSkyBlock.Block, (int) this.posX, (int) this.posY - 1, (int) this.posZ); this.worldObj.updateLightByType(EnumSkyBlock.Block, (int) this.posX + 1, (int) this.posY, (int) this.posZ); this.worldObj.updateLightByType(EnumSkyBlock.Block, (int) this.posX - 1, (int) this.posY, (int) this.posZ); this.worldObj.updateLightByType(EnumSkyBlock.Block, (int) this.posX, (int) this.posY, (int) this.posZ + 1); this.worldObj.updateLightByType(EnumSkyBlock.Block, (int) this.posX, (int) this.posY, (int) this.posZ - 1); } to call on it put this in your LivingUpdate method: addLight(); also add this to the very end of your LivingUpdate to remove the light when you remove the entity if (this.isDead) { this.worldObj.updateLightByType(EnumSkyBlock.Block, (int) this.posX, (int) this.posY, (int) this.posZ); } this will force the block to update its light to where it should be.
  24. What kind of entity are you talking about? and item entity, living entity, ect??? I do have some code I could explain to you for a living entity. Also, what version are you doing this in?
  25. ok, I followed the tutorial here on ISmartBlockModel, and the 2 things I am most confused it, what do I need to do to send the textures as layers, I know you said to "group" them, but by group do you mean to send them as a Collection, or something else? Also for the BakedBlockModel, im guessing that "..." is to say "put more code of your own here," but I'm not sure about the "myquad" variable, I see no mention of it anywhere in the tutorial. I have a slight idea of how this works, but these are just going over me. Finally, would I check the blocks around the block in the main block class eg. "MyBlock?" If not, where would I check the blocks around it? 1.8 has really screwed me up, I feel so lost now.
×
×
  • Create New...

Important Information

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