public Fluid setBlockID(int blockID) { if (this.blockID == -1 || this.blockID == blockID) { this.blockID = blockID; } else if (!ForgeDummyContainer.forceDuplicateFluidBlockCrash) { FMLLog.warning("A mod has attempted to assign BlockID " + blockID + " to the Fluid '" + fluidName + "' but this Fluid has already been linked to BlockID " + this.blockID + ". Configure your mods to prevent this from happening."); } else { FMLLog.severe("A mod has attempted to assign BlockID " + blockID + " to the Fluid '" + fluidName + "' but this Fluid has already been linked to BlockID " + this.blockID + ". Configure your mods to prevent this from happening."); throw new LoaderException(new RuntimeException("A mod has attempted to assign BlockID " + blockID + " to the Fluid '" + fluidName + "' but this Fluid has already been linked to BlockID " + this.blockID + ". Configure your mods to prevent this from happening.")); } return this; }
/*********************************************************************************** * This function is here for compatibilities sake, Modders should Check for * Sided before ContainerWorldly, Vanilla Minecraft does not follow the * sided standard that Modding has for a while. * * In vanilla: * * Top: Ores Sides: Fuel Bottom: Output * * Standard Modding: Top: Ores Sides: Output Bottom: Fuel * * The Modding one is designed after the GUI, the vanilla one is designed * because its intended use is for the hopper, which logically would take * things in from the top. * * This will possibly be removed in future updates, and make vanilla the * definitive standard. */ @Override public int getStartInventorySide(ForgeDirection side){ if(ForgeDummyContainer.legacyFurnaceSides){ if(side==ForgeDirection.DOWN) return 1; if(side==ForgeDirection.UP) return 0; return 2; } else{ if(side==ForgeDirection.DOWN) return 2; if(side==ForgeDirection.UP) return 0; return 1; } }
protected void applyEntityAttributes() { super.applyEntityAttributes(); this.getEntityAttribute(SharedMonsterAttributes.followRange).setAttribute(20.0D); this.getEntityAttribute(SharedMonsterAttributes.movementSpeed).setAttribute(0.23000000417232513D); this.getEntityAttribute(SharedMonsterAttributes.attackDamage).setAttribute(3.0D); this.getAttributeMap().func_111150_b(field_110186_bp).setAttribute(this.rand.nextDouble() * ForgeDummyContainer.zombieSummonBaseChance); }
public static int getSkyBlendColour(World world, int playerX, int playerZ) { if (playerX == skyX && playerZ == skyZ && skyInit) { return skyRGBMultiplier; } skyInit = true; int distance = Minecraft.getMinecraft().gameSettings.fancyGraphics ? ForgeDummyContainer.blendRanges[Minecraft.getMinecraft().gameSettings.renderDistance] : 0; int r = 0; int g = 0; int b = 0; int divider = 0; for (int x = -distance; x <= distance; ++x) { for (int z = -distance; z <= distance; ++z) { BiomeGenBase biome = world.getBiomeGenForCoords(playerX + x, playerZ + z); int colour = biome.getSkyColorByTemp(biome.getFloatTemperature()); r += (colour & 0xFF0000) >> 16; g += (colour & 0x00FF00) >> 8; b += colour & 0x0000FF; divider++; } } int multiplier = (r / divider & 255) << 16 | (g / divider & 255) << 8 | b / divider & 255; skyX = playerX; skyZ = playerZ; skyRGBMultiplier = multiplier; return skyRGBMultiplier; }
protected void applyEntityAttributes() { super.applyEntityAttributes(); this.getEntityAttribute(SharedMonsterAttributes.followRange).setAttribute(40.0D); this.getEntityAttribute(SharedMonsterAttributes.movementSpeed).setAttribute(0.23000000417232513D); this.getEntityAttribute(SharedMonsterAttributes.attackDamage).setAttribute(3.0D); this.getAttributeMap().func_111150_b(field_110186_bp).setAttribute(this.rand.nextDouble() * ForgeDummyContainer.zombieSummonBaseChance); }
public ForgeNetworkHandler(ForgeDummyContainer container) { super(container,container.getClass().getAnnotation(NetworkMod.class)); configureNetworkMod(container); }
public EntityLivingData onSpawnWithEgg(EntityLivingData par1EntityLivingData) { Object par1EntityLivingData1 = super.onSpawnWithEgg(par1EntityLivingData); float f = this.worldObj.getLocationTensionFactor(this.posX, this.posY, this.posZ); this.setCanPickUpLoot(this.rand.nextFloat() < 0.55F * f); if (par1EntityLivingData1 == null) { par1EntityLivingData1 = new EntityZombieGroupData(this, this.worldObj.rand.nextFloat() < ForgeDummyContainer.zombieBabyChance, this.worldObj.rand.nextFloat() < 0.05F, (EntityZombieINNER1)null); } if (par1EntityLivingData1 instanceof EntityZombieGroupData) { EntityZombieGroupData entityzombiegroupdata = (EntityZombieGroupData)par1EntityLivingData1; if (entityzombiegroupdata.field_142046_b) { this.setVillager(true); } if (entityzombiegroupdata.field_142048_a) { this.setChild(true); } } this.addRandomArmor(); this.enchantEquipment(); if (this.getCurrentItemOrArmor(4) == null) { Calendar calendar = this.worldObj.getCurrentDate(); if (calendar.get(2) + 1 == 10 && calendar.get(5) == 31 && this.rand.nextFloat() < 0.25F) { this.setCurrentItemOrArmor(4, new ItemStack(this.rand.nextFloat() < 0.1F ? Block.pumpkinLantern : Block.pumpkin)); this.equipmentDropChances[4] = 0.0F; } } this.getEntityAttribute(SharedMonsterAttributes.knockbackResistance).applyModifier(new AttributeModifier("Random spawn bonus", this.rand.nextDouble() * 0.05000000074505806D, 0)); this.getEntityAttribute(SharedMonsterAttributes.followRange).applyModifier(new AttributeModifier("Random zombie-spawn bonus", this.rand.nextDouble() * 1.5D, 2)); if (this.rand.nextFloat() < f * 0.05F) { this.getEntityAttribute(field_110186_bp).applyModifier(new AttributeModifier("Leader zombie bonus", this.rand.nextDouble() * 0.25D + 0.5D, 0)); this.getEntityAttribute(SharedMonsterAttributes.maxHealth).applyModifier(new AttributeModifier("Leader zombie bonus", this.rand.nextDouble() * 3.0D + 1.0D, 2)); } return (EntityLivingData)par1EntityLivingData1; }
public Packet52MultiBlockChange(int par1, int par2, short[] par3ArrayOfShort, int par4, World par5World) { this.isChunkDataPacket = true; this.xPosition = par1; this.zPosition = par2; this.size = par4; int l = 4 * par4; Chunk chunk = par5World.getChunkFromChunkCoords(par1, par2); try { if (par4 >= ForgeDummyContainer.clumpingThreshold) { if (field_73449_e.length < l) { field_73449_e = new byte[l]; } } else { ByteArrayOutputStream bytearrayoutputstream = new ByteArrayOutputStream(l); DataOutputStream dataoutputstream = new DataOutputStream(bytearrayoutputstream); for (int i1 = 0; i1 < par4; ++i1) { int j1 = par3ArrayOfShort[i1] >> 12 & 15; int k1 = par3ArrayOfShort[i1] >> 8 & 15; int l1 = par3ArrayOfShort[i1] & 255; dataoutputstream.writeShort(par3ArrayOfShort[i1]); dataoutputstream.writeShort((short)((chunk.getBlockID(j1, l1, k1) & 4095) << 4 | chunk.getBlockMetadata(j1, l1, k1) & 15)); } this.metadataArray = bytearrayoutputstream.toByteArray(); if (this.metadataArray.length != l) { throw new RuntimeException("Expected length " + l + " doesn\'t match received length " + this.metadataArray.length); } } } catch (IOException ioexception) { this.field_98193_m.logSevereException("Couldn\'t create chunk packet", ioexception); this.metadataArray = null; } }
public void sendChunkUpdate() { if (this.numberOfTilesToUpdate != 0) { int i; int j; int k; if (this.numberOfTilesToUpdate == 1) { i = this.chunkLocation.chunkXPos * 16 + (this.locationOfBlockChange[0] >> 12 & 15); j = this.locationOfBlockChange[0] & 255; k = this.chunkLocation.chunkZPos * 16 + (this.locationOfBlockChange[0] >> 8 & 15); this.sendToAllPlayersWatchingChunk(new Packet53BlockChange(i, j, k, PlayerManager.getWorldServer(this.thePlayerManager))); if (PlayerManager.getWorldServer(this.thePlayerManager).blockHasTileEntity(i, j, k)) { this.sendTileToAllPlayersWatchingChunk(PlayerManager.getWorldServer(this.thePlayerManager).getBlockTileEntity(i, j, k)); } } else { int l; if (this.numberOfTilesToUpdate >= ForgeDummyContainer.clumpingThreshold) { i = this.chunkLocation.chunkXPos * 16; j = this.chunkLocation.chunkZPos * 16; this.sendToAllPlayersWatchingChunk(new Packet51MapChunk(PlayerManager.getWorldServer(this.thePlayerManager).getChunkFromChunkCoords(this.chunkLocation.chunkXPos, this.chunkLocation.chunkZPos), false, this.flagsYAreasToUpdate)); /* Forge: Grabs ALL tile entities is costly on a modded server, only send needed ones for (k = 0; k < 16; ++k) { if ((this.flagsYAreasToUpdate & 1 << k) != 0) { l = k << 4; List list = PlayerManager.getWorldServer(this.thePlayerManager).getAllTileEntityInBox(i, l, j, i + 16, l + 16, j + 16); for (int i1 = 0; i1 < list.size(); ++i1) { this.sendTileToAllPlayersWatchingChunk((TileEntity)list.get(i1)); } } } */ } else { this.sendToAllPlayersWatchingChunk(new Packet52MultiBlockChange(this.chunkLocation.chunkXPos, this.chunkLocation.chunkZPos, this.locationOfBlockChange, this.numberOfTilesToUpdate, PlayerManager.getWorldServer(this.thePlayerManager))); } { //Forge: Send only the tile entities that are updated, Adding this brace lets us keep the indent and the patch small for (i = 0; i < this.numberOfTilesToUpdate; ++i) { j = this.chunkLocation.chunkXPos * 16 + (this.locationOfBlockChange[i] >> 12 & 15); k = this.locationOfBlockChange[i] & 255; l = this.chunkLocation.chunkZPos * 16 + (this.locationOfBlockChange[i] >> 8 & 15); if (PlayerManager.getWorldServer(this.thePlayerManager).blockHasTileEntity(j, k, l)) { this.sendTileToAllPlayersWatchingChunk(PlayerManager.getWorldServer(this.thePlayerManager).getBlockTileEntity(j, k, l)); } } } } this.numberOfTilesToUpdate = 0; this.flagsYAreasToUpdate = 0; } }