Jump to content

Dragonisser

Forge Modder
  • Posts

    157
  • Joined

  • Last visited

Everything posted by Dragonisser

  1. What could he use instead? or does he need to go over @SideOnly(Side.CLIENT)? He's a friend of mine so i'm kinda asking for him
  2. /** * Drops the block items with a specified chance of dropping the specified items */ public void dropBlockAsItemWithChance(World p_149690_1_, int p_149690_2_, int p_149690_3_, int p_149690_4_, int p_149690_5_, float p_149690_6_, int p_149690_7_) { if (!p_149690_1_.isRemote) { int j1 = this.func_150123_b(p_149690_5_); if (p_149690_7_ > 0) { j1 -= 2 << p_149690_7_; if (j1 < 10) { j1 = 10; } } if (p_149690_1_.rand.nextInt(j1) == 0) { Item item = this.getItemDropped(p_149690_5_, p_149690_1_.rand, p_149690_7_); this.dropBlockAsItem(p_149690_1_, p_149690_2_, p_149690_3_, p_149690_4_, new ItemStack(item, 1, this.damageDropped(p_149690_5_))); } j1 = 200; if (p_149690_7_ > 0) { j1 -= 10 << p_149690_7_; if (j1 < 40) { j1 = 40; } } this.func_150124_c(p_149690_1_, p_149690_2_, p_149690_3_, p_149690_4_, p_149690_5_, j1); } } BlockLeaves 258 and here the old one: public void dropBlockAsItemWithChance(World par1World, int par2, int par3, int par4, int par5, float par6, int par7) { if (!par1World.isRemote) { int j1 = 20; if ((par5 & 3) == 3) { j1 = 80; } if (par7 > 0) { j1 -= 2 << par7; if (j1 < 10) { j1 = 20; } } if (par1World.rand.nextInt(j1) == 0) { Block k1 = this.idDropped(par5, par1World.rand, par7); this.dropBlockAsItem(par1World, par2, par3, par4, new ItemStack(k1, 1, this.damageDropped(par5))); } j1 = 400; if (par7 > 0) { j1 -= 10 << par7; if (j1 < 40) { j1 = 80; } } if ((par5 & 3) == 0 && par1World.rand.nextInt(j1) == 0) { this.dropBlockAsItem(par1World, par2, par3, par4, new ItemStack(CMStuff.cobaltapple, 1, 0)); } } }
  3. I've added a custom bucket and when i rightclick on my custom fluid, it adds the correct fluid. But when i use the normal bucket on my fluid it gives me my custom bucket instead, even when i add the normal bucket to the registry/handler. main CMStuff.cobaltbucket = new ItemCobaltBucket(Blocks.air).setUnlocalizedName(MODID + ":cobaltbucket_empty").setTextureName(MODID + ":cobaltbucket_empty").setCreativeTab(cobalttab); CMStuff.cobaltbucket_darkwater = new ItemCobaltBucket(CMStuff.darkwater).setContainerItem(CMStuff.cobaltbucket).setUnlocalizedName(MODID + ":cobaltbucket_darkwater").setTextureName(MODID + ":cobaltbucket_darkwater").setCreativeTab(cobalttab); CMStuff.cobaltbucket_water = new ItemCobaltBucket(Blocks.flowing_water).setContainerItem(CMStuff.cobaltbucket).setUnlocalizedName(MODID + ":cobaltbucket_water").setTextureName(MODID + ":cobaltbucket_water").setCreativeTab(cobalttab); CMStuff.cobaltbucket_lava = new ItemCobaltBucket(Blocks.flowing_lava).setContainerItem(CMStuff.cobaltbucket).setUnlocalizedName(MODID + ":cobaltbucket_lava").setTextureName(MODID + ":cobaltbucket_lava").setCreativeTab(cobalttab); BucketHandler.INSTANCE.buckets.put(CMStuff.darkwater, CMStuff.cobaltbucket_darkwater); BucketHandler.INSTANCE.buckets.put(Blocks.water, CMStuff.cobaltbucket_water); BucketHandler.INSTANCE.buckets.put(Blocks.lava, CMStuff.cobaltbucket_lava); FluidContainerRegistry.registerFluidContainer(FluidRegistry.getFluidStack("darkwater_fluid", FluidContainerRegistry.BUCKET_VOLUME), new ItemStack(CMStuff.cobaltbucket_darkwater), new ItemStack(CMStuff.cobaltbucket)); Buckethandler /** * Copyright (c) 2011-2014, SpaceToad and the BuildCraft Team * http://www.mod-buildcraft.com * * BuildCraft is distributed under the terms of the Minecraft Mod Public * License 1.0, or MMPL. Please check the contents of the license located in * http://www.mod-buildcraft.com/MMPL-1.0.txt */ package cobaltmod.handler; import java.util.HashMap; import java.util.Map; import net.minecraft.block.Block; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.util.MovingObjectPosition; import net.minecraft.world.World; import cpw.mods.fml.common.eventhandler.Event.Result; import cpw.mods.fml.common.eventhandler.SubscribeEvent; import net.minecraftforge.event.entity.player.FillBucketEvent; public final class BucketHandler { public static BucketHandler INSTANCE = new BucketHandler(); public Map<Block, Item> buckets = new HashMap<Block, Item>(); private BucketHandler() { } @SubscribeEvent public void onBucketFill(FillBucketEvent event) { ItemStack result = fillCustomBucket(event.world, event.target); if (result == null) { return; } event.result = result; event.setResult(Result.ALLOW); } private ItemStack fillCustomBucket(World world, MovingObjectPosition pos) { Block block = world.getBlock(pos.blockX, pos.blockY, pos.blockZ); Item bucket = buckets.get(block); if (bucket != null && world.getBlockMetadata(pos.blockX, pos.blockY, pos.blockZ) == 0) { world.setBlockToAir(pos.blockX, pos.blockY, pos.blockZ); return new ItemStack(bucket); } else { return null; } } } Either the normal bucket should not work or a custom normal bucket should works with my custom bucket together.
  4. You need to use the functions of the extended class protected Item func_149866_i() { return Items.wheat_seeds; } protected Item func_149865_P() { return Items.wheat; }
  5. When you write you own then for sure ^^ Did you tried it with the mc teleporter code?
  6. Why did you even change it, where the player gets teleported?
  7. public void onEntityCollidedWithBlock(World p_149670_1_, int p_149670_2_, int p_149670_3_, int p_149670_4_, Entity entity) { if ((entity.ridingEntity == null)&& (entity.riddenByEntity == null) && ((entity instanceof EntityPlayerMP))) { EntityPlayerMP thePlayer = (EntityPlayerMP) entity; if (thePlayer.timeUntilPortal > 0) { thePlayer.timeUntilPortal = 10; } else if (thePlayer.dimension != mod_cobalt.cobaltdimension) { thePlayer.timeUntilPortal = 10; thePlayer.mcServer.getConfigurationManager().transferPlayerToDimension(thePlayer, mod_cobalt.cobaltdimension, new TeleporterCobalt(thePlayer.mcServer.worldServerForDimension(mod_cobalt.cobaltdimension))); } else { thePlayer.timeUntilPortal = 10; thePlayer.mcServer.getConfigurationManager().transferPlayerToDimension(thePlayer, 0, new TeleporterCobalt(thePlayer.mcServer.worldServerForDimension(0))); } if (entity instanceof EntityPlayer) { EntityPlayer entityplayer = (EntityPlayer) entity; entityplayer.addStat(mod_cobalt.cobaltachiev14, 1); } } } You need also a custom Teleporter Maybe this will help ya ^^ I can send you my whole dimension/Portal code if doesn't work.
  8. world.setBlock(i + 1, j + 1, k + 9, Blocks.mob_spawner); TileEntityMobSpawner spawner = (TileEntityMobSpawner)world.getTileEntity(i + 1, j + 1, k + 9); spawner.func_145881_a().setEntityName("CobaltZombie"); Here ya go ^^ .setEntityName("") simply put the name of the Mob/Monster you want in there. Look at the EntityList.java for the names ^^
  9. I forgot to say that the texture is only on the one side wrong. and i don't really understand how to use your methods in the tutorial you gave me ._.
  10. Well, i simply use my method i mention above, because it works like a normal bed. Then i write some mystery lore about my bed, that it is the only way to sleep here, etc. Thanks anyway ^^
  11. Well i have a weird texture bug with my bed. This bug has already exist in Minecraft and it's fixed now, but in Forge it isn't fixed. package cobaltmod.blocks; import java.util.Iterator; import java.util.Random; import net.minecraft.block.Block; import net.minecraft.block.BlockBed; import net.minecraft.block.BlockDirectional; import net.minecraft.client.renderer.texture.IIconRegister; import net.minecraft.entity.Entity; import net.minecraft.entity.EntityLivingBase; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.init.Blocks; import net.minecraft.init.Items; import net.minecraft.item.Item; import net.minecraft.server.MinecraftServer; import net.minecraft.util.ChatComponentTranslation; import net.minecraft.util.ChunkCoordinates; import net.minecraft.util.Direction; import net.minecraft.util.IIcon; import net.minecraft.world.IBlockAccess; import net.minecraft.world.World; import net.minecraft.world.biome.BiomeGenBase; import cobaltmod.api.CMStuff; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; public class BlockCobaltBed extends BlockBed { public static final int[][] field_149981_a = new int[][] {{0, 1}, { -1, 0}, {0, -1}, {1, 0}}; @SideOnly(Side.CLIENT) private IIcon[] field_149980_b; @SideOnly(Side.CLIENT) private IIcon[] field_149982_M; @SideOnly(Side.CLIENT) private IIcon[] field_149983_N; @SideOnly(Side.CLIENT) private IIcon bed_h_s1; private static final String __OBFID = "CL_00000198"; public BlockCobaltBed() { super(); this.func_149978_e(); this.disableStats(); } /** * Called upon block activation (right click on the block.) */ public boolean onBlockActivated(World p_149727_1_, int p_149727_2_, int p_149727_3_, int p_149727_4_, EntityPlayer p_149727_5_, int p_149727_6_, float p_149727_7_, float p_149727_8_, float p_149727_9_) { if (p_149727_1_.isRemote) { return true; } else { int i1 = p_149727_1_.getBlockMetadata(p_149727_2_, p_149727_3_, p_149727_4_); if (!isBlockHeadOfBed(i1)) { int j1 = getDirection(i1); p_149727_2_ += field_149981_a[j1][0]; p_149727_4_ += field_149981_a[j1][1]; if (p_149727_1_.getBlock(p_149727_2_, p_149727_3_, p_149727_4_) != this) { return true; } i1 = p_149727_1_.getBlockMetadata(p_149727_2_, p_149727_3_, p_149727_4_); } if (p_149727_1_.provider.canRespawnHere() && p_149727_1_.getBiomeGenForCoords(p_149727_2_, p_149727_4_) != BiomeGenBase.hell) { if (func_149976_c(i1)) { EntityPlayer entityplayer1 = null; Iterator iterator = p_149727_1_.playerEntities.iterator(); while (iterator.hasNext()) { EntityPlayer entityplayer2 = (EntityPlayer)iterator.next(); if (entityplayer2.isPlayerSleeping()) { ChunkCoordinates chunkcoordinates = entityplayer2.playerLocation; if (chunkcoordinates.posX == p_149727_2_ && chunkcoordinates.posY == p_149727_3_ && chunkcoordinates.posZ == p_149727_4_) { entityplayer1 = entityplayer2; } } } if (entityplayer1 != null) { p_149727_5_.addChatComponentMessage(new ChatComponentTranslation("tile.bed.occupied", new Object[0])); return true; } func_149979_a(p_149727_1_, p_149727_2_, p_149727_3_, p_149727_4_, false); } System.out.println("WAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAH"); EntityPlayer.EnumStatus enumstatus = p_149727_5_.sleepInBedAt(p_149727_2_, p_149727_3_, p_149727_4_); if (enumstatus == EntityPlayer.EnumStatus.OK) { func_149979_a(p_149727_1_, p_149727_2_, p_149727_3_, p_149727_4_, true); System.out.println("WIIIIIIIIIIIIIIIIIIIIIIIH"); for (int zeit = 0; zeit < 990000; ++zeit) { System.out.println(zeit); for (int j = 0; j < MinecraftServer.getServer().worldServers.length; ++j) { MinecraftServer.getServer().worldServers[j].setWorldTime(0); } } return true; } else { if (enumstatus == EntityPlayer.EnumStatus.NOT_POSSIBLE_NOW) { p_149727_5_.addChatComponentMessage(new ChatComponentTranslation("tile.bed.noSleep", new Object[0])); } else if (enumstatus == EntityPlayer.EnumStatus.NOT_SAFE) { p_149727_5_.addChatComponentMessage(new ChatComponentTranslation("tile.bed.notSafe", new Object[0])); } return true; } } else { double d2 = (double)p_149727_2_ + 0.5D; double d0 = (double)p_149727_3_ + 0.5D; double d1 = (double)p_149727_4_ + 0.5D; p_149727_1_.setBlockToAir(p_149727_2_, p_149727_3_, p_149727_4_); int k1 = getDirection(i1); p_149727_2_ += field_149981_a[k1][0]; p_149727_4_ += field_149981_a[k1][1]; if (p_149727_1_.getBlock(p_149727_2_, p_149727_3_, p_149727_4_) == this) { p_149727_1_.setBlockToAir(p_149727_2_, p_149727_3_, p_149727_4_); d2 = (d2 + (double)p_149727_2_ + 0.5D) / 2.0D; d0 = (d0 + (double)p_149727_3_ + 0.5D) / 2.0D; d1 = (d1 + (double)p_149727_4_ + 0.5D) / 2.0D; } p_149727_1_.newExplosion((Entity)null, (double)((float)p_149727_2_ + 0.5F), (double)((float)p_149727_3_ + 0.5F), (double)((float)p_149727_4_ + 0.5F), 5.0F, true, true); return true; } } } /** * Gets the block's texture. Args: side, meta */ @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( "mod_cobalt:cobaltbed_f_t"), p_149651_1_.registerIcon("mod_cobalt:cobaltbed_h_t")}; this.field_149980_b = new IIcon[] {p_149651_1_.registerIcon("mod_cobalt:cobaltbed_f_e"), p_149651_1_.registerIcon("mod_cobalt:cobaltbed_h_e")}; this.field_149982_M = new IIcon[] {p_149651_1_.registerIcon("mod_cobalt:cobaltbed_f_s"), p_149651_1_.registerIcon("mod_cobalt:cobaltbed_h_s")}; this.bed_h_s1 = p_149651_1_.registerIcon( "mod_cobalt:cobaltbed_h_s1"); } /** * The type of render function that is called for this block */ public int getRenderType() { return 14; } /** * If this block doesn't render as an ordinary block it will return False (examples: signs, buttons, stairs, etc) */ public boolean renderAsNormalBlock() { return false; } /** * Is this block (a) opaque and (b) a full 1m cube? This determines whether or not to render the shared face of two * adjacent blocks and also whether the player can attach torches, redstone wire, etc to this block. */ public boolean isOpaqueCube() { return false; } /** * Updates the blocks bounds based on its current state. Args: world, x, y, z */ public void setBlockBoundsBasedOnState(IBlockAccess p_149719_1_, int p_149719_2_, int p_149719_3_, int p_149719_4_) { this.func_149978_e(); } /** * Lets the block know when one of its neighbor changes. Doesn't know which neighbor changed (coordinates passed are * their own) Args: x, y, z, neighbor Block */ public void onNeighborBlockChange(World p_149695_1_, int p_149695_2_, int p_149695_3_, int p_149695_4_, Block p_149695_5_) { int l = p_149695_1_.getBlockMetadata(p_149695_2_, p_149695_3_, p_149695_4_); int i1 = getDirection(l); if (isBlockHeadOfBed(l)) { if (p_149695_1_.getBlock(p_149695_2_ - field_149981_a[i1][0], p_149695_3_, p_149695_4_ - field_149981_a[i1][1]) != this) { p_149695_1_.setBlockToAir(p_149695_2_, p_149695_3_, p_149695_4_); } } else if (p_149695_1_.getBlock(p_149695_2_ + field_149981_a[i1][0], p_149695_3_, p_149695_4_ + field_149981_a[i1][1]) != this) { p_149695_1_.setBlockToAir(p_149695_2_, p_149695_3_, p_149695_4_); if (!p_149695_1_.isRemote) { this.dropBlockAsItem(p_149695_1_, p_149695_2_, p_149695_3_, p_149695_4_, l, 0); } } } public Item getItemDropped(int p_149650_1_, Random p_149650_2_, int p_149650_3_) { /** * Returns whether or not this bed block is the head of the bed. */ return isBlockHeadOfBed(p_149650_1_) ? Item.getItemById(0) : Items.bed; } private void func_149978_e() { this.setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 0.5625F, 1.0F); } /** * Returns whether or not this bed block is the head of the bed. */ public static boolean isBlockHeadOfBed(int p_149975_0_) { return (p_149975_0_ & != 0; } public static boolean func_149976_c(int p_149976_0_) { return (p_149976_0_ & 4) != 0; } public static void func_149979_a(World p_149979_0_, int p_149979_1_, int p_149979_2_, int p_149979_3_, boolean p_149979_4_) { int l = p_149979_0_.getBlockMetadata(p_149979_1_, p_149979_2_, p_149979_3_); if (p_149979_4_) { l |= 4; } else { l &= -5; } p_149979_0_.setBlockMetadataWithNotify(p_149979_1_, p_149979_2_, p_149979_3_, l, 4); } public static ChunkCoordinates func_149977_a(World p_149977_0_, int p_149977_1_, int p_149977_2_, int p_149977_3_, int p_149977_4_) { int i1 = p_149977_0_.getBlockMetadata(p_149977_1_, p_149977_2_, p_149977_3_); int j1 = BlockDirectional.getDirection(i1); for (int k1 = 0; k1 <= 1; ++k1) { int l1 = p_149977_1_ - field_149981_a[j1][0] * k1 - 1; int i2 = p_149977_3_ - field_149981_a[j1][1] * k1 - 1; int j2 = l1 + 2; int k2 = i2 + 2; for (int l2 = l1; l2 <= j2; ++l2) { for (int i3 = i2; i3 <= k2; ++i3) { if (World.doesBlockHaveSolidTopSurface(p_149977_0_, l2, p_149977_2_ - 1, i3) && !p_149977_0_.getBlock(l2, p_149977_2_, i3).getMaterial().isOpaque() && !p_149977_0_.getBlock(l2, p_149977_2_ + 1, i3).getMaterial().isOpaque()) { if (p_149977_4_ <= 0) { return new ChunkCoordinates(l2, p_149977_2_, i3); } --p_149977_4_; } } } } return null; } /** * Drops the block items with a specified chance of dropping the specified items */ public void dropBlockAsItemWithChance(World p_149690_1_, int p_149690_2_, int p_149690_3_, int p_149690_4_, int p_149690_5_, float p_149690_6_, int p_149690_7_) { if (!isBlockHeadOfBed(p_149690_5_)) { super.dropBlockAsItemWithChance(p_149690_1_, p_149690_2_, p_149690_3_, p_149690_4_, p_149690_5_, p_149690_6_, 0); } } /** * 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 1; } /** * Gets an item for the block being called on. Args: world, x, y, z */ @SideOnly(Side.CLIENT) public Item getItem(World p_149694_1_, int p_149694_2_, int p_149694_3_, int p_149694_4_) { return CMStuff.cobaltbed1; } /** * Called when the block is attempted to be harvested */ public void onBlockHarvested(World p_149681_1_, int p_149681_2_, int p_149681_3_, int p_149681_4_, int p_149681_5_, EntityPlayer p_149681_6_) { if (p_149681_6_.capabilities.isCreativeMode && isBlockHeadOfBed(p_149681_5_)) { int i1 = getDirection(p_149681_5_); p_149681_2_ -= field_149981_a[i1][0]; p_149681_4_ -= field_149981_a[i1][1]; if (p_149681_1_.getBlock(p_149681_2_, p_149681_3_, p_149681_4_) == this) { p_149681_1_.setBlockToAir(p_149681_2_, p_149681_3_, p_149681_4_); } } } public boolean isBed(IBlockAccess world, int x, int y, int z, EntityLivingBase player) { return this == CMStuff.cobaltbed; } } Does anybody know how to fix this? Or do i need to make a new TileEntity/Model ._.
  12. Are you sure? That's just the tick loop; it counts the elapsed milliseconds and performs a tick every 50ms. I don't think it has anything to do with the world time? -TGG hmm, but the code in WorldServer.java never gets called if (this.areAllPlayersAsleep()) { if (this.getGameRules().getGameRuleBooleanValue("doDaylightCycle")) /// HERE { long i = this.worldInfo.getWorldTime() + 24000L; this.worldInfo.setWorldTime(i - i % 24000L); } this.wakeAllPlayers(); }
  13. No it reset the time in all dimension. I didn't say that it reset only the time of my dimension. Yeah these are the Symptoms Found the problem: if (this.worldServers[0].areAllPlayersAsleep()) { this.tick(); l = 0L; } It's in the MinecraftServer.java. And it's only work for the World 0 = Normal World
  14. This doesn't change anything. The normal bed doesn't work either even when my Dimension is SurfaceWorld and canRespawnHere true. The sleeping animation works, but the time doesn't reset.
  15. World time...do you want to have an independent time for your dimension? EDIT: wait, can you use the normal bed in your dimension? No the normal bed doesn't work either.
  16. Well i made it so i can sleep in my custom bed in my custom dimension, but the world time doesn't reset to 0 or day, when i go to sleep(actually this works ~_~). BlockCobaltBed package cobaltmod.blocks; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; import java.util.Iterator; import java.util.Random; import cobaltmod.api.CMStuff; import net.minecraft.block.Block; import net.minecraft.block.BlockBed; import net.minecraft.block.BlockDirectional; import net.minecraft.block.material.Material; import net.minecraft.client.renderer.texture.IIconRegister; import net.minecraft.entity.Entity; import net.minecraft.entity.EntityLivingBase; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.init.Blocks; import net.minecraft.init.Items; import net.minecraft.item.Item; import net.minecraft.util.ChatComponentTranslation; import net.minecraft.util.ChunkCoordinates; import net.minecraft.util.Direction; import net.minecraft.util.IIcon; import net.minecraft.world.IBlockAccess; import net.minecraft.world.World; import net.minecraft.world.biome.BiomeGenBase; public class BlockCobaltBed extends BlockBed { public static final int[][] field_149981_a = new int[][] {{0, 1}, { -1, 0}, {0, -1}, {1, 0}}; @SideOnly(Side.CLIENT) private IIcon[] field_149980_b; @SideOnly(Side.CLIENT) private IIcon[] field_149982_M; @SideOnly(Side.CLIENT) private IIcon[] field_149983_N; private static final String __OBFID = "CL_00000198"; public BlockCobaltBed() { super(); this.func_149978_e(); this.disableStats(); } /** * Called upon block activation (right click on the block.) */ public boolean onBlockActivated(World p_149727_1_, int p_149727_2_, int p_149727_3_, int p_149727_4_, EntityPlayer p_149727_5_, int p_149727_6_, float p_149727_7_, float p_149727_8_, float p_149727_9_) { if (p_149727_1_.isRemote) { return true; } else { int i1 = p_149727_1_.getBlockMetadata(p_149727_2_, p_149727_3_, p_149727_4_); if (!isBlockHeadOfBed(i1)) { int j1 = getDirection(i1); p_149727_2_ += field_149981_a[j1][0]; p_149727_4_ += field_149981_a[j1][1]; if (p_149727_1_.getBlock(p_149727_2_, p_149727_3_, p_149727_4_) != this) { return true; } i1 = p_149727_1_.getBlockMetadata(p_149727_2_, p_149727_3_, p_149727_4_); } if (p_149727_1_.provider.canRespawnHere() && p_149727_1_.getBiomeGenForCoords(p_149727_2_, p_149727_4_) != BiomeGenBase.hell) { if (func_149976_c(i1)) { EntityPlayer entityplayer1 = null; Iterator iterator = p_149727_1_.playerEntities.iterator(); while (iterator.hasNext()) { EntityPlayer entityplayer2 = (EntityPlayer)iterator.next(); if (entityplayer2.isPlayerSleeping()) { ChunkCoordinates chunkcoordinates = entityplayer2.playerLocation; if (chunkcoordinates.posX == p_149727_2_ && chunkcoordinates.posY == p_149727_3_ && chunkcoordinates.posZ == p_149727_4_) { entityplayer1 = entityplayer2; } } } if (entityplayer1 != null) { p_149727_5_.addChatComponentMessage(new ChatComponentTranslation("tile.bed.occupied", new Object[0])); return true; } func_149979_a(p_149727_1_, p_149727_2_, p_149727_3_, p_149727_4_, false); } EntityPlayer.EnumStatus enumstatus = p_149727_5_.sleepInBedAt(p_149727_2_, p_149727_3_, p_149727_4_); if (enumstatus == EntityPlayer.EnumStatus.OK) { func_149979_a(p_149727_1_, p_149727_2_, p_149727_3_, p_149727_4_, true); return true; } else { if (enumstatus == EntityPlayer.EnumStatus.NOT_POSSIBLE_NOW) { p_149727_5_.addChatComponentMessage(new ChatComponentTranslation("tile.bed.noSleep", new Object[0])); } else if (enumstatus == EntityPlayer.EnumStatus.NOT_SAFE) { p_149727_5_.addChatComponentMessage(new ChatComponentTranslation("tile.bed.notSafe", new Object[0])); } return true; } } else { double d2 = (double)p_149727_2_ + 0.5D; double d0 = (double)p_149727_3_ + 0.5D; double d1 = (double)p_149727_4_ + 0.5D; p_149727_1_.setBlockToAir(p_149727_2_, p_149727_3_, p_149727_4_); int k1 = getDirection(i1); p_149727_2_ += field_149981_a[k1][0]; p_149727_4_ += field_149981_a[k1][1]; if (p_149727_1_.getBlock(p_149727_2_, p_149727_3_, p_149727_4_) == this) { p_149727_1_.setBlockToAir(p_149727_2_, p_149727_3_, p_149727_4_); d2 = (d2 + (double)p_149727_2_ + 0.5D) / 2.0D; d0 = (d0 + (double)p_149727_3_ + 0.5D) / 2.0D; d1 = (d1 + (double)p_149727_4_ + 0.5D) / 2.0D; } p_149727_1_.newExplosion((Entity)null, (double)((float)p_149727_2_ + 0.5F), (double)((float)p_149727_3_ + 0.5F), (double)((float)p_149727_4_ + 0.5F), 5.0F, true, true); return true; } } } /** * Gets the block's texture. Args: side, meta */ @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( "mod_cobalt:cobaltbed_f_t"), p_149651_1_.registerIcon("mod_cobalt:cobaltbed_h_t")}; this.field_149980_b = new IIcon[] {p_149651_1_.registerIcon("mod_cobalt:cobaltbed_f_e"), p_149651_1_.registerIcon("mod_cobalt:cobaltbed_h_e")}; this.field_149982_M = new IIcon[] {p_149651_1_.registerIcon("mod_cobalt:cobaltbed_f_s"), p_149651_1_.registerIcon("mod_cobalt:cobaltbed_h_s")}; } /** * The type of render function that is called for this block */ public int getRenderType() { return 14; } /** * If this block doesn't render as an ordinary block it will return False (examples: signs, buttons, stairs, etc) */ public boolean renderAsNormalBlock() { return false; } /** * Is this block (a) opaque and (b) a full 1m cube? This determines whether or not to render the shared face of two * adjacent blocks and also whether the player can attach torches, redstone wire, etc to this block. */ public boolean isOpaqueCube() { return false; } /** * Updates the blocks bounds based on its current state. Args: world, x, y, z */ public void setBlockBoundsBasedOnState(IBlockAccess p_149719_1_, int p_149719_2_, int p_149719_3_, int p_149719_4_) { this.func_149978_e(); } /** * Lets the block know when one of its neighbor changes. Doesn't know which neighbor changed (coordinates passed are * their own) Args: x, y, z, neighbor Block */ public void onNeighborBlockChange(World p_149695_1_, int p_149695_2_, int p_149695_3_, int p_149695_4_, Block p_149695_5_) { int l = p_149695_1_.getBlockMetadata(p_149695_2_, p_149695_3_, p_149695_4_); int i1 = getDirection(l); if (isBlockHeadOfBed(l)) { if (p_149695_1_.getBlock(p_149695_2_ - field_149981_a[i1][0], p_149695_3_, p_149695_4_ - field_149981_a[i1][1]) != this) { p_149695_1_.setBlockToAir(p_149695_2_, p_149695_3_, p_149695_4_); } } else if (p_149695_1_.getBlock(p_149695_2_ + field_149981_a[i1][0], p_149695_3_, p_149695_4_ + field_149981_a[i1][1]) != this) { p_149695_1_.setBlockToAir(p_149695_2_, p_149695_3_, p_149695_4_); if (!p_149695_1_.isRemote) { this.dropBlockAsItem(p_149695_1_, p_149695_2_, p_149695_3_, p_149695_4_, l, 0); } } } public Item getItemDropped(int p_149650_1_, Random p_149650_2_, int p_149650_3_) { /** * Returns whether or not this bed block is the head of the bed. */ return isBlockHeadOfBed(p_149650_1_) ? Item.getItemById(0) : Items.bed; } private void func_149978_e() { this.setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 0.5625F, 1.0F); } /** * Returns whether or not this bed block is the head of the bed. */ public static boolean isBlockHeadOfBed(int p_149975_0_) { return (p_149975_0_ & != 0; } public static boolean func_149976_c(int p_149976_0_) { return (p_149976_0_ & 4) != 0; } public static void func_149979_a(World p_149979_0_, int p_149979_1_, int p_149979_2_, int p_149979_3_, boolean p_149979_4_) { int l = p_149979_0_.getBlockMetadata(p_149979_1_, p_149979_2_, p_149979_3_); if (p_149979_4_) { l |= 4; } else { l &= -5; } p_149979_0_.setBlockMetadataWithNotify(p_149979_1_, p_149979_2_, p_149979_3_, l, 4); } public static ChunkCoordinates func_149977_a(World p_149977_0_, int p_149977_1_, int p_149977_2_, int p_149977_3_, int p_149977_4_) { int i1 = p_149977_0_.getBlockMetadata(p_149977_1_, p_149977_2_, p_149977_3_); int j1 = BlockDirectional.getDirection(i1); for (int k1 = 0; k1 <= 1; ++k1) { int l1 = p_149977_1_ - field_149981_a[j1][0] * k1 - 1; int i2 = p_149977_3_ - field_149981_a[j1][1] * k1 - 1; int j2 = l1 + 2; int k2 = i2 + 2; for (int l2 = l1; l2 <= j2; ++l2) { for (int i3 = i2; i3 <= k2; ++i3) { if (World.doesBlockHaveSolidTopSurface(p_149977_0_, l2, p_149977_2_ - 1, i3) && !p_149977_0_.getBlock(l2, p_149977_2_, i3).getMaterial().isOpaque() && !p_149977_0_.getBlock(l2, p_149977_2_ + 1, i3).getMaterial().isOpaque()) { if (p_149977_4_ <= 0) { return new ChunkCoordinates(l2, p_149977_2_, i3); } --p_149977_4_; } } } } return null; } /** * Drops the block items with a specified chance of dropping the specified items */ public void dropBlockAsItemWithChance(World p_149690_1_, int p_149690_2_, int p_149690_3_, int p_149690_4_, int p_149690_5_, float p_149690_6_, int p_149690_7_) { if (!isBlockHeadOfBed(p_149690_5_)) { super.dropBlockAsItemWithChance(p_149690_1_, p_149690_2_, p_149690_3_, p_149690_4_, p_149690_5_, p_149690_6_, 0); } } /** * 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 1; } /** * Gets an item for the block being called on. Args: world, x, y, z */ @SideOnly(Side.CLIENT) public Item getItem(World p_149694_1_, int p_149694_2_, int p_149694_3_, int p_149694_4_) { return CMStuff.cobaltbed1; } /** * Called when the block is attempted to be harvested */ public void onBlockHarvested(World p_149681_1_, int p_149681_2_, int p_149681_3_, int p_149681_4_, int p_149681_5_, EntityPlayer p_149681_6_) { if (p_149681_6_.capabilities.isCreativeMode && isBlockHeadOfBed(p_149681_5_)) { int i1 = getDirection(p_149681_5_); p_149681_2_ -= field_149981_a[i1][0]; p_149681_4_ -= field_149981_a[i1][1]; if (p_149681_1_.getBlock(p_149681_2_, p_149681_3_, p_149681_4_) == this) { p_149681_1_.setBlockToAir(p_149681_2_, p_149681_3_, p_149681_4_); } } } public boolean isBed(IBlockAccess world, int x, int y, int z, EntityLivingBase player) { return this == CMStuff.cobaltbed; } } WorldProvider package cobaltmod.dimension; import cobaltmod.main.mod_cobalt; import net.minecraft.entity.player.EntityPlayerMP; import net.minecraft.util.ChunkCoordinates; import net.minecraft.world.WorldProvider; import net.minecraft.world.WorldSettings; import net.minecraft.world.chunk.IChunkProvider; public class WorldProviderCobalt extends WorldProvider { public void registerWorldChunkManager() { this.worldChunkMgr = new WorldChunkManagerCobalt(mod_cobalt.biomeplains, 0.8F); this.dimensionId = mod_cobalt.cobaltdimension; } public String getDimensionName() { return "Cobaltis"; } @Override public IChunkProvider createChunkGenerator() { return new ChunkProviderCobalt(worldObj, worldObj.getSeed(), true); } public String getSaveFolder() { return "Cobaltis"; } public boolean isSurfaceWorld() { return true; } public boolean canRespawnHere() { return true; } } And yes it's just copy paste of the normal Bed. I've put this in the Code. It works like the normal bed, but it isn't the best solution. if (enumstatus == EntityPlayer.EnumStatus.OK) { func_149979_a(p_149727_1_, p_149727_2_, p_149727_3_, p_149727_4_, true); System.out.println("WIIIIIIIIIIIIIIIIIIIIIIIH"); for (int zeit = 0; zeit < 1000000; ++zeit) { System.out.println(zeit); for (int j = 0; j < MinecraftServer.getServer().worldServers.length; ++j) { MinecraftServer.getServer().worldServers[j].setWorldTime(0); } } return true; }
  17. I will test it, if it works too. Hold on edit: Didn't find it yet ._.
  18. This doesn't going to work because the method is commented in the Code ... /* public BiomeGenBase[] getBiomesForWorldType() { return biomesForWorldType; } public void addNewBiome(BiomeGenBase biome) { Set<BiomeGenBase> newBiomesForWorld = Sets.newLinkedHashSet(Arrays.asList(biomesForWorldType)); newBiomesForWorld.add(biome); biomesForWorldType = newBiomesForWorld.toArray(new BiomeGenBase[0]); } public void removeBiome(BiomeGenBase biome) { Set<BiomeGenBase> newBiomesForWorld = Sets.newLinkedHashSet(Arrays.asList(biomesForWorldType)); newBiomesForWorld.remove(biome); biomesForWorldType = newBiomesForWorld.toArray(new BiomeGenBase[0]); } */
  19. So when i try to go to the next page of the creativetabs my game crashes, but not the server. But when i go to singleplayer first and then to multiplayer and click on the arrow it works. I deregistered(is this even a word ?) all my items/blocks and change the tabicon to the vanilla apple and it still crashes. Error Main Creativetab Probably it's a block/item again like last time when i got a noclassdeffounderror in my main and it was in a block class ._. The only place i found ItemStack.func_77960_j was in ItemStack.java.patch // JAVADOC METHOD $$ func_77960_j public int getItemDamage() { - return this.itemDamage; + return getItem().getDamage(this); } The only thing i can imagine is that my CreativeTab is broken, but why suddenly? I didn't change anything in my CreativeTab since i added it If someone wants to see the whole code i can give them the source. Edit; I delete all my mods(was only one that added another creativetab to the game) and it worked. Could it be a bug in forge? Edit edit: A friend told me it comes when you register your item/texture wrong. Yeah it seems like it was not my mod ._. If you got the same error test which of the mod crashes on multiplayer and report it to the author
  20. Don't know if it really fit in here, but now i get another error: It says that my class exist on compile but not when i start the game. The .class is in the folder so i don't understand what's the problem is. http://prntscr.com/3319we Without the changes i made before it doesn't happend, so ;_; Nevermind. a friend gave me his teleporter(even i didn't find any difference ), well now it works
  21. I know that, but it was the only solution. A friend of mine did the exact same and it worked ._. I would be glad, if you could still help me ^^ edit: Nevermind found the error I post the Code so other can use it. else if (thePlayer.dimension != mod_cobalt.cobaltdimension) { thePlayer.timeUntilPortal = 10; thePlayer.mcServer.getConfigurationManager().transferPlayerToDimension(thePlayer, mod_cobalt.cobaltdimension, new TeleporterCobalt(thePlayer.mcServer.worldServerForDimension(mod_cobalt.cobaltdimension))); } else { thePlayer.timeUntilPortal = 10; thePlayer.mcServer.getConfigurationManager().transferPlayerToDimension(thePlayer, 0, new TeleporterCobalt(thePlayer.mcServer.worldServerForDimension(0))); }
  22. Hey ^^ As soon as i go to my dimension a netherportal spawns instead of mine(using 1.7.2 forge 1046) My Dimension Normal Dimension http://abload.de/img/2014-03-20_18.34.29jds5c.png[/img] Main: public static BlockCobaltPortal cobaltportal; CMStuff.cobaltportal = (BlockCobaltPortal) new BlockCobaltPortal().setBlockName("cobaltportal").setBlockTextureName(MODID + ":cobaltportal"); BlockCobaltPortal ChunkProviderCobalt (too long) PortalPositionCobalt TeleporterCobalt WorldChunkManagerCobalt WorldproviderCobalt
  23. Well, i made custom leaves. When i chop down a tree, the leaves don't decay . It only works in the normal biomes of Minecraft ._.
  24. Thank you, thank you sooo much Finally my mod work again, because of you
×
×
  • Create New...

Important Information

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