Jump to content

Dragonisser

Forge Modder
  • Posts

    157
  • Joined

  • Last visited

Everything posted by Dragonisser

  1. this.topBlock = CMContent.cobaltgrass.getDefaultState();
  2. ugh, your right. Totally forgot that. It seem to spread again. I gonna reply again if it works on the server.
  3. I tried it with the coordinates of the block and then with the coordinates of the block that is in the range to replace.
  4. Hmm, it simply says false the whole time, even though standing at the position.
  5. Hmm, is there any way to prevent the loading of the chunks, so the water doesnt spread any further?
  6. Could someone explain me why my custom water loads chunks? At the updatetick method it checks if the vanilla water is next to it and replaces it with itself. Curretnly it loads every chunk while doing this and replaces everything. You can see what i mean on my Dynmap. I never went to the dark blue area. http://prwh.de:8125/?worldname=world&mapname=flat&zoom=3&x=669&y=64&z=478 package cobaltmod.main.blocks; import java.util.Random; import cobaltmod.entity.EntityBlueSlime; import cobaltmod.entity.EntityCobaltGuardian; import cobaltmod.entity.EntityCobaltZombie; import cobaltmod.main.api.CMApiReplace; import cobaltmod.main.api.CMContent; import net.minecraft.block.Block; import net.minecraft.block.material.Material; import net.minecraft.client.renderer.texture.IIconRegister; import net.minecraft.entity.Entity; import net.minecraft.entity.item.EntityItem; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.init.Blocks; import net.minecraft.item.ItemStack; import net.minecraft.util.DamageSource; import net.minecraft.util.IIcon; import net.minecraft.world.IBlockAccess; import net.minecraft.world.World; import net.minecraftforge.fluids.BlockFluidClassic; import net.minecraftforge.fluids.Fluid; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; public class BlockDarkWater extends BlockFluidClassic { public static BlockDarkWater instance; @SideOnly(Side.CLIENT) protected IIcon stillIcon; @SideOnly(Side.CLIENT) protected IIcon flowingIcon; public BlockDarkWater(Fluid fluid, Material material) { super(fluid, material); } @SideOnly(Side.CLIENT) public void registerBlockIcons(IIconRegister register) { stillIcon = register.registerIcon("mod_cobalt:darkwater_still"); flowingIcon = register.registerIcon("mod_cobalt:darkwater_flow"); } @Override public IIcon getIcon(int side, int meta) { return (side == 0 || side == 1)? stillIcon : flowingIcon; } @Override public boolean canDisplace(IBlockAccess world, int x, int y, int z) { if (world.getBlock(x, y, z).getMaterial().isLiquid()) return false; return super.canDisplace(world, x, y, z); } @Override public boolean displaceIfPossible(World world, int x, int y, int z) { if (world.getBlock(x, y, z).getMaterial().isLiquid()) return false; return super.displaceIfPossible(world, x, y, z); } public void onEntityCollidedWithBlock(World par1World, int par2, int par3, int par4, Entity par5Entity) { super.onEntityWalking(par1World, par2, par3, par4, par5Entity); if(par5Entity instanceof EntityPlayer) { EntityPlayer player = (EntityPlayer)par5Entity; ItemStack[] armor = player.inventory.armorInventory; if(armor[0] != null) { if(armor[0].getItem() == CMContent.cobaltboots && armor[1].getItem() == CMContent.cobaltlegs && armor[2].getItem() == CMContent.cobaltplate && armor[3].getItem() == CMContent.cobalthelmet) { return; } } } if(par5Entity instanceof EntityItem) { return; } if(par5Entity instanceof EntityCobaltZombie) { return; } if(par5Entity instanceof EntityCobaltGuardian) { return; } if(par5Entity instanceof EntityBlueSlime) { return; } par5Entity.attackEntityFrom(DamageSource.magic, 0.5F); } @Override public void updateTick(World world, int x, int y, int z, Random rand) { int quantaRemaining = quantaPerBlock - world.getBlockMetadata(x, y, z); int expQuanta = -101; // check adjacent block levels if non-source if (quantaRemaining < quantaPerBlock) { int y2 = y - densityDir; if (world.getBlock(x, y2, z ) == this || world.getBlock(x - 1, y2, z ) == this || world.getBlock(x + 1, y2, z ) == this || world.getBlock(x, y2, z - 1) == this || world.getBlock(x, y2, z + 1) == this) { expQuanta = quantaPerBlock - 1; } else { int maxQuanta = -100; maxQuanta = getLargerQuanta(world, x - 1, y, z, maxQuanta); maxQuanta = getLargerQuanta(world, x + 1, y, z, maxQuanta); maxQuanta = getLargerQuanta(world, x, y, z - 1, maxQuanta); maxQuanta = getLargerQuanta(world, x, y, z + 1, maxQuanta); expQuanta = maxQuanta - 1; } // decay calculation if (expQuanta != quantaRemaining) { quantaRemaining = expQuanta; if (expQuanta <= 0) { world.setBlock(x, y, z, Blocks.air); } else { world.setBlockMetadataWithNotify(x, y, z, quantaPerBlock - expQuanta, 3); world.scheduleBlockUpdate(x, y, z, this, tickRate); world.notifyBlocksOfNeighborChange(x, y, z, this); } } } // This is a "source" block, set meta to zero, and send a server only update else if (quantaRemaining >= quantaPerBlock) { world.setBlockMetadataWithNotify(x, y, z, 0, 2); } // Flow vertically if possible if (canDisplace(world, x, y + densityDir, z)) { flowIntoBlock(world, x, y + densityDir, z, 1); return; } // Flow outward if possible int flowMeta = quantaPerBlock - quantaRemaining + 1; if (flowMeta >= quantaPerBlock) { return; } if (isSourceBlock(world, x, y, z) || !isFlowingVertically(world, x, y, z)) { if (world.getBlock(x, y - densityDir, z) == this) { flowMeta = 1; } boolean flowTo[] = getOptimalFlowDirections(world, x, y, z); if (flowTo[0]) flowIntoBlock(world, x - 1, y, z, flowMeta); if (flowTo[1]) flowIntoBlock(world, x + 1, y, z, flowMeta); if (flowTo[2]) flowIntoBlock(world, x, y, z - 1, flowMeta); if (flowTo[3]) flowIntoBlock(world, x, y, z + 1, flowMeta); } // if (!world.isRemote) { // for (int l = 0; l < 2; ++l) { // // int i1 = x + rand.nextInt(3) - 1; // int j1 = y + rand.nextInt(5) - 3; // int k1 = z + rand.nextInt(3) - 1; // // Block spreadable = world.getBlock(i1, j1, k1); // // if (world.getChunkFromBlockCoords(x, z).isChunkLoaded) // { // if (world.getBlock(j1, y - 1, k1) != CMContent.cobaltgrass) // { // if (CMApiReplace.map.containsKey(spreadable)) // { // world.setBlock(i1, j1, k1, CMApiReplace.map.get(spreadable)); // } // } // // } // // } // } } }
  7. I need it for the normal stone, so the player doesnt receive the extra item, when he mines the placed block again. I guess the nbttag is the best method for that.
  8. Is it possible to check if the player placed the certain block hes mining currently? The leaves does something similar, so they doesnt decay, if a player placed them. My guess was nbttags.
  9. Dragonisser

    Vec3

    It's not directly the player look vector, but you can stuff like this with the normal Vec3. https://bitbucket.org/Dragonisser/cobaltmod/src/2e23e3b1a547b37c59234d4725bef14b7af1a1f2/cobaltmod/entity/EntityCobaltGuardian.java?at=master#cl-288
  10. https://bitbucket.org/Dragonisser/cobaltmod/src/2e23e3b1a547b37c59234d4725bef14b7af1a1f2/cobaltmod/main/blocks/BlockBouncyCobalt.java?at=master Take a look at this. There some methods unnecessary, but i guess you can figure this out.
  11. Here you can take a look ^^ https://bitbucket.org/Dragonisser/cobaltmod/src/2e23e3b1a547b37c59234d4725bef14b7af1a1f2/cobaltmod/world/dimension/?at=master
  12. The block: https://bitbucket.org/Dragonisser/cobaltmod/src/2e23e3b1a547b37c59234d4725bef14b7af1a1f2/cobaltmod/main/blocks/BlockCobaltDoor.java?at=master The item: https://bitbucket.org/Dragonisser/cobaltmod/src/2e23e3b1a547b37c59234d4725bef14b7af1a1f2/cobaltmod/main/items/ItemCobaltDoor.java?at=master The initilization is the same as normal. If you still have problems, im here and the guy above me too
  13. You could try something like that. It works perfectly on client/server https://bitbucket.org/Dragonisser/cobaltmod/src/2e23e3b1a547b37c59234d4725bef14b7af1a1f2/cobaltmod/main/items/ItemWindAxe.java?at=master#cl-53
  14. You dont really need to make the upper block emit the light (Simply let the block you are placing emit the light. particles could also be done, if you check, if its the upper part of the plant(or torch)) When i get home, i will take a look at the DoublePlant and try to help you ^^
  15. public void spawnShockWave() { //System.out.println("Spawned"); if (this.worldObj.getClosestVulnerablePlayerToEntity(this, 10.0D) != null) { EntityLivingBase entityplayer = (EntityLivingBase) this.worldObj.getClosestVulnerablePlayerToEntity(this, 10.0D); double x = Math.sin(entityplayer.rotationYaw * Math.PI / 180) * 1.0D; double z = Math.cos(entityplayer.rotationYaw * Math.PI / 180) * 1.0D; double y = 1.0D; //System.out.println(entityplayer); double d = Math.random(); if (d < 0.2) { //System.out.println("PUSH"); entityplayer.addVelocity(x, y, z); } } } Well this is my attempt to push the player away from a certain entity. https://bitbucket.org/Dragonisser/cobaltmod/src/2a6e45c02444af95fc11af6b881cea78c633b164/cobaltmod/entity/EntityCobaltGuardian.java?at=master#cl-230 It gets called where //System.out.println("FIREBALL 2"); is written.(Old code, thats why it isnt written there ^^) But nothing happens. I use the same at my windaxe: https://bitbucket.org/Dragonisser/cobaltmod/src/2a6e45c02444af95fc11af6b881cea78c633b164/cobaltmod/items/ItemWindAxe.java?at=master#cl-119 I also tried to use EntityPlayer. I even get the variables like - entityplayer.rotationYaw - entityplayer but nothing happens to me. I added right now this "entityplayer.attackEntityFrom(DamageSource.cactus, 0.1F);" under .addVelocity() and suddenly i get thrown away. Does someone knows why it only works when i get damaged? Or did i make a stupid mistake ?
  16. This is of/from coolAlias http://www.minecraftforge.net/forum/index.php?topic=20806.20 And how i used it. Just an example
  17. There you go ^^ https://bitbucket.org/Dragonisser/cobaltmod/src/178c28c1f444b11466696e40bcbfb0f8978acf76/cobaltmod/items/ItemWindAxe.java?at=master
  18. You could also made it into the slot directly https://bitbucket.org/Dragonisser/cobaltmod/src/178c28c1f444b11466696e40bcbfb0f8978acf76/cobaltmod/gui/SlotBackpack.java?at=master
  19. Do it like that: // Worldgenerator Registration GameRegistry.registerWorldGenerator(new WorldGenerator(), 1); and put it in the init or even post-init
  20. uhm how do i do that can you compelte the code ? i have no idea what to do, you can use any block this.dropItem(Item.getItemFromBlock(mod.block, 1)); This should do it ^^
  21. I got this: https://bitbucket.org/Dragonisser/cobaltmod/src/178c28c1f444b11466696e40bcbfb0f8978acf76/cobaltmod/blocks/BlockFluidDarkWater.java?at=master and this in the main: @SubscribeEvent @SideOnly(Side.CLIENT) public void textureHook(TextureStitchEvent.Post event) { if (event.map.getTextureType() == 0) { CMStuff.darkwater_fluid.setIcons(CMStuff.darkwater.getIcon(0, 0), CMStuff.darkwater.getIcon(1, 0)); } } Ii dont know if its necessary, because i didnt checked afterwards, but i think it was for the bc tanks
  22. It's because of the metadata i guess, but im not sure about this ^^
×
×
  • Create New...

Important Information

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